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


C++ Creature::ArenaOrganizersFlags方法代码示例

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


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

示例1: HandleCharterBuy

// Charter part
void WorldSession::HandleCharterBuy(WorldPacket & recv_data)
{
	uint8 error;
	uint64 creature_guid;
	uint32 crap;
	uint64 crap2;
	string name, unkstr;
	uint32 Data[7];
	uint16 crap10;
	uint32 crap11;
	uint32 crap12, PetitionSignerCount;
	string crap13;
	uint32 arena_index;

	recv_data >> creature_guid;
	recv_data >> crap >> crap2;
	recv_data >> name >> unkstr;
	recv_data >> Data[0] >> Data[1] >> Data[2] >> Data[3] >> Data[4] >> Data[5] >> Data[6];
	recv_data >> crap10;
	recv_data >> crap11 >> crap12 >> PetitionSignerCount;
	for(uint32 s = 0; s < 10; ++s)
		recv_data >> crap13;
	recv_data >> arena_index;

	Creature* crt = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(creature_guid));
	if(!crt)
	{
		Disconnect();
		return;
	}

	if( arena_index >= NUM_CHARTER_TYPES )
		return;

	//All arena organizers should be allowed to create arena charter's
	if( !crt->ArenaOrganizersFlags() )
	{
		uint32 arena_type = arena_index - 1;
		if(arena_type > 2)
			return;

		if(_player->m_playerInfo->arenaTeam[arena_type])
		{
			SendNotification("You are already in an arena team.");
			return;
		}

		if(_player->m_playerInfo->charterId[arena_index] != 0)
		{
			SendNotification("You already have an arena charter of this type.");
			return;
		}

		if(!sWorld.VerifyName(name.c_str(), name.length()))
		{
			SendNotification("That name is invalid or contains invalid characters.");
			return;
		}

		ArenaTeam * t = objmgr.GetArenaTeamByName(name, arena_type);
		if(t != NULL)
		{
			sChatHandler.SystemMessage(this,"That name is already in use.");
			return;
		}

		if(objmgr.GetCharterByName(name, (CharterTypes)arena_index))
		{
			sChatHandler.SystemMessage(this,"That name is already in use.");
			return;
		}

		static uint32 item_ids[] = {ARENA_TEAM_CHARTER_2v2, ARENA_TEAM_CHARTER_3v3, ARENA_TEAM_CHARTER_5v5};
		static uint32 costs[] = {ARENA_TEAM_CHARTER_2v2_COST,ARENA_TEAM_CHARTER_3v3_COST,ARENA_TEAM_CHARTER_5v5_COST};

		if(_player->GetUInt32Value(PLAYER_FIELD_COINAGE) < costs[arena_type])
		{
			sChatHandler.SystemMessage(this,"You don't have enough money!");
			return;			// error message needed here
		}

		ItemPrototype * ip = ItemPrototypeStorage.LookupEntry(item_ids[arena_type]);
		ASSERT(ip);
		SlotResult res = _player->GetItemInterface()->FindFreeInventorySlot(ip);
		if(res.Result == 0)
		{
			_player->GetItemInterface()->BuildInventoryChangeError(NULLITEM, NULLITEM, INV_ERR_INVENTORY_FULL);
			return;
		}

		error = _player->GetItemInterface()->CanReceiveItem(ip,1, NULL);
		if(error)
		{
			_player->GetItemInterface()->BuildInventoryChangeError(NULLITEM, NULLITEM,error);
		}
		else
		{
			// Create the item and charter
			Item* i = objmgr.CreateItem(item_ids[arena_type], _player);
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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