Created
April 16, 2014 18:04
-
-
Save irancore/10914735 to your computer and use it in GitHub Desktop.
[OregonCore] Change Race / Gender C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Coded By Amir_Cinderella | |
Skype : Amir.Cinderella | |
Email : [email protected] | |
WebSite : WwW.IranCore.Ir | |
*/ | |
#include "ScriptPCH.h" | |
#include "ScriptedGossip.h" | |
#include "Player.h" | |
#include "GossipDef.h" | |
#include "Spell.h" | |
#include "World.h" | |
#include "Chat.h" | |
#include "Language.h" | |
bool GossipHello_racechanger(Player* player, Creature* creature) | |
{ | |
if(player->isInCombat()) | |
{ | |
return true; | |
} | |
if(player->isDead()) | |
{ | |
return true; | |
} | |
player->ADD_GOSSIP_ITEM( 0, "Gender Change" , GOSSIP_SENDER_MAIN, 5); | |
player->ADD_GOSSIP_ITEM( 0, "Race Change" , GOSSIP_SENDER_MAIN, 2); | |
player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); | |
return true; | |
} | |
bool GossipSelect_racechanger(Player *player, Creature *creature, uint32 Id, uint32 action) | |
{ | |
switch(action) | |
{ | |
//START OF THE GENDER CHANGE | |
case 5: | |
player->ADD_GOSSIP_ITEM( 0, "~Continue With The Gender Change~" ,GOSSIP_SENDER_MAIN, 101); | |
player->ADD_GOSSIP_ITEM( 0, "~Main Menu~" ,GOSSIP_SENDER_MAIN, 100); | |
player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); | |
break; | |
case 101: | |
Gender gender; | |
if(player->getGender() == GENDER_FEMALE) | |
{ | |
gender = GENDER_MALE; | |
} | |
else | |
{ | |
gender = GENDER_FEMALE; | |
} | |
player->InitDisplayIds(); | |
player->SetByteValue(UNIT_FIELD_BYTES_0, 2, gender); | |
player->SetByteValue(PLAYER_BYTES_3, 0, gender); | |
player->GetSession()->SendAreaTriggerMessage("Gender has been changed!"); | |
player->CLOSE_GOSSIP_MENU(); | |
break; | |
//END OF GENDER CHANGE | |
//START OF RACE CHANGE | |
case 2: | |
if((player->GetTeam() == ALLIANCE && player->getRace() != RACE_DRAENEI && player->getClass() != CLASS_WARLOCK && player->getClass() != CLASS_ROGUE && player->getClass() != CLASS_DRUID) && (player->getRace() == RACE_NIGHTELF || player->getRace() == RACE_HUMAN || player->getRace() == RACE_GNOME || player->getRace() == RACE_DWARF)) | |
player->ADD_GOSSIP_ITEM( 0, "~Draenei~" , GOSSIP_SENDER_MAIN, 200); | |
if((player->GetTeam() == ALLIANCE && player->getRace() != RACE_DWARF && player->getClass() != CLASS_WARLOCK && player->getClass() != CLASS_SHAMAN && player->getClass() != CLASS_MAGE && player->getClass() != CLASS_DRUID) && (player->getRace() == RACE_NIGHTELF || player->getRace() == RACE_HUMAN || player->getRace() == RACE_GNOME || player->getRace() == RACE_DRAENEI)) | |
player->ADD_GOSSIP_ITEM( 0, "~Dwarf~" , GOSSIP_SENDER_MAIN, 201); | |
if((player->GetTeam() == ALLIANCE && player->getRace() != RACE_GNOME) && (player->getClass() == CLASS_WARRIOR || player->getClass() == CLASS_ROGUE || player->getClass() == CLASS_MAGE || player->getClass() == CLASS_WARLOCK || player->getClass() == CLASS_DEATH_KNIGHT) && (player->getRace() == RACE_NIGHTELF || player->getRace() == RACE_HUMAN || player->getRace() == RACE_DWARF || player->getRace() == RACE_DRAENEI)) | |
player->ADD_GOSSIP_ITEM( 0, "~Gnome~" , GOSSIP_SENDER_MAIN, 202); | |
if((player->GetTeam() == ALLIANCE && player->getRace() != RACE_HUMAN && player->getClass() != CLASS_DRUID && player->getClass() != CLASS_SHAMAN && player->getClass() != CLASS_HUNTER) && (player->getRace() == RACE_NIGHTELF || player->getRace() == RACE_GNOME || player->getRace() == RACE_DWARF || player->getRace() == RACE_DRAENEI)) | |
player->ADD_GOSSIP_ITEM( 0, "~Human~" , GOSSIP_SENDER_MAIN, 203); | |
if((player->GetTeam() == ALLIANCE && player->getRace() != RACE_NIGHTELF && player->getClass() != CLASS_MAGE && player->getClass() != CLASS_PALADIN && player->getClass() != CLASS_SHAMAN && player->getClass() != CLASS_WARLOCK) && (player->getRace() == RACE_HUMAN || player->getRace() == RACE_GNOME || player->getRace() == RACE_DWARF || player->getRace() == RACE_DRAENEI)) | |
player->ADD_GOSSIP_ITEM( 0, "~Night Elf~" , GOSSIP_SENDER_MAIN, 204); | |
if((player->GetTeam() == HORDE && player->getRace() != RACE_BLOODELF && player->getClass() != CLASS_WARRIOR && player->getClass() != CLASS_SHAMAN && player->getClass() != CLASS_DRUID) && (player->getRace() == RACE_ORC || player->getRace() == RACE_TAUREN || player->getRace() == RACE_TROLL || player->getRace() == RACE_UNDEAD_PLAYER)) | |
player->ADD_GOSSIP_ITEM( 0, "~Blood Elf~" , GOSSIP_SENDER_MAIN, 205); | |
if((player->GetTeam() == HORDE && player->getRace() != RACE_ORC && player->getClass() != CLASS_MAGE && player->getClass() != CLASS_PALADIN && player->getClass() != CLASS_PRIEST && player->getClass() != CLASS_DRUID) && (player->getRace() == RACE_BLOODELF || player->getRace() == RACE_TAUREN || player->getRace() == RACE_TROLL || player->getRace() == RACE_UNDEAD_PLAYER)) | |
player->ADD_GOSSIP_ITEM( 0, "~Orc~" , GOSSIP_SENDER_MAIN, 206); | |
if((player->GetTeam() == HORDE && player->getRace() != RACE_TAUREN) && (player->getClass() == CLASS_WARRIOR || player->getClass() == CLASS_SHAMAN || player->getClass() == CLASS_HUNTER || player->getClass() == CLASS_DRUID || player->getClass() == CLASS_DEATH_KNIGHT) && (player->getRace() == RACE_BLOODELF || player->getRace() == RACE_ORC || player->getRace() == RACE_TROLL || player->getRace() == RACE_UNDEAD_PLAYER)) | |
player->ADD_GOSSIP_ITEM( 0, "~Tauren~" , GOSSIP_SENDER_MAIN, 207); | |
if((player->GetTeam() == HORDE && player->getRace() != RACE_TROLL && player->getClass() != CLASS_WARLOCK && player->getClass() != CLASS_PALADIN && player->getClass() != CLASS_DRUID) && (player->getRace() == RACE_BLOODELF || player->getRace() == RACE_ORC || player->getRace() == RACE_TAUREN || player->getRace() == RACE_UNDEAD_PLAYER)) | |
player->ADD_GOSSIP_ITEM( 0, "~Troll~" , GOSSIP_SENDER_MAIN, 208); | |
if((player->GetTeam() == HORDE && player->getRace() != RACE_UNDEAD_PLAYER && player->getClass() != CLASS_SHAMAN && player->getClass() != CLASS_PALADIN && player->getClass() != CLASS_HUNTER && player->getClass() != CLASS_DRUID) && (player->getRace() == RACE_BLOODELF || player->getRace() == RACE_ORC || player->getRace() == RACE_TAUREN || player->getRace() == RACE_TROLL)) | |
player->ADD_GOSSIP_ITEM( 0, "~Undead~" , GOSSIP_SENDER_MAIN, 209); | |
player->ADD_GOSSIP_ITEM( 0, "~Main Menu~" ,GOSSIP_SENDER_MAIN, 100); | |
player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); | |
break; | |
case 200: | |
player->SetByteValue(UNIT_FIELD_BYTES_0, 0, RACE_DRAENEI); | |
player->InitDisplayIds(); | |
player->learnSpell(28880), | |
// started spell undead removed | |
player->removeSpell(7744), | |
player->removeSpell(5227), | |
//player->removeSpell(27353), | |
player->removeSpell(20577), | |
// end spell undead | |
// start remove spell orc | |
player->removeSpell(20573), | |
player->removeSpell(20572), | |
// end remove spell orc | |
// start remove spell tauren | |
player->removeSpell(46026), | |
player->removeSpell(20550), | |
// end remove spell tauren | |
// start remove spell troll | |
player->removeSpell(26296), | |
player->removeSpell(20557), | |
player->removeSpell(26290), | |
// end remove spell tauren | |
// start remove spell blood elf | |
player->removeSpell(28734), | |
player->removeSpell(28730), | |
// end remove spell blood elf | |
// start remove spell Human | |
player->removeSpell(20600), | |
player->removeSpell(4362), | |
// end remove spell Human | |
// start remove spell night elf | |
player->removeSpell(20580), | |
// end remove spell night elf | |
// start remove spell dwarf | |
player->removeSpell(20594), | |
// end remove spell dwarf | |
// start remove spell gnome | |
player->removeSpell(20589), | |
player->removeSpell(20591), | |
player->removeSpell(20593), | |
// end remove spell gnome | |
player->CLOSE_GOSSIP_MENU(); | |
player->GetSession()->KickPlayer(); | |
return false; | |
break; | |
case 201: | |
player->SetByteValue(UNIT_FIELD_BYTES_0, 0, RACE_DWARF); | |
player->InitDisplayIds(); | |
player->learnSpell(20594), | |
// started spell undead removed | |
player->removeSpell(7744), | |
player->removeSpell(5227), | |
//player->removeSpell(27353), | |
player->removeSpell(20577), | |
// end spell undead | |
// start remove spell orc | |
player->removeSpell(20573), | |
player->removeSpell(20572), | |
// end remove spell orc | |
// start remove spell tauren | |
player->removeSpell(46026), | |
player->removeSpell(20550), | |
// end remove spell tauren | |
// start remove spell troll | |
player->removeSpell(26296), | |
player->removeSpell(20557), | |
player->removeSpell(26290), | |
// end remove spell tauren | |
// start remove spell blood elf | |
player->removeSpell(28734), | |
player->removeSpell(28730), | |
// end remove spell blood elf | |
// start remove spell Human | |
player->removeSpell(20600), | |
player->removeSpell(4362), | |
// end remove spell Human | |
// start remove spell night elf | |
player->removeSpell(20580), | |
// end remove spell night elf | |
// start remove spell gnome | |
player->removeSpell(20589), | |
player->removeSpell(20591), | |
player->removeSpell(20593), | |
// end remove spell gnome | |
// start remove spell DRAENEI | |
player->removeSpell(28880), | |
// end remove spell DRAENEI | |
player->CLOSE_GOSSIP_MENU(); | |
player->GetSession()->KickPlayer(); | |
return false; | |
break; | |
case 202 : | |
player->SetByteValue(UNIT_FIELD_BYTES_0, 0, RACE_GNOME); | |
player->InitDisplayIds(); | |
player->learnSpell(20589), | |
player->learnSpell(20591), | |
player->learnSpell(20593), | |
// started spell undead removed | |
player->removeSpell(7744), | |
player->removeSpell(5227), | |
//player->removeSpell(27353), | |
player->removeSpell(20577), | |
// end spell undead | |
// start remove spell orc | |
player->removeSpell(20573), | |
player->removeSpell(20572), | |
// end remove spell orc | |
// start remove spell tauren | |
player->removeSpell(46026), | |
player->removeSpell(20550), | |
// end remove spell tauren | |
// start remove spell troll | |
player->removeSpell(26296), | |
player->removeSpell(20557), | |
player->removeSpell(26290), | |
// end remove spell tauren | |
// start remove spell blood elf | |
player->removeSpell(28734), | |
player->removeSpell(28730), | |
// end remove spell blood elf | |
// start remove spell Human | |
player->removeSpell(20600), | |
player->removeSpell(4362), | |
// end remove spell Human | |
// start remove spell night elf | |
player->removeSpell(20580), | |
// end remove spell night elf | |
// start remove spell dwarf | |
player->removeSpell(20594), | |
// end remove spell dwarf | |
// start remove spell DRAENEI | |
player->removeSpell(28880), | |
// end remove spell DRAENEI | |
player->CLOSE_GOSSIP_MENU(); | |
player->GetSession()->KickPlayer(); | |
return false; | |
break; | |
case 203 : | |
player->SetByteValue(UNIT_FIELD_BYTES_0, 0, RACE_HUMAN); | |
player->InitDisplayIds(); | |
player->learnSpell(20600), | |
player->learnSpell(4362), | |
// started spell undead removed | |
player->removeSpell(7744), | |
player->removeSpell(5227), | |
//player->removeSpell(27353), | |
player->removeSpell(20577), | |
// end spell undead | |
// start remove spell orc | |
player->removeSpell(20573), | |
player->removeSpell(20572), | |
// end remove spell orc | |
// start remove spell tauren | |
player->removeSpell(46026), | |
player->removeSpell(20550), | |
// end remove spell tauren | |
// start remove spell troll | |
player->removeSpell(26296), | |
player->removeSpell(20557), | |
player->removeSpell(26290), | |
// end remove spell tauren | |
// start remove spell blood elf | |
player->removeSpell(28734), | |
player->removeSpell(28730), | |
// end remove spell blood elf | |
// start remove spell night elf | |
player->removeSpell(20580), | |
// end remove spell night elf | |
// start remove spell dwarf | |
player->removeSpell(20594), | |
// end remove spell dwarf | |
// start remove spell gnome | |
player->removeSpell(20589), | |
player->removeSpell(20591), | |
player->removeSpell(20593), | |
// end remove spell gnome | |
// start remove spell DRAENEI | |
player->removeSpell(28880), | |
// end remove spell DRAENEI | |
player->CLOSE_GOSSIP_MENU(); | |
player->GetSession()->KickPlayer(); | |
return false; | |
break; | |
case 204 : | |
player->SetByteValue(UNIT_FIELD_BYTES_0, 0, RACE_NIGHTELF); | |
player->InitDisplayIds(); | |
player->learnSpell(20580), | |
// started spell undead removed | |
player->removeSpell(7744), | |
player->removeSpell(5227), | |
//player->removeSpell(27353), | |
player->removeSpell(20577), | |
// end spell undead | |
// start remove spell orc | |
player->removeSpell(20573), | |
player->removeSpell(20572), | |
// end remove spell orc | |
// start remove spell tauren | |
player->removeSpell(46026), | |
player->removeSpell(20550), | |
// end remove spell tauren | |
// start remove spell troll | |
player->removeSpell(26296), | |
player->removeSpell(20557), | |
player->removeSpell(26290), | |
// end remove spell tauren | |
// start remove spell blood elf | |
player->removeSpell(28734), | |
player->removeSpell(28730), | |
// end remove spell blood elf | |
// start remove spell Human | |
player->removeSpell(20600), | |
player->removeSpell(4362), | |
// end remove spell Human | |
// start remove spell dwarf | |
player->removeSpell(20594), | |
// end remove spell dwarf | |
// start remove spell gnome | |
player->removeSpell(20589), | |
player->removeSpell(20591), | |
player->removeSpell(20593), | |
// end remove spell gnome | |
// start remove spell DRAENEI | |
player->removeSpell(28880), | |
// end remove spell DRAENEI | |
player->CLOSE_GOSSIP_MENU(); | |
player->GetSession()->KickPlayer(); | |
return false; | |
break; | |
case 205 : | |
player->SetByteValue(UNIT_FIELD_BYTES_0, 0, RACE_BLOODELF); | |
player->InitDisplayIds(); | |
player->learnSpell(28734), | |
player->learnSpell(28730), | |
// started spell undead removed | |
player->removeSpell(7744), | |
player->removeSpell(5227), | |
//player->removeSpell(27353), | |
player->removeSpell(20577), | |
// end spell undead | |
// start remove spell orc | |
player->removeSpell(20573), | |
player->removeSpell(20572), | |
// end remove spell orc | |
// start remove spell tauren | |
player->removeSpell(46026), | |
player->removeSpell(20550), | |
// end remove spell tauren | |
// start remove spell troll | |
player->removeSpell(26296), | |
player->removeSpell(20557), | |
player->removeSpell(26290), | |
// end remove spell tauren | |
// start remove spell Human | |
player->removeSpell(20600), | |
player->removeSpell(4362), | |
// end remove spell Human | |
// start remove spell night elf | |
player->removeSpell(20580), | |
// end remove spell night elf | |
// start remove spell dwarf | |
player->removeSpell(20594), | |
// end remove spell dwarf | |
// start remove spell gnome | |
player->removeSpell(20589), | |
player->removeSpell(20591), | |
player->removeSpell(20593), | |
// end remove spell gnome | |
// start remove spell DRAENEI | |
player->removeSpell(28880), | |
// end remove spell DRAENEI | |
player->CLOSE_GOSSIP_MENU(); | |
player->GetSession()->KickPlayer(); | |
return false; | |
break; | |
case 206 : | |
player->SetByteValue(UNIT_FIELD_BYTES_0, 0, RACE_ORC); | |
player->InitDisplayIds(); | |
player->learnSpell(20573), | |
player->learnSpell(20572), | |
// end learn spell orc | |
// started spell undead removed | |
player->removeSpell(7744), | |
player->removeSpell(5227), | |
//player->removeSpell(27353), | |
player->removeSpell(20577), | |
// end spell undead | |
// start remove spell tauren | |
player->removeSpell(46026), | |
player->removeSpell(20550), | |
// end remove spell tauren | |
// start remove spell troll | |
player->removeSpell(26296), | |
player->removeSpell(20557), | |
player->removeSpell(26290), | |
// end remove spell tauren | |
// start remove spell blood elf | |
player->removeSpell(28734), | |
player->removeSpell(28730), | |
// end remove spell blood elf | |
// start remove spell Human | |
player->removeSpell(20600), | |
player->removeSpell(4362), | |
// end remove spell Human | |
// start remove spell night elf | |
player->removeSpell(20580), | |
// end remove spell night elf | |
// start remove spell dwarf | |
player->removeSpell(20594), | |
// end remove spell dwarf | |
// start remove spell gnome | |
player->removeSpell(20589), | |
player->removeSpell(20591), | |
player->removeSpell(20593), | |
// end remove spell gnome | |
// start remove spell DRAENEI | |
player->removeSpell(28880), | |
// end remove spell DRAENEI | |
player->CLOSE_GOSSIP_MENU(); | |
player->GetSession()->KickPlayer(); | |
return false; | |
break; | |
case 207 : | |
player->SetByteValue(UNIT_FIELD_BYTES_0, 0, RACE_TAUREN); | |
player->InitDisplayIds(); | |
player->learnSpell(46026), | |
player->learnSpell(20550), | |
// started spell undead removed | |
player->removeSpell(7744), | |
player->removeSpell(5227), | |
//player->removeSpell(27353), | |
player->removeSpell(20577), | |
// end spell undead | |
// start remove spell orc | |
player->removeSpell(20573), | |
player->removeSpell(20572), | |
// end remove spell orc | |
// start remove spell troll | |
player->removeSpell(26296), | |
player->removeSpell(20557), | |
player->removeSpell(26290), | |
// end remove spell tauren | |
// start remove spell blood elf | |
player->removeSpell(28734), | |
player->removeSpell(28730), | |
// end remove spell blood elf | |
// start remove spell Human | |
player->removeSpell(20600), | |
player->removeSpell(4362), | |
// end remove spell Human | |
// start remove spell night elf | |
player->removeSpell(20580), | |
// end remove spell night elf | |
// start remove spell dwarf | |
player->removeSpell(20594), | |
// end remove spell dwarf | |
// start remove spell gnome | |
player->removeSpell(20589), | |
player->removeSpell(20591), | |
player->removeSpell(20593), | |
// end remove spell gnome | |
// start remove spell DRAENEI | |
player->removeSpell(28880), | |
// end remove spell DRAENEI | |
player->CLOSE_GOSSIP_MENU(); | |
player->GetSession()->KickPlayer(); | |
return false; | |
break; | |
case 208 : | |
player->SetByteValue(UNIT_FIELD_BYTES_0, 0, RACE_TROLL); | |
player->InitDisplayIds(); | |
player->learnSpell(26296), | |
player->learnSpell(20557), | |
player->learnSpell(26290), | |
// started spell undead removed | |
player->removeSpell(7744), | |
player->removeSpell(5227), | |
//player->removeSpell(27353), | |
player->removeSpell(20577), | |
// end spell undead | |
// start remove spell orc | |
player->removeSpell(20573), | |
player->removeSpell(20572), | |
// end remove spell orc | |
// start remove spell tauren | |
player->removeSpell(46026), | |
player->removeSpell(20550), | |
// end remove spell tauren | |
// start remove spell blood elf | |
player->removeSpell(28734), | |
player->removeSpell(28730), | |
// end remove spell blood elf | |
// start remove spell Human | |
player->removeSpell(20600), | |
player->removeSpell(4362), | |
// end remove spell Human | |
// start remove spell night elf | |
player->removeSpell(20580), | |
// end remove spell night elf | |
// start remove spell dwarf | |
player->removeSpell(20594), | |
// end remove spell dwarf | |
// start remove spell gnome | |
player->removeSpell(20589), | |
player->removeSpell(20591), | |
player->removeSpell(20593), | |
// end remove spell gnome | |
// start remove spell DRAENEI | |
player->removeSpell(28880), | |
// end remove spell DRAENEI | |
player->CLOSE_GOSSIP_MENU(); | |
player->GetSession()->KickPlayer(); | |
return false; | |
break; | |
case 209 : | |
player->SetByteValue(UNIT_FIELD_BYTES_0, 0, RACE_UNDEAD_PLAYER); | |
player->InitDisplayIds(); | |
player->learnSpell(7744), | |
player->learnSpell(5227), | |
//player->learnSpell(27353), | |
player->learnSpell(20577), | |
// end learn spell undead | |
// start remove spell orc | |
player->removeSpell(20573), | |
player->removeSpell(20572), | |
// end remove spell orc | |
// start remove spell tauren | |
player->removeSpell(46026), | |
player->removeSpell(20550), | |
// end remove spell tauren | |
// start remove spell troll | |
player->removeSpell(26296), | |
player->removeSpell(20557), | |
player->removeSpell(26290), | |
// end remove spell tauren | |
// start remove spell blood elf | |
player->removeSpell(28734), | |
player->removeSpell(28730), | |
// end remove spell blood elf | |
// start remove spell Human | |
player->removeSpell(20600), | |
player->removeSpell(4362), | |
// end remove spell Human | |
// start remove spell night elf | |
player->removeSpell(20580), | |
// end remove spell night elf | |
// start remove spell dwarf | |
player->removeSpell(20594), | |
// end remove spell dwarf | |
// start remove spell gnome | |
player->removeSpell(20589), | |
player->removeSpell(20591), | |
player->removeSpell(20593), | |
// end remove spell gnome | |
// start remove spell DRAENEI | |
player->removeSpell(28880), | |
// end remove spell DRAENEI | |
player->CLOSE_GOSSIP_MENU(); | |
player->GetSession()->KickPlayer(); | |
return false; | |
break; | |
} | |
return true; | |
} | |
void AddSC_racechanger() | |
{ | |
Script *newscript; | |
newscript = new Script; | |
newscript->Name = "racechanger"; | |
newscript->pGossipHello = &GossipHello_racechanger; | |
newscript->pGossipSelect = &GossipSelect_racechanger; | |
newscript->RegisterSelf(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/game/Player.h b/src/game/Player.h | |
index 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); | |
diff --git a/src/game/Player.cpp b/src/game/Player.cpp | |
index 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment