mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
/played command should work once again.
This commit is contained in:
parent
09907c8e61
commit
a26e90019b
2 changed files with 77 additions and 77 deletions
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
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");
|
||||
uint8 srcbag, srcslot, dstbag, dstslot, count;
|
||||
|
|
@ -40,19 +40,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)
|
||||
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;
|
||||
|
|
@ -63,7 +63,7 @@ void WorldSession::HandleSplitItemOpcode( 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");
|
||||
uint8 srcslot, dstslot;
|
||||
|
|
@ -71,11 +71,11 @@ void WorldSession::HandleSwapInvItemOpcode( WorldPacket & recv_data )
|
|||
recv_data >> dstslot >> srcslot;
|
||||
//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)
|
||||
// prevent attempt swap same item to current position generated by client at special cheating sequence
|
||||
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;
|
||||
|
|
@ -95,7 +95,7 @@ void WorldSession::HandleSwapInvItemOpcode( 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;
|
||||
uint8 dstslot;
|
||||
recv_data >> itemguid >> dstslot;
|
||||
|
|
@ -115,7 +115,7 @@ void WorldSession::HandleAutoEquipItemSlotOpcode( 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");
|
||||
uint8 dstbag, dstslot, srcbag, srcslot;
|
||||
|
|
@ -126,17 +126,17 @@ void WorldSession::HandleSwapItem( WorldPacket & recv_data )
|
|||
uint16 src = ( (srcbag << 8) | srcslot );
|
||||
uint16 dst = ( (dstbag << 8) | dstslot );
|
||||
|
||||
// prevent attempt swap same item to current position generated by client at special checting sequence
|
||||
if(src==dst)
|
||||
// prevent attempt swap same item to current position generated by client at special cheating sequence
|
||||
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;
|
||||
|
|
@ -147,7 +147,7 @@ void WorldSession::HandleSwapItem( 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");
|
||||
uint8 srcbag, srcslot;
|
||||
|
|
@ -175,7 +175,7 @@ void WorldSession::HandleAutoEquipItemOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
|
||||
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 );
|
||||
|
|
@ -250,7 +250,7 @@ void WorldSession::HandleAutoEquipItemOpcode( 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");
|
||||
uint8 bag, slot, count, data1, data2, data3;
|
||||
|
|
@ -445,7 +445,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
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);
|
||||
data << uint32(item | 0x80000000);
|
||||
SendPacket( &data );
|
||||
|
|
@ -454,7 +454,7 @@ void WorldSession::HandleItemQuerySingleOpcode( 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");
|
||||
|
||||
|
|
@ -489,9 +489,9 @@ void WorldSession::HandleReadItem( 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;
|
||||
uint64 guid;
|
||||
|
|
@ -504,7 +504,7 @@ void WorldSession::HandlePageQuerySkippedOpcode( 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" );
|
||||
uint64 vendorguid, itemguid;
|
||||
|
|
@ -518,7 +518,7 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
|
|||
if(!itemguid)
|
||||
return;
|
||||
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid,UNIT_NPC_FLAG_VENDOR);
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
|
||||
if (!pCreature)
|
||||
{
|
||||
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 )
|
||||
{
|
||||
// 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;
|
||||
|
|
@ -548,20 +548,20 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
|
||||
// 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 (possable only not from client)
|
||||
// prevent sell more items that exist in stack (possible only not from client)
|
||||
if(count > pItem->GetCount())
|
||||
{
|
||||
_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)
|
||||
{
|
||||
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;
|
||||
uint32 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)
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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;
|
||||
uint32 item, slot, count;
|
||||
uint8 bagslot;
|
||||
|
|
@ -697,26 +697,26 @@ void WorldSession::HandleBuyItemInSlotOpcode( WorldPacket & recv_data )
|
|||
if (bag == NULL_BAG)
|
||||
return;
|
||||
|
||||
GetPlayer()->BuyItemFromVendor(vendorguid,item,count,bag,bagslot);
|
||||
GetPlayer()->BuyItemFromVendor(vendorguid, item, count, bag, bagslot);
|
||||
}
|
||||
|
||||
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;
|
||||
uint32 item, slot, count;
|
||||
uint8 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 )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,8);
|
||||
CHECK_PACKET_SIZE(recv_data, 8);
|
||||
|
||||
uint64 guid;
|
||||
|
||||
|
|
@ -725,16 +725,16 @@ void WorldSession::HandleListInventoryOpcode( WorldPacket & recv_data )
|
|||
if(!GetPlayer()->isAlive())
|
||||
return;
|
||||
|
||||
sLog.outDebug( "WORLD: Recvd CMSG_LIST_INVENTORY" );
|
||||
sLog.outDebug( "WORLD: Recvd CMSG_LIST_INVENTORY" );
|
||||
|
||||
SendListInventory( guid );
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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 )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,1+1+1);
|
||||
CHECK_PACKET_SIZE(recv_data, 1+1+1);
|
||||
|
||||
//sLog.outDebug("WORLD: CMSG_AUTOSTORE_BAG_ITEM");
|
||||
uint8 srcbag, srcslot, dstbag;
|
||||
|
|
@ -812,7 +812,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data )
|
|||
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;
|
||||
|
|
@ -840,9 +840,9 @@ void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
|
||||
// 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 );
|
||||
return;
|
||||
}
|
||||
|
|
@ -892,7 +892,7 @@ void WorldSession::HandleBuyBankSlotOpcode(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");
|
||||
uint8 srcbag, srcslot;
|
||||
|
|
@ -918,7 +918,7 @@ void WorldSession::HandleAutoBankItemOpcode(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");
|
||||
uint8 srcbag, srcslot;
|
||||
|
|
@ -960,7 +960,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
|
|||
|
||||
void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data)
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,4);
|
||||
CHECK_PACKET_SIZE(recv_data, 4);
|
||||
|
||||
if(!GetPlayer()->isAlive())
|
||||
{
|
||||
|
|
@ -982,10 +982,10 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data)
|
|||
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
|
||||
data << Target;
|
||||
data << Caster;
|
||||
data << ItemID;
|
||||
data << SpellID;
|
||||
data << uint64(Target);
|
||||
data << uint64(Caster);
|
||||
data << uint32(ItemID);
|
||||
data << uint32(SpellID);
|
||||
data << uint8(0);
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
|
@ -1003,7 +1003,7 @@ void WorldSession::SendItemEnchantTimeUpdate(uint64 Playerguid, uint64 Itemguid,
|
|||
|
||||
void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data)
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,4);
|
||||
CHECK_PACKET_SIZE(recv_data, 4);
|
||||
|
||||
uint32 itemid;
|
||||
recv_data >> itemid;
|
||||
|
|
@ -1044,7 +1044,7 @@ void WorldSession::HandleItemNameQueryOpcode(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");
|
||||
|
||||
|
|
@ -1077,7 +1077,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
|
|||
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 );
|
||||
return;
|
||||
|
|
@ -1114,7 +1114,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
|
|||
}
|
||||
|
||||
// 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;
|
||||
|
|
@ -1137,7 +1137,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);
|
||||
|
|
@ -1153,7 +1153,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
|
|||
{
|
||||
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 gem_guids[MAX_GEM_SOCKETS];
|
||||
|
|
@ -1201,8 +1201,8 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
|
|||
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))
|
||||
// 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))
|
||||
return;
|
||||
|
||||
// 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
|
||||
{
|
||||
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
|
||||
|
|
@ -1239,7 +1239,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])
|
||||
|
|
@ -1309,7 +1309,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
|
|||
// for equipped item check all equipment for duplicate equipped gems
|
||||
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;
|
||||
|
|
@ -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
|
||||
|
||||
//remove ALL enchants
|
||||
for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot)
|
||||
_player->ApplyEnchantment(itemTarget,EnchantmentSlot(enchant_slot),false);
|
||||
for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
|
||||
_player->ApplyEnchantment(itemTarget, EnchantmentSlot(enchant_slot), false);
|
||||
|
||||
for(int i = 0; i < MAX_GEM_SOCKETS; ++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]))
|
||||
_player->DestroyItem(guidItem->GetBagSlot(), guidItem->GetSlot(), true );
|
||||
}
|
||||
}
|
||||
|
||||
for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot)
|
||||
_player->ApplyEnchantment(itemTarget,EnchantmentSlot(enchant_slot),true);
|
||||
for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
|
||||
_player->ApplyEnchantment(itemTarget, EnchantmentSlot(enchant_slot), true);
|
||||
|
||||
bool SocketBonusToBeActivated = itemTarget->GemsFitSockets();//current socketbonus state
|
||||
if(SocketBonusActivated ^ SocketBonusToBeActivated) //if there was a change...
|
||||
bool SocketBonusToBeActivated = itemTarget->GemsFitSockets();// current socketbonus state
|
||||
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);
|
||||
_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
|
||||
}
|
||||
|
||||
_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)
|
||||
{
|
||||
sLog.outDebug("WORLD: CMSG_CANCEL_TEMP_ENCHANTMENT");
|
||||
|
||||
CHECK_PACKET_SIZE(recv_data,4);
|
||||
CHECK_PACKET_SIZE(recv_data, 4);
|
||||
|
||||
uint32 eslot;
|
||||
|
||||
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);
|
||||
|
|
@ -1373,6 +1373,6 @@ void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recv_data)
|
|||
if(!item->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
|
||||
return;
|
||||
|
||||
GetPlayer()->ApplyEnchantment(item,TEMP_ENCHANTMENT_SLOT,false);
|
||||
GetPlayer()->ApplyEnchantment(item, TEMP_ENCHANTMENT_SLOT, false);
|
||||
item->ClearEnchantment(TEMP_ENCHANTMENT_SLOT);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue