[C++] Friend Porter menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    TheSpidey's Avatar Elite User
    Reputation
    365
    Join Date
    Jan 2008
    Posts
    2,200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [C++] Friend Porter

    Friend Porter

    Description:
    This gossip script lets players teleport to other players for a set amount of gold. When they use this item, a text box shows up, in which they input the name of the player they wish to port to. Then, if the rules allow it, they will port to his location.

    This is the script you've seen in countless repacks and servers.

    Code:
    /*
     * Friend Porter
     * Copyright (C) 2008 Spidey <http://www.aspiredev.org/>
     *
     * This program is free software: you can redistribute it and/or modify
     * it under the terms of the GNU Affero General Public License as published by
     * the Free Software Foundation, either version 3 of the License, or
     * any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU Affero General Public License for more details.
     *
     * You should have received a copy of the GNU Affero General Public License
     * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     *
     */
    
    #include "StdAfx.h"
    #include "Setup.h"
    
    // This determines the cost of the port in copper
    #define FRIENDCOST 100000
    // The ID of the item used
    #define FRIENDPORTID 61000
    
    #define FP_ERR(s)\
    			Plr->BroadcastMessage(s);\
    			Plr->Gossip_Complete();\
    			return;
    
    class SCRIPT_DECL FriendGrab : 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);
    	void Destroy()
    	{
    		delete this;
    	}
    };
    
    void FriendGrab::GossipHello(Object * pObject, Player* Plr, bool AutoSend)
    {
    	if(Plr->GetUInt32Value(PLAYER_FIELD_COINAGE) < FRIENDCOST)
    	{
    		Plr->BroadcastMessage("You don't have enough gold to teleport to another player.");
    		return;
    	}
    	GossipMenu *Menu;
        objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
    	Menu->AddItem(1, "Teleport to friend", 1, 1);
    	//Note:
    	// When menus have only one item, the one item gets auto-picked;
    	// The text "Teleport to friend" will not show up ingame unless you add at least one other item.
    	// Instead, the item will automatically pop the code request window.
    	
        if(AutoSend)
            Menu->SendTo(Plr);
    }
    
    void FriendGrab::GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
    {
        switch(IntId)
        {
    		case 0:
    		{
    			GossipHello(pObject, Plr, true);
    		}break;
    		case 1:
    		{
    			if(!Code)
    				return;
    				
    			if(Plr->GetUInt32Value(PLAYER_FIELD_COINAGE) < FRIENDCOST)
    				return;
    
    			Player * pTarget = objmgr.GetPlayer(Code, false);
    			if(!pTarget)
    				FP_ERR("Player does not exist or is offline.");
    			
    			if(pTarget->GetSession()->HasGMPermissions())
    				FP_ERR("Player does not exist or is offline."); //As to not expose GMs
    			
    			if(Plr->CombatStatus.IsInCombat())
    				FP_ERR("You cannot teleport while in combat.");
    			
    			if(Plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAG_FREE_FOR_ALL_PVP))
    				FP_ERR("You can't port while in a PvP zone.");
    			
    			if(pTarget->GetTeam() != Plr->GetTeam())
    				FP_ERR("Player is from the opposing faction.");
    
    			if(pTarget->CombatStatus.IsInCombat())
    				FP_ERR("Your friend is in combat, you cannot teleport to him now.");
    
    			if(pTarget->HasFlag(PLAYER_FLAGS, PLAYER_FLAG_FREE_FOR_ALL_PVP))
    				FP_ERR("You can't port to a player in a PvP zone.");
    			
    			uint32 pMap = pTarget->GetMapId();
    			if(pMap != 0 && pMap != 1 && pMap != 530) //Assume that all other maps are instances
    				FP_ERR("Cannot port to a player inside an instance");
    			
    			//if we reached so far, the player can port
    			Plr->SetUInt32Value(PLAYER_FIELD_COINAGE, Plr->GetUInt32Value(PLAYER_FIELD_COINAGE)-FRIENDCOST);
    			float pX = pTarget->GetPositionX();
    			float pY = pTarget->GetPositionY();
    			float pZ = pTarget->GetPositionZ();
    			float pO = pTarget->GetOrientation();
    			Plr->Gossip_Complete();
    			pTarget->BroadcastMessage("%s is porting to your location.", Plr->GetName());
    			Plr->EventTeleport(pMap, pX, pY, pZ);
    			Plr->SetOrientation(pO);
    		}break;
        }
    };
    
    void FriendGrab::GossipEnd(Object * pObject, Player* Plr)
    {
    	GossipScript::GossipEnd(pObject, Plr);
    }
    
    void SetupFriendPorter(ScriptMgr * mgr)
    {
    	GossipScript * gs = (GossipScript*) new FriendGrab();
    	mgr->register_item_gossip_script(FRIENDPORTID, gs);
    }

    [C++] Friend Porter
  2. #2
    stoneharry's Avatar Moderator Harry

    Authenticator enabled
    Reputation
    1613
    Join Date
    Sep 2007
    Posts
    4,554
    Thanks G/R
    150/146
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Just a couple of questions, if the friend is in a instance, you cant normaly teleport to them unless your in there group. Will it still charge you after failing to get in?
    Also can the other player stop the person appearing at there location if it's anoying them?
    Apart from that looks very nice I might use it, +Rep

    Edit: 24 hour cooldown Will rep tommoro
    Last edited by stoneharry; 11-01-2008 at 04:19 PM.

  3. #3
    Fireblast's Avatar Contributor
    Reputation
    195
    Join Date
    Aug 2008
    Posts
    883
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nice TheSpidey, would love to try it sometime.

  4. #4
    TheSpidey's Avatar Elite User
    Reputation
    365
    Join Date
    Jan 2008
    Posts
    2,200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stoneharry View Post
    Just a couple of questions, if the friend is in a instance, you cant normaly teleport to them unless your in there group. Will it still charge you after failing to get in?
    Also can the other player stop the person appearing at there location if it's anoying them?
    Apart from that looks very nice I might use it, +Rep

    Edit: 24 hour cooldown Will rep tommoro
    If, for any reason stated above, you're not able to teleport to your friend, you will not be charged.

    The target player cannot stop the teleporting player in this version.

  5. #5
    AzolexX's Avatar Contributor
    Reputation
    179
    Join Date
    May 2007
    Posts
    587
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    +REPx2 man Good job! BTW Unban me from irc lol. (hasbrowow)

    Find about scripting, programming and music! My blog: https://worldofsmth.wordpress.com!

  6. #6
    EmuX's Avatar Active Member
    Reputation
    29
    Join Date
    Feb 2008
    Posts
    172
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Didn't gastric make this?

  7. #7
    TheSpidey's Avatar Elite User
    Reputation
    365
    Join Date
    Jan 2008
    Posts
    2,200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nope. I did

  8. #8
    Darksid's Avatar Member
    Reputation
    19
    Join Date
    Jun 2008
    Posts
    375
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what should the item be like can it be anything?

  9. #9
    bleach12233's Avatar Member
    Reputation
    2
    Join Date
    Nov 2008
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Great release spidey! I'm sure this will help out alot of players on my server.

  10. #10
    Darksid's Avatar Member
    Reputation
    19
    Join Date
    Jun 2008
    Posts
    375
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Spidey what should the item be like? i know the id is 61000 and i made an item but its not working, and when i load the dll it loads.... Could you put the sql here for us?

  11. #11
    Chuck Norris's Avatar Member
    Reputation
    32
    Join Date
    Oct 2007
    Posts
    134
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Google won't search for Chuck Norris because it knows you don't find Chuck Norris, he finds you.

  12. #12
    Darksid's Avatar Member
    Reputation
    19
    Join Date
    Jun 2008
    Posts
    375
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What should the sql be? could you post it?

  13. #13
    XXXJOGIXXX's Avatar Member
    Reputation
    1
    Join Date
    Jun 2008
    Posts
    13
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    edit now my Friend Porter work you are great
    Last edited by XXXJOGIXXX; 01-09-2009 at 03:19 PM.

  14. #14
    Darksid's Avatar Member
    Reputation
    19
    Join Date
    Jun 2008
    Posts
    375
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So my question still isnt answered! what should the sql be, because i add the item to my bag and it doesnt work. But the DLL loads

  15. #15
    keazain's Avatar Banned
    Reputation
    234
    Join Date
    Jun 2008
    Posts
    660
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    insert into `items` values ('61000','15','0','-1','Friendport Token','Trade this Token to Teleport a friend at our Friendporter NPC','','','41565','2','0','0','0','0','-1','-1','1','0','0','0','0','0','0','0','0','0','100','0','0','0','0','0','0','0','0' ,'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0' ,'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0' ,'0','0','0','-1','0','-1','0','0','0','-1','0','-1','0','0','0','-1','0','-1','0','0','0','-1','0','-1','0','0','0','-1','0','-1','1','Trade this token for teleporting a friend','0','0','0','0','0','-1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','0');

    Darksid, try this one

    Nice done spider +rep

Page 1 of 2 12 LastLast

Similar Threads

  1. Portable Morpher, Wishing Stone and Friend-Porter.
    By Syrup in forum WoW EMU General Releases
    Replies: 25
    Last Post: 08-29-2008, 10:44 AM
  2. make your friends say things they dont want to say!
    By Krazzee in forum World of Warcraft Exploits
    Replies: 63
    Last Post: 05-20-2007, 10:45 AM
  3. very old ZG exploit back up...welcome back old friend
    By TMK in forum World of Warcraft Exploits
    Replies: 11
    Last Post: 09-02-2006, 11:04 PM
  4. Idiot Friends.
    By dela in forum World of Warcraft General
    Replies: 9
    Last Post: 08-26-2006, 04:50 PM
  5. Hunters Best Friend
    By Tbone in forum World of Warcraft Guides
    Replies: 1
    Last Post: 06-22-2006, 06:20 PM
All times are GMT -5. The time now is 06:54 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search