Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- <--------------------------------------------------------------------------->
- Made by : Buxbunny
- Description : User stone (Teleport / Repair / Reset talents ).
- Script name to be used in the SQL query : user_stone
- Before you compile please change TeleportTo(Z, X, Y, Z, O) with the right
- coords to match your starter / duel area if you have any.
- <--------------------------------------------------------------------------->
- */
- #include "ScriptMgr.h"
- #include "ScriptedCreature.h"
- #include "Spell.h"
- class user_stone : public ItemScript
- {
- public:
- user_stone() : ItemScript("user_stone") { }
- bool OnUse(Player* player, Item* item, const SpellCastTargets &)
- {
- if (player->IsInCombat())
- {
- player->GetSession()->SendNotification("You can't use this item in combat!");
- return false;
- }
- player->PlayerTalkClass->ClearMenus();
- player->ADD_GOSSIP_ITEM(0, "Starter Area", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
- player->ADD_GOSSIP_ITEM(0, "Duel Zone", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
- player->ADD_GOSSIP_ITEM(0, "Teleport me to Dalaran", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
- player->ADD_GOSSIP_ITEM(0, "Repair my gear", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
- player->ADD_GOSSIP_ITEM(0, "Reset my talents", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
- player->ADD_GOSSIP_ITEM(0, "Remove sickness", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6);
- player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, item->GetGUID());
- return false;
- }
- void OnGossipSelect(Player* player, Item* /*item*/, uint32 /*sender*/, uint32 action) override
- {
- player->PlayerTalkClass->ClearMenus();
- switch (action)
- {
- case GOSSIP_ACTION_INFO_DEF + 1:
- player->TeleportTo(Z, X, Y, Z, O);
- break;
- case GOSSIP_ACTION_INFO_DEF + 2:
- player->TeleportTo(Z, X, Y, Z, O);
- break;
- case GOSSIP_ACTION_INFO_DEF + 3:
- player->TeleportTo(571, 5804.149902, 624.770996, 647.767029, 1.640000);
- break;
- case GOSSIP_ACTION_INFO_DEF + 4:
- player->DurabilityRepairAll(false, 0, false);
- player->CLOSE_GOSSIP_MENU();
- break;
- case GOSSIP_ACTION_INFO_DEF + 5:
- player->ResetTalents(true);
- player->SendTalentsInfoData(false);
- player->CLOSE_GOSSIP_MENU();
- break;
- case GOSSIP_ACTION_INFO_DEF + 6:
- if (player->HasAura(15007))
- player->RemoveAura(15007);
- player->CLOSE_GOSSIP_MENU();
- break;
- }
- player->CLOSE_GOSSIP_MENU();
- }
- };
- void AddSC_user_stone()
- {
- new user_stone();
- }
Advertisement
Add Comment
Please, Sign In to add comment