amir_cinderella
Exalted Member
Hey Guys!
I'm Here To Release This Little System That I Think Really Useful.
What It DoEs ?
Change Race / Gender .
http://pastebin.com/bufhSynr
and apply this diff in your source
I'm Here To Release This Little System That I Think Really Useful.
What It DoEs ?
Change Race / Gender .
http://pastebin.com/bufhSynr
and apply this diff in your source
Code:
diff --git a/src/game/Player.h b/src/game/Player.hindex e30701e..2692d51 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1707,6 +1707,8 @@ class Player : public Unit, public GridObject<Player>
TeamId GetTeamId() const { return m_team == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE; }
static uint32 getFactionForRace(uint8 race);
void setFactionForRace(uint8 race);
+
+ void InitDisplayIds();
bool IsAtGroupRewardDistance(WorldObject const* pRewardSource) const;
void RewardPlayerAndGroupAtKill(Unit* pVictim);
Code:
diff --git a/src/game/Player.cpp b/src/game/Player.cppindex 951b5b8..0d21414 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -543,7 +543,7 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE);
SetFloatValue(UNIT_FIELD_COMBATREACH, DEFAULT_COMBAT_REACH);
- switch(gender)
+ /* switch(gender)
{
case GENDER_FEMALE:
SetDisplayId(info->displayId_f);
@@ -557,13 +557,14 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c
sLog.outError("Invalid gender %u for player",gender);
return false;
break;
- }
+ }*/
setFactionForRace(race);
uint32 RaceClassGender = (race) | (class_ << 8) | (gender << 16);
SetUInt32Value(UNIT_FIELD_BYTES_0, (RaceClassGender | (powertype << 24)));
+ InitDisplayIds();
SetUInt32Value(UNIT_FIELD_BYTES_1, unitfield);
SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY | UNIT_BYTE2_FLAG_UNK5);
SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
@@ -14829,6 +14830,7 @@ bool Player::LoadFromDB(uint32 guid, SqlQueryHolder *holder)
SetUInt32Value(PLAYER_FLAGS, fields[12].GetUInt32());
SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[48].GetUInt32());
+ InitDisplayIds();
// cleanup inventory related item value fields (its will be filled correctly in _LoadInventory)
for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
{
@@ -16494,7 +16496,7 @@ void Player::SaveToDB()
SetByteValue(UNIT_FIELD_BYTES_2, 3, 0); // shapeshift
SetByteValue(UNIT_FIELD_BYTES_1, 3, 0); // stand flags?
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
- SetDisplayId(GetNativeDisplayId());
+ // SetDisplayId(GetNativeDisplayId());
std::string sql_name = m_name;
CharacterDatabase.escape_string(sql_name);
@@ -16639,7 +16641,7 @@ void Player::SaveToDB()
CharacterDatabase.CommitTransaction();
// restore state (before aura apply, if aura remove flag then aura must set it ack by self)
- SetDisplayId(tmp_displayid);
+ // SetDisplayId(tmp_displayid);
SetUInt32Value(UNIT_FIELD_BYTES_1, tmp_bytes);
SetUInt32Value(UNIT_FIELD_BYTES_2, tmp_bytes2);
SetUInt32Value(UNIT_FIELD_FLAGS, tmp_flags);
@@ -18276,6 +18278,31 @@ void Player::InitDataForForm(bool reapplyMods)
UpdateAttackPowerAndDamage();
UpdateAttackPowerAndDamage(true);
}
+void Player::InitDisplayIds()
+ {
+ PlayerInfo const *info = objmgr.GetPlayerInfo(getRace(), getClass());
+ if(!info)
+ {
+ sLog.outError("Player %u has incorrect race/class pair. Can't init display ids.", GetGUIDLow());
+ return;
+ }
+
+ uint8 gender = getGender();
+ switch(gender)
+ {
+ case GENDER_FEMALE:
+ SetDisplayId(info->displayId_f );
+ SetNativeDisplayId(info->displayId_f );
+ break;
+ case GENDER_MALE:
+ SetDisplayId(info->displayId_m );
+ SetNativeDisplayId(info->displayId_m );
+ break;
+ default:
+ sLog.outError("Invalid gender %u for player",gender);
+ return;
+ }
+ }
// Return true is the bought item has a max count to force refresh of window by caller
bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint8 bag, uint8 slot)
Last edited: