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


C++ Slayer::getExtraInventorySlotItem方法代码示例

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


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

示例1: execute

void CGAddMouseToGearHandler::execute (CGAddMouseToGear* pPacket , Player* pPlayer)
	throw(ProtocolException, Error)
{
	__BEGIN_TRY __BEGIN_DEBUG_EX

#ifdef __GAME_SERVER__

	Assert(pPacket != NULL);
	Assert(pPlayer != NULL);

	try 
	{
		GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
		Assert(pGamePlayer != NULL);

		Creature*   pCreature   = pGamePlayer->getCreature();
		Assert(pCreature != NULL);

		bool        Success     = false;

		if (pCreature->isSlayer()) 
		{
			Slayer* pSlayer    = dynamic_cast<Slayer*>(pCreature);
			Assert(pSlayer != NULL);

			Item*   pItem = pSlayer->getExtraInventorySlotItem();

			if (pItem == NULL)
			{
				GCCannotAdd _GCCannotAdd;
				_GCCannotAdd.setObjectID(pPacket->getObjectID());
				pPlayer->sendPacket(&_GCCannotAdd);
				return;
			}

			ObjectID_t ItemObjectID = pItem->getObjectID();
			SlotID_t   SlotID       = pPacket->getSlotID();
		
			// 아이템의 ObjectID가 일치하는지 체크한다.
			if (ItemObjectID == pPacket->getObjectID()) 
			{
				Item::ItemClass IClass = pItem->getItemClass();
				
				switch (SlotID) // 슬랏을 보고 그 슬랏에 맞는 아이템 유형인지 비교한다.
				{
					case Slayer::WEAR_HEAD:
						if (IClass == Item::ITEM_CLASS_HELM) Success = true;
						break;
					case Slayer::WEAR_NECK:
						if (IClass == Item::ITEM_CLASS_NECKLACE) Success = true;
						break;
					case Slayer::WEAR_FINGER1:
						if (IClass == Item::ITEM_CLASS_RING || IClass == Item::ITEM_CLASS_COUPLE_RING) Success = true;
						break;
					case Slayer::WEAR_FINGER2:
						if (IClass == Item::ITEM_CLASS_RING || IClass == Item::ITEM_CLASS_COUPLE_RING) Success = true;
						break;
					case Slayer::WEAR_FINGER3:
						if (IClass == Item::ITEM_CLASS_RING || IClass == Item::ITEM_CLASS_COUPLE_RING) Success = true;
						break;
					case Slayer::WEAR_FINGER4:
						if (IClass == Item::ITEM_CLASS_RING || IClass == Item::ITEM_CLASS_COUPLE_RING) Success = true;
						break;
					case Slayer::WEAR_WRIST1:
						if (IClass == Item::ITEM_CLASS_BRACELET) Success = true;
						break;
					case Slayer::WEAR_WRIST2:
						if (IClass == Item::ITEM_CLASS_BRACELET) Success = true;
						break;
					case Slayer::WEAR_LEFTHAND:
						if (IClass == Item::ITEM_CLASS_SHIELD) Success = true;
						break;
					case Slayer::WEAR_HAND3:
						if (IClass == Item::ITEM_CLASS_GLOVE) Success = true;
						break;
					case Slayer::WEAR_BODY:
						if (IClass == Item::ITEM_CLASS_COAT) Success = true;
						break;
					case Slayer::WEAR_BELT:
						if (IClass == Item::ITEM_CLASS_BELT) Success = true;
						break;
					case Slayer::WEAR_LEG:
						if (IClass == Item::ITEM_CLASS_TROUSER) Success = true;
						break;
					case Slayer::WEAR_FOOT:
						if (IClass == Item::ITEM_CLASS_SHOES) Success = true;
						break;
					case Slayer::WEAR_RIGHTHAND:
						if (isSlayerWeapon(IClass)) Success = true;
						break;
					case Slayer::WEAR_ZAP1:
					case Slayer::WEAR_ZAP2:
					case Slayer::WEAR_ZAP3:
					case Slayer::WEAR_ZAP4:
						if (IClass == Item::ITEM_CLASS_CORE_ZAP) Success = true;
						break;
					case Slayer::WEAR_PDA:
						if (IClass == Item::ITEM_CLASS_CARRYING_RECEIVER) Success = true;
						break;
					case Slayer::WEAR_SHOULDER:
//.........这里部分代码省略.........
开发者ID:jun199004,项目名称:server,代码行数:101,代码来源:CGAddMouseToGearHandler.cpp


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