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
???