Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptPCH.h"
- class Tools : public CreatureScript
- {
- public:
- Tools() : CreatureScript("Tools") { }
- bool OnGossipHello(Player * player, Creature * creature)
- {
- if (player->isInCombat())
- {
- ChatHandler(player).SendSysMessage("|cffFF0000You are in combat!|r"); // Cannot access NPC.
- return false;
- }
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, "Browse my Tools", GOSSIP_SENDER_MAIN, 1);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Nevermind..", GOSSIP_SENDER_MAIN, 2);
- player->PlayerTalkClass->SendGossipMenu(1, creature->GetGUID());
- return true;
- }
- bool OnGossipSelect(Player * player, Creature* creature, uint32 uiSender, uint32 uiAction)
- {
- player->PlayerTalkClass->ClearMenus();
- switch(uiAction)
- {
- case 1:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Heal me!", GOSSIP_SENDER_MAIN, 3);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Give me Mana!", GOSSIP_SENDER_MAIN, 4);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Reset my Cooldowns!", GOSSIP_SENDER_MAIN, 5);
- player->PlayerTalkClass->SendGossipMenu(2, creature->GetGUID());
- break;
- case 2:
- player->CLOSE_GOSSIP_MENU();
- break;
- case 3:
- player->SetHealth(player->GetMaxHealth());
- player->CLOSE_GOSSIP_MENU();
- break;
- case 4:
- if ( player->getPowerType() == POWER_MANA )
- player->SetPower(POWER_MANA, player->GetMaxPower(POWER_MANA));
- player->CLOSE_GOSSIP_MENU();
- break;
- case 5:
- player->RemoveAllSpellCooldown();
- player->CLOSE_GOSSIP_MENU();
- }
- return true;
- }
- };
- void AddSC_Tools()
- {
- new Tools();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement