Advertisement
Guest User

Eatos

a guest
Aug 9th, 2012
428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.84 KB | None | 0 0
  1. #include "StdAfx.h"
  2. #include "Setup.h"
  3. #define NPC_ID 56099
  4.  
  5. class RaceChanger : public GossipScript
  6. {
  7.  
  8. public:
  9. void GossipHello(Object* pObject, Player * Plr, bool AutoSend)
  10. {
  11. GossipMenu *Menu;
  12. objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 40002, Plr);
  13. if(Plr->GetSession()->CanUseCommand('z'))
  14. {
  15. Menu->AddItem( 0, "Change my Race", 1 );
  16. }
  17. else
  18. {
  19. Menu->AddItem(0, "You can not use this right now!", 3);
  20. }
  21.  
  22. if(AutoSend)
  23. Menu->SendTo(Plr);
  24. }
  25.  
  26. void GossipSelectOption(Object* pObject, Player * Plr, uint32 Id, uint32 IntId, const char * Code)
  27. {
  28. Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NULL;
  29. if(pCreature==NULL)
  30. return;
  31.  
  32. GossipMenu *Menu;
  33. switch(IntId)
  34. {
  35. case 1:
  36. {
  37. objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
  38. Menu->AddItem( 0, "Change me Into Human", 4 );
  39. Menu->AddItem( 0, "Change me Into NightElf", 5 );
  40. Menu->AddItem( 0, "Change me Into Dwarf", 6 );
  41. Menu->AddItem( 0, "Change me Into Gnome", 7 );
  42. Menu->AddItem( 0, "Change me Into Draenei", 8 );
  43. Menu->AddItem( 0, "Change me Into Orc", 10 );
  44. Menu->AddItem( 0, "Change me Into Undead", 11 );
  45. Menu->AddItem( 0, "Change me Into Tauren", 12 );
  46. Menu->AddItem( 0, "Change me Into Troll", 13 );
  47. Menu->AddItem( 0, "Change me Into BloodElf", 14 );
  48. Menu->SendTo(Plr);
  49. }break;
  50.  
  51. case 4: // Human
  52. {
  53. sChatHandler.SystemMessage(Plr->GetSession(), "MUHAHAHA ...");
  54. uint32 team = Plr->GetTeam();
  55.  
  56. race_old = race = 1;
  57. class_ = Plr->getClass();
  58. gender = Plr->getGender();
  59. powertype = Plr->GetPowerType();
  60.  
  61. Plr->SetTeam( team ? 0 : 1 );
  62. PlayerCreateInfo *info = objmgr.GetPlayerCreateInfo(race, class_);
  63. if (!info)
  64. break;
  65.  
  66. Plr->SetFloatValue(OBJECT_FIELD_SCALE_X, ((race==RACE_TAUREN)?1.3f:1.0f));
  67. Plr->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, info->factiontemplate );
  68. Plr->SetUInt32Value(UNIT_FIELD_BYTES_0, ( ( race ) | ( class_ << 8 ) | ( gender << 16 ) | ( powertype << 24 ) ) );
  69. if(race != RACE_BLOODELF)
  70. {
  71. Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, info->displayId + gender );
  72. Plr->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, info->displayId + gender );
  73. }
  74. else
  75. {
  76. Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, info->displayId - gender );
  77. Plr->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, info->displayId - gender );
  78. }
  79. // Different races have different number of visuals
  80. Plr->SetUInt32Value(PLAYER_BYTES, ((RandomUInt(5))|(RandomUInt(5)<<8)|(RandomUInt(5)<<16)|(RandomUInt(5)<<24)));
  81. Plr->SetUInt32Value(PLAYER_BYTES_2, (( !gender ? 0 : RandomUInt(3) ) | (0x02 << 24)));
  82. //Plr->SetUInt32Value(PLAYER_BYTES, ((skin) | (face << 8) | (hairStyle << 16) | (hairColor << 24)));
  83. //Plr->SetUInt32Value(PLAYER_BYTES_2, (facialHair | (0x02 << 24)));
  84.  
  85. Plr->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, 0xEEEEEEEE);
  86. //dump reputation data
  87. ReputationMap m_tempRepMap;
  88. //store neutral
  89. for(uint32 i = 0; i < dbcFaction.GetNumRows(); ++i)
  90. {
  91. FactionDBC * f = dbcFaction.LookupRow(i);
  92. if(f == 0) continue;
  93. if( Plr->GetStanding(f->ID) &&
  94. f->parentFaction != 67 && f->parentFaction != 469 &&
  95. f->parentFaction != 892 && f->parentFaction != 891 &&
  96. f->ID != 947 && f->ID != 946 &&
  97. f->ID != 892 && f->ID != 891 &&
  98. f->ID != 941 && f->ID != 978 &&
  99. f->ID != 922
  100. )
  101. {
  102. FactionReputation * rep = new FactionReputation;
  103. rep->flag = 0;
  104. rep->standing = Plr->GetStanding(f->ID);
  105. rep->baseStanding = Plr->GetBaseStanding(f->ID);
  106.  
  107. m_tempRepMap[f->ID] = rep;
  108. }
  109. }
  110.  
  111.  
  112. Plr->_InitialReputation();
  113.  
  114. for(ReputationMap::iterator itr = m_tempRepMap.begin(); itr != m_tempRepMap.end(); ++itr)
  115. {
  116. Plr->SetStanding(itr->first, itr->second->standing );
  117. //delete itr->second;
  118. }
  119.  
  120. Plr->_RemoveLanguages();
  121.  
  122. //remove racial spells along with all starting spells then add them for new race
  123. PlayerCreateInfo * old_info = objmgr.GetPlayerCreateInfo(race_old, class_);
  124. if (!old_info) break;
  125.  
  126. for(std::set<uint32>::iterator sp = old_info->spell_list.begin(); sp!=old_info->spell_list.end(); sp++)
  127. if (Plr->HasSpell(*sp)) Plr->removeSpell((*sp), false, false, 0);
  128.  
  129. for(std::set<uint32>::iterator sp = info->spell_list.begin(); sp!=info->spell_list.end(); sp++)
  130. Plr->addSpell(*sp);
  131.  
  132.  
  133. if (Plr->GetGuildId())
  134. {
  135. Guild *pGuild = objmgr.GetGuild( Plr->GetGuildId() );
  136.  
  137. if(pGuild && pGuild->GetGuildLeader() != Plr->GetGUID() )
  138. {
  139. Plr->SetGuildId(0);
  140. Plr->SetGuildRank(0);
  141. pGuild->RemoveGuildMember(Plr->m_playerInfo, NULL);
  142.  
  143. WorldPacket data(100);
  144. data.Initialize(SMSG_GUILD_EVENT);
  145. data << uint8(GUILD_EVENT_LEFT);
  146. data << uint8(1);
  147. data << Plr->GetName();
  148. pGuild->SendPacket(&data);
  149. }
  150. }
  151.  
  152.  
  153.  
  154. Plr->SaveToDB(false);
  155. sChatHandler.SystemMessage(Plr->GetSession(), "Signed in blood. There is no going back now ...");
  156. sChatHandler.SystemMessage(Plr->GetSession(), "Relog ...");
  157. //force relog
  158. Plr->Kick(5000);
  159. Plr->Gossip_Complete();
  160.  
  161. }break;
  162.  
  163. case 5: // Nightelf
  164. {
  165. sChatHandler.SystemMessage(Plr->GetSession(), "MUHAHAHA ...");
  166. uint32 team = Plr->GetTeam();
  167.  
  168. race_old = race = 4;
  169. class_ = Plr->getClass();
  170. gender = Plr->getGender();
  171. powertype = Plr->GetPowerType();
  172.  
  173. Plr->SetTeam( team ? 0 : 1 );
  174. PlayerCreateInfo *info = objmgr.GetPlayerCreateInfo(race, class_);
  175. if (!info)
  176. break;
  177.  
  178. Plr->SetFloatValue(OBJECT_FIELD_SCALE_X, ((race==RACE_TAUREN)?1.3f:1.0f));
  179. Plr->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, info->factiontemplate );
  180. Plr->SetUInt32Value(UNIT_FIELD_BYTES_0, ( ( race ) | ( class_ << 8 ) | ( gender << 16 ) | ( powertype << 24 ) ) );
  181. if(race != RACE_BLOODELF)
  182. {
  183. Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, info->displayId + gender );
  184. Plr->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, info->displayId + gender );
  185. }
  186. else
  187. {
  188. Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, info->displayId - gender );
  189. Plr->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, info->displayId - gender );
  190. }
  191. // Different races have different number of visuals
  192. Plr->SetUInt32Value(PLAYER_BYTES, ((RandomUInt(5))|(RandomUInt(5)<<8)|(RandomUInt(5)<<16)|(RandomUInt(5)<<24)));
  193. Plr->SetUInt32Value(PLAYER_BYTES_2, (( !gender ? 0 : RandomUInt(3) ) | (0x02 << 24)));
  194. //Plr->SetUInt32Value(PLAYER_BYTES, ((skin) | (face << 8) | (hairStyle << 16) | (hairColor << 24)));
  195. //Plr->SetUInt32Value(PLAYER_BYTES_2, (facialHair | (0x02 << 24)));
  196.  
  197. Plr->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, 0xEEEEEEEE);
  198. //dump reputation data
  199. ReputationMap m_tempRepMap;
  200. //store neutral
  201. for(uint32 i = 0; i < dbcFaction.GetNumRows(); ++i)
  202. {
  203. FactionDBC * f = dbcFaction.LookupRow(i);
  204. if(f == 0) continue;
  205. // dont store side related factions
  206. if( Plr->GetStanding(f->ID) &&
  207. f->parentFaction != 67 && f->parentFaction != 469 &&
  208. f->parentFaction != 892 && f->parentFaction != 891 &&
  209. f->ID != 947 && f->ID != 946 &&
  210. f->ID != 892 && f->ID != 891 &&
  211. f->ID != 941 && f->ID != 978 &&
  212. f->ID != 922
  213. )
  214. {
  215. FactionReputation * rep = new FactionReputation;
  216. rep->flag = 0;
  217. rep->standing = Plr->GetStanding(f->ID);
  218. rep->baseStanding = Plr->GetBaseStanding(f->ID);
  219.  
  220. m_tempRepMap[f->ID] = rep;
  221. }
  222. }
  223.  
  224. Plr->_InitialReputation();
  225.  
  226. for(ReputationMap::iterator itr = m_tempRepMap.begin(); itr != m_tempRepMap.end(); ++itr)
  227. {
  228. Plr->SetStanding(itr->first, itr->second->standing );
  229. //delete itr->second;
  230. }
  231.  
  232. Plr->_RemoveLanguages();
  233.  
  234.  
  235. PlayerCreateInfo * old_info = objmgr.GetPlayerCreateInfo(race_old, class_);
  236. if (!old_info) break;
  237.  
  238. for(std::set<uint32>::iterator sp = old_info->spell_list.begin(); sp!=old_info->spell_list.end(); sp++)
  239. if (Plr->HasSpell(*sp)) Plr->removeSpell((*sp), false, false, 0);
  240.  
  241. for(std::set<uint32>::iterator sp = info->spell_list.begin(); sp!=info->spell_list.end(); sp++)
  242. Plr->addSpell(*sp);
  243.  
  244.  
  245. if (Plr->GetGuildId())
  246. {
  247. Guild *pGuild = objmgr.GetGuild( Plr->GetGuildId() );
  248.  
  249. if(pGuild && pGuild->GetGuildLeader() != Plr->GetGUID() )
  250. {
  251. Plr->SetGuildId(0);
  252. Plr->SetGuildRank(0);
  253. pGuild->RemoveGuildMember(Plr->m_playerInfo, NULL);
  254.  
  255. WorldPacket data(100);
  256. data.Initialize(SMSG_GUILD_EVENT);
  257. data << uint8(GUILD_EVENT_LEFT);
  258. data << uint8(1);
  259. data << Plr->GetName();
  260. pGuild->SendPacket(&data);
  261. }
  262. }
  263.  
  264.  
  265.  
  266. Plr->SaveToDB(false);
  267. sChatHandler.SystemMessage(Plr->GetSession(), "Signed in blood. There is no going back now ...");
  268. sChatHandler.SystemMessage(Plr->GetSession(), "Relog ...");
  269. //force relog
  270. Plr->Kick(5000);
  271. Plr->Gossip_Complete();
  272.  
  273.  
  274. }break;
  275.  
  276. case 6:// Dwarf
  277. {
  278. sChatHandler.SystemMessage(Plr->GetSession(), "MUHAHAHA ...");
  279. uint32 team = Plr->GetTeam();
  280.  
  281. race_old = race = 3;
  282. class_ = Plr->getClass();
  283. gender = Plr->getGender();
  284. powertype = Plr->GetPowerType();
  285.  
  286. Plr->SetTeam( team ? 0 : 1 );
  287. PlayerCreateInfo *info = objmgr.GetPlayerCreateInfo(race, class_);
  288. if (!info)
  289. break;
  290.  
  291. Plr->SetFloatValue(OBJECT_FIELD_SCALE_X, ((race==RACE_TAUREN)?1.3f:1.0f));
  292. Plr->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, info->factiontemplate );
  293. Plr->SetUInt32Value(UNIT_FIELD_BYTES_0, ( ( race ) | ( class_ << 8 ) | ( gender << 16 ) | ( powertype << 24 ) ) );
  294. if(race != RACE_BLOODELF)
  295. {
  296. Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, info->displayId + gender );
  297. Plr->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, info->displayId + gender );
  298. }
  299. else
  300. {
  301. Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, info->displayId - gender );
  302. Plr->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, info->displayId - gender );
  303. }
  304. // Different races have different number of visuals
  305. Plr->SetUInt32Value(PLAYER_BYTES, ((RandomUInt(5))|(RandomUInt(5)<<8)|(RandomUInt(5)<<16)|(RandomUInt(5)<<24)));
  306. Plr->SetUInt32Value(PLAYER_BYTES_2, (( !gender ? 0 : RandomUInt(3) ) | (0x02 << 24)));
  307. //Plr->SetUInt32Value(PLAYER_BYTES, ((skin) | (face << 8) | (hairStyle << 16) | (hairColor << 24)));
  308. //Plr->SetUInt32Value(PLAYER_BYTES_2, (facialHair | (0x02 << 24)));
  309.  
  310. Plr->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, 0xEEEEEEEE);
  311. //dump reputation data
  312. ReputationMap m_tempRepMap;
  313. //store neutral
  314. for(uint32 i = 0; i < dbcFaction.GetNumRows(); ++i)
  315. {
  316. FactionDBC * f = dbcFaction.LookupRow(i);
  317. if(f == 0) continue;
  318. // dont store side related factions
  319. if( Plr->GetStanding(f->ID) &&
  320. f->parentFaction != 67 && f->parentFaction != 469 &&
  321. f->parentFaction != 892 && f->parentFaction != 891 &&
  322. f->ID != 947 && f->ID != 946 &&
  323. f->ID != 892 && f->ID != 891 &&
  324. f->ID != 941 && f->ID != 978 &&
  325. f->ID != 922
  326. )
  327. {
  328. FactionReputation * rep = new FactionReputation;
  329. rep->flag = 0;
  330. rep->standing = Plr->GetStanding(f->ID);
  331. rep->baseStanding = Plr->GetBaseStanding(f->ID);
  332.  
  333. m_tempRepMap[f->ID] = rep;
  334. }
  335. }
  336.  
  337. Plr->_InitialReputation();
  338.  
  339. for(ReputationMap::iterator itr = m_tempRepMap.begin(); itr != m_tempRepMap.end(); ++itr)
  340. {
  341. Plr->SetStanding(itr->first, itr->second->standing );
  342. //delete itr->second;
  343. }
  344.  
  345. Plr->_RemoveLanguages();
  346.  
  347.  
  348. PlayerCreateInfo * old_info = objmgr.GetPlayerCreateInfo(race_old, class_);
  349. if (!old_info) break;
  350.  
  351. for(std::set<uint32>::iterator sp = old_info->spell_list.begin(); sp!=old_info->spell_list.end(); sp++)
  352. if (Plr->HasSpell(*sp)) Plr->removeSpell((*sp), false, false, 0);
  353.  
  354. for(std::set<uint32>::iterator sp = info->spell_list.begin(); sp!=info->spell_list.end(); sp++)
  355. Plr->addSpell(*sp);
  356.  
  357.  
  358. if (Plr->GetGuildId())
  359. {
  360. Guild *pGuild = objmgr.GetGuild( Plr->GetGuildId() );
  361.  
  362. if(pGuild && pGuild->GetGuildLeader() != Plr->GetGUID() )
  363. {
  364. Plr->SetGuildId(0);
  365. Plr->SetGuildRank(0);
  366. pGuild->RemoveGuildMember(Plr->m_playerInfo, NULL);
  367.  
  368. WorldPacket data(100);
  369. data.Initialize(SMSG_GUILD_EVENT);
  370. data << uint8(GUILD_EVENT_LEFT);
  371. data << uint8(1);
  372. data << Plr->GetName();
  373. pGuild->SendPacket(&data);
  374. }
  375. }
  376.  
  377.  
  378.  
  379. Plr->SaveToDB(false);
  380. sChatHandler.SystemMessage(Plr->GetSession(), "Signed in blood. There is no going back now ...");
  381. sChatHandler.SystemMessage(Plr->GetSession(), "Relog ...");
  382. //force relog
  383. Plr->Kick(5000);
  384. Plr->Gossip_Complete();
  385.  
  386. }break;
  387.  
  388. case 7: // Gnome
  389. {
  390. sChatHandler.SystemMessage(Plr->GetSession(), "MUHAHAHA ...");
  391. uint32 team = Plr->GetTeam();
  392.  
  393. race_old = race = 7;
  394. class_ = Plr->getClass();
  395. gender = Plr->getGender();
  396. powertype = Plr->GetPowerType();
  397.  
  398. Plr->SetTeam( team ? 0 : 1 );
  399. PlayerCreateInfo *info = objmgr.GetPlayerCreateInfo(race, class_);
  400. if (!info)
  401. break;
  402.  
  403. Plr->SetFloatValue(OBJECT_FIELD_SCALE_X, ((race==RACE_TAUREN)?1.3f:1.0f));
  404. Plr->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, info->factiontemplate );
  405. Plr->SetUInt32Value(UNIT_FIELD_BYTES_0, ( ( race ) | ( class_ << 8 ) | ( gender << 16 ) | ( powertype << 24 ) ) );
  406. if(race != RACE_BLOODELF)
  407. {
  408. Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, info->displayId + gender );
  409. Plr->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, info->displayId + gender );
  410. }
  411. else
  412. {
  413. Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, info->displayId - gender );
  414. Plr->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, info->displayId - gender );
  415. }
  416. // Different races have different number of visuals
  417. Plr->SetUInt32Value(PLAYER_BYTES, ((RandomUInt(5))|(RandomUInt(5)<<8)|(RandomUInt(5)<<16)|(RandomUInt(5)<<24)));
  418. Plr->SetUInt32Value(PLAYER_BYTES_2, (( !gender ? 0 : RandomUInt(3) ) | (0x02 << 24)));
  419. //Plr->SetUInt32Value(PLAYER_BYTES, ((skin) | (face << 8) | (hairStyle << 16) | (hairColor << 24)));
  420. //Plr->SetUInt32Value(PLAYER_BYTES_2, (facialHair | (0x02 << 24)));
  421.  
  422. Plr->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, 0xEEEEEEEE);
  423.  
  424. ReputationMap m_tempRepMap;
  425.  
  426. for(uint32 i = 0; i < dbcFaction.GetNumRows(); ++i)
  427. {
  428. FactionDBC * f = dbcFaction.LookupRow(i);
  429. if(f == 0) continue;
  430. // dont store side related factions
  431. if( Plr->GetStanding(f->ID) &&
  432. f->parentFaction != 67 && f->parentFaction != 469 &&
  433. f->parentFaction != 892 && f->parentFaction != 891 &&
  434. f->ID != 947 && f->ID != 946 && //HH/thrallmar
  435. f->ID != 892 && f->ID != 891 && //h/a Forces
  436. f->ID != 941 && f->ID != 978 && //Mag'har / Kurenai
  437. f->ID != 922 //Tranquillien
  438. )
  439. {
  440. FactionReputation * rep = new FactionReputation;
  441. rep->flag = 0;
  442. rep->standing = Plr->GetStanding(f->ID);
  443. rep->baseStanding = Plr->GetBaseStanding(f->ID);
  444.  
  445. m_tempRepMap[f->ID] = rep;
  446. }
  447. }
  448.  
  449. Plr->_InitialReputation();
  450.  
  451. for(ReputationMap::iterator itr = m_tempRepMap.begin(); itr != m_tempRepMap.end(); ++itr)
  452. {
  453. Plr->SetStanding(itr->first, itr->second->standing );
  454. //delete itr->second;
  455. }
  456.  
  457. Plr->_RemoveLanguages();
  458.  
  459.  
  460. PlayerCreateInfo * old_info = objmgr.GetPlayerCreateInfo(race_old, class_);
  461. if (!old_info) break;
  462.  
  463. for(std::set<uint32>::iterator sp = old_info->spell_list.begin(); sp!=old_info->spell_list.end(); sp++)
  464. if (Plr->HasSpell(*sp)) Plr->removeSpell((*sp), false, false, 0);
  465.  
  466. for(std::set<uint32>::iterator sp = info->spell_list.begin(); sp!=info->spell_list.end(); sp++)
  467. Plr->addSpell(*sp);
  468.  
  469.  
  470. if (Plr->GetGuildId())
  471. {
  472. Guild *pGuild = objmgr.GetGuild( Plr->GetGuildId() );
  473.  
  474. if(pGuild && pGuild->GetGuildLeader() != Plr->GetGUID() )
  475. {
  476. Plr->SetGuildId(0);
  477. Plr->SetGuildRank(0);
  478. pGuild->RemoveGuildMember(Plr->m_playerInfo, NULL);
  479.  
  480. WorldPacket data(100);
  481. data.Initialize(SMSG_GUILD_EVENT);
  482. data << uint8(GUILD_EVENT_LEFT);
  483. data << uint8(1);
  484. data << Plr->GetName();
  485. pGuild->SendPacket(&data);
  486. }
  487. }
  488.  
  489.  
  490.  
  491. Plr->SaveToDB(false);
  492. sChatHandler.SystemMessage(Plr->GetSession(), "Signed in blood. There is no going back now ...");
  493. sChatHandler.SystemMessage(Plr->GetSession(), "Relog ...");
  494. //force relog
  495. Plr->Kick(5000);
  496. Plr->Gossip_Complete();
  497.  
  498. }break;
  499.  
  500. case 8: // Draenei
  501. {
  502. sChatHandler.SystemMessage(Plr->GetSession(), "MUHAHAHA ...");
  503. uint32 team = Plr->GetTeam();
  504.  
  505. race_old = race = 11;
  506. class_ = Plr->getClass();
  507. gender = Plr->getGender();
  508. powertype = Plr->GetPowerType();
  509.  
  510. Plr->SetTeam( team ? 0 : 1 );
  511. PlayerCreateInfo *info = objmgr.GetPlayerCreateInfo(race, class_);
  512. if (!info)
  513. break;
  514.  
  515. Plr->SetFloatValue(OBJECT_FIELD_SCALE_X, ((race==RACE_TAUREN)?1.3f:1.0f));
  516. Plr->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, info->factiontemplate );
  517. Plr->SetUInt32Value(UNIT_FIELD_BYTES_0, ( ( race ) | ( class_ << 8 ) | ( gender << 16 ) | ( powertype << 24 ) ) );
  518. if(race != RACE_BLOODELF)
  519. {
  520. Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, info->displayId + gender );
  521. Plr->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, info->displayId + gender );
  522. }
  523. else
  524. {
  525. Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, info->displayId - gender );
  526. Plr->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, info->displayId - gender );
  527. }
  528. // Different races have different number of visuals
  529. Plr->SetUInt32Value(PLAYER_BYTES, ((RandomUInt(5))|(RandomUInt(5)<<8)|(RandomUInt(5)<<16)|(RandomUInt(5)<<24)));
  530. Plr->SetUInt32Value(PLAYER_BYTES_2, (( !gender ? 0 : RandomUInt(3) ) | (0x02 << 24)));
  531. //Plr->SetUInt32Value(PLAYER_BYTES, ((skin) | (face << 8) | (hairStyle << 16) | (hairColor << 24)));
  532. //Plr->SetUInt32Value(PLAYER_BYTES_2, (facialHair | (0x02 << 24)));
  533.  
  534. Plr->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, 0xEEEEEEEE);
  535. //dump reputation data
  536. ReputationMap m_tempRepMap;
  537. //store neutral
  538. for(uint32 i = 0; i < dbcFaction.GetNumRows(); ++i)
  539. {
  540. FactionDBC * f = dbcFaction.LookupRow(i);
  541. if(f == 0) continue;
  542. // dont store side related factions
  543. if( Plr->GetStanding(f->ID) &&
  544. f->parentFaction != 67 && f->parentFaction != 469 &&
  545. f->parentFaction != 892 && f->parentFaction != 891 &&
  546. f->ID != 947 && f->ID != 946 &&
  547. f->ID != 892 && f->ID != 891 &&
  548. f->ID != 941 && f->ID != 978 &&
  549. f->ID != 922
  550. )
  551. {
  552. FactionReputation * rep = new FactionReputation;
  553. rep->flag = 0;
  554. rep->standing = Plr->GetStanding(f->ID);
  555. rep->baseStanding = Plr->GetBaseStanding(f->ID);
  556.  
  557. m_tempRepMap[f->ID] = rep;
  558. }
  559. }
  560.  
  561. Plr->_InitialReputation();
  562.  
  563. for(ReputationMap::iterator itr = m_tempRepMap.begin(); itr != m_tempRepMap.end(); ++itr)
  564. {
  565. Plr->SetStanding(itr->first, itr->second->standing );
  566. //delete itr->second;
  567. }
  568.  
  569. Plr->_RemoveLanguages();
  570.  
  571.  
  572. PlayerCreateInfo * old_info = objmgr.GetPlayerCreateInfo(race_old, class_);
  573. if (!old_info) break;
  574.  
  575. for(std::set<uint32>::iterator sp = old_info->spell_list.begin(); sp!=old_info->spell_list.end(); sp++)
  576. if (Plr->HasSpell(*sp)) Plr->removeSpell((*sp), false, false, 0);
  577.  
  578. for(std::set<uint32>::iterator sp = info->spell_list.begin(); sp!=info->spell_list.end(); sp++)
  579. Plr->addSpell(*sp);
  580.  
  581.  
  582. if (Plr->GetGuildId())
  583. {
  584. Guild *pGuild = objmgr.GetGuild( Plr->GetGuildId() );
  585.  
  586. if(pGuild && pGuild->GetGuildLeader() != Plr->GetGUID() )
  587. {
  588. Plr->SetGuildId(0);
  589. Plr->SetGuildRank(0);
  590. pGuild->RemoveGuildMember(Plr->m_playerInfo, NULL);
  591.  
  592. WorldPacket data(100);
  593. data.Initialize(SMSG_GUILD_EVENT);
  594. data << uint8(GUILD_EVENT_LEFT);
  595. data << uint8(1);
  596. data << Plr->GetName();
  597. pGuild->SendPacket(&data);
  598. }
  599. }
  600.  
  601.  
  602.  
  603. Plr->SaveToDB(false);
  604. sChatHandler.SystemMessage(Plr->GetSession(), "Signed in blood. There is no going back now ...");
  605. sChatHandler.SystemMessage(Plr->GetSession(), "Relog ...");
  606. //force relog
  607. Plr->Kick(5000);
  608. Plr->Gossip_Complete();
  609.  
  610.  
  611. }break;
  612.  
  613.  
  614. case 10: // Orc
  615. {
  616. sChatHandler.SystemMessage(Plr->GetSession(), "MUHAHAHA ...");
  617. uint32 team = Plr->GetTeam();
  618.  
  619. race_old = race = 2;
  620. class_ = Plr->getClass();
  621. gender = Plr->getGender();
  622. powertype = Plr->GetPowerType();
  623.  
  624. Plr->SetTeam( team ? 0 : 1 );
  625. PlayerCreateInfo *info = objmgr.GetPlayerCreateInfo(race, class_);
  626. if (!info)
  627. break;
  628.  
  629. Plr->SetFloatValue(OBJECT_FIELD_SCALE_X, ((race==RACE_TAUREN)?1.3f:1.0f));
  630. Plr->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, info->factiontemplate );
  631. Plr->SetUInt32Value(UNIT_FIELD_BYTES_0, ( ( race ) | ( class_ << 8 ) | ( gender << 16 ) | ( powertype << 24 ) ) );
  632. if(race != RACE_BLOODELF)
  633. {
  634. Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, info->displayId + gender );
  635. Plr->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, info->displayId + gender );
  636. }
  637. else
  638. {
  639. Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, info->displayId - gender );
  640. Plr->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, info->displayId - gender );
  641. }
  642. // Different races have different number of visuals
  643. Plr->SetUInt32Value(PLAYER_BYTES, ((RandomUInt(5))|(RandomUInt(5)<<8)|(RandomUInt(5)<<16)|(RandomUInt(5)<<24)));
  644. Plr->SetUInt32Value(PLAYER_BYTES_2, (( !gender ? 0 : RandomUInt(3) ) | (0x02 << 24)));
  645. //Plr->SetUInt32Value(PLAYER_BYTES, ((skin) | (face << 8) | (hairStyle << 16) | (hairColor << 24)));
  646. //Plr->SetUInt32Value(PLAYER_BYTES_2, (facialHair | (0x02 << 24)));
  647.  
  648. Plr->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, 0xEEEEEEEE);
  649.  
  650. ReputationMap m_tempRepMap;
  651.  
  652. for(uint32 i = 0; i < dbcFaction.GetNumRows(); ++i)
  653. {
  654. FactionDBC * f = dbcFaction.LookupRow(i);
  655. if(f == 0) continue;
  656.  
  657. if( Plr->GetStanding(f->ID) &&
  658. f->parentFaction != 67 && f->parentFaction != 469 &&
  659. f->parentFaction != 892 && f->parentFaction != 891 &&
  660. f->ID != 947 && f->ID != 946 &&
  661. f->ID != 892 && f->ID != 891 &&
  662. f->ID != 941 && f->ID != 978 &&
  663. f->ID != 922
  664. )
  665. {
  666. FactionReputation * rep = new FactionReputation;
  667. rep->flag = 0;
  668. rep->standing = Plr->GetStanding(f->ID);
  669. rep->baseStanding = Plr->GetBaseStanding(f->ID);
  670.  
  671. m_tempRepMap[f->ID] = rep;
  672. }
  673. }
  674.  
  675. Plr->_InitialReputation();
  676.  
  677. for(ReputationMap::iterator itr = m_tempRepMap.begin(); itr != m_tempRepMap.end(); ++itr)
  678. {
  679. Plr->SetStanding(itr->first, itr->second->standing );
  680. //delete itr->second;
  681. }
  682.  
  683. Plr->_RemoveLanguages();
  684.  
  685.  
  686. PlayerCreateInfo * old_info = objmgr.GetPlayerCreateInfo(race_old, class_);
  687. if (!old_info) break;
  688.  
  689. for(std::set<uint32>::iterator sp = old_info->spell_list.begin(); sp!=old_info->spell_list.end(); sp++)
  690. if (Plr->HasSpell(*sp)) Plr->removeSpell((*sp), false, false, 0);
  691.  
  692. for(std::set<uint32>::iterator sp = info->spell_list.begin(); sp!=info->spell_list.end(); sp++)
  693. Plr->addSpell(*sp);
  694.  
  695.  
  696. if (Plr->GetGuildId())
  697. {
  698. Guild *pGuild = objmgr.GetGuild( Plr->GetGuildId() );
  699.  
  700. if(pGuild && pGuild->GetGuildLeader() != Plr->GetGUID() )
  701. {
  702. Plr->SetGuildId(0);
  703. Plr->SetGuildRank(0);
  704. pGuild->RemoveGuildMember(Plr->m_playerInfo, NULL);
  705.  
  706. WorldPacket data(100);
  707. data.Initialize(SMSG_GUILD_EVENT);
  708. data << uint8(GUILD_EVENT_LEFT);
  709. data << uint8(1);
  710. data << Plr->GetName();
  711. pGuild->SendPacket(&data);
  712. }
  713. }
  714.  
  715.  
  716.  
  717. Plr->SaveToDB(false);
  718. sChatHandler.SystemMessage(Plr->GetSession(), "Signed in blood. There is no going back now ...");
  719. sChatHandler.SystemMessage(Plr->GetSession(), "Relog ...");
  720. //force relog
  721. Plr->Kick(5000);
  722. Plr->Gossip_Complete();
  723.  
  724. }break;
  725.  
  726. case 11: // Undead
  727. {
  728. sChatHandler.SystemMessage(Plr->GetSession(), "MUHAHAHA ...");
  729. uint32 team = Plr->GetTeam();
  730.  
  731. race_old = race = 5;
  732. class_ = Plr->getClass();
  733. gender = Plr->getGender();
  734. powertype = Plr->GetPowerType();
  735.  
  736. Plr->SetTeam( team ? 0 : 1 );
  737. PlayerCreateInfo *info = objmgr.GetPlayerCreateInfo(race, class_);
  738. if (!info)
  739. break;
  740.  
  741. Plr->SetFloatValue(OBJECT_FIELD_SCALE_X, ((race==RACE_TAUREN)?1.3f:1.0f));
  742. Plr->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, info->factiontemplate );
  743. Plr->SetUInt32Value(UNIT_FIELD_BYTES_0, ( ( race ) | ( class_ << 8 ) | ( gender << 16 ) | ( powertype << 24 ) ) );
  744. if(race != RACE_BLOODELF)
  745. {
  746. Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, info->displayId + gender );
  747. Plr->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, info->displayId + gender );
  748. }
  749. else
  750. {
  751. Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, info->displayId - gender );
  752. Plr->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, info->displayId - gender );
  753. }
  754. // Different races have different number of visuals
  755. Plr->SetUInt32Value(PLAYER_BYTES, ((RandomUInt(5))|(RandomUInt(5)<<8)|(RandomUInt(5)<<16)|(RandomUInt(5)<<24)));
  756. Plr->SetUInt32Value(PLAYER_BYTES_2, (( !gender ? 0 : RandomUInt(3) ) | (0x02 << 24)));
  757. //Plr->SetUInt32Value(PLAYER_BYTES, ((skin) | (face << 8) | (hairStyle << 16) | (hairColor << 24)));
  758. //Plr->SetUInt32Value(PLAYER_BYTES_2, (facialHair | (0x02 << 24)));
  759.  
  760. Plr->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, 0xEEEEEEEE);
  761.  
  762. ReputationMap m_tempRepMap;
  763.  
  764. for(uint32 i = 0; i < dbcFaction.GetNumRows(); ++i)
  765. {
  766. FactionDBC * f = dbcFaction.LookupRow(i);
  767. if(f == 0) continue;
  768.  
  769. if( Plr->GetStanding(f->ID) &&
  770. f->parentFaction != 67 && f->parentFaction != 469 &&
  771. f->parentFaction != 892 && f->parentFaction != 891 &&
  772. f->ID != 947 && f->ID != 946 &&
  773. f->ID != 892 && f->ID != 891 &&
  774. f->ID != 941 && f->ID != 978 &&
  775. f->ID != 922
  776. )
  777. {
  778. FactionReputation * rep = new FactionReputation;
  779. rep->flag = 0;
  780. rep->standing = Plr->GetStanding(f->ID);
  781. rep->baseStanding = Plr->GetBaseStanding(f->ID);
  782.  
  783. m_tempRepMap[f->ID] = rep;
  784. }
  785. }
  786.  
  787. Plr->_InitialReputation();
  788.  
  789. for(ReputationMap::iterator itr = m_tempRepMap.begin(); itr != m_tempRepMap.end(); ++itr)
  790. {
  791. Plr->SetStanding(itr->first, itr->second->standing );
  792. //delete itr->second;
  793. }
  794.  
  795. Plr->_RemoveLanguages();
  796.  
  797.  
  798. PlayerCreateInfo * old_info = objmgr.GetPlayerCreateInfo(race_old, class_);
  799. if (!old_info) break;
  800.  
  801. for(std::set<uint32>::iterator sp = old_info->spell_list.begin(); sp!=old_info->spell_list.end(); sp++)
  802. if (Plr->HasSpell(*sp)) Plr->removeSpell((*sp), false, false, 0);
  803.  
  804. for(std::set<uint32>::iterator sp = info->spell_list.begin(); sp!=info->spell_list.end(); sp++)
  805. Plr->addSpell(*sp);
  806.  
  807.  
  808. if (Plr->GetGuildId())
  809. {
  810. Guild *pGuild = objmgr.GetGuild( Plr->GetGuildId() );
  811.  
  812. if(pGuild && pGuild->GetGuildLeader() != Plr->GetGUID() )
  813. {
  814. Plr->SetGuildId(0);
  815. Plr->SetGuildRank(0);
  816. pGuild->RemoveGuildMember(Plr->m_playerInfo, NULL);
  817.  
  818. WorldPacket data(100);
  819. data.Initialize(SMSG_GUILD_EVENT);
  820. data << uint8(GUILD_EVENT_LEFT);
  821. data << uint8(1);
  822. data << Plr->GetName();
  823. pGuild->SendPacket(&data);
  824. }
  825. }
  826.  
  827.  
  828.  
  829. Plr->SaveToDB(false);
  830. sChatHandler.SystemMessage(Plr->GetSession(), "Signed in blood. There is no going back now ...");
  831. sChatHandler.SystemMessage(Plr->GetSession(), "Relog ...");
  832. //force relog
  833. Plr->Kick(5000);
  834. Plr->Gossip_Complete();
  835.  
  836.  
  837. }break;
  838.  
  839. case 12:
  840. {
  841. sChatHandler.SystemMessage(Plr->GetSession(), "MUHAHAHA ...");
  842. uint32 team = Plr->GetTeam();
  843.  
  844. race_old = race = 6;
  845. class_ = Plr->getClass();
  846. gender = Plr->getGender();
  847. powertype = Plr->GetPowerType();
  848.  
  849. Plr->SetTeam( team ? 0 : 1 );
  850. PlayerCreateInfo *info = objmgr.GetPlayerCreateInfo(race, class_);
  851. if (!info)
  852. break;
  853.  
  854. Plr->SetFloatValue(OBJECT_FIELD_SCALE_X, ((race==RACE_TAUREN)?1.3f:1.0f));
  855. Plr->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, info->factiontemplate );
  856. Plr->SetUInt32Value(UNIT_FIELD_BYTES_0, ( ( race ) | ( class_ << 8 ) | ( gender << 16 ) | ( powertype << 24 ) ) );
  857. if(race != RACE_BLOODELF)
  858. {
  859. Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, info->displayId + gender );
  860. Plr->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, info->displayId + gender );
  861. }
  862. else
  863. {
  864. Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, info->displayId - gender );
  865. Plr->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, info->displayId - gender );
  866. }
  867. // Different races have different number of visuals
  868. Plr->SetUInt32Value(PLAYER_BYTES, ((RandomUInt(5))|(RandomUInt(5)<<8)|(RandomUInt(5)<<16)|(RandomUInt(5)<<24)));
  869. Plr->SetUInt32Value(PLAYER_BYTES_2, (( !gender ? 0 : RandomUInt(3) ) | (0x02 << 24)));
  870. //Plr->SetUInt32Value(PLAYER_BYTES, ((skin) | (face << 8) | (hairStyle << 16) | (hairColor << 24)));
  871. //Plr->SetUInt32Value(PLAYER_BYTES_2, (facialHair | (0x02 << 24)));
  872.  
  873. Plr->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, 0xEEEEEEEE);
  874.  
  875. ReputationMap m_tempRepMap;
  876.  
  877. for(uint32 i = 0; i < dbcFaction.GetNumRows(); ++i)
  878. {
  879. FactionDBC * f = dbcFaction.LookupRow(i);
  880. if(f == 0) continue;
  881.  
  882. if( Plr->GetStanding(f->ID) &&
  883. f->parentFaction != 67 && f->parentFaction != 469 &&
  884. f->parentFaction != 892 && f->parentFaction != 891 &&
  885. f->ID != 947 && f->ID != 946 &&
  886. f->ID != 892 && f->ID != 891 &&
  887. f->ID != 941 && f->ID != 978 &&
  888. f->ID != 922
  889. )
  890. {
  891. FactionReputation * rep = new FactionReputation;
  892. rep->flag = 0;
  893. rep->standing = Plr->GetStanding(f->ID);
  894. rep->baseStanding = Plr->GetBaseStanding(f->ID);
  895.  
  896. m_tempRepMap[f->ID] = rep;
  897. }
  898. }
  899.  
  900. Plr->_InitialReputation();
  901.  
  902. for(ReputationMap::iterator itr = m_tempRepMap.begin(); itr != m_tempRepMap.end(); ++itr)
  903. {
  904. Plr->SetStanding(itr->first, itr->second->standing );
  905. //delete itr->second;
  906. }
  907.  
  908. Plr->_RemoveLanguages();
  909.  
  910.  
  911. PlayerCreateInfo * old_info = objmgr.GetPlayerCreateInfo(race_old, class_);
  912. if (!old_info) break;
  913.  
  914. for(std::set<uint32>::iterator sp = old_info->spell_list.begin(); sp!=old_info->spell_list.end(); sp++)
  915. if (Plr->HasSpell(*sp)) Plr->removeSpell((*sp), false, false, 0);
  916.  
  917. for(std::set<uint32>::iterator sp = info->spell_list.begin(); sp!=info->spell_list.end(); sp++)
  918. Plr->addSpell(*sp);
  919.  
  920.  
  921. if (Plr->GetGuildId())
  922. {
  923. Guild *pGuild = objmgr.GetGuild( Plr->GetGuildId() );
  924.  
  925. if(pGuild && pGuild->GetGuildLeader() != Plr->GetGUID() )
  926. {
  927. Plr->SetGuildId(0);
  928. Plr->SetGuildRank(0);
  929. pGuild->RemoveGuildMember(Plr->m_playerInfo, NULL);
  930.  
  931. WorldPacket data(100);
  932. data.Initialize(SMSG_GUILD_EVENT);
  933. data << uint8(GUILD_EVENT_LEFT);
  934. data << uint8(1);
  935. data << Plr->GetName();
  936. pGuild->SendPacket(&data);
  937. }
  938. }
  939.  
  940.  
  941.  
  942. Plr->SaveToDB(false);
  943. sChatHandler.SystemMessage(Plr->GetSession(), "Signed in blood. There is no going back now ...");
  944. sChatHandler.SystemMessage(Plr->GetSession(), "Relog ...");
  945. //force relog
  946. Plr->Kick(5000);
  947. Plr->Gossip_Complete();
  948.  
  949. }break;
  950.  
  951. case 13:
  952. {
  953. sChatHandler.SystemMessage(Plr->GetSession(), "MUHAHAHA ...");
  954. uint32 team = Plr->GetTeam();
  955.  
  956. race_old = race = 8;
  957. class_ = Plr->getClass();
  958. gender = Plr->getGender();
  959. powertype = Plr->GetPowerType();
  960.  
  961. Plr->SetTeam( team ? 0 : 1 );
  962. PlayerCreateInfo *info = objmgr.GetPlayerCreateInfo(race, class_);
  963. if (!info)
  964. break;
  965.  
  966. Plr->SetFloatValue(OBJECT_FIELD_SCALE_X, ((race==RACE_TAUREN)?1.3f:1.0f));
  967. Plr->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, info->factiontemplate );
  968. Plr->SetUInt32Value(UNIT_FIELD_BYTES_0, ( ( race ) | ( class_ << 8 ) | ( gender << 16 ) | ( powertype << 24 ) ) );
  969. if(race != RACE_BLOODELF)
  970. {
  971. Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, info->displayId + gender );
  972. Plr->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, info->displayId + gender );
  973. }
  974. else
  975. {
  976. Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, info->displayId - gender );
  977. Plr->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, info->displayId - gender );
  978. }
  979. // Different races have different number of visuals
  980. Plr->SetUInt32Value(PLAYER_BYTES, ((RandomUInt(5))|(RandomUInt(5)<<8)|(RandomUInt(5)<<16)|(RandomUInt(5)<<24)));
  981. Plr->SetUInt32Value(PLAYER_BYTES_2, (( !gender ? 0 : RandomUInt(3) ) | (0x02 << 24)));
  982. //Plr->SetUInt32Value(PLAYER_BYTES, ((skin) | (face << 8) | (hairStyle << 16) | (hairColor << 24)));
  983. //Plr->SetUInt32Value(PLAYER_BYTES_2, (facialHair | (0x02 << 24)));
  984.  
  985. Plr->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, 0xEEEEEEEE);
  986.  
  987. ReputationMap m_tempRepMap;
  988.  
  989. for(uint32 i = 0; i < dbcFaction.GetNumRows(); ++i)
  990. {
  991. FactionDBC * f = dbcFaction.LookupRow(i);
  992. if(f == 0)
  993. continue;
  994.  
  995. if( Plr->GetStanding(f->ID) &&
  996. f->parentFaction != 67 && f->parentFaction != 469 &&
  997. f->parentFaction != 892 && f->parentFaction != 891 &&
  998. f->ID != 947 && f->ID != 946 &&
  999. f->ID != 892 && f->ID != 891 &&
  1000. f->ID != 941 && f->ID != 978 &&
  1001. f->ID != 922
  1002. )
  1003. {
  1004. FactionReputation * rep = new FactionReputation;
  1005. rep->flag = 0;
  1006. rep->standing = Plr->GetStanding(f->ID);
  1007. rep->baseStanding = Plr->GetBaseStanding(f->ID);
  1008.  
  1009. m_tempRepMap[f->ID] = rep;
  1010. }
  1011. }
  1012.  
  1013. Plr->_InitialReputation();
  1014.  
  1015. for(ReputationMap::iterator itr = m_tempRepMap.begin(); itr != m_tempRepMap.end(); ++itr)
  1016. {
  1017. Plr->SetStanding(itr->first, itr->second->standing );
  1018. //delete itr->second;
  1019. }
  1020.  
  1021. Plr->_RemoveLanguages();
  1022.  
  1023.  
  1024. PlayerCreateInfo * old_info = objmgr.GetPlayerCreateInfo(race_old, class_);
  1025. if (!old_info) break;
  1026.  
  1027. for(std::set<uint32>::iterator sp = old_info->spell_list.begin(); sp!=old_info->spell_list.end(); sp++)
  1028. if (Plr->HasSpell(*sp)) Plr->removeSpell((*sp), false, false, 0);
  1029.  
  1030. for(std::set<uint32>::iterator sp = info->spell_list.begin(); sp!=info->spell_list.end(); sp++)
  1031. Plr->addSpell(*sp);
  1032.  
  1033.  
  1034. if (Plr->GetGuildId())
  1035. {
  1036. Guild *pGuild = objmgr.GetGuild( Plr->GetGuildId() );
  1037.  
  1038. if(pGuild && pGuild->GetGuildLeader() != Plr->GetGUID() )
  1039. {
  1040. Plr->SetGuildId(0);
  1041. Plr->SetGuildRank(0);
  1042. pGuild->RemoveGuildMember(Plr->m_playerInfo, NULL);
  1043.  
  1044. WorldPacket data(100);
  1045. data.Initialize(SMSG_GUILD_EVENT);
  1046. data << uint8(GUILD_EVENT_LEFT);
  1047. data << uint8(1);
  1048. data << Plr->GetName();
  1049. pGuild->SendPacket(&data);
  1050. }
  1051. }
  1052.  
  1053.  
  1054.  
  1055. Plr->SaveToDB(false);
  1056. sChatHandler.SystemMessage(Plr->GetSession(), "Signed in blood. There is no going back now ...");
  1057. sChatHandler.SystemMessage(Plr->GetSession(), "Relog ...");
  1058. //force relog
  1059. Plr->Kick(5000);
  1060. Plr->Gossip_Complete();
  1061.  
  1062. }break;
  1063.  
  1064. case 14:
  1065. {
  1066. sChatHandler.SystemMessage(Plr->GetSession(), "MUHAHAHA ...");
  1067. uint32 team = Plr->GetTeam();
  1068.  
  1069. race_old = race = 10;
  1070. class_ = Plr->getClass();
  1071. gender = Plr->getGender();
  1072. powertype = Plr->GetPowerType();
  1073.  
  1074. Plr->SetTeam( team ? 0 : 1 );
  1075. PlayerCreateInfo *info = objmgr.GetPlayerCreateInfo(race, class_);
  1076. if (!info)
  1077. break;
  1078.  
  1079. Plr->SetFloatValue(OBJECT_FIELD_SCALE_X, ((race==RACE_TAUREN)?1.3f:1.0f));
  1080. Plr->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, info->factiontemplate );
  1081. Plr->SetUInt32Value(UNIT_FIELD_BYTES_0, ( ( race ) | ( class_ << 8 ) | ( gender << 16 ) | ( powertype << 24 ) ) );
  1082. if(race != RACE_BLOODELF)
  1083. {
  1084. Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, info->displayId + gender );
  1085. Plr->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, info->displayId + gender );
  1086. }
  1087. else
  1088. {
  1089. Plr->SetUInt32Value(UNIT_FIELD_DISPLAYID, info->displayId - gender );
  1090. Plr->SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, info->displayId - gender );
  1091. }
  1092. // Different races have different number of visuals
  1093. Plr->SetUInt32Value(PLAYER_BYTES, ((RandomUInt(5))|(RandomUInt(5)<<8)|(RandomUInt(5)<<16)|(RandomUInt(5)<<24)));
  1094. Plr->SetUInt32Value(PLAYER_BYTES_2, (( !gender ? 0 : RandomUInt(3) ) | (0x02 << 24)));
  1095. //Plr->SetUInt32Value(PLAYER_BYTES, ((skin) | (face << 8) | (hairStyle << 16) | (hairColor << 24)));
  1096. //Plr->SetUInt32Value(PLAYER_BYTES_2, (facialHair | (0x02 << 24)));
  1097.  
  1098. Plr->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, 0xEEEEEEEE);
  1099. //dump reputation data
  1100. ReputationMap m_tempRepMap;
  1101. //store neutral
  1102. for(uint32 i = 0; i < dbcFaction.GetNumRows(); ++i)
  1103. {
  1104. FactionDBC * f = dbcFaction.LookupRow(i);
  1105. if(f == 0) continue;
  1106.  
  1107. if( Plr->GetStanding(f->ID) &&
  1108. f->parentFaction != 67 && f->parentFaction != 469 &&
  1109. f->parentFaction != 892 && f->parentFaction != 891 &&
  1110. f->ID != 947 && f->ID != 946 &&
  1111. f->ID != 892 && f->ID != 891 &&
  1112. f->ID != 941 && f->ID != 978 &&
  1113. f->ID != 922
  1114. )
  1115. {
  1116. FactionReputation * rep = new FactionReputation;
  1117. rep->flag = 0;
  1118. rep->standing = Plr->GetStanding(f->ID);
  1119. rep->baseStanding = Plr->GetBaseStanding(f->ID);
  1120.  
  1121. m_tempRepMap[f->ID] = rep;
  1122. }
  1123. }
  1124.  
  1125.  
  1126. Plr->_InitialReputation();
  1127.  
  1128. for(ReputationMap::iterator itr = m_tempRepMap.begin(); itr != m_tempRepMap.end(); ++itr)
  1129. {
  1130. Plr->SetStanding(itr->first, itr->second->standing );
  1131. //delete itr->second;
  1132. }
  1133.  
  1134. Plr->_RemoveLanguages();
  1135.  
  1136.  
  1137. PlayerCreateInfo * old_info = objmgr.GetPlayerCreateInfo(race_old, class_);
  1138. if (!old_info) break;
  1139.  
  1140. for(std::set<uint32>::iterator sp = old_info->spell_list.begin(); sp!=old_info->spell_list.end(); sp++)
  1141. if (Plr->HasSpell(*sp)) Plr->removeSpell((*sp), false, false, 0);
  1142.  
  1143. for(std::set<uint32>::iterator sp = info->spell_list.begin(); sp!=info->spell_list.end(); sp++)
  1144. Plr->addSpell(*sp);
  1145.  
  1146.  
  1147. if (Plr->GetGuildId())
  1148. {
  1149. Guild *pGuild = objmgr.GetGuild( Plr->GetGuildId() );
  1150.  
  1151. if(pGuild && pGuild->GetGuildLeader() != Plr->GetGUID() )
  1152. {
  1153. Plr->SetGuildId(0);
  1154. Plr->SetGuildRank(0);
  1155. pGuild->RemoveGuildMember(Plr->m_playerInfo, NULL);
  1156.  
  1157. WorldPacket data(100);
  1158. data.Initialize(SMSG_GUILD_EVENT);
  1159. data << uint8(GUILD_EVENT_LEFT);
  1160. data << uint8(1);
  1161. data << Plr->GetName();
  1162. pGuild->SendPacket(&data);
  1163. }
  1164. }
  1165.  
  1166.  
  1167.  
  1168. Plr->SaveToDB(false);
  1169. sChatHandler.SystemMessage(Plr->GetSession(), "Signed in blood. There is no going back now ...");
  1170. sChatHandler.SystemMessage(Plr->GetSession(), "Relog ...");
  1171. //force relog
  1172. Plr->Kick(5000);
  1173. Plr->Gossip_Complete();
  1174.  
  1175. }break;
  1176.  
  1177. }
  1178. };
  1179.  
  1180. void Destroy()
  1181. {
  1182. delete this;
  1183. }
  1184.  
  1185. private:
  1186. uint8 race, race_old, class_,gender,powertype/*,skin,face,hairStyle,hairColor,facialHair*/;
  1187.  
  1188. };
  1189.  
  1190. void SetupRaceChangeScript(ScriptMgr * mgr)
  1191. {
  1192. GossipScript * RCA = (GossipScript*) new RaceChanger();
  1193. mgr->register_gossip_script(NPC_ID, RCA);
  1194. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement