Add meaningfull tooltip, first locales
This commit is contained in:
parent
723b9927fb
commit
8e65f1eecb
|
@ -2,16 +2,21 @@ local addonName, addon = ...
|
|||
local childName = addon['childName']
|
||||
local child = addon[childName]
|
||||
local zzLDB = LibStub:GetLibrary("zzLDB")
|
||||
local L = LibStub("AceLocale-3.0"):GetLocale(childName, true)
|
||||
local function OnClick(self, button)
|
||||
zzLDB:DefaultOnClick(self, button, addon, childName)
|
||||
end
|
||||
local function OnTooltipShow(tip)
|
||||
tip:AddLine(childName)
|
||||
local avgItemLevel, avgItemLevelEquipped, avgItemLevelPvp = GetAverageItemLevel()
|
||||
tip:AddDoubleLine(L['Itemlevel'], child:colorize(format(child['frm_digits'],avgItemLevel), 'ffffff'))
|
||||
tip:AddDoubleLine(L['Equipped Itemlevel'], child:colorize(format(child['frm_digits'],avgItemLevelEquipped), 'ffffff'))
|
||||
tip:AddDoubleLine(L['PvP'], child:colorize(format(child['frm_digits'],avgItemLevelPvp), 'ffffff'))
|
||||
end
|
||||
child['ldb'] = { -- https://github.com/tekkub/libdatabroker-1-1/wiki/Data-Specifications
|
||||
['type'] = 'data source', -- required: 'data source' or 'launcher'
|
||||
['text'] = childName, -- required/optional for launcher
|
||||
['icon'] = 'Interface\\Icons\\INV_Misc_Bag_10_Blue', -- optional/required for launcher
|
||||
['icon'] = 'Interface\\Icons\\Sha_spell_warlock_demonsoul_nightmare', -- optional/required for launcher
|
||||
['OnClick'] = OnClick, -- optional/required for launcher
|
||||
['OnTooltipShow'] = OnTooltipShow, -- optional
|
||||
}
|
||||
|
|
4
core.lua
4
core.lua
|
@ -3,6 +3,8 @@ local childName = addon['childName']
|
|||
local child = addon[childName]
|
||||
local events = child['events']
|
||||
local db
|
||||
child['frm_digits'] = "%.2f"
|
||||
LibStub("zzHelper"):Embed(child)
|
||||
local function prepareDB()
|
||||
db = addon['db']['profile'][childName]
|
||||
child['db'] = db
|
||||
|
@ -22,7 +24,7 @@ child['specs'] = {
|
|||
}
|
||||
function events:PLAYER_AVG_ITEM_LEVEL_UPDATE()
|
||||
local avgItemLevel, avgItemLevelEquipped, avgItemLevelPvp = GetAverageItemLevel()
|
||||
child:OnText(childName, format("%.2f",avgItemLevelEquipped))
|
||||
child:OnText(childName, format(child['frm_digits'], avgItemLevelEquipped))
|
||||
end
|
||||
function events:PLAYER_ENTERING_WORLD(_, event)
|
||||
child:UnregisterEvent(event)
|
||||
|
|
|
@ -2,5 +2,7 @@ local addonname, addon = ...
|
|||
local childName = addon['childName']
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale(childName, "enUS", true)
|
||||
if L then
|
||||
L[childName] = childName
|
||||
L['Itemlevel'] = true
|
||||
L['Equipped Itemlevel'] = true
|
||||
L['PvP'] = true
|
||||
end
|
Loading…
Reference in New Issue