[Scripts] Fix zone data load ordering issue (#4343)

* [Scripts] Fix zone data load ordering issue

* Move more around

* More
This commit is contained in:
Chris Miles 2024-05-26 14:26:06 -05:00 committed by GitHub
parent b253fce0d5
commit 1310c5d528
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -108,9 +108,6 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool is_static) {
numclients = 0; numclients = 0;
zone = new Zone(iZoneID, iInstanceID, zonename); zone = new Zone(iZoneID, iInstanceID, zonename);
parse->Init();
parse->ReloadQuests(true);
//init the zone, loads all the data, etc //init the zone, loads all the data, etc
if (!zone->Init(is_static)) { if (!zone->Init(is_static)) {
safe_delete(zone); safe_delete(zone);
@ -1150,6 +1147,33 @@ bool Zone::Init(bool is_static) {
watermap = WaterMap::LoadWaterMapfile(map_name); watermap = WaterMap::LoadWaterMapfile(map_name);
pathing = IPathfinder::Load(map_name); pathing = IPathfinder::Load(map_name);
LogInfo("Loading timezone data");
zone_time.setEQTimeZone(content_db.GetZoneTimezone(zoneid, GetInstanceVersion()));
LoadLDoNTraps();
LoadLDoNTrapEntries();
LoadDynamicZoneTemplates();
DynamicZone::CacheAllFromDatabase();
Expedition::CacheAllFromDatabase();
content_db.LoadGlobalLoot();
npc_scale_manager->LoadScaleData();
LoadGrids();
if (RuleB(Zone, LevelBasedEXPMods)) {
LoadLevelEXPMods();
}
RespawnTimesRepository::ClearExpiredRespawnTimers(database);
// make sure that anything that needs to be loaded prior to scripts is loaded before here
// this is to ensure that the scripts have access to the data they need
parse->Init();
parse->ReloadQuests(true);
spawn_conditions.LoadSpawnConditions(short_name, instanceid); spawn_conditions.LoadSpawnConditions(short_name, instanceid);
content_db.LoadStaticZonePoints(&zone_point_list, short_name, GetInstanceVersion()); content_db.LoadStaticZonePoints(&zone_point_list, short_name, GetInstanceVersion());
@ -1166,12 +1190,8 @@ bool Zone::Init(bool is_static) {
LogInfo("Loading adventure flavor text"); LogInfo("Loading adventure flavor text");
LoadAdventureFlavor(); LoadAdventureFlavor();
LoadGroundSpawns(); LoadGroundSpawns();
LoadZoneObjects(); LoadZoneObjects();
RespawnTimesRepository::ClearExpiredRespawnTimers(database);
LoadZoneDoors(); LoadZoneDoors();
LoadZoneBlockedSpells(); LoadZoneBlockedSpells();
@ -1181,22 +1201,12 @@ bool Zone::Init(bool is_static) {
database.DeleteBuyLines(0); database.DeleteBuyLines(0);
} }
LoadLDoNTraps();
LoadLDoNTrapEntries();
LoadVeteranRewards(); LoadVeteranRewards();
LoadAlternateCurrencies(); LoadAlternateCurrencies();
LoadNPCEmotes(&npc_emote_list); LoadNPCEmotes(&npc_emote_list);
LoadAlternateAdvancement(); LoadAlternateAdvancement();
content_db.LoadGlobalLoot();
LoadBaseData(); LoadBaseData();
//Load merchant data
LoadMerchants(); LoadMerchants();
//Load temporary merchant data
LoadTempMerchantData(); LoadTempMerchantData();
// Merc data // Merc data
@ -1205,29 +1215,13 @@ bool Zone::Init(bool is_static) {
LoadMercenarySpells(); LoadMercenarySpells();
} }
if (RuleB(Zone, LevelBasedEXPMods)) {
LoadLevelEXPMods();
}
petition_list.ClearPetitions(); petition_list.ClearPetitions();
petition_list.ReadDatabase(); petition_list.ReadDatabase();
LoadDynamicZoneTemplates();
DynamicZone::CacheAllFromDatabase();
Expedition::CacheAllFromDatabase();
guild_mgr.LoadGuilds(); guild_mgr.LoadGuilds();
LogInfo("Loading timezone data");
zone_time.setEQTimeZone(content_db.GetZoneTimezone(zoneid, GetInstanceVersion()));
LogInfo("Zone booted successfully zone_id [{}] time_offset [{}]", zoneid, zone_time.getEQTimeZone()); LogInfo("Zone booted successfully zone_id [{}] time_offset [{}]", zoneid, zone_time.getEQTimeZone());
LoadGrids();
npc_scale_manager->LoadScaleData();
// logging origination information // logging origination information
LogSys.origination_info.zone_short_name = zone->short_name; LogSys.origination_info.zone_short_name = zone->short_name;
LogSys.origination_info.zone_long_name = zone->long_name; LogSys.origination_info.zone_long_name = zone->long_name;