Core/Packets:

* converted CMSG_REQUEST_HONOR_STATS and SMSG_INSPECT_HONOR_STATS to packet class
* enabled and added handlers for CMSG_REQUEST_INSPECT_RATED_BG_STATS and SMSG_INSPECT_RATED_BG_STATS
This commit is contained in:
Ovahlord committed 2021-07-10 19:55:04 +02:00
1 parent 74f451941c
commit aef0d5c5dc
8 files changed
+274 -63

No files matched your search

@@ -0,0 +1,69 @@
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "WorldSession.h"
#include "InspectPackets.h"
#include "Player.h"
void WorldSession::HandleRequestHonorStatsOpcode(WorldPackets::Inspect::RequestHonorStats& packet)
{
Player* player = ObjectAccessor::GetPlayer(*_player, packet.TargetGUID);
if (!player)
{
TC_LOG_DEBUG("network", "CMSG_REQUEST_HONOR_STATS: No player found from %s", packet.TargetGUID.ToString().c_str());
return;
}
if (!GetPlayer()->IsWithinDistInMap(player, INSPECT_DISTANCE, false))
return;
if (GetPlayer()->IsValidAttackTarget(player))
return;
WorldPackets::Inspect::InspectHonorStats inspectHonorStats;
inspectHonorStats.PlayerGUID = player->GetGUID();
inspectHonorStats.LifetimeHK = player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS);
inspectHonorStats.YesterdayHK = player->GetUInt16Value(PLAYER_FIELD_KILLS, 1);
inspectHonorStats.TodayHK = player->GetUInt16Value(PLAYER_FIELD_KILLS, 0);
inspectHonorStats.LifetimeMaxRank = 0; // @todo
SendPacket(inspectHonorStats.Write());
}
void WorldSession::HandleRequestInspectRatedBgStatsOpcode(WorldPackets::Inspect::RequestInspectRatedBgStats& packet)
{
Player* player = ObjectAccessor::GetPlayer(*_player, packet.TargetGUID);
if (!player)
{
TC_LOG_DEBUG("network", "CMSG_REQUEST_INSPECT_RATED_BG_STATS: No player found from %s", packet.TargetGUID.ToString().c_str());
return;
}
if (!GetPlayer()->IsWithinDistInMap(player, INSPECT_DISTANCE, false))
return;
if (GetPlayer()->IsValidAttackTarget(player))
return;
WorldPackets::Inspect::InspectRatedBgStats inspectRatedBgStats;
inspectRatedBgStats.PlayerGUID = player->GetGUID();
inspectRatedBgStats.Played = 0; // @todo
inspectRatedBgStats.Rating = 0; // @todo
inspectRatedBgStats.Won = 0; // @todo
SendPacket(inspectRatedBgStats.Write());
}
+1 -58
View File
@@ -39,6 +39,7 @@
#include "Group.h"
#include "Guild.h"
#include "GuildMgr.h"
#include "InspectPackets.h"
#include "InstanceScript.h"
#include "Language.h"
#include "Log.h"
@@ -1040,64 +1041,6 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recvData)
SendPacket(&data);
}
void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recvData)
{
ObjectGuid guid;
guid[1] = recvData.ReadBit();
guid[5] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
guid[3] = recvData.ReadBit();
guid[2] = recvData.ReadBit();
guid[4] = recvData.ReadBit();
guid[0] = recvData.ReadBit();
guid[6] = recvData.ReadBit();
recvData.ReadByteSeq(guid[4]);
recvData.ReadByteSeq(guid[7]);
recvData.ReadByteSeq(guid[0]);
recvData.ReadByteSeq(guid[5]);
recvData.ReadByteSeq(guid[1]);
recvData.ReadByteSeq(guid[6]);
recvData.ReadByteSeq(guid[2]);
recvData.ReadByteSeq(guid[3]);
Player* player = ObjectAccessor::GetPlayer(*_player, guid);
if (!player)
{
TC_LOG_DEBUG("network", "CMSG_INSPECT_HONOR_STATS: No player found from %s", guid.ToString().c_str());
return;
}
if (!GetPlayer()->IsWithinDistInMap(player, INSPECT_DISTANCE, false))
return;
if (GetPlayer()->IsValidAttackTarget(player))
return;
ObjectGuid playerGuid = player->GetGUID();
WorldPacket data(SMSG_INSPECT_HONOR_STATS, 8+1+4+4);
data.WriteBit(playerGuid[4]);
data.WriteBit(playerGuid[3]);
data.WriteBit(playerGuid[6]);
data.WriteBit(playerGuid[2]);
data.WriteBit(playerGuid[5]);
data.WriteBit(playerGuid[0]);
data.WriteBit(playerGuid[7]);
data.WriteBit(playerGuid[1]);
data << uint8(0); // rank
data << uint16(player->GetUInt16Value(PLAYER_FIELD_KILLS, 1)); // yesterday kills
data << uint16(player->GetUInt16Value(PLAYER_FIELD_KILLS, 0)); // today kills
data.WriteByteSeq(playerGuid[2]);
data.WriteByteSeq(playerGuid[0]);
data.WriteByteSeq(playerGuid[6]);
data.WriteByteSeq(playerGuid[3]);
data.WriteByteSeq(playerGuid[4]);
data.WriteByteSeq(playerGuid[1]);
data.WriteByteSeq(playerGuid[5]);
data << uint32(player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS));
data.WriteByteSeq(playerGuid[7]);
SendPacket(&data);
}
void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recvData)
{
uint32 time;
@@ -25,6 +25,7 @@
#include "CombatLogPackets.h"
#include "CombatPackets.h"
#include "GuildPackets.h"
#include "InspectPackets.h"
#include "InstancePackets.h"
#include "ItemPackets.h"
#include "LFGPackets.h"
@@ -0,0 +1,113 @@
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "InspectPackets.h"
WorldPacket const* WorldPackets::Inspect::InspectHonorStats::Write()
{
_worldPacket.WriteBit(PlayerGUID[4]);
_worldPacket.WriteBit(PlayerGUID[3]);
_worldPacket.WriteBit(PlayerGUID[6]);
_worldPacket.WriteBit(PlayerGUID[2]);
_worldPacket.WriteBit(PlayerGUID[5]);
_worldPacket.WriteBit(PlayerGUID[0]);
_worldPacket.WriteBit(PlayerGUID[7]);
_worldPacket.WriteBit(PlayerGUID[1]);
_worldPacket << uint8(LifetimeMaxRank);
_worldPacket << uint16(YesterdayHK);
_worldPacket << uint16(TodayHK);
_worldPacket.WriteByteSeq(PlayerGUID[2]);
_worldPacket.WriteByteSeq(PlayerGUID[0]);
_worldPacket.WriteByteSeq(PlayerGUID[6]);
_worldPacket.WriteByteSeq(PlayerGUID[3]);
_worldPacket.WriteByteSeq(PlayerGUID[4]);
_worldPacket.WriteByteSeq(PlayerGUID[1]);
_worldPacket.WriteByteSeq(PlayerGUID[5]);
_worldPacket << uint32(LifetimeHK);
_worldPacket.WriteByteSeq(PlayerGUID[7]);
return &_worldPacket;
}
void WorldPackets::Inspect::RequestHonorStats::Read()
{
TargetGUID[1] = _worldPacket.ReadBit();
TargetGUID[5] = _worldPacket.ReadBit();
TargetGUID[7] = _worldPacket.ReadBit();
TargetGUID[3] = _worldPacket.ReadBit();
TargetGUID[2] = _worldPacket.ReadBit();
TargetGUID[4] = _worldPacket.ReadBit();
TargetGUID[0] = _worldPacket.ReadBit();
TargetGUID[6] = _worldPacket.ReadBit();
_worldPacket.ReadByteSeq(TargetGUID[4]);
_worldPacket.ReadByteSeq(TargetGUID[7]);
_worldPacket.ReadByteSeq(TargetGUID[0]);
_worldPacket.ReadByteSeq(TargetGUID[5]);
_worldPacket.ReadByteSeq(TargetGUID[1]);
_worldPacket.ReadByteSeq(TargetGUID[6]);
_worldPacket.ReadByteSeq(TargetGUID[2]);
_worldPacket.ReadByteSeq(TargetGUID[3]);
}
void WorldPackets::Inspect::RequestInspectRatedBgStats::Read()
{
TargetGUID[1] = _worldPacket.ReadBit();
TargetGUID[4] = _worldPacket.ReadBit();
TargetGUID[6] = _worldPacket.ReadBit();
TargetGUID[5] = _worldPacket.ReadBit();
TargetGUID[0] = _worldPacket.ReadBit();
TargetGUID[2] = _worldPacket.ReadBit();
TargetGUID[7] = _worldPacket.ReadBit();
TargetGUID[3] = _worldPacket.ReadBit();
_worldPacket.ReadByteSeq(TargetGUID[4]);
_worldPacket.ReadByteSeq(TargetGUID[7]);
_worldPacket.ReadByteSeq(TargetGUID[2]);
_worldPacket.ReadByteSeq(TargetGUID[5]);
_worldPacket.ReadByteSeq(TargetGUID[6]);
_worldPacket.ReadByteSeq(TargetGUID[3]);
_worldPacket.ReadByteSeq(TargetGUID[0]);
_worldPacket.ReadByteSeq(TargetGUID[1]);
}
WorldPacket const* WorldPackets::Inspect::InspectRatedBgStats::Write()
{
_worldPacket.WriteBit(PlayerGUID[6]);
_worldPacket.WriteBit(PlayerGUID[4]);
_worldPacket.WriteBit(PlayerGUID[5]);
_worldPacket.WriteBit(PlayerGUID[1]);
_worldPacket.WriteBit(PlayerGUID[2]);
_worldPacket.WriteBit(PlayerGUID[7]);
_worldPacket.WriteBit(PlayerGUID[0]);
_worldPacket.WriteBit(PlayerGUID[3]);
_worldPacket.WriteByteSeq(PlayerGUID[3]);
_worldPacket << int32(Rating);
_worldPacket.WriteByteSeq(PlayerGUID[1]);
_worldPacket.WriteByteSeq(PlayerGUID[7]);
_worldPacket.WriteByteSeq(PlayerGUID[3]);
_worldPacket.WriteByteSeq(PlayerGUID[6]);
_worldPacket << int32(Won);
_worldPacket << int32(Played);
_worldPacket.WriteByteSeq(PlayerGUID[2]);
_worldPacket.WriteByteSeq(PlayerGUID[5]);
_worldPacket.WriteByteSeq(PlayerGUID[0]);
return &_worldPacket;
}
@@ -0,0 +1,77 @@
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef InspectPackets_h__
#define InspectPackets_h__
#include "Packet.h"
#include "ObjectGuid.h"
namespace WorldPackets
{
namespace Inspect
{
class InspectHonorStats final : public ServerPacket
{
public:
InspectHonorStats() : ServerPacket(SMSG_INSPECT_HONOR_STATS, 17) { }
WorldPacket const* Write() override;
ObjectGuid PlayerGUID;
uint32 LifetimeHK = 0;
uint16 YesterdayHK = 0;
uint16 TodayHK = 0;
uint8 LifetimeMaxRank = 0;
};
class RequestHonorStats final : public ClientPacket
{
public:
RequestHonorStats(WorldPacket&& packet) : ClientPacket(CMSG_REQUEST_HONOR_STATS, std::move(packet)) { }
void Read() override;
ObjectGuid TargetGUID;
};
class RequestInspectRatedBgStats final : public ClientPacket
{
public:
RequestInspectRatedBgStats(WorldPacket&& packet) : ClientPacket(CMSG_REQUEST_INSPECT_RATED_BG_STATS, std::move(packet)) { }
void Read() override;
ObjectGuid TargetGUID;
};
class InspectRatedBgStats final : public ServerPacket
{
public:
InspectRatedBgStats() : ServerPacket(SMSG_INSPECT_RATED_BG_STATS, 20) { }
WorldPacket const* Write() override;
ObjectGuid PlayerGUID;
int32 Rating = 0;
int32 Played = 0;
int32 Won = 0;
};
}
}
#endif
+3 -3
View File
@@ -382,7 +382,6 @@ void OpcodeTable::Initialize()
DEFINE_HANDLER(CMSG_IGNORE_TRADE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleIgnoreTradeOpcode );
DEFINE_HANDLER(CMSG_INITIATE_TRADE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleInitiateTradeOpcode );
DEFINE_HANDLER(CMSG_INSPECT, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleInspectOpcode );
DEFINE_HANDLER(CMSG_INSPECT_HONOR_STATS, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleInspectHonorStatsOpcode );
DEFINE_HANDLER(CMSG_INSTANCE_LOCK_WARNING_RESPONSE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleInstanceLockResponse );
DEFINE_HANDLER(CMSG_ITEM_REFUND, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleItemRefund );
DEFINE_HANDLER(CMSG_ITEM_REFUND_INFO, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleItemRefundInfoRequest );
@@ -540,7 +539,8 @@ void OpcodeTable::Initialize()
DEFINE_HANDLER(CMSG_REQUEST_CATEGORY_COOLDOWNS, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleRequestCategoryCooldowns );
DEFINE_HANDLER(CMSG_REQUEST_CEMETERY_LIST, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleRequestCemeteryList );
DEFINE_HANDLER(CMSG_REQUEST_GUILD_REWARDS_LIST, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleRequestGuildRewardsList );
DEFINE_HANDLER(CMSG_REQUEST_INSPECT_RATED_BG_STATS, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_HANDLER(CMSG_REQUEST_HONOR_STATS, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRequestHonorStatsOpcode );
DEFINE_HANDLER(CMSG_REQUEST_INSPECT_RATED_BG_STATS, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRequestInspectRatedBgStatsOpcode);
DEFINE_HANDLER(CMSG_REQUEST_PARTY_MEMBER_STATS, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRequestPartyMemberStatsOpcode);
DEFINE_HANDLER(CMSG_REQUEST_PET_INFO, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRequestPetInfoOpcode );
DEFINE_HANDLER(CMSG_REQUEST_PVP_OPTIONS_ENABLED, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleRequestPvpOptions );
@@ -939,7 +939,7 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SETUP_RESEARCH_HISTORY, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_INIT_WORLD_STATES, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_INSPECT_HONOR_STATS, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_INSPECT_RATED_BG_STATS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_INSPECT_RATED_BG_STATS, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_INSPECT_RESULTS_UPDATE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_INSPECT_TALENT, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_INSTANCE_INFO, STATUS_NEVER, CONNECTION_TYPE_REALM);
+1 -1
View File
@@ -285,7 +285,6 @@ enum OpcodeClient : uint16
CMSG_IGNORE_TRADE = 0x7112,
CMSG_INITIATE_TRADE = 0x7916,
CMSG_INSPECT = 0x0927,
CMSG_INSPECT_HONOR_STATS = 0x791E,
CMSG_INSTANCE_LOCK_WARNING_RESPONSE = 0x6234,
CMSG_ITEM_REFUND = 0x6134,
CMSG_ITEM_REFUND_INFO = 0x2206,
@@ -457,6 +456,7 @@ enum OpcodeClient : uint16
CMSG_REQUEST_CATEGORY_COOLDOWNS = 0x7102,
CMSG_REQUEST_CEMETERY_LIST = 0x720A,
CMSG_REQUEST_GUILD_REWARDS_LIST = 0x3012,
CMSG_REQUEST_HONOR_STATS = 0x791E,
CMSG_REQUEST_INSPECT_RATED_BG_STATS = 0x3010,
CMSG_REQUEST_PARTY_MEMBER_STATS = 0x0C04,
CMSG_REQUEST_PET_INFO = 0x4924,
+9 -1
View File
@@ -143,6 +143,12 @@ namespace WorldPackets
class SetGuildMaster;
}
namespace Inspect
{
class RequestHonorStats;
class RequestInspectRatedBgStats;
}
namespace Misc
{
class CompleteCinematic;
@@ -657,7 +663,9 @@ class TC_GAME_API WorldSession
void HandleInspectOpcode(WorldPacket& recvPacket);
// new party stats
void HandleInspectHonorStatsOpcode(WorldPacket& recvPacket);
void HandleRequestHonorStatsOpcode(WorldPackets::Inspect::RequestHonorStats& packet);
void HandleRequestInspectRatedBgStatsOpcode(WorldPackets::Inspect::RequestInspectRatedBgStats& packet);
void HandleMoveWaterWalkAck(WorldPacket& recvPacket);
void HandleFeatherFallAck(WorldPacket& recvData);