Token Exchange System menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  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)

    Token Exchange System

    This lets you exchange tokens for items / item sets, and even exchange marks for tokens! Easy to understand, easy to configure, easy to use :)

    Code:
    #include "StdAfx.h"
    #include "Setup.h"
    
    #define MARKID 90909 //ID for the mark
    #define TOKENID 91919 //ID for the token.
    #define TRADERATE 5 //This manymarks = 1 token
    #define SUCMSG "Enjoy your prize :)" //Message when user gets his prize
    #define TOKMSG "You don't have enough tokens to buy this"
    #define MRKMSG "You don't have enough marks to get a token"
    #define NPCID 87001 //ID of the vendor NPC
    
    class SCRIPT_DECL Coin : 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 Coin::GossipHello(Object * pObject, Player* Plr, bool AutoSend)
    {
    //-----------------------------
    //Setup Main Categories/Items
    //-----------------------------
    GossipMenu *Menu;
    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
    Menu->AddItem(0, "Convert 5 Marks for 1 Token", 98);
    Menu->AddItem(0, "Category 1", 1);
    Menu->AddItem(0, "Category 2", 2);
    
    if(AutoSend)
    Menu->SendTo(Plr);
    }
    
    bool TradeForCoins(uint32 ItemId, uint8 reqAmt, Player* Plr)
    {
    if(Plr->GetItemInterface()->GetItemCount(TOKENID, false)>=reqAmt) {
    //remove tokens
    Plr->GetItemInterface()->RemoveItemAmt(TOKENID, reqAmt);
    //add item
    Item * pItem = objmgr.CreateItem(ItemId, Plr);
    Plr->GetItemInterface()->AddItemToFreeSlot(pItem);
    return true;
    }else{
    //not enough tokens
    return false;
    }
    }
    
    bool TradeMarks(Player* Plr)
    {
    if(Plr->GetItemInterface()->GetItemCount(MARKID,false)>=TRADERATE){
    //remove marks
    Plr->GetItemInterface()->RemoveItemAmt(MARKID, TRADERATE);
    //add tokens
    Item * pItem = objmgr.CreateItem(TOKENID,Plr);
    Plr->GetItemInterface()->AddItemToFreeSlot(pItem);
    return true;
    }else{
    //not enough marks to buy a token
    return false;
    }
    }
    bool TradeSet(uint32 ItemIdStart, uint32 ItemIdEnd, uint8 reqAmt, Player* Plr)
    {
    //Assuming ItemIdStart is lower than ItemIdEnd
    //Double check your code or else infinite loop will occur
    //And we certainly don't want that.
    if(Plr->GetItemInterface()->GetItemCount(TOKENID, false) >= reqAmt){
    //Remove coin
    Plr->GetItemInterface()->RemoveItemAmt(TOKENID, reqAmt);
    //Add set
    for(int i=ItemIdStart; i<=ItemIdEnd; i++){
    Item * pItem = objmgr.CreateItem(i, Plr);
    Plr->GetItemInterface()->AddItemToFreeSlot(pItem);
    }
    return true;
    }else{
    //Not enough tokens
    return false;
    }
    }
    
    void Coin::GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
    {
    Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NULL;
    if(pCreature==NULL)
    return;
    
    GossipMenu * Menu;
    switch(IntId)
    {
    case 0: // Return to start
    GossipHello(pCreature, Plr, true);
    break;
    
    case 1: //Category 1
    objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), 1, Plr);
    Menu->AddItem(5, "First item", 10);
    Menu->AddItem(5, "Second item", 11);
    Menu->AddItem(5, "Itemset", 12);
    Menu->AddItem(0, "[Back]", 99);
    Menu->SendTo(Plr);
    break;
    
    case 2: //Category 2
    objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), 1, Plr);
    Menu->AddItem(5, "First item", 20);
    Menu->AddItem(5, "Item set", 21);
    Menu->AddItem(0, "[Back]", 99);
    Menu->SendTo(Plr);
    break;
    
    case 10: //Item 1
    if (TradeForCoins(<itemid>, <itemprice>, Plr))
    {Plr->BroadcastMessage(SUCMSG);}
    else {Plr->BroadcastMessage(TOKMSG);}
    objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), 1, Plr);
    Menu->AddItem(0, "[Back]", 1);
    Menu->SendTo(Plr);
    break;
    
    case 11: //Item 2
    if (TradeForCoins(<itemid>, <itemprice>, Plr))
    {Plr->BroadcastMessage(SUCMSG);}
    else {Plr->BroadcastMessage(TOKMSG);}
    objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), 1, Plr);
    Menu->AddItem(0, "[Back]", 1);
    Menu->SendTo(Plr);
    break;
    
    case 12: //Itemset
    if (TradeSet(<itemid>, <itemid>, <itemprice>, Plr))
    {Plr->BroadcastMessage(SUCMSG);}
    else {Plr->BroadcastMessage(TOKMSG);}
    objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), 1, Plr);
    Menu->AddItem(0, "[Back]", 1);
    Menu->SendTo(Plr);
    break;
    
    case 98: //Convert Marks to Token
    if (TradeMarks(Plr))
    {Plr->BroadcastMessage("Have fun with your token!");}
    else {Plr->BroadcastMessage(MRKMSG);}
    objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), 1, Plr);
    Menu->AddItem(0, "[Back]", 1);
    Menu->SendTo(Plr);
    break;
    
    case 99: //main menu
    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
    Menu->AddItem(0, "Convert 5 Marks for 1 Token", 98);
    Menu->AddItem(0, "Category 1", 1);
    Menu->AddItem(0, "Category 2", 2);
    Menu->SendTo(Plr);
    break;
    } //end switch
    } //end void
    
    void Coin::GossipEnd(Object * pObject, Player* Plr)
    {
    GossipScript::GossipEnd(pObject, Plr);
    }
    
    void SetupCoin(ScriptMgr * mgr)
    {
    GossipScript * gs = (GossipScript*) new Coin();
    
    mgr->register_gossip_script(NPCID, gs);
    }
    Don't forget to add the gossip NPC in the database.
    If you want it to be portable, you can bind the menu to an item, and have a [Portable Mall], like so:
    Code:
    #include "StdAfx.h"
    #include "Setup.h"
    
    #ifdef WIN32
    #pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float'
    #endif
    #define MARKID 90909 //ID for the mark
    #define TOKENID 91919 //ID for the token.
    #define TRADERATE 5 //This much marks = 1 token
    #define SUCMSG "Enjoy your prize smile.gif" //Message when user gets his prize
    #define TOKMSG "You don't have enough tokens to buy this"
    #define MRKMSG "You don't have enough marks to get a token"
    
    //Defining Warper
    class SCRIPT_DECL Warper2 : 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;
    }
    };
    bool TradeForCoins(uint32 ItemId, uint8 reqAmt, Player* Plr)
    {
    if(Plr->GetItemInterface()->GetItemCount(TOKENID, false)>=reqAmt) {
    //remove tokens
    Plr->GetItemInterface()->RemoveItemAmt(TOKENID, reqAmt);
    //add item
    Item * pItem = objmgr.CreateItem(ItemId, Plr);
    Plr->GetItemInterface()->AddItemToFreeSlot(pItem);
    return true;
    }else
    {
    //not enough tokens
    return false;
    }
    }
    
    bool TradeMarks(Player* Plr)
    {
    if(Plr->GetItemInterface()->GetItemCount(MARKID,false)>=TRADERATE){
    //remove marks
    Plr->GetItemInterface()->RemoveItemAmt(MARKID, TRADERATE);
    //add tokens
    Item * pItem = objmgr.CreateItem(TOKENID,Plr);
    Plr->GetItemInterface()->AddItemToFreeSlot(pItem);
    return true;
    }else{
    //not enough marks to buy a token
    return false;
    }
    }
    bool TradeSet(uint32 ItemIdStart, uint32 ItemIdEnd, uint8 reqAmt, Player* Plr)
    {
    //Assuming ItemIdStart is lower than ItemIdEnd
    //Double check your code or else infinite loop will occur
    //And we certainly don't want that.
    if(Plr->GetItemInterface()->GetItemCount(TOKENID, false) >= reqAmt){
    //Remove coin
    Plr->GetItemInterface()->RemoveItemAmt(TOKENID, reqAmt);
    //Add set
    for(int i=ItemIdStart; i<=ItemIdEnd; i++){
    Item * pItem = objmgr.CreateItem(i, Plr);
    Plr->GetItemInterface()->AddItemToFreeSlot(pItem);
    }
    return true;
    }else{
    //Not enough tokens
    return false;
    }
    }
    
    void Warper2::GossipHello(Object* pObject, Player * Plr, bool AutoSend)
    {
    
    
    GossipMenu *Menu;
    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);
    Menu->AddItem(0, "Convert 5 Marks to 1 Token", 1);
    Menu->AddItem(0, "Tier 7 Sets", 2);
    //Menu->AddItem(0, "Tier 7 Parts", 3);
    Menu->AddItem(0, "Other Items", 4);
    if(AutoSend)
    Menu->SendTo(Plr);
    };
    
    
    
    
    //Defining Cases
    void Warper2::GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
    {
    GossipMenu * Menu;
    switch(IntId)
    {
    case 1:
    if (TradeMarks(Plr))
    {Plr->BroadcastMessage("Have fun with your token!");}
    else {Plr->BroadcastMessage(MRKMSG);}
    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);
    Menu->SendTo(Plr);
    break;
    
    case 2:
    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);
    Menu->AddItem(5, "Rogue - 10 Tokens", 10);
    Menu->AddItem(5, "Warrior - 10 Tokens", 11);
    Menu->AddItem(5, "Mage - 10 Tokens", 12);
    //Menu->AddItem(5, "Shaman", 13);
    //Menu->AddItem(5, "Warlock", 14);
    //Menu->AddItem(5, "Paladin", 15);
    //Menu->AddItem(5, "Priest", 16);
    //Menu->AddItem(5, "Hunter", 17);
    //Menu->AddItem(5, "Druid", 18);
    Menu->SendTo(Plr);
    break;
    
    case 3:
    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);
    Menu->AddItem(5, "Rogue", 20);
    Menu->AddItem(5, "Warrior", 21);
    Menu->AddItem(5, "Mage", 22);
    //Menu->AddItem(5, "Shaman", 23);
    //Menu->AddItem(5, "Warlock", 24);
    //Menu->AddItem(5, "Paladin", 25);
    //Menu->AddItem(5, "Priest", 26);
    //Menu->AddItem(5, "Hunter", 27);
    //Menu->AddItem(5, "Druid", 28);
    Menu->SendTo(Plr);
    
    case 4:
    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);
    Menu->AddItem(5, "Flying Carpet - Flies in Azeroth - 20 Tokens", 31);
    Menu->AddItem(5, "Phoenix - Flies in Azeroth - 35 Tokens", 32);
    Menu->AddItem(5, "Endless Bag - 36 slots! - 1 Token", 33);
    Menu->SendTo(Plr);
    break;
    
    case 10:
    if (TradeSet(91000, 91007, 10, Plr))
    {Plr->BroadcastMessage(SUCMSG);}
    else {Plr->BroadcastMessage(TOKMSG);}
    Plr->Gossip_Complete();
    break;
    
    case 11:
    if (TradeSet(92000, 92007, 10, Plr))
    {Plr->BroadcastMessage(SUCMSG);}
    else {Plr->BroadcastMessage(TOKMSG);}
    Plr->Gossip_Complete();
    break;
    
    case 12:
    if (TradeSet(93000, 93007, 10, Plr))
    {Plr->BroadcastMessage(SUCMSG);}
    else {Plr->BroadcastMessage(TOKMSG);}
    Plr->Gossip_Complete();
    break;
    
    case 31:
    if (TradeForCoins(98988, 20, Plr))
    {Plr->BroadcastMessage(SUCMSG);}
    else {Plr->BroadcastMessage(TOKMSG);}
    Plr->Gossip_Complete();
    break;
    
    case 32:
    if (TradeForCoins(90001, 35, Plr))
    {Plr->BroadcastMessage(SUCMSG);}
    else {Plr->BroadcastMessage(TOKMSG);}
    Plr->Gossip_Complete();
    break;
    
    case 33:
    if (TradeForCoins(90003, 1, Plr))
    {Plr->BroadcastMessage(SUCMSG);}
    else {Plr->BroadcastMessage(TOKMSG);}
    Plr->Gossip_Complete();
    break;
    
    
    }
    };
    
    void Warper2::GossipEnd(Object * pObject, Player* Plr)
    {
    GossipScript::GossipEnd(pObject, Plr);
    }
    
    void SetupWarper2(ScriptMgr * mgr)
    {
    GossipScript * gs = (GossipScript*) new Warper2();
    mgr->register_item_gossip_script(60002,gs);
    }
    Again don't forget to add an item with the entry 60002 (or change the entry in the code) with spell 33208.

    Token Exchange System
  2. #2
    staskax's Avatar Member
    Reputation
    31
    Join Date
    Dec 2007
    Posts
    146
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    erm ... could u insert ANY instructions ?


  3. #3
    shakib's Avatar Member
    Reputation
    1
    Join Date
    Aug 2006
    Posts
    11
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is there anyway to trick the server into making it think u have enough tokens lol

  4. #4
    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)
    Nice man, good work +Rep


  5. #5
    Creepfold's Avatar Contributor
    Reputation
    176
    Join Date
    Jul 2007
    Posts
    536
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1. belongs at guides
    2. instructions would be nice
    RickAstley LUA Boss! (Rickroll)
    mmowned.com/forums/emulator-server-releases/171755-epic-release-rick-astley-rickroll-boss-lua.html#post1119442

  6. #6
    Ballwinkle's Avatar Contributor Authenticator enabled
    Reputation
    124
    Join Date
    Mar 2007
    Posts
    662
    Thanks G/R
    0/12
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    copied from ascentemu.com sigh..

  7. #7
    Gastricpenguin's Avatar Legendary
    Reputation
    980
    Join Date
    Feb 2007
    Posts
    2,236
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually this isnt a guide Zerg.
    Belongs here
    Life Puzzler WoW - Website | Forums

  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)
    Well Ballwinkle this is his edited version from ascentemu but he should throw in some credits to the original author too


  9. #9
    staskax's Avatar Member
    Reputation
    31
    Join Date
    Dec 2007
    Posts
    146
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    erm ... any instructions ?


  10. #10
    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)
    Well I suppose we could compile it for you guys


  11. #11
    OMGPWN's Avatar Active Member
    Reputation
    35
    Join Date
    Oct 2006
    Posts
    431
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol you stole from another site and posted it here saying its simple though you dont understand it but u think we would. Clever. +1 rep for stealing instead of 2

  12. #12
    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)
    this is his edited version why are you all saying he stole it, here the original post for proof: Board Message


  13. #13
    staskax's Avatar Member
    Reputation
    31
    Join Date
    Dec 2007
    Posts
    146
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    :)

    Originally Posted by insanesk8123 View Post
    Well I suppose we could compile it for you guys
    ill be waiting


  14. #14
    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)
    what rev would you like


  15. #15
    staskax's Avatar Member
    Reputation
    31
    Join Date
    Dec 2007
    Posts
    146
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ascent 3.6 - TRUNK r3522 . i guess thats it xD


Page 1 of 2 12 LastLast

Similar Threads

  1. PvP Token System!
    By Performer in forum World of Warcraft Emulator Servers
    Replies: 6
    Last Post: 02-03-2008, 03:42 PM
  2. [release]Token to item exchanger, for tier 7, 8, 9
    By jokerjokes in forum World of Warcraft Emulator Servers
    Replies: 50
    Last Post: 01-30-2008, 02:50 PM
  3. [Question] DKP/Token Tracking System
    By OutsideOfDreams in forum WoW UI, Macros and Talent Specs
    Replies: 0
    Last Post: 12-21-2007, 02:19 PM
  4. [Release] EnderfectX Custom Token System
    By EnderfectX in forum World of Warcraft Emulator Servers
    Replies: 22
    Last Post: 12-20-2007, 01:51 AM
All times are GMT -5. The time now is 05:26 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.
Digital Point modules: Sphinx-based search