forked from Sidoine/Ovale
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Recount.lua
79 lines (71 loc) · 2.26 KB
/
Recount.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
--[[--------------------------------------------------------------------
Copyright (C) 2009 Sidoine De Wispelaere.
Copyright (C) 2012, 2013, 2014 Johnny C. Lam.
See the file LICENSE.txt for copying permission.
--]]--------------------------------------------------------------------
local OVALE, Ovale = ...
local OvaleRecount = Ovale:NewModule("OvaleRecount")
Ovale.OvaleRecount = OvaleRecount
--<private-static-properties>
local L = nil
local OvaleScore = nil
local Recount = LibStub("AceAddon-3.0"):GetAddon("Recount", true)
local setmetatable = setmetatable
-- GLOBALS: GameTooltip
-- GLOBALS: LibStub
--</private-static-properties>
--<private-static-methods>
local function DataModes(self, data, num)
if not data then
return 0, 0
end
local fight = data.Fights[Recount.db.profile.CurDataSet]
local score
if fight and fight.Ovale and fight.OvaleMax then
score = fight.Ovale * 1000 / fight.OvaleMax
else
score = 0
end
if num == 1 then
return score
end
return score, nil
end
local function TooltipFuncs(self, name, data)
local SortedData, total
GameTooltip:ClearLines()
GameTooltip:AddLine(name)
-- Recount:AddSortedTooltipData(L["Top 3"].." Ovale",data and data.Fights[Recount.db.profile.CurDataSet] and data.Fights[Recount.db.profile.CurDataSet].Ovale,3)
-- GameTooltip:AddLine("<"..L["Click for more Details"]..">",0,0.9,0)
end
--</private-static-methods>
--<public-static-methods>
function OvaleRecount:OnInitialize()
OvaleScore = Ovale.OvaleScore
if Recount then
local AceLocale = LibStub("AceLocale-3.0", true)
local L = AceLocale and AceLocale:GetLocale("Recount", true)
if not L then
L = setmetatable({}, { __index = function(t, k) t[k] = k; return k; end })
end
Recount:AddModeTooltip(OVALE, DataModes, TooltipFuncs, nil, nil, nil, nil)
end
end
function OvaleRecount:OnEnable()
if Recount then
OvaleScore:RegisterDamageMeter("OvaleRecount", self, "ReceiveScore")
end
end
function OvaleRecount:OnDisable()
OvaleScore:UnregisterDamageMeter("OvaleRecount")
end
function OvaleRecount:ReceiveScore(name, guid, scored, scoreMax)
if Recount then
local source = Recount.db2.combatants[name]
if source then
Recount:AddAmount(source, OVALE, scored)
Recount:AddAmount(source, OVALE .. "Max", scoreMax)
end
end
end
--</public-static-methods>