本文整理汇总了C++中Obj_Human::FreePetToNature方法的典型用法代码示例。如果您正苦于以下问题:C++ Obj_Human::FreePetToNature方法的具体用法?C++ Obj_Human::FreePetToNature怎么用?C++ Obj_Human::FreePetToNature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obj_Human
的用法示例。
在下文中一共展示了Obj_Human::FreePetToNature方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
uint CGManipulatePetHandler::Execute( CGManipulatePet* 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 ) ;
Item *pPetItem = pHuman->GetPetItem(pPacket->GetGUID());
if(pPetItem == NULL)
return PACKET_EXE_CONTINUE;
if(pPetItem->IsLock())
{
return PACKET_EXE_CONTINUE;
}
INT nType = pPacket->GetManipulateType();
switch(nType)
{
case MANIPULATE_CREATEPET:
{// 召唤宠物
ORESULT oResult = pHuman->TestCallUpPet(pPacket->GetGUID() );
if( OR_SUCCEEDED(oResult) )
{
AI_Human* pHumanAI = (AI_Human*)(pHuman->GetAIObj());
if (pHumanAI)
{
ObjID_t idSkill = CALL_UP_PET;
oResult = pHumanAI->PushCommand_UseSkill(idSkill, 1, -1, -1.f, -1.f, 0.f, INVALID_GUID);
}
}
if( OR_FAILED(oResult) )
{
GCManipulatePetRet msg;
msg.SetManipulateRet(GCManipulatePetRet::MANIPULATEPET_RET_CALLUPFALID);
pGamePlayer->SendPacket(&msg);
pHuman->SendOperateResultMsg(oResult);
return PACKET_EXE_CONTINUE;
}
pHuman->ReCallPet();
pHuman->SetGUIDOfCallUpPet(pPacket->GetGUID());
}
break;
case MANIPULATE_DELETEPET:
{// 收回宠物
ORESULT oResult = pHuman->ReCallPet();
GCManipulatePetRet msg;
if (OR_FAILED(oResult))
{
msg.SetManipulateRet(GCManipulatePetRet::MANIPULATEPET_RET_RECALLFALID);
}
else if (OR_SUCCEEDED(oResult))
{
msg.SetManipulateRet(GCManipulatePetRet::MANIPULATEPET_RET_RECALLSUCC);
}
pGamePlayer->SendPacket(&msg);
}
break;
case MANIPULATE_FREEPET:
{// 放生宠物
PET_LOG_PARAM PetLogParam;
ORESULT oResult = pHuman->FreePetToNature(&PetLogParam,pPacket->GetGUID());
GCManipulatePetRet msg;
if (OR_FAILED(oResult))
{
msg.SetManipulateRet(GCManipulatePetRet::MANIPULATEPET_RET_FREEFALID);
}
else if (OR_SUCCEEDED(oResult))
{
msg.SetManipulateRet(GCManipulatePetRet::MANIPULATEPET_RET_FREESUCC);
}
pGamePlayer->SendPacket(&msg);
}
break;
case MANIPULATE_ASKOTHERPETINFO:
{// 察看其他玩家的宠物信息
ObjID_t objID = pPacket->GetObjID();
Obj* pObj = pScene->GetObjManager()->GetObj(objID);
if (pObj && pObj->GetObjType() == Obj::OBJ_TYPE_PET)
{
Obj_Human* pCreator = ((Obj_Pet*)pObj)->GetCreator();
if (pCreator)
{
PET_GUID_t guidpet = ((Obj_Pet*)pObj)->GetPetGUID();
if(guidpet.IsNull())
//.........这里部分代码省略.........