From 7b1074d42773fd66b8e8bf48dea838d8632d051a Mon Sep 17 00:00:00 2001 From: Bunny67 Date: Tue, 10 Jul 2018 21:09:05 +0300 Subject: [PATCH] test sort --- !Compatibility/api/wowAPI.lua | 216 +++++++++++++++++- ....0.lua => LibBabble-ItemBagFamily-3.0.lua} | 46 +--- !Compatibility/libs/libs.xml | 2 +- ElvUI/Modules/Bags/Bags.lua | 9 +- ElvUI/Modules/Bags/Sort.lua | 25 +- 5 files changed, 238 insertions(+), 60 deletions(-) rename !Compatibility/libs/{LibBabble-ItemFamily-3.0.lua => LibBabble-ItemBagFamily-3.0.lua} (61%) diff --git a/!Compatibility/api/wowAPI.lua b/!Compatibility/api/wowAPI.lua index d29bc2f..97bfda3 100644 --- a/!Compatibility/api/wowAPI.lua +++ b/!Compatibility/api/wowAPI.lua @@ -266,16 +266,207 @@ function GetMapNameByID(id) return mapByID[tonumber(id)] end +local t = { + [6218] = 16, + [6339] = 16, + [6342] = 16, + [6344] = 16, + [6346] = 16, + [6347] = 16, + [6348] = 16, + [6349] = 16, + [6375] = 16, + [6377] = 16, + [10938] = 16, + [10939] = 16, + [10940] = 16, + [10978] = 16, + [10998] = 16, + [11038] = 16, + [11039] = 16, + [11081] = 16, + [11082] = 16, + [11083] = 16, + [11084] = 16, + [11098] = 16, + [11101] = 16, + [11130] = 16, + [11134] = 16, + [11135] = 16, + [11137] = 16, + [11138] = 16, + [11139] = 16, + [11145] = 16, + [11150] = 16, + [11151] = 16, + [11152] = 16, + [11163] = 16, + [11164] = 16, + [11165] = 16, + [11166] = 16, + [11167] = 16, + [11168] = 16, + [11174] = 16, + [11175] = 16, + [11176] = 16, + [11177] = 16, + [11178] = 16, + [11202] = 16, + [11203] = 16, + [11204] = 16, + [11205] = 16, + [11206] = 16, + [11207] = 16, + [11208] = 16, + [11224] = 16, + [11225] = 16, + [11226] = 16, + [11813] = 16, + [14343] = 16, + [14344] = 16, + [16202] = 16, + [16203] = 16, + [16204] = 16, + [16207] = 16, + [16214] = 16, + [16215] = 16, + [16216] = 16, + [16217] = 16, + [16218] = 16, + [16219] = 16, + [16220] = 16, + [16221] = 16, + [16222] = 16, + [16223] = 16, + [16224] = 16, + [16242] = 16, + [16243] = 16, + [16244] = 16, + [16245] = 16, + [16246] = 16, + [16247] = 16, + [16248] = 16, + [16249] = 16, + [16250] = 16, + [16251] = 16, + [16252] = 16, + [16253] = 16, + [16254] = 16, + [16255] = 16, + [17725] = 16, + [18259] = 16, + [18260] = 16, + [19444] = 16, + [19445] = 16, + [19446] = 16, + [19447] = 16, + [19448] = 16, + [19449] = 16, + [20634] = 16, + [20725] = 16, + [20726] = 16, + [20727] = 16, + [20728] = 16, + [20729] = 16, + [20730] = 16, + [20731] = 16, + [20732] = 16, + [20733] = 16, + [20735] = 16, + [20736] = 16, + [20752] = 16, + [20753] = 16, + [20754] = 16, + [20755] = 16, + [20756] = 16, + [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, +} + local bagTypes = { - [LBIF["Bag"]] = 0, [LBIF["Quiver"]] = 1, [LBIF["Ammo Pouch"]] = 2, [LBIF["Soul Bag"]] = 4, - [LBIF["Leatherworking Bag"]] = 8, - [LBIF["Herb Bag"]] = 16, - [LBIF["Enchanting Bag"]] = 32, - [LBIF["Engineering Bag"]] = 64, - [LBIF["Mining Bag"]] = 128 + [LBIF["Herb Bag"]] = 8, + [LBIF["Enchanting Bag"]] = 16, } function GetItemFamily(id) @@ -286,8 +477,19 @@ function GetItemFamily(id) id = match(id, "item:(%d+)") end + return t[id] or 0 +end + +function GetBagFamily(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+)") + end + local _, _, _, _, _, itemType = GetItemInfo(id) - return bagTypes[itemType] + return bagTypes[itemType] or 0 end local arrow diff --git a/!Compatibility/libs/LibBabble-ItemFamily-3.0.lua b/!Compatibility/libs/LibBabble-ItemBagFamily-3.0.lua similarity index 61% rename from !Compatibility/libs/LibBabble-ItemFamily-3.0.lua rename to !Compatibility/libs/LibBabble-ItemBagFamily-3.0.lua index 7850f95..58c990c 100644 --- a/!Compatibility/libs/LibBabble-ItemFamily-3.0.lua +++ b/!Compatibility/libs/LibBabble-ItemBagFamily-3.0.lua @@ -8,114 +8,78 @@ if not lib then return end local GAME_LOCALE = GetLocale() lib:SetBaseTranslations { - ["Bag"] = true, ["Quiver"] = true, ["Ammo Pouch"] = true, ["Soul Bag"] = true, - ["Leatherworking Bag"] = true, ["Herb Bag"] = true, ["Enchanting Bag"] = true, - ["Engineering Bag"] = true, - ["Mining Bag"] = true, } if GAME_LOCALE == "enUS" then lib:SetCurrentTranslations(true) elseif GAME_LOCALE == "deDE" then lib:SetCurrentTranslations { - ["Bag"] = "Bag", ["Quiver"] = "Quiver", ["Ammo Pouch"] = "Ammo Pouch", ["Soul Bag"] = "Soul Bag", - ["Leatherworking Bag"] = "Leatherworking Bag", ["Herb Bag"] = "Herb Bag", ["Enchanting Bag"] = "Enchanting Bag", - ["Engineering Bag"] = "Engineering Bag", - ["Mining Bag"] = "Mining Bag", } elseif GAME_LOCALE == "frFR" then lib:SetCurrentTranslations { - ["Bag"] = "Bag", ["Quiver"] = "Quiver", ["Ammo Pouch"] = "Ammo Pouch", ["Soul Bag"] = "Soul Bag", - ["Leatherworking Bag"] = "Leatherworking Bag", ["Herb Bag"] = "Herb Bag", ["Enchanting Bag"] = "Enchanting Bag", - ["Engineering Bag"] = "Engineering Bag", - ["Mining Bag"] = "Mining Bag", } elseif GAME_LOCALE == "zhCN" then lib:SetCurrentTranslations { - ["Bag"] = "Bag", ["Quiver"] = "Quiver", ["Ammo Pouch"] = "Ammo Pouch", ["Soul Bag"] = "Soul Bag", - ["Leatherworking Bag"] = "Leatherworking Bag", ["Herb Bag"] = "Herb Bag", ["Enchanting Bag"] = "Enchanting Bag", - ["Engineering Bag"] = "Engineering Bag", - ["Mining Bag"] = "Mining Bag", } elseif GAME_LOCALE == "zhTW" then lib:SetCurrentTranslations { - ["Bag"] = "Bag", ["Quiver"] = "Quiver", ["Ammo Pouch"] = "Ammo Pouch", ["Soul Bag"] = "Soul Bag", - ["Leatherworking Bag"] = "Leatherworking Bag", ["Herb Bag"] = "Herb Bag", ["Enchanting Bag"] = "Enchanting Bag", - ["Engineering Bag"] = "Engineering Bag", - ["Mining Bag"] = "Mining Bag", } elseif GAME_LOCALE == "koKR" then lib:SetCurrentTranslations { - ["Bag"] = "Bag", ["Quiver"] = "Quiver", ["Ammo Pouch"] = "Ammo Pouch", ["Soul Bag"] = "Soul Bag", - ["Leatherworking Bag"] = "Leatherworking Bag", ["Herb Bag"] = "Herb Bag", ["Enchanting Bag"] = "Enchanting Bag", - ["Engineering Bag"] = "Engineering Bag", - ["Mining Bag"] = "Mining Bag", } elseif GAME_LOCALE == "esES" then lib:SetCurrentTranslations { - ["Bag"] = "Bag", ["Quiver"] = "Quiver", ["Ammo Pouch"] = "Ammo Pouch", ["Soul Bag"] = "Soul Bag", - ["Leatherworking Bag"] = "Leatherworking Bag", ["Herb Bag"] = "Herb Bag", ["Enchanting Bag"] = "Enchanting Bag", - ["Engineering Bag"] = "Engineering Bag", - ["Mining Bag"] = "Mining Bag", } elseif GAME_LOCALE == "esMX" then lib:SetCurrentTranslations { - ["Bag"] = "Bag", ["Quiver"] = "Quiver", ["Ammo Pouch"] = "Ammo Pouch", ["Soul Bag"] = "Soul Bag", - ["Leatherworking Bag"] = "Leatherworking Bag", ["Herb Bag"] = "Herb Bag", ["Enchanting Bag"] = "Enchanting Bag", - ["Engineering Bag"] = "Engineering Bag", - ["Mining Bag"] = "Mining Bag", } elseif GAME_LOCALE == "ruRU" then lib:SetCurrentTranslations { - ["Bag"] = "Bag", - ["Quiver"] = "Quiver", - ["Ammo Pouch"] = "Ammo Pouch", - ["Soul Bag"] = "Soul Bag", - ["Leatherworking Bag"] = "Leatherworking Bag", - ["Herb Bag"] = "Herb Bag", - ["Enchanting Bag"] = "Enchanting Bag", - ["Engineering Bag"] = "Engineering Bag", - ["Mining Bag"] = "Mining Bag", + ["Quiver"] = "Колчан", + ["Ammo Pouch"] = "Подсумок", + ["Soul Bag"] = "Сумка душ", + ["Herb Bag"] = "Сумка травника", + ["Enchanting Bag"] = "Сумка зачаровывателя", } else error(string.format("%s: Locale %q not supported", MAJOR_VERSION, GAME_LOCALE)) diff --git a/!Compatibility/libs/libs.xml b/!Compatibility/libs/libs.xml index 0f9f29d..c30f819 100644 --- a/!Compatibility/libs/libs.xml +++ b/!Compatibility/libs/libs.xml @@ -3,5 +3,5 @@