tercio@0
|
1 LibHotCorners = LibStub ("AceAddon-3.0"):NewAddon ("HotCorners", "AceConsole-3.0", "AceEvent-3.0", "AceTimer-3.0")
|
tercio@1
|
2 _G.HotCorners = LibHotCorners
|
tercio@0
|
3 local LibHotCorners = LibHotCorners
|
tercio@0
|
4
|
tercio@0
|
5 local LBD = LibStub ("LibDataBroker-1.1")
|
tercio@0
|
6
|
tercio@0
|
7 local debug = false
|
tercio@0
|
8 local tinsert = tinsert
|
tercio@0
|
9
|
tercio@0
|
10 local default_db = {
|
tercio@0
|
11 profile = {
|
tercio@0
|
12 is_enabled = true,
|
tercio@0
|
13 topleft_enabled = true,
|
tercio@1
|
14 topleft_quickfunc = false,
|
tercio@0
|
15 clicks = {},
|
tercio@0
|
16 disabled = {}
|
tercio@0
|
17 },
|
tercio@0
|
18 }
|
tercio@0
|
19
|
tercio@1
|
20 LibHotCorners.RegistredQuickFunctions = {}
|
tercio@1
|
21 LibHotCorners.QuickFunctions = {topleft = false}
|
tercio@1
|
22
|
Tercio@7
|
23 LibHotCorners.LastItemButtonClick = GetTime()
|
Tercio@7
|
24
|
tercio@0
|
25 function LibHotCorners:OnEnable()
|
tercio@0
|
26
|
tercio@0
|
27 end
|
tercio@0
|
28
|
tercio@0
|
29 function LibHotCorners:OnDisable()
|
tercio@0
|
30
|
tercio@0
|
31 end
|
tercio@0
|
32
|
tercio@2
|
33 LibHotCorners.ItemButtons = {}
|
tercio@2
|
34 LibHotCorners.ItemOnInventory = {}
|
tercio@2
|
35
|
tercio@0
|
36 local refresh_topleft = function()
|
tercio@0
|
37 LibHotCorners ["topleft"].is_enabled = LibHotCorners.db.profile.topleft_enabled
|
tercio@0
|
38 end
|
tercio@0
|
39
|
tercio@0
|
40 local OptionsTable = {
|
tercio@0
|
41 name = "HotCorners",
|
tercio@0
|
42 type = "group",
|
tercio@0
|
43 args = {
|
tercio@0
|
44 Enabled = {
|
tercio@0
|
45 type = "toggle",
|
tercio@0
|
46 name = "Enabled",
|
tercio@0
|
47 desc = "Enable or Disable this addon.",
|
tercio@0
|
48 order = 1,
|
tercio@0
|
49 get = function() return LibHotCorners.db.profile.is_enabled end,
|
tercio@0
|
50 set = function (self, val) LibHotCorners.db.profile.is_enabled = not LibHotCorners.db.profile.is_enabled; --[[ do something]] end,
|
tercio@0
|
51 },
|
tercio@0
|
52 TopLeftEnabled = {
|
tercio@0
|
53 type = "toggle",
|
tercio@0
|
54 name = "Top Left",
|
tercio@0
|
55 desc = "Enable or Disable the Top Left bar.",
|
tercio@0
|
56 order = 2,
|
tercio@0
|
57 get = function() return LibHotCorners.db.profile.topleft_enabled end,
|
tercio@0
|
58 set = function (self, val) LibHotCorners.db.profile.topleft_enabled = not LibHotCorners.db.profile.topleft_enabled; refresh_topleft() end,
|
tercio@0
|
59 },
|
tercio@1
|
60 QuickClickFunc = {
|
tercio@1
|
61 type = "select",
|
tercio@1
|
62 name = "Quick Click",
|
tercio@1
|
63 desc = "Select the behavior when clicking over the absolute topleft corner.",
|
tercio@1
|
64 values = function()
|
tercio@1
|
65 local options = {}
|
tercio@1
|
66 for index, quickfunc in ipairs (LibHotCorners.RegistredQuickFunctions) do
|
tercio@1
|
67 options [quickfunc.name] = quickfunc.name
|
tercio@1
|
68 end
|
tercio@1
|
69 return options
|
tercio@1
|
70 end,
|
tercio@1
|
71 get = function() return LibHotCorners.db.profile.topleft_quickfunc or "" end,
|
tercio@1
|
72 set = function (self, funcname)
|
tercio@1
|
73 LibHotCorners.db.profile.topleft_quickfunc = funcname;
|
tercio@1
|
74 for index, quickfunc in ipairs (LibHotCorners.RegistredQuickFunctions) do
|
tercio@1
|
75 if (quickfunc.name == funcname) then
|
tercio@1
|
76 LibHotCorners.QuickFunctions.topleft = quickfunc.func
|
tercio@1
|
77 break
|
tercio@1
|
78 end
|
tercio@1
|
79 end
|
tercio@1
|
80 end,
|
tercio@1
|
81 order = 4,
|
tercio@1
|
82 }
|
tercio@0
|
83 }
|
tercio@0
|
84 }
|
tercio@0
|
85
|
tercio@0
|
86 function LibHotCorners:OnInitialize()
|
tercio@0
|
87
|
tercio@0
|
88 --declarar primeiro o db usando a global que é declarada no toc.
|
tercio@0
|
89 self.db = LibStub ("AceDB-3.0"):New ("HotCornersDB", default_db, true)
|
tercio@0
|
90
|
tercio@0
|
91 --declara agora as opções da tab raiz
|
tercio@0
|
92 LibStub("AceConfig-3.0"):RegisterOptionsTable ("HotCorners", OptionsTable)
|
tercio@0
|
93 LibHotCorners.OptionsFrame1 = LibStub ("AceConfigDialog-3.0"):AddToBlizOptions ("HotCorners", "HotCorners")
|
tercio@0
|
94 --sub tab
|
tercio@0
|
95 LibStub ("AceConfig-3.0"):RegisterOptionsTable ("HotCorners-Profiles", LibStub ("AceDBOptions-3.0"):GetOptionsTable (self.db))
|
tercio@0
|
96 LibHotCorners.OptionsFrame2 = LibStub ("AceConfigDialog-3.0"):AddToBlizOptions ("HotCorners-Profiles", "Profiles", "HotCorners")
|
tercio@0
|
97
|
tercio@0
|
98 LibHotCorners ["topleft"].is_enabled = self.db.topleft_enabled
|
tercio@0
|
99 refresh_topleft()
|
tercio@0
|
100
|
tercio@0
|
101 SLASH_HOTCORNER1, SLASH_HOTCORNER2 = "/hotcorners", "/hotcorner"
|
tercio@0
|
102 function SlashCmdList.HOTCORNER (msg, editbox)
|
tercio@0
|
103 HotCornersOpenOptions (self);
|
tercio@0
|
104 end
|
tercio@0
|
105
|
tercio@0
|
106 for name, dataobj in LBD:DataObjectIterator() do
|
tercio@0
|
107 if (dataobj.type and dataobj.icon and dataobj.OnClick) then
|
tercio@0
|
108 LibHotCorners:RegisterHotCornerButton (name, "TopLeft", nil, name .. "HotCornerLauncher", dataobj.icon, dataobj.OnTooltipShow, dataobj.OnClick, nil, nil, dataobj.OnEnter, dataobj.OnLeave)
|
tercio@0
|
109 end
|
tercio@0
|
110 end
|
tercio@0
|
111 for k, v in pairs (LBD.attributestorage) do
|
tercio@0
|
112 --print (k, v)
|
tercio@0
|
113 --print ("----------------")
|
tercio@0
|
114 --vardump (v)
|
tercio@0
|
115 end
|
tercio@0
|
116
|
tercio@0
|
117 end
|
tercio@0
|
118
|
tercio@0
|
119 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
tercio@0
|
120 --> main function
|
tercio@0
|
121
|
tercio@0
|
122 LibHotCorners.embeds = LibHotCorners.embeds or {}
|
tercio@0
|
123 local embed_functions = {
|
tercio@0
|
124 "RegisterHotCornerButton",
|
tercio@0
|
125 "HideHotCornerButton",
|
tercio@0
|
126 }
|
tercio@0
|
127
|
tercio@0
|
128 function LibHotCorners:Embed (target)
|
tercio@0
|
129 for k, v in pairs (embed_functions) do
|
tercio@0
|
130 target[v] = self[v]
|
tercio@0
|
131 end
|
tercio@0
|
132 self.embeds [target] = true
|
tercio@0
|
133 return target
|
tercio@0
|
134 end
|
tercio@0
|
135
|
tercio@0
|
136 local CallbackHandler = LibStub:GetLibrary ("CallbackHandler-1.0")
|
tercio@0
|
137 LibHotCorners.callbacks = LibHotCorners.callbacks or CallbackHandler:New (LibHotCorners)
|
tercio@0
|
138
|
tercio@0
|
139 LibHotCorners.topleft = LibHotCorners.topleft or {widgets = {}, quickclick = false, is_enabled = false, map = {}}
|
tercio@0
|
140 LibHotCorners.bottomleft = {}
|
tercio@0
|
141 LibHotCorners.topright = {}
|
tercio@0
|
142 LibHotCorners.bottomright = {}
|
tercio@0
|
143
|
tercio@0
|
144 local function test (corner)
|
tercio@0
|
145 assert (corner == "topleft" or corner == "bottomleft" or corner == "topright" or corner == "bottomright", "LibHotCorners:RegisterAddon expects a corner on #1 argument.")
|
tercio@0
|
146 end
|
tercio@0
|
147
|
tercio@1
|
148 function LibHotCorners:AddQuickFunction (quickfunc, corner)
|
tercio@1
|
149
|
tercio@1
|
150 local current_quickfunc = LibHotCorners.db.profile [corner .. "_quickfunc"] or ""
|
tercio@1
|
151
|
tercio@1
|
152 --> passed only one table
|
tercio@1
|
153 if (quickfunc.name) then
|
tercio@1
|
154 --> check if already exists
|
tercio@1
|
155 local already_exists = false
|
tercio@1
|
156 for _, registred in ipairs (LibHotCorners.RegistredQuickFunctions) do
|
tercio@1
|
157 if (registred.name == quickfunc.name) then
|
tercio@1
|
158 registred.func = quickfunc.func
|
tercio@1
|
159 if (current_quickfunc == quickfunc.name) then
|
tercio@1
|
160 LibHotCorners.QuickFunctions [corner] = quickfunc.func
|
tercio@1
|
161 end
|
tercio@1
|
162 already_exists = true
|
tercio@1
|
163 break
|
tercio@1
|
164 end
|
tercio@1
|
165 end
|
tercio@1
|
166 --> add table
|
tercio@1
|
167 if (not already_exists) then
|
tercio@1
|
168 table.insert (LibHotCorners.RegistredQuickFunctions, quickfunc)
|
tercio@1
|
169 if (current_quickfunc == quickfunc.name) then
|
tercio@1
|
170 LibHotCorners.QuickFunctions [corner] = quickfunc.func
|
tercio@1
|
171 end
|
tercio@1
|
172 end
|
tercio@1
|
173 --> check if there is a quickfunc to be use
|
tercio@1
|
174 if (current_quickfunc == "") then
|
tercio@1
|
175 LibHotCorners.db.profile [corner .. "_quickfunc"] = quickfunc.name
|
tercio@1
|
176 LibHotCorners.QuickFunctions [corner] = quickfunc.func
|
tercio@1
|
177 end
|
tercio@1
|
178 else
|
tercio@1
|
179 --> passed a table of tables
|
tercio@1
|
180 for _, this_quickfunc in ipairs (quickfunc) do
|
tercio@1
|
181 --> check if already exists
|
tercio@1
|
182 local already_exists = false
|
tercio@1
|
183 for _, registred in ipairs (LibHotCorners.RegistredQuickFunctions) do
|
tercio@1
|
184 if (registred.name == this_quickfunc.name) then
|
tercio@1
|
185 registred.func = this_quickfunc.func
|
tercio@1
|
186 if (current_quickfunc == this_quickfunc.name) then
|
tercio@1
|
187 LibHotCorners.QuickFunctions [corner] = this_quickfunc.func
|
tercio@1
|
188 end
|
tercio@1
|
189 already_exists = true
|
tercio@1
|
190 break
|
tercio@1
|
191 end
|
tercio@1
|
192 end
|
tercio@1
|
193 --> add table
|
tercio@1
|
194 if (not already_exists) then
|
tercio@1
|
195 table.insert (LibHotCorners.RegistredQuickFunctions, this_quickfunc)
|
tercio@1
|
196 if (current_quickfunc == this_quickfunc.name) then
|
tercio@1
|
197 LibHotCorners.QuickFunctions [corner] = this_quickfunc.func
|
tercio@1
|
198 end
|
tercio@1
|
199 end
|
tercio@1
|
200 --> check if there is a quickfunc to be use
|
tercio@1
|
201 if (current_quickfunc == "") then
|
tercio@1
|
202 LibHotCorners.db.profile [corner .. "_quickfunc"] = this_quickfunc.name
|
tercio@1
|
203 LibHotCorners.QuickFunctions [corner] = this_quickfunc.func
|
tercio@1
|
204 current_quickfunc = this_quickfunc.name
|
tercio@1
|
205 end
|
tercio@1
|
206 end
|
tercio@1
|
207 end
|
tercio@1
|
208
|
tercio@1
|
209 end
|
tercio@1
|
210
|
tercio@1
|
211 function LibHotCorners:RegisterHotCornerButton (name, corner, optionstable, fname, icon, tooltip, clickfunc, menus, quickfunc, onenter, onleave, is_install)
|
tercio@0
|
212 corner = string.lower (corner)
|
tercio@0
|
213 test (corner)
|
tercio@0
|
214
|
tercio@1
|
215 optionstable = optionstable or {hide = false}
|
tercio@1
|
216
|
tercio@0
|
217 if (is_install) then
|
tercio@0
|
218 --> overwrite if already exists a widget
|
tercio@0
|
219 for i, widget in ipairs (LibHotCorners [corner]) do
|
tercio@0
|
220 if (widget.name == name) then
|
tercio@0
|
221 table.remove (LibHotCorners [corner], i)
|
tercio@1
|
222 table.insert (LibHotCorners [corner], i, {name = name, fname = fname, optionstable = optionstable, icon = icon, tooltip = tooltip, click = clickfunc, menus = menus, quickfunc = quickfunc, onenter = onenter, onleave = onleave, is_install = true})
|
tercio@1
|
223 if (quickfunc) then
|
tercio@1
|
224 LibHotCorners:AddQuickFunction (quickfunc, corner)
|
tercio@1
|
225 end
|
tercio@0
|
226 return LibHotCorners [corner].map [name]
|
tercio@0
|
227 end
|
tercio@0
|
228 end
|
tercio@1
|
229 --> add
|
tercio@1
|
230 table.insert (LibHotCorners [corner], {name = name, fname = fname, optionstable = optionstable, icon = icon, tooltip = tooltip, click = clickfunc, menus = menus, quickfunc = quickfunc, onenter = onenter, onleave = onleave, is_install = true})
|
tercio@0
|
231 LibHotCorners [corner].map [name] = #LibHotCorners [corner]
|
tercio@1
|
232 if (quickfunc) then
|
tercio@1
|
233 LibHotCorners:AddQuickFunction (quickfunc, corner)
|
tercio@1
|
234 end
|
tercio@0
|
235 return LibHotCorners [corner].map [name]
|
tercio@0
|
236 else
|
tercio@1
|
237 --> check if already exists
|
tercio@1
|
238 for i, widget in ipairs (LibHotCorners [corner]) do
|
tercio@1
|
239 if (widget.name == name) then
|
tercio@1
|
240 return
|
tercio@0
|
241 end
|
tercio@0
|
242 end
|
tercio@1
|
243 --> add
|
tercio@1
|
244 table.insert (LibHotCorners [corner], {name = name, fname = fname, optionstable = optionstable, icon = icon, tooltip = tooltip, click = clickfunc, menus = menus, quickfunc = quickfunc, onenter = onenter, onleave = onleave})
|
tercio@1
|
245 LibHotCorners [corner].map [name] = #LibHotCorners [corner]
|
tercio@1
|
246 if (quickfunc) then
|
tercio@1
|
247 LibHotCorners:AddQuickFunction (quickfunc, corner)
|
tercio@0
|
248 end
|
tercio@1
|
249 return LibHotCorners [corner].map [name]
|
tercio@0
|
250 end
|
tercio@0
|
251 end
|
tercio@0
|
252
|
tercio@0
|
253 function LibHotCorners:HideHotCornerButton (name, corner, value)
|
tercio@0
|
254
|
tercio@0
|
255 corner = string.lower (corner)
|
tercio@0
|
256 test (corner)
|
tercio@0
|
257
|
tercio@0
|
258 local corner_table = LibHotCorners [corner]
|
tercio@0
|
259 local addon_table = corner_table [corner_table.map [name]]
|
tercio@0
|
260
|
tercio@1
|
261 if (addon_table) then
|
tercio@1
|
262 addon_table.optionstable.hide = value
|
tercio@1
|
263 end
|
tercio@0
|
264
|
tercio@0
|
265 LibHotCorners [corner].is_enabled = false
|
tercio@0
|
266
|
tercio@1
|
267 for index, button_table in ipairs (corner_table) do
|
tercio@1
|
268 if (not button_table.optionstable.hide) then
|
tercio@0
|
269 LibHotCorners [corner].is_enabled = true
|
tercio@0
|
270 break
|
tercio@0
|
271 end
|
tercio@0
|
272 end
|
tercio@0
|
273
|
tercio@0
|
274 return true
|
tercio@0
|
275 end
|
tercio@0
|
276
|
tercio@0
|
277 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
tercio@0
|
278 --> data broker stuff
|
tercio@0
|
279 function LibHotCorners:DataBrokerCallback (event, name, dataobj)
|
tercio@0
|
280 if (not name or not dataobj or not dataobj.type) then
|
tercio@0
|
281 return
|
tercio@0
|
282 end
|
tercio@0
|
283 if (dataobj.icon and dataobj.OnClick) then
|
tercio@0
|
284 LibHotCorners:RegisterHotCornerButton (name, "TopLeft", nil, name .. "HotCornerLauncher", dataobj.icon, dataobj.OnTooltipShow, dataobj.OnClick, nil, nil, dataobj.OnEnter, dataobj.OnLeave)
|
tercio@0
|
285 end
|
tercio@0
|
286 end
|
tercio@0
|
287 LBD.RegisterCallback (LibHotCorners, "DataBrokerCallback")
|
tercio@0
|
288
|
tercio@0
|
289 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
tercio@0
|
290 --> scripts
|
tercio@0
|
291
|
tercio@0
|
292 --> background (window mode fix)
|
tercio@0
|
293 function HotCornersBackgroundOnEnter (self)
|
tercio@0
|
294 if (LibHotCornersTopLeft and LibHotCornersTopLeft:IsShown()) then
|
tercio@0
|
295 if (LibHotCornersTopLeft:GetWidth() > 2) then
|
tercio@2
|
296 HotCornersOnLeave (LibHotCornersTopLeft, true)
|
tercio@0
|
297 end
|
tercio@0
|
298 end
|
tercio@0
|
299 self:EnableMouse (false)
|
tercio@0
|
300 end
|
tercio@0
|
301
|
tercio@0
|
302 --> set size
|
tercio@0
|
303 local function set_size (self)
|
tercio@0
|
304 if (self.position == "topleft" or self.position == "topright") then
|
tercio@0
|
305 self:SetSize (40, GetScreenHeight())
|
tercio@0
|
306 else
|
tercio@0
|
307 self:SetSize (GetScreenWidth(), 40)
|
tercio@0
|
308 end
|
tercio@0
|
309 end
|
tercio@0
|
310
|
tercio@0
|
311 --> show tooltip
|
tercio@0
|
312 local show_tooltip = function (self)
|
tercio@2
|
313 if (self.table and self.table.tooltip) then
|
tercio@0
|
314 if (type (self.table.tooltip) == "function") then
|
tercio@0
|
315 GameTooltip:SetOwner (self, "ANCHOR_RIGHT")
|
tercio@0
|
316 self.table.tooltip (GameTooltip)
|
tercio@0
|
317 GameTooltip:Show()
|
tercio@0
|
318 elseif (type (self.table.tooltip) == "string") then
|
tercio@0
|
319 GameTooltip:SetOwner (self, "ANCHOR_RIGHT")
|
tercio@0
|
320 GameTooltip:AddLine (self.table.tooltip)
|
tercio@0
|
321 GameTooltip:Show()
|
tercio@0
|
322 end
|
tercio@2
|
323 elseif (self.table and self.table.onenter) then
|
tercio@0
|
324 self.table.onenter (self)
|
tercio@2
|
325 elseif (self.isItem) then
|
tercio@2
|
326 GameTooltip:SetOwner (self, "ANCHOR_BOTTOMRIGHT")
|
tercio@2
|
327 GameTooltip:SetHyperlink (self.itemtable[4])
|
tercio@2
|
328 GameTooltip:Show()
|
tercio@0
|
329 end
|
tercio@0
|
330 end
|
tercio@0
|
331
|
tercio@0
|
332 --> corner frame on enter
|
tercio@0
|
333 local more_clicked = function (t1, t2)
|
tercio@0
|
334 return t1[1] > t2[1]
|
tercio@0
|
335 end
|
tercio@0
|
336
|
tercio@2
|
337 LibHotCorners.BackPackItemList = {
|
tercio@2
|
338
|
Tercio@13
|
339 --> hearthstones
|
Tercio@13
|
340 [140192] = true, -- Dalaran Hearthstone
|
Tercio@13
|
341 --[110560] = true, -- Garrison Hearthstone
|
Tercio@13
|
342 [6948] = true, -- Innkeeper Hearthstone
|
Tercio@13
|
343
|
Tercio@13
|
344 --> good items
|
Tercio@13
|
345
|
Tercio@13
|
346
|
tercio@2
|
347 --> alchemy
|
Tercio@7
|
348
|
Tercio@7
|
349 --MOP
|
tercio@2
|
350 [76086] = true, -- Flask of Falling Leaves
|
tercio@2
|
351 [76084] = true, -- Flask of Spring Blossoms
|
tercio@2
|
352 [76085] = true, -- Flask of the Warm Sun
|
tercio@2
|
353 [76087] = true, -- Flask of the Earth
|
tercio@2
|
354 [76088] = true, -- Flask of Winter's Bite
|
tercio@2
|
355
|
tercio@2
|
356 [76081] = true, -- Elixir of Mirrors
|
tercio@2
|
357 [76079] = true, -- Elixir of Peace
|
tercio@2
|
358 [76080] = true, -- Elixir of Perfection
|
tercio@2
|
359 [76078] = true, -- Elixir of the Rapids
|
tercio@2
|
360 [76077] = true, -- Elixir of Weaponry
|
tercio@2
|
361 [70676] = true, -- Mad Hozen Elixir
|
tercio@2
|
362 [76075] = true, -- Mantid Elixir
|
tercio@2
|
363 [76083] = true, -- Monk's Elixir
|
tercio@2
|
364
|
tercio@2
|
365 [76094] = true, -- Alchemist's Rejuvenation
|
tercio@2
|
366 [96096] = true, -- Darkwater Potion
|
tercio@2
|
367 [75218] = true, -- Electrified Oil
|
tercio@2
|
368 [76097] = true, -- Master Healing Potion
|
tercio@2
|
369 [76098] = true, -- Master Mana Potion
|
tercio@2
|
370 [76092] = true, -- Potion of Focus
|
tercio@2
|
371 [76093] = true, -- Potion of the Jade Serpent
|
tercio@2
|
372 [76095] = true, -- Potion of Mogu Power
|
tercio@2
|
373 [76090] = true, -- Potion of the Mountains
|
tercio@2
|
374 [76091] = true, -- Greater Potion of Luck
|
tercio@2
|
375 [76089] = true, -- Virmen's Bite
|
Tercio@7
|
376
|
Tercio@7
|
377 --WOD
|
Tercio@7
|
378 [118704] = true, --Pure Rage Potion
|
Tercio@7
|
379 [109156] = true, --Greater Draenic Strength Flask
|
Tercio@7
|
380 [109160] = true, --Greater Draenic Stamina Flask
|
Tercio@7
|
381 [109155] = true, --Greater Draenic Intellect Flask
|
Tercio@7
|
382 [109153] = true, --Greater Draenic Agility Flask
|
Tercio@7
|
383 [118711] = true, --Draenic Water Walking Elixir
|
Tercio@7
|
384 [116271] = true, --Draenic Water Breathing Elixir
|
Tercio@7
|
385 [116266] = true, --Draenic Swiftness Potion
|
Tercio@7
|
386 [109219] = true, --Draenic Strength Potion
|
Tercio@7
|
387 [109148] = true, --Draenic Strength Flask
|
Tercio@7
|
388 [109152] = true, --Draenic Stamina Flask
|
Tercio@7
|
389 [109226] = true, --Draenic Rejuvenation Potion
|
Tercio@7
|
390 [109222] = true, --Draenic Mana Potion
|
Tercio@7
|
391 [116276] = true, --Draenic Living Action Potion
|
Tercio@7
|
392 [116268] = true, --Draenic Invisibility Potion
|
Tercio@7
|
393 [109218] = true, --Draenic Intellect Potion
|
Tercio@7
|
394 [109147] = true, --Draenic Intellect Flask
|
Tercio@7
|
395 [109221] = true, --Draenic Channeled Mana Potion
|
Tercio@7
|
396 [109220] = true, --Draenic Armor Potion
|
Tercio@7
|
397 [109217] = true, --Draenic Agility Potion
|
Tercio@7
|
398 [109145] = true, --Draenic Agility Flask
|
Tercio@7
|
399 [112090] = true, --Transmorphic Tincture
|
Tercio@7
|
400
|
tercio@2
|
401 --> cooking
|
Tercio@7
|
402 --WOD
|
Tercio@7
|
403 [111449] = true, --Blackrock Barbecue
|
Tercio@7
|
404 [111433] = true, --Blackrock Ham
|
Tercio@7
|
405 [111436] = true, --Braised Riverbeast
|
Tercio@7
|
406 [122348] = true, --Buttered Sturgeon
|
Tercio@7
|
407 [111453] = true, --Calamari Crepes
|
Tercio@7
|
408 [111438] = true, --Clefthoof Sausages
|
Tercio@7
|
409 [126935] = true, --Fancy Darkmoon Feast
|
Tercio@7
|
410 [111444] = true, --Fat Sleeper Cakes
|
Tercio@7
|
411 [111457] = true, --Feast of Blood
|
Tercio@7
|
412 [111458] = true, --Feast of the Waters
|
Tercio@7
|
413 [111445] = true, --Fiery Calamari
|
Tercio@7
|
414 [111450] = true, --Frosty Stew
|
Tercio@7
|
415 [111454] = true, --Gorgrond Chowder
|
Tercio@7
|
416 [111441] = true, --Grilled Gulper
|
Tercio@7
|
417 [111456] = true, --Grilled Saberfish
|
Tercio@7
|
418 [111431] = true, --Hearty Elekk Steak
|
Tercio@7
|
419 [122346] = true, --Jumbo Sea Dog
|
Tercio@7
|
420 [126934] = true, --Lemon Herb Filet
|
Tercio@7
|
421 [111434] = true, --Pan-Seared Talbuk
|
Tercio@7
|
422 [122345] = true, --Pickled Eel
|
Tercio@7
|
423 [111437] = true, --Rylak Crepes
|
Tercio@7
|
424 [111455] = true, --Saberfish Broth
|
Tercio@7
|
425 [122344] = true, --Salty Squid Roll
|
Tercio@7
|
426 [111446] = true, --Skulker Chowder
|
Tercio@7
|
427 [111452] = true, --Sleeper Surprise
|
Tercio@7
|
428 [122343] = true, --Sleeper Sushi
|
Tercio@7
|
429 [111439] = true, --Steamed Scorpion
|
Tercio@7
|
430 [111442] = true, --Sturgeon Stew
|
Tercio@7
|
431 [126936] = true, --Sugar-Crusted Fish Feast
|
Tercio@7
|
432 [111447] = true, --Talador Surf and Turf
|
Tercio@7
|
433 [122347] = true, --Whiptail Fillet
|
Tercio@7
|
434 --[] = true, --
|
Tercio@7
|
435 --MOP
|
Tercio@7
|
436 --Way of the Grill: Strength
|
tercio@2
|
437 [74642] = true, -- Charbroiled Tiger Steak
|
tercio@2
|
438 [74645] = true, -- Eternal Blossom Fish
|
tercio@2
|
439 [74646] = true, -- Black Pepper Ribs and Shrimp
|
tercio@2
|
440
|
tercio@2
|
441 --Way of the Oven: Stamina
|
tercio@2
|
442 [74654] = true, -- Wildfowl Roast
|
tercio@2
|
443 [74655] = true, -- Twin Fish Platter
|
tercio@2
|
444 [74656] = true, -- Chun Tian Spring Rolls
|
tercio@2
|
445
|
tercio@2
|
446 --Way of the Pot: Intellect
|
tercio@2
|
447
|
tercio@2
|
448 [74644] = true, -- Swirling Mist Soup
|
tercio@2
|
449 [74649] = true, -- Braised Turtle
|
tercio@2
|
450 [74650] = true, -- Mogu Fish Stew
|
tercio@2
|
451
|
tercio@2
|
452 --Way of the Steamer: Spirit
|
tercio@2
|
453
|
tercio@2
|
454 [74651] = true, -- Shrimp Dumplings
|
tercio@2
|
455 [74652] = true, -- Fire Spirit Salmon
|
tercio@2
|
456 [74653] = true, -- Steamed Crab Surprise
|
tercio@2
|
457
|
tercio@2
|
458 --Way of the Wok: Agility
|
tercio@2
|
459
|
tercio@2
|
460 [74643] = true, -- Sauteed Carrots
|
tercio@2
|
461 [74647] = true, -- Valley Stir Fry
|
tercio@2
|
462 [74648] = true, -- Sea Mist Rice Noodles
|
tercio@2
|
463
|
tercio@2
|
464 --Way of the Brew: Headaches and Grandeur
|
tercio@2
|
465
|
tercio@2
|
466 [74626] = true, -- Ginseng Tea
|
tercio@2
|
467 [74637] = true, -- Jade Witch Brew
|
tercio@2
|
468 [74638] = true, -- Mad Brewer's Breakfast
|
tercio@2
|
469
|
tercio@2
|
470 --General Cooking
|
tercio@2
|
471
|
tercio@2
|
472 [74641] = true, -- Fish Cake
|
tercio@2
|
473 [74636] = true, -- Golden Carp Consomme
|
tercio@2
|
474 [86070] = true, -- Wildfowl Ginseng Soup
|
tercio@2
|
475 [86069] = true, -- Rice Pudding
|
tercio@2
|
476 [86074] = true, -- Spicy Vegetable Chips
|
tercio@2
|
477 [86073] = true, -- Spicy Salmon
|
tercio@2
|
478
|
tercio@2
|
479 --5.4 Recipes
|
tercio@2
|
480
|
tercio@2
|
481 [145308] = true, -- Mango Ice
|
tercio@2
|
482 [145309] = true, -- Farmer's Delight
|
tercio@2
|
483 [145311] = true, -- Fluffy Silkfeather Omelet
|
tercio@2
|
484 [145310] = true, -- Stuffed Lushrooms
|
tercio@2
|
485 [145307] = true, -- Spiced Blossom Soup
|
tercio@2
|
486 [145305] = true, -- Seasoned Pomfruit Slices
|
tercio@2
|
487
|
tercio@2
|
488 --Cart Kits
|
tercio@2
|
489 [101630] = true, -- Noodle Cart Kit
|
tercio@2
|
490 [101661] = true, -- Deluxe Noodle Cart Kit
|
tercio@2
|
491 [101662] = true, -- Pandaren Treasure Noodle Cart Kit
|
tercio@2
|
492
|
tercio@2
|
493 [101618] = true, -- Pandaren Treasure Noodle Soup
|
tercio@2
|
494 [101617] = true, -- Deluxe Noodle Soup
|
tercio@2
|
495 [101616] = true, -- Noodle Soup
|
Tercio@13
|
496
|
Tercio@12
|
497 --LEGION
|
Tercio@12
|
498 [188028] = true, --Potion of the Old War
|
Tercio@12
|
499 [188027] = true, --Potion of Deadly Grace
|
Tercio@12
|
500 [188029] = true, --Unbending Potion
|
Tercio@12
|
501 [188017] = true, --Ancient Mana Potion
|
Tercio@12
|
502 [188030] = true, --Leytorrent Potion
|
Tercio@12
|
503 [229206] = true, --Potion of Prolongued Power
|
Tercio@13
|
504
|
tercio@2
|
505 }
|
tercio@2
|
506
|
tercio@0
|
507 function HotCornersOnEnter (self)
|
tercio@0
|
508
|
tercio@0
|
509 if (not LibHotCorners.db.profile.is_enabled) then
|
tercio@0
|
510 return
|
tercio@0
|
511 end
|
tercio@0
|
512
|
tercio@0
|
513 if (not LibHotCorners.db.profile [self.position .. "_enabled"]) then
|
tercio@0
|
514 return
|
tercio@0
|
515 end
|
tercio@0
|
516
|
tercio@2
|
517 if (self:GetWidth() < 1.1 and self:GetHeight() < 1.1) then
|
tercio@2
|
518 --print ("abrindo...")
|
tercio@2
|
519 end
|
tercio@2
|
520
|
tercio@0
|
521 set_size (self)
|
tercio@0
|
522
|
tercio@0
|
523 HotCornersBackgroundFrame:EnableMouse (true)
|
tercio@2
|
524 self.item_frame:Show()
|
tercio@0
|
525
|
tercio@0
|
526 local i = 1
|
tercio@0
|
527
|
tercio@0
|
528 local sort = {}
|
tercio@0
|
529 local clicks = LibHotCorners.db.profile.clicks
|
tercio@0
|
530 for index, button_table in ipairs (LibHotCorners [self.position]) do
|
tercio@0
|
531 tinsert (sort, {clicks [button_table.name] or 0, button_table})
|
tercio@0
|
532 end
|
tercio@0
|
533 table.sort (sort, more_clicked)
|
Tercio@13
|
534
|
tercio@0
|
535 local last_button
|
tercio@0
|
536
|
tercio@0
|
537 local disabled = LibHotCorners.db.profile.disabled
|
tercio@0
|
538
|
tercio@0
|
539 for index, button_table in ipairs (sort) do
|
tercio@0
|
540 button_table = button_table [2]
|
tercio@0
|
541 if (not button_table.widget) then
|
tercio@0
|
542 LibHotCorners:CreateAddonWidget (self, button_table, index, self.position)
|
tercio@0
|
543 end
|
tercio@0
|
544
|
tercio@0
|
545 button_table.widget:ClearAllPoints()
|
tercio@0
|
546
|
tercio@1
|
547 if (not disabled [button_table.name] and not button_table.optionstable.hide) then
|
tercio@0
|
548 if (self.position == "topleft" or self.position == "topright") then
|
tercio@2
|
549
|
tercio@0
|
550 local y = i * 35 * -1
|
tercio@2
|
551 --button_table.widget:SetPoint ("topleft", self, "topleft", 4, y)
|
tercio@0
|
552 button_table.widget.y = y
|
tercio@2
|
553 HotCornersStartAnimOnShow (button_table.widget, "y")
|
tercio@2
|
554
|
tercio@2
|
555 else --bottom left / bottom right
|
tercio@0
|
556 local x = i * 35
|
tercio@0
|
557 button_table.widget:SetPoint ("topleft", self, "topleft", x, -4)
|
tercio@0
|
558 button_table.widget.x = x
|
tercio@0
|
559 end
|
tercio@0
|
560
|
tercio@0
|
561 button_table.widget:Show()
|
tercio@0
|
562 last_button = button_table.widget
|
tercio@0
|
563
|
tercio@0
|
564 i = i + 1
|
tercio@0
|
565 else
|
tercio@0
|
566 button_table.widget:Hide()
|
tercio@0
|
567 end
|
tercio@0
|
568 end
|
tercio@0
|
569
|
tercio@0
|
570 local OptionsButton = LibHotCorners [self.position].optionsbutton
|
tercio@0
|
571 local y = i * 35 * -1
|
tercio@0
|
572 OptionsButton:SetPoint ("top", self, "top", 0, y)
|
tercio@0
|
573 OptionsButton:Show()
|
tercio@0
|
574
|
tercio@2
|
575 --item frame
|
tercio@2
|
576 LibHotCorners:RefereshItems (self)
|
tercio@2
|
577
|
Tercio@11
|
578 --self.AnimOnShow:Play()
|
tercio@3
|
579 HotCornersInfosFrame:Show()
|
tercio@3
|
580 HotCornersInfosFrame:SetAlpha (0)
|
Tercio@11
|
581 --HotCornersInfosFrame.AnimOnShow:Play()
|
tercio@3
|
582
|
tercio@3
|
583 --update repair
|
tercio@3
|
584 local percent, items = 0, 0
|
tercio@3
|
585 for i = INVSLOT_FIRST_EQUIPPED, INVSLOT_LAST_EQUIPPED do
|
tercio@3
|
586 local durability, maxdurability = GetInventoryItemDurability (i)
|
tercio@3
|
587 if (durability and maxdurability) then
|
tercio@3
|
588 local p = durability / maxdurability * 100
|
tercio@3
|
589 percent = percent + p
|
tercio@3
|
590 items = items + 1
|
tercio@3
|
591 end
|
tercio@3
|
592 end
|
tercio@3
|
593
|
tercio@3
|
594 if (items == 0) then
|
tercio@3
|
595 HotCornersInfosFrame.repairText:SetText ("-- %")
|
tercio@3
|
596 end
|
tercio@3
|
597
|
tercio@3
|
598 percent = percent / items
|
tercio@3
|
599 HotCornersInfosFrame.repairText:SetText (math.floor (percent) .. "%")
|
tercio@3
|
600
|
tercio@3
|
601 --update date
|
tercio@3
|
602 HotCornersInfosFrame.clockText:SetText (date ("%H:%M"))
|
tercio@3
|
603 HotCornersInfosFrame.dayText:SetText (date ("%A\n%B %d"))
|
tercio@3
|
604
|
tercio@3
|
605 --update money
|
tercio@3
|
606 local money = GetMoney()
|
tercio@3
|
607 HotCornersInfosFrame.goldText:SetText (math.floor (money / 100 / 100))
|
tercio@3
|
608 HotCornersInfosFrame.silverText:SetText (math.floor ((money / 100) % 100))
|
tercio@3
|
609 HotCornersInfosFrame.bronzeText:SetText (math.floor (money % 100))
|
tercio@3
|
610
|
tercio@3
|
611 --HotCornersInfosFrame.clockText:SetText (date ("%A %B %d %H:%M:%S %Y"))
|
tercio@3
|
612
|
tercio@0
|
613 end
|
tercio@0
|
614
|
tercio@2
|
615 function LibHotCorners:RefereshItems (self)
|
tercio@2
|
616
|
Tercio@7
|
617 if (HotCornersItemUsed and LibHotCorners.LastItemButtonClick < GetTime() and not self) then
|
Tercio@7
|
618 for _, button in pairs (LibHotCorners.ItemButtons) do
|
Tercio@7
|
619 if (not button.itemtable[6]) then --> isn't a profession cooldown
|
Tercio@7
|
620 button.cooldown:SetCooldown (GetTime(), 1.5)
|
Tercio@7
|
621 end
|
Tercio@7
|
622 end
|
Tercio@7
|
623 HotCornersItemUsed = nil
|
Tercio@7
|
624 LibHotCorners.LastItemButtonClick = GetTime()+1.5
|
Tercio@7
|
625 end
|
Tercio@7
|
626
|
tercio@2
|
627 if (not self) then
|
tercio@2
|
628 return LibHotCorners:ScheduleTimer ("RefereshItems", 1, LibHotCornersTopLeft)
|
tercio@2
|
629 end
|
tercio@2
|
630
|
tercio@2
|
631 if (not UnitAffectingCombat ("player") and not InCombatLockdown()) then
|
Tercio@13
|
632
|
Tercio@13
|
633 --update the icon
|
tercio@2
|
634 for itemId, itemTable in pairs (LibHotCorners.ItemOnInventory) do
|
tercio@2
|
635 itemTable [1] = 0
|
tercio@2
|
636 end
|
tercio@2
|
637
|
tercio@2
|
638 for bagID = 0, 4 do
|
tercio@2
|
639 local numItems = GetContainerNumSlots (bagID)
|
tercio@2
|
640 for slot = 1, numItems do
|
tercio@2
|
641 local itemId = GetContainerItemID (bagID, slot)
|
tercio@2
|
642 if (LibHotCorners.BackPackItemList [itemId]) then
|
tercio@2
|
643 local texture, itemCount, locked, quality, readable, lootable, itemLink = GetContainerItemInfo (bagID, slot)
|
tercio@2
|
644 if (not LibHotCorners.ItemOnInventory [itemId]) then
|
tercio@2
|
645 LibHotCorners.ItemOnInventory [itemId] = {itemCount, texture, quality, itemLink, itemId}
|
tercio@2
|
646 else
|
tercio@2
|
647 LibHotCorners.ItemOnInventory [itemId] [1] = LibHotCorners.ItemOnInventory [itemId] [1] + itemCount
|
tercio@2
|
648 end
|
tercio@2
|
649 end
|
tercio@2
|
650 end
|
tercio@2
|
651 end
|
tercio@2
|
652
|
tercio@2
|
653 local index = 1
|
tercio@2
|
654 for itemId, itemTable in pairs (LibHotCorners.ItemOnInventory) do
|
tercio@2
|
655 local itemCount, texture, quality, itemLink = unpack (itemTable)
|
tercio@2
|
656
|
tercio@2
|
657 local item_button = LibHotCorners:GetItemButton (index, self)
|
tercio@2
|
658 if (item_button) then
|
Tercio@13
|
659
|
tercio@2
|
660 item_button:SetNormalTexture (texture)
|
tercio@2
|
661 item_button:SetHighlightTexture (texture)
|
tercio@2
|
662 item_button:SetPushedTexture (texture)
|
tercio@2
|
663
|
Tercio@13
|
664 itemCount = itemCount or 0
|
Tercio@13
|
665 if (itemCount > 1) then
|
Tercio@13
|
666 item_button.item_count:SetText (itemCount or 0)
|
Tercio@13
|
667 item_button.bg_item_count:Show()
|
Tercio@13
|
668 else
|
Tercio@13
|
669 item_button.item_count:SetText ("")
|
Tercio@13
|
670 item_button.bg_item_count:Hide()
|
Tercio@13
|
671 end
|
Tercio@13
|
672
|
Tercio@13
|
673 if (not UnitAffectingCombat ("player") and not InCombatLockdown()) then
|
Tercio@13
|
674 item_button:SetAttribute ("macrotext", "/use " .. GetItemInfo (itemId) .. ";\n/script HotCornersItemUsed=GetTime(); HotCorners:RefereshItems()")
|
Tercio@13
|
675 item_button:GetNormalTexture():SetDesaturated (false)
|
Tercio@13
|
676 --item_button:Enable()
|
Tercio@13
|
677 else
|
Tercio@13
|
678 item_button:GetNormalTexture():SetDesaturated (true)
|
Tercio@13
|
679 --item_button:Disable()
|
Tercio@13
|
680 end
|
tercio@2
|
681
|
tercio@2
|
682 item_button.itemtable = itemTable
|
tercio@2
|
683
|
tercio@2
|
684 if (not item_button:IsShown() or item_button:GetAlpha() < 1) then
|
Tercio@13
|
685 -- HotCornersStartAnimOnShow (item_button, "item_topleft")
|
Tercio@13
|
686 end
|
Tercio@13
|
687
|
Tercio@13
|
688 if (not UnitAffectingCombat ("player") and not InCombatLockdown()) then
|
Tercio@13
|
689 item_button:Show()
|
tercio@2
|
690 end
|
tercio@2
|
691 end
|
Tercio@7
|
692 index = index + 1
|
tercio@2
|
693 end
|
Tercio@13
|
694
|
Tercio@7
|
695 LibHotCorners:RefereshProfessions (self, index)
|
tercio@2
|
696
|
tercio@2
|
697 end
|
Tercio@13
|
698
|
tercio@2
|
699 --/run local itemid=GetContainerItemID (0, 1);print (itemid)
|
tercio@2
|
700 --UseContainerItem(bagID, slot[, onSelf])
|
Tercio@7
|
701 end
|
Tercio@7
|
702
|
Tercio@7
|
703 local get_profession = function (icon)
|
Tercio@7
|
704 if (icon:find ("Trade_Engineering")) then
|
Tercio@7
|
705 return "en"
|
Tercio@7
|
706 elseif (icon:find ("Trade_LeatherWorking")) then
|
Tercio@7
|
707 return "lw"
|
Tercio@7
|
708 elseif (icon:find ("Trade_Tailoring")) then
|
Tercio@7
|
709 return "tl"
|
Tercio@7
|
710 elseif (icon:find ("Trade_Engraving")) then
|
Tercio@7
|
711 return "ec"
|
Tercio@7
|
712 elseif (icon:find ("Trade_BlackSmithing")) then
|
Tercio@7
|
713 return "bs"
|
Tercio@7
|
714 elseif (icon:find ("Trade_Alchemy")) then
|
Tercio@7
|
715 return "al"
|
Tercio@7
|
716 elseif (icon:find ("INV_Misc_Gem_01")) then
|
Tercio@7
|
717 return "jc"
|
Tercio@7
|
718 elseif (icon:find ("INV_Inscription_Tradeskill01")) then
|
Tercio@7
|
719 return "in"
|
Tercio@7
|
720 end
|
Tercio@7
|
721 end
|
Tercio@7
|
722 local secrets_index = {
|
Tercio@7
|
723 ["tl"] = 176058, --tailoring
|
Tercio@7
|
724 ["ec"] = 177043, --enchanting
|
Tercio@7
|
725 ["lw"] = 176089, --letherwork
|
Tercio@7
|
726 ["en"] = 177054, --engeener
|
Tercio@7
|
727 ["bs"] = 176090, --blacksmith
|
Tercio@7
|
728 ["al"] = 175880, --alchemy
|
Tercio@7
|
729 ["jc"] = 176087, --jewelcraft
|
Tercio@7
|
730 ["in"] = 177045, --inscription
|
Tercio@7
|
731 }
|
Tercio@7
|
732 local secrets_icons = {
|
Tercio@7
|
733 ["tl"] = "inv_misc_book_03", --tailoring
|
Tercio@7
|
734 ["ec"] = "inv_misc_book_08", --enchant
|
Tercio@7
|
735 ["al"] = "inv_misc_book_08", -- alchemy
|
Tercio@7
|
736 ["bs"] = "inv_misc_book_11", --bs
|
Tercio@7
|
737 ["en"] = "inv_misc_book_08", --engeener
|
Tercio@7
|
738 ["in"] = "inv_misc_book_08", --inscritp
|
Tercio@7
|
739 ["jc"] = "inv_misc_book_10", --jc
|
Tercio@7
|
740 ["lw"] = "inv_misc_book_09", --lw
|
Tercio@7
|
741 }
|
Tercio@7
|
742
|
Tercio@7
|
743 function LibHotCorners:RefereshProfessions (self, index)
|
Tercio@7
|
744
|
Tercio@7
|
745 index = index + 1
|
Tercio@7
|
746
|
Tercio@7
|
747 local prof1, prof2, archaeology, fishing, cooking, firstAid = GetProfessions()
|
Tercio@7
|
748
|
Tercio@7
|
749 if (prof1) then
|
Tercio@7
|
750 local name, icon, skillLevel, maxSkillLevel, numAbilities, spelloffset, skillLine, skillModifier, specializationIndex, specializationOffset = GetProfessionInfo (prof1)
|
Tercio@7
|
751 local prof = get_profession (icon)
|
Tercio@7
|
752 local secrets_spellID = secrets_index [prof]
|
Tercio@7
|
753 if (secrets_spellID) then
|
Tercio@7
|
754 local name, _, texture = GetSpellInfo (secrets_spellID)
|
Tercio@7
|
755 texture = "Interface\\Icons\\" .. secrets_icons [prof]
|
Tercio@7
|
756 local item_button = LibHotCorners:GetItemButton (index, self)
|
Tercio@7
|
757 if (item_button) then
|
Tercio@7
|
758 item_button:SetNormalTexture (texture)
|
Tercio@7
|
759 item_button:SetHighlightTexture (texture)
|
Tercio@7
|
760 item_button:SetPushedTexture (texture)
|
Tercio@7
|
761
|
Tercio@7
|
762 item_button:SetAttribute ("macrotext", "/cast " .. name .. ";\n/script HotCornersItemUsed=GetTime(); HotCorners:RefereshItems()")
|
Tercio@7
|
763
|
Tercio@7
|
764 item_button.itemtable = {false, false, false, GetSpellLink (secrets_spellID), false, true}
|
Tercio@7
|
765
|
Tercio@7
|
766 local start, duration = GetSpellCooldown (secrets_spellID)
|
Tercio@7
|
767 if (start and start > 0) then
|
Tercio@7
|
768 item_button.cooldown:SetCooldown (start, duration)
|
Tercio@7
|
769 else
|
Tercio@7
|
770 item_button.item_count:SetText (1)
|
Tercio@7
|
771 end
|
Tercio@7
|
772
|
Tercio@7
|
773 if (not item_button:IsShown() or item_button:GetAlpha() < 1) then
|
Tercio@11
|
774 -- HotCornersStartAnimOnShow (item_button, "item_topleft")
|
Tercio@7
|
775 end
|
Tercio@7
|
776 end
|
Tercio@7
|
777 index = index + 1
|
Tercio@7
|
778 end
|
Tercio@7
|
779 end
|
Tercio@7
|
780
|
Tercio@7
|
781 if (prof2) then
|
Tercio@7
|
782 local name, icon, skillLevel, maxSkillLevel, numAbilities, spelloffset, skillLine, skillModifier, specializationIndex, specializationOffset = GetProfessionInfo (prof2)
|
Tercio@7
|
783 local prof = get_profession (icon)
|
Tercio@7
|
784 local secrets_spellID = secrets_index [prof]
|
Tercio@7
|
785 if (secrets_spellID) then
|
Tercio@7
|
786 local name, _, texture = GetSpellInfo (secrets_spellID)
|
Tercio@7
|
787 texture = "Interface\\Icons\\" .. secrets_icons [prof]
|
Tercio@7
|
788 local item_button = LibHotCorners:GetItemButton (index, self)
|
Tercio@7
|
789 if (item_button) then
|
Tercio@7
|
790 item_button:SetNormalTexture (texture)
|
Tercio@7
|
791 item_button:SetHighlightTexture (texture)
|
Tercio@7
|
792 item_button:SetPushedTexture (texture)
|
Tercio@7
|
793
|
Tercio@7
|
794 item_button:SetAttribute ("macrotext", "/cast " .. name .. ";\n/script HotCornersItemUsed=GetTime(); HotCorners:RefereshItems()")
|
Tercio@7
|
795
|
Tercio@7
|
796 item_button.itemtable = {false, false, false, GetSpellLink (secrets_spellID), false, true}
|
Tercio@7
|
797
|
Tercio@7
|
798 local start, duration = GetSpellCooldown (secrets_spellID)
|
Tercio@7
|
799 if (start and start > 0) then
|
Tercio@7
|
800 item_button.cooldown:SetCooldown (start, duration)
|
Tercio@7
|
801 else
|
Tercio@7
|
802 item_button.item_count:SetText (1)
|
Tercio@7
|
803 end
|
Tercio@7
|
804
|
Tercio@7
|
805 if (not item_button:IsShown() or item_button:GetAlpha() < 1) then
|
Tercio@11
|
806 -- HotCornersStartAnimOnShow (item_button, "item_topleft")
|
Tercio@7
|
807 end
|
Tercio@7
|
808 end
|
Tercio@7
|
809 index = index + 1
|
Tercio@7
|
810 end
|
Tercio@7
|
811 end
|
Tercio@7
|
812
|
Tercio@7
|
813 end
|
tercio@2
|
814
|
tercio@2
|
815 function LibHotCorners:GetItemButton (index, parent)
|
tercio@2
|
816 local button = LibHotCorners.ItemButtons [index]
|
tercio@2
|
817 if (not button) then
|
tercio@2
|
818 button = CreateFrame ("button", "HotCornersItemButton" .. index, parent.item_frame, "HotCornersUseItemButtonTemplate")
|
tercio@2
|
819 button.isItem = true
|
tercio@2
|
820
|
tercio@2
|
821 if (parent.position == "topleft") then
|
tercio@2
|
822 local x = (index-1) * 33
|
tercio@2
|
823 button:SetPoint ("topleft", parent.item_frame, "topleft", x, -2)
|
tercio@2
|
824 button.x = x
|
tercio@2
|
825 elseif (parent.position == "topright") then
|
tercio@2
|
826 local x = (index-1) * 33
|
tercio@2
|
827 button:SetPoint ("topright", parent.item_frame, "topright", -x, -2)
|
tercio@2
|
828 end
|
tercio@2
|
829
|
tercio@2
|
830 LibHotCorners.ItemButtons [index] = button
|
tercio@2
|
831 end
|
tercio@2
|
832 return button
|
tercio@2
|
833 end
|
tercio@2
|
834
|
tercio@0
|
835 --> corner frame on leave
|
tercio@2
|
836 function HotCornersOnLeave (self, from_background)
|
tercio@2
|
837 if (not from_background) then
|
tercio@2
|
838 return
|
tercio@2
|
839 end
|
tercio@2
|
840
|
tercio@0
|
841 self:SetSize (1, 1)
|
tercio@0
|
842 for index, button_table in ipairs (LibHotCorners [self.position]) do
|
tercio@1
|
843 if (button_table.widget) then
|
tercio@1
|
844 button_table.widget:Hide()
|
tercio@1
|
845 end
|
tercio@0
|
846 end
|
tercio@2
|
847 for _, button in pairs (LibHotCorners.ItemButtons) do
|
tercio@2
|
848 button:Hide()
|
tercio@2
|
849 end
|
tercio@2
|
850
|
tercio@0
|
851 local OptionsButton = LibHotCorners [self.position].optionsbutton
|
tercio@0
|
852 OptionsButton:Hide()
|
tercio@2
|
853
|
tercio@2
|
854 self.item_frame:Hide()
|
tercio@3
|
855 HotCornersInfosFrame:Hide()
|
tercio@0
|
856 end
|
tercio@0
|
857
|
tercio@0
|
858 --> quick corner on click
|
tercio@0
|
859 function HotCornersOnQuickClick (self, button)
|
tercio@0
|
860 local parent_position = self:GetParent().position
|
tercio@1
|
861 local func = LibHotCorners.QuickFunctions [parent_position]
|
tercio@1
|
862 if (func) then
|
tercio@1
|
863 func (self, button)
|
tercio@0
|
864 end
|
tercio@0
|
865 end
|
tercio@0
|
866
|
tercio@0
|
867 --> options button onenter
|
tercio@0
|
868 function HotCornersOptionsButtonOnEnter (self)
|
tercio@0
|
869 set_size (self:GetParent())
|
tercio@0
|
870 for index, button_table in ipairs (LibHotCorners [self:GetParent().position]) do
|
tercio@0
|
871 if (not LibHotCorners.db.profile.disabled [button_table.name]) then
|
tercio@0
|
872 button_table.widget:Show()
|
tercio@0
|
873 end
|
tercio@0
|
874 end
|
tercio@0
|
875 self:Show()
|
tercio@0
|
876 end
|
tercio@0
|
877
|
tercio@0
|
878 function HotCornersOpenOptions (self)
|
tercio@0
|
879 InterfaceOptionsFrame_OpenToCategory ("HotCorners")
|
tercio@0
|
880 InterfaceOptionsFrame_OpenToCategory ("HotCorners")
|
tercio@0
|
881 end
|
tercio@0
|
882
|
tercio@0
|
883 function HotCornersSetEnabled (state)
|
tercio@0
|
884 LibHotCorners.db.profile.is_enabled = state
|
tercio@0
|
885 end
|
tercio@0
|
886
|
tercio@0
|
887 --> options button onleave
|
tercio@0
|
888 function HotCornersOptionsButtonOnLeave (self)
|
tercio@0
|
889 self:GetParent():GetScript("OnLeave")(self:GetParent())
|
tercio@0
|
890 end
|
tercio@0
|
891
|
tercio@0
|
892 --> button onenter
|
tercio@0
|
893 function HotCornersButtonOnEnter (self)
|
tercio@2
|
894 --set_size (self:GetParent())
|
tercio@2
|
895 --for index, button_table in ipairs (LibHotCorners [self:GetParent().position]) do
|
tercio@2
|
896 -- if (not LibHotCorners.db.profile.disabled [button_table.name] and button_table.widget) then
|
tercio@2
|
897 -- button_table.widget:Show()
|
tercio@2
|
898 -- end
|
tercio@2
|
899 --end
|
tercio@0
|
900 show_tooltip (self)
|
tercio@2
|
901 --local OptionsButton = LibHotCorners [self:GetParent().position].optionsbutton
|
tercio@2
|
902 --OptionsButton:Show()
|
tercio@0
|
903 end
|
tercio@0
|
904
|
tercio@0
|
905 --> button onleave
|
tercio@0
|
906 function HotCornersButtonOnLeave (self)
|
tercio@0
|
907 GameTooltip:Hide()
|
tercio@2
|
908 if (self.table and self.table.onleave) then
|
tercio@0
|
909 self.table.onleave (self)
|
tercio@0
|
910 end
|
tercio@2
|
911 --self:GetParent():GetScript("OnLeave")(self:GetParent())
|
tercio@2
|
912 --local OptionsButton = LibHotCorners [self:GetParent().position].optionsbutton
|
tercio@2
|
913 --OptionsButton:Hide()
|
tercio@0
|
914 end
|
tercio@0
|
915
|
tercio@0
|
916 --> button onmousedown
|
tercio@0
|
917 function HotCornersButtonOnMouseDown (self, button)
|
tercio@2
|
918 if (self.isItem) then
|
tercio@2
|
919 if (self:GetParent():GetParent().position == "topleft") then
|
tercio@2
|
920 self:SetPoint ("topleft", self:GetParent(), "topleft", self.x+1, -3)
|
tercio@2
|
921 end
|
tercio@0
|
922 else
|
tercio@2
|
923 if (self:GetParent().position == "topleft" or self:GetParent().position == "topright") then
|
tercio@2
|
924 self:SetPoint ("topleft", self:GetParent(), "topleft", 5, self.y - 1)
|
tercio@2
|
925 else
|
tercio@2
|
926 self:SetPoint ("topleft", self:GetParent(), "topleft", self.x+1, -6)
|
tercio@2
|
927 end
|
tercio@0
|
928 end
|
tercio@0
|
929 end
|
tercio@0
|
930
|
tercio@0
|
931 --> button onmouseup
|
tercio@0
|
932 function HotCornersButtonOnMouseUp (self, button)
|
tercio@2
|
933 if (self.isItem) then
|
tercio@2
|
934 if (self:GetParent():GetParent().position == "topleft") then
|
tercio@2
|
935 self:SetPoint ("topleft", self:GetParent(), "topleft", self.x, -2)
|
tercio@2
|
936 end
|
tercio@0
|
937 else
|
tercio@2
|
938 if (self:GetParent().position == "topleft" or self:GetParent().position == "topright") then
|
tercio@2
|
939 self:SetPoint ("topleft", self:GetParent(), "topleft", 4, self.y)
|
tercio@2
|
940 else
|
tercio@2
|
941 self:SetPoint ("topleft", self:GetParent(), "topleft", self.x, -4)
|
tercio@2
|
942 end
|
tercio@2
|
943 if (self.table.click) then
|
tercio@2
|
944 local clicks = LibHotCorners.db.profile.clicks
|
tercio@2
|
945 clicks [self.table.name] = clicks [self.table.name] or 0
|
tercio@2
|
946 clicks [self.table.name] = clicks [self.table.name] + 1
|
tercio@2
|
947 self.table.click (self, button)
|
tercio@2
|
948 end
|
tercio@0
|
949 end
|
tercio@2
|
950 end
|
tercio@2
|
951
|
tercio@2
|
952 --> start show animation
|
tercio@2
|
953 function HotCornersStartAnimOnShow (button, axis)
|
tercio@2
|
954 if (axis == "y") then
|
tercio@2
|
955 --button:SetPoint ("topleft", button:GetParent(), "topleft", -32, button.y)
|
tercio@2
|
956 button:SetPoint ("topleft", button:GetParent(), "topleft", 4, button.y)
|
Tercio@11
|
957 --button.AnimOnShow:Play()
|
Tercio@11
|
958 button:Show()
|
Tercio@11
|
959 button:SetAlpha (1)
|
tercio@2
|
960
|
tercio@2
|
961 elseif (axis == "item_topleft") then
|
Tercio@11
|
962 --button.AnimOnShow:Play()
|
tercio@2
|
963 button:Show()
|
Tercio@11
|
964 button:SetAlpha (1)
|
tercio@0
|
965 end
|
tercio@0
|
966 end
|
tercio@2
|
967
|
tercio@2
|
968 --> on start / finish show animation
|
tercio@2
|
969 function HotCornersAnimOnShowStarted (button)
|
tercio@2
|
970
|
tercio@2
|
971 end
|
tercio@2
|
972 function HotCornersAnimOnShowFinished (button)
|
tercio@2
|
973 --button:SetPoint ("topleft", button:GetParent(), "topleft", 4, button.y)
|
tercio@2
|
974 button:Show()
|
tercio@2
|
975 --button:SetPoint ("topleft", button:GetParent(), "topleft", -4, button.y)
|
tercio@2
|
976 end
|
tercio@0
|
977
|
tercio@0
|
978 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
tercio@0
|
979 --> create top left corner
|
tercio@0
|
980
|
tercio@0
|
981 local TopLeftCorner = CreateFrame ("Frame", "LibHotCornersTopLeft", nil, "HotCornersFrameCornerTemplate")
|
tercio@0
|
982 TopLeftCorner:SetPoint ("topleft", UIParent, "topleft", 0, 0)
|
tercio@0
|
983 TopLeftCorner.position = "topleft"
|
tercio@0
|
984
|
tercio@0
|
985 --fast corner button
|
tercio@0
|
986 local QuickClickButton = CreateFrame ("button", "LibHotCornersTopLeftFastButton", TopLeftCorner, "HotCornersQuickCornerButtonTemplate")
|
tercio@0
|
987
|
tercio@0
|
988 --options button
|
tercio@0
|
989 local OptionsButton = CreateFrame ("button", "LibHotCornersTopLeftOptionsButton", TopLeftCorner, "HotCornersOptionsButtonTemplate")
|
tercio@0
|
990
|
tercio@0
|
991 if (debug) then
|
tercio@0
|
992 QuickClickButton:SetSize (20, 20)
|
tercio@0
|
993 QuickClickButton:SetBackdrop ({bgFile = [[Interface\DialogFrame\UI-DialogBox-Gold-Background]], tile = true, tileSize = 40})
|
tercio@0
|
994 QuickClickButton:SetBackdropColor (1, 0, 0, 1)
|
tercio@0
|
995 end
|
tercio@0
|
996
|
tercio@0
|
997 LibHotCorners.topleft.quickbutton = QuickClickButton
|
tercio@0
|
998 LibHotCorners.topleft.optionsbutton = OptionsButton
|
tercio@0
|
999
|
tercio@0
|
1000 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
tercio@0
|
1001 --> buttons
|
tercio@0
|
1002
|
tercio@0
|
1003 function LibHotCorners:CreateAddonWidget (frame, button_table, index, side)
|
tercio@0
|
1004
|
tercio@0
|
1005 --> create the button
|
tercio@0
|
1006 local button = CreateFrame ("button", "LibHotCorners" .. side .. button_table.fname, frame, "HotCornersButtonTemplate")
|
tercio@0
|
1007
|
tercio@0
|
1008 --> write some attributes
|
tercio@0
|
1009 button.index = index
|
tercio@0
|
1010 button.table = button_table
|
tercio@0
|
1011 button.parent = frame
|
tercio@0
|
1012 button_table.widget = button
|
tercio@0
|
1013
|
tercio@0
|
1014 --> set the icon
|
tercio@0
|
1015 button:SetNormalTexture (button_table.icon)
|
tercio@0
|
1016 button:SetHighlightTexture (button_table.icon)
|
Tercio@11
|
1017
|
Tercio@11
|
1018 if (string.lower (button_table.icon):find ([[\icons\]]) or string.lower (button_table.icon):find ([[\ICONS\]]) or string.lower (button_table.icon):find ([[\Icons\]])) then
|
tercio@0
|
1019 button:GetNormalTexture():SetTexCoord (0.078125, 0.9375, 0.078125, 0.9375)
|
tercio@0
|
1020 button:GetHighlightTexture():SetTexCoord (0.078125, 0.9375, 0.078125, 0.9375)
|
tercio@0
|
1021 end
|
tercio@0
|
1022
|
Tercio@11
|
1023 button:SetNormalTexture (button_table.icon)
|
Tercio@11
|
1024 button:SetHighlightTexture (button_table.icon)
|
Tercio@11
|
1025
|
Tercio@11
|
1026 button.Icon = button:CreateTexture (nil, "overlay")
|
Tercio@11
|
1027 button.Icon:SetTexture (button_table.icon)
|
Tercio@11
|
1028 button.Icon:SetSize (32, 32)
|
Tercio@11
|
1029 button.Icon:SetPoint ("center", button, "center", 0, 0)
|
Tercio@11
|
1030
|
Tercio@11
|
1031 --print (button:GetName())
|
Tercio@11
|
1032 --print (1, button:GetAlpha())
|
Tercio@11
|
1033
|
tercio@0
|
1034 return button
|
tercio@0
|
1035 end |