/played command should work once again.

This commit is contained in:
tomrus88 2009-07-22 01:24:22 +04:00
parent 09907c8e61
commit a26e90019b
2 changed files with 77 additions and 77 deletions

View file

@ -29,7 +29,7 @@
void WorldSession::HandleSplitItemOpcode( WorldPacket & recv_data ) void WorldSession::HandleSplitItemOpcode( WorldPacket & recv_data )
{ {
CHECK_PACKET_SIZE(recv_data,1+1+1+1+1); CHECK_PACKET_SIZE(recv_data, 1+1+1+1+1);
//sLog.outDebug("WORLD: CMSG_SPLIT_ITEM"); //sLog.outDebug("WORLD: CMSG_SPLIT_ITEM");
uint8 srcbag, srcslot, dstbag, dstslot, count; uint8 srcbag, srcslot, dstbag, dstslot, count;
@ -40,19 +40,19 @@ void WorldSession::HandleSplitItemOpcode( WorldPacket & recv_data )
uint16 src = ( (srcbag << 8) | srcslot ); uint16 src = ( (srcbag << 8) | srcslot );
uint16 dst = ( (dstbag << 8) | dstslot ); uint16 dst = ( (dstbag << 8) | dstslot );
if(src==dst) if(src == dst)
return; return;
if (count==0) if (count == 0)
return; //check count - if zero it's fake packet 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 ); _player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
return; return;
} }
if(!_player->IsValidPos(dstbag,dstslot)) if(!_player->IsValidPos(dstbag, dstslot))
{ {
_player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL ); _player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL );
return; return;
@ -63,7 +63,7 @@ void WorldSession::HandleSplitItemOpcode( WorldPacket & recv_data )
void WorldSession::HandleSwapInvItemOpcode( WorldPacket & recv_data ) void WorldSession::HandleSwapInvItemOpcode( WorldPacket & recv_data )
{ {
CHECK_PACKET_SIZE(recv_data,1+1); CHECK_PACKET_SIZE(recv_data, 1+1);
//sLog.outDebug("WORLD: CMSG_SWAP_INV_ITEM"); //sLog.outDebug("WORLD: CMSG_SWAP_INV_ITEM");
uint8 srcslot, dstslot; uint8 srcslot, dstslot;
@ -71,11 +71,11 @@ void WorldSession::HandleSwapInvItemOpcode( WorldPacket & recv_data )
recv_data >> dstslot >> srcslot; recv_data >> dstslot >> srcslot;
//sLog.outDebug("STORAGE: receive srcslot = %u, dstslot = %u", srcslot, dstslot); //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 // prevent attempt swap same item to current position generated by client at special cheating sequence
if(srcslot==dstslot) if(srcslot == dstslot)
return; 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 ); _player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
return; return;
@ -95,7 +95,7 @@ void WorldSession::HandleSwapInvItemOpcode( WorldPacket & recv_data )
void WorldSession::HandleAutoEquipItemSlotOpcode( WorldPacket & recv_data ) void WorldSession::HandleAutoEquipItemSlotOpcode( WorldPacket & recv_data )
{ {
CHECK_PACKET_SIZE(recv_data,8+1); CHECK_PACKET_SIZE(recv_data, 8+1);
uint64 itemguid; uint64 itemguid;
uint8 dstslot; uint8 dstslot;
recv_data >> itemguid >> dstslot; recv_data >> itemguid >> dstslot;
@ -115,7 +115,7 @@ void WorldSession::HandleAutoEquipItemSlotOpcode( WorldPacket & recv_data )
void WorldSession::HandleSwapItem( WorldPacket & recv_data ) void WorldSession::HandleSwapItem( WorldPacket & recv_data )
{ {
CHECK_PACKET_SIZE(recv_data,1+1+1+1); CHECK_PACKET_SIZE(recv_data, 1+1+1+1);
//sLog.outDebug("WORLD: CMSG_SWAP_ITEM"); //sLog.outDebug("WORLD: CMSG_SWAP_ITEM");
uint8 dstbag, dstslot, srcbag, srcslot; uint8 dstbag, dstslot, srcbag, srcslot;
@ -126,17 +126,17 @@ void WorldSession::HandleSwapItem( WorldPacket & recv_data )
uint16 src = ( (srcbag << 8) | srcslot ); uint16 src = ( (srcbag << 8) | srcslot );
uint16 dst = ( (dstbag << 8) | dstslot ); uint16 dst = ( (dstbag << 8) | dstslot );
// prevent attempt swap same item to current position generated by client at special checting sequence // prevent attempt swap same item to current position generated by client at special cheating sequence
if(src==dst) if(src == dst)
return; return;
if(!_player->IsValidPos(srcbag,srcslot)) if(!_player->IsValidPos(srcbag, srcslot))
{ {
_player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); _player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );
return; return;
} }
if(!_player->IsValidPos(dstbag,dstslot)) if(!_player->IsValidPos(dstbag, dstslot))
{ {
_player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL ); _player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL );
return; return;
@ -147,7 +147,7 @@ void WorldSession::HandleSwapItem( WorldPacket & recv_data )
void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data ) void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
{ {
CHECK_PACKET_SIZE(recv_data,1+1); CHECK_PACKET_SIZE(recv_data, 1+1);
//sLog.outDebug("WORLD: CMSG_AUTOEQUIP_ITEM"); //sLog.outDebug("WORLD: CMSG_AUTOEQUIP_ITEM");
uint8 srcbag, srcslot; uint8 srcbag, srcslot;
@ -175,7 +175,7 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
} }
uint16 src = pSrcItem->GetPos(); 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; return;
Item *pDstItem = _player->GetItemByPos( dest ); Item *pDstItem = _player->GetItemByPos( dest );
@ -250,7 +250,7 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
void WorldSession::HandleDestroyItemOpcode( WorldPacket & recv_data ) void WorldSession::HandleDestroyItemOpcode( WorldPacket & recv_data )
{ {
CHECK_PACKET_SIZE(recv_data,1+1+1+1+1+1); CHECK_PACKET_SIZE(recv_data, 1+1+1+1+1+1);
//sLog.outDebug("WORLD: CMSG_DESTROYITEM"); //sLog.outDebug("WORLD: CMSG_DESTROYITEM");
uint8 bag, slot, count, data1, data2, data3; uint8 bag, slot, count, data1, data2, data3;
@ -445,7 +445,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data )
} }
else else
{ {
sLog.outDebug( "WORLD: CMSG_ITEM_QUERY_SINGLE - NO item INFO! (ENTRY: %u)", item ); sLog.outDebug( "WORLD: CMSG_ITEM_QUERY_SINGLE - NO item INFO! (ENTRY: %u)", item );
WorldPacket data( SMSG_ITEM_QUERY_SINGLE_RESPONSE, 4); WorldPacket data( SMSG_ITEM_QUERY_SINGLE_RESPONSE, 4);
data << uint32(item | 0x80000000); data << uint32(item | 0x80000000);
SendPacket( &data ); SendPacket( &data );
@ -454,7 +454,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data )
void WorldSession::HandleReadItem( WorldPacket & recv_data ) void WorldSession::HandleReadItem( WorldPacket & recv_data )
{ {
CHECK_PACKET_SIZE(recv_data,1+1); CHECK_PACKET_SIZE(recv_data, 1+1);
//sLog.outDebug( "WORLD: CMSG_READ_ITEM"); //sLog.outDebug( "WORLD: CMSG_READ_ITEM");
@ -489,9 +489,9 @@ void WorldSession::HandleReadItem( WorldPacket & recv_data )
void WorldSession::HandlePageQuerySkippedOpcode( WorldPacket & recv_data ) void WorldSession::HandlePageQuerySkippedOpcode( WorldPacket & recv_data )
{ {
CHECK_PACKET_SIZE(recv_data,4+8); CHECK_PACKET_SIZE(recv_data, 4+8);
sLog.outDebug( "WORLD: Received CMSG_PAGE_TEXT_QUERY" ); sLog.outDebug( "WORLD: Received CMSG_PAGE_TEXT_QUERY" );
uint32 itemid; uint32 itemid;
uint64 guid; uint64 guid;
@ -504,7 +504,7 @@ void WorldSession::HandlePageQuerySkippedOpcode( WorldPacket & recv_data )
void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data ) void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
{ {
CHECK_PACKET_SIZE(recv_data,8+8+1); CHECK_PACKET_SIZE(recv_data, 8+8+1);
sLog.outDebug( "WORLD: Received CMSG_SELL_ITEM" ); sLog.outDebug( "WORLD: Received CMSG_SELL_ITEM" );
uint64 vendorguid, itemguid; uint64 vendorguid, itemguid;
@ -518,7 +518,7 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
if(!itemguid) if(!itemguid)
return; return;
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid,UNIT_NPC_FLAG_VENDOR); Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
if (!pCreature) if (!pCreature)
{ {
sLog.outDebug( "WORLD: HandleSellItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) ); sLog.outDebug( "WORLD: HandleSellItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) );
@ -534,7 +534,7 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
if( pItem ) if( pItem )
{ {
// prevent sell not owner item // 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); _player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
return; return;
@ -548,20 +548,20 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
} }
// prevent sell currently looted item // 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); _player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
return; return;
} }
// special case at auto sell (sell all) // special case at auto sell (sell all)
if(count==0) if(count == 0)
{ {
count = pItem->GetCount(); count = pItem->GetCount();
} }
else else
{ {
// prevent sell more items that exist in stack (possable only not from client) // 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); _player->SendSellError( SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0);
@ -615,15 +615,15 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
void WorldSession::HandleBuybackItem(WorldPacket & recv_data) void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
{ {
CHECK_PACKET_SIZE(recv_data,8+4); CHECK_PACKET_SIZE(recv_data, 8+4);
sLog.outDebug( "WORLD: Received CMSG_BUYBACK_ITEM" ); sLog.outDebug( "WORLD: Received CMSG_BUYBACK_ITEM" );
uint64 vendorguid; uint64 vendorguid;
uint32 slot; uint32 slot;
recv_data >> vendorguid >> slot; recv_data >> vendorguid >> slot;
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid,UNIT_NPC_FLAG_VENDOR); Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
if (!pCreature) if (!pCreature)
{ {
sLog.outDebug( "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) ); sLog.outDebug( "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) );
@ -664,9 +664,9 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
void WorldSession::HandleBuyItemInSlotOpcode( WorldPacket & recv_data ) void WorldSession::HandleBuyItemInSlotOpcode( WorldPacket & recv_data )
{ {
CHECK_PACKET_SIZE(recv_data,8+4+4+8+1+4); CHECK_PACKET_SIZE(recv_data, 8+4+4+8+1+4);
sLog.outDebug( "WORLD: Received CMSG_BUY_ITEM_IN_SLOT" ); sLog.outDebug( "WORLD: Received CMSG_BUY_ITEM_IN_SLOT" );
uint64 vendorguid, bagguid; uint64 vendorguid, bagguid;
uint32 item, slot, count; uint32 item, slot, count;
uint8 bagslot; uint8 bagslot;
@ -697,26 +697,26 @@ void WorldSession::HandleBuyItemInSlotOpcode( WorldPacket & recv_data )
if (bag == NULL_BAG) if (bag == NULL_BAG)
return; return;
GetPlayer()->BuyItemFromVendor(vendorguid,item,count,bag,bagslot); GetPlayer()->BuyItemFromVendor(vendorguid, item, count, bag, bagslot);
} }
void WorldSession::HandleBuyItemOpcode( WorldPacket & recv_data ) void WorldSession::HandleBuyItemOpcode( WorldPacket & recv_data )
{ {
CHECK_PACKET_SIZE(recv_data,8+4+4+4+1); CHECK_PACKET_SIZE(recv_data, 8+4+4+4+1);
sLog.outDebug( "WORLD: Received CMSG_BUY_ITEM" ); sLog.outDebug( "WORLD: Received CMSG_BUY_ITEM" );
uint64 vendorguid; uint64 vendorguid;
uint32 item, slot, count; uint32 item, slot, count;
uint8 unk1; uint8 unk1;
recv_data >> vendorguid >> item >> slot >> count >> unk1; recv_data >> vendorguid >> item >> slot >> count >> unk1;
GetPlayer()->BuyItemFromVendor(vendorguid,item,count,NULL_BAG,NULL_SLOT); GetPlayer()->BuyItemFromVendor(vendorguid, item, count, NULL_BAG, NULL_SLOT);
} }
void WorldSession::HandleListInventoryOpcode( WorldPacket & recv_data ) void WorldSession::HandleListInventoryOpcode( WorldPacket & recv_data )
{ {
CHECK_PACKET_SIZE(recv_data,8); CHECK_PACKET_SIZE(recv_data, 8);
uint64 guid; uint64 guid;
@ -725,16 +725,16 @@ void WorldSession::HandleListInventoryOpcode( WorldPacket & recv_data )
if(!GetPlayer()->isAlive()) if(!GetPlayer()->isAlive())
return; return;
sLog.outDebug( "WORLD: Recvd CMSG_LIST_INVENTORY" ); sLog.outDebug( "WORLD: Recvd CMSG_LIST_INVENTORY" );
SendListInventory( guid ); SendListInventory( guid );
} }
void WorldSession::SendListInventory( uint64 vendorguid ) void WorldSession::SendListInventory( uint64 vendorguid )
{ {
sLog.outDebug( "WORLD: Sent SMSG_LIST_INVENTORY" ); sLog.outDebug( "WORLD: Sent SMSG_LIST_INVENTORY" );
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid,UNIT_NPC_FLAG_VENDOR); Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
if (!pCreature) if (!pCreature)
{ {
sLog.outDebug( "WORLD: SendListInventory - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) ); sLog.outDebug( "WORLD: SendListInventory - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) );
@ -800,7 +800,7 @@ void WorldSession::SendListInventory( uint64 vendorguid )
void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data ) void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data )
{ {
CHECK_PACKET_SIZE(recv_data,1+1+1); CHECK_PACKET_SIZE(recv_data, 1+1+1);
//sLog.outDebug("WORLD: CMSG_AUTOSTORE_BAG_ITEM"); //sLog.outDebug("WORLD: CMSG_AUTOSTORE_BAG_ITEM");
uint8 srcbag, srcslot, dstbag; uint8 srcbag, srcslot, dstbag;
@ -812,7 +812,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data )
if( !pItem ) if( !pItem )
return; return;
if(!_player->IsValidPos(dstbag,NULL_SLOT)) if(!_player->IsValidPos(dstbag, NULL_SLOT))
{ {
_player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL ); _player->SendEquipError( EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, NULL );
return; return;
@ -840,9 +840,9 @@ void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data )
} }
// no-op: placed in same slot // 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 // just remove gray item state
_player->SendEquipError( EQUIP_ERR_NONE, pItem, NULL ); _player->SendEquipError( EQUIP_ERR_NONE, pItem, NULL );
return; return;
} }
@ -892,7 +892,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket) void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket)
{ {
CHECK_PACKET_SIZE(recvPacket,1+1); CHECK_PACKET_SIZE(recvPacket, 1+1);
sLog.outDebug("WORLD: CMSG_AUTOBANK_ITEM"); sLog.outDebug("WORLD: CMSG_AUTOBANK_ITEM");
uint8 srcbag, srcslot; uint8 srcbag, srcslot;
@ -918,7 +918,7 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket)
void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
{ {
CHECK_PACKET_SIZE(recvPacket,1+1); CHECK_PACKET_SIZE(recvPacket, 1+1);
sLog.outDebug("WORLD: CMSG_AUTOSTORE_BANK_ITEM"); sLog.outDebug("WORLD: CMSG_AUTOSTORE_BANK_ITEM");
uint8 srcbag, srcslot; uint8 srcbag, srcslot;
@ -960,7 +960,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data) void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data)
{ {
CHECK_PACKET_SIZE(recv_data,4); CHECK_PACKET_SIZE(recv_data, 4);
if(!GetPlayer()->isAlive()) if(!GetPlayer()->isAlive())
{ {
@ -982,10 +982,10 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data)
void WorldSession::SendEnchantmentLog(uint64 Target, uint64 Caster,uint32 ItemID,uint32 SpellID) void WorldSession::SendEnchantmentLog(uint64 Target, uint64 Caster,uint32 ItemID,uint32 SpellID)
{ {
WorldPacket data(SMSG_ENCHANTMENTLOG, (8+8+4+4+1)); // last check 2.0.10 WorldPacket data(SMSG_ENCHANTMENTLOG, (8+8+4+4+1)); // last check 2.0.10
data << Target; data << uint64(Target);
data << Caster; data << uint64(Caster);
data << ItemID; data << uint32(ItemID);
data << SpellID; data << uint32(SpellID);
data << uint8(0); data << uint8(0);
SendPacket(&data); SendPacket(&data);
} }
@ -1003,7 +1003,7 @@ void WorldSession::SendItemEnchantTimeUpdate(uint64 Playerguid, uint64 Itemguid,
void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data) void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data)
{ {
CHECK_PACKET_SIZE(recv_data,4); CHECK_PACKET_SIZE(recv_data, 4);
uint32 itemid; uint32 itemid;
recv_data >> itemid; recv_data >> itemid;
@ -1044,7 +1044,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data)
void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data) void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
{ {
CHECK_PACKET_SIZE(recv_data,1+1+1+1); CHECK_PACKET_SIZE(recv_data, 1+1+1+1);
sLog.outDebug("Received opcode CMSG_WRAP_ITEM"); sLog.outDebug("Received opcode CMSG_WRAP_ITEM");
@ -1077,7 +1077,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
return; return;
} }
if(item==gift) // not possable with pacjket from real client if(item == gift) // not possible with packet from real client
{ {
_player->SendEquipError( EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL ); _player->SendEquipError( EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL );
return; return;
@ -1114,7 +1114,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
} }
// maybe not correct check (it is better than nothing) // 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 ); _player->SendEquipError( EQUIP_ERR_UNIQUE_CANT_BE_WRAPPED, item, NULL );
return; return;
@ -1137,7 +1137,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
item->SetUInt32Value(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED); item->SetUInt32Value(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
item->SetState(ITEM_CHANGED, _player); 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 // after save it will be impossible to remove the item from the queue
item->RemoveFromUpdateQueueOf(_player); item->RemoveFromUpdateQueueOf(_player);
@ -1153,7 +1153,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
{ {
sLog.outDebug("WORLD: CMSG_SOCKET_GEMS"); sLog.outDebug("WORLD: CMSG_SOCKET_GEMS");
CHECK_PACKET_SIZE(recv_data,8+8*MAX_GEM_SOCKETS); CHECK_PACKET_SIZE(recv_data, 8+8*MAX_GEM_SOCKETS);
uint64 item_guid; uint64 item_guid;
uint64 gem_guids[MAX_GEM_SOCKETS]; uint64 gem_guids[MAX_GEM_SOCKETS];
@ -1201,8 +1201,8 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
if(!itemTarget->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT)) if(!itemTarget->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT))
return; return;
// not first not-colored (not normaly used) socket // not first not-colored (not normally 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; return;
// ok, this is first not colored socket for item with prismatic socket // ok, this is first not colored socket for item with prismatic socket
@ -1222,7 +1222,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
for(int i = 0; i < MAX_GEM_SOCKETS; ++i) //get new and old enchantments for(int i = 0; i < MAX_GEM_SOCKETS; ++i) //get new and old enchantments
{ {
GemEnchants[i] = (GemProps[i]) ? GemProps[i]->spellitemenchantement : 0; GemEnchants[i] = (GemProps[i]) ? GemProps[i]->spellitemenchantement : 0;
OldEnchants[i] = itemTarget->GetEnchantmentId(EnchantmentSlot(SOCK_ENCHANTMENT_SLOT+i)); OldEnchants[i] = itemTarget->GetEnchantmentId(EnchantmentSlot(SOCK_ENCHANTMENT_SLOT + i));
} }
// check unique-equipped conditions // check unique-equipped conditions
@ -1239,7 +1239,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
{ {
for (int j = 0; j < MAX_GEM_SOCKETS; ++j) for (int j = 0; j < MAX_GEM_SOCKETS; ++j)
{ {
if(i==j) // skip self if(i == j) // skip self
continue; continue;
if (Gems[j]) if (Gems[j])
@ -1309,7 +1309,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
// for equipped item check all equipment for duplicate equipped gems // 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 ); _player->SendEquipError( res, itemTarget, NULL );
return; return;
@ -1323,46 +1323,46 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
//if a meta gem is being equipped, all information has to be written to the item before testing if the conditions for the gem are met //if a meta gem is being equipped, all information has to be written to the item before testing if the conditions for the gem are met
//remove ALL enchants //remove ALL enchants
for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot) for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
_player->ApplyEnchantment(itemTarget,EnchantmentSlot(enchant_slot),false); _player->ApplyEnchantment(itemTarget, EnchantmentSlot(enchant_slot), false);
for(int i = 0; i < MAX_GEM_SOCKETS; ++i) 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); 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 ); _player->DestroyItem(guidItem->GetBagSlot(), guidItem->GetSlot(), true );
} }
} }
for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot) for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
_player->ApplyEnchantment(itemTarget,EnchantmentSlot(enchant_slot),true); _player->ApplyEnchantment(itemTarget, EnchantmentSlot(enchant_slot), true);
bool SocketBonusToBeActivated = itemTarget->GemsFitSockets();//current socketbonus state 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); _player->ApplyEnchantment(itemTarget,BONUS_ENCHANTMENT_SLOT, false);
itemTarget->SetEnchantment(BONUS_ENCHANTMENT_SLOT, (SocketBonusToBeActivated ? itemTarget->GetProto()->socketBonus : 0), 0, 0); itemTarget->SetEnchantment(BONUS_ENCHANTMENT_SLOT, (SocketBonusToBeActivated ? itemTarget->GetProto()->socketBonus : 0), 0, 0);
_player->ApplyEnchantment(itemTarget,BONUS_ENCHANTMENT_SLOT,true); _player->ApplyEnchantment(itemTarget, BONUS_ENCHANTMENT_SLOT, true);
//it is not displayed, client has an inbuilt system to determine if the bonus is activated //it is not displayed, client has an inbuilt system to determine if the bonus is activated
} }
_player->ToggleMetaGemsActive(slot, true); //turn on all metagems (except for target item) _player->ToggleMetaGemsActive(slot, true); // turn on all metagems (except for target item)
} }
void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recv_data) void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recv_data)
{ {
sLog.outDebug("WORLD: CMSG_CANCEL_TEMP_ENCHANTMENT"); sLog.outDebug("WORLD: CMSG_CANCEL_TEMP_ENCHANTMENT");
CHECK_PACKET_SIZE(recv_data,4); CHECK_PACKET_SIZE(recv_data, 4);
uint32 eslot; uint32 eslot;
recv_data >> eslot; recv_data >> eslot;
// apply only to equipped item // apply only to equipped item
if(!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0,eslot)) if(!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0, eslot))
return; return;
Item* item = GetPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, eslot); Item* item = GetPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, eslot);
@ -1373,6 +1373,6 @@ void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recv_data)
if(!item->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT)) if(!item->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
return; return;
GetPlayer()->ApplyEnchantment(item,TEMP_ENCHANTMENT_SLOT,false); GetPlayer()->ApplyEnchantment(item, TEMP_ENCHANTMENT_SLOT, false);
item->ClearEnchantment(TEMP_ENCHANTMENT_SLOT); item->ClearEnchantment(TEMP_ENCHANTMENT_SLOT);
} }

View file

@ -1164,7 +1164,7 @@ void WorldSession::HandlePlayedTime(WorldPacket& /*recv_data*/)
WorldPacket data(SMSG_PLAYED_TIME, 4 + 4 + 1); WorldPacket data(SMSG_PLAYED_TIME, 4 + 4 + 1);
data << uint32(_player->GetTotalPlayedTime()); data << uint32(_player->GetTotalPlayedTime());
data << uint32(_player->GetLevelPlayedTime()); data << uint32(_player->GetLevelPlayedTime());
data << uint8(0); data << uint8(1); // 0 - will not show in chat frame
SendPacket(&data); SendPacket(&data);
} }