panel: add bagspace calculation

This commit is contained in:
Sqoops
2017-06-26 22:23:06 +02:00
committed by shagu
parent f95714a1f2
commit 6c8d4944ee
9 changed files with 32 additions and 3 deletions
+1
View File
@@ -17,6 +17,7 @@ pfUI_translation["deDE"] = {
["Background Color"] = nil,
["Bags & Bank"] = nil,
["Bags Border Size"] = nil,
["Bagspace"] = nil,
["Border Color"] = nil,
["Bottom"] = nil,
["Buff Limit"] = nil,
+1
View File
@@ -17,6 +17,7 @@ pfUI_translation["enGB"] = {
["Background Color"] = nil,
["Bags & Bank"] = nil,
["Bags Border Size"] = nil,
["Bagspace"] = nil,
["Border Color"] = nil,
["Bottom"] = nil,
["Buff Limit"] = nil,
+1
View File
@@ -17,6 +17,7 @@ pfUI_translation["frFR"] = {
["Background Color"] = "Couleur de l'arrière-plan",
["Bags & Bank"] = "Sacs et Banque",
["Bags Border Size"] = "Taille de la bordure des Sacs",
["Bagspace"] = nil,
["Border Color"] = "Couleur de la bordure",
["Bottom"] = "Bas",
["Buff Limit"] = "Limite des améliorations",
+1
View File
@@ -17,6 +17,7 @@ pfUI_translation["koKR"] = {
["Background Color"] = "백그라운드 색상",
["Bags & Bank"] = "가방&은행",
["Bags Border Size"] = "가방 테두리 크기",
["Bagspace"] = nil,
["Border Color"] = "테두리 색상",
["Bottom"] = "아래",
["Buff Limit"] = "버프 한도",
+1
View File
@@ -17,6 +17,7 @@ pfUI_translation["ruRU"] = {
["Background Color"] = nil,
["Bags & Bank"] = nil,
["Bags Border Size"] = nil,
["Bagspace"] = nil,
["Border Color"] = nil,
["Bottom"] = nil,
["Buff Limit"] = nil,
+1
View File
@@ -17,6 +17,7 @@ pfUI_translation["zhCN"] = {
["Background Color"] = "聊天窗口背景颜色",
["Bags & Bank"] = "背包和银行",
["Bags Border Size"] = "背包边框大小",
["Bagspace"] = nil,
["Border Color"] = "边框颜色",
["Bottom"] = "底部",
["Buff Limit"] = "Buff总数量",
+2 -1
View File
@@ -17,6 +17,7 @@ pfUI_translation["zhTW"] = {
["Background Color"] = "聊天窗口背景顏色",
["Bags & Bank"] = "背包和銀行",
["Bags Border Size"] = "背包邊框大小",
["Bagspace"] = nil,
["Border Color"] = "邊框顏色",
["Bottom"] = "底部",
["Buff Limit"] = "Buff總數量",
@@ -280,4 +281,4 @@ pfUI_translation["zhTW"] = {
["WIM"] = "WIM",
["XP Percentage"] = "經驗百分比",
["Zone Name"] = "區域名稱",
}
}
+2 -1
View File
@@ -634,7 +634,8 @@ pfUI:RegisterModule("gui", function ()
"zone:" .. T["Zone Name"],
"combat:" .. T["Combat Timer"],
"ammo:" .. T["Ammo Counter"],
"soulshard:" .. T["Soulshard Counter"]
"soulshard:" .. T["Soulshard Counter"],
"bagspace:" .. T["Bagspace"]
}
local dropdown_unitframes_portrait_position = {
+22 -1
View File
@@ -25,7 +25,7 @@ pfUI:RegisterModule("panel", function ()
-- list of available panel fields
pfUI.panel.options = { "time", "fps", "exp", "gold", "friends",
"guild", "durability", "zone", "ammo" }
"guild", "durability", "zone", "ammo", "bagspace" }
pfUI.panel:SetScript("OnEvent", function()
if event == "PLAYER_ENTERING_WORLD" then
@@ -38,11 +38,13 @@ pfUI:RegisterModule("panel", function ()
pfUI.panel:UpdateZone()
pfUI.panel:UpdateAmmo()
pfUI.panel:UpdateSoulshard()
pfUI.panel:UpdateBagspace()
elseif event == "PLAYER_MONEY" then
pfUI.panel:UpdateGold()
pfUI.panel:UpdateRepair()
elseif event == "BAG_UPDATE" then
pfUI.panel:UpdateSoulshard()
pfUI.panel:UpdateBagspace()
elseif event == "UNIT_INVENTORY_CHANGED" then
pfUI.panel:UpdateAmmo()
elseif event == "PLAYER_XP_UPDATE" then
@@ -229,6 +231,25 @@ pfUI:RegisterModule("panel", function ()
end
end
-- Update "bagspace"
function pfUI.panel:UpdateBagspace ()
local maxslots = 0
local usedslots = 0
for bag = 0,4 do
local bagsize = GetContainerNumSlots(bag)
maxslots = maxslots + bagsize
for j = 1,bagsize do
link = GetContainerItemLink(bag,j)
if link then
usedslots = usedslots + 1
end
end
end
local freeslots = maxslots - usedslots
pfUI.panel:OutputPanel("bagspace", freeslots .. " (" .. usedslots .. "/" .. maxslots .. ")")
end
-- Update "gold"
function pfUI.panel:UpdateGold ()
local gold = floor(GetMoney()/ 100 / 100)