From 7142615fda93ab87cba328f69f000ff02a791523 Mon Sep 17 00:00:00 2001 From: Bunny67 Date: Sat, 14 Jul 2018 13:32:14 +0300 Subject: [PATCH] update ItemBagFamily --- !Compatibility/api/wowAPI.lua | 19 +- .../libs/LibBabble-ItemBagFamily-3.0.lua | 248 ++++++++---------- 2 files changed, 114 insertions(+), 153 deletions(-) diff --git a/!Compatibility/api/wowAPI.lua b/!Compatibility/api/wowAPI.lua index c3b65bb..8c248de 100644 --- a/!Compatibility/api/wowAPI.lua +++ b/!Compatibility/api/wowAPI.lua @@ -266,24 +266,16 @@ function GetMapNameByID(id) return mapByID[tonumber(id)] end -local bagTypes = { - [LBIBF["Quiver"]] = 1, - [LBIBF["Ammo Pouch"]] = 2, - [LBIBF["Soul Bag"]] = 4, - [LBIBF["Herb Bag"]] = 8, - [LBIBF["Enchanting Bag"]] = 16, -} - -local LBIBF2 = LibStub("LibBabble-ItemBagFamily-3.0").ItemFamily +local LBIBF = LibStub("LibBabble-ItemBagFamily-3.0") function GetItemFamily(id) if not id then return end if type(id) == "table" or type(id) == "function" then return end if type(id) == "string" then - id = match(id, "item:(%d+)") + id = tonumber(match(id, "item:(%d+)")) end - return LBIBF2[id] or 0 + return LBIBF.ItemFamily[id] or 0 end function GetBagFamily(id) @@ -291,11 +283,10 @@ function GetBagFamily(id) if type(id) == "table" or type(id) == "function" then return end if type(id) == "string" then - id = match(id, "item:(%d+)") + id = tonumber(match(id, "item:(%d+)")) end - local _, _, _, _, _, itemType = GetItemInfo(id) - return bagTypes[itemType] or 0 + return LBIBF.ItemBagFamily[id] or 0 end local arrow diff --git a/!Compatibility/libs/LibBabble-ItemBagFamily-3.0.lua b/!Compatibility/libs/LibBabble-ItemBagFamily-3.0.lua index bba13c3..0c1810d 100644 --- a/!Compatibility/libs/LibBabble-ItemBagFamily-3.0.lua +++ b/!Compatibility/libs/LibBabble-ItemBagFamily-3.0.lua @@ -5,71 +5,118 @@ if not LibStub then error(MAJOR_VERSION .. " requires LibStub.") end local lib = LibStub("LibBabble-3.0"):New(MAJOR_VERSION, MINOR_VERSION) if not lib then return end -local GAME_LOCALE = GetLocale() - -lib:SetBaseTranslations { - ["Quiver"] = true, - ["Ammo Pouch"] = true, - ["Soul Bag"] = true, - ["Herb Bag"] = true, - ["Enchanting Bag"] = true, +lib.ItemBagFamily = { + [8217] = 1, + [7371] = 1, + [7278] = 1, + [5439] = 1, + [3605] = 1, + [3573] = 1, + [2662] = 1, + [2101] = 1, + [19319] = 1, + [18714] = 1, + [11362] = 1, + [8218] = 2, + [7372] = 2, + [7279] = 2, + [5441] = 2, + [3604] = 2, + [3574] = 2, + [2663] = 2, + [2102] = 2, + [19320] = 2, + [21340] = 4, + [21341] = 4, + [21342] = 4, + [22243] = 4, + [22244] = 4, + [22250] = 8, + [22251] = 8, + [22252] = 8, + [22246] = 16, + [22248] = 16, + [22249] = 16, } -if GAME_LOCALE == "enUS" then - lib:SetCurrentTranslations(true) -elseif GAME_LOCALE == "deDE" then - lib:SetCurrentTranslations { - ["Quiver"] = "Köcher", - ["Ammo Pouch"] = "Ammo Pouch", - ["Soul Bag"] = "Seelentaschen", - ["Herb Bag"] = "Kräutertaschen", - ["Enchanting Bag"] = "Verzauberertaschen", - } -elseif GAME_LOCALE == "frFR" then - lib:SetCurrentTranslations { - ["Quiver"] = "Carquois", - ["Ammo Pouch"] = "Ammo Pouch", - ["Soul Bag"] = "Sacs d'âmes", - ["Herb Bag"] = "Sacs d'herbes", - ["Enchanting Bag"] = "Sacs d'enchanteur", - } -elseif GAME_LOCALE == "zhCN" then - lib:SetCurrentTranslations { - ["Quiver"] = "箭袋", - ["Ammo Pouch"] = "Ammo Pouch", - ["Soul Bag"] = "灵魂袋", - ["Herb Bag"] = "草药包", - ["Enchanting Bag"] = "附魔材料包", - } -elseif GAME_LOCALE == "koKR" then - lib:SetCurrentTranslations { - ["Quiver"] = "화살통", - ["Ammo Pouch"] = "Ammo Pouch", - ["Soul Bag"] = "영혼의 주머니", - ["Herb Bag"] = "약초 가방", - ["Enchanting Bag"] = "마법부여 가방", - } -elseif GAME_LOCALE == "esES" then - lib:SetCurrentTranslations { - ["Quiver"] = "Carcaj", - ["Ammo Pouch"] = "Ammo Pouch", - ["Soul Bag"] = "Bolsas de almas", - ["Herb Bag"] = "Bolsas de hierbas", - ["Enchanting Bag"] = "Bolsas de encantamiento", - } -elseif GAME_LOCALE == "ruRU" then - lib:SetCurrentTranslations { - ["Quiver"] = "Колчан", - ["Ammo Pouch"] = "Подсумок", - ["Soul Bag"] = "Сумка душ", - ["Herb Bag"] = "Сумка травника", - ["Enchanting Bag"] = "Сумка зачаровывателя", - } -else - error(string.format("%s: Locale %q not supported", MAJOR_VERSION, GAME_LOCALE)) -end - lib.ItemFamily = { + [2512] = 1, + [2515] = 1, + [3030] = 1, + [3464] = 1, + [9399] = 1, + [11285] = 1, + [12654] = 1, + [18042] = 1, + [19316] = 1, + [2516] = 2, + [2519] = 2, + [3033] = 2, + [3465] = 2, + [4960] = 2, + [5568] = 2, + [8067] = 2, + [8068] = 2, + [8069] = 2, + [10512] = 2, + [10513] = 2, + [11284] = 2, + [11363] = 2, + [11630] = 2, + [13377] = 2, + [15997] = 2, + [19317] = 2, + [6265] = 4, + [765] = 8, + [785] = 8, + [1401] = 8, + [2447] = 8, + [2449] = 8, + [2450] = 8, + [2452] = 8, + [2453] = 8, + [3355] = 8, + [3356] = 8, + [3357] = 8, + [3358] = 8, + [3369] = 8, + [3818] = 8, + [3819] = 8, + [3820] = 8, + [3821] = 8, + [4625] = 8, + [5056] = 8, + [5168] = 8, + [8153] = 8, + [8831] = 8, + [8836] = 8, + [8838] = 8, + [8839] = 8, + [8845] = 8, + [8846] = 8, + [11022] = 8, + [11040] = 8, + [11514] = 8, + [11951] = 8, + [11952] = 8, + [13463] = 8, + [13464] = 8, + [13465] = 8, + [13466] = 8, + [13467] = 8, + [13468] = 8, + [16205] = 8, + [16208] = 8, + [17034] = 8, + [17035] = 8, + [17036] = 8, + [17037] = 8, + [17038] = 8, + [17760] = 8, + [18297] = 8, + [19726] = 8, + [19727] = 8, + [22094] = 8, [6218] = 16, [6339] = 16, [6342] = 16, @@ -185,81 +232,4 @@ lib.ItemFamily = { [20757] = 16, [20758] = 16, [22392] = 16, - [765] = 8, - [785] = 8, - [1401] = 8, - [2447] = 8, - [2449] = 8, - [2450] = 8, - [2452] = 8, - [2453] = 8, - [3355] = 8, - [3356] = 8, - [3357] = 8, - [3358] = 8, - [3369] = 8, - [3818] = 8, - [3819] = 8, - [3820] = 8, - [3821] = 8, - [4625] = 8, - [5056] = 8, - [5168] = 8, - [8153] = 8, - [8831] = 8, - [8836] = 8, - [8838] = 8, - [8839] = 8, - [8845] = 8, - [8846] = 8, - [11022] = 8, - [11040] = 8, - [11514] = 8, - [11951] = 8, - [11952] = 8, - [13463] = 8, - [13464] = 8, - [13465] = 8, - [13466] = 8, - [13467] = 8, - [13468] = 8, - [16205] = 8, - [16208] = 8, - [17034] = 8, - [17035] = 8, - [17036] = 8, - [17037] = 8, - [17038] = 8, - [17760] = 8, - [18297] = 8, - [19726] = 8, - [19727] = 8, - [22094] = 8, - [6265] = 4, - [2516] = 2, - [2519] = 2, - [3033] = 2, - [3465] = 2, - [4960] = 2, - [5568] = 2, - [8067] = 2, - [8068] = 2, - [8069] = 2, - [10512] = 2, - [10513] = 2, - [11284] = 2, - [11363] = 2, - [11630] = 2, - [13377] = 2, - [15997] = 2, - [19317] = 2, - [2512] = 1, - [2515] = 1, - [3030] = 1, - [3464] = 1, - [9399] = 1, - [11285] = 1, - [12654] = 1, - [18042] = 1, - [19316] = 1, } \ No newline at end of file