-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDcr_LDB.lua
191 lines (135 loc) · 5.54 KB
/
Dcr_LDB.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
--[[
This file is part of Decursive.
Decursive (v @project-version@) add-on for World of Warcraft UI
Copyright (C) 2006-2025 John Wellesz (Decursive AT 2072productions.com) ( http://www.2072productions.com/to/decursive.php )
Decursive is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Decursive is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Decursive. If not, see <https://www.gnu.org/licenses/>.
Decursive is inspired from the original "Decursive v1.9.4" by Patrick Bohnet (Quu).
The original "Decursive 1.9.4" is in public domain ( www.quutar.com )
Decursive is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
This file was last updated on @file-date-iso@
--]]
-------------------------------------------------------------------------------
local addonName, T = ...;
-- big ugly scary fatal error message display function {{{
if not T._FatalError then
-- the beautiful error popup : {{{ -
StaticPopupDialogs["DECURSIVE_ERROR_FRAME"] = {
text = "|cFFFF0000Decursive Error:|r\n%s",
button1 = "OK",
OnAccept = function()
return false;
end,
timeout = 0,
whileDead = 1,
hideOnEscape = 1,
showAlert = 1,
preferredIndex = 3,
}; -- }}}
T._FatalError = function (TheError) StaticPopup_Show ("DECURSIVE_ERROR_FRAME", TheError); end
end
-- }}}
if not T._LoadedFiles or not T._LoadedFiles["DCR_init.lua"] then
if not DecursiveInstallCorrupted then T._FatalError("Decursive installation is corrupted! (DCR_init.lua not loaded)"); end;
DecursiveInstallCorrupted = true;
return;
end
T._LoadedFiles["Dcr_LDB.lua"] = false;
local D = T.Dcr;
local L = D.L;
local DC = T._C;
T._CatchAllErrors = 'LibDBIcon';
local icon = LibStub("LibDBIcon-1.0");
T._CatchAllErrors = 'LibQTip';
local LibQTip = LibStub('LibQTip-1.0');
T._CatchAllErrors = 'LibDataBroker';
local LDB = LibStub("LibDataBroker-1.1"):NewDataObject("Decursive", {
type = "launcher",
OnClick = function(Frame, button)
D:QuickAccess(Frame, button);
end,
text = "Decursive",
label = "Decursive",
icon = DC.IconOFF,
});
T._CatchAllErrors = false;
local function ShowToolTip (frame)
if not D.DcrFullyInitialized then
return;
end
--D:Debug("ShowToolTip called");
local HeadFont = D:CreateLQTHFonts();
local tooltip = LibQTip:Acquire("DecursiveGenInfo", 2, "LEFT", "RIGHT");
frame.tooltip = tooltip
tooltip:SetHeaderFont(HeadFont);
local x, y;
-- 1
x, y = tooltip:AddLine();
tooltip:SetCell(x,y,'Decursive', HeadFont,"CENTER",2);
-- 2
--tooltip:AddLine( ("|cFF00FF00%s|r: "):format(D.L["HLP_RIGHTCLICK"]),
-- D.L["STR_OPTIONS"]);
-- 3
tooltip:AddLine( ("|cFF00FF00%s-%s|r: "):format(D.L["ALT"], D.L["HLP_RIGHTCLICK"]),
D.L["BINDING_NAME_DCRSHOWOPTION"]);
-- 4
tooltip:AddLine( ("|cFF00FF00%s-%s|r: "):format(D.L["CTRL"], D.L["HLP_LEFTCLICK"]),
D.L["BINDING_NAME_DCRPRSHOW"]);
-- 5
tooltip:AddLine( ("|cFF00FF00%s-%s|r: "):format(D.L["SHIFT"], D.L["HLP_LEFTCLICK"]),
D.L["BINDING_NAME_DCRSKSHOW"]);
-- 6
tooltip:AddLine( ("|cFF00FF00%s-%s|r: " ):format(D.L["SHIFT"], D.L["HLP_RIGHTCLICK"]),
D.L["BINDING_NAME_DCRSHOW"]);
if (D.db.global.debug) then
tooltip:AddSeparator();
x, y = tooltip:AddLine();
tooltip:SetCell(x,y,'Debugging', HeadFont,"CENTER",2);
tooltip:AddLine("Afflicted units count:", D.ForLLDebuffedUnitsNum);
tooltip:AddLine("Afflicted units count in range:", D.MicroUnitF.UnitsDebuffedInRange);
tooltip:AddLine("Max Concurrent update events:", D.Status.MaxConcurentUpdateDebuff);
tooltip:AddLine("Live timers:", ("Dcr: |cf0d09000%d|r, Lib: |cf0d09000%d|r, Yields: |cf0f06000%d|r, Longest batch: |cf0e07000%dms|r, Largest batch: |cf0d07000%d|r, TotalRun: |cf0d07000%u|r"):format(D:GetTimersInfo()));
tooltip:AddLine("Version annouces received:", T.VersionAnnounceReceived);
tooltip:AddSeparator();
x, y = tooltip:AddLine();
tooltip:SetCell(x,y,'Debuff seen history:', HeadFont,"CENTER",2);
local HistoryIndex = 1;
while HistoryIndex < 10 do
tooltip:AddLine( "|cFFAAFFAA"..HistoryIndex.."|r", (D:Debuff_History_Get (HistoryIndex, true)));
HistoryIndex = HistoryIndex + 1;
end
end
-- Use smart anchoring code to anchor the tooltip to our frame
tooltip:SmartAnchorTo(frame)
-- Show it
tooltip:Show()
end
LDB.OnEnter = function(frame)
ShowToolTip(frame);
end
LDB.OnLeave = function(frame)
LibQTip:Release(frame.tooltip)
frame.tooltip = nil
--D:Debug("Releasing tooltip");
end
function D:SetIcon (icon)
LDB.icon = icon;
end
function D:SetMinimapIcon()
if not icon:IsRegistered("Decursive") then
icon:Register("Decursive", LDB, D.profile.MiniMapIcon);
end
end
function D:HideMiniMapIcon()
icon:Hide();
end
T._LoadedFiles["Dcr_LDB.lua"] = "@project-version@";