diff --git a/common/content/world_content_service.cpp b/common/content/world_content_service.cpp index 95aa0b0b9..6e567d247 100644 --- a/common/content/world_content_service.cpp +++ b/common/content/world_content_service.cpp @@ -357,3 +357,13 @@ WorldContentService::FindZoneResult WorldContentService::FindZone(uint32 zone_id return WorldContentService::FindZoneResult{.zone_id = 0}; } +bool WorldContentService::IsInPublicStaticInstance(uint32 instance_id) +{ + for (auto &i: m_zone_instances) { + if (i.id == instance_id) { + return true; + } + } + + return false; +} diff --git a/common/content/world_content_service.h b/common/content/world_content_service.h index 9d8ce82af..ea075b0ed 100644 --- a/common/content/world_content_service.h +++ b/common/content/world_content_service.h @@ -178,6 +178,8 @@ public: }; FindZoneResult FindZone(uint32 zone_id, uint32 instance_id); + bool IsInPublicStaticInstance(uint32 instance_id); + private: int current_expansion{}; std::vector content_flags; diff --git a/zone/zoning.cpp b/zone/zoning.cpp index c095f7ad0..449697def 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -755,11 +755,6 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z pZoneName = strcpy(new char[zd->long_name.length() + 1], zd->long_name.c_str()); } - // If we are zoning to the same zone, we need to use the current instance ID if it is not specified. - if (zoneID == zone->GetZoneID() && instance_id == 0) { - instance_id = zone->GetInstanceID(); - } - auto r = content_service.FindZone(zoneID, instance_id); if (r.zone_id) { zoneID = r.zone_id; @@ -776,6 +771,11 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z ignorerestrictions, static_cast(zm) ); + + // If we are zoning to the same zone, we need to use the current instance ID if it is not specified. + if (content_service.IsInPublicStaticInstance(instance_id) && zoneID == zone->GetZoneID() && instance_id == 0) { + instance_id = zone->GetInstanceID(); + } } LogInfo(