diff --git a/!Compatibility/api/wowAPI.lua b/!Compatibility/api/wowAPI.lua index 31da465..8970e09 100644 --- a/!Compatibility/api/wowAPI.lua +++ b/!Compatibility/api/wowAPI.lua @@ -26,6 +26,7 @@ local DURABILITY_TEMPLATE = gsub(DURABILITY_TEMPLATE, "%%d / %%d", "(%%d+) / (%% --Libs local LBC = LibStub("LibBabble-Class-3.0"):GetLookupTable() local LBZ = LibStub("LibBabble-Zone-3.0"):GetLookupTable() +local LBBF = LibStub("LibBabble-BagFamily-3.0"):GetLookupTable() CLASS_SORT_ORDER = { "WARRIOR", @@ -265,6 +266,23 @@ function GetMapNameByID(id) return mapByID[tonumber(id)] end +local bagTypes = { + [LBBF["Bag"]] = 0, + [LBBF["Quiver"]] = 1, + [LBBF["Ammo Pouch"]] = 2, + [LBBF["Soul Bag"]] = 4, + [LBBF["Leatherworking Bag"]] = 8, + [LBBF["Herb Bag"]] = 16, + [LBBF["Enchanting Bag"]] = 32, + [LBBF["Engineering Bag"]] = 64, + [LBBF["Mining Bag"]] = 128 +} + +function GetItemFamily(id) + local _, _, _, _, _, itemType = GetItemInfo(id) + return bagTypes[itemType] +end + local arrow function GetPlayerFacing() if not arrow then diff --git a/!Compatibility/libs/LibBabble-BagFamily-3.0.lua b/!Compatibility/libs/LibBabble-BagFamily-3.0.lua new file mode 100644 index 0000000..d60eaba --- /dev/null +++ b/!Compatibility/libs/LibBabble-BagFamily-3.0.lua @@ -0,0 +1,122 @@ +local MAJOR_VERSION = "LibBabble-BagFamily-3.0" +local MINOR_VERSION = 90000 + tonumber(string.match("$Revision: 50 $", "%d+")) + +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 { + ["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", + } +else + error(string.format("%s: Locale %q not supported", MAJOR_VERSION, GAME_LOCALE)) +end \ No newline at end of file diff --git a/!Compatibility/libs/libs.xml b/!Compatibility/libs/libs.xml index b37fb2c..86d700e 100644 --- a/!Compatibility/libs/libs.xml +++ b/!Compatibility/libs/libs.xml @@ -3,4 +3,5 @@