diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index b49ad2a1a0b..c1925e613ac 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -1578,7 +1578,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) return false; } - if (areaEntry->ParentAreaID != 0) + if (areaEntry->ParentAreaID != 0 && areaEntry->GetFlags().HasFlag(AreaFlags::IsSubzone)) { TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses subzone (ID: %u) instead of zone, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.overrideLight.zoneId); return false; @@ -1607,7 +1607,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) return false; } - if (areaEntry->ParentAreaID != 0) + if (areaEntry->ParentAreaID != 0 && areaEntry->GetFlags().HasFlag(AreaFlags::IsSubzone)) { TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses subzone (ID: %u) instead of zone, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.overrideWeather.zoneId); return false; diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 835c4c474d5..46a7cf77043 100644 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -321,9 +321,11 @@ bool ChatHandler::ExecuteCommandInTable(std::vector const& table, c std::string zoneName = "Unknown"; if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaId)) { - areaName = area->AreaName; - if (AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID)) - zoneName = zone->AreaName; + LocaleConstant locale = m_session->GetSessionDbcLocale(); + areaName = area->AreaName[locale]; + if (area->GetFlags().HasFlag(AreaFlags::IsSubzone)) + if (AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID)) + zoneName = zone->AreaName[locale]; } sLog->outCommand(m_session->GetAccountId(), "Command: %s [Player: %s (%s) (Account: %u) X: %f Y: %f Z: %f Map: %u (%s) Area: %u (%s) Zone: %s Selected: %s (%s)]", diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index da3c0aced62..1a570d49c79 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -2071,7 +2071,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const return false; } - if (areaEntry->ParentAreaID != 0) + if (areaEntry->ParentAreaID != 0 && areaEntry->GetFlags().HasFlag(AreaFlags::IsSubzone)) { TC_LOG_ERROR("sql.sql", "%s requires to be in area (%u) which is a subzone but zone expected, skipped.", cond->ToString(true).c_str(), cond->ConditionValue1); return false; diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 15bb571b1c1..eba7be6f62d 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1217,7 +1217,7 @@ void WorldObject::ProcessPositionDataChanged(PositionFullTerrainStatus const& da { m_zoneId = m_areaId = data.areaId; if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(m_areaId)) - if (area->ParentAreaID) + if (area->ParentAreaID && area->GetFlags().HasFlag(AreaFlags::IsSubzone)) m_zoneId = area->ParentAreaID; m_outdoors = data.outdoors; m_staticFloorZ = data.floorZ; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 029180956cf..73242bf1959 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -27068,8 +27068,9 @@ std::string Player::GetMapAreaAndZoneString() const { int locale = GetSession()->GetSessionDbcLocale(); areaName = area->AreaName[locale]; - if (AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID)) - zoneName = zone->AreaName[locale]; + if (area->GetFlags().HasFlag(AreaFlags::IsSubzone)) + if (AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID)) + zoneName = zone->AreaName[GetSession()->GetSessionDbcLocale()]; } std::ostringstream str; diff --git a/src/server/game/Maps/TerrainMgr.cpp b/src/server/game/Maps/TerrainMgr.cpp index e15483bc6f4..36ba26630e7 100644 --- a/src/server/game/Maps/TerrainMgr.cpp +++ b/src/server/game/Maps/TerrainMgr.cpp @@ -619,7 +619,7 @@ uint32 TerrainInfo::GetZoneId(PhaseShift const& phaseShift, uint32 mapId, float { uint32 areaId = GetAreaId(phaseShift, mapId, x, y, z); if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaId)) - if (area->ParentAreaID) + if (area->ParentAreaID && area->GetFlags().HasFlag(AreaFlags::IsSubzone)) return area->ParentAreaID; return areaId; @@ -629,7 +629,7 @@ void TerrainInfo::GetZoneAndAreaId(PhaseShift const& phaseShift, uint32 mapId, u { areaid = zoneid = GetAreaId(phaseShift, mapId, x, y, z); if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaid)) - if (area->ParentAreaID) + if (area->ParentAreaID && area->GetFlags().HasFlag(AreaFlags::IsSubzone)) zoneid = area->ParentAreaID; } diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp index 2c3d7c8ec7d..7f4910fd72c 100644 --- a/src/server/scripts/Commands/cs_go.cpp +++ b/src/server/scripts/Commands/cs_go.cpp @@ -315,7 +315,9 @@ class go_commandscript : public CommandScript } // update to parent zone if exist (client map show only zones without parents) - AreaTableEntry const* zoneEntry = areaEntry->ParentAreaID ? sAreaTableStore.LookupEntry(areaEntry->ParentAreaID) : areaEntry; + AreaTableEntry const* zoneEntry = areaEntry->ParentAreaID && areaEntry->GetFlags().HasFlag(AreaFlags::IsSubzone) + ? sAreaTableStore.LookupEntry(areaEntry->ParentAreaID) + : areaEntry; ASSERT(zoneEntry); std::shared_ptr terrain = sTerrainMgr.LoadTerrain(zoneEntry->ContinentID); diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp index c3e48c01bc0..21aa5d6f515 100644 --- a/src/server/scripts/Commands/cs_group.cpp +++ b/src/server/scripts/Commands/cs_group.cpp @@ -428,7 +428,7 @@ class group_commandscript : public CommandScript LocaleConstant localeConstant = handler->GetSessionDbcLocale(); AreaTableEntry const* area = sAreaTableStore.LookupEntry(p->GetAreaId()); - if (area) + if (area && area->GetFlags().HasFlag(AreaFlags::IsSubzone)) { AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID); if (zone) diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 407176a71ac..276e270bdc7 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1065,7 +1065,7 @@ class misc_commandscript : public CommandScript uint32 zoneId = player->GetZoneId(); AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(zoneId); - if (!areaEntry || areaEntry->ParentAreaID != 0) + if (!areaEntry || areaEntry->GetFlags().HasFlag(AreaFlags::IsSubzone)) { handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, graveyardId, zoneId); handler->SetSentErrorMessage(true); @@ -1830,11 +1830,17 @@ class misc_commandscript : public CommandScript AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaId); if (area) { - areaName = area->AreaName; + zoneName = area->AreaName[locale]; - AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID); - if (zone) - zoneName = zone->AreaName; + if (area->GetFlags().HasFlag(AreaFlags::IsSubzone)) + { + AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->ParentAreaID); + if (zone) + { + areaName = zoneName; + zoneName = zone->AreaName[locale]; + } + } } if (target)