Advertisement
Guest User

Untitled

a guest
Jan 15th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.21 KB | None | 0 0
  1. #include "Define.h"
  2. #include "GossipDef.h"
  3. #include "Item.h"
  4. #include "Player.h"
  5. #include "ScriptedGossip.h"
  6. #include "ScriptMgr.h"
  7. #include "Spell.h"
  8.  
  9. class charstone_ItemGossip : public ItemScript
  10. {
  11. public:
  12.     charstone_ItemGossip() : ItemScript("charstone_ItemGossip") { }
  13.  
  14.     bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/) override // Any hook here
  15.     {
  16.         sLog->outDebug(LOG_FILTER_SQL, "charstone_ItemGossip message ... HELLO");
  17.  
  18.         player->PlayerTalkClass->ClearMenus(); // Clears old options
  19.         player->ADD_GOSSIP_ITEM(0, "Goto Mall", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
  20.         player->ADD_GOSSIP_ITEM(0, "Goto Dummy Area", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
  21.         player->ADD_GOSSIP_ITEM(0, "Goto Duel Zone", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
  22.         player->ADD_GOSSIP_ITEM(0, "Reset Cooldowns", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
  23.         player->ADD_GOSSIP_ITEM(0, "Repair Items", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
  24.         player->ADD_GOSSIP_ITEM(0, "Reset Talents", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6);
  25.  
  26.         player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, item->GetGUID());
  27.         return true; // Cast the spell on use normally
  28.     }
  29.  
  30.     void OnGossipSelect(Player* player, Item* /*item*/, uint32 /*sender*/, uint32 action) override
  31.     {
  32.         player->PlayerTalkClass->ClearMenus();
  33.  
  34.         switch (action)
  35.         {
  36.             case GOSSIP_ACTION_INFO_DEF + 1:
  37.                 player->TeleportTo(870, 3795.498535, 533.554199, 639.007446, 3.034940);
  38.                 player->CLOSE_GOSSIP_MENU();
  39.                 break;
  40.             case GOSSIP_ACTION_INFO_DEF + 2:
  41.                 player->TeleportTo(870, -77.167274, -5399.377441, 150.105423, 6.150439);
  42.                 player->CLOSE_GOSSIP_MENU();
  43.                 break;
  44.             case GOSSIP_ACTION_INFO_DEF + 3:
  45.                 player->TeleportTo(870, -192.235474, -5372.152344, 123.077499, 2.898886);
  46.                 player->CLOSE_GOSSIP_MENU();
  47.                 break;
  48.             case GOSSIP_ACTION_INFO_DEF + 4:
  49.                 player->CombatStop();
  50.                 player->CLOSE_GOSSIP_MENU();
  51.                 break;
  52.             case GOSSIP_ACTION_INFO_DEF + 5:
  53.                 player->ResetTalents();
  54.                 player->CLOSE_GOSSIP_MENU();
  55.                 break;
  56.         }
  57.         player->CLOSE_GOSSIP_MENU();
  58.     }
  59. };
  60.  
  61. void AddSC_charstone_ItemGossip() // Add to scriptloader normally
  62. {
  63.     new charstone_ItemGossip();
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement