bags: initial draft of movable bags

This commit is contained in:
Unknown
2018-04-26 23:11:58 +02:00
committed by shagu
parent 5e5596821a
commit cd7642da09
12 changed files with 64 additions and 6 deletions
+4
View File
@@ -81,6 +81,10 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("appearance", "infight", "screen", "0")
pfUI:UpdateConfig("appearance", "bags", "borderlimit", "1")
pfUI:UpdateConfig("appearance", "bags", "borderonlygear", "0")
pfUI:UpdateConfig("appearance", "bags", "movable", "0")
pfUI:UpdateConfig("appearance", "bags", "icon_size", "22")
pfUI:UpdateConfig("appearance", "bags", "bagrowlength", "11")
pfUI:UpdateConfig("appearance", "bags", "bankrowlength", "11")
pfUI:UpdateConfig("appearance", "minimap", "mouseoverzone", "0")
pfUI:UpdateConfig("appearance", "minimap", "coordsloc", "bottomleft")
pfUI:UpdateConfig("appearance", "minimap", "tracking_size", "16")
+2
View File
@@ -256,6 +256,8 @@ pfUI_translation["deDE"] = {
["Invert Health Bar"] = nil,
["is not allowed in profile name"] = nil,
["Item Durability"] = nil,
["Items in a row (bag)"] = nil,
["Items in a row (bank)"] = nil,
["KLH Threat Meter (Dock)"] = nil,
["KLH Threat Meter (Skin)"] = nil,
["Language"] = nil,
+2
View File
@@ -256,6 +256,8 @@ pfUI_translation["enUS"] = {
["Invert Health Bar"] = nil,
["is not allowed in profile name"] = nil,
["Item Durability"] = nil,
["Items in a row (bag)"] = nil,
["Items in a row (bank)"] = nil,
["KLH Threat Meter (Dock)"] = nil,
["KLH Threat Meter (Skin)"] = nil,
["Language"] = nil,
+2
View File
@@ -256,6 +256,8 @@ pfUI_translation["esES"] = {
["Invert Health Bar"] = "Invertir la Barra de Salud",
["is not allowed in profile name"] = "no se permite en el nombe de perfil",
["Item Durability"] = "Durabilidad del Objeto",
["Items in a row (bag)"] = nil,
["Items in a row (bank)"] = nil,
["KLH Threat Meter (Dock)"] = "KLH Threat Meter (Dársena)",
["KLH Threat Meter (Skin)"] = "KLH Threat Meter (Piel)",
["Language"] = "Idioma",
+2
View File
@@ -256,6 +256,8 @@ pfUI_translation["frFR"] = {
["Invert Health Bar"] = "Inverser les barres de vie",
["is not allowed in profile name"] = "n'est pas autorisé comme nom de profil",
["Item Durability"] = "Durabilité des objets",
["Items in a row (bag)"] = nil,
["Items in a row (bank)"] = nil,
["KLH Threat Meter (Dock)"] = "KLH Threat Meter (Accroche)",
["KLH Threat Meter (Skin)"] = "KLH Threat Meter (Apparence)",
["Language"] = "Langage",
+2
View File
@@ -256,6 +256,8 @@ pfUI_translation["koKR"] = {
["Invert Health Bar"] = "체력바 반전",
["is not allowed in profile name"] = "프로필 이름에 허용되지 않습니다.",
["Item Durability"] = "아이템 내구도",
["Items in a row (bag)"] = nil,
["Items in a row (bank)"] = nil,
["KLH Threat Meter (Dock)"] = "KLH 어그로 미터기 (독)",
["KLH Threat Meter (Skin)"] = "KLH 어그로 미터기 (스킨)",
["Language"] = "언어 선택",
+2
View File
@@ -256,6 +256,8 @@ pfUI_translation["ruRU"] = {
["Invert Health Bar"] = "Инвертировать панель здоровья",
["is not allowed in profile name"] = "не разрешено в имени профиля",
["Item Durability"] = "Прочность предметов",
["Items in a row (bag)"] = nil,
["Items in a row (bank)"] = nil,
["KLH Threat Meter (Dock)"] = "KLH Threat Meter (панель)",
["KLH Threat Meter (Skin)"] = "KLH Threat Meter (оболочка)",
["Language"] = "Язык",
+2
View File
@@ -256,6 +256,8 @@ pfUI_translation["zhCN"] = {
["Invert Health Bar"] = "血量反色显示",
["is not allowed in profile name"] = "在配置文件名中不允许",
["Item Durability"] = "装备耐久",
["Items in a row (bag)"] = nil,
["Items in a row (bank)"] = nil,
["KLH Threat Meter (Dock)"] = "KLH Threat Meter (停靠)",
["KLH Threat Meter (Skin)"] = "KLH Threat Meter (皮肤)",
["Language"] = "语言",
+2
View File
@@ -256,6 +256,8 @@ pfUI_translation["zhTW"] = {
["Invert Health Bar"] = "血量反色顯示",
["is not allowed in profile name"] = "在設定檔名中不允許",
["Item Durability"] = "裝備耐久",
["Items in a row (bag)"] = nil,
["Items in a row (bank)"] = nil,
["KLH Threat Meter (Dock)"] = "KLH Threat Meter (停靠)",
["KLH Threat Meter (Skin)"] = "KLH Threat Meter (皮膚)",
["Language"] = "語言",
+39 -5
View File
@@ -169,10 +169,25 @@ pfUI:RegisterModule("bags", function ()
local y = 0
local frame = {}
local iterate = {}
-- default length with fixed windows
local rowlength = 11
if object == "bank" then
if not pfUI.bag.left then pfUI.bag.left = CreateFrame("Frame", "pfBank", UIParent) end
if pfUI.chat then
if C.appearance.bags.movable == "1" then
rowlength = C.appearance.bags.bankrowlength
pfUI.bag.left:SetWidth((C.appearance.bags.icon_size + default_border*3) * rowlength - default_border)
-- avoiding stretching. 0.5 because math rounding
local horizontalmargin = GetScreenWidth()/2 - pfUI.bag.left:GetWidth()/2 - 4.5 - default_border
local verticalmargin = GetScreenHeight()/2 - pfUI.bag.left:GetHeight()/2 - 4.5 - default_border
pfUI.bag.left:SetPoint("CENTER", UIParent, -horizontalmargin, -verticalmargin)
pfUI.bag.left:SetMovable(1)
pfUI.bag.left:SetUserPlaced(1)
pfUI.bag.left:RegisterForDrag("LeftButton")
pfUI.bag.left:SetScript("OnDragStart", function() this:StartMoving() end)
pfUI.bag.left:SetScript("OnDragStop", function() this:StopMovingOrSizing() end)
elseif pfUI.chat then
pfUI.bag.left:SetPoint("BOTTOMLEFT", pfUI.chat.left, "BOTTOMLEFT", 0, 0)
pfUI.bag.left:SetPoint("BOTTOMRIGHT", pfUI.chat.left, "BOTTOMRIGHT", 0, 0)
pfUI.bag.left:SetWidth(C.chat.left.width * pfUI.chat.left:GetScale())
@@ -180,12 +195,26 @@ pfUI:RegisterModule("bags", function ()
pfUI.bag.left:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 5, 5)
pfUI.bag.left:SetWidth(C.chat.left.width)
end
pfUI.bag.left:EnableMouse(1)
iterate = pfUI.BANK
frame = pfUI.bag.left
else
if not pfUI.bag.right then pfUI.bag.right = CreateFrame("Frame", "pfBag", UIParent) end
if pfUI.chat then
if C.appearance.bags.movable == "1" then
rowlength = C.appearance.bags.bagrowlength
pfUI.bag.right:SetWidth((C.appearance.bags.icon_size + default_border*3) * rowlength - default_border)
-- avoiding stretching. 0.5 because math rounding
local horizontalmargin = GetScreenWidth()/2 - pfUI.bag.right:GetWidth()/2 - 4.5 - default_border
local verticalmargin = GetScreenHeight()/2 - pfUI.bag.right:GetHeight()/2 - 4.5 - default_border
pfUI.bag.right:SetPoint("CENTER", UIParent, horizontalmargin, -verticalmargin)
pfUI.bag.right:SetMovable(1)
pfUI.bag.right:SetUserPlaced(1)
pfUI.bag.right:RegisterForDrag("LeftButton")
pfUI.bag.right:SetScript("OnDragStart", function() this:StartMoving() end)
pfUI.bag.right:SetScript("OnDragStop", function() this:StopMovingOrSizing() end)
elseif pfUI.chat then
pfUI.bag.right:SetPoint("BOTTOMLEFT", pfUI.chat.right, "BOTTOMLEFT", 0, 0)
pfUI.bag.right:SetPoint("BOTTOMRIGHT", pfUI.chat.right, "BOTTOMRIGHT", 0, 0)
pfUI.bag.right:SetWidth(C.chat.right.width * pfUI.chat.right:GetScale())
@@ -193,18 +222,22 @@ pfUI:RegisterModule("bags", function ()
pfUI.bag.right:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -5, 5)
pfUI.bag.right:SetWidth(C.chat.right.width)
end
pfUI.bag.right:EnableMouse(1)
iterate = pfUI.BACKPACK
frame = pfUI.bag.right
end
pfUI.bag:CreateAdditions(frame)
frame:SetFrameStrata("HIGH")
CreateBackdrop(frame, default_border)
pfUI.bag.button_size = (frame:GetWidth() - 2*default_border - 9*default_border*3)/ 10
local topspace = pfUI.bag.right.close:GetHeight() + default_border * 2
if C.appearance.bags.movable == "1" then
pfUI.bag.button_size = C.appearance.bags.icon_size
else
pfUI.bag.button_size = (frame:GetWidth() - 2*default_border - (rowlength-1)*default_border*3)/ rowlength
end
for id, bag in pairs(iterate) do
if not pfUI.bags[bag] then
@@ -222,10 +255,11 @@ pfUI:RegisterModule("bags", function ()
pfUI.bags[bag].slots[slot].frame:SetPoint("TOPLEFT",
default_border + x*(pfUI.bag.button_size+default_border*3),
-default_border*2 - y*(pfUI.bag.button_size+default_border*3) - topspace)
pfUI.bags[bag].slots[slot].frame:SetHeight(pfUI.bag.button_size)
pfUI.bags[bag].slots[slot].frame:SetWidth(pfUI.bag.button_size)
if x >= 9 then
if x >= rowlength - 1 then
y = y + 1
x = 0
else
+4
View File
@@ -918,6 +918,10 @@ pfUI:RegisterModule("gui", function ()
if not this.setup then
CreateConfig(nil, this, T["Disable Item Quality Color For \"Common\" Items"], C.appearance.bags, "borderlimit", "checkbox")
CreateConfig(nil, this, T["Enable Item Quality Color For Equipment Only"], C.appearance.bags, "borderonlygear", "checkbox")
CreateConfig(nil, this, T["Enable Movable Bags"], C.appearance.bags, "movable", "checkbox")
CreateConfig(nil, this, T["Icon Size"], C.appearance.bags, "icon_size")
CreateConfig(nil, this, T["Bagslots Per Row"], C.appearance.bags, "bagrowlength")
CreateConfig(nil, this, T["Bankslots Per Row"], C.appearance.bags, "bankrowlength")
CreateConfig(nil, this, T["Auto Sell Grey Items"], C.global, "autosell", "checkbox")
CreateConfig(nil, this, T["Auto Repair Items"], C.global, "autorepair", "checkbox")
this.setup = true
+1 -1
View File
@@ -87,7 +87,7 @@ pfUI:RegisterModule("tooltip", function ()
anchor = pfUI.chat.right
end
if pfUI.bag and pfUI.bag.right and pfUI.bag.right:IsShown() then
if pfUI.bag and pfUI.bag.right and pfUI.bag.right:IsShown() and C.appearance.bags.movable == "0" then
anchor = pfUI.bag.right
end