This commit is contained in:
Bunny67
2018-07-07 19:29:30 +03:00
parent 7b9ba50490
commit d4ca4e6268
5 changed files with 151 additions and 39 deletions
+18
View File
@@ -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
@@ -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
+1
View File
@@ -3,4 +3,5 @@
<Script file="LibBabble-3.0.lua"/>
<Script file="LibBabble-Class-3.0.lua"/>
<Script file="LibBabble-Zone-3.0.lua"/>
<Script file="LibBabble-BagFamily-3.0.lua"/>
</Ui>
+7 -11
View File
@@ -20,7 +20,6 @@ local DeleteCursorItem = DeleteCursorItem
local GetContainerItemCooldown = GetContainerItemCooldown
local GetContainerItemInfo = GetContainerItemInfo
local GetContainerItemLink = GetContainerItemLink
local GetContainerNumFreeSlots = GetContainerNumFreeSlots
local GetContainerNumSlots = GetContainerNumSlots
local GetItemInfo = GetItemInfo
local GetItemQualityColor = GetItemQualityColor
@@ -49,13 +48,11 @@ local SEARCH = SEARCH
local SEARCH_STRING = ""
B.ProfessionColors = {
["0x0008"] = {224/255, 187/255, 74/255}, -- Leatherworking
["0x0010"] = {74/255, 77/255, 224/255}, -- Inscription
["0x0020"] = {18/255, 181/255, 32/255}, -- Herbs
["0x0040"] = {160/255, 3/255, 168/255}, -- Enchanting
["0x0080"] = {232/255, 118/255, 46/255}, -- Engineering
["0x0400"] = {105/255, 79/255, 7/255}, -- Mining
["0x010000"] = {222/255, 13/255, 65/255} -- Cooking
["8"] = {224/255, 187/255, 74/255}, -- Leatherworking
["16"] = {18/255, 181/255, 32/255}, -- Herbs
["32"] = {160/255, 3/255, 168/255}, -- Enchanting
["64"] = {232/255, 118/255, 46/255}, -- Engineering
["128"] = {105/255, 79/255, 7/255}, -- Mining
}
function B:GetContainerFrame(arg)
@@ -234,7 +231,7 @@ function B:UpdateSlot(bagID, slotID)
if (self.Bags[bagID] and self.Bags[bagID].numSlots ~= GetContainerNumSlots(bagID)) or not self.Bags[bagID] or not self.Bags[bagID][slotID] then return end
local slot = self.Bags[bagID][slotID]
local bagType = self.Bags[bagID].type
local bagType = tostring(self.Bags[bagID].type)
local texture, count, locked = GetContainerItemInfo(bagID, slotID)
local clink = GetContainerItemLink(bagID, slotID)
@@ -452,11 +449,10 @@ function B:Layout(isBank)
end
f.Bags[bagID].numSlots = numSlots
local link = GetInventoryItemLink("player", ContainerIDToInventoryID(bagID))
if link then
local _, _, id = strfind(link, "item:(%d+)")
f.Bags[bagID].type = select(6, GetItemInfo(id))
f.Bags[bagID].type = GetItemFamily(id)
end
--Hide unused slots
+3 -28
View File
@@ -362,31 +362,6 @@ function B:ScanBags()
end
end
local bagTypes = {
["Bag"] = 0,
["Quiver"] = 1,
["Ammo Pouch"] = 2,
["Soul Bag"] = 4,
["Leatherworking Bag"] = 8,
["Herb Bag"] = 16,
["Enchanting Bag"] = 32,
["Engineering Bag"] = 64,
["Mining Bag"] = 128
}
local function GetItemFamily(bag)
local bagID = match(bag, "item:(%d+)")
local itemType
if bagID then
itemType = select(6, GetItemInfo(bagID))
if itemType then
return tonumber(bagTypes[itemType])
end
end
return nil
end
function B:IsSpecialtyBag(bagID)
if safe[bagID] then return false end
@@ -396,7 +371,7 @@ function B:IsSpecialtyBag(bagID)
local bag = GetInventoryItemLink("player", inventorySlot)
if not bag then return false end
local family = GetItemFamily(bag)
local family = GetItemFamily(match(bag, "item:(%d+)"))
if family == 0 or family == nil then return false end
return family
@@ -404,14 +379,14 @@ end
function B:CanItemGoInBag(bag, slot, targetBag)
local item = bagIDs[B:Encode_BagSlot(bag, slot)]
local itemFamily = GetItemFamily(item)
local itemFamily = GetItemFamily(match(item, "item:(%d+)"))
if itemFamily then
local equipSlot = select(8, GetItemInfo(item))
if equipSlot == "INVTYPE_BAG" then
itemFamily = 1
end
end
local bagFamily = GetItemFamily(targetBag)
local bagFamily = GetItemFamily(match(targetBag, "item:(%d+)"))
if itemFamily then
return (bagFamily == 0) or band(itemFamily, bagFamily) > 0
else