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


C++ Item::GetEquipGemCount方法代码示例

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


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

示例1: CanUseAbility

ORESULT AbilityMachining::CanUseAbility(Obj_Human* pHuman)
{
__ENTER_FUNCTION

	Assert( pHuman );

	AbilityOpera* pAbilityOpera;

	pAbilityOpera = pHuman->GetAbilityOpera();
	Assert( pAbilityOpera );

	switch( pAbilityOpera->m_SubType )
	{
	case NORMAL_TYPE:
		return AbilityCompound::CanUseAbility(pHuman);
	case GEM_COMPOUND:
		{
			ORESULT res;
			res = Ability::CanUseAbility(pHuman);
			if( res != OR_OK )
			{
				return res;
			}

			if( (pAbilityOpera->m_BagPos[0] < 0) || (pAbilityOpera->m_BagPos[0] >= MAX_BAG_SIZE)
			 || (pAbilityOpera->m_BagPos[1] < 0) || (pAbilityOpera->m_BagPos[1] >= MAX_BAG_SIZE)
			 )
			{
				Assert(FALSE);
				return OR_ERROR;
			}

			//const	_ITEM* pGem1 = pHuman->GetItem(pAbilityOpera->m_BagPos[0]);
			//const	_ITEM* pGem2 = pHuman->GetItem(pAbilityOpera->m_BagPos[1]);
			
			Item*	pGem1Item = HumanItemLogic::GetBagItem(pHuman,pAbilityOpera->m_BagPos[0]);
			Item*	pGem2Item = HumanItemLogic::GetBagItem(pHuman,pAbilityOpera->m_BagPos[1]);

			Assert( (pGem1Item != NULL) && (pGem2Item != NULL) );

			if( (pGem1Item->GetItemClass() != ICLASS_GEM) || (pGem2Item->GetItemClass() != ICLASS_GEM) )
			{
				return OR_STUFF_LACK;
			}

			if((pGem1Item->GetItemIndex() != pGem2Item->GetItemIndex())// (pGem1Item->GetItemQual() != pGem2Item->GetItemQual())
			 )
			{
				return OR_STUFF_LACK;
			}

			//if(  >= MAX_GEM_QUALITY ) // pGem1Item->GetItemQual()没法再升了
			//{
			//	return OR_CANNOT_UPGRADE;
			//}

			return OR_OK;
		}
		break;
	case GEM_EMBED:
		{
			ORESULT res;
			res = Ability::CanUseAbility(pHuman);
			if( res != OR_OK )
			{
				return res;
			}

			if( (pAbilityOpera->m_BagPos[0] < 0) || (pAbilityOpera->m_BagPos[0] >= MAX_BAG_SIZE)
			 || (pAbilityOpera->m_BagPos[1] < 0) || (pAbilityOpera->m_BagPos[1] >= MAX_BAG_SIZE)
			 )
			{
				Assert(FALSE);
				return OR_ERROR;
			}

			//const	_ITEM* pGem = pHuman->GetItem(pAbilityOpera->m_BagPos[0]);
			//const	_ITEM* pEquip = pHuman->GetItem(pAbilityOpera->m_BagPos[1]);

			Item*		pGemItem	=	HumanItemLogic::GetBagItem(pHuman,pAbilityOpera->m_BagPos[0]);
			Item*		pEquipItem	=	HumanItemLogic::GetBagItem(pHuman,pAbilityOpera->m_BagPos[1]);
			Assert( (pGemItem != NULL) && (pEquipItem != NULL) );

			if( (pGemItem->GetItemClass() != ICLASS_GEM) || (pEquipItem->GetItemClass() != ICLASS_EQUIP) )
			{
				return OR_STUFF_LACK;
			}

			if( IsGemConflict(pHuman, pAbilityOpera->m_BagPos[0], pAbilityOpera->m_BagPos[1]) == FALSE )
			{
				return OR_GEM_CONFLICT;
			}

			LuaInterface* pLuaInterface;
			pLuaInterface = pHuman->getScene()->GetLuaInterface();

			if( pEquipItem->GetGemSlotMax() <= pEquipItem->GetEquipGemCount()
				|| pLuaInterface->ExeScript_DDD(	ABILITY_LOGIC_SCRIPT, 
													"TooManyGems",
													(INT)pHuman->getScene()->SceneID(),
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例2: Execute

UINT CGEquipRefiningHandler::Execute( CGEquipRefining* pPacket, Player* pPlayer )
{
	__ENTER_FUNCTION

	GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
	Assert( pGamePlayer ) ;

	Obj_Human* pHuman = pGamePlayer->GetHuman() ;
	Assert( pHuman ) ;

	Scene* pScene = pHuman->getScene() ;
	if( pScene==NULL )
	{
		Assert(FALSE) ;
		return PACKET_EXE_ERROR ;
	}
	//检查线程执行资源是否正确
	Assert( MyGetCurrentThreadID()==pScene->m_ThreadID );

	//切场景时丢弃换装消息
	//交易状态不可操作
	//摆摊状态不可操作

	// 获取炼化的装备
	BYTE iEquipItemPos = pPacket->GetEquipItemPos();
	Assert(iEquipItemPos >= 0 );
	Assert(iEquipItemPos <= MAX_BAG_SIZE);
	
	GCEquipRefining	msg;
	ItemContainer* pBagContainer = HumanItemLogic::GetBagContainer(pHuman, iEquipItemPos);
	if (pBagContainer == NULL)
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGEquipRefiningHandler equipment BagIndex is invalid, BagIndex = %d", iEquipItemPos) ;
		msg.SetResult(EQUIPREFINING_NOT_SUCH_ITEM);
		pGamePlayer->SendPacket(&msg);
		return PACKET_EXE_CONTINUE;
	}

	Item* pEquipment = pBagContainer->GetItem(pBagContainer->BagIndex2ConIndex(iEquipItemPos));
	Assert(NULL != pEquipment);
	//一些验证:星级,等级...
	if( NULL == pEquipment || ICLASS_EQUIP != pEquipment->GetItemClass() || !(pEquipment->IsRuler(IRL_DISCARD) )
		|| pEquipment->IsAdsorbMagic()	|| pEquipment->GetRequireLevel() < EQUIP_REFINING_MIN_LEVEL	//已经附魔或者需求等级小于40
		|| 0 == pEquipment->GetEquipGemCount())	//没有镶嵌宝石
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGEquipRefiningHandler equipment type is invalid, BagIndex = %d", iEquipItemPos) ;
		msg.SetResult(EQUIPREFINING_NOT_SUCH_ITEM);
		pGamePlayer->SendPacket(&msg);

		return PACKET_EXE_CONTINUE;
	}
	//获取炼化神器
	BYTE iRefiningItemPos = pPacket->GetRefiningItemPos();
	Assert(iRefiningItemPos >= 0 );
	Assert(iRefiningItemPos <= MAX_BAG_SIZE);

	pBagContainer = HumanItemLogic::GetBagContainer(pHuman, iRefiningItemPos);
	if (pBagContainer == NULL)
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGEquipRefiningHandler refining BagIndex is invalid, BagIndex = %d", iRefiningItemPos) ;
		msg.SetResult(EQUIPREFINING_NOT_SUCH_ITEM);
		pGamePlayer->SendPacket(&msg);
		return PACKET_EXE_CONTINUE;
	}

	Item* pRefiningItem = pBagContainer->GetItem(pBagContainer->BagIndex2ConIndex(iRefiningItemPos));
	Assert(NULL != pRefiningItem);
	if(NULL == pRefiningItem || pRefiningItem->GetItemClass() != ICLASS_COMITEM || pRefiningItem->GetItemType() != COMITEM_EQUIP_REFINING)
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGEquipRefiningHandler refining type is invalid, BagIndex = %d", iRefiningItemPos) ;
		msg.SetResult(EQUIPREFINING_NOT_SUCH_ITEM);
		pGamePlayer->SendPacket(&msg);

		return PACKET_EXE_CONTINUE;
	}
	//逻辑处理 
	COMMITEM_INFO_TB* pGet = g_ItemTable.GetCommItemInfoTB(pRefiningItem->GetItemTableIndex());
	Assert(NULL != pGet);
	if ((pEquipment->GetRequireLevel()-1)/10+1 != pGet->m_nLevel)//验证等级
	{
		msg.SetResult(EQUIPREFINING_NOT_SUCH_ITEM);
		pGamePlayer->SendPacket(&msg);

		return PACKET_EXE_CONTINUE;
	}

	if ( 0 == pEquipment->GetAttrCount())// && pEquipment->GetLevel() 
	{
		msg.SetResult(EQUIPREFINING_NOT_HAVE_ATTR);
		pGamePlayer->SendPacket(&msg);
		return PACKET_EXE_CONTINUE;
	}

	//EQUIP_TB* pGet = g_ItemTable.GetEquipTB(pEquipment->GetItemTableIndex());
	//Assert(NULL != pGet);
	//删除装备和炼化神符道具
	UINT iPrice = pEquipment->GetSellPrice();//保留将要删除的装备属性给后面用
	BYTE iRequireLevel = pEquipment->GetRequireLevel();
	BYTE curEquipPoint = pEquipment->GetEquipPoint();
	BYTE attrCount = 0;
//.........这里部分代码省略.........
开发者ID:uvbs,项目名称:wx2Server,代码行数:101,代码来源:CGEqupRefiningHandler.cpp

示例3: CanUseAbility

ORESULT AbilityInlay::CanUseAbility(Obj_Human* pHuman)
{
__ENTER_FUNCTION

	Assert( pHuman );

	AbilityOpera* pAbilityOpera;

	pAbilityOpera = pHuman->GetAbilityOpera();
	Assert( pAbilityOpera );

	ORESULT res;
	res = Ability::CanUseAbility(pHuman);
	if( res != OR_OK )
	{
		return res;
	}

	CHAR MaterialBagIndex1 = (CHAR)pAbilityOpera->m_BagPos[2];
	CHAR MaterialBagIndex2 = (CHAR)pAbilityOpera->m_BagPos[3];
	if( (pAbilityOpera->m_BagPos[0] < 0)  || (pAbilityOpera->m_BagPos[0] >= MAX_BAG_SIZE)
	 || (pAbilityOpera->m_BagPos[1] < 0)  || (pAbilityOpera->m_BagPos[1] >= MAX_BAG_SIZE)
	 || (MaterialBagIndex1>= MAX_BAG_SIZE)|| (MaterialBagIndex2>= MAX_BAG_SIZE)
	 )
	{
		Assert(FALSE);
		return OR_ERROR;
	}

	Item* pGemItem = HumanItemLogic::GetBagItem( pHuman, pAbilityOpera->m_BagPos[0] );
	Item* pEquipItem = HumanItemLogic::GetBagItem( pHuman, pAbilityOpera->m_BagPos[1] );
	Item* pMaterialItem1 = NULL;
	Item* pMaterialItem2 = NULL;
	if( MaterialBagIndex1 != -1 )
	{
		pMaterialItem1 = HumanItemLogic::GetBagItem( pHuman, pAbilityOpera->m_BagPos[2] );
		Assert( pMaterialItem1 != NULL );
	}
	if( MaterialBagIndex2 != -1 )
	{
		pMaterialItem2 = HumanItemLogic::GetBagItem( pHuman, pAbilityOpera->m_BagPos[3] );
		Assert( pMaterialItem2 != NULL );
	}
	Assert( (pGemItem != NULL) && (pEquipItem != NULL) );

	if( (pGemItem->IsLock())
	 || (pEquipItem->IsLock())
	 || (pGemItem->IsPWLock())
	 || (pEquipItem->IsPWLock())
	 || (pGemItem->GetItemClass() != ICLASS_GEM)
	 || (pEquipItem->GetItemClass() != ICLASS_EQUIP)
	 )
	{
		return OR_STUFF_LACK;
	}

	//if( pHuman->__GetAbilityLevel(pAbilityOpera->m_AbilityID) < pGemItem->GetItemQual() )
	//{
	//	return OR_NO_LEVEL;
	//}

	if( IsGemConflict(pHuman, pAbilityOpera->m_BagPos[0], pAbilityOpera->m_BagPos[1]) == FALSE )
	{
		return OR_GEM_CONFLICT;
	}

	LuaInterface* pLuaInterface;
	pLuaInterface = pHuman->getScene()->GetLuaInterface();

	if( pEquipItem->GetGemSlotMax() <= pEquipItem->GetEquipGemCount()
	 || pLuaInterface->ExeScript_DDD(	ABILITY_LOGIC_SCRIPT, DEF_GEM_COUNT_CHECK,
										(INT)pHuman->getScene()->SceneID(),
										(INT)pHuman->GetID(),
										(INT)pAbilityOpera->m_BagPos[1] )
	 )
	{
		return OR_GEM_SLOT_LACK;
	}

	if( pLuaInterface->ExeScript_DDDD(	ABILITY_LOGIC_SCRIPT, DEF_IS_GEM_FIT_EQUIP,
										(INT)pHuman->getScene()->SceneID(),
										(INT)pHuman->GetID(),
										pGemItem->GetItemTableIndex(),
										pAbilityOpera->m_BagPos[1] ) == 0
	 )
	{ // 判断宝石和装备是否匹配
		return OR_GEM_NOT_FIT_EQUIP;
	}

	return OR_OK;

__LEAVE_FUNCTION

	return OR_ERROR;
}
开发者ID:uvbs,项目名称:wx2Server,代码行数:95,代码来源:AbilityInlay.cpp


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