本文整理汇总了C++中PlayerCreature::getPetInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerCreature::getPetInfo方法的具体用法?C++ PlayerCreature::getPetInfo怎么用?C++ PlayerCreature::getPetInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerCreature
的用法示例。
在下文中一共展示了PlayerCreature::getPetInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
void CGModifyNicknameHandler::execute (CGModifyNickname* pPacket , Player* pPlayer)
throw(ProtocolException, Error)
{
__BEGIN_TRY __BEGIN_DEBUG_EX
#ifdef __GAME_SERVER__
Assert(pPacket != NULL);
Assert(pPlayer != NULL);
GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
Assert(pGamePlayer != NULL);
PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pGamePlayer->getCreature());
Assert(pPC != NULL);
Inventory* pInventory = pPC->getInventory();
Assert(pInventory != NULL);
GCNicknameVerify gcNV;
ObjectID_t itemOID = pPacket->getItemObjectID();
EventGiftBox* pItem = NULL;
if (itemOID != 0 )
{
pItem = dynamic_cast<EventGiftBox*>(pInventory->getItemWithObjectID(itemOID ));
if (pItem == NULL )
{
filelog("Nickname.log", "[%s:%s] 아이템이 없거나 EventGiftBox가 아닙니다.",
pPlayer->getID().c_str(),
pPC->getName().c_str());
gcNV.setCode(NICKNAME_MODIFY_FAIL_NO_ITEM);
pGamePlayer->sendPacket(&gcNV);
return;
}
}
else
{
PetInfo* pPetInfo = pPC->getPetInfo();
if (pPetInfo == NULL || pPetInfo->getPetType() != PET_PACKAGE )
{
gcNV.setCode(NICKNAME_MODIFY_FAIL_NO_ITEM);
pGamePlayer->sendPacket(&gcNV);
return;
}
pPetInfo->setNickname(pPacket->getNickname());
pPetInfo->getPetItem()->savePetInfo();
sendPetInfo(pGamePlayer, true);
gcNV.setCode(NICKNAME_MODIFY_OK);
pGamePlayer->sendPacket(&gcNV);
return;
}
switch (pItem->getItemType() )
{
// 펫 닉네임 바꾸기
case 23 :
{
PetInfo* pPetInfo = pPC->getPetInfo();
if (pPetInfo == NULL )
{
gcNV.setCode(NICKNAME_MODIFY_FAIL_NO_ITEM);
pGamePlayer->sendPacket(&gcNV);
return;
}
if (pPetInfo->getPetType() != PET_PACKAGE && pItem == NULL )
{
gcNV.setCode(NICKNAME_MODIFY_FAIL_NO_ITEM);
pGamePlayer->sendPacket(&gcNV);
return;
}
pPetInfo->setNickname(pPacket->getNickname());
pPetInfo->getPetItem()->savePetInfo();
sendPetInfo(pGamePlayer, true);
gcNV.setCode(NICKNAME_MODIFY_OK);
pGamePlayer->sendPacket(&gcNV);
if (pPetInfo->getPetType() != PET_PACKAGE )
{
pInventory->deleteItem(itemOID);
pItem->destroy();
SAFE_DELETE(pItem);
GCUseOK gcOK;
pGamePlayer->sendPacket(&gcOK);
}
return;
}
// 커스텀 닉네임 바꾸기
case 22 :
//.........这里部分代码省略.........