Mercurial > wow > buffalo2
comparison ObjectiveTracker/Frame.lua @ 29:adcd7c328d07
code collation cleaning
author | Nenue |
---|---|
date | Wed, 13 Apr 2016 21:53:24 -0400 |
parents | c33c17dd97e7 |
children | 7583684becf4 |
comparison
equal
deleted
inserted
replaced
28:c33c17dd97e7 | 29:adcd7c328d07 |
---|---|
10 local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent | 10 local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent |
11 local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText | 11 local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText |
12 local PERCENTAGE_STRING, GetQuestProgressBarPercent = PERCENTAGE_STRING, GetQuestProgressBarPercent | 12 local PERCENTAGE_STRING, GetQuestProgressBarPercent = PERCENTAGE_STRING, GetQuestProgressBarPercent |
13 local Default, AutoQuest, Quest, Bonus, Cheevs = T.DefaultHandler, T.AutoQuest, T.Quest, T.Bonus, T.Cheevs | 13 local Default, AutoQuest, Quest, Bonus, Cheevs = T.DefaultHandler, T.AutoQuest, T.Quest, T.Bonus, T.Cheevs |
14 local InCombatLockdown, format, lshift, CreateFrame = InCombatLockdown, format, bit.lshift, CreateFrame | 14 local InCombatLockdown, format, lshift, CreateFrame = InCombatLockdown, format, bit.lshift, CreateFrame |
15 local IsModifiedClick, ChatEdit_GetActiveWindow = IsModifiedClick, ChatEdit_GetActiveWindow | |
15 local print = B.print('Tracker') | 16 local print = B.print('Tracker') |
16 local unitLevel = 1 | 17 local unitLevel = 1 |
17 local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_REASON | 18 local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_REASON |
18 local debug = false | 19 local debug = false |
19 -------------------------------------------------------------------- | 20 -------------------------------------------------------------------- |
140 | 141 |
141 T.AddBlock = function(self, block) | 142 T.AddBlock = function(self, block) |
142 local print = bprint | 143 local print = bprint |
143 local tracker = self.frame | 144 local tracker = self.frame |
144 local info = block.info | 145 local info = block.info |
145 currentBlock:SetPoint('TOPLEFT', self.currentAnchor, 'BOTTOMLEFT', 0, 0) | 146 block:SetPoint('TOPLEFT', self.currentAnchor, 'BOTTOMLEFT', 0, 0) |
146 currentBlock:SetPoint('RIGHT', tracker,'RIGHT', 0, 0) | 147 block:SetPoint('RIGHT', tracker,'RIGHT', 0, 0) |
147 self.currentAnchor = currentBlock | 148 self.currentAnchor = block |
148 print(' |cFFFFFF00'..tracker.height..'|r', '|cFF00FF00'..currentBlock:GetName()..'|r', currentBlock.height, tracker.height) | 149 print(' |cFFFFFF00'..tracker.height..'|r', '|cFF00FF00'..block:GetName()..'|r', block.height, tracker.height) |
149 tracker.height = tracker.height + currentBlock.height | 150 tracker.height = tracker.height + block.height |
150 tracker.numBlocks = max(tracker.numBlocks, info.blockIndex) | 151 self.numBlocks = max(self.numBlocks, info.blockIndex) |
151 tracker.actualBlocks = tracker.actualBlocks + 1 | 152 self.actualBlocks = self.actualBlocks + 1 |
152 end | 153 end |
153 | 154 |
154 --- Used as an iterator of sorts for cascaded tag icon placements (the daily/faction/account icons) | 155 --- Used as an iterator of sorts for cascaded tag icon placements (the daily/faction/account icons) |
155 T.AddTag = function (block, tagName, tagPoint, tagAnchor, tagRelative) | 156 T.AddTag = function (block, tagName, tagPoint, tagAnchor, tagRelative) |
156 local print = bprint | 157 local print = bprint |
214 | 215 |
215 end | 216 end |
216 return lines[lineIndex] | 217 return lines[lineIndex] |
217 end | 218 end |
218 | 219 |
220 | |
221 | |
219 --- Creates or retrieves a complete block frame object | 222 --- Creates or retrieves a complete block frame object |
220 T.GetBlock = function(handler, blockIndex) | 223 T.GetBlock = function(handler, blockIndex) |
221 local print = bprint | 224 local print = bprint |
222 local block = handler.usedBlocks[blockIndex] | 225 local block = handler.usedBlocks[blockIndex] |
223 | 226 |
230 | 233 |
231 | 234 |
232 | 235 |
233 local c = T.Conf.Wrapper | 236 local c = T.Conf.Wrapper |
234 block.index = blockIndex | 237 block.index = blockIndex |
235 block.SetStyle = T.SetBlockStyle | |
236 block:SetWidth(c.Width) | 238 block:SetWidth(c.Width) |
237 | 239 |
238 block.title:SetSpacing(c.TitleSpacing) | 240 block.title:SetSpacing(c.TitleSpacing) |
239 block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing) | 241 block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing) |
240 | 242 |
295 tracker.title:SetFont(headerFont, headerSize, headerOutline) | 297 tracker.title:SetFont(headerFont, headerSize, headerOutline) |
296 tracker.titlebg:SetHeight(headerHeight) | 298 tracker.titlebg:SetHeight(headerHeight) |
297 tracker.title:SetTextColor(unpack(headerColor)) | 299 tracker.title:SetTextColor(unpack(headerColor)) |
298 | 300 |
299 self.currentAnchor = tracker.titlebg | 301 self.currentAnchor = tracker.titlebg |
300 local numWatched = self:GetNumWatched() | 302 self.numWatched = self:GetNumWatched() |
301 local numBlocks = self.numBlocks | 303 self.actualBlocks = 0 |
302 local actualBlocks = 0 | |
303 for watchIndex = 1, 25 do | 304 for watchIndex = 1, 25 do |
304 blockIndex = blockIndex + 1 | 305 blockIndex = blockIndex + 1 |
305 if watchIndex <= numWatched then | 306 if watchIndex <= self.numWatched then |
306 local info = self:GetInfo(watchIndex) | 307 local info = self:GetInfo(watchIndex) |
307 if info then | 308 if info then |
308 local currentBlock = self:UpdateBlock(blockIndex, info) | 309 local currentBlock = self:UpdateBlock(blockIndex, info) |
309 T.AddBlock(currentBlock) | 310 T.AddBlock(self, currentBlock) |
310 else | 311 else |
311 print(' |cFFFF0000bad GetInfo data for #'..watchIndex) | 312 print(' |cFFFF0000bad GetInfo data for #'..watchIndex) |
312 end | 313 end |
313 elseif watchIndex <= numBlocks then | 314 elseif watchIndex <= self.actualBlocks then |
314 local used = self.usedBlocks | 315 local used = self.usedBlocks |
315 local free = self.freeBlocks | 316 local free = self.freeBlocks |
316 print('clean up dead quest block') | 317 print('clean up dead quest block') |
317 if used[blockIndex] then | 318 if used[blockIndex] then |
318 used[blockIndex]:Hide() | 319 used[blockIndex]:Hide() |
324 print(' |cFFFF9900END|r @', blockIndex) | 325 print(' |cFFFF9900END|r @', blockIndex) |
325 break -- done with quest stuff | 326 break -- done with quest stuff |
326 end | 327 end |
327 end | 328 end |
328 | 329 |
329 self.numWatched = numWatched | 330 |
330 self.numBlocks = numBlocks | 331 if self.actualBlocks >= 1 then |
331 self.actualBlocks = actualBlocks | |
332 | |
333 if numBlocks >= 1 then | |
334 tracker.height = tracker.height + headerHeight | 332 tracker.height = tracker.height + headerHeight |
335 tracker:Show() | 333 tracker:Show() |
336 | 334 |
337 if tracker.wasEmpty then | 335 if tracker.wasEmpty then |
338 tracker.headerFade:Play() | 336 tracker.headerFade:Play() |
339 tracker.wasEmpty = nil | 337 tracker.wasEmpty = nil |
340 end | 338 end |
341 if tracker.height ~= tracker.previousHeight then | 339 if tracker.height ~= tracker.previousHeight then |
342 tracker:SetHeight(tracker.height) | 340 tracker:SetHeight(tracker.height) |
343 end | 341 end |
342 print(' |cFFFFFF00', tracker.height, tracker:GetWidth()) | |
344 else | 343 else |
345 tracker:Hide() | 344 tracker:Hide() |
346 tracker.wasEmpty = true | 345 tracker.wasEmpty = true |
347 end | 346 end |
348 | 347 |
694 | 693 |
695 T.UpdateItemButtonCooldown = function(button) | 694 T.UpdateItemButtonCooldown = function(button) |
696 | 695 |
697 end | 696 end |
698 | 697 |
699 Default.Select = function(self) | 698 Default.Select = function(handler, block) |
700 T:Update(self.watchReasonModule) | 699 T:Update(handler.watchReasonModule) |
701 end | 700 end |
702 Default.Open = function(self) | 701 Default.Open = function(handler, block) |
703 T:Update(self.watchReasonModule) | 702 T:Update(handler.watchReasonModule) |
704 end | 703 end |
705 Default.Remove = function(self) | 704 Default.Remove = function(handler, block) |
706 T:Update(self.watchReasonModule) | 705 T:Update(handler.watchReasonModule) |
707 end | 706 end |
708 Default.Report = function(self) | 707 Default.Report = function(handler, block) |
709 print('Stats:', self.numWatched,'items tracked,', self.numBlocks,'blocks assigned.') | 708 print('Stats:', handler.numWatched,'items tracked,', handler.numBlocks,'blocks assigned.') |
710 end | 709 end |
711 | 710 |
712 Default.OnMouseUp = function(self, button) | 711 Default.OnMouseUp = function(self, button) |
713 | |
714 print(self.handler.name, self.mainStyle, self.subStyle) | 712 print(self.handler.name, self.mainStyle, self.subStyle) |
715 if button == 'LeftButton' then | 713 if button == 'LeftButton' then |
716 if IsModifiedClick("CHATLINK") and ChatEdit_GetActiveWindow() then | 714 if IsModifiedClick("CHATLINK") and ChatEdit_GetActiveWindow() then |
717 self:Link() | 715 self.Link(self.handler, self) |
718 elseif IsModifiedClick("QUESTWATCHTOGGLE") then | 716 elseif IsModifiedClick("QUESTWATCHTOGGLE") then |
719 self:Remove() | 717 self.Remove(self.handler, self) |
720 else | 718 else |
721 self:Select() | 719 self.Select(self.handler, self) |
722 end | 720 end |
723 elseif button == 'RightButton' then | 721 elseif button == 'RightButton' then |
724 self:Open() | 722 self.Open(self.handler, self) |
725 end | 723 end |
726 self.initialButton = nil | 724 self.initialButton = nil |
727 self.modChatLink = nil | 725 self.modChatLink = nil |
728 self.modQuestWatch = nil | 726 self.modQuestWatch = nil |
729 mod:Update(self.handler.updateReasonModule) | 727 T:Update(self.handler.updateReasonModule) |
730 print('|cFFFF8800'..tostring(self:GetName())..':MouseUp()|r') | 728 print('|cFFFF8800'..tostring(self:GetName())..':MouseUp()|r') |
731 end | 729 end |
732 | |
733 Default.OnMouseDown = function(self, button) | 730 Default.OnMouseDown = function(self, button) |
734 | |
735 print(IsModifiedClick("CHATLINK"), IsModifiedClick("QUESTWATCHTOGGLE")) | |
736 print(self.info.title) | 731 print(self.info.title) |
737 end | 732 end |