Core/Packets: updated SMSG_LOOT_MONEY_NOTIFY, SMSG_COIN_REMOVED, SMSG_LOOT_REMOVED and SMSG_LOOT_RELEASE to packet class

This commit is contained in:
Ovahlord
2020-07-08 14:53:54 +02:00
parent 4f7eec88dc
commit c80ce80644
6 changed files with 86 additions and 22 deletions

View File

@@ -62,6 +62,7 @@
#include "Log.h"
#include "LootItemStorage.h"
#include "LootMgr.h"
#include "LootPackets.h"
#include "Mail.h"
#include "MapInstanced.h"
#include "MapManager.h"
@@ -8304,9 +8305,9 @@ void Player::RemovedInsignia(Player* looterPlr)
void Player::SendLootRelease(ObjectGuid guid) const
{
WorldPacket data(SMSG_LOOT_RELEASE_RESPONSE, (8+1));
data << uint64(guid) << uint8(1);
SendDirectMessage(&data);
WorldPackets::Loot::LootReleaseResponse packet;
packet.LootObj = guid;
SendDirectMessage(packet.Write());
}
void Player::SendLoot(ObjectGuid guid, LootType loot_type)
@@ -8686,15 +8687,14 @@ void Player::SendLootError(ObjectGuid guid, LootError error) const
void Player::SendNotifyLootMoneyRemoved() const
{
WorldPacket data(SMSG_LOOT_CLEAR_MONEY, 0);
SendDirectMessage(&data);
SendDirectMessage(WorldPackets::Loot::CoinRemoved().Write());
}
void Player::SendNotifyLootItemRemoved(uint8 lootSlot) const
{
WorldPacket data(SMSG_LOOT_REMOVED, 1);
data << uint8(lootSlot);
SendDirectMessage(&data);
WorldPackets::Loot::LootRemoved packet;
packet.LootListID = lootSlot;
SendDirectMessage(packet.Write());
}
void Player::SendNotifyCurrencyLootRemoved(uint8 lootSlot)

View File

@@ -27,6 +27,7 @@
#include "Log.h"
#include "LootItemStorage.h"
#include "LootMgr.h"
#include "LootPackets.h"
#include "Map.h"
#include "Object.h"
#include "ObjectAccessor.h"
@@ -237,10 +238,10 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/)
if (uint32 guildGold = CalculatePct(goldPerPlayer, (*i)->GetTotalAuraModifier(SPELL_AURA_DEPOSIT_BONUS_MONEY_IN_GUILD_BANK_ON_LOOT)))
guild->HandleMemberDepositMoney(this, guildGold, true);
WorldPacket data(SMSG_LOOT_MONEY_NOTIFY, 4 + 1);
data << uint32(goldPerPlayer);
data << uint8(playersNear.size() <= 1); // Controls the text displayed in chat. 0 is "Your share is..." and 1 is "You loot..."
(*i)->SendDirectMessage(&data);
WorldPackets::Loot::LootMoneyNotify packet;
packet.Money = goldPerPlayer;
packet.SoleLooter = playersNear.size() <= 1; // Controls the text displayed in chat. 0 is "Your share is..." and 1 is "You loot..."
(*i)->SendDirectMessage(packet.Write());
}
}
else
@@ -252,10 +253,10 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/)
if (uint32 guildGold = CalculatePct(loot->gold, player->GetTotalAuraModifier(SPELL_AURA_DEPOSIT_BONUS_MONEY_IN_GUILD_BANK_ON_LOOT)))
guild->HandleMemberDepositMoney(this, guildGold, true);
WorldPacket data(SMSG_LOOT_MONEY_NOTIFY, 4 + 1);
data << uint32(loot->gold);
data << uint8(1); // "You loot..."
SendPacket(&data);
WorldPackets::Loot::LootMoneyNotify packet;
packet.Money = loot->gold;
packet.SoleLooter = true; // "You loot..."
SendPacket(packet.Write());
}
loot->gold = 0;

View File

@@ -17,6 +17,29 @@
#include "LootPackets.h"
WorldPacket const* WorldPackets::Loot::LootMoneyNotify::Write()
{
_worldPacket << uint32(Money);
_worldPacket << uint8(SoleLooter);
return &_worldPacket;
}
WorldPacket const* WorldPackets::Loot::LootRemoved::Write()
{
_worldPacket << uint8(LootListID);
return &_worldPacket;
}
WorldPacket const* WorldPackets::Loot::LootReleaseResponse::Write()
{
_worldPacket << LootObj;
_worldPacket << uint8(UnkBool);
return &_worldPacket;
}
WorldPacket const* WorldPackets::Loot::LootList::Write()
{
_worldPacket << Owner;

View File

@@ -26,6 +26,46 @@ namespace WorldPackets
{
namespace Loot
{
class LootMoneyNotify final : public ServerPacket
{
public:
LootMoneyNotify() : ServerPacket(SMSG_LOOT_MONEY_NOTIFY, 4 + 1) { }
WorldPacket const* Write() override;
uint32 Money = 0;
bool SoleLooter = false;
};
class CoinRemoved final : public ServerPacket
{
public:
CoinRemoved() : ServerPacket(SMSG_COIN_REMOVED, 0) { }
WorldPacket const* Write() override { return &_worldPacket; };
};
class LootRemoved final : public ServerPacket
{
public:
LootRemoved() : ServerPacket(SMSG_LOOT_REMOVED, 1) { }
WorldPacket const* Write() override;
uint8 LootListID = 0;
};
class LootReleaseResponse final : public ServerPacket
{
public:
LootReleaseResponse() : ServerPacket(SMSG_LOOT_RELEASE, 8 + 1) { }
WorldPacket const* Write() override;
ObjectGuid LootObj;
bool UnkBool = true;
};
class LootList final : public ServerPacket
{
public:

View File

@@ -997,13 +997,13 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_LOGOUT_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_LOG_XPGAIN, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_LOOT_ALL_PASSED, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_LOOT_CLEAR_MONEY, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_COIN_REMOVED, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_LOOT_CONTENTS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_LOOT_ITEM_NOTIFY, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_LOOT_LIST, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_LOOT_MASTER_LIST, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_LOOT_MONEY_NOTIFY, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_LOOT_RELEASE_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_LOOT_RELEASE, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_LOOT_REMOVED, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_LOOT_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_LOOT_ROLL, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);

View File

@@ -945,13 +945,13 @@ enum OpcodeServer
SMSG_LOGOUT_RESPONSE = 0x0524,
SMSG_LOG_XPGAIN = 0x4514,
SMSG_LOOT_ALL_PASSED = 0x6237,
SMSG_LOOT_CLEAR_MONEY = 0x2B37,
SMSG_COIN_REMOVED = 0x2B37,
SMSG_LOOT_CONTENTS = 0x11B1,
SMSG_LOOT_ITEM_NOTIFY = 0x6D15,
SMSG_LOOT_LIST = 0x6807,
SMSG_LOOT_MASTER_LIST = 0x0325,
SMSG_LOOT_MONEY_NOTIFY = 0x2836,
SMSG_LOOT_RELEASE_RESPONSE = 0x6D25,
SMSG_LOOT_RELEASE = 0x6D25,
SMSG_LOOT_REMOVED = 0x6817,
SMSG_LOOT_RESPONSE = 0x4C16,
SMSG_LOOT_ROLL = 0x6507,
@@ -1399,14 +1399,14 @@ inline bool IsInstanceOnlyOpcode(uint32 opcode)
case SMSG_MOUNT_RESULT:
case SMSG_DUEL_COMPLETE:
case SMSG_LOOT_MONEY_NOTIFY:
case SMSG_LOOT_CLEAR_MONEY:
case SMSG_COIN_REMOVED:
case SMSG_ATTACKSTART:
case SMSG_DUEL_WINNER:
case SMSG_DUEL_REQUESTED:
case SMSG_LOOT_RESPONSE:
case SMSG_LOOT_REMOVED:
case SMSG_LOOT_ITEM_NOTIFY:
case SMSG_LOOT_RELEASE_RESPONSE:
case SMSG_LOOT_RELEASE:
return true;
default:
return false;