C++ code help menu

Shout-Out

User Tag List

Results 1 to 4 of 4
  1. #1
    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)

    C++ code help

    I took this from gastric's NPC tele dll it is remove rez sickness. Thats all I want and I removed some things away from the code, but I don't know if its correct.


    npc.cpp
    Code:
    #include "StdAfx.h"
    #include "Setup.h"
    
    #ifdef WIN32
    #pragma warning(disable:4305)// warning C4305: 'argument' : truncation from 'double' to 'float'
    #endif
    
    
    class SCRIPT_DECL GlobalNPC : 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 GlobalNPC::GossipHello(Object * pObject, Player* Plr, bool AutoSend)
        {
            GossipMenu *Menu;
            objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
            {Menu->AddItem(0, "Remove Resurrection Sickness", 1)
        if(AutoSend)
                Menu->SendTo(Plr);
     }
    
    void GlobalNPC::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:
            GossipHello(pObject, Plr, true);
            break;
                        
            case 1: // REMOVE RESSURECTION SICKNESS
            {
            objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
            Plr->addSpell(15007);
            Plr->removeSpell(15007,0,0,0);
            pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You have been cured of that dreaded sickness." );
            
            Menu->SendTo(Plr);
            }break;
     }
    
    void GlobalNPC::GossipEnd(Object * pObject, Player* Plr)
    {
        GossipScript::GossipEnd(pObject, Plr);
    }
    
    void SetupGlobalNPC(ScriptMgr * mgr)
    {
        GossipScript * gs = (GossipScript*) new GlobalNPC();
        mgr->register_gossip_script(111111, gs);
    Make File.am
    Code:
    INCLUDES += -I$(srcdir) -I$(srcdir)/../../../../dep/include -I$(srcdir)/../../../shared
    INCLUDES += -I$(srcdir)/../../../script -I$(srcdir)/../../../../src -I$(srcdir)/../../../game
    INCLUDES += -I$(srcdir)/../../../logonserver -I$(srcdir)/../../../../dep/src
    
    AM_CXXFLAGS = -DSCRIPTLIB
    
    lib_LTLIBRARIES = libGlobalNPC.la
    
    libGlobalNPC_la_SOURCES = GlobalNPC.cpp Setup.cpp
    setup.cpp
    Code:
    #include "StdAfx.h"
    #include "Setup.h"
    
    extern "C" SCRIPT_DECL uint32 _exp_get_version()
    {
        return MAKE_SCRIPT_VERSION(SCRIPTLIB_VERSION_MAJOR, SCRIPTLIB_VERSION_MINOR);
    }
    
    extern "C" SCRIPT_DECL void _exp_script_register(ScriptMgr* mgr)
    {
        SetupGlobalNPC(mgr);
    }
    
    extern "C" SCRIPT_DECL uint32 _exp_get_script_type() 
    {
        return SCRIPT_TYPE_MISC;
    }
    
    #ifdef WIN32
    
    BOOL APIENTRY DllMain( HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved )
    {
        return TRUE;
    }
    
    #endif
    setup.h
    Code:
    #ifndef INSTANCE_SCRIPTS_SETUP_H
    #define INSTANCE_SCRIPTS_SETUP_H
    
    void SetupGlobalNPC(ScriptMgr * mgr);
    
    #endif

    Also When I complie I make a new project call it rez sickness but where do I put the files into

    -header files
    -resource files
    -source files
    ???
    Last edited by Chuck Norris; 02-18-2008 at 11:03 PM.
    Google won't search for Chuck Norris because it knows you don't find Chuck Norris, he finds you.

    C++ code help
  2. #2
    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)
    [Bump] Please help.
    Google won't search for Chuck Norris because it knows you don't find Chuck Norris, he finds you.

  3. #3
    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)
    Remove:

    {
    case 0:
    GossipHello(pObject, Plr, true);
    break;
    Life Puzzler WoW - Website | Forums

  4. #4
    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)
    Ok thanks
    But were do I place the files like the header folders etc in C++
    Google won't search for Chuck Norris because it knows you don't find Chuck Norris, he finds you.

Similar Threads

  1. [code help]
    By runiker in forum World of Warcraft Emulator Servers
    Replies: 9
    Last Post: 02-18-2008, 07:52 PM
  2. WPE Coding Help
    By Rectal Exambot in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 01-21-2008, 03:01 AM
  3. [AU3] Need some coding help.
    By Tink in forum Community Chat
    Replies: 4
    Last Post: 12-25-2007, 12:10 AM
All times are GMT -5. The time now is 02:55 AM. 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