Skip to content

Commit

Permalink
[10111] Move code for initialize player model data and scale to same …
Browse files Browse the repository at this point in the history
…function, InitDisplayIds

Signed-off-by: NoFantasy <nofantasy@nf.no>
  • Loading branch information
NoFantasy committed Jun 27, 2010
1 parent ef5b735 commit 1d39bbf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 30 deletions.
46 changes: 17 additions & 29 deletions src/game/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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]);
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10110"
#define REVISION_NR "10111"
#endif // __REVISION_NR_H__

0 comments on commit 1d39bbf

Please sign in to comment.