Core/WorldStates: Migrate pvp season worldstates to new system

This commit is contained in:
Shauren authored and Ovahlord committed 2022-12-21 22:05:48 +01:00
1 parent ccff3af924
commit d35f58a46d
5 files changed
+20 -5

No files matched your search

@@ -0,0 +1,7 @@
UPDATE `world_state` SET `Comment`='Battlegrounds - Horde bases' WHERE `ID`=1778;
UPDATE `world_state` SET `Comment`='Battlegrounds - Alliance bases' WHERE `ID`=1779;
DELETE FROM `world_state` WHERE `ID` IN (3191,3901);
INSERT INTO `world_state` (`ID`,`DefaultValue`,`MapIDs`,`AreaIDs`,`ScriptName`,`Comment`) VALUES
(3191,0,NULL,NULL,'','PvpSeason - Current season ID'),
(3901,0,NULL,NULL,'','PvpSeason - Previous season ID');
@@ -8774,10 +8774,6 @@ void Player::SendInitWorldStates(uint32 zoneId, uint32 areaId)
packet.Worldstates.emplace_back(2260, 0); // 5
packet.Worldstates.emplace_back(2259, 0); // 6
packet.Worldstates.emplace_back(3191, int32(sWorld->getBoolConfig(CONFIG_ARENA_SEASON_IN_PROGRESS) ? sWorld->getIntConfig(CONFIG_ARENA_SEASON_ID) : 0)); // 7 Current Season - Arena season in progress
// 0 - End of season
packet.Worldstates.emplace_back(3901, int32(sWorld->getIntConfig(CONFIG_ARENA_SEASON_ID) - sWorld->getBoolConfig(CONFIG_ARENA_SEASON_IN_PROGRESS))); // 8 PreviousSeason
SendDirectMessage(packet.Write());
}
@@ -4359,6 +4359,9 @@ enum AreaId : uint32
enum WorldState : uint32
{
WS_CURRENT_PVP_SEASON_ID = 3191,
WS_PREVIOUS_PVP_SEASON_ID = 3901,
WS_BATTLEFIELD_WG_VEHICLE_H = 3490,
WS_BATTLEFIELD_WG_MAX_VEHICLE_H = 3491,
WS_BATTLEFIELD_WG_VEHICLE_A = 3680,
@@ -33,7 +33,7 @@ namespace WorldPackets
int32 Value;
};
class InitWorldStates final : public ServerPacket
class TC_GAME_API InitWorldStates final : public ServerPacket
{
public:
InitWorldStates();
+9
View File
@@ -1281,6 +1281,12 @@ void World::LoadConfigSettings(bool reload)
m_float_configs[CONFIG_ARENA_LOSE_RATING_MODIFIER] = sConfigMgr->GetFloatDefault("Arena.ArenaLoseRatingModifier", 24.0f);
m_float_configs[CONFIG_ARENA_MATCHMAKER_RATING_MODIFIER] = sConfigMgr->GetFloatDefault("Arena.ArenaMatchmakerRatingModifier", 24.0f);
if (reload)
{
sWorldStateMgr->SetValue(WS_CURRENT_PVP_SEASON_ID, getBoolConfig(CONFIG_ARENA_SEASON_IN_PROGRESS) ? getIntConfig(CONFIG_ARENA_SEASON_ID) : 0, false, nullptr);
sWorldStateMgr->SetValue(WS_PREVIOUS_PVP_SEASON_ID, getIntConfig(CONFIG_ARENA_SEASON_ID) - getBoolConfig(CONFIG_ARENA_SEASON_IN_PROGRESS), false, nullptr);
}
m_bool_configs[CONFIG_OFFHAND_CHECK_AT_SPELL_UNLEARN] = sConfigMgr->GetBoolDefault("OffhandCheckAtSpellUnlearn", true);
m_int_configs[CONFIG_CREATURE_PICKPOCKET_REFILL] = sConfigMgr->GetIntDefault("Creature.PickPocketRefillDelay", 10 * MINUTE);
@@ -2129,6 +2135,9 @@ void World::SetInitialWorldSettings()
TC_LOG_INFO("server.loading", "Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions
LoadWorldStates();
sWorldStateMgr->SetValue(WS_CURRENT_PVP_SEASON_ID, getBoolConfig(CONFIG_ARENA_SEASON_IN_PROGRESS) ? getIntConfig(CONFIG_ARENA_SEASON_ID) : 0, false, nullptr);
sWorldStateMgr->SetValue(WS_PREVIOUS_PVP_SEASON_ID, getIntConfig(CONFIG_ARENA_SEASON_ID) - getBoolConfig(CONFIG_ARENA_SEASON_IN_PROGRESS), false, nullptr);
TC_LOG_INFO("server.loading", "Loading World State templates...");
sWorldStateMgr->LoadFromDB();