Core/WorldStates: Migrate battleground HolidayWorldState to new system

This commit is contained in:
Shauren authored and Ovahlord committed 2022-12-21 22:01:54 +01:00
1 parent e748845e78
commit ccff3af924
5 files changed
+16 -33

No files matched your search

@@ -0,0 +1,10 @@
DELETE FROM `world_state` WHERE `ID` IN (1941,1942,1943,2851,3695,4273,5360,5361,6306,6436,7671);
INSERT INTO `world_state` (`ID`,`DefaultValue`,`MapIDs`,`AreaIDs`,`ScriptName`,`Comment`) VALUES
(1941,0,NULL,NULL,'','Battleground Call to Arms - Alterac Valley'),
(1942,0,NULL,NULL,'','Battleground Call to Arms - Warsong Gulch'),
(1943,0,NULL,NULL,'','Battleground Call to Arms - Arathi Basin'),
(2851,0,NULL,NULL,'','Battleground Call to Arms - Eye of the Storm'),
(3695,0,NULL,NULL,'','Battleground Call to Arms - Strand of the Ancients'),
(4273,0,NULL,NULL,'','Battleground Call to Arms - Isle of Conquest'),
(5360,0,NULL,NULL,'','Battleground Call to Arms - The Battle for Gilneas'),
(5361,0,NULL,NULL,'','Battleground Call to Arms - Twin Peaks');
@@ -8779,22 +8779,6 @@ void Player::SendInitWorldStates(uint32 zoneId, uint32 areaId)
packet.Worldstates.emplace_back(3901, int32(sWorld->getIntConfig(CONFIG_ARENA_SEASON_ID) - sWorld->getBoolConfig(CONFIG_ARENA_SEASON_IN_PROGRESS))); // 8 PreviousSeason
SendDirectMessage(packet.Write());
SendBGWeekendWorldStates();
}
void Player::SendBGWeekendWorldStates() const
{
for (uint32 i = 1; i < sBattlemasterListStore.GetNumRows(); ++i)
{
BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(i);
if (bl && bl->HolidayWorldState)
{
if (BattlegroundMgr::IsBGWeekend((BattlegroundTypeId)bl->ID))
SendUpdateWorldState(bl->HolidayWorldState, 1);
else
SendUpdateWorldState(bl->HolidayWorldState, 0);
}
}
}
uint32 Player::GetXPRestBonus(uint32 xp)
-1
View File
@@ -2044,7 +2044,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
void SendInitWorldStates(uint32 zone, uint32 area);
void SendUpdateWorldState(uint32 variable, uint32 value, bool hidden = false) const;
void SendDirectMessage(WorldPacket const* data) const;
void SendBGWeekendWorldStates() const;
void SendAurasForTarget(Unit* target) const;
+4 -14
View File
@@ -30,7 +30,7 @@
#include "PoolMgr.h"
#include "UnitAI.h"
#include "World.h"
#include "WorldPacket.h"
#include "WorldStateMgr.h"
GameEventMgr* GameEventMgr::instance()
{
@@ -1581,19 +1581,9 @@ void GameEventMgr::UpdateWorldStates(uint16 event_id, bool Activate)
{
GameEventData const& event = mGameEvent[event_id];
if (event.holiday_id != HOLIDAY_NONE)
{
BattlegroundTypeId bgTypeId = BattlegroundMgr::WeekendHolidayIdToBGType(event.holiday_id);
if (bgTypeId != BATTLEGROUND_TYPE_NONE)
{
BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId);
if (bl && bl->HolidayWorldState)
{
WorldPacket data;
sBattlegroundMgr->BuildUpdateWorldStatePacket(&data, bl->HolidayWorldState, Activate ? 1 : 0);
sWorld->SendGlobalMessage(&data);
}
}
}
if (BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(BattlegroundMgr::WeekendHolidayIdToBGType(event.holiday_id)))
if (bl->HolidayWorldState)
sWorldStateMgr->SetValue(bl->HolidayWorldState, Activate ? 1 : 0, false, nullptr);
}
GameEventMgr::GameEventMgr() : isSystemInit(false)
@@ -156,7 +156,7 @@ int32 WorldStateMgr::GetValue(int32 worldStateId, Map const* map) const
return 0;
}
if (worldStateTemplate->MapIds.find(map->GetId()) == worldStateTemplate->MapIds.end())
if (!map || worldStateTemplate->MapIds.find(map->GetId()) == worldStateTemplate->MapIds.end())
return 0;
return map->GetWorldStateValue(worldStateId);
@@ -186,7 +186,7 @@ void WorldStateMgr::SetValue(int32 worldStateId, int32 value, bool hidden, Map*
return;
}
if (worldStateTemplate->MapIds.find(map->GetId()) == worldStateTemplate->MapIds.end())
if (!map || worldStateTemplate->MapIds.find(map->GetId()) == worldStateTemplate->MapIds.end())
return;
map->SetWorldStateValue(worldStateId, value, hidden);