PDA

View Full Version : [C++] Buff Npc



MikExV™
18-05-10, 03:33 PM
ArcEmu Buff Npc.

#include "StdAfx.h"
#include "Setup.h"

#ifdef WIN32
#pragma warning(disable:4305)
#endif

#define NPCID 400035 //Put your NPC ID here and enjoy!!!

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);
if(Plr->getRace()== 10||Plr->getRace()== 2||Plr->getRace()== 6||Plr->getRace()== 8||Plr->getRace()== 5)
{Menu->AddItem(6, "|CFF8B0000Buffs", 1);}else{Menu->AddItem(6, "|CFF191970Buffs", 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):NUL L;
if(pCreature==NULL)
return;

GossipMenu * Menu;
switch(IntId)
{
case 0:
GossipHello(pObject, Plr, true);
break;

case 1:
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
Menu->AddItem(6, "Blessing Of Kings", 333331);
Menu->AddItem(6, "Blessing Of Might", 333332);
Menu->AddItem(6, "Blessing Of Wisdom", 333333);
Menu->AddItem(6, "Power Word: Shield", 333334);
Menu->AddItem(6, "Shadow Protection", 333335);
Menu->AddItem(6, "Prayer of Fortitude", 333336);
Menu->AddItem(6, "Inner Fire", 333337);
Menu->AddItem(6, "Horn of Winter", 333338);
Menu->AddItem(6, "Frost Presence", 333339);
Menu->AddItem(6, "Unholy Presence", 333340);
Menu->AddItem(6, "Blood Presence", 3333341);
Menu->AddItem(6, "Aspect of the Cheetah", 3333342);
Menu->AddItem(6, "Aspect of the Beast", 333343);
Menu->AddItem(6, "Tureshot Aura", 333344);
Menu->AddItem(6, "Fel Armor", 333345);
Menu->AddItem(6, "Windfury Weapon", 333346);
Menu->AddItem(6, "Lightning Shield", 333347);
Menu->SendTo(Plr);
}
break;

case 333331:
{
Plr->CastSpell(Plr, 56525, 0);
}
break;

case 333332:
{
Plr->CastSpell(Plr, 48932, 0);
}
break;

case 333333:
{
Plr->CastSpell(Plr, 48932, 0);
}
break;

case 333334:
{
Plr->CastSpell(Plr, 48066, 0);
}
break;

case 333335:
{
Plr->CastSpell(Plr, 48169, 0);
}
break;

case 333336:
{
Plr->CastSpell(Plr, 48162, 0);
}
break;

case 333337:
{
Plr->CastSpell(Plr, 48168, 0);
}
break;

case 333338:
{
Plr->CastSpell(Plr, 57623, 0);
}
break;

case 333339:
{
Plr->CastSpell(Plr, 48263, 0);
}
break;

case 333340:
{
Plr->CastSpell(Plr, 48263, 0);
}
break;

case 333341:
{
Plr->CastSpell(Plr, 48266, 0);
}
break;

case 333342:
{
Plr->CastSpell(Plr, 5118, 0);
}
break;

case 333343:
{
Plr->CastSpell(Plr, 13161, 0);
}
break;

case 333344:
{
Plr->CastSpell(Plr, 19506, 0);
}
break;

case 333345:
{
Plr->CastSpell(Plr, 47893, 0);
}
break;

case 333346:
{
Plr->CastSpell(Plr, 58804, 0);
}
break;

case 333347:
{
Plr->CastSpell(Plr, 49281, 0);
}
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(NPCID, gs);
}Enjoy! :D
Compile

1>------ Build started: Project: ExtraScripts, Configuration: Release Win32 ------
1>Compiling...
1>Buff Npc.cpp
1>Linking...
1> Creating library ..\..\..\bin\release\script_bin/ExtraScripts.lib and object ..\..\..\bin\release\script_bin/ExtraScripts.exp
1>Embedding manifest...
1>Build log was saved at "file://c:\WoWServer\High Rate Core\src\scripts\projects\2003_int_release\BuildLo g.htm"
1>ExtraScripts - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 5 up-to-date, 0 skipped ==========

Cocain
18-05-10, 03:50 PM
Simple, yet effecient.


Good job.

MikExV™
18-05-10, 04:37 PM
Thank you! :D one of my first C++ Scripts.

Milation
21-05-10, 03:05 PM
Cool +rep

MikExV™
21-05-10, 05:23 PM
Why thank you Milation :D

mariobox
09-09-10, 04:03 PM
Were to i put c++? don't get with c++ plz tell me.. i only know about Lua

Nice Idea and good scripted

Dimman
09-09-10, 04:36 PM
Were to i put c++? don't get with c++ plz tell me.. i only know about Lua

Nice Idea and good scripted
You will have to apply it to the core & re-compile it. (You cant recompile a repack without the orginal source)