Core/Packets: converted SMSG_RATED_BG_STATS, SMSG_PVP_OPTIONS_ENABLED and SMSG_BATTLEFIELD_RATED_INFO to packet class and named a fiew fields
This commit is contained in:
1 parent
cfecdc0fe5
commit
b513b472a6
4 files changed
+157
-49
No files matched your search
@@ -20,6 +20,7 @@
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "BattlegroundPackets.h"
|
||||
#include "Chat.h"
|
||||
#include "Common.h"
|
||||
#include "Creature.h"
|
||||
@@ -818,47 +819,32 @@ void WorldSession::HandleRequestRatedBgInfo(WorldPacket & recvData)
|
||||
recvData >> unk;
|
||||
|
||||
TC_LOG_DEBUG("bg.battleground", "WorldSession::HandleRequestRatedBgInfo: unk = %u", unk);
|
||||
uint8 ratedBattlegroundActive = sWorld->getBoolConfig(CONFIG_RATED_BATTLEGROUND_ENABLE);
|
||||
uint8 ratedBattlegroundReward = sWorld->getIntConfig(CONFIG_RATED_BATTLEGROUND_REWARD) / CURRENCY_PRECISION;
|
||||
|
||||
/// @Todo: perfome research in this case
|
||||
/// The unk fields are related to arenas
|
||||
WorldPacket data(SMSG_RATED_BG_STATS, 72);
|
||||
data << uint32(0); // BgWeeklyWins20vs20
|
||||
data << uint32(0); // BgWeeklyPlayed20vs20
|
||||
data << uint32(0); // BgWeeklyPlayed15vs15
|
||||
data << uint32(0);
|
||||
data << uint32(0); // BgWeeklyWins10vs10
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0); // BgWeeklyWins15vs15
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0); // BgWeeklyPlayed10vs10
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
|
||||
SendPacket(&data);
|
||||
WorldPackets::Battleground::BattlefieldRatedInfo packet;
|
||||
packet.Unk = unk;
|
||||
packet.Reward = ratedBattlegroundReward;
|
||||
packet.RewardWeeklyLimit = _player->GetCurrencyWeekCap(CURRENCY_TYPE_CONQUEST_META_RBG, true);
|
||||
packet.PurseQuantity = _player->GetCurrency(CURRENCY_TYPE_CONQUEST_POINTS, true);
|
||||
|
||||
SendPacket(packet.Write());
|
||||
|
||||
// update the rated battleground state
|
||||
_player->SendUpdateWorldState(WS_RATED_BATTLEGROUND_STATE_ACTIVE, ratedBattlegroundActive);
|
||||
}
|
||||
|
||||
void WorldSession::HandleRequestPvpOptions(WorldPacket& /*recvData*/)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: CMSG_REQUEST_PVP_OPTIONS_ENABLED");
|
||||
|
||||
/// @Todo: perfome research in this case
|
||||
WorldPacket data(SMSG_PVP_OPTIONS_ENABLED, 1);
|
||||
data.WriteBit(1);
|
||||
data.WriteBit(1); // WargamesEnabled
|
||||
data.WriteBit(1);
|
||||
data.WriteBit(1); // RatedBGsEnabled
|
||||
data.WriteBit(1); // RatedArenasEnabled
|
||||
WorldPackets::Battleground::PVPOptionsEnabled packet;
|
||||
packet.RatedArenas = true;
|
||||
packet.WargameBattlegrounds = true;
|
||||
packet.RatedBattlegrounds = true;
|
||||
|
||||
data.FlushBits();
|
||||
|
||||
SendPacket(&data);
|
||||
SendPacket(packet.Write());
|
||||
}
|
||||
|
||||
void WorldSession::HandleRequestPvpReward(WorldPacket& /*recvData*/)
|
||||
@@ -872,23 +858,8 @@ void WorldSession::HandleRequestRatedBgStats(WorldPacket& /*recvData*/)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: CMSG_REQUEST_RATED_BG_STATS");
|
||||
|
||||
uint8 ratedBattlegroundActive = sWorld->getBoolConfig(CONFIG_RATED_BATTLEGROUND_ENABLE);
|
||||
uint8 ratedBattlegroundReward = sWorld->getIntConfig(CONFIG_RATED_BATTLEGROUND_REWARD) / CURRENCY_PRECISION;
|
||||
|
||||
WorldPacket data(SMSG_BATTLEFIELD_RATED_INFO, 29);
|
||||
data << uint32(ratedBattlegroundReward); // Reward
|
||||
data << uint8(3); // unk
|
||||
data << uint32(0); // unk
|
||||
data << uint32(0); // unk
|
||||
data << _player->GetCurrencyWeekCap(CURRENCY_TYPE_CONQUEST_META_RBG, true);
|
||||
data << uint32(0); // unk
|
||||
data << uint32(0); // unk
|
||||
data << _player->GetCurrency(CURRENCY_TYPE_CONQUEST_POINTS, true);
|
||||
|
||||
SendPacket(&data);
|
||||
|
||||
// update the rated battleground state
|
||||
_player->SendUpdateWorldState(WS_RATED_BATTLEGROUND_STATE_ACTIVE, ratedBattlegroundActive);
|
||||
WorldPackets::Battleground::RatedBattlefieldInfo packet;
|
||||
SendPacket(packet.Write());
|
||||
}
|
||||
|
||||
void WorldSession::HandleBattlegroundStateQuery(WorldPacket& /*recvData*/)
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#define AllPackets_h__
|
||||
|
||||
#include "AuthenticationPackets.h"
|
||||
#include "BattlegroundPackets.h"
|
||||
#include "CharacterPackets.h"
|
||||
#include "CombatLogPackets.h"
|
||||
#include "CombatPackets.h"
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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 "BattlegroundPackets.h"
|
||||
|
||||
WorldPacket const* WorldPackets::Battleground::PVPOptionsEnabled::Write()
|
||||
{
|
||||
_worldPacket.WriteBit(1); // ignored by the client
|
||||
_worldPacket.WriteBit(WargameBattlegrounds);
|
||||
_worldPacket.WriteBit(1); // ignored by the client
|
||||
_worldPacket.WriteBit(RatedBattlegrounds);
|
||||
_worldPacket.WriteBit(RatedArenas);
|
||||
_worldPacket.FlushBits();
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Battleground::RatedBattlefieldInfo::Write()
|
||||
{
|
||||
_worldPacket << int32(Brackets[2].WeeklyWon); // BgWeeklyWins25vs25
|
||||
_worldPacket << int32(Brackets[2].WeeklyPlayed); // BgWeeklyPlayed25vs25
|
||||
_worldPacket << int32(Brackets[1].WeeklyPlayed); // BgWeeklyPlayed15vs15
|
||||
_worldPacket << int32(0);
|
||||
_worldPacket << int32(Brackets[0].WeeklyWon); // BgWeeklyWins10vs10
|
||||
_worldPacket << int32(0);
|
||||
_worldPacket << int32(0);
|
||||
_worldPacket << int32(0);
|
||||
_worldPacket << int32(Brackets[1].WeeklyWon); // BgWeeklyWins15vs15
|
||||
_worldPacket << int32(0);
|
||||
_worldPacket << int32(0);
|
||||
_worldPacket << int32(0);
|
||||
_worldPacket << int32(Brackets[0].WeeklyPlayed); // BgWeeklyPlayed10vs10
|
||||
_worldPacket << int32(0);
|
||||
_worldPacket << int32(0);
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Battleground::BattlefieldRatedInfo::Write()
|
||||
{
|
||||
_worldPacket << int32(Reward);
|
||||
_worldPacket << int8(Unk);
|
||||
_worldPacket << int32(PersonalRating);
|
||||
_worldPacket << int32(0);
|
||||
_worldPacket << int32(RewardWeeklyLimit);
|
||||
_worldPacket << int32(0);
|
||||
_worldPacket << int32(0);
|
||||
_worldPacket << int32(PurseQuantity);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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 BattlegroundPackets_h__
|
||||
#define BattlegroundPackets_h__
|
||||
|
||||
#include "Packet.h"
|
||||
#include "ObjectGuid.h"
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace Battleground
|
||||
{
|
||||
class PVPOptionsEnabled final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
PVPOptionsEnabled() : ServerPacket(SMSG_PVP_OPTIONS_ENABLED, 1) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
bool RatedArenas = false;
|
||||
bool WargameBattlegrounds = false;
|
||||
bool RatedBattlegrounds = false;
|
||||
};
|
||||
|
||||
struct ClientBracketInfo
|
||||
{
|
||||
int32 WeeklyPlayed = 0;
|
||||
int32 WeeklyWon = 0;
|
||||
};
|
||||
|
||||
class RatedBattlefieldInfo final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
RatedBattlefieldInfo() : ServerPacket(SMSG_RATED_BG_STATS, 72) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
std::array<ClientBracketInfo, 3> Brackets;
|
||||
};
|
||||
|
||||
class BattlefieldRatedInfo final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
BattlefieldRatedInfo() : ServerPacket(SMSG_BATTLEFIELD_RATED_INFO, 29) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
int32 Reward = 0;
|
||||
int32 PersonalRating = 0;
|
||||
int32 RewardWeeklyLimit = 0;
|
||||
int32 PurseQuantity = 0;
|
||||
int8 Unk = 0; // Same value as in cmsg
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // BattlegroundPackets_h__
|
||||
Reference in new issue
Block a user