zz_Itemlevel/prefs.lua

23 lines
810 B
Lua
Raw Permalink Normal View History

2021-04-20 12:45:59 +00:00
local addonName, addon = ...
local childName = addon['childName']
local child = addon[childName]
2021-04-21 13:31:08 +00:00
local L = LibStub("AceLocale-3.0"):GetLocale(childName, true)
function child:PrefChanged()
local digit = child['db']['digits'] or 1
if(digit > 0) then
child['frm_digits'] = format("%%.%if", digit)
else
child['frm_digits'] = "%i"
end
child.events.PLAYER_AVG_ITEM_LEVEL_UPDATE()
end
2021-04-20 12:45:59 +00:00
local init = {
Setup = function(self)
local config = LibStub:GetLibrary("zzConfig")
local options = child['options']
local main = options['args'][childName]
-- print("setup prefs", childName)
2021-04-21 13:31:08 +00:00
config:AddConfigEntry(main, "digits", "range", L['Digits'], L['Number of digits after the decimal point'], 1, 0, 5, 1, false)
2021-04-20 12:45:59 +00:00
end
}
2021-04-21 13:31:08 +00:00
addon.RegisterCallback(init, format("Init%s", childName), 'Setup')