当前位置: 首页>>代码示例>>C++>>正文


C++ GossipMenu::SetTextID方法代码示例

本文整理汇总了C++中GossipMenu::SetTextID方法的典型用法代码示例。如果您正苦于以下问题:C++ GossipMenu::SetTextID方法的具体用法?C++ GossipMenu::SetTextID怎么用?C++ GossipMenu::SetTextID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GossipMenu的用法示例。


在下文中一共展示了GossipMenu::SetTextID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: send_MainPage

	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);
	}
开发者ID:AtVirus,项目名称:Descent-Scripts,代码行数:11,代码来源:Tournament_supervisor_gossip.cpp

示例2: GossipHello

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);
//.........这里部分代码省略.........
开发者ID:Sylica2013,项目名称:Antrix,代码行数:101,代码来源:ScriptMgr.cpp


注:本文中的GossipMenu::SetTextID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。