mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-14 19:51:29 +00:00
[Bug Fix] Fix issue with NPCs no longer using some armor. (#3318)
* [BugFix/NPCs] Fix issue with NPCs no longer using some armor. * Removed redundant memory clear
This commit is contained in:
parent
8b1d64a043
commit
e19b8d3056
@ -58,16 +58,10 @@ void Mob::CalcBonuses()
|
|||||||
void NPC::CalcBonuses()
|
void NPC::CalcBonuses()
|
||||||
{
|
{
|
||||||
memset(&itembonuses, 0, sizeof(StatBonuses));
|
memset(&itembonuses, 0, sizeof(StatBonuses));
|
||||||
if (RuleB(NPC, UseItemBonusesForNonPets)) {
|
|
||||||
memset(&itembonuses, 0, sizeof(StatBonuses));
|
if (GetOwner() || RuleB(NPC, UseItemBonusesForNonPets)) {
|
||||||
CalcItemBonuses(&itembonuses);
|
CalcItemBonuses(&itembonuses);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if (GetOwner()) {
|
|
||||||
memset(&itembonuses, 0, sizeof(StatBonuses));
|
|
||||||
CalcItemBonuses(&itembonuses);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// This has to happen last, so we actually take the item bonuses into account.
|
// This has to happen last, so we actually take the item bonuses into account.
|
||||||
Mob::CalcBonuses();
|
Mob::CalcBonuses();
|
||||||
@ -268,7 +262,7 @@ void Mob::AddItemBonuses(const EQ::ItemInstance* inst, StatBonuses* b, bool is_a
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_tribute && !inst->IsEquipable(GetBaseRace(), GetClass())) {
|
if (IsClient() && !is_tribute && !inst->IsEquipable(GetBaseRace(), GetClass())) {
|
||||||
if (item->ItemType != EQ::item::ItemTypeFood && item->ItemType != EQ::item::ItemTypeDrink) {
|
if (item->ItemType != EQ::item::ItemTypeFood && item->ItemType != EQ::item::ItemTypeDrink) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -276,14 +270,14 @@ void Mob::AddItemBonuses(const EQ::ItemInstance* inst, StatBonuses* b, bool is_a
|
|||||||
|
|
||||||
const auto current_level = GetLevel();
|
const auto current_level = GetLevel();
|
||||||
|
|
||||||
if (current_level < inst->GetItemRequiredLevel(true)) {
|
if (IsClient() && current_level < inst->GetItemRequiredLevel(true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_ammo_item) {
|
if (!is_ammo_item) {
|
||||||
const auto recommended_level = is_augment ? recommended_level_override : inst->GetItemRecommendedLevel(true);
|
const auto recommended_level = is_augment ? recommended_level_override : inst->GetItemRecommendedLevel(true);
|
||||||
|
|
||||||
if (current_level >= recommended_level) {
|
if (IsNPC() || current_level >= recommended_level) {
|
||||||
b->HP += item->HP;
|
b->HP += item->HP;
|
||||||
b->Mana += item->Mana;
|
b->Mana += item->Mana;
|
||||||
b->Endurance += item->Endur;
|
b->Endurance += item->Endur;
|
||||||
|
|||||||
@ -361,11 +361,12 @@ void NPC::AddLootDrop(
|
|||||||
SetArrowEquipped(true);
|
SetArrowEquipped(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool found = false; // track if we found an empty slot we fit into
|
||||||
|
|
||||||
if (loot_drop.equip_item > 0) {
|
if (loot_drop.equip_item > 0) {
|
||||||
uint8 eslot = 0xFF;
|
uint8 eslot = 0xFF;
|
||||||
char newid[20];
|
char newid[20];
|
||||||
const EQ::ItemData* compitem = nullptr;
|
const EQ::ItemData* compitem = nullptr;
|
||||||
bool found = false; // track if we found an empty slot we fit into
|
|
||||||
int32 foundslot = -1; // for multi-slot items
|
int32 foundslot = -1; // for multi-slot items
|
||||||
|
|
||||||
// Equip rules are as follows:
|
// Equip rules are as follows:
|
||||||
@ -500,7 +501,6 @@ void NPC::AddLootDrop(
|
|||||||
|
|
||||||
}
|
}
|
||||||
if (found) {
|
if (found) {
|
||||||
CalcBonuses(); // This is less than ideal for bulk adding of items
|
|
||||||
item->equip_slot = foundslot;
|
item->equip_slot = foundslot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -510,6 +510,10 @@ void NPC::AddLootDrop(
|
|||||||
}
|
}
|
||||||
else safe_delete(item);
|
else safe_delete(item);
|
||||||
|
|
||||||
|
if (found) {
|
||||||
|
CalcBonuses();
|
||||||
|
}
|
||||||
|
|
||||||
if (IsRecordLootStats()) {
|
if (IsRecordLootStats()) {
|
||||||
m_rolled_items.emplace_back(item->item_id);
|
m_rolled_items.emplace_back(item->item_id);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user