本文整理汇总了C++中PlayerCreature::deleteItemFromExtraInventorySlot方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerCreature::deleteItemFromExtraInventorySlot方法的具体用法?C++ PlayerCreature::deleteItemFromExtraInventorySlot怎么用?C++ PlayerCreature::deleteItemFromExtraInventorySlot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerCreature
的用法示例。
在下文中一共展示了PlayerCreature::deleteItemFromExtraInventorySlot方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
//.........这里部分代码省略.........
} else {
bisSame = false;
break;
}
}
}
}
// 들어갈 아이템과 들어있는 아이템의 좌표가 꼭 일치 한다면?
if(bisSame) {
// 숫자가 9개를 넘으면 9개 될때까지만 Add 하고 나머지는 마우스에 달아둔다.
if (pItem->getNum() + pPrevItem->getNum() > MaxStack) {
ItemNum_t CurrentNum = pPrevItem->getNum();
ItemNum_t AddNum = pItem->getNum();
ItemNum_t NewNum = AddNum + CurrentNum - MaxStack;
pPrevItem->setNum(MaxStack);
pItem->setNum(NewNum);
pInventory->increaseNum(MaxStack - CurrentNum);
pInventory->increaseWeight(pItem->getWeight()* (MaxStack - CurrentNum));
//pPrevItem->save(pPC->getName(), STORAGE_INVENTORY, 0, InvenX, InvenY);
// item저장 최적화. by sigi. 2002.5.13
char pField[80];
sprintf(pField, "Num=%d, Storage=%d, StorageID=%d, X=%d, Y=%d", MaxStack, STORAGE_INVENTORY, invenID, InvenX, InvenY);
pPrevItem->tinysave(pField);
//pItem->save(pPC->getName(), STORAGE_EXTRASLOT, 0, 0, 0);
// item저장 최적화. by sigi. 2002.5.13
sprintf(pField, "Num=%d, Storage=%d", NewNum, STORAGE_EXTRASLOT);
pItem->tinysave(pField);
Success = true;
} else {
pPC->deleteItemFromExtraInventorySlot();
pPrevItem->setNum(pPrevItem->getNum() + pItem->getNum());
pInventory->increaseNum(pItem->getNum());
pInventory->increaseWeight(pItem->getWeight()* pItem->getNum());
//pPrevItem->save(pPC->getName(), STORAGE_INVENTORY, 0, InvenX, InvenY);
// item저장 최적화. by sigi. 2002.5.13
char pField[80];
sprintf(pField, "Num=%d, Storage=%d, StorageID=%u, X=%d, Y=%d", pPrevItem->getNum(), STORAGE_INVENTORY, invenID, InvenX, InvenY);
pPrevItem->tinysave(pField);
pItem->destroy();
SAFE_DELETE(pItem);
Success = true;
}
if (g_pVariableManager->getVariable(NETMARBLE_CARD_EVENT) != 0 && pPrevItem->getItemClass() == Item::ITEM_CLASS_MOON_CARD && pPrevItem->getItemType() == 2 && pPrevItem->getNum() == 99) {
GCNoticeEvent gcNE;
gcNE.setCode(NOTICE_EVENT_NETMARBLE_CARD_FULL);
pGamePlayer->sendPacket(&gcNE);
//cout << "gcNE sent" << endl;
}
if (pPrevItem->getItemClass() == Item::ITEM_CLASS_LUCKY_BAG
&& pPrevItem->getItemType() == 3
&& pPrevItem->getNum() == 50 ) {
GCDeleteInventoryItem gcDI;
gcDI.setObjectID(pPrevItem->getObjectID());
pGamePlayer->sendPacket(&gcDI);
pInventory->deleteItem(pPrevItem->getObjectID());
pPrevItem->destroy();
SAFE_DELETE(pPrevItem);
示例2: 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
}
示例3: 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);
//.........这里部分代码省略.........