PDA

View Full Version : MiscNPC



Crux
08-09-08, 04:32 PM
Made by myself, can Heal player, reset talents, unlock fp's, save to DB, remove res sick, tele, buff's, advance all skills to 350 and explore all maps. :)


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

#define MISCNPC 129876

class SCRIPT_DECL MiscNPC : 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 MiscNPC::GossipHello(Object * pObject, Player* Plr, bool AutoSend)
{
if(Plr->CombatStatus.IsInCombat())
{
Plr->BroadcastMessage("Come back when you are not longer in combat!");
return;
}
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);

Menu->AddItem(0, "Low health! Heal me!", 1);
Menu->AddItem(0, "Reset Talents", 2);
Menu->AddItem(0, "Save to DB", 3);
Menu->AddItem(0, "Unlock all flight paths", 4);
Menu->AddItem(0, "Remove Res sickness", 5);
Menu->AddItem(0, "Main cities.", 6);
Menu->AddItem(0, "Advance All skills (1-350)", 7);
Menu->AddItem(0, "Explore all maps", 8);
Menu->AddItem(0, "Buff me up!", 9);


if(AutoSend)
Menu->SendTo(Plr);
}

void MiscNPC::GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
{
Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NUL L;
if(pObject==NULL)
return;

GossipMenu * Menu;
switch(IntId)
{
case 1: //heal

uint32 price=1000; //10 Silver
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
if (currentgold>=price){
int32 newgold = currentgold - price;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
pCreature->CastSpell(Plr, 25840, 0); //Full heal
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Pleasure doing buisness." );
}else{
Plr->BroadcastMessage("You don't have enough money to be healed!");
}
}break;

case 2: //Reset Talent
{
uint32 price = 1000; //10 silver
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
if (currentgold>=price){
int32 newgold = currentgold - price;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
Plr->BroadcastMessage("Choice your next points carefully, journeymen");
Plr->Reset_Talents();
} else {
Plr->BroadcastMessage("You don't have enough money to afford a talent reset!");
}
}break;

case 3: //Save to DB
plr->SaveToDB(true);
Plr->BroadcastMessage("Saved to database");\
}break;

case 4: //Unlock all flight paths.
{
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
if(currentgold>50000){
int32 newgold = currentgold - 50000;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
for (uint8 i=0; i<8; i++)
{
Plr->SetTaximask(i, 0xFFFFFFFF);
}
Plr->BroadcastMessage("No more looking for flight paths my friend.");
Plr->Gossip_Complete();
}else{
Plr->BroadcastMessage("You have unlocked all flight paths %s");
Plr->Gossip_Complete();
}
}break;


case 5:// Remove Res Sickness
{
uint32 price = 5000; //50 silver
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
if (currentgold>=price){
int32 newgold = currentgold - price;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
Plr->BroadcastMessage("You have been cleansed");
Plr->addSpell(15007);
Plr->removeSpell(15007, 0, 0, 0);
}
}break;

case 6: // Main Cities
{
if(Plr->GetTeam() == 0)
{
Menu->AddItem(0, "Stormwind", 20);
Menu->AddItem(0, "Ironforge", 21);
Menu->AddItem(0, "Exodar", 22);
Menu->AddItem(0, "Darnassus", 23);
Menu->SendTo(Plr);
}
else
{
if (plr->GetTeam() == 1)
{
Menu->AddItem(0, "Orgrimar", 30);
Menu->AddItem(0, "Thunder Bluff", 31);
Menu->AddItem(0, "Silvermoon City", 32);
Menu->AddItem(0, "Undercity", 33);
Menu->SendTo(Plr);
}break;



case 20: //Stormwind
{
if(plr->GetTeam() == 0)
Plr->SafeTeleport(0, 0, -9100.480469, 406.950745, 92.594185, 0);
}break;

case 21:
//ironforge
{
if(plr->GetTeam() == 0)
Plr->SafeTeleport(0, 0, -5028.265137, -825.976563, 495.301575, 0);
}break;

case 22: //Exodar
{
if(plr->GetTeam() == 0)
Plr->SafeTeleport(1, 0, 9985.907227, 1971.155640, 1326.815674, 0);
}break;

case 23: //Darn
{
if(plr->GetTeam() == 0)
Plr->SafeTeleport(1, 0, 9985.907227, 1971.155640, 1326.815674, 0);
}break;

case 30: //org
{
if(plr->GetTeam() == 1)
Plr->SafeTeleport(1, 0, 1371.068970, -4370.801758, 26.052483, 0);
}break;

case 31: //thunder bluff
{
if(plr->GetTeam() == 1)
Plr->SafeTeleport(1, 0, -1304.569946, 205.285004, 68.681396, 0);
}break;

case 32: //Silvermoon
{
if(plr->GetTeam() == 1)
Plr->SafeTeleport(530, 0, 9400.486328, -7278.376953, 14.206780, 0);
}break;

case 33: //undercity
{
if(plr->GetTeam() == 1)
Plr->SafeTeleport(0, 0, 2050.203125, 285.650604, 56.994549, 0);
}break;

case 7: //Advance skills

{
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
if(currentgold>50000){
int32 newgold = currentgold - 500000; //500 gold
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
if (Plr->_HasSkillLine(43))
{Plr->_AdvanceSkillLine(43, 350);}
if (Plr->_HasSkillLine(55))
{Plr->_AdvanceSkillLine(55, 350);}
if (Plr->_HasSkillLine(44))
{Plr->_AdvanceSkillLine(44, 350);}
if (Plr->_HasSkillLine(95))
{Plr->_AdvanceSkillLine(95, 350);}
if (Plr->_HasSkillLine(54))
{Plr->_AdvanceSkillLine(54, 350);}
if (Plr->_HasSkillLine(45))
{Plr->_AdvanceSkillLine(45, 350);}
if (Plr->_HasSkillLine(46))
{Plr->_AdvanceSkillLine(46, 350);}
if (Plr->_HasSkillLine(136))
{Plr->_AdvanceSkillLine(136, 350);}
if (Plr->_HasSkillLine(160))
{Plr->_AdvanceSkillLine(160, 350);}
if (Plr->_HasSkillLine(162))
{Plr->_AdvanceSkillLine(162, 350);}
if (Plr->_HasSkillLine(172))
{Plr->_AdvanceSkillLine(172, 350);}
if (Plr->_HasSkillLine(173))
{Plr->_AdvanceSkillLine(173, 350);}
if (Plr->_HasSkillLine(176))
{Plr->_AdvanceSkillLine(176, 350);}
if (Plr->_HasSkillLine(226))
{Plr->_AdvanceSkillLine(226, 350);}
if (Plr->_HasSkillLine(228))
{Plr->_AdvanceSkillLine(228, 350);}
if (Plr->_HasSkillLine(229))
{Plr->_AdvanceSkillLine(229, 350);}
if (Plr->_HasSkillLine(473))
{Plr->_AdvanceSkillLine(473, 350);}
Plr->Gossip_Complete();
}else{
Plr->BroadcastMessage("Not enough gold hey? Pathetic!");
}
}break;

case 8: //Explore maps
{
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
if(currentgold>15000){ //15 gold
int32 newgold = currentgold - 15000;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
for (uint8 i=0; i<64; i++)
{
Plr->SetFlag(PLAYER_EXPLORED_ZONES_1+i,0xFFFFFFFF);
}
Plr->BroadcastMessage("Sight has a new meaning");
Plr->Gossip_Complete();
}else{
Plr->BroadcastMessage("Well hurry up! %s I need that money now!");
Plr->Gossip_Complete();
}
}break;

case 9: //Buffs
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);

Menu->AddItem(0, "Stamina", 70);
Menu->AddItem(0, "Intellect", 71);
Menu->AddItem(0, "Strength", 72);
Menu->AddItem(0, "Agility", 73);
Menu->SendTo(plr);
}break;

case 70:
{
uint32 price=5000;// 5 Silver
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
if (currentgold>=price){
int32 newgold = currentgold - price;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
Plr->CastSpell(Plr, 27062, 0);
Plr->BroadcastMessage("Buff added to %s" );
}else{
Plr->BroadcastMessage("Enjoy the power" );
}
}break;

case 71:
{
uint32 price=5000;// 5 Silver
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
if (currentgold>=price){
int32 newgold = currentgold - price;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
Plr->CastSpell(Plr, 260261, 0);
Plr->BroadcastMessage("Buff added to %s" );
}else{
Plr->BroadcastMessage("Enjoy the power" );
}
}break;

case 72:
{
uint32 price=5000;// 5 Silver
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
if (currentgold>=price){
int32 newgold = currentgold - price;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
Plr->CastSpell(Plr, 20266, 0);
Plr->BroadcastMessage("Buff added to %s" );
}else{
Plr->BroadcastMessage("Enjoy the power" );
}
}break;

case 73:
{
uint32 price=5000;// 5 Silver
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
if (currentgold>=price){
int32 newgold = currentgold - price;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
Plr->CastSpell(Plr, 27976, 0);
Plr->BroadcastMessage("Buff added to %s" );
}else{
Plr->BroadcastMessage("Enjoy the power" );
}
}break;
}
Plr->Gossip_Complete();
};


void MiscNPC::GossipEnd(Object * pObject, Player* Plr)
{
GossipScript::GossipEnd(pObject, Plr);
}

void SetupMiscNPC(ScriptMgr * mgr)
{
GossipScript * gs = (GossipScript*) new MiscNPC();
mgr->register_item_gossip_script(MISCNPC, gs);
}

*Alexz*
08-09-08, 04:50 PM
what emu dose this work with

Wolfly
08-09-08, 04:53 PM
There's no code for All FP Unlocked. Menu item yeah but no function to it.

StickyIcky
08-09-08, 05:17 PM
+rep
great script man!

Apple
08-09-08, 09:17 PM
Really nice job , keep it up +Rep ;)

Crux
09-09-08, 12:04 AM
what emu dose this work with
Ascent, Arcemu and other ascent bases cores.



There's no code for All FP Unlocked. Menu item yeah but no function to it.

Ah my bad,thanks for telling me, flight path code added.

Wolfly
09-09-08, 11:42 AM
No problem, and +Rep. You've earned it.

*Alexz*
09-09-08, 04:03 PM
also what are the setupfiles?

StickyIcky
09-09-08, 06:23 PM
lawl...if you dont know how to set up setup files dont bother...

all i gotta say is:
void SetupMiscNPC(ScriptMgr * mgr)

*Alexz*
09-09-08, 09:04 PM
well... im stupid so i need to know for future refrence!

Crux
10-09-08, 12:10 AM
@ alex just look in GossipScripts and find setup.h and setup.cpp. in setup.cpp find SetupGuardGossip(mgr); and the part in red you can change to the script name in this case its MiscNPC and open setup.h and find void SetupGuardGossip(ScriptMgr * mgr); and again you may change that to the name.

*Alexz*
10-09-08, 06:25 PM
i got likee 14 errors with compleing it xD


3>..\src\GossipScripts\MiscNPC.cpp(64) : error C2043: illegal break
3>..\src\GossipScripts\MiscNPC.cpp(66) : error C2046: illegal case
3>..\src\GossipScripts\MiscNPC.cpp(79) : error C2043: illegal break
3>..\src\GossipScripts\MiscNPC.cpp(81) : error C2046: illegal case
3>..\src\GossipScripts\MiscNPC.cpp(82) : error C2065: 'plr' : undeclared identifier
3>..\src\GossipScripts\MiscNPC.cpp(82) : error C2227: left of '->SaveToDB' must point to class/struct/union/generic type
3> type is ''unknown-type''
3>..\src\GossipScripts\MiscNPC.cpp(85) : error C2059: syntax error : 'break'
3>..\src\GossipScripts\MiscNPC.cpp(87) : error C2059: syntax error : 'case'
3>..\src\GossipScripts\MiscNPC.cpp(88) : error C2447: '{' : missing function header (old-style formal list?)
3>..\src\GossipScripts\MiscNPC.cpp(104) : error C2059: syntax error : 'break'
3>..\src\GossipScripts\MiscNPC.cpp(107) : error C2059: syntax error : 'case'
3>..\src\GossipScripts\MiscNPC.cpp(108) : error C2447: '{' : missing function header (old-style formal list?)
3>..\src\GossipScripts\MiscNPC.cpp(118) : error C2059: syntax error : 'break'
3>..\src\GossipScripts\MiscNPC.cpp(120) : error C2059: syntax error : 'case'
3>..\src\GossipScripts\MiscNPC.cpp(121) : error C2447: '{' : missing function header (old-style formal list?)
3>..\src\GossipScripts\MiscNPC.cpp(367) : error C2061: syntax error : identifier 'MiscNPC'

(lol i know im posting/asking alot

Crux
11-09-08, 12:47 AM
Do you have a MSN?

*Alexz*
11-09-08, 07:08 AM
ya [email protected]

StickyIcky
11-09-08, 02:14 PM
Noobs...
*shakes head*

XD Jk wif ya alexz =]

*Alexz*
11-09-08, 03:11 PM
im new to c++ tryin to learn here! lol

LiLLeCarl
24-01-09, 05:09 AM
what emu dose this work with

case 8: //Explore maps
{
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
if(currentgold>15000){ //15 gold
int32 newgold = currentgold - 15000;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
for (uint8 i=0; i<64; i++)
{
Plr->SetFlag(PLAYER_EXPLORED_ZONES_1+i,0xFFFFFFFF);
}
Plr->BroadcastMessage("Sight has a new meaning");
Plr->Gossip_Complete();
}else{
Plr->BroadcastMessage("Well hurry up! %s I need that money now!");
Plr->Gossip_Complete();
}
}break;

aint that unlock all maps?