mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-03 03:50:40 +00:00
[Bugfix] Load zone variables before encounter_load. (#4846)
This commit is contained in:
+30
-12
@@ -381,6 +381,31 @@ inline void LoadZoneVariables(Zone *z, const std::string &variables)
|
||||
}
|
||||
}
|
||||
|
||||
bool Zone::LoadZoneVariablesState()
|
||||
{
|
||||
auto spawn_states = ZoneStateSpawnsRepository::GetWhere(
|
||||
database,
|
||||
fmt::format(
|
||||
"zone_id = {} AND instance_id = {} AND is_zone = 1 ORDER BY spawn2_id",
|
||||
zoneid,
|
||||
zone->GetInstanceID()
|
||||
)
|
||||
);
|
||||
|
||||
if (spawn_states.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto &s: spawn_states) {
|
||||
if (s.is_zone) {
|
||||
LoadZoneVariables(zone, s.entity_variables);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Zone::LoadZoneState(
|
||||
std::unordered_map<uint32, uint32> spawn_times,
|
||||
std::vector<Spawn2DisabledRepository::Spawn2Disabled> disabled_spawns
|
||||
@@ -389,18 +414,19 @@ bool Zone::LoadZoneState(
|
||||
auto spawn_states = ZoneStateSpawnsRepository::GetWhere(
|
||||
database,
|
||||
fmt::format(
|
||||
"zone_id = {} AND instance_id = {} ORDER BY spawn2_id",
|
||||
"zone_id = {} AND instance_id = {} AND is_zone = 0 ORDER BY spawn2_id",
|
||||
zoneid,
|
||||
zone->GetInstanceID()
|
||||
)
|
||||
);
|
||||
|
||||
LogInfo("Loading zone state spawns for zone [{}] spawns [{}]", GetShortName(), spawn_states.size());
|
||||
|
||||
if (spawn_states.empty()) {
|
||||
LogInfo("No zone state spawns found for zone [{}] instance [{}]", GetShortName(), zone->GetInstanceID());
|
||||
return false;
|
||||
}
|
||||
|
||||
LogInfo("Loading zone state spawns for zone [{}] instance [{}] spawns [{}]", GetShortName(), zone->GetInstanceID(), spawn_states.size());
|
||||
|
||||
if (!IsZoneStateValid(spawn_states)) {
|
||||
LogZoneState("Invalid zone state data for zone [{}]", GetShortName());
|
||||
ClearZoneState(zoneid, zone->GetInstanceID());
|
||||
@@ -414,16 +440,8 @@ bool Zone::LoadZoneState(
|
||||
zone->initgrids_timer.Trigger();
|
||||
zone->Process();
|
||||
|
||||
// load zone variables first
|
||||
int count = 0;
|
||||
for (auto &s: spawn_states) {
|
||||
if (s.is_zone) {
|
||||
LoadZoneVariables(zone, s.entity_variables);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// spawn2
|
||||
int count = 0;
|
||||
for (auto &s: spawn_states) {
|
||||
if (s.spawngroup_id == 0 || s.is_corpse || s.is_zone) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user