From 6168937901554f00e1b0a71fb97f9a141d876b49 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Tue, 2 May 2017 22:01:24 +0200 Subject: [PATCH] DB/Structure * implemented changes from https://github.com/TrinityCore/TrinityCore/commit/460e2c5dc5eae49f62a9193fb58f1bab42028bd2 (item localization) --- setup/tools/sqlGen.class.php | 4 ++-- setup/tools/sqlgen/currencies.func.php | 22 ++++++++++++++++++++-- setup/tools/sqlgen/items.func.php | 14 ++++++++++---- setup/updates/1493755253_01.sql | 1 + 4 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 setup/updates/1493755253_01.sql diff --git a/setup/tools/sqlGen.class.php b/setup/tools/sqlGen.class.php index e3fa87e9..53cacb95 100644 --- a/setup/tools/sqlGen.class.php +++ b/setup/tools/sqlGen.class.php @@ -57,7 +57,7 @@ class SqlGen 'itemenchantment' => [null, null, null, ['spell_enchant_proc_data']], 'achievement' => [null, null, ['icons'], ['dbc_achievement', 'disables']], 'creature' => [null, null, null, ['creature_template', 'creature_template_locale', 'creature_classlevelstats', 'instance_encounters']], - 'currencies' => [null, null, null, ['item_template', 'locales_item']], + 'currencies' => [null, null, null, ['item_template', 'item_template_locale']], 'events' => [null, null, null, ['game_event', 'game_event_prerequisite']], 'objects' => [null, null, null, ['gameobject_template', 'gameobject_template_locale', 'gameobject_questitem']], 'pet' => [null, null, ['icons'], ['creature_template', 'creature']], @@ -67,7 +67,7 @@ class SqlGen 'spelldifficulty' => [null, null, null, ['spelldifficulty_dbc']], 'taxi' /* nodes + paths */ => [null, null, null, ['creature_template', 'creature']], 'titles' => [null, null, null, ['quest_template', 'game_event_seasonal_questrelation', 'game_event', 'achievement_reward']], - 'items' => [null, null, ['icons'], ['item_template', 'locales_item', 'spell_group', 'game_event']], + 'items' => [null, null, ['icons'], ['item_template', 'item_template_locale', 'spell_group', 'game_event']], 'spawns' /* + waypoints */ => [null, null, null, ['creature', 'creature_addon', 'gameobject', 'gameobject_template', 'vehicle_accessory', 'vehicle_accessory_template', 'script_waypoint', 'waypoints', 'waypoint_data']], 'zones' => [null, null, null, ['access_requirement']], 'itemset' => [null, null, ['spell'], ['item_template', 'game_event']], diff --git a/setup/tools/sqlgen/currencies.func.php b/setup/tools/sqlgen/currencies.func.php index 4d5ce491..a48ec42a 100644 --- a/setup/tools/sqlgen/currencies.func.php +++ b/setup/tools/sqlgen/currencies.func.php @@ -9,7 +9,7 @@ if (!CLI) /* deps: * item_template - * locales_item + * item_template_locale */ // hide test tokens and move them to unused @@ -32,7 +32,25 @@ function currencies(array $ids = []) $moneyItems = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, itemId FROM dbc_currencytypes{ WHERE id IN (?a)}', $ids ?: DBSIMPLE_SKIP); // apply names & cap - $moneyNames = DB::World()->select('SELECT it.entry AS ARRAY_KEY, name AS name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, it.maxCount AS cap FROM item_template it LEFT JOIN locales_item li ON li.entry = it.entry WHERE it.entry IN (?a)', $moneyItems); + $moneyNames = DB::World()->select(' + SELECT + it.entry AS ARRAY_KEY, + it.name AS name_loc0, IFNULL(itl2.Name, "") AS name_loc2, IFNULL(itl3.Name, "") AS name_loc3, IFNULL(itl6.Name, "") AS name_loc6, IFNULL(itl8.Name, "") AS name_loc8, + it.maxCount AS cap + FROM + item_template it + LEFT JOIN + item_template_locale itl2 ON it.entry = itl2.ID AND itl2.locale = "frFR" + LEFT JOIN + item_template_locale itl3 ON it.entry = itl3.ID AND itl3.locale = "deDE" + LEFT JOIN + item_template_locale itl6 ON it.entry = itl6.ID AND itl6.locale = "esES" + LEFT JOIN + item_template_locale itl8 ON it.entry = itl8.ID AND itl8.locale = "ruRU" + WHERE + it.entry IN (?a)', + $moneyItems); + foreach ($moneyItems as $cId => $itemId) { if (!empty($moneyNames[$itemId])) diff --git a/setup/tools/sqlgen/items.func.php b/setup/tools/sqlgen/items.func.php index e42aa134..7c775532 100644 --- a/setup/tools/sqlgen/items.func.php +++ b/setup/tools/sqlgen/items.func.php @@ -9,7 +9,7 @@ if (!CLI) /* deps: * item_template - * locales_item + * item_template_locale * spell_group * game_event */ @@ -35,7 +35,7 @@ function items(array $ids = []) subclass, subclass AS subClassBak, SoundOverrideSubclass, IFNULL(sg.id, 0) AS subSubClass, - name, IFNULL(li.name_loc2, ""), IFNULL(li.name_loc3, ""), IFNULL(li.name_loc6, ""), IFNULL(li.name_loc8, ""), + it.name, IFNULL(itl2.Name, ""), IFNULL(itl3.Name, ""), IFNULL(itl6.Name, ""), IFNULL(itl8.Name, ""), 0 AS iconId, displayid, 0 AS spellVisualId, @@ -84,7 +84,7 @@ function items(array $ids = []) spellid_4, spelltrigger_4, spellcharges_4, spellppmRate_4, spellcooldown_4, spellcategory_4, spellcategorycooldown_4, spellid_5, spelltrigger_5, spellcharges_5, spellppmRate_5, spellcooldown_5, spellcategory_5, spellcategorycooldown_5, bonding, - it.description, IFNULL(li.description_loc2, ""), IFNULL(li.description_loc3, ""), IFNULL(li.description_loc6, ""), IFNULL(li.description_loc8, ""), + it.description, IFNULL(itl2.Description, ""), IFNULL(itl3.Description, ""), IFNULL(itl6.Description, ""), IFNULL(itl8.Description, ""), PageText, LanguageID, startquest, @@ -119,7 +119,13 @@ function items(array $ids = []) FROM item_template it LEFT JOIN - locales_item li ON li.entry = it.entry + item_template_locale itl2 ON it.entry = itl2.ID AND itl2.locale = "frFR" + LEFT JOIN + item_template_locale itl3 ON it.entry = itl3.ID AND itl3.locale = "deDE" + LEFT JOIN + item_template_locale itl6 ON it.entry = itl6.ID AND itl6.locale = "esES" + LEFT JOIN + item_template_locale itl8 ON it.entry = itl8.ID AND itl8.locale = "ruRU" LEFT JOIN spell_group sg ON sg.spell_id = it.spellid_1 AND it.class = 0 AND it.subclass = 2 AND sg.id IN (1, 2) LEFT JOIN diff --git a/setup/updates/1493755253_01.sql b/setup/updates/1493755253_01.sql new file mode 100644 index 00000000..df2be4d1 --- /dev/null +++ b/setup/updates/1493755253_01.sql @@ -0,0 +1 @@ +UPDATE aowow_dbversion SET `sql` = CONCAT(IFNULL(`sql`, ''), 'currencies items');