mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-08 01:42:26 +00:00
[Bug Fix] Edge cases where min_drop 1 not honored with valid choices (#1617)
* [Bug Fix] Edge cases where min_drop 1 not honored with valid choices * Forgot header file change. * Remove verbose option from MeetsLootDropLevelRequirements per @akka * Fix spacing * Restore verbose mode after further consideration * Remove logging on counting of valid items Co-authored-by: Noudess <noudess@gmail.com>
This commit is contained in:
parent
0b18671e91
commit
62253cc016
@ -133,7 +133,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC *npc, uint32 lootdrop_id, ItemList *item
|
|||||||
int charges = loot_drop->Entries[i].multiplier;
|
int charges = loot_drop->Entries[i].multiplier;
|
||||||
for (int j = 0; j < charges; ++j) {
|
for (int j = 0; j < charges; ++j) {
|
||||||
if (zone->random.Real(0.0, 100.0) <= loot_drop->Entries[i].chance &&
|
if (zone->random.Real(0.0, 100.0) <= loot_drop->Entries[i].chance &&
|
||||||
npc->MeetsLootDropLevelRequirements(loot_drop->Entries[i])) {
|
npc->MeetsLootDropLevelRequirements(loot_drop->Entries[i], true)) {
|
||||||
const EQ::ItemData *database_item = GetItem(loot_drop->Entries[i].item_id);
|
const EQ::ItemData *database_item = GetItem(loot_drop->Entries[i].item_id);
|
||||||
npc->AddLootDrop(
|
npc->AddLootDrop(
|
||||||
database_item,
|
database_item,
|
||||||
@ -155,29 +155,29 @@ void ZoneDatabase::AddLootDropToNPC(NPC *npc, uint32 lootdrop_id, ItemList *item
|
|||||||
}
|
}
|
||||||
|
|
||||||
float roll_t = 0.0f;
|
float roll_t = 0.0f;
|
||||||
float roll_t_min = 0.0f;
|
|
||||||
bool active_item_list = false;
|
bool active_item_list = false;
|
||||||
for (uint32 i = 0; i < loot_drop->NumEntries; ++i) {
|
for (uint32 i = 0; i < loot_drop->NumEntries; ++i) {
|
||||||
const EQ::ItemData *db_item = GetItem(loot_drop->Entries[i].item_id);
|
const EQ::ItemData *db_item = GetItem(loot_drop->Entries[i].item_id);
|
||||||
if (db_item) {
|
if (db_item && npc->MeetsLootDropLevelRequirements(loot_drop->Entries[i])) {
|
||||||
roll_t += loot_drop->Entries[i].chance;
|
roll_t += loot_drop->Entries[i].chance;
|
||||||
active_item_list = true;
|
active_item_list = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
roll_t_min = roll_t;
|
|
||||||
roll_t = EQ::ClampLower(roll_t, 100.0f);
|
|
||||||
|
|
||||||
if (!active_item_list) {
|
if (!active_item_list) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < mindrop; ++i) {
|
for (int i = 0; i < mindrop; ++i) {
|
||||||
float roll = (float) zone->random.Real(0.0, roll_t_min);
|
float roll = (float) zone->random.Real(0.0, roll_t);
|
||||||
for (uint32 j = 0; j < loot_drop->NumEntries; ++j) {
|
for (uint32 j = 0; j < loot_drop->NumEntries; ++j) {
|
||||||
const EQ::ItemData *db_item = GetItem(loot_drop->Entries[j].item_id);
|
const EQ::ItemData *db_item = GetItem(loot_drop->Entries[j].item_id);
|
||||||
if (db_item) {
|
if (db_item) {
|
||||||
if (roll < loot_drop->Entries[j].chance && npc->MeetsLootDropLevelRequirements(loot_drop->Entries[j])) {
|
// if it doesn't meet the requirements do nothing
|
||||||
|
if (!npc->MeetsLootDropLevelRequirements(loot_drop->Entries[j]))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (roll < loot_drop->Entries[j].chance) {
|
||||||
npc->AddLootDrop(
|
npc->AddLootDrop(
|
||||||
db_item,
|
db_item,
|
||||||
item_list,
|
item_list,
|
||||||
@ -213,7 +213,11 @@ void ZoneDatabase::AddLootDropToNPC(NPC *npc, uint32 lootdrop_id, ItemList *item
|
|||||||
for (uint32 j = 0; j < loot_drop->NumEntries; ++j) {
|
for (uint32 j = 0; j < loot_drop->NumEntries; ++j) {
|
||||||
const EQ::ItemData *db_item = GetItem(loot_drop->Entries[j].item_id);
|
const EQ::ItemData *db_item = GetItem(loot_drop->Entries[j].item_id);
|
||||||
if (db_item) {
|
if (db_item) {
|
||||||
if (roll < loot_drop->Entries[j].chance && npc->MeetsLootDropLevelRequirements(loot_drop->Entries[j])) {
|
// if it doesn't meet the requirements do nothing
|
||||||
|
if (!npc->MeetsLootDropLevelRequirements(loot_drop->Entries[j]))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (roll < loot_drop->Entries[j].chance) {
|
||||||
npc->AddLootDrop(
|
npc->AddLootDrop(
|
||||||
db_item,
|
db_item,
|
||||||
item_list,
|
item_list,
|
||||||
@ -250,27 +254,31 @@ void ZoneDatabase::AddLootDropToNPC(NPC *npc, uint32 lootdrop_id, ItemList *item
|
|||||||
// npc->SendAppearancePacket(AT_Light, npc->GetActiveLightValue());
|
// npc->SendAppearancePacket(AT_Light, npc->GetActiveLightValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NPC::MeetsLootDropLevelRequirements(LootDropEntries_Struct loot_drop)
|
bool NPC::MeetsLootDropLevelRequirements(LootDropEntries_Struct loot_drop, bool verbose)
|
||||||
{
|
{
|
||||||
if (loot_drop.npc_min_level > 0 && GetLevel() < loot_drop.npc_min_level) {
|
if (loot_drop.npc_min_level > 0 && GetLevel() < loot_drop.npc_min_level) {
|
||||||
LogLootDetail(
|
if (verbose) {
|
||||||
"NPC [{}] does not meet loot_drop level requirements (min_level) level [{}] current [{}] for item [{}]",
|
LogLootDetail(
|
||||||
GetCleanName(),
|
"NPC [{}] does not meet loot_drop level requirements (min_level) level [{}] current [{}] for item [{}]",
|
||||||
loot_drop.npc_min_level,
|
GetCleanName(),
|
||||||
GetLevel(),
|
loot_drop.npc_min_level,
|
||||||
database.CreateItemLink(loot_drop.item_id)
|
GetLevel(),
|
||||||
);
|
database.CreateItemLink(loot_drop.item_id)
|
||||||
|
);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loot_drop.npc_max_level > 0 && GetLevel() > loot_drop.npc_max_level) {
|
if (loot_drop.npc_max_level > 0 && GetLevel() > loot_drop.npc_max_level) {
|
||||||
LogLootDetail(
|
if (verbose) {
|
||||||
"NPC [{}] does not meet loot_drop level requirements (max_level) level [{}] current [{}] for item [{}]",
|
LogLootDetail(
|
||||||
GetCleanName(),
|
"NPC [{}] does not meet loot_drop level requirements (max_level) level [{}] current [{}] for item [{}]",
|
||||||
loot_drop.npc_max_level,
|
GetCleanName(),
|
||||||
GetLevel(),
|
loot_drop.npc_max_level,
|
||||||
database.CreateItemLink(loot_drop.item_id)
|
GetLevel(),
|
||||||
);
|
database.CreateItemLink(loot_drop.item_id)
|
||||||
|
);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -314,7 +314,7 @@ public:
|
|||||||
uint32 aug6 = 0
|
uint32 aug6 = 0
|
||||||
);
|
);
|
||||||
|
|
||||||
bool MeetsLootDropLevelRequirements(LootDropEntries_Struct loot_drop);
|
bool MeetsLootDropLevelRequirements(LootDropEntries_Struct loot_drop, bool verbose=false);
|
||||||
|
|
||||||
virtual void DoClassAttacks(Mob *target);
|
virtual void DoClassAttacks(Mob *target);
|
||||||
void CheckSignal();
|
void CheckSignal();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user