mirror of
https://github.com/araxiaonline/TrinityCore2.git
synced 2026-06-19 22:39:39 -04:00
Add helper Player::GetAverageItemLevel() function for future use in Dungeon Finder and vehicle scaling.
--HG-- branch : trunk
This commit is contained in:
@@ -24003,3 +24003,23 @@ void Player::_LoadRandomBGStatus(QueryResult_AutoPtr result)
|
||||
if (result)
|
||||
m_IsBGRandomWinner = true;
|
||||
}
|
||||
|
||||
float Player::GetAverageItemLevel()
|
||||
{
|
||||
uint32 sum = 0;
|
||||
uint32 count = 0;
|
||||
|
||||
for (int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
|
||||
{
|
||||
// don't check tabard, ranged, offhand or chest
|
||||
if (i == EQUIPMENT_SLOT_TABARD || i == EQUIPMENT_SLOT_RANGED || i == EQUIPMENT_SLOT_OFFHAND || i == EQUIPMENT_SLOT_CHEST)
|
||||
continue;
|
||||
|
||||
if (m_items[i] && m_items[i]->GetProto())
|
||||
sum += m_items[i]->GetProto()->ItemLevel;
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
return ((float)sum) / count;
|
||||
}
|
||||
|
||||
@@ -2347,6 +2347,8 @@ class Player : public Unit, public GridObject<Player>
|
||||
void SetChampioningFaction(uint32 faction) { m_ChampioningFaction = faction; }
|
||||
Spell * m_spellModTakingSpell;
|
||||
|
||||
float GetAverageItemLevel();
|
||||
|
||||
protected:
|
||||
uint32 m_AreaID;
|
||||
uint32 m_regenTimerCount;
|
||||
|
||||
Reference in New Issue
Block a user