void send_MainPage(Object * pObject, Player* Plr)
	{
		if( Plr == false )
			return; 

		GossipMenu *Menu;
		objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
		Menu->SetTextID( 20050 );
		Menu->AddItem( 0, "Queue for Maze Event",2);
		Menu->SendTo(Plr);
	}
Пример #2
0
void GossipScript::GossipHello(Creature* pCreature, Player* Plr, bool AutoSend)
{
	GossipMenu *Menu;
	uint32 TextID = 2;
	Trainer *pTrainer = pCreature->GetTrainer();
	uint32 Text = objmgr.GetGossipTextForNpc(pCreature->GetEntry());
	if(Text != 0)
	{
		GossipText * text = NpcTextStorage.LookupEntry(Text);
		if(text != 0)
			TextID = Text;
	}

	objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), TextID, Plr);
	
	uint32 flags = pCreature->GetUInt32Value(UNIT_NPC_FLAGS);

	if(flags & UNIT_NPC_FLAG_VENDOR)
		Menu->AddItem(1, "I would like to browse your goods", 1);
	
	if(flags & UNIT_NPC_FLAG_TRAINER && pTrainer != 0)
	{
		string name = pCreature->GetCreatureName()->Name;
		string::size_type pos = name.find(" ");	  // only take first name
		if(pos != string::npos)
			name = name.substr(0, pos);

		string msg = "I seek ";

		if(pTrainer->RequiredClass && pTrainer->RequiredClass != Plr->getClass())
		{
			//							   WARRIOR   PALADIN HUNTER  ROGUE   PRIEST  -   SHAMAN  MAGE   WARLOCK  - DRUID
			uint32 notclass[13] =   {0	  ,5721	 ,3976   ,5839   ,4797   ,4435   ,0  ,5006   ,539	,5836   ,0,4774};
			Menu->SetTextID(notclass[pTrainer->RequiredClass]);
		} else if(pTrainer->RequiredClass) {
			//							   WARRIOR   PALADIN HUNTER  ROGUE   PRIEST  -   SHAMAN  MAGE   WARLOCK  - DRUID
			uint32 isclass[13] =	{0	  ,1040	 ,3974   ,4864   ,4835   ,4436   ,0  ,5005   ,538	,5835   ,0,4775};
			Menu->SetTextID(isclass[pTrainer->RequiredClass]);

			switch(Plr->getClass())
			{
			case MAGE:
				msg += "mage";
				break;
			case SHAMAN:
				msg += "shaman";
				break;
			case WARRIOR:
				msg += "warrior";
				break;
			case PALADIN:
				msg += "paladin";
				break;
			case WARLOCK:
				msg += "warlock";
				break;
			case HUNTER:
				msg += "hunter";
				break;
			case ROGUE:
				msg += "rogue";
				break;
			case DRUID:
				msg += "druid";
				break;
			case PRIEST:
				msg += "priest";
				break;
			}
			msg += " training, ";
			msg += name;
			msg += ".";

			Menu->AddItem(3, msg.c_str(), 2);

		}
		else
		{
			msg += "training, ";
			msg += name;
			msg += ".";

			Menu->AddItem(3, msg.c_str(), 2);
		}
	}

	if(flags & UNIT_NPC_FLAG_TAXIVENDOR)
		Menu->AddItem(2, "Give me a ride.", 3);

	if(flags & UNIT_NPC_FLAG_AUCTIONEER)
		Menu->AddItem(0, "I would like to make a bid.", 4);

	if(flags & UNIT_NPC_FLAG_INNKEEPER)
		Menu->AddItem(5, "Make this inn your home.", 5);

	if(flags & UNIT_NPC_FLAG_BANKER)
		Menu->AddItem(0, "I would like to check my deposit box.", 6);

	if(flags & UNIT_NPC_FLAG_SPIRITHEALER)
		Menu->AddItem(0, "Bring me back to life.", 7);

	if(flags & UNIT_NPC_FLAG_PETITIONER)
		Menu->AddItem(0, "How do I create a guild?", 8);

	if(flags & UNIT_NPC_FLAG_TABARDCHANGER)
		Menu->AddItem(0, "I want to create a guild crest.", 9);

	/*if(flags & UNIT_NPC_FLAG_BATTLEFIELDPERSON)
		Menu->AddItem(0, "I would like to go to the battleground.", 10);*/

	if( pTrainer &&
		pTrainer->RequiredClass &&					  // class trainer
		pTrainer->RequiredClass == Plr->getClass() &&   // correct class
		pCreature->getLevel() > 10 &&				   // creature level
		Plr->getLevel() > 10 )						  // player level
	{
		Menu->AddItem(0, "I would like to reset my talents.", 11);
	}

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