本文整理汇总了C++中Inventory::findItemOID方法的典型用法代码示例。如果您正苦于以下问题:C++ Inventory::findItemOID方法的具体用法?C++ Inventory::findItemOID怎么用?C++ Inventory::findItemOID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inventory
的用法示例。
在下文中一共展示了Inventory::findItemOID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
//////////////////////////////////////////////////////////////////////////////
// 뱀파이어 인벤토리 핸들러
//////////////////////////////////////////////////////////////////////////////
void BloodyTunnel::execute(Vampire* pVampire, ObjectID_t InvenObjectID, ObjectID_t InventoryItemObjectID, CoordInven_t X, CoordInven_t Y, CoordInven_t TargetX, CoordInven_t TargetY, VampireSkillSlot* pSkillSlot)
throw(Error)
{
__BEGIN_TRY
//cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin" << endl;
Assert(pVampire != NULL);
Assert(pSkillSlot != NULL);
try
{
Player* pPlayer = pVampire->getPlayer();
Zone* pZone = pVampire->getZone();
Inventory* pInventory = pVampire->getInventory();
Assert(pPlayer != NULL);
Assert(pZone != NULL);
Assert(pInventory!= NULL);
// 전쟁 존이라면 BloodyTunnel를 사용할 수 없다.
// 일단은 ZoneID로 가는데.. ZoneInfo에 넣도록 해야한다.
///*
//if (pZone->getZoneID()==1122 || pZone->getZoneID()==1123)
// 이벤트 경기장/OX 막기. by sigi. 2002.8.31
//int zoneID = pZone->getZoneID();
//if (zoneID==1005 || zoneID==1006)
if (pZone->isNoPortalZone()
|| pZone->isMasterLair()
|| pZone->isCastle()
|| pZone->isHolyLand())
{
executeSkillFailException(pVampire, getSkillType());
//cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl;
return;
}
//*/
SubInventory* pInventoryItem = NULL;
int invenID = 0;
if (InventoryItemObjectID != 0 )
{
//cout << "서브 인벤토리에서 사용 : " << InventoryItemObjectID << endl;
CoordInven_t X, Y;
pInventoryItem = dynamic_cast<SubInventory*>(pInventory->findItemOID(InventoryItemObjectID, X, Y ));
TradeManager* pTradeManager = pZone->getTradeManager();
Assert(pTradeManager != NULL);
if (pInventoryItem == NULL || pTradeManager->hasTradeInfo(pVampire->getName()) )
{
//cout << "근데 서브 인벤토리가 없다." <<endl;
executeSkillFailException(pVampire, getSkillType());
return;
}
pInventory = pInventoryItem->getInventory();
invenID = pInventoryItem->getItemID();
}
Item* pItem = pInventory->getItem(X, Y);
// 아이템이 없거나, 뱀파이어 포탈 아이템이 아니거나, OID가 틀리다면 기술 사용 불가
if (pItem == NULL || pItem->getItemClass() != Item::ITEM_CLASS_VAMPIRE_PORTAL_ITEM || pItem->getObjectID() != InvenObjectID)
{
executeSkillFailException(pVampire, getSkillType());
//cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl;
return;
}
VampirePortalItem* pVampirePortalItem = dynamic_cast<VampirePortalItem*>(pItem);
Assert(pVampirePortalItem != NULL);
// 뱀파이어 포탈 아이템에 기록된 위치가 없을 경우에는 실패다.
ZoneID_t zoneid = pVampirePortalItem->getZoneID();
ZoneCoord_t tx = pVampirePortalItem->getX();
ZoneCoord_t ty = pVampirePortalItem->getY();
if (zoneid == 0)
{
executeSkillFailException(pVampire, getSkillType());
//cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl;
return;
}
// 얻어온 목표 존과 좌표를 검증한다.
Zone* pTargetZone = getZoneByZoneID(zoneid);
// 아담의 성지와 다른 존과는 연결되지 않는다.
if (pZone->isHolyLand() != pTargetZone->isHolyLand())
{
executeSkillFailException(pVampire, getSkillType());
return;
}
//cout << "타겟 존 포인터 획득 성공" << endl;
VSRect* pRect = pTargetZone->getOuterRect();
//.........这里部分代码省略.........
示例2: 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)
{
//.........这里部分代码省略.........
示例3: execute
//////////////////////////////////////////////////////////////////////////////
// 뱀파이어 인벤토리 핸들러
//////////////////////////////////////////////////////////////////////////////
void TransformToWolf::execute(Vampire* pVampire, ObjectID_t InvenObjectID, ObjectID_t InventoryItemObjectID, CoordInven_t X, CoordInven_t Y, CoordInven_t TargetX, CoordInven_t TargetY, VampireSkillSlot* pSkillSlot)
throw(Error)
{
__BEGIN_TRY
//cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin" << endl;
Assert(pVampire != NULL);
Assert(pSkillSlot != NULL);
try
{
Player* pPlayer = pVampire->getPlayer();
Zone* pZone = pVampire->getZone();
Inventory* pInventory = pVampire->getInventory();
Assert(pPlayer != NULL);
Assert(pZone != NULL);
Assert(pInventory!= NULL);
SubInventory* pInventoryItem = NULL;
int invenID = 0;
if (InventoryItemObjectID != 0 )
{
//cout << "서브 인벤토리에서 사용 : " << InventoryItemObjectID << endl;
CoordInven_t X, Y;
pInventoryItem = dynamic_cast<SubInventory*>(pInventory->findItemOID(InventoryItemObjectID, X, Y ));
TradeManager* pTradeManager = pZone->getTradeManager();
Assert(pTradeManager != NULL);
if (pInventoryItem == NULL || pTradeManager->hasTradeInfo(pVampire->getName()) )
{
//cout << "근데 서브 인벤토리가 없다." <<endl;
executeSkillFailException(pVampire, getSkillType());
return;
}
pInventory = pInventoryItem->getInventory();
invenID = pInventoryItem->getItemID();
}
Item* pItem = pInventory->getItem(X, Y);
Assert(pItem != NULL);
// 적당한 아이템이 아니라면 당연히 변신할 수 없다.
// PK존에서는 변신할 수 없다.
if (pItem->getItemClass() != Item::ITEM_CLASS_VAMPIRE_ETC
|| pItem->getItemType() != 0
|| pVampire->hasRelicItem()
|| g_pPKZoneInfoManager->isPKZone(pZone->getZoneID() )
|| pVampire->isFlag(Effect::EFFECT_CLASS_REFINIUM_TICKET )
|| GDRLairManager::Instance().isGDRLairZone(pZone->getZoneID())
)
{
executeSkillFailException(pVampire, getSkillType());
//cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl;
return;
}
GCSkillToInventoryOK1 _GCSkillToInventoryOK1;
SkillType_t SkillType = pSkillSlot->getSkillType();
SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType);
ZoneCoord_t x = pVampire->getX();
ZoneCoord_t y = pVampire->getY();
// Knowledge of Innate 가 있다면 hit bonus 10
int HitBonus = 0;
if (pVampire->hasRankBonus(RankBonus::RANK_BONUS_KNOWLEDGE_OF_INNATE ) )
{
RankBonus* pRankBonus = pVampire->getRankBonus(RankBonus::RANK_BONUS_KNOWLEDGE_OF_INNATE);
Assert(pRankBonus != NULL);
HitBonus = pRankBonus->getPoint();
}
int RequiredMP = decreaseConsumeMP(pVampire, pSkillInfo);
bool bManaCheck = hasEnoughMana(pVampire, RequiredMP);
bool bTimeCheck = verifyRunTime(pSkillSlot);
bool bRangeCheck = checkZoneLevelToUseSkill(pVampire);
bool bHitRoll = HitRoll::isSuccessMagic(pVampire, pSkillInfo, pSkillSlot, HitBonus);
bool bMoveModeCheck = pVampire->isWalking();
bool bEffected = pVampire->isFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_WOLF)
|| pVampire->isFlag(Effect::EFFECT_CLASS_HAS_FLAG)
|| pVampire->isFlag(Effect::EFFECT_CLASS_HAS_SWEEPER);
if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && bMoveModeCheck && !bEffected)
{
decreaseMana(pVampire, RequiredMP, _GCSkillToInventoryOK1);
SkillInput input(pVampire);
SkillOutput output;
computeOutput(input, output);
//.........这里部分代码省略.........