aboutsummaryrefslogtreecommitdiff
path: root/src/game/ItemHandler.cpp
diff options
context:
space:
mode:
authorSpp <none@none>2010-04-07 19:14:10 +0200
committerSpp <none@none>2010-04-07 19:14:10 +0200
commitd19e12708001fbef2308be0e8cb5375a2ac7af48 (patch)
tree09fc8f67a6197802e0512950f0b0a3438a9834e8 /src/game/ItemHandler.cpp
parent2e127f7a30706dc1d40c65de22ff02851732da24 (diff)
Code style (game + scripts only):
"if(" --> "if (" --HG-- branch : trunk
Diffstat (limited to 'src/game/ItemHandler.cpp')
-rw-r--r--src/game/ItemHandler.cpp228
1 files changed, 114 insertions, 114 deletions
diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp
index 8d7b06227c3..d323f84d016 100644
--- a/src/game/ItemHandler.cpp
+++ b/src/game/ItemHandler.cpp
@@ -41,19 +41,19 @@ void WorldSession::HandleSplitItemOpcode( WorldPacket & recv_data )
uint16 src = ( (srcbag << 8) | srcslot );
uint16 dst = ( (dstbag << 8) | dstslot );
- if(src==dst)
+ if (src==dst)
return;
if (count==0)
return; //check count - if zero it's fake packet
- if(!_player->IsValidPos(srcbag,srcslot))
+ if (!_player->IsValidPos(srcbag,srcslot))
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
return;
}
- if(!_player->IsValidPos(dstbag,dstslot))
+ if (!_player->IsValidPos(dstbag,dstslot))
{
_player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL );
return;
@@ -71,16 +71,16 @@ void WorldSession::HandleSwapInvItemOpcode( WorldPacket & recv_data )
//sLog.outDebug("STORAGE: receive srcslot = %u, dstslot = %u", srcslot, dstslot);
// prevent attempt swap same item to current position generated by client at special checting sequence
- if(srcslot==dstslot)
+ if (srcslot==dstslot)
return;
- if(!_player->IsValidPos(INVENTORY_SLOT_BAG_0,srcslot))
+ if (!_player->IsValidPos(INVENTORY_SLOT_BAG_0,srcslot))
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
return;
}
- if(!_player->IsValidPos(INVENTORY_SLOT_BAG_0,dstslot))
+ if (!_player->IsValidPos(INVENTORY_SLOT_BAG_0,dstslot))
{
_player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL );
return;
@@ -99,13 +99,13 @@ void WorldSession::HandleAutoEquipItemSlotOpcode( WorldPacket & recv_data )
recv_data >> itemguid >> dstslot;
// cheating attempt, client should never send opcode in that case
- if(!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0, dstslot))
+ if (!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0, dstslot))
return;
Item* item = _player->GetItemByGuid(itemguid);
uint16 dstpos = dstslot | (INVENTORY_SLOT_BAG_0 << 8);
- if(!item || item->GetPos() == dstpos)
+ if (!item || item->GetPos() == dstpos)
return;
_player->SwapItem(item->GetPos(), dstpos);
@@ -123,16 +123,16 @@ void WorldSession::HandleSwapItem( WorldPacket & recv_data )
uint16 dst = ( (dstbag << 8) | dstslot );
// prevent attempt swap same item to current position generated by client at special checting sequence
- if(src==dst)
+ if (src==dst)
return;
- if(!_player->IsValidPos(srcbag,srcslot))
+ if (!_player->IsValidPos(srcbag,srcslot))
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
return;
}
- if(!_player->IsValidPos(dstbag,dstslot))
+ if (!_player->IsValidPos(dstbag,dstslot))
{
_player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL );
return;
@@ -150,10 +150,10 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
//sLog.outDebug("STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot);
Item *pSrcItem = _player->GetItemByPos( srcbag, srcslot );
- if( !pSrcItem )
+ if ( !pSrcItem )
return; // only at cheat
- if(pSrcItem->m_lootGenerated) // prevent swap looting item
+ if (pSrcItem->m_lootGenerated) // prevent swap looting item
{
//best error message found for attempting to swap while looting
_player->SendEquipError( EQUIP_ERR_CANT_DO_RIGHT_NOW, pSrcItem, NULL );
@@ -162,18 +162,18 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
uint16 dest;
uint8 msg = _player->CanEquipItem( NULL_SLOT, dest, pSrcItem, !pSrcItem->IsBag() );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pSrcItem, NULL );
return;
}
uint16 src = pSrcItem->GetPos();
- if(dest==src) // prevent equip in same slot, only at cheat
+ if (dest==src) // prevent equip in same slot, only at cheat
return;
Item *pDstItem = _player->GetItemByPos( dest );
- if( !pDstItem ) // empty slot, simple case
+ if ( !pDstItem ) // empty slot, simple case
{
_player->RemoveItem( srcbag, srcslot, true );
_player->EquipItem( dest, pSrcItem, true );
@@ -185,7 +185,7 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
uint8 dstslot = pDstItem->GetSlot();
msg = _player->CanUnequipItem( dest, !pSrcItem->IsBag() );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pDstItem, NULL );
return;
@@ -194,30 +194,30 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
// check dest->src move possibility
ItemPosCountVec sSrc;
uint16 eSrc = 0;
- if( _player->IsInventoryPos( src ) )
+ if ( _player->IsInventoryPos( src ) )
{
msg = _player->CanStoreItem( srcbag, srcslot, sSrc, pDstItem, true );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
msg = _player->CanStoreItem( srcbag, NULL_SLOT, sSrc, pDstItem, true );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, sSrc, pDstItem, true );
}
- else if( _player->IsBankPos( src ) )
+ else if ( _player->IsBankPos( src ) )
{
msg = _player->CanBankItem( srcbag, srcslot, sSrc, pDstItem, true );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
msg = _player->CanBankItem( srcbag, NULL_SLOT, sSrc, pDstItem, true );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
msg = _player->CanBankItem( NULL_BAG, NULL_SLOT, sSrc, pDstItem, true );
}
- else if( _player->IsEquipmentPos( src ) )
+ else if ( _player->IsEquipmentPos( src ) )
{
msg = _player->CanEquipItem( srcslot, eSrc, pDstItem, true);
- if( msg == EQUIP_ERR_OK )
+ if ( msg == EQUIP_ERR_OK )
msg = _player->CanUnequipItem( eSrc, true);
}
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pDstItem, pSrcItem );
return;
@@ -231,11 +231,11 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
_player->EquipItem(dest, pSrcItem, true);
// add to src
- if( _player->IsInventoryPos( src ) )
+ if ( _player->IsInventoryPos( src ) )
_player->StoreItem(sSrc, pDstItem, true);
- else if( _player->IsBankPos( src ) )
+ else if ( _player->IsBankPos( src ) )
_player->BankItem(sSrc, pDstItem, true);
- else if( _player->IsEquipmentPos( src ) )
+ else if ( _player->IsEquipmentPos( src ) )
_player->EquipItem(eSrc, pDstItem, true);
_player->AutoUnequipOffhandIfNeed();
@@ -253,10 +253,10 @@ void WorldSession::HandleDestroyItemOpcode( WorldPacket & recv_data )
uint16 pos = (bag << 8) | slot;
// prevent drop unequipable items (in combat, for example) and non-empty bags
- if(_player->IsEquipmentPos(pos) || _player->IsBagPos(pos))
+ if (_player->IsEquipmentPos(pos) || _player->IsBagPos(pos))
{
uint8 msg = _player->CanUnequipItem( pos, false );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, _player->GetItemByPos(pos), NULL );
return;
@@ -264,13 +264,13 @@ void WorldSession::HandleDestroyItemOpcode( WorldPacket & recv_data )
}
Item *pItem = _player->GetItemByPos( bag, slot );
- if(!pItem)
+ if (!pItem)
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
return;
}
- if(count)
+ if (count)
{
uint32 i_count = count;
_player->DestroyItemCount( pItem, i_count, true );
@@ -289,7 +289,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data )
sLog.outDetail("STORAGE: Item Query = %u", item);
ItemPrototype const *pProto = objmgr.GetItemPrototype( item );
- if( pProto )
+ if ( pProto )
{
std::string Name = pProto->Name1;
std::string Description = pProto->Description;
@@ -370,7 +370,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data )
// send DBC data for cooldowns in same way as it used in Spell::SendSpellCooldown
// use `item_template` or if not set then only use spell cooldowns
SpellEntry const* spell = sSpellStore.LookupEntry(pProto->Spells[s].SpellId);
- if(spell)
+ if (spell)
{
bool db_data = pProto->Spells[s].SpellCooldown >= 0 || pProto->Spells[s].SpellCategoryCooldown >= 0;
@@ -378,7 +378,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data )
data << pProto->Spells[s].SpellTrigger;
data << uint32(-abs(pProto->Spells[s].SpellCharges));
- if(db_data)
+ if (db_data)
{
data << uint32(pProto->Spells[s].SpellCooldown);
data << uint32(pProto->Spells[s].SpellCategory);
@@ -452,12 +452,12 @@ void WorldSession::HandleReadItem( WorldPacket & recv_data )
//sLog.outDetail("STORAGE: Read bag = %u, slot = %u", bag, slot);
Item *pItem = _player->GetItemByPos( bag, slot );
- if( pItem && pItem->GetProto()->PageText )
+ if ( pItem && pItem->GetProto()->PageText )
{
WorldPacket data;
uint8 msg = _player->CanUseItem( pItem );
- if( msg == EQUIP_ERR_OK )
+ if ( msg == EQUIP_ERR_OK )
{
data.Initialize (SMSG_READ_ITEM_OK, 8);
sLog.outDetail("STORAGE: Item page sent");
@@ -496,7 +496,7 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
recv_data >> vendorguid >> itemguid >> count;
- if(!itemguid)
+ if (!itemguid)
return;
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid,UNIT_NPC_FLAG_VENDOR);
@@ -508,42 +508,42 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Item *pItem = _player->GetItemByGuid( itemguid );
- if( pItem )
+ if ( pItem )
{
// prevent sell not owner item
- if(_player->GetGUID()!=pItem->GetOwnerGUID())
+ if (_player->GetGUID()!=pItem->GetOwnerGUID())
{
_player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
return;
}
// prevent sell non empty bag by drag-and-drop at vendor's item list
- if(pItem->IsBag() && !((Bag*)pItem)->IsEmpty())
+ if (pItem->IsBag() && !((Bag*)pItem)->IsEmpty())
{
_player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
return;
}
// prevent sell currently looted item
- if(_player->GetLootGUID()==pItem->GetGUID())
+ if (_player->GetLootGUID()==pItem->GetGUID())
{
_player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
return;
}
// special case at auto sell (sell all)
- if(count==0)
+ if (count==0)
{
count = pItem->GetCount();
}
else
{
// prevent sell more items that exist in stack (possible only not from client)
- if(count > pItem->GetCount())
+ if (count > pItem->GetCount())
{
_player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
return;
@@ -551,11 +551,11 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
}
ItemPrototype const *pProto = pItem->GetProto();
- if( pProto )
+ if ( pProto )
{
- if( pProto->SellPrice > 0 )
+ if ( pProto->SellPrice > 0 )
{
- if(count < pItem->GetCount()) // need split items
+ if (count < pItem->GetCount()) // need split items
{
Item *pNewItem = pItem->CloneItem( count, _player );
if (!pNewItem)
@@ -567,12 +567,12 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
pItem->SetCount( pItem->GetCount() - count );
_player->ItemRemovedQuestCheck( pItem->GetEntry(), count );
- if( _player->IsInWorld() )
+ if ( _player->IsInWorld() )
pItem->SendUpdateToPlayer( _player );
pItem->SetState(ITEM_CHANGED, _player);
_player->AddItemToBuyBackSlot( pNewItem );
- if( _player->IsInWorld() )
+ if ( _player->IsInWorld() )
pNewItem->SendUpdateToPlayer( _player );
}
else
@@ -611,14 +611,14 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Item *pItem = _player->GetItemFromBuyBackSlot( slot );
- if( pItem )
+ if ( pItem )
{
uint32 price = _player->GetUInt32Value( PLAYER_FIELD_BUYBACK_PRICE_1 + slot - BUYBACK_SLOT_START );
- if( _player->GetMoney() < price )
+ if ( _player->GetMoney() < price )
{
_player->SendBuyError( BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, pItem->GetEntry(), 0);
return;
@@ -626,7 +626,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
ItemPosCountVec dest;
uint8 msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
- if( msg == EQUIP_ERR_OK )
+ if ( msg == EQUIP_ERR_OK )
{
_player->ModifyMoney( -(int32)price );
_player->RemoveItemFromBuyBackSlot( slot, false );
@@ -695,7 +695,7 @@ void WorldSession::HandleListInventoryOpcode( WorldPacket & recv_data )
recv_data >> guid;
- if(!GetPlayer()->isAlive())
+ if (!GetPlayer()->isAlive())
return;
sLog.outDebug( "WORLD: Recvd CMSG_LIST_INVENTORY" );
@@ -716,14 +716,14 @@ void WorldSession::SendListInventory( uint64 vendorguid )
}
// remove fake death
- if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
+ if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// Stop the npc if moving
pCreature->StopMoving();
VendorItemData const* vItems = pCreature->GetVendorItems();
- if(!vItems)
+ if (!vItems)
{
_player->SendSellError( SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0);
return;
@@ -740,11 +740,11 @@ void WorldSession::SendListInventory( uint64 vendorguid )
for (int i = 0; i < numitems; ++i )
{
- if(VendorItem const* crItem = vItems->GetItem(i))
+ if (VendorItem const* crItem = vItems->GetItem(i))
{
- if(ItemPrototype const *pProto = objmgr.GetItemPrototype(crItem->item))
+ if (ItemPrototype const *pProto = objmgr.GetItemPrototype(crItem->item))
{
- if((pProto->AllowableClass & _player->getClassMask()) == 0 && pProto->Bonding == BIND_WHEN_PICKED_UP && !_player->isGameMaster())
+ if ((pProto->AllowableClass & _player->getClassMask()) == 0 && pProto->Bonding == BIND_WHEN_PICKED_UP && !_player->isGameMaster())
continue;
// Only display items in vendor lists for the team the
// player is on. If GM on, display all items.
@@ -786,10 +786,10 @@ void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data )
//sLog.outDebug("STORAGE: receive srcbag = %u, srcslot = %u, dstbag = %u", srcbag, srcslot, dstbag);
Item *pItem = _player->GetItemByPos( srcbag, srcslot );
- if( !pItem )
+ if ( !pItem )
return;
- if(!_player->IsValidPos(dstbag,NULL_SLOT))
+ if (!_player->IsValidPos(dstbag,NULL_SLOT))
{
_player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL );
return;
@@ -798,10 +798,10 @@ void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data )
uint16 src = pItem->GetPos();
// check unequip potability for equipped items and bank bags
- if(_player->IsEquipmentPos ( src ) || _player->IsBagPos ( src ))
+ if (_player->IsEquipmentPos ( src ) || _player->IsBagPos ( src ))
{
uint8 msg = _player->CanUnequipItem( src, !_player->IsBagPos ( src ));
- if(msg != EQUIP_ERR_OK)
+ if (msg != EQUIP_ERR_OK)
{
_player->SendEquipError( msg, pItem, NULL );
return;
@@ -810,14 +810,14 @@ void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data )
ItemPosCountVec dest;
uint8 msg = _player->CanStoreItem( dstbag, NULL_SLOT, dest, pItem, false );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pItem, NULL );
return;
}
// no-op: placed in same slot
- if(dest.size()==1 && dest[0].pos==src)
+ if (dest.size()==1 && dest[0].pos==src)
{
// just remove grey item state
_player->SendEquipError( EQUIP_ERR_NONE, pItem, NULL );
@@ -838,7 +838,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
// cheating protection
/* not critical if "cheated", and check skip allow by slots in bank windows open by .bank command.
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER);
- if(!pCreature)
+ if (!pCreature)
{
sLog.outDebug( "WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
return;
@@ -854,7 +854,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
BankBagSlotPricesEntry const* slotEntry = sBankBagSlotPricesStore.LookupEntry(slot);
- if(!slotEntry)
+ if (!slotEntry)
return;
uint32 price = slotEntry->price;
@@ -877,12 +877,12 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket)
sLog.outDebug("STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot);
Item *pItem = _player->GetItemByPos( srcbag, srcslot );
- if( !pItem )
+ if ( !pItem )
return;
ItemPosCountVec dest;
uint8 msg = _player->CanBankItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pItem, NULL );
return;
@@ -901,14 +901,14 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
sLog.outDebug("STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot);
Item *pItem = _player->GetItemByPos( srcbag, srcslot );
- if( !pItem )
+ if ( !pItem )
return;
- if(_player->IsBankPos(srcbag, srcslot)) // moving from bank to inventory
+ if (_player->IsBankPos(srcbag, srcslot)) // moving from bank to inventory
{
ItemPosCountVec dest;
uint8 msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pItem, NULL );
return;
@@ -921,7 +921,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
{
ItemPosCountVec dest;
uint8 msg = _player->CanBankItem( NULL_BAG, NULL_SLOT, dest, pItem, false );
- if( msg != EQUIP_ERR_OK )
+ if ( msg != EQUIP_ERR_OK )
{
_player->SendEquipError( msg, pItem, NULL );
return;
@@ -934,7 +934,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data)
{
- if(!GetPlayer()->isAlive())
+ if (!GetPlayer()->isAlive())
{
GetPlayer()->SendEquipError( EQUIP_ERR_YOU_ARE_DEAD, NULL, NULL );
return;
@@ -945,7 +945,7 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data)
recv_data >> item;
- if(!item)
+ if (!item)
GetPlayer()->RemoveAmmo();
else
GetPlayer()->SetAmmo(item);
@@ -981,7 +981,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data)
sLog.outDebug("WORLD: CMSG_ITEM_NAME_QUERY %u", itemid);
ItemPrototype const *pProto = objmgr.GetItemPrototype( itemid );
- if( pProto )
+ if ( pProto )
{
std::string Name;
Name = pProto->Name1;
@@ -1009,7 +1009,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data)
/* else
{
// listed in dbc or not expected to exist unknown item
- if(sItemStore.LookupEntry(itemid))
+ if (sItemStore.LookupEntry(itemid))
sLog.outErrorDb("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (item listed in Item.dbc but not exist in DB)", itemid);
else
sLog.outError("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (unknown item, not listed in Item.dbc)", itemid);
@@ -1029,13 +1029,13 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
sLog.outDebug("WRAP: receive gift_bag = %u, gift_slot = %u, item_bag = %u, item_slot = %u", gift_bag, gift_slot, item_bag, item_slot);
Item *gift = _player->GetItemByPos( gift_bag, gift_slot );
- if(!gift)
+ if (!gift)
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, gift, NULL );
return;
}
- if(!gift->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPER))// cheating: non-wrapper wrapper
+ if (!gift->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPER))// cheating: non-wrapper wrapper
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, gift, NULL );
return;
@@ -1043,50 +1043,50 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
Item *item = _player->GetItemByPos( item_bag, item_slot );
- if( !item )
+ if ( !item )
{
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, item, NULL );
return;
}
- if(item==gift) // not possable with pacjket from real client
+ if (item==gift) // not possable with pacjket from real client
{
_player->SendEquipError( EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL );
return;
}
- if(item->IsEquipped())
+ if (item->IsEquipped())
{
_player->SendEquipError( EQUIP_ERR_EQUIPPED_CANT_BE_WRAPPED, item, NULL );
return;
}
- if(item->GetUInt64Value(ITEM_FIELD_GIFTCREATOR)) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
+ if (item->GetUInt64Value(ITEM_FIELD_GIFTCREATOR)) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
{
_player->SendEquipError( EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL );
return;
}
- if(item->IsBag())
+ if (item->IsBag())
{
_player->SendEquipError( EQUIP_ERR_BAGS_CANT_BE_WRAPPED, item, NULL );
return;
}
- if(item->IsSoulBound())
+ if (item->IsSoulBound())
{
_player->SendEquipError( EQUIP_ERR_BOUND_CANT_BE_WRAPPED, item, NULL );
return;
}
- if(item->GetMaxStackCount() != 1)
+ if (item->GetMaxStackCount() != 1)
{
_player->SendEquipError( EQUIP_ERR_STACKABLE_CANT_BE_WRAPPED, item, NULL );
return;
}
// maybe not correct check (it is better than nothing)
- if(item->GetProto()->MaxCount>0)
+ if (item->GetProto()->MaxCount>0)
{
_player->SendEquipError( EQUIP_ERR_UNIQUE_CANT_BE_WRAPPED, item, NULL );
return;
@@ -1109,7 +1109,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
item->SetUInt32Value(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
item->SetState(ITEM_CHANGED, _player);
- if(item->GetState()==ITEM_NEW) // save new item, to have alway for `character_gifts` record in `item_instance`
+ if (item->GetState()==ITEM_NEW) // save new item, to have alway for `character_gifts` record in `item_instance`
{
// after save it will be impossible to remove the item from the queue
item->RemoveFromUpdateQueueOf(_player);
@@ -1129,7 +1129,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
uint64 gem_guids[MAX_GEM_SOCKETS];
recv_data >> item_guid;
- if(!item_guid)
+ if (!item_guid)
return;
for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
@@ -1141,11 +1141,11 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
return;
Item *itemTarget = _player->GetItemByGuid(item_guid);
- if(!itemTarget) //missing item to socket
+ if (!itemTarget) //missing item to socket
return;
ItemPrototype const* itemProto = itemTarget->GetProto();
- if(!itemProto)
+ if (!itemProto)
return;
//this slot is excepted when applying / removing meta gem bonus
@@ -1168,11 +1168,11 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
if (!itemProto->Socket[i].Color)
{
// no prismatic socket
- if(!itemTarget->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT))
+ if (!itemTarget->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT))
return;
// not first not-colored (not normaly used) socket
- if(i!=0 && !itemProto->Socket[i-1].Color && (i+1 >= MAX_GEM_SOCKETS || itemProto->Socket[i+1].Color))
+ if (i!=0 && !itemProto->Socket[i-1].Color && (i+1 >= MAX_GEM_SOCKETS || itemProto->Socket[i+1].Color))
return;
// ok, this is first not colored socket for item with prismatic socket
@@ -1198,7 +1198,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
// check unique-equipped conditions
for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
{
- if(!Gems[i])
+ if (!Gems[i])
continue;
// continue check for case when attempt add 2 similar unique equipped gems in one item.
@@ -1209,7 +1209,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
{
for (int j = 0; j < MAX_GEM_SOCKETS; ++j)
{
- if(i==j) // skip self
+ if (i==j) // skip self
continue;
if (Gems[j])
@@ -1220,9 +1220,9 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
return;
}
}
- else if(OldEnchants[j])
+ else if (OldEnchants[j])
{
- if(SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
+ if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
{
if (iGemProto->ItemId == enchantEntry->GemID)
{
@@ -1239,7 +1239,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
int32 limit_newcount = 0;
if (iGemProto->ItemLimitCategory)
{
- if(ItemLimitCategoryEntry const* limitEntry = sItemLimitCategoryStore.LookupEntry(iGemProto->ItemLimitCategory))
+ if (ItemLimitCategoryEntry const* limitEntry = sItemLimitCategoryStore.LookupEntry(iGemProto->ItemLimitCategory))
{
for (int j = 0; j < MAX_GEM_SOCKETS; ++j)
{
@@ -1248,8 +1248,8 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
// destroyed gem
if (OldEnchants[j])
{
- if(SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
- if(ItemPrototype const* jProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID))
+ if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
+ if (ItemPrototype const* jProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID))
if (iGemProto->ItemLimitCategory == jProto->ItemLimitCategory)
--limit_newcount;
}
@@ -1259,16 +1259,16 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
++limit_newcount;
}
// existed gem
- else if(OldEnchants[j])
+ else if (OldEnchants[j])
{
- if(SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
- if(ItemPrototype const* jProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID))
+ if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
+ if (ItemPrototype const* jProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID))
if (iGemProto->ItemLimitCategory == jProto->ItemLimitCategory)
++limit_newcount;
}
}
- if(limit_newcount > 0 && uint32(limit_newcount) > limitEntry->maxCount)
+ if (limit_newcount > 0 && uint32(limit_newcount) > limitEntry->maxCount)
{
_player->SendEquipError( EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED, itemTarget, NULL );
return;
@@ -1277,9 +1277,9 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
}
// for equipped item check all equipment for duplicate equipped gems
- if(itemTarget->IsEquipped())
+ if (itemTarget->IsEquipped())
{
- if(uint8 res = _player->CanEquipUniqueItem(Gems[i],slot,limit_newcount >= 0 ? limit_newcount : 0))
+ if (uint8 res = _player->CanEquipUniqueItem(Gems[i],slot,limit_newcount >= 0 ? limit_newcount : 0))
{
_player->SendEquipError( res, itemTarget, NULL );
return;
@@ -1298,10 +1298,10 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
{
- if(GemEnchants[i])
+ if (GemEnchants[i])
{
itemTarget->SetEnchantment(EnchantmentSlot(SOCK_ENCHANTMENT_SLOT+i), GemEnchants[i],0,0);
- if(Item* guidItem = _player->GetItemByGuid(gem_guids[i]))
+ if (Item* guidItem = _player->GetItemByGuid(gem_guids[i]))
_player->DestroyItem(guidItem->GetBagSlot(), guidItem->GetSlot(), true );
}
}
@@ -1310,7 +1310,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
_player->ApplyEnchantment(itemTarget,EnchantmentSlot(enchant_slot),true);
bool SocketBonusToBeActivated = itemTarget->GemsFitSockets();//current socketbonus state
- if(SocketBonusActivated ^ SocketBonusToBeActivated) //if there was a change...
+ if (SocketBonusActivated ^ SocketBonusToBeActivated) //if there was a change...
{
_player->ApplyEnchantment(itemTarget,BONUS_ENCHANTMENT_SLOT,false);
itemTarget->SetEnchantment(BONUS_ENCHANTMENT_SLOT, (SocketBonusToBeActivated ? itemTarget->GetProto()->socketBonus : 0), 0, 0);
@@ -1330,15 +1330,15 @@ void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recv_data)
recv_data >> eslot;
// apply only to equipped item
- if(!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0,eslot))
+ if (!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0,eslot))
return;
Item* item = GetPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, eslot);
- if(!item)
+ if (!item)
return;
- if(!item->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
+ if (!item->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
return;
GetPlayer()->ApplyEnchantment(item,TEMP_ENCHANTMENT_SLOT,false);