-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRaidInfo.lua
62 lines (58 loc) · 2.02 KB
/
RaidInfo.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
local _, core = ...
local module
module = core:NewModule("RaidInfo", {
type = "data source",
label = "Raid info",
icon = [[Interface\Icons\Ability_TownWatch]],
OnClick = function(self, button)
ToggleRaidFrame(2)
if RaidFrame:IsVisible() then
RaidInfoFrame:Show()
end
end,
OnTooltipShow = function(self)
self:AddLine("Raid info", HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b)
local isSaved
for i = 1, GetNumSavedInstances() do
local instanceName, instanceID, instanceReset, instanceDifficulty, locked, extended, _, isRaid, maxPlayers, difficultyName, maxBosses, numDefeatedBosses = GetSavedInstanceInfo(i)
if locked or extended then
self:AddLine(format("%s (%s)", instanceName, difficultyName))
if numDefeatedBosses < maxBosses then
for encounterIndex = 1, maxBosses do
local encounterName, _, defeated = GetSavedInstanceEncounterInfo(i, encounterIndex)
local color
if defeated then
color = RED_FONT_COLOR
else
color = GREEN_FONT_COLOR
end
self:AddDoubleLine(" "..encounterName, defeated and BOSS_DEAD or BOSS_ALIVE, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b, color.r, color.g, color.b)
end
else
self:AddLine(" Cleared", RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b)
end
isSaved = true
end
end
for i = 1, GetNumSavedWorldBosses() do
self:AddLine(GetSavedWorldBossInfo(i))
self:AddLine(" "..BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b)
isSaved = true
end
if not isSaved then
self:AddLine("Not saved to any instances")
end
RequestRaidInfo()
module.tooltipOwner = self:GetOwner()
end
})
function module:OnInitialize()
self:RegisterEvent("UPDATE_INSTANCE_INFO", "UpdateTooltip")
end
function module:UpdateTooltip()
if self.tooltipOwner and GameTooltip:IsOwned(self.tooltipOwner) then
GameTooltip:ClearLines()
self.OnTooltipShow(GameTooltip)
GameTooltip:Show()
end
end