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


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

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


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

示例1: Fishing_Ready_Ack

void CFishingManager::Fishing_Ready_Ack(void* pMsg)
{
	MSG_DWORD4* pmsg = (MSG_DWORD4*)pMsg;

	CObject* pObject = OBJECTMGR->GetObject(pmsg->dwObjectID);
	if(!pObject)
		return;

	if(pObject == HERO)
	{
		if(0==pmsg->dwData1 || 0==pmsg->dwData3 || 0==pmsg->dwData4)
			return;

		SetFishingStartTime(gCurTime);
		SetFishingPlace(pmsg->dwData1);

		m_fGaugeStartPos = (float)pmsg->dwData2/100.0f;
		m_dwProcessTime = pmsg->dwData3;
		m_nRepeatCount = pmsg->dwData4;

		LONG maxValue = 0;
		cGuageBar* pGaugeBar = GAMEIN->GetFishingGaugeDlg()->GetFishingGB();
		if(pGaugeBar)
			maxValue = pGaugeBar->GetMaxValue();

		m_fGaugeBarSpeed = ((float)m_nRepeatCount * maxValue) / (float)m_dwProcessTime;
		m_dwUpdateTime = (m_dwProcessTime / m_nRepeatCount) / maxValue;

		m_bActive = TRUE;
	}
	else
	{
		CNpc* pNpc = (CNpc*)OBJECTMGR->GetObject(pmsg->dwData1);
		if(pNpc)
		{
			// 방향전환
			VECTOR3 pos;
			pNpc->GetPosition(&pos);
			MOVEMGR->SetLookatPos(pObject,&pos,0,gCurTime);
		}
	}


	OBJECTSTATEMGR->StartObjectState(pObject, eObjectState_Fishing);
	OBJECTEFFECTDESC desc( FindEffectNum("char_m_fishing_swing_A.beff") );

	pObject->RemoveObjectEffect( FISHING_START_EFFECT );
	pObject->AddObjectEffect( FISHING_START_EFFECT, &desc, 1 );
}
开发者ID:xianyinchen,项目名称:LUNAPlus,代码行数:49,代码来源:FishingManager.cpp

示例2: 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

示例3: SendFishing_Ready

void CFishingManager::SendFishing_Ready(DWORD dwBaitIdx, POSTYPE BaitPos)
{
	const EObjectState IsRestMode = OBJECTSTATEMGR->GetObjectState(HERO) ;

	if(IsRestMode == eObjectState_FishingResult)
	{
		OBJECTSTATEMGR->EndObjectState(HERO, eObjectState_FishingResult);
		OBJECTSTATEMGR->StartObjectState(HERO, eObjectState_None);
	}
	else if(IsRestMode != eObjectState_None)
	{
		CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(1524) );
		goto FISHING_SENDREADY_ERROR;
	}

	if(m_bActive)
	{
		CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(1525) );
		goto FISHING_SENDREADY_ERROR;
	}

	CObject* pObject = OBJECTMGR->GetSelectedObject();
	if(pObject && pObject->GetObjectKind() == eObjectKind_Npc)
	{
		CNpc* pNpc = (CNpc*)pObject;
		if(pNpc->GetNpcJob() != FISHINGPLACE_ROLE)
		{
			CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(1526) );
			goto FISHING_SENDREADY_ERROR;
		}

		if(HERO->GetWeaponEquipType() != eWeaponType_FishingPole)
		{
			CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(1532) );
			goto FISHING_SENDREADY_ERROR;
		}

		if(pNpc->IsDied())
		{
			CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(1524) );
			goto FISHING_SENDREADY_ERROR;
		}

		if(0==dwBaitIdx)
		{
			CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(1527) );
			goto FISHING_SENDREADY_ERROR;
		}

		// 거리제한
		VECTOR3 vHeroPos;
		HERO->GetPosition(&vHeroPos) ;
		float fDistance = CalcDistanceXZ(&vHeroPos, &pObject->GetBaseMoveInfo()->CurPosition) ;
		if(MAX_FISHING_DISTANCE < fDistance) 
		{
			CHATMGR->AddMsg(CTC_SYSMSG, CHATMGR->GetChatMsg(1548)) ;
			goto FISHING_SENDREADY_ERROR;
		}

		// 방향전환
		VECTOR3 pos;
		pNpc->GetPosition(&pos);
		MOVEMGR->SetLookatPos(HERO,&pos,0,gCurTime);

		GAMEIN->GetFishingDlg()->SetLastFishingEndTime(0);

		MSG_FISHING_READY_SYN msg;
		msg.Category = MP_FISHING;
		msg.Protocol = MP_FISHING_READY_SYN;
		msg.dwObjectID = HEROID;
		msg.dwPlaceIdx = pNpc->GetID();
		msg.dwPoleItemIdx = HERO->GetWearedItemIdx(eWearedItem_Weapon);
		msg.wBaitItemPos = BaitPos;
		msg.dwBaitItemIdx = dwBaitIdx;

		NETWORK->Send(&msg, sizeof(msg));
		return;
	}

	CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(1526) );
	goto FISHING_SENDREADY_ERROR;

FISHING_SENDREADY_ERROR:
	GAMEIN->GetFishingDlg()->SetPushStartBtn(FALSE);
	GAMEIN->GetFishingDlg()->SetLastFishingEndTime(0);
}
开发者ID:xianyinchen,项目名称:LUNAPlus,代码行数:86,代码来源:FishingManager.cpp


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