mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/WorldStates: Migrate battleground HolidayWorldState to new system
This commit is contained in:
13
sql/updates/world/master/2022_07_11_01_world.sql
Normal file
13
sql/updates/world/master/2022_07_11_01_world.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
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'),
|
||||
(6306,0,NULL,NULL,'','Battleground Call to Arms - Temple of Kotmogu'),
|
||||
(6436,0,NULL,NULL,'','Battleground Call to Arms - Silvershard Mines'),
|
||||
(7671,0,NULL,NULL,'','Battleground Call to Arms - Deepwind Gorge (Legacy)');
|
||||
@@ -9232,22 +9232,6 @@ void Player::SendInitWorldStates(uint32 zoneId, uint32 areaId)
|
||||
packet.Worldstates.emplace_back(3901, previousArenaSeason);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::SetBindPoint(ObjectGuid guid) const
|
||||
|
||||
@@ -2352,7 +2352,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
void SendInitWorldStates(uint32 zoneId, uint32 areaId);
|
||||
void SendUpdateWorldState(uint32 variable, uint32 value, bool hidden = false) const;
|
||||
void SendDirectMessage(WorldPacket const* data) const;
|
||||
void SendBGWeekendWorldStates() const;
|
||||
|
||||
void SendAurasForTarget(Unit* target) const;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "PoolMgr.h"
|
||||
#include "StringConvert.h"
|
||||
#include "World.h"
|
||||
#include "WorldStatePackets.h"
|
||||
#include "WorldStateMgr.h"
|
||||
|
||||
GameEventMgr* GameEventMgr::instance()
|
||||
{
|
||||
@@ -1550,21 +1550,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)
|
||||
{
|
||||
WorldPackets::WorldState::UpdateWorldState worldstate;
|
||||
worldstate.VariableID = bl->HolidayWorldState;
|
||||
worldstate.Value = Activate;
|
||||
//worldstate.Hidden = false;
|
||||
sWorld->SendGlobalMessage(worldstate.Write());
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user