[C++] Improved Hearthstone menu

User Tag List

Results 1 to 8 of 8
  1. #1
    Sounddead's Avatar Contributor
    Reputation
    160
    Join Date
    Sep 2007
    Posts
    1,126
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [C++] Improved Hearthstone

    Imp Hearthstone



    A pretty simple, but imo useful script. It simply records your coordinates when you click "Go Home" and teleports you to your hearthstone location. Then, when your done selling all of your items/doing whatever (maybe you wanted to do a battleground for a bit) you can click the item again and click "Go Back" which will teleport you right back to where you first used the item. Right back into the action.

    I made it pretty much because when I was right in the middle of a quest or something and I needed to either repair or sell my shit, i didn't want to hearth back to town and then have to walk all the way back to what I was doing.
    I'm not including the SQL because i'm sure all of you smrt people on this forum can figure out how to make an item

    Tested on ArcEmu, but it would be easily modified for any Ascent based emulator.

    Step 1:


    Step 2:


    Step 3:


    Step 4:


    Step 5:



    Script:
    Code:
    #include "StdAfx.h"
    #include "Setup.h"
     
    const char* menuText = "Go Home";
    int menuId = 1;
    float playerX;
    float playerY;
    float playerZ;
    float playerO;
    int instanceId;
    uint32 mapId;
     
    class SCRIPT_DECL ImpHearthstone : public GossipScript
    {
    public:
        void GossipHello(Object * pObject, Player * Plr, bool AutoSend);
        void GossipSelectOption(Object *  pObject, Player * Plr, uint32 Id, uint32 IntId, const char * Code);
        void GossipEnd(Object * pObject, Player * Plr){GossipScript::GossipEnd(pObject, Plr);}
        void Destroy(){delete this;}
    };
     
    void ImpHearthstone::GossipHello(Object * pObject, Player * Plr, bool AutoSend)
    {
        GossipMenu *Menu;
        objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
     
        Menu->AddItem(0, menuText, menuId);
        Menu->AddItem(0, "Reset", 3);
     
        if(AutoSend)
            Menu->SendTo(Plr); 
    }
     
    void ImpHearthstone::GossipSelectOption(Object * pObject, Player * Plr, uint32 Id, uint32 IntId, const char * Code)
    {
        switch(IntId)
        {
        case 1:
            {
                Player * pTarget = Plr->GetMapMgr()->GetPlayer(Plr->GetGUID());
                mapId = Plr->GetMapId();
                playerX = Plr->GetPositionX();
                playerY = Plr->GetPositionY();
                playerZ = Plr->GetPositionZ();
                playerO = Plr->GetOrientation();
                instanceId =Plr->GetInstanceID();
     
                Plr->CastSpell(pTarget, 8690, true);
                menuText = "Go Back";
                menuId = 2;
                Plr->Gossip_Complete();
            }
            break;
     
        case 2:
            {
                Plr->SafeTeleport(mapId, instanceId, playerX, playerY, playerZ, playerO);
                menuText = "Go Home";
                menuId = 1;
                Plr->Gossip_Complete();
            }
            break;
         case 3:
            {
                menuText = "Go Home";
                menuId = 1;
                Plr->Gossip_Complete();
            }
        }
    }
     
    void SetupImpHearthstone(ScriptMgr * mgr)
    {
        GossipScript * itr = (GossipScript*) new ImpHearthstone();
        mgr->register_item_gossip_script(ITEMID, itr);
    }
    Change ITEMID to the Id of your item.

    Please report any bugs/additions you would like to see to this script in this thread. Don't PM me you bums.
    I will be adding a few more things within the next few days, but I don't have time atm to be on the computer.

    Updated 1.0:
    -Reset button
    -Closes on select option
    Last edited by Sounddead; 10-09-2009 at 07:56 PM.

    I live in a shoe

    [C++] Improved Hearthstone
  2. #2
    Stabatha's Avatar Contributor
    Reputation
    84
    Join Date
    Dec 2007
    Posts
    345
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Pretty nice idea! Also don't forget to change the item's spellid_1 to 33208 so it will gossip

    GoblinCity.net -
    Home of the only Cataclysm Twink Server
    Instant Level 49 * Custom Gear * Scripted Raids * Tons More
    We are the oldest private twink server community - Open since 2007

  3. #3
    Sounddead's Avatar Contributor
    Reputation
    160
    Join Date
    Sep 2007
    Posts
    1,126
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Updated & thanks

    I live in a shoe

  4. #4
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Very good idea, this is really useful actually. +Rep

  5. #5
    Sounddead's Avatar Contributor
    Reputation
    160
    Join Date
    Sep 2007
    Posts
    1,126
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why thank you kind sir.

    I live in a shoe

  6. #6
    Pragma's Avatar Contributor
    Reputation
    261
    Join Date
    Feb 2007
    Posts
    630
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Very nice, although i think because playerX, playerY, etc variables are declared globally, if you had more than one player online you would get some weird results. For example, if Player #1 uses his hearth and his location are assigned to those variables then Player #2 uses his stone Player #2's location is going to replace Player #1's location information, then when Player #1 uses his stone to return to his previous location he will appear at Player #2's previous location.


  7. #7
    Sounddead's Avatar Contributor
    Reputation
    160
    Join Date
    Sep 2007
    Posts
    1,126
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Never tested it with more than 1 player, but if them being declared globally does make a difference I will change it around

    I live in a shoe

  8. #8
    Pragma's Avatar Contributor
    Reputation
    261
    Join Date
    Feb 2007
    Posts
    630
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it might be a little harder than said, because you gotta make an indexed array so you can have a place to store every separate players info.

    I'd use a map and make a custom class to hold each player's info, like this:
    Code:
    #include <map>
    
    class TeleInfo{
    
       public:
       TeleInfo(float x, float y, float z, int map, int instance) : pX(x), pY(y), pZ(z), pMap(map), pInstance(instance) {};
    
       ~TeleInfo() {};
    
       float pX, pY, pZ;
       int pMap, pInstance;
    };
    
    std::map<uint32, TeleInfo> plrTeleMap;
    std::map<uint32, TeleInfo>::Iterator pItr;
    
    void ImpHearthstone::GossipSelectOption(Object * pObject, Player * Plr, uint32 Id, uint32 IntId, const char * Code)
    {
        switch(IntId)
        {
        case 1: //save previous location
            {
                plrTeleMap.insert(std::make_pair(Plr->getGuid(),     TeleInfo(Plr->GetX(), Plr->GetY(), Plr->GetZ(), Plr->GetMap(), Plr->GetInstanceID())));
                
                Plr->Gossip_Complete();
             }break;
        
        case 2: //reset previous location
            {
                pItr = plrTeleMap.find(Plr->GetGuid());
                plrTeleMap.erase(pItr);
                Plr->Gossip_Complete();
            }break;
    
        case 3: //Tele to previous location
            {
                pItr = plrTeleMap.find(Plr->GetGUID());
                if (pItr != plrTeleMap.end())
                {
                   TeleInfo *pInf = pItr.second;
                   Plr->SafeTeleport(pInf->pMap, pInf->pInstance, pInf->pX, pInf->pY, pInf->pZ, 0);
                   Plr->Gossip_Complete();
                }
                else
                {
                   Plr->BroadcastMessage("You do not have a saved previous location!");
                   Plr->Gossip_Complete();
                }
             }break;
          }
    }
    now thats a fairly rough example, and proly has some errors, but shows roughly what you need. It's weird how hard it is to do that.


Similar Threads

  1. warsong gulch lvl 60 in 10-19 improved that works
    By Tubz in forum World of Warcraft Exploits
    Replies: 18
    Last Post: 09-04-2006, 06:38 AM
  2. Cross-Team Hearthstone
    By Matt in forum World of Warcraft Exploits
    Replies: 12
    Last Post: 09-03-2006, 05:26 PM
  3. Interrupt others hearthstone
    By blomstervand in forum World of Warcraft Guides
    Replies: 9
    Last Post: 07-27-2006, 06:22 PM
  4. Yet another hearthstone trick
    By lvlrbojang1es in forum World of Warcraft Exploits
    Replies: 4
    Last Post: 06-19-2006, 02:48 PM
  5. [Exploit] Use Hearthstone to get fromm A to B and back to A
    By Matt in forum World of Warcraft Exploits
    Replies: 2
    Last Post: 05-14-2006, 01:02 AM
All times are GMT -5. The time now is 02:02 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search