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


C++ CNpc::GetObjectKind方法代码示例

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


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

示例1: Cook_Syn

void cCookManager::Cook_Syn(void* pMsg)
{
	WORD wResult = eCookError_None;
	MSG_COOK_SYN* pmsg = (MSG_COOK_SYN*)pMsg;
	CPlayer* pPlayer = (CPlayer*)g_pUserTable->FindUser(pmsg->dwObjectID);
	
	if(pPlayer)
	{
		// 스피드핵 체크
		if(0 < pPlayer->GetLastCookTime())
		{
			wResult=eCookError_InvaildState;
			goto COOK_NACK;
		}

		// 요리도구확인
		WORD wCookUtilLevel = CheckCookUtil(pPlayer);
		if(!wCookUtilLevel)
		{
			wResult=eCookError_InvaildUtil;			
			goto COOK_NACK;
		}

		// 레시피확인
		stRecipeInfo* pRecipe = GetRecipeInfo(pmsg->dwRecipeIdx);
		if(!pRecipe)
		{
			wResult=eCookError_InvaildRecipe;
			goto COOK_NACK;
		}

		// 요리도구-레시피 레벨확인
		if(wCookUtilLevel<eCOOKLEVEL3 && wCookUtilLevel<COOKMGR->GetCookLevelFromRecipe(pRecipe->dwRecipeIdx))
		{
			wResult=eCookError_LowerUtil;
			goto COOK_NACK;
		}

		// 모닥불확인
		CNpc* pFire = (CNpc*)g_pUserTable->FindUser(pmsg->dwFireNpcIdx);
		if(!pFire || eObjectKind_Npc!=pFire->GetObjectKind())
		{
			wResult=eCookError_InvaildFire;
			goto COOK_NACK;
		}

		// 제작수량확인
		if(pmsg->wMakeNum<1 || 99<pmsg->wMakeNum)
		{
			wResult=eCookError_InvaildMakeNum;
			goto COOK_NACK;
		}

		// 거리제한
		VECTOR3 vHeroPos, vPlacePos;
		pPlayer->GetPosition(&vHeroPos) ;
		pFire->GetPosition(&vPlacePos);
		float fDistance = CalcDistanceXZ(&vHeroPos, &vPlacePos);
		if(MAX_COOKING_DISTANCE < fDistance)
		{
			wResult = eCookError_OverDistance;
			goto COOK_NACK;
		}

		CItemSlot* pInvenSlot = pPlayer->GetSlot(eItemTable_Inventory);
		if(0 == ITEMMGR->GetTotalEmptySlotNum(pInvenSlot, pPlayer))
		{
			wResult = eCookError_InvenFull;
			goto COOK_NACK;
		}

		// 요리재료확인 및 소모
		if(!CheckIngredients(pPlayer, pRecipe, pmsg->wMakeNum))
		{
			wResult = eCookError_NeedIngredient;
			goto COOK_NACK;
		}

		// 숙련도확인 및 증가
		WORD wCookCount = pPlayer->GetCookCount(); 
		WORD wAddPoint = 0;
		if(pPlayer->GetCookLevel() == GetCookLevelFromRecipe(pRecipe->dwRecipeIdx))
		{
			WORD wExpertPointMin = (WORD)pRecipe->dwExpertPointMin;
			WORD wExpertPointMax = (WORD)pRecipe->dwExpertPointMax;
			if(pPlayer->GetCookCount() < wExpertPointMin)
			{
				wResult = eCookError_LowerExpertPoint;
				goto COOK_NACK;
			}
			
			if(wExpertPointMax < wCookCount)
				wAddPoint = 0;
			else if(wExpertPointMax <= wCookCount+pmsg->wMakeNum)
				wAddPoint = wExpertPointMax - wCookCount;
			else
				wAddPoint = pmsg->wMakeNum;

			if(wCookCount+wAddPoint < COOKMGR->GetMaxCookCount(pPlayer->GetCookLevel()))
				pPlayer->SetCookCount(wCookCount + wAddPoint);
//.........这里部分代码省略.........
开发者ID:xianyinchen,项目名称:LUNAPlus,代码行数:101,代码来源:cCookManager.cpp


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