All pastes #907950 Raw Edit

ControlPanel.cpp

public cpp v1 · immutable
·published 2008-02-18 00:45 UTC
rendered paste body
//--------------------------------------////           ControlPanel.cpp           ////--------------------------------------////  Created by Gastricpenguin. With     ////  some tips here and there. If you    ////  release this, you need the proper   ////  permission. If you do not give the  ////  proper credits, and don't even have ////  permission, then you're most def    ////  going to be banned. Anyway, enjoy!  ////--------------------------------------//#include "StdAfx.h"#include "Setup.h"#ifdef WIN32#pragma warning(disable:4305)#endifclass SCRIPT_DECL CPanel : 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 CPanel::GossipHello(Object* pObject, Player * Plr, bool AutoSend)    {    if(Plr->CombatStatus.IsInCombat()){        Plr->BroadcastMessage("You are in combat!");        return;    }        GossipMenu *Menu;        objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);        Menu->AddItem(0, "-|Welcome to your Control Panel|-");        Menu->AddItem(2, "Main City Teleports", 8);		Menu->AddItem(6, "Show Online GMs", 4);		Menu->AddItem(6, "Show Online Players", 19);		Menu->AddItem(4, "Global Options", 1);        Menu->AddItem(3, "Player Options", 2);           if(AutoSend)            Menu->SendTo(Plr);    }void CPanel::GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)    {        GossipMenu * Menu;        switch(IntId)        {         case 1:            {            objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);			Menu->AddItem(4, "Open Flight Paths      [10 gold]", 10);			Menu->AddItem(4, "Discover Map Locations [10 gold]", 21);			Menu->AddItem(4, "Advance All Skills     [5 gold]", 20);            Menu->SendTo(Plr);            }            break;        case 2:            {            objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);            Menu->AddItem(3, "Reset Talentpoints [10 gold]", 9);//			Menu->AddItem(5, "Access My Bank", 5);		---- Converting Creatures to an Object is a bitch//			Menu->AddItem(3, "Repair My Items", 6);		---- Not finished.. figures >.>			Menu->AddItem(3, "Player Save", 7);			Menu->AddItem(3, "Latency", 22);            Menu->SendTo(Plr);            }            break;        case 4:            {			bool first = true;			PlayerStorageMap::const_iterator itr;			objmgr._playerslock.AcquireReadLock();			for (itr = objmgr._players.begin(); itr != objmgr._players.end(); itr++)			{				if(itr->second->GetSession()->GetPermissionCount())				{					if(first)					Plr->BroadcastMessage("The following GMs are currently online:");					Plr->BroadcastMessage("%s", itr->second->GetName());					Plr->Gossip_Complete();					first = false;				}			}			objmgr._playerslock.ReleaseReadLock();			if(first)			Plr->BroadcastMessage("There are no GMs currently online.");			Plr->Gossip_Complete();            }            break;	/* If anyone has a clue as to how i open a bank from a creature, using an item? Cuz im stumped o.o *///		case 5://			{//			Plr->GetSession()->SendBankerList(pCreature);//			}//			break;/*							 I just haven't finished this one yet.									*///		case 6://			{//			Plr->SetUInt32Value( ITEM_FIELD_DURABILITY, m_itemProto->MaxDurability );//			Plr->Gossip_Complete();  //			}//			 break;			case 7:			{            Plr->SaveToDB(true);            Plr->BroadcastMessage("Your Character Has Been Succesfully Saved to the Database");                            Plr->Emote(EMOTE_ONESHOT_CHEER);			Plr->Gossip_Complete(); 			}            break;        case 8:            {            objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);			if(Plr->getRace()== 10||Plr->getRace()== 2||Plr->getRace()== 6||Plr->getRace()== 8||Plr->getRace()== 5)			{			    Menu->AddItem(2, "Silvermoon", 11);                		        Menu->AddItem(2, "Orgrimmar", 12);                		        Menu->AddItem(2, "Thunderbluff", 13);                		        Menu->AddItem(2, "UnderCity", 14);    			}			else			{                Menu->AddItem(2, "The Exodar", 17);                Menu->AddItem(2, "Stormwind", 18);                Menu->AddItem(2, "Ironforge", 15);                Menu->AddItem(2, "Darnassus", 16);			}                     Menu->SendTo(Plr);            }            break;		case 9:			{			uint32 price = 100000;			uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);			if (currentgold>=price){			int32 newgold = currentgold - price;			Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);			Plr->BroadcastMessage("Your Talentpoints have been sucessfully reset!");			Plr->Reset_Talents();			Plr->Gossip_Complete(); 			} else {			Plr->BroadcastMessage("You don't have enough money to afford a talent reset!");			Plr->Gossip_Complete(); 			}			}break;		case 10:			{			uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);			if(currentgold>100000)				{				int32 newgold = currentgold - 100000;				Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);				for (uint8 i=0; i<8; i++)					{					Plr->SetTaximask(i, 0xFFFFFFFF);					}				Plr->BroadcastMessage("All flight paths have been opened!");				Plr->Gossip_Complete(); 				}			else				{				Plr->BroadcastMessage("Sorry, you don't have enought gold.");				Plr->Gossip_Complete(); 				}			}break;		case 11:            {				Plr->EventTeleport(530, 9400.486328, -7278.376953, 14.206780);}            break;		case 12:            {				Plr->EventTeleport(1, 1371.068970, -4370.801758, 26.052483);}            break;		case 13:            {				Plr->EventTeleport(1, -1304.569946, 205.285004, 68.681396);}            break;		case 14:            {				Plr->EventTeleport(0, 2050.203125, 285.650604, 56.994549);}            break;        case 15:            {				Plr->EventTeleport(0, -5028.265137, -825.976563, 495.301575);}            break;        case 16:            {				Plr->EventTeleport(1, 9985.907227, 1971.155640, 1326.815674);}            break;        case 17:             {				Plr->EventTeleport(530, -4072.202393, -12014.337891, -1.277277);}            break;        case 18:             {				Plr->EventTeleport(0, -9100.480469, 406.950745, 92.594185);}            break;		case 19:			{			uint32 clientsNum = (uint32)sWorld.GetSessionCount();			Plr->BroadcastMessage("Current Players Online: %d", clientsNum);			Plr->Gossip_Complete();			}break;		case 20:			{			uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);			if(currentgold>50000){			int32 newgold = currentgold - 50000;			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("Sorry, you don't have enought gold.");			Plr->Gossip_Complete(); 			}			}break;		case 21:			{			uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);			if(currentgold>100000)				{				int32 newgold = currentgold - 100000;				Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);				for (uint8 i=0; i<64; i++)				{				Plr->SetFlag(PLAYER_EXPLORED_ZONES_1+i,0xFFFFFFFF);				}				Plr->BroadcastMessage("All Map Locations have been opened!");				Plr->Gossip_Complete();				}			else				{				Plr->BroadcastMessage("Sorry, you don't have enought gold.");				Plr->Gossip_Complete(); 				}			}break;		case 22:			{			Plr->BroadcastMessage("|cffff0000 Your Latency: %i ms", Plr->GetSession()->GetLatency());			Plr->Gossip_Complete(); 			}break;        }};void CPanel::GossipEnd(Object * pObject, Player* Plr){GossipScript::GossipEnd(pObject, Plr);}void SetupCPanel(ScriptMgr * mgr){GossipScript * gs = (GossipScript*) new CPanel();mgr->register_item_gossip_script(87562,gs);}