[10111] Move code for initialize player model data and scale to same function, InitDisplayIds

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-06-27 13:12:44 +02:00
parent 2375a1cb71
commit 0757b43929
2 changed files with 18 additions and 30 deletions

View file

@ -687,19 +687,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
SetUInt32Value(UNIT_FIELD_BYTES_0, ( RaceClassGender | ( powertype << 24 ) ) );
InitDisplayIds();
if (CreatureModelInfo const* modelInfo = sObjectMgr.GetCreatureModelInfo(GetDisplayId()))
{
// bounding_radius and combat_reach is normally modified by scale, but player is always 1.0 scale by default so no need to modify values here.
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, modelInfo->bounding_radius);
SetFloatValue(UNIT_FIELD_COMBATREACH, modelInfo->combat_reach);
}
else
{
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE);
SetFloatValue(UNIT_FIELD_COMBATREACH, 1.5f);
}
InitDisplayIds(); // model, scale and model data
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP );
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE );
@ -2704,9 +2692,6 @@ void Player::InitStatsForLevel(bool reapplyMods)
// set default cast time multiplier
SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f);
// reset scale before reapply auras
SetObjectScale(DEFAULT_OBJECT_SCALE);
// save base values (bonuses already included in stored stats
for(int i = STAT_STRENGTH; i < MAX_STATS; ++i)
SetCreateStat(Stats(i), info.stats[i]);
@ -15004,19 +14989,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
_LoadIntoDataField(fields[60].GetString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE);
_LoadIntoDataField(fields[63].GetString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE*2);
InitDisplayIds();
if (CreatureModelInfo const* modelInfo = sObjectMgr.GetCreatureModelInfo(GetDisplayId()))
{
// bounding_radius and combat_reach is normally modified by scale, but player is always 1.0 scale by default so no need to modify values here.
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, modelInfo->bounding_radius);
SetFloatValue(UNIT_FIELD_COMBATREACH, modelInfo->combat_reach);
}
else
{
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE);
SetFloatValue(UNIT_FIELD_COMBATREACH, 1.5f);
}
InitDisplayIds(); // model, scale and model data
SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f);
@ -18458,6 +18431,21 @@ void Player::InitDisplayIds()
sLog.outError("Invalid gender %u for player",gender);
return;
}
// reset scale before reapply auras
SetObjectScale(DEFAULT_OBJECT_SCALE);
if (CreatureModelInfo const* modelInfo = sObjectMgr.GetCreatureModelInfo(GetDisplayId()))
{
// bounding_radius and combat_reach is normally modified by scale, but player is always 1.0 scale by default so no need to modify values here.
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, modelInfo->bounding_radius);
SetFloatValue(UNIT_FIELD_COMBATREACH, modelInfo->combat_reach);
}
else
{
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE);
SetFloatValue(UNIT_FIELD_COMBATREACH, 1.5f);
}
}
// Return true is the bought item has a max count to force refresh of window by caller