Core/Packets: corrected field order and type in RequestPVPRewardsResponse and handle BattlefieldRatedInfo for arena teams

This commit is contained in:
Ovahlord
2020-11-02 23:14:25 +01:00
parent 031363620d
commit b79bc4dde7
4 changed files with 32 additions and 19 deletions

View File

@@ -806,24 +806,37 @@ void WorldSession::HandleRequestRatedBgInfo(WorldPacket & recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_REQUEST_RATED_BG_INFO");
uint8 unk;
recvData >> unk;
TC_LOG_DEBUG("bg.battleground", "WorldSession::HandleRequestRatedBgInfo: unk = %u", unk);
uint8 ratedBattlegroundActive = sWorld->getIntConfig(CONFIG_RATED_BATTLEGROUND_ENABLE);
int32 ratedBattlegroundReward = sWorld->getIntConfig(CONFIG_RATED_BATTLEGROUND_REWARD) / CURRENCY_PRECISION;
uint8 mode;
recvData >> mode;
TC_LOG_DEBUG("bg.battleground", "WorldSession::HandleRequestRatedBgInfo: mode = %u", mode);
WorldPackets::Battleground::BattlefieldRatedInfo packet;
packet.Unk = unk;
packet.Reward = ratedBattlegroundReward;
packet.RatedMaxRewardPointsThisWeek = _player->GetCurrencyWeekCap(CURRENCY_TYPE_CONQUEST_META_RBG, true);
packet.Mode = mode;
switch (mode)
{
case 0: // Arena 2v2
case 1: // Arena 3v3
case 2: // Arena 5v5
packet.Reward = sWorld->getIntConfig(CONFIG_CURRENCY_CONQUEST_POINTS_ARENA_REWARD) / CURRENCY_PRECISION;
break;
case 3: // Rated Battlegrounds
packet.Reward = sWorld->getIntConfig(CONFIG_RATED_BATTLEGROUND_REWARD) / CURRENCY_PRECISION;
packet.RatedMaxRewardPointsThisWeek = _player->GetCurrencyWeekCap(CURRENCY_TYPE_CONQUEST_META_RBG, true);
packet.PersonalRating = 0; // Todo: implement
break;
default:
TC_LOG_ERROR("bg.battleground", "WorldSession::HandleRequestRatedBgInfo: Player %s tried to request rated BG infos for a invalid game mode (%u). Possible cheater.", _player->GetGUID().ToString().c_str(), mode);
return;
}
packet.MaxRewardPointsThisWeek = _player->GetCurrencyWeekCap(CURRENCY_TYPE_CONQUEST_POINTS, true);
packet.RewardPointsThisWeek = _player->GetCurrencyOnWeek(CURRENCY_TYPE_CONQUEST_POINTS, true);
SendPacket(packet.Write());
// update the rated battleground state
uint8 ratedBattlegroundActive = sWorld->getIntConfig(CONFIG_RATED_BATTLEGROUND_ENABLE);
_player->SendUpdateWorldState(WS_RATED_BATTLEGROUND_STATE_ACTIVE, ratedBattlegroundActive);
}

View File

@@ -54,7 +54,7 @@ WorldPacket const* WorldPackets::Battleground::RatedBattlefieldInfo::Write()
WorldPacket const* WorldPackets::Battleground::BattlefieldRatedInfo::Write()
{
_worldPacket << int32(Reward);
_worldPacket << int8(Unk);
_worldPacket << int8(Mode);
_worldPacket << int32(PersonalRating);
_worldPacket << int32(RewardPointsThisWeek);
_worldPacket << int32(RatedMaxRewardPointsThisWeek); // this and MaxRewardPointsThisWeek are weekly conquest limits but not sure which one is for rated BGs

View File

@@ -56,7 +56,7 @@ namespace WorldPackets
class BattlefieldRatedInfo final : public ServerPacket
{
public:
BattlefieldRatedInfo() : ServerPacket(SMSG_BATTLEFIELD_RATED_INFO, 29) { }
BattlefieldRatedInfo() : ServerPacket(SMSG_BATTLEFIELD_RATED_INFO, 21) { }
WorldPacket const* Write() override;
@@ -65,7 +65,7 @@ namespace WorldPackets
int32 RatedMaxRewardPointsThisWeek = 0;
int32 MaxRewardPointsThisWeek = 0;
int32 RewardPointsThisWeek = 0;
int8 Unk = 0; // Same value as in cmsg
int8 Mode = 0; // 0 = arena 2v2, 1 = arena 3v3, 2 = arena 5v5, 3 = rated battleground
};
class BattlefieldList final : public ServerPacket

View File

@@ -52,12 +52,12 @@ WorldPacket const* WorldPackets::Misc::SetupCurrency::Write()
WorldPacket const* WorldPackets::Misc::RequestPVPRewardsResponse::Write()
{
_worldPacket << uint32(MaxRewardPointsThisWeek);
_worldPacket << uint32(RewardPointsThisWeek);
_worldPacket << uint32(ArenaMaxRewardPointsThisWeek);
_worldPacket << uint32(RatedRewardPointsThisWeek);
_worldPacket << uint32(ArenaRewardPointsThisWeek);
_worldPacket << uint32(RatedMaxRewardPointsThisWeek);
_worldPacket << int32(RatedMaxRewardPointsThisWeek);
_worldPacket << int32(RewardPointsThisWeek);
_worldPacket << int32(ArenaMaxRewardPointsThisWeek);
_worldPacket << int32(RatedRewardPointsThisWeek);
_worldPacket << int32(ArenaRewardPointsThisWeek);
_worldPacket << int32(MaxRewardPointsThisWeek);
return &_worldPacket;
}