ZEN Shop (kinda currency)

Results 1 to 1 of 1
  1. #1
    Elite Member KHDreams is offline
    Member +Rank
    Mar 2008 Join Date
    Heukelum, The NetherlandsLocation
    242Posts

    ZEN Shop (kinda currency)

    Well, I'm a really basic scripter.
    I'm trying to make a currency shop.. for my server.
    But the menu's doesnt appear right. Some of them should be hidden if you don't have enough ZEN (its a currency)
    Also if you take the 1-50 menu, it directly goes to case 5601..
    The other button doesn't react..

    I don't know what i've done wrong..

    Code:
    #include "StdAfx.h"
        #include "Setup.h"
    
        #ifdef WIN32
        #pragma warning(disable:4305)
        class SCRIPT_DECL ZEN : 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 ZEN::GossipHello(Object* pObject, Player * Plr, bool AutoSend)
        { 
            if(Plr->CombatStatus.IsInCombat())
            {
                Plr->BroadcastMessage("You are in combat!");
            }
             if(!Plr->CombatStatus.IsInCombat() )
            {
            
            GossipMenu *Menu;
            objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);
            if(Plr->GetItemInterface()->GetItemCount(80001, 1))
            {Menu->AddItem(0, "Welcome to the ZEN Shop!", 1);
            //Hier shop invullen
    
    if(Plr->GetItemInterface()->GetItemCount(80001, 1))
            {Menu->AddItem(1, "Items between 1-50 FinalWoW ZEN", 5000);}else{}
    
            if(Plr->GetItemInterface()->GetItemCount(80001, 150))
            {Menu->AddItem(1, "Items between 150-175 FinalWoW ZEN", 15000);}else{}
    
    
            //Einde Shop invullen
            }else{
                Menu->AddItem(0, "You don't have any FinalWoW ZEN!", 1);
                Menu->AddItem(0, "Come back when you have some to spend", 1);
            }
            if(AutoSend)
                Menu->SendTo(Plr);
        }
    };
        
        
            void ZEN::GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
        {
            GossipMenu * Menu;
            float  Speed     = 7.0;
            uint32 displayid = 0;
            uint32 eventid   = 5;
            uint32  xxx     = 0;
            bool   flytf     = false;
            bool apply = false;
        switch(IntId)
            { 
    
    case 1: //main menu
            {
            objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
            if(Plr->GetItemInterface()->GetItemCount(80001, 1))
            {Menu->AddItem(0, "Welcome to the ZEN Shop!", 1);
            //Hier shop invullen
    
    
            if(Plr->GetItemInterface()->GetItemCount(80001, 1))
            {Menu->AddItem(1, "Items between 1-50 FinalWoW ZEN", 5000);}else{/*Hier niks invullen*/}
    
            if(Plr->GetItemInterface()->GetItemCount(80001, 150))
            {Menu->AddItem(1, "Items between 150-250 FinalWoW ZEN", 15000);}else{/*Hier niks invullen*/}
    
    
            //Einde Shop invullen
            }else{
                Menu->AddItem(0, "You don't have any FinalWoW ZEN!", 1);
                Menu->AddItem(0, "Come back when you have some to spend", 1);
            }
            Menu->SendTo(Plr);
            }break;
                        case 5000: //main menu 1-50
            {
                if(Plr->GetItemInterface()->GetItemCount(80001, 1)){
                    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
                    Menu->AddItem(1, "Bags", 5006);
                    Menu->SendTo(Plr);}else{Plr->BroadcastMessage("You don't have the required number of FinalWoW ZEN");}
                
            }break;
                            case 5006: //Bags
            {
                if(Plr->GetItemInterface()->GetItemCount(80001, 1)){
                    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
                    Menu->AddItem(1, "JanSport Bag - 30 Slot + 5% extra Speed - 10 ZEN", 5601);
                    Menu->SendTo(Plr);}else{Plr->BroadcastMessage("You don't have the required number of FinalWoW ZEN");}
            }break;
            case 5601:// JanSport Bag 10ZEN
    { 
        if(Plr->GetItemInterface()->GetItemCount(80001, 10)){
            Plr->GetItemInterface()->RemoveItemAmt(80001, 10);
            Plr->GetItemInterface()->SafeAddItem(100007, INVENTORY_SLOT_NOT_SET, -1);
             Item * it = objmgr.CreateItem(100007, Plr);
             Plr->GetItemInterface()->AddItemToFreeSlot(it);
                Plr->BroadcastMessage("Have Fun with your [JanSport]!");
                Plr->BroadcastMessage("10 [FinalWoW ZEN] Has been removed");}
    else{Plr->BroadcastMessage("You have an insufficient amount of coins to support this transaction." );
    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
    Menu->AddItem(1, "Go back", 5006);
    Menu->SendTo(Plr);}
    }
    break;
        
    
                    case 15000: //main menu 150-250
            {
                if(Plr->GetItemInterface()->GetItemCount(80001, 150)){
                    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
                    Menu->AddItem(1, "Swords", 15001);
                    Menu->SendTo(Plr);}else{Plr->BroadcastMessage("You don't have the required number of FinalWoW ZEN");}
                
            }break;
                    case 15001: //Swords
            {
                if(Plr->GetItemInterface()->GetItemCount(80001, 150)){
                    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
                    Menu->AddItem(1, "Sword of a Thousand Truths - 200 ZEN", 15001);
                    Menu->SendTo(Plr);}else{Plr->BroadcastMessage("You don't have the required number of FinalWoW ZEN");}
            }break;
    case 15002:
    { // Sword of a Thousand Truths - 200 ZEN
        if(Plr->GetItemInterface()->GetItemCount(80001, 200)){
            Plr->GetItemInterface()->RemoveItemAmt(80001, 200);
            Plr->GetItemInterface()->SafeAddItem(100002, INVENTORY_SLOT_NOT_SET, -1);
             Item * it = objmgr.CreateItem(100002, Plr);
             Plr->GetItemInterface()->AddItemToFreeSlot(it);
                Plr->BroadcastMessage("Have Fun with your [Sword of a Thousand Truths]!");
                Plr->BroadcastMessage("200 [FinalWoW ZEN] Has been removed");}
    else{Plr->BroadcastMessage("You have an insufficient amount of coins to support this transaction." );
    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
    Menu->AddItem(1, "Go back", 15000);
    Menu->SendTo(Plr);}
    }
    break;
        }
            }
        void ZEN::GossipEnd(Object * pObject, Player* Plr)
    {
        GossipScript::GossipEnd(pObject, Plr);
    }
    
        void SetupZEN(ScriptMgr * mgr)
        {
        GossipScript * gs = (GossipScript*) new ZEN();
        mgr->register_item_gossip_script(100000,gs);
        }




Advertisement