Advertisement
Guest User

Untitled

a guest
Aug 29th, 2012
827
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.82 KB | None | 0 0
  1. ///////////////////////////////
  2. //**** Created By EroniX ****//
  3. ///////////////////////////////
  4. //
  5. // #Files: - TransmogHandler.cpp
  6. //
  7. // - TransmogEngine.cpp
  8. // - TransmogEngine.h
  9. //
  10. // - TransmogMgr.cpp
  11. // - TransmogMgr.h
  12. //
  13. //
  14. // #Core Mods: - Player.cpp:
  15. // - #include "TransmogEngine.h"
  16. // - EquipItem:
  17. // - TransmogEngine::SetTransmogDisplay(this, slot);
  18. //
  19. // - RemoveItem:
  20. // - TransmogEngine::RemoveTransmog(this, slot);
  21. //
  22. // - Player.h:
  23. // - uint32 selectedSlotID;
  24. // - Loot* selectedInterface;
  25. //
  26. // - LootHandler.cpp:
  27. // - #include "TransmogEngine.h"
  28. // - HandleAutostoreLootItemOpcode:
  29. // if(TransmogEngine::IsActiveInterface(lguid) && player)
  30. // {
  31. // if(Creature* creature = player->GetMap()->GetCreature(lguid))
  32. // TransmogEngine::HandleInterfaceSelect(player, creature, player->selectedInterface, lootSlot);
  33. //
  34. // return;
  35. // }
  36. //
  37. // - HandleLootReleaseOpcode:
  38. // if(Player* player = GetPlayer())
  39. // if(TransmogEngine::IsActiveInterface(guid))
  40. // {
  41. // if(Creature* creature = GetPlayer()->GetMap()->GetCreature(guid))
  42. // TransmogEngine::SendInterfaceClose(player, guid);
  43. //
  44. // return;
  45. // }
  46.  
  47. #include "TransmogEngine.h"
  48. #include "TransmogMgr.h"
  49. #include <stdio.h>
  50. #include <string.h>
  51. #include <stdlib.h>
  52. #include "LootMgr.h"
  53.  
  54. class npc_transmog : CreatureScript
  55. {
  56. public:
  57. npc_transmog() : CreatureScript("npc_transmog") { }
  58.  
  59. bool OnGossipHello(Player* player, Creature* creature)
  60. {
  61. TransmogEngine::GossipHelloMainMenu(player, creature);
  62. return true;
  63. }
  64. bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action)
  65. {
  66. if(GossipSelectMenu(player, creature, action) == false)
  67. if(GossipSelectTransmog(player, creature, action) == false) { }
  68.  
  69. return true;
  70. }
  71. bool GossipSelectMenu(Player* player, Creature* creature, uint32 action)
  72. {
  73. if((MENU_TEXT + 0) == action)
  74. {
  75. if(TransmogMgr::IsTransmogedPlayer(player->GetGUIDLow()))
  76. {
  77. TransmogEngine::RemoveAllTransmog(player);
  78. creature->MonsterWhisper("All of your active transmogrifications have been removed succesfully", player->GetGUID(), true);
  79. }
  80. else
  81. creature->MonsterWhisper("You don't have any active transmogrifications", player->GetGUID(), true);
  82.  
  83. TransmogEngine::GossipHelloMainMenu(player, creature);
  84. return true;
  85. }
  86.  
  87. if((MENU_TEXT + 1) == action)
  88. {
  89. player->PlayerTalkClass->SendCloseGossip();
  90. return true;
  91. }
  92.  
  93. if((MENU_TEXT + 2) == action)
  94. {
  95. TransmogEngine::GossipHelloMainMenu(player, creature);
  96. return true;
  97. }
  98.  
  99. if((MENU_TEXT + 3) == action)
  100. {
  101. GossipHelloInformationMenu(player, creature);
  102. return true;
  103. }
  104.  
  105. return false;
  106. }
  107.  
  108. bool GossipSelectTransmog(Player* player, Creature* creature, uint32 slotID)
  109. {
  110. Item* item = player->GetItemByPos(BAG, slotID);
  111. if(!item)
  112. {
  113. creature->MonsterWhisper("You don't have any items at the slot that you selected", player->GetGUID(), true);
  114. TransmogEngine::GossipHelloMainMenu(player, creature);
  115. return true;
  116. }
  117.  
  118. if(TransmogMgr::IsTransmogedItem(item->GetGUIDLow()))
  119. {
  120. creature->MonsterWhisper("Transmogrification has been removed succesfully", player->GetGUID(), true);
  121. TransmogEngine::RemoveTransmog(player, slotID);
  122. TransmogEngine::GossipHelloMainMenu(player, creature);
  123. return true;
  124. }
  125.  
  126. Loot* loot = TransmogEngine::CreateInterface(player, item);
  127.  
  128. if(loot->items.size() > 0)
  129. {
  130. TransmogEngine::AddInterfacePreparation(player, creature, loot, slotID);
  131. TransmogEngine::SendInterfaceOpen(player, creature, loot);
  132. }
  133. else
  134. creature->MonsterWhisper("You don't have any items at the slot that you selected", player->GetGUID(), true);
  135.  
  136. TransmogEngine::GossipHelloMainMenu(player, creature);
  137. return false;
  138. }
  139.  
  140. void GossipHelloInformationMenu(Player* player, Creature* creature)
  141. {
  142. player->PlayerTalkClass->ClearMenus();
  143.  
  144. std::string menuOutPut = "<< " + TransmogEngine::CreateColorString(COLOR_DARK_GREY, "Menu");
  145. std::string nevermindOutPut = TransmogEngine::CreateColorString(COLOR_DARK_GREY, " Nevermind") + "...";
  146.  
  147. player->ADD_GOSSIP_ITEM(5, menuOutPut, GOSSIP_SENDER_MAIN, MENU_TEXT + 2);
  148. player->ADD_GOSSIP_ITEM(5, nevermindOutPut, GOSSIP_SENDER_MAIN, MENU_TEXT + 1);
  149.  
  150. player->SEND_GOSSIP_MENU(TEXT_INFORMATION, creature->GetGUID());
  151. }
  152. };
  153.  
  154. class player_transmog : public PlayerScript
  155. {
  156. public:
  157. player_transmog() : PlayerScript("player_transmog") { }
  158.  
  159. void OnLogin(Player* player)
  160. {
  161. if(player)
  162. TransmogEngine::SetAllTransmogDisplay(player);
  163. }
  164.  
  165. void OnDelete(uint64 guid)
  166. {
  167. TransmogEngine::RemoveAllTransmogDB(guid);
  168. }
  169. };
  170.  
  171. void AddSC_transmog()
  172. {
  173. new npc_transmog();
  174. new player_transmog();
  175. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement