本文整理汇总了C++中PlayerCreature::getExtraInventorySlotItem方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerCreature::getExtraInventorySlotItem方法的具体用法?C++ PlayerCreature::getExtraInventorySlotItem怎么用?C++ PlayerCreature::getExtraInventorySlotItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerCreature
的用法示例。
在下文中一共展示了PlayerCreature::getExtraInventorySlotItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: executeOusters
void CGTradeAddItemHandler::executeOusters (CGTradeAddItem* pPacket , Player* pPlayer)
throw(ProtocolException , Error)
{
__BEGIN_TRY __BEGIN_DEBUG_EX
#ifdef __GAME_SERVER__
// 상위 함수에서 에러를 검사했기 때문에,
// 여기서는 포인터가 널인지를 검사하지 않는다.
ObjectID_t TargetOID = pPacket->getTargetObjectID();
ObjectID_t ItemOID = pPacket->getItemObjectID();
GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
Creature* pPC = pGamePlayer->getCreature();
Zone* pZone = pPC->getZone();
PlayerCreature* pTargetPC = dynamic_cast<PlayerCreature*>(pZone->getCreature(TargetOID));
// NoSuch제거. by sigi. 2002.5.2
if (pTargetPC==NULL) return;
Ousters* pSender = dynamic_cast<Ousters*>(pPC);
TradeManager* pTradeManager = pZone->getTradeManager();
Assert(pTradeManager != NULL);
// 교환 대상에 추가할 아이템의 포인터를 얻어낸다.
CoordInven_t X, Y;
Inventory* pInventory = pSender->getInventory();
Item* pItem = pInventory->findItemOID(ItemOID, X, Y);
// 추가할 아이템이 없다면 당연히 더 이상 처리가 불가능
// Relic은 교환할 수 없다.
if (pItem == NULL
|| !canTrade(pItem )
|| pSender->getStore()->hasItem(pItem)
|| (pItem->getItemClass() == Item::ITEM_CLASS_SUB_INVENTORY && hasItemWithItemClass(pTargetPC, Item::ITEM_CLASS_SUB_INVENTORY ) )
)
{
pTradeManager->cancelTrade(pPC);
executeError(pPacket, pPlayer, GC_TRADE_ERROR_CODE_ADD_ITEM);
return;
}
//
//#ifdef __XMAS_EVENT_CODE__
// 녹색 선물 상자인 경우에는, 상대방에게 적색 선물 상자가 없는지 검사한 후,
// 인증 패킷을 보내줘야 한다.
if (pItem->getItemClass() == Item::ITEM_CLASS_EVENT_GIFT_BOX)
{
PlayerCreature* pReceiver = dynamic_cast<PlayerCreature*>(pTargetPC);
Item* pExtraSlotItem = pReceiver->getExtraInventorySlotItem();
if (pItem->getItemType() == 0)
{
Inventory* pTargetInventory = pReceiver->getInventory();
if (pTargetInventory->hasRedGiftBox())
{
// 적색 선물 상자를 가지고 있다면 더할 수 없다. 리턴시킨다.
GCTradeVerify gcTradeVerify;
gcTradeVerify.setCode(GC_TRADE_VERIFY_CODE_ADD_ITEM_FAIL);
pPlayer->sendPacket(&gcTradeVerify);
return;
}
else if (pExtraSlotItem != NULL)
{
if (pExtraSlotItem->getItemClass() == Item::ITEM_CLASS_EVENT_GIFT_BOX && pExtraSlotItem->getItemType() == 1)
{
GCTradeVerify gcTradeVerify;
gcTradeVerify.setCode(GC_TRADE_VERIFY_CODE_ADD_ITEM_FAIL);
pPlayer->sendPacket(&gcTradeVerify);
return;
}
}
else
{
// 적색 선물 상자를 가지고 있지 않다면, 걍 넘어간다.
GCTradeVerify gcTradeVerify;
gcTradeVerify.setCode(GC_TRADE_VERIFY_CODE_ADD_ITEM_OK);
pPlayer->sendPacket(&gcTradeVerify);
}
}
else if (pItem->getItemType() == 1)
{
// 적색 선물 상자는 교환 품목이 될 수 없다.
GCTradeVerify gcTradeVerify;
gcTradeVerify.setCode(GC_TRADE_VERIFY_CODE_ADD_ITEM_FAIL);
pPlayer->sendPacket(&gcTradeVerify);
return;
}
}
//#endif
//
TradeInfo* pInfo1 = pTradeManager->getTradeInfo(pSender->getName());
TradeInfo* pInfo2 = pTradeManager->getTradeInfo(pTargetPC->getName());
list<Item*> tradeList1 = pInfo1->getItemList();
if (pItem->getItemClass() == Item::ITEM_CLASS_EVENT_GIFT_BOX && pItem->getItemType() > 1 && pItem->getItemType() < 6)
{
//.........这里部分代码省略.........
示例2: execute
void CGAddInventoryToMouseHandler::execute(CGAddInventoryToMouse* pPacket , Player* pPlayer)
throw(ProtocolException, Error)
{
__BEGIN_TRY __BEGIN_DEBUG_EX
#ifdef __GAME_SERVER__
GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
Assert(pGamePlayer != NULL);
Creature* pCreature = pGamePlayer->getCreature();
Assert(pCreature != NULL);
PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature);
Assert(pPC != NULL);
Zone* pZone = pPC->getZone();
Assert(pZone != NULL);
if (pPC->getStore()->isOpen() )
{
GCCannotAdd _GCCannotAdd;
_GCCannotAdd.setObjectID(pPacket->getObjectID());
pPlayer->sendPacket(&_GCCannotAdd);
return;
}
CoordInven_t InvenX = pPacket->getX();
CoordInven_t InvenY = pPacket->getY();
ObjectID_t ItemOID = pPacket->getObjectID();
Inventory* pInventory = pPC->getInventory();
Assert(pInventory != NULL);
int invenID = 0;
/* Commenting the SubInventory stuff, since it's not supported by the client we use
SubInventory* pInventoryItem = NULL;
int invenID = 0;
if (pPacket->getInventoryItemObjectID() != 0 )
{
CoordInven_t X, Y;
pInventoryItem = dynamic_cast<SubInventory*>(pInventory->findItemOID(pPacket->getInventoryItemObjectID(), X, Y ));
if (pInventoryItem == NULL )
{
GCCannotAdd _GCCannotAdd;
_GCCannotAdd.setObjectID(pPacket->getObjectID());
pPlayer->sendPacket(&_GCCannotAdd);
return;
}
pInventory = pInventoryItem->getInventory();
invenID = pInventoryItem->getItemID();
}
*/
// 인벤토리 좌표를 넘어가면 곤란하다...
if (InvenX >= pInventory->getWidth() || InvenY >= pInventory->getHeight())
{
GCCannotAdd _GCCannotAdd;
_GCCannotAdd.setObjectID(pPacket->getObjectID());
pPlayer->sendPacket(&_GCCannotAdd);
return;
}
Item* pItem = pInventory->getItem(InvenX, InvenY);
Item* pExtraSlotItem = pPC->getExtraInventorySlotItem();
if (pPC->getStore()->hasItem(pItem ) )
{
GCCannotAdd _GCCannotAdd;
_GCCannotAdd.setObjectID(pPacket->getObjectID());
pPlayer->sendPacket(&_GCCannotAdd);
return;
}
// 더하고자 하는 아이템이 없거나, 이미 마우스에 뭔가가 붙어있다면
// 들 수 없다.
if (pItem == NULL || pExtraSlotItem != NULL)
{
GCCannotAdd _GCCannotAdd;
_GCCannotAdd.setObjectID(pPacket->getObjectID());
pPlayer->sendPacket(&_GCCannotAdd);
return;
}
// 일반적인 아이템 마우스 더하기 루틴
if (ItemOID != 0)
{
// OID가 일치하지 않으면 곤란하다...
if (pItem->getObjectID() != ItemOID)
{
GCCannotAdd _GCCannotAdd;
_GCCannotAdd.setObjectID(pPacket->getObjectID());
pPlayer->sendPacket(&_GCCannotAdd);
return;
}
pInventory->deleteItem(pItem->getObjectID());
pPC->addItemToExtraInventorySlot(pItem);
//pItem->save(pPC->getName(), STORAGE_EXTRASLOT, 0, 0, 0);
// item저장 최적화. by sigi. 2002.5.13
//.........这里部分代码省略.........
示例3: execute
void CGAddItemToCodeSheetHandler::execute (CGAddItemToCodeSheet* pPacket , Player* pPlayer)
throw(Error)
{
__BEGIN_TRY __BEGIN_DEBUG_EX
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);
CoordInven_t x,y;
Item* pMouseItem = pPC->getExtraInventorySlotItem();
Item* pTargetItem = pPC->getInventory()->findItemOID(pPacket->getObjectID(), x, y);
GCCannotUse failpkt;
failpkt.setObjectID(pPacket->getObjectID());
if (pMouseItem == NULL || pTargetItem == NULL
|| pMouseItem->getItemClass() != Item::ITEM_CLASS_EVENT_ITEM
|| pTargetItem->getItemClass() != Item::ITEM_CLASS_CODE_SHEET
|| pMouseItem->getItemType() > 26 || pMouseItem->getItemType() < 22
|| pTargetItem->getItemType() != 0 )
{
pPlayer->sendPacket(&failpkt);
return;
}
GCUseOK okpkt;
uint StoneNum = pMouseItem->getItemType()-21;
Assert(StoneNum >= 1 && StoneNum <= 5);
x = pPacket->getX();
y = pPacket->getY();
vector<OptionType_t> OptionType(pTargetItem->getOptionTypeList().begin(), pTargetItem->getOptionTypeList().end());
if (OptionType.size() < 30 )
{
pPlayer->sendPacket(&failpkt);
return;
}
uint TargetStoneNum = getStoneNum(OptionType, x, y);
if (TargetStoneNum != 0xf || !canPutStone(OptionType, x, y, StoneNum ) )
{
pPlayer->sendPacket(&failpkt);
return;
}
setStoneNum(OptionType, x, y, StoneNum);
if (isComplete(OptionType ) )
{
pTargetItem->setItemType(1);
pTargetItem->tinysave("ItemType=1");
}
pTargetItem->setOptionType(list<OptionType_t>(OptionType.begin(), OptionType.end()));
string optionField;
setOptionTypeToField(pTargetItem->getOptionTypeList(), optionField);
char query[100];
sprintf(query, "OptionType = '%s'", optionField.c_str());
pTargetItem->tinysave(query);
pPC->deleteItemFromExtraInventorySlot();
pMouseItem->destroy();
SAFE_DELETE(pMouseItem);
pPlayer->sendPacket(&okpkt);
__END_DEBUG_EX __END_CATCH
}
示例4: execute
void CGTameMonsterHandler::execute (CGTameMonster* pPacket , Player* pPlayer)
throw(Error)
{
__BEGIN_TRY
#ifdef __GAME_SERVER__
GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
Assert(pGamePlayer != NULL);
PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pGamePlayer->getCreature());
Assert(pPC != NULL);
Zone* pZone = pPC->getZone();
Assert(pZone != NULL);
Monster* pMonster = dynamic_cast<Monster*>(pZone->getCreature(pPacket->getObjectID() ));
if (pMonster == NULL ) return;
Item* pItem = pPC->getExtraInventorySlotItem();
if (pItem == NULL || pItem->getItemClass() != Item::ITEM_CLASS_PET_FOOD || pItem->getNum() != 1 ) return;
PetFoodInfo* pPetFoodInfo = dynamic_cast<PetFoodInfo*>(g_pPetFoodInfoManager->getItemInfo(pItem->getItemType() ));
Assert(pPetFoodInfo != NULL);
Inventory* pInventory = pPC->getInventory();
if (pInventory == NULL ) return;
ItemType_t petType = PET_COMMON;
PetItem* pPetItem = dynamic_cast<PetItem*>(g_pItemFactoryManager->createItem(Item::ITEM_CLASS_PET_ITEM, petType, list<OptionType_t>() ));
Assert(pPetItem != NULL);
_TPOINT pt;
if (!pInventory->getEmptySlot(pPetItem, pt ) )
{
GCCannotUse gcCannotUse;
pGamePlayer->sendPacket(&gcCannotUse);
SAFE_DELETE(pPetItem);
return;
}
pPC->deleteItemFromExtraInventorySlot();
GCDeleteInventoryItem gcDI;
gcDI.setObjectID(pItem->getObjectID());
pGamePlayer->sendPacket(&gcDI);
pItem->destroy();
SAFE_DELETE(pItem);
/*
* 여기서 뭔가 확인을 해야 한다.
*/
int ratio = rand()%100;
if (g_pVariableManager->getVariable(PET_DAY_EVENT) != 0 )
{
ratio = 100;
}
// 공용 펫만 꼬실 수 있다.
PetTypeInfo* pPetTypeInfo = PetTypeInfoManager::getInstance()->getPetTypeInfo(petType);
if (pPetTypeInfo == NULL || pPetTypeInfo->getOriginalMonsterType() != pMonster->getMonsterType() || ratio >= pPetFoodInfo->getTameRatio() )
{
//cout << "꼬시기 실패 : " << ratio << endl;
SAFE_DELETE(pPetItem);
pMonster->addEnemy(pPC);
return;
}
pZone->deleteCreature(pMonster, pMonster->getX(), pMonster->getY());
SAFE_DELETE(pMonster);
/*
* 여기서 해당 펫의 정보를 가져와야 된다.
*/
PetInfo* pPetInfo = new PetInfo;
pPetInfo->setPetType(petType);
pPetInfo->setPetLevel(0);
pPetInfo->setPetCreatureType(pPetTypeInfo->getPetCreatureType(0));
pPetInfo->setPetAttr(0xff);
pPetInfo->setPetExp(0);
pPetInfo->setPetAttrLevel(0);
pPetInfo->setFoodType(pPetFoodInfo->getItemType());
pPetInfo->setGamble(0);
pPetInfo->setCutHead(0);
pPetInfo->setPetHP(pPetFoodInfo->getPetHP());
pPetInfo->setFeedTime(VSDateTime::currentDateTime());
// 양방향 링크
pPetItem->setPetInfo(pPetInfo);
pPetInfo->setPetItem(pPetItem);
pZone->registerObject(pPetItem);
pInventory->addItem(pPetItem, pt);
Assert(pt.x != -1);
pPetItem->create(pPC->getName(), STORAGE_INVENTORY, 0, pt.x, pt.y);
//.........这里部分代码省略.........