Add prefs to choose what total is displayed in broker and tooltip

This commit is contained in:
rilgamon 2021-03-15 10:35:22 +01:00
parent e6ab43617c
commit 03c4e24880
7 changed files with 72 additions and 10 deletions

View File

@ -18,6 +18,7 @@ local function cdbCheck(n,realm)
db[realm] = db[realm] or {}
db[realm][n] = db[realm][n] or { currentGold = 0 }
end
addonTable.cdbCheck = cdbCheck
local function getSumToday(d)
if(faction=='Neutral') then return 0,0 end
local sumIn,sumOut = 0,0
@ -52,6 +53,7 @@ local function Helper_Tooltip3(realm)
end
end
end
addonTable.Helper_Tooltip3 = Helper_Tooltip3
local function OnClick(self, button)
if(IsShiftKeyDown() and button == "LeftButton") then
local sb = addonTable['db']['global']['ldbicons']
@ -132,11 +134,12 @@ local function OnTooltipShow(tip)
if(m == realm or cr) then
cdbCheck(n, m)
if( faction == db[m][n]['faction']) then
sum = sum + db[m][n]['currentGold']
-- sum = sum + db[m][n]['currentGold']
ttlist[k] = db[m][n]['currentGold']
end
elseif(db['accountMoney']) then
sum = sum + db[m][n]['currentGold']
-- sum = sum + db[m][n]['currentGold']
end
end
end
@ -147,7 +150,7 @@ local function OnTooltipShow(tip)
tip:AddDoubleLine(addonTable:classcolor(n,db[cr and m or realm][n]['class']),addonTable:displayMoney(db[cr and m or realm][n]['currentGold']+(db[cr and m or realm][n]['incoming'] or 0), db['shortMoneyTip']),0,1,0,1,1,1)
end
tip:AddLine(' ')
tip:AddDoubleLine(L['Gesamt'],addonTable:displayMoney(sum, db['shortMoneyTip']),0,1,0,1,1,1)
tip:AddDoubleLine(L['Gesamt'],addonTable:displayMoney(addonTable:GetGold(db['displaySelTT'] or 2), db['shortMoneyTip']),0,1,0,1,1,1)
end
function addonTable:GetBroker(objname)
return LibStub:GetLibrary("zzLDB"):GetLDB(objname)

View File

@ -58,10 +58,35 @@ local specs = {
['profile'] = {
[childName] = {
['disableBanker'] = true,
['displaySelTT'] = 2,
['displaySel'] = 2,
['connectedRealms'] = true
}
}
}
}
function addonTable:GetGold(val)
local val = val or 2
local sums = { dbp['currentGold'], 0, 0, 0 }
if(addonTable['db']['sv']['profileKeys']) then
for k,v in pairs(addonTable['db']['sv']['profileKeys']) do
local n,_,m = strsplit(' ',k,3)
if(n) then
local cr = addonTable.Helper_Tooltip3(m)
addonTable.cdbCheck(n, m)
local ch = db[m][n]
sums[3] = sums[3] + ch['currentGold'] -- global all
if(faction == ch['faction']) then
if(m == realm or cr) then
sums[2] = sums[2] + ch['currentGold'] -- realm/pool faction
end
sums[4] = sums[4] + ch['currentGold'] -- global faction
end
end
end
end
return sums[val]
end
function addonTable:displayMoney(money, abr)
if(abr) then
if(db['shortMoney'] and money>10000)then
@ -103,7 +128,8 @@ function pew_events:PLAYER_MONEY(event)
end
dbp['currentGold'] = money
end
addonTable:OnText(childName, addonTable:displayMoney(money, true))
local sum = addonTable:GetGold(db['displaySel'] or 2)
addonTable:OnText(childName, addonTable:displayMoney(sum, true))
end
function addonTable:PrefChanged(pref, value, oldvalue)
pew_events:PLAYER_MONEY()

View File

@ -45,6 +45,12 @@ if L then
L['noIconDesk'] = "Benutze Text statt M\195\188nzsymbole"
L['Color text'] = "Farbtext"
L['Color text desc'] = "F\195\164rbe den Text in M\195\188nzfarbe"
L['displayMoneyChar'] = "Spieler"
L['displayMoneyRealm'] = "Realm (Pool)"
L['displayMoneyGlobal'] = "Global"
L['displayMoneyGlobalFaction'] = "Global (nur deine Fraktion)"
L['Displayvalue'] = "Broker Anzeige"
L['DisplayvalueDesc'] = "Legt fest welcher Wert im Broker angezeigt wird. Global zeigt alle Fraktionen. Realm zeigt nur die eigene Fraktion (Falls aktiviert auch die verbundenen Realms)."
end
-- ö \195\182 ß \195\159

View File

@ -45,4 +45,10 @@ if L then
L['noIconDesk'] = "Use text instead of coin texture"
L['Color text'] = "Use color text"
L['Color text desc'] = "Colorize text in coin colors"
L['displayMoneyChar'] = "Character"
L['displayMoneyRealm'] = "Realm (Pool)"
L['displayMoneyGlobal'] = "Global"
L['displayMoneyGlobalFaction'] = "Global (only your faction)"
L['Displayvalue'] = "Broker Display"
L['DisplayvalueDesc'] = "Selects the sum diplayed by the broker. Global is for all factions and chars or only your faction. Realm is for your faction (pool when selected)."
end

View File

@ -45,4 +45,10 @@ if L then
L['noIconDesk'] = "Use text instead of coin texture"
L['Color text'] = "Use color text"
L['Color text desc'] = "Colorize text in coin colors"
L['displayMoneyChar'] = "Character"
L['displayMoneyRealm'] = "Realm (Pool)"
L['displayMoneyGlobal'] = "Global"
L['displayMoneyGlobalFaction'] = "Global (only your faction)"
L['Displayvalue'] = "Broker Display"
L['DisplayvalueDesc'] = "Selects the sum diplayed by the broker. Global is for all factions and chars. Realm is for your faction (pool when selected)."
end

View File

@ -45,4 +45,10 @@ if L then
L['noIconDesk'] = "Use text instead of coin texture"
L['Color text'] = "Use color text"
L['Color text desc'] = "Colorize text in coin colors"
L['displayMoneyChar'] = "Character"
L['displayMoneyRealm'] = "Realm (Pool)"
L['displayMoneyGlobal'] = "Global"
L['displayMoneyGlobalFaction'] = "Global (only your faction)"
L['Displayvalue'] = "Broker Display"
L['DisplayvalueDesc'] = "Selects the sum diplayed by the broker. Global is for all factions and chars. Realm is for your faction (pool when selected)."
end

View File

@ -1,5 +1,7 @@
local addonName, addonTable = ...
local db, dbr, faction
local childName = "zz_Money"
local L = LibStub("AceLocale-3.0"):GetLocale(childName, true)
addonTable['bankHandler'] = {
SetDB = function(self, db) self.db = db end,
GetPref = function(self, pref)
@ -25,6 +27,11 @@ local function buildSelect()
end
return sel
end
local buildDisplayValue = {
L['displayMoneyChar'], L['displayMoneyRealm'], L['displayMoneyGlobal'], L['displayMoneyGlobalFaction']
}
local function buildSelectAll()
local sel = {}
local n,m,_
@ -55,11 +62,13 @@ function addonTable:SetupPrefs(childName)
faction = addonTable['storage']['faction']
local config = LibStub:GetLibrary("zzConfig")
local main = addonTable['options']['args'][childName]
config:AddConfigEntry(main, "showLog", "toggle", L['showLog'], nil, 1)
config:AddConfigEntry(main, "shortMoney", "toggle", L['shortMoney'], nil, 2)
config:AddConfigEntry(main, "disableBanker", "toggle", L['nobanker'], nil, 3)
config:AddConfigEntry(main, "abrevK", "toggle", L['abrevK'], nil, 4)
config:AddConfigEntry(main, "abrevM", "toggle", L['abrevM'], nil, 5)
config:AddConfigEntry(main, "displaySel", "select", L['Displayvalue'], L['DisplayvalueDesc'], 1, buildDisplayValue)
config:AddConfigEntry(main, "connectedRealms", "toggle", L['connectedRealms'], nil, 2)
config:AddConfigEntry(main, "showLog", "toggle", L['showLog'], nil, 3)
config:AddConfigEntry(main, "shortMoney", "toggle", L['shortMoney'], nil, 4)
config:AddConfigEntry(main, "disableBanker", "toggle", L['nobanker'], nil, 5)
config:AddConfigEntry(main, "abrevK", "toggle", L['abrevK'], nil, 6)
config:AddConfigEntry(main, "abrevM", "toggle", L['abrevM'], nil, 7)
local noicon = config:AddConfigEntry(main, "noIcon", "toggle", L['noIcon'], L['noIconDesk'], 6)
local noiconColor = config:AddConfigEntry(main, "noIconColor", "toggle", L['Color text'], L['Color text desc'], 7)
noiconColor['disabled'] = function(self) if(not db['noIcon']) then return true end end
@ -69,7 +78,7 @@ end})
config:AddConfigEntry(menu, "maxLimit", "range", L['Maximum Limit'], L['Desc MaxL'], 2, 10, 150000, 5, false)
config:AddConfigEntry(menu, "banker","select",L['Bankier'],nil,3,buildSelect)
local ttmenu = config:AddConfigEntry(main, "ttmenu", "group", L['ttmenu_title'], L['ttmenu_desc'], 9, config:GetDefaultHandler(addonTable['events']['PLAYER_MONEY'], db), true)
config:AddConfigEntry(ttmenu, "connectedRealms", "toggle", L['connectedRealms'], nil, 1)
config:AddConfigEntry(ttmenu, "displaySelTT", "select", L['Gesamt'], L['DisplayvalueDesc'], 1, buildDisplayValue)
config:AddConfigEntry(ttmenu, "sortDir", "toggle", L['sortDir'], nil, 2)
config:AddConfigEntry(ttmenu, "accountMoney", "toggle", L['accountMoney'], L['accountMoneyDesc'], 3)
local short = config:AddConfigEntry(ttmenu, "shortMoneyTip", "toggle", L['shortMoneyTip'], nil, 4)