aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/ItemHandler.cpp
diff options
context:
space:
mode:
authorleak <leak@bitmx.net>2012-03-14 18:51:51 +0100
committerleak <leak@bitmx.net>2012-03-14 18:51:51 +0100
commit2a5caef4a64645f788f6d3e33d6159725358f1dd (patch)
tree82978b70c72e756d5252bbce68fdec359e71f423 /src/server/game/Handlers/ItemHandler.cpp
parentb02a012b4784e2073593a75315616e093327e738 (diff)
Revert "Core: more more cleanup" - Build test anyone?
This reverts commit 20cd4c71ee6336610daab304959909b2f6397287.
Diffstat (limited to 'src/server/game/Handlers/ItemHandler.cpp')
-rwxr-xr-xsrc/server/game/Handlers/ItemHandler.cpp124
1 files changed, 62 insertions, 62 deletions
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index 9e637665f55..2434ba6eaa7 100755
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -255,14 +255,14 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket & recv_data)
}
}
- Item* item = _player->GetItemByPos(bag, slot);
- if (!item)
+ Item* pItem = _player->GetItemByPos(bag, slot);
+ if (!pItem)
{
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
return;
}
- if (item->GetTemplate()->Flags & ITEM_PROTO_FLAG_INDESTRUCTIBLE)
+ if (pItem->GetTemplate()->Flags & ITEM_PROTO_FLAG_INDESTRUCTIBLE)
{
_player->SendEquipError(EQUIP_ERR_CANT_DROP_SOULBOUND, NULL, NULL);
return;
@@ -271,7 +271,7 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket & recv_data)
if (count)
{
uint32 i_count = count;
- _player->DestroyItemCount(item, i_count, true);
+ _player->DestroyItemCount(pItem, i_count, true);
}
else
_player->DestroyItem(bag, slot, true);
@@ -445,13 +445,13 @@ void WorldSession::HandleReadItem(WorldPacket & recv_data)
recv_data >> bag >> slot;
//sLog->outDetail("STORAGE: Read bag = %u, slot = %u", bag, slot);
- Item* item = _player->GetItemByPos(bag, slot);
+ Item* pItem = _player->GetItemByPos(bag, slot);
- if (item && item->GetTemplate()->PageText)
+ if (pItem && pItem->GetTemplate()->PageText)
{
WorldPacket data;
- InventoryResult msg = _player->CanUseItem(item);
+ InventoryResult msg = _player->CanUseItem(pItem);
if (msg == EQUIP_ERR_OK)
{
data.Initialize (SMSG_READ_ITEM_OK, 8);
@@ -461,9 +461,9 @@ void WorldSession::HandleReadItem(WorldPacket & recv_data)
{
data.Initialize(SMSG_READ_ITEM_FAILED, 8);
sLog->outDetail("STORAGE: Unable to read item");
- _player->SendEquipError(msg, item, NULL);
+ _player->SendEquipError(msg, pItem, NULL);
}
- data << item->GetGUID();
+ data << pItem->GetGUID();
SendPacket(&data);
}
else
@@ -506,25 +506,25 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data)
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
- Item* item = _player->GetItemByGuid(itemguid);
- if (item)
+ Item* pItem = _player->GetItemByGuid(itemguid);
+ if (pItem)
{
// prevent sell not owner item
- if (_player->GetGUID() != item->GetOwnerGUID())
+ if (_player->GetGUID() != pItem->GetOwnerGUID())
{
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
return;
}
// prevent sell non empty bag by drag-and-drop at vendor's item list
- if (item->IsNotEmptyBag())
+ if (pItem->IsNotEmptyBag())
{
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
return;
}
// prevent sell currently looted item
- if (_player->GetLootGUID() == item->GetGUID())
+ if (_player->GetLootGUID() == pItem->GetGUID())
{
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
return;
@@ -533,44 +533,44 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data)
// prevent selling item for sellprice when the item is still refundable
// this probably happens when right clicking a refundable item, the client sends both
// CMSG_SELL_ITEM and CMSG_REFUND_ITEM (unverified)
- if (item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE))
+ if (pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE))
return; // Therefore, no feedback to client
// special case at auto sell (sell all)
if (count == 0)
{
- count = item->GetCount();
+ count = pItem->GetCount();
}
else
{
// prevent sell more items that exist in stack (possible only not from client)
- if (count > item->GetCount())
+ if (count > pItem->GetCount())
{
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
return;
}
}
- ItemTemplate const* pProto = item->GetTemplate();
+ ItemTemplate const* pProto = pItem->GetTemplate();
if (pProto)
{
if (pProto->SellPrice > 0)
{
- if (count < item->GetCount()) // need split items
+ if (count < pItem->GetCount()) // need split items
{
- Item* pNewItem = item->CloneItem(count, _player);
+ Item* pNewItem = pItem->CloneItem(count, _player);
if (!pNewItem)
{
- sLog->outError("WORLD: HandleSellItemOpcode - could not create clone of item %u; count = %u", item->GetEntry(), count);
+ sLog->outError("WORLD: HandleSellItemOpcode - could not create clone of item %u; count = %u", pItem->GetEntry(), count);
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
return;
}
- item->SetCount(item->GetCount() - count);
- _player->ItemRemovedQuestCheck(item->GetEntry(), count);
+ pItem->SetCount(pItem->GetCount() - count);
+ _player->ItemRemovedQuestCheck(pItem->GetEntry(), count);
if (_player->IsInWorld())
- item->SendUpdateToPlayer(_player);
- item->SetState(ITEM_CHANGED, _player);
+ pItem->SendUpdateToPlayer(_player);
+ pItem->SetState(ITEM_CHANGED, _player);
_player->AddItemToBuyBackSlot(pNewItem);
if (_player->IsInWorld())
@@ -578,10 +578,10 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data)
}
else
{
- _player->ItemRemovedQuestCheck(item->GetEntry(), item->GetCount());
- _player->RemoveItem(item->GetBagSlot(), item->GetSlot(), true);
- item->RemoveFromUpdateQueueOf(_player);
- _player->AddItemToBuyBackSlot(item);
+ _player->ItemRemovedQuestCheck(pItem->GetEntry(), pItem->GetCount());
+ _player->RemoveItem(pItem->GetBagSlot(), pItem->GetSlot(), true);
+ pItem->RemoveFromUpdateQueueOf(_player);
+ _player->AddItemToBuyBackSlot(pItem);
}
uint32 money = pProto->SellPrice * count;
@@ -617,28 +617,28 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
- Item* item = _player->GetItemFromBuyBackSlot(slot);
- if (item)
+ Item* pItem = _player->GetItemFromBuyBackSlot(slot);
+ if (pItem)
{
uint32 price = _player->GetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + slot - BUYBACK_SLOT_START);
if (!_player->HasEnoughMoney(price))
{
- _player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, item->GetEntry(), 0);
+ _player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, pItem->GetEntry(), 0);
return;
}
ItemPosCountVec dest;
- InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, item, false);
+ InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, pItem, false);
if (msg == EQUIP_ERR_OK)
{
_player->ModifyMoney(-(int32)price);
_player->RemoveItemFromBuyBackSlot(slot, false);
- _player->ItemAddedQuestCheck(item->GetEntry(), item->GetCount());
- _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, item->GetEntry(), item->GetCount());
- _player->StoreItem(dest, item, true);
+ _player->ItemAddedQuestCheck(pItem->GetEntry(), pItem->GetCount());
+ _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, pItem->GetEntry(), pItem->GetCount());
+ _player->StoreItem(dest, pItem, true);
}
else
- _player->SendEquipError(msg, item, NULL);
+ _player->SendEquipError(msg, pItem, NULL);
return;
}
else
@@ -815,8 +815,8 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recv_data)
recv_data >> srcbag >> srcslot >> dstbag;
//sLog->outDebug("STORAGE: receive srcbag = %u, srcslot = %u, dstbag = %u", srcbag, srcslot, dstbag);
- Item* item = _player->GetItemByPos(srcbag, srcslot);
- if (!item)
+ Item* pItem = _player->GetItemByPos(srcbag, srcslot);
+ if (!pItem)
return;
if (!_player->IsValidPos(dstbag, NULL_SLOT, false)) // can be autostore pos
@@ -825,7 +825,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recv_data)
return;
}
- uint16 src = item->GetPos();
+ uint16 src = pItem->GetPos();
// check unequip potability for equipped items and bank bags
if (_player->IsEquipmentPos (src) || _player->IsBagPos (src))
@@ -833,16 +833,16 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recv_data)
InventoryResult msg = _player->CanUnequipItem(src, !_player->IsBagPos (src));
if (msg != EQUIP_ERR_OK)
{
- _player->SendEquipError(msg, item, NULL);
+ _player->SendEquipError(msg, pItem, NULL);
return;
}
}
ItemPosCountVec dest;
- InventoryResult msg = _player->CanStoreItem(dstbag, NULL_SLOT, dest, item, false);
+ InventoryResult msg = _player->CanStoreItem(dstbag, NULL_SLOT, dest, pItem, false);
if (msg != EQUIP_ERR_OK)
{
- _player->SendEquipError(msg, item, NULL);
+ _player->SendEquipError(msg, pItem, NULL);
return;
}
@@ -850,12 +850,12 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recv_data)
if (dest.size() == 1 && dest[0].pos == src)
{
// just remove grey item state
- _player->SendEquipError(EQUIP_ERR_NONE, item, NULL);
+ _player->SendEquipError(EQUIP_ERR_NONE, pItem, NULL);
return;
}
_player->RemoveItem(srcbag, srcslot, true);
- _player->StoreItem(dest, item, true);
+ _player->StoreItem(dest, pItem, true);
}
void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
@@ -919,27 +919,27 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket)
recvPacket >> srcbag >> srcslot;
sLog->outDebug(LOG_FILTER_NETWORKIO, "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot);
- Item* item = _player->GetItemByPos(srcbag, srcslot);
- if (!item)
+ Item* pItem = _player->GetItemByPos(srcbag, srcslot);
+ if (!pItem)
return;
ItemPosCountVec dest;
- InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, item, false);
+ InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, pItem, false);
if (msg != EQUIP_ERR_OK)
{
- _player->SendEquipError(msg, item, NULL);
+ _player->SendEquipError(msg, pItem, NULL);
return;
}
- if (dest.size() == 1 && dest[0].pos == item->GetPos())
+ if (dest.size() == 1 && dest[0].pos == pItem->GetPos())
{
- _player->SendEquipError(EQUIP_ERR_NONE, item, NULL);
+ _player->SendEquipError(EQUIP_ERR_NONE, pItem, NULL);
return;
}
_player->RemoveItem(srcbag, srcslot, true);
- _player->ItemRemovedQuestCheck(item->GetEntry(), item->GetCount());
- _player->BankItem(dest, item, true);
+ _player->ItemRemovedQuestCheck(pItem->GetEntry(), pItem->GetCount());
+ _player->BankItem(dest, pItem, true);
}
void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
@@ -950,36 +950,36 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
recvPacket >> srcbag >> srcslot;
sLog->outDebug(LOG_FILTER_NETWORKIO, "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot);
- Item* item = _player->GetItemByPos(srcbag, srcslot);
- if (!item)
+ Item* pItem = _player->GetItemByPos(srcbag, srcslot);
+ if (!pItem)
return;
if (_player->IsBankPos(srcbag, srcslot)) // moving from bank to inventory
{
ItemPosCountVec dest;
- InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, item, false);
+ InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, pItem, false);
if (msg != EQUIP_ERR_OK)
{
- _player->SendEquipError(msg, item, NULL);
+ _player->SendEquipError(msg, pItem, NULL);
return;
}
_player->RemoveItem(srcbag, srcslot, true);
- _player->StoreItem(dest, item, true);
- _player->ItemAddedQuestCheck(item->GetEntry(), item->GetCount());
+ _player->StoreItem(dest, pItem, true);
+ _player->ItemAddedQuestCheck(pItem->GetEntry(), pItem->GetCount());
}
else // moving from inventory to bank
{
ItemPosCountVec dest;
- InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, item, false);
+ InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, pItem, false);
if (msg != EQUIP_ERR_OK)
{
- _player->SendEquipError(msg, item, NULL);
+ _player->SendEquipError(msg, pItem, NULL);
return;
}
_player->RemoveItem(srcbag, srcslot, true);
- _player->BankItem(dest, item, true);
+ _player->BankItem(dest, pItem, true);
}
}