From 7906b6c942573968e5a410ecf0e3456d269c26d4 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Thu, 26 Mar 2026 15:22:11 +0100 Subject: [PATCH] Localization/Fixup * localize "unnamed" text for gameobjects and areatrigger * fix empty links in Quest Detail Page for quests with external completion event but empty AreaDescription * closes #501 --- endpoints/quest/quest.php | 10 +++++----- includes/dbtypes/areatrigger.class.php | 6 +++--- includes/dbtypes/gameobject.class.php | 4 ++-- localization/locale_dede.php | 2 ++ localization/locale_enus.php | 2 ++ localization/locale_eses.php | 2 ++ localization/locale_frfr.php | 2 ++ localization/locale_ruru.php | 2 ++ localization/locale_zhcn.php | 2 ++ 9 files changed, 22 insertions(+), 10 deletions(-) diff --git a/endpoints/quest/quest.php b/endpoints/quest/quest.php index 36e4a206..b3d1d74e 100644 --- a/endpoints/quest/quest.php +++ b/endpoints/quest/quest.php @@ -634,7 +634,7 @@ class QuestBaseResponse extends TemplateResponse implements ICache // PSA: 'redundant' data is on purpose (e.g. creature required for kill, also dropps item required to collect) // external events - $endTextWrapper = '%s'; + $endText = $this->subject->parseText('end', false); if ($_specialFlags & QUEST_FLAG_SPECIAL_EXT_COMPLETE) { // areatrigger @@ -643,7 +643,7 @@ class QuestBaseResponse extends TemplateResponse implements ICache if ($atSpawns = DB::AoWoW()->selectAssoc('SELECT `typeId` AS ARRAY_KEY, `posX`, `posY`, `floor`, `areaId` FROM ::spawns WHERE `type` = %i AND `typeId` IN %in', Type::AREATRIGGER, $atir)) { if (User::isInGroup(U_GROUP_STAFF)) - $endTextWrapper = '%s'; + $endText = ''.($endText ?: Lang::areatrigger('unnamed', [$atir[0]])).''; foreach ($atSpawns as $atId => $atsp) { @@ -651,7 +651,7 @@ class QuestBaseResponse extends TemplateResponse implements ICache 'type' => User::isInGroup(U_GROUP_STAFF) ? Type::AREATRIGGER : -1, 'id' => $atId, 'point' => 'requirement', - 'name' => $this->subject->parseText('end', false), + 'name' => $this->subject->parseText('end', false) ?: Lang::areatrigger('unnamed', [$atir[0]]), 'coord' => [$atsp['posX'], $atsp['posY']], 'coords' => [[$atsp['posX'], $atsp['posY']]], 'objective' => $objectiveIdx++ @@ -674,7 +674,7 @@ class QuestBaseResponse extends TemplateResponse implements ICache // complete-spell else if ($endSpell = new SpellList(array(DB::OR, [DB::AND, ['effect1Id', SPELL_EFFECT_QUEST_COMPLETE], ['effect1MiscValue', $this->typeId]], [DB::AND, ['effect2Id', SPELL_EFFECT_QUEST_COMPLETE], ['effect2MiscValue', $this->typeId]], [DB::AND, ['effect3Id', SPELL_EFFECT_QUEST_COMPLETE], ['effect3MiscValue', $this->typeId]]))) if (!$endSpell->error) - $endTextWrapper = '%s'; + $endText = ''.($endText ?: $endSpell->getField('name', true)).''; } // ..adding creature kill requirements @@ -898,7 +898,7 @@ class QuestBaseResponse extends TemplateResponse implements ICache $this->offerReward = $this->subject->parseText('offerReward', false); $this->requestItems = $this->subject->parseText('requestItems', false); $this->completed = $this->subject->parseText('completed', false); - $this->end = sprintf($endTextWrapper, $this->subject->parseText('end', false)); + $this->end = $endText; $this->suggestedPl = $this->subject->getField('suggestedPlayers'); $this->unavailable = $_flags & QUEST_FLAG_UNAVAILABLE || $this->subject->getField('cuFlags') & CUSTOM_EXCLUDE_FOR_LISTVIEW; $this->redButtons = array( diff --git a/includes/dbtypes/areatrigger.class.php b/includes/dbtypes/areatrigger.class.php index aa0a543e..527afb25 100644 --- a/includes/dbtypes/areatrigger.class.php +++ b/includes/dbtypes/areatrigger.class.php @@ -27,13 +27,13 @@ class AreaTriggerList extends DBTypeList foreach ($this->iterate() as $id => &$_curTpl) if (!$_curTpl['name']) - $_curTpl['name'] = 'Unnamed Areatrigger #' . $id; + $_curTpl['name'] = Lang::areatrigger('unnamed', [$id]); } public static function getName(int $id) : ?LocString { - if ($n = DB::Aowow()->SelectRow('SELECT IF(`name`, `name`, CONCAT("Unnamed Areatrigger #", `id`) AS "name_loc0" FROM %n WHERE `id` = %i', self::$dataTable, $id)) - return new LocString($n); + if ($n = DB::Aowow()->SelectRow('SELECT `name` AS "name_loc0" FROM %n WHERE `id` = %i', self::$dataTable, $id)) + return new LocString($n, callback: fn($x) => $x ?: Lang::areatrigger('unnamed', [$id])); return null; } diff --git a/includes/dbtypes/gameobject.class.php b/includes/dbtypes/gameobject.class.php index ad0fe167..7dcc92c1 100644 --- a/includes/dbtypes/gameobject.class.php +++ b/includes/dbtypes/gameobject.class.php @@ -34,8 +34,8 @@ class GameObjectList extends DBTypeList // post processing foreach ($this->iterate() as $_id => &$curTpl) { - if (!$curTpl['name_loc0']) - $curTpl['name_loc0'] = 'Unnamed Object #' . $_id; + if (!$curTpl['name_loc'.Lang::getLocale()->value]) + $curTpl['name_loc'.Lang::getLocale()->value] = Lang::gameObject('unnamed', [$_id]); // unpack miscInfo $curTpl['mStone'] = diff --git a/localization/locale_dede.php b/localization/locale_dede.php index f95bffd4..1ca688b4 100644 --- a/localization/locale_dede.php +++ b/localization/locale_dede.php @@ -1143,11 +1143,13 @@ $lang = array( 'areatrigger' => array( 'notFound' => "Dieser Areatrigger existiert nicht.", 'foundIn' => "Dieser Areatrigger befindet sich in", + 'unnamed' => "Unbenannter Areatrigger #%d", 'types' => ['Unbenutzt', 'Gasthaus', 'Teleporter', 'Questziel', 'Smarter Trigger', 'Script'] ), 'gameObject' => array( 'id' => "Objekt-ID: ", 'notFound' => "Dieses Objekt existiert nicht.", + 'unnamed' => "Unbenanntes Objekt #%d", 'cat' => [0 => "Anderes", 3 => "Behälter", 6 => "Fallen", 9 => "Bücher", 25 => "Fischschwärme", -5 => "Truhen", -3 => "Kräuter", -4 => "Erzadern", -2 => "Quest", -6 => "Werkzeuge"], 'type' => [ 3 => "Behälter", 6 => "", 9 => "Buch", 25 => "", -5 => "Truhe", -3 => "Kraut", -4 => "Erzvorkommen", -2 => "Quest", -6 => ""], 'unkPosition' => "Der Standort dieses Objekts ist nicht bekannt.", diff --git a/localization/locale_enus.php b/localization/locale_enus.php index 13488289..6735239a 100644 --- a/localization/locale_enus.php +++ b/localization/locale_enus.php @@ -1143,11 +1143,13 @@ $lang = array( 'areatrigger' => array( 'notFound' => "This areatrigger doesn't exist.", 'foundIn' => "This areatrigger can be found in", + 'unnamed' => "Unnamed areatrigger #%d", 'types' => ['Unused', 'Tavern', 'Teleporter', 'Quest Objective', 'Smart Trigger', 'Script'] ), 'gameObject' => array( 'id' => "Object ID: ", 'notFound' => "This object doesn't exist.", + 'unnamed' => "Unnamed object #%d", 'cat' => [0 => "Other", 3 => "Containers", 6 => "Traps", 9 => "Books", 25 => "Fishing Pools", -5 => "Chests", -3 => "Herbs", -4 => "Mineral Veins", -2 => "Quest", -6 => "Tools"], 'type' => [ 3 => "Container", 6 => "", 9 => "Book", 25 => "", -5 => "Chest", -3 => "Herb", -4 => "Mineral Vein", -2 => "Quest", -6 => ""], // used for tooltip 'unkPosition' => "The location of this object is unknown.", diff --git a/localization/locale_eses.php b/localization/locale_eses.php index 96db72fd..bae6c931 100644 --- a/localization/locale_eses.php +++ b/localization/locale_eses.php @@ -1143,11 +1143,13 @@ $lang = array( 'areatrigger' => array( 'notFound' => "Este activador de área no existe.", 'foundIn' => "Este activador de área se puede encontrar en", + 'unnamed' => "[Unnamed areatrigger] #%d", 'types' => ['Sin usar', 'Taberna', 'Teletransportador', 'Objetivo de misión', 'Activador inteligente', 'Script'] ), 'gameObject' => array( 'id' => "ID de Entidad: ", 'notFound' => "Esta entidad no existe.", + 'unnamed' => "[Unnamed object] #%d", 'cat' => [0 => "Otros", 3 => "Contenedores", 6 => "Trampas", 9 => "Libros", 25 => "Bancos de peces", -5 => "Cofres", -3 => "Hierbas", -4 => "Venas de minerales", -2 => "Misiones", -6 => "Herramientas"], 'type' => [ 3 => "Contenedore", 6 => "", 9 => "Libro", 25 => "", -5 => "Cofre", -3 => "Hierba", -4 => "Filóne de mineral", -2 => "Misión", -6 => ""], 'unkPosition' => "No se conoce la ubicación de esta entidad.", diff --git a/localization/locale_frfr.php b/localization/locale_frfr.php index d311dea5..eef73e93 100644 --- a/localization/locale_frfr.php +++ b/localization/locale_frfr.php @@ -1143,11 +1143,13 @@ $lang = array( 'areatrigger' => array( 'notFound' => "This areatrigger doesn't exist.", 'foundIn' => "This areatrigger can be found in", + 'unnamed' => "[Unnamed areatrigger] #%d", 'types' => ['Unused', 'Tavern', 'Teleporter', 'Quest Objective', 'Smart Trigger', 'Script'] ), 'gameObject' => array( 'id' => "ID Entité: ", 'notFound' => "Cette entité n'existe pas.", + 'unnamed' => "[Unnamed object] #%d", 'cat' => [0 => "Autre", 3 => "Conteneurs", 6 => "Pièges", 9 => "Livres", 25 => "Bancs de poissons", -5 => "Coffres", -3 => "Herbes", -4 => "Filons de minerai", -2 => "Quêtes", -6 => "Outils"], 'type' => [ 3 => "Conteneur", 6 => "", 9 => "Livre", 25 => "", -5 => "Coffre", -3 => "Herbe", -4 => "Filon de minerai", -2 => "Quête", -6 => ""], 'unkPosition' => "L'emplacement de cette entité est inconnu.", diff --git a/localization/locale_ruru.php b/localization/locale_ruru.php index 71bce292..04429780 100644 --- a/localization/locale_ruru.php +++ b/localization/locale_ruru.php @@ -1143,11 +1143,13 @@ $lang = array( 'areatrigger' => array( 'notFound' => "This areatrigger doesn't exist.", 'foundIn' => "This areatrigger can be found in", + 'unnamed' => "[Unnamed areatrigger] #%d", 'types' => ['Unused', 'Tavern', 'Teleporter', 'Quest Objective', 'Smart Trigger', 'Script'] ), 'gameObject' => array( 'id' => "Объект ID: ", 'notFound' => "Такой объект не существует.", + 'unnamed' => "[Unnamed object] #%d", 'cat' => [0 => "Другое", 3 => "Контейнеры", 6 => "Ловушки", 9 => "Книги", 25 => "Рыболовные лунки", -5 => "Сундуки", -3 => "Травы", -4 => "Полезные ископаемые", -2 => "Задания", -6 => "Инструменты"], 'type' => [ 3 => "Контейнер", 6 => "", 9 => "Книга", 25 => "", -5 => "Сундук", -3 => "Растение", -4 => "Полезное ископаемое", -2 => "Задание", -6 => ""], 'unkPosition' => "Местонахождение этого объекта неизвестно.", diff --git a/localization/locale_zhcn.php b/localization/locale_zhcn.php index 445d19d2..ec6a1025 100644 --- a/localization/locale_zhcn.php +++ b/localization/locale_zhcn.php @@ -1143,11 +1143,13 @@ $lang = array( 'areatrigger' => array( 'notFound' => "这个区域触发器不存在。", 'foundIn' => "这个区域触发器可以在以下地区找到:", + 'unnamed' => "[Unnamed areatrigger] #%d", 'types' => ['未使用', '酒馆', '传送门', '任务目标', 'Smart Trigger', '脚本'] ), 'gameObject' => array( 'id' => "对象ID:", 'notFound' => "这个对象不存在。", + 'unnamed' => "[Unnamed object] #%d", 'cat' => [0 => "其他", 3 => "容器", 6 => "陷阱", 9 => "书籍", 25 => "钓鱼点", -5 => "宝箱", -3 => "草药", -4 => "矿脉", -2 => "任务", -6 => "工具"], 'type' => [ 3 => "容器", 6 => "", 9 => "书籍", 25 => "", -5 => "宝箱", -3 => "草药", -4 => "矿脉", -2 => "任务", -6 => ""], 'unkPosition' => "这个对象的位置未知。",