Add helper Player::GetAverageItemLevel() function for future use in Dungeon Finder and vehicle scaling.

--HG--
branch : trunk
This commit is contained in:
silinoron
2010-08-05 14:18:33 -07:00
parent 309970936c
commit 71ef21de21
2 changed files with 22 additions and 0 deletions
@@ -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;
}
+2
View File
@@ -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;