
Results 1 to 10 of 17
Thread: MiscNPC
Threaded View
-
08-09-08, 03:32 PM #1
MiscNPC
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.
Code:#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):NULL; 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); }
Last edited by Crux; 11-09-08 at 12:14 AM. Reason: left out a break;