本文整理汇总了C++中Inventory::increaseWeight方法的典型用法代码示例。如果您正苦于以下问题:C++ Inventory::increaseWeight方法的具体用法?C++ Inventory::increaseWeight怎么用?C++ Inventory::increaseWeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inventory
的用法示例。
在下文中一共展示了Inventory::increaseWeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
//.........这里部分代码省略.........
VolumeWidth_t ItemWidth = pItem->getVolumeWidth();
VolumeHeight_t ItemHeight = pItem->getVolumeHeight();
VolumeWidth_t InvenWidth = pInventory->getWidth();
VolumeWidth_t InvenHeight= pInventory->getHeight();
if ((InvenX + ItemWidth <= InvenWidth) && (InvenY + ItemHeight <= InvenHeight)) {
for (int x = InvenX; x < (InvenX + ItemWidth); x++) {
for (int y = InvenY; y < (InvenY + ItemHeight); y++) {
if (pInventory->hasItem(x, y)) {
if(pInventory->getItem(x,y) != pPrevItem ) {
bisSame = false;
break;
}
} 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);
示例2: execute
void CGAddMouseToQuickSlotHandler::execute (CGAddMouseToQuickSlot* 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);
Creature* pCreature = pGamePlayer->getCreature();
bool Success = false;
if (pCreature->isSlayer())
{
Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature);
InventorySlot* pExtraSlot = pSlayer->getExtraInventorySlot();
Item* pItem = pExtraSlot->getItem();
if (pItem == NULL)
{
GCCannotAdd _GCCannotAdd;
_GCCannotAdd.setObjectID(pPacket->getObjectID());
pPlayer->sendPacket(&_GCCannotAdd);
return;
}
ObjectID_t ItemObjectID = pItem->getObjectID();
SlotID_t SlotID = pPacket->getSlotID();
Item::ItemClass IClass = pItem->getItemClass();
// 아이템의 ObjectID가 일치하는지 체크한다.
if (ItemObjectID != pPacket->getObjectID())
{
GCCannotAdd _GCCannotAdd;
_GCCannotAdd.setObjectID(pPacket->getObjectID());
pPlayer->sendPacket(&_GCCannotAdd);
return;
}
// 벨트를 입고 있지 않다면 벨트에다 아이템을 더할 수가 없다.
if (!pSlayer->isWear(Slayer::WEAR_BELT))
{
GCCannotAdd _GCCannotAdd;
_GCCannotAdd.setObjectID(pPacket->getObjectID());
pPlayer->sendPacket(&_GCCannotAdd);
return;
}
// 포션도 아니고, 탄창도 아니라면 더할 수가 없지.
if (IClass != Item::ITEM_CLASS_POTION && IClass != Item::ITEM_CLASS_MAGAZINE && IClass != Item::ITEM_CLASS_EVENT_ETC && IClass != Item::ITEM_CLASS_KEY)
{
GCCannotAdd _GCCannotAdd;
_GCCannotAdd.setObjectID(pPacket->getObjectID());
pPlayer->sendPacket(&_GCCannotAdd);
return;
}
if (IClass == Item::ITEM_CLASS_EVENT_ETC && pItem->getItemType() < 14 )
{
GCCannotAdd _GCCannotAdd;
_GCCannotAdd.setObjectID(pPacket->getObjectID());
pPlayer->sendPacket(&_GCCannotAdd);
return;
}
Item* pBelt = pSlayer->getWearItem(Slayer::WEAR_BELT);
Inventory* pBeltInventory = ((Belt*)pBelt)->getInventory();
if (pBeltInventory->canAdding(SlotID, 0, pItem))
{
// 현재 벨트에 있는 Item을 받아온다.
Item* pPrevItem = pBeltInventory->getItem(SlotID, 0);
// 지정한 자리에 아이템이 있다면...
if (pPrevItem != NULL)
{
// 아이템이 완전히 같은 아이템이라면...
if (isStackable(pItem) && isSameItem(pItem, pPrevItem))
{
int MaxStack = ItemMaxStack[pItem->getItemClass()];
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);
pBeltInventory->increaseNum(MaxStack - CurrentNum);
pBeltInventory->increaseWeight(pItem->getWeight()* (MaxStack - CurrentNum));
//pPrevItem->save(pSlayer->getName(), STORAGE_BELT, pBelt->getItemID(), SlotID, 0);
// item저장 최적화. by sigi. 2002.5.13
char pField[80];
sprintf(pField, "Num=%d, Storage=%d, StorageID=%lu, X=%d", MaxStack, STORAGE_BELT, pBelt->getItemID(), SlotID);
pPrevItem->tinysave(pField);
//pItem->save(pSlayer->getName(), STORAGE_EXTRASLOT, 0, 0, 0);
// item저장 최적화. by sigi. 2002.5.13
//.........这里部分代码省略.........