ilvl calculation fixed warfury use case (#1222)

* War fury detection fixed in GetEquipGearScore.

* fixing indentation

---------

Co-authored-by: Julien MAS <julien.mas81@gmail.com>
This commit is contained in:
Cryo81 2025-04-22 07:32:54 -03:00 committed by GitHub
parent 07e4dec70d
commit 04b8b76362
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4398,7 +4398,8 @@ void PlayerbotAI::RemoveShapeshift()
// RemoveAura("tree of life"); // RemoveAura("tree of life");
} }
// NOTE : function rewritten as flags "withBags" and "withBank" not used, and _fillGearScoreData sometimes attribute one-hand/2H Weapon in wrong slots // NOTE : function rewritten as flags "withBags" and "withBank" not used, and _fillGearScoreData sometimes attribute
// one-hand/2H Weapon in wrong slots
uint32 PlayerbotAI::GetEquipGearScore(Player* player) uint32 PlayerbotAI::GetEquipGearScore(Player* player)
{ {
// This function aims to calculate the equipped gear score // This function aims to calculate the equipped gear score
@ -4410,22 +4411,21 @@ uint32 PlayerbotAI::GetEquipGearScore(Player* player)
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
{ {
Item* item =player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); Item* item =player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
if (item && i != EQUIPMENT_SLOT_BODY && i != EQUIPMENT_SLOT_TABARD){ if (item && i != EQUIPMENT_SLOT_BODY && i != EQUIPMENT_SLOT_TABARD)
{
ItemTemplate const* proto = item->GetTemplate(); ItemTemplate const* proto = item->GetTemplate();
sum += proto->ItemLevel; sum += proto->ItemLevel;
//if character is not warfury and have 2 hand weapon equipped, main hand will be counted twice // If character is not warfury and have 2 hand weapon equipped, main hand will be counted twice
if (i == SLOT_MAIN_HAND) if (i == SLOT_MAIN_HAND)
mh_type = item->GetTemplate()->InventoryType; mh_type = item->GetTemplate()->InventoryType;
if(!player->HasSpell(SPELL_TITAN_GRIP) && mh_type == INVTYPE_2HWEAPON && i == SLOT_MAIN_HAND) if (!player->HasAura(SPELL_TITAN_GRIP) && mh_type == INVTYPE_2HWEAPON && i == SLOT_MAIN_HAND)
sum += item->GetTemplate()->ItemLevel; sum += item->GetTemplate()->ItemLevel;
} }
} }
uint32 gs = uint32(sum / count); uint32 gs = uint32(sum / count);
return gs; return gs;
} }
/*uint32 PlayerbotAI::GetEquipGearScore(Player* player, bool withBags, bool withBank) /*uint32 PlayerbotAI::GetEquipGearScore(Player* player, bool withBags, bool withBank)