Advertisement
WIXXZI

Untitled

Jan 13th, 2013
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2.  
  3. class Tools : public CreatureScript
  4. {
  5. public:
  6. Tools() : CreatureScript("Tools") { }
  7.  
  8. bool OnGossipHello(Player * player, Creature * creature)
  9. {
  10. if (player->isInCombat())
  11. {
  12. ChatHandler(player).SendSysMessage("|cffFF0000You are in combat!|r"); // Cannot access NPC.
  13. return false;
  14. }
  15.  
  16. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, "Browse my Tools", GOSSIP_SENDER_MAIN, 1);
  17. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Nevermind..", GOSSIP_SENDER_MAIN, 2);
  18. player->PlayerTalkClass->SendGossipMenu(1, creature->GetGUID());
  19. return true;
  20. }
  21.  
  22. bool OnGossipSelect(Player * player, Creature* creature, uint32 uiSender, uint32 uiAction)
  23. {
  24. player->PlayerTalkClass->ClearMenus();
  25.  
  26. switch(uiAction)
  27. {
  28. case 1:
  29. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Heal me!", GOSSIP_SENDER_MAIN, 3);
  30. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Give me Mana!", GOSSIP_SENDER_MAIN, 4);
  31. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Reset my Cooldowns!", GOSSIP_SENDER_MAIN, 5);
  32. player->PlayerTalkClass->SendGossipMenu(2, creature->GetGUID());
  33. break;
  34.  
  35. case 2:
  36. player->CLOSE_GOSSIP_MENU();
  37. break;
  38.  
  39. case 3:
  40. player->SetHealth(player->GetMaxHealth());
  41. player->CLOSE_GOSSIP_MENU();
  42. break;
  43.  
  44. case 4:
  45. if ( player->getPowerType() == POWER_MANA )
  46. player->SetPower(POWER_MANA, player->GetMaxPower(POWER_MANA));
  47. player->CLOSE_GOSSIP_MENU();
  48. break;
  49.  
  50. case 5:
  51. player->RemoveAllSpellCooldown();
  52. player->CLOSE_GOSSIP_MENU();
  53. }
  54. return true;
  55. }
  56. };
  57.  
  58. void AddSC_Tools()
  59. {
  60. new Tools();
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement