Mercurial > wow > buffalo2
comparison ObjectiveTracker/Achievements.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 |
---|---|
3 -- @project-revision@ @project-hash@ | 3 -- @project-revision@ @project-hash@ |
4 -- @file-revision@ @file-hash@ | 4 -- @file-revision@ @file-hash@ |
5 -- Created: 4/13/2016 7:48 PM | 5 -- Created: 4/13/2016 7:48 PM |
6 local B = select(2,...).frame | 6 local B = select(2,...).frame |
7 local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') | 7 local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') |
8 local _G, ipairs, max, min, unpack, floor, pairs, tostring, type, band = _G, ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band | 8 local band = bit.band |
9 local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText | 9 local ChatEdit_InsertLink, RemoveTrackedAchievement, GetAchievementLink, AchievementFrame, AchievementFrame_LoadUI = ChatEdit_InsertLink, RemoveTrackedAchievement, GetAchievementLink, AchievementFrame, AchievementFrame_LoadUI |
10 local Cheevs = T.Cheevs | 10 local AchievementFrame_ToggleAchievementFrame, AchievementFrame_SelectAchievement = AchievementFrame_ToggleAchievementFrame, AchievementFrame_SelectAchievement |
11 local format = format | 11 local GetTime, GetAchievementNumCriteria, GetAchievementCriteriaInfo = GetTime, GetAchievementNumCriteria, GetAchievementCriteriaInfo |
12 local GetNumTrackedAchievements, GetTrackedAchievements, GetAchievementInfo = GetNumTrackedAchievements, GetTrackedAchievements, GetAchievementInfo | |
13 local Default, Cheevs = T.DefaultHandler, T.Cheevs | |
12 local print = B.print('Tracker') | 14 local print = B.print('Tracker') |
13 local lprint = B.print('Line') | 15 local lprint = B.print('Line') |
14 local iprint = B.print('Info') | 16 local iprint = B.print('Info') |
15 | 17 |
18 --- Data retrieval | |
19 Cheevs.GetNumWatched = function(self) | |
20 print('|cFF00FF00' .. GetTime()) | |
21 Cheevs.trackedCheevs = {GetTrackedAchievements()} | |
22 return GetNumTrackedAchievements() | |
23 end | |
24 Cheevs.GetInfo = function(self, index) | |
25 local cheevID = Cheevs.trackedCheevs[index] | |
26 local id, name, points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy = GetAchievementInfo(cheevID) | |
16 | 27 |
28 self.Info[cheevID] = {} | |
29 local c = self.Info[cheevID] | |
30 c.type = 'Cheevs' | |
31 c.watchIndex = index | |
32 c.cheevID = cheevID | |
33 c.title = name | |
34 c.points, c.completed, c.month, c.day, c.year, c.description, c.flags, c.icon, c.rewardText, c.isGuildAch, c.wasEarnedByMe, c.earnedBy = | |
35 points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy | |
36 c.numObjectives = GetAchievementNumCriteria(cheevID) | |
37 c.objectives = {} | |
38 for i = 1, c.numObjectives do | |
39 local description, type, completed, quantity, requiredQuantity, characterName, flags, assetID, quantityString, criteriaID = GetAchievementCriteriaInfo(cheevID, i) | |
40 c.objectives[i] = { | |
41 objectiveIndex = i, | |
42 cheevID = cheevID, | |
43 text = description, | |
44 type = type, | |
45 finished = completed, | |
46 value = quantity, | |
47 maxValue = requiredQuantity, | |
48 characterName = characterName, | |
49 flags = flags, | |
50 assetID = assetID, | |
51 quantityString = quantityString, | |
52 criteriaID = criteriaID, | |
53 } | |
54 end | |
55 print('Cheevs.|cFF0088FFGetInfo|r('..index..')', 'obj:', GetAchievementNumCriteria(cheevID), name, description) | |
17 | 56 |
57 self.WatchInfo[index] = c | |
58 return self.Info[cheevID] | |
59 end | |
60 | |
61 --- Content handlers | |
18 Cheevs.UpdateLine = function(handler, block, line, data) | 62 Cheevs.UpdateLine = function(handler, block, line, data) |
19 local print = B.print('CheevsLine') | 63 local print = B.print('CheevsLine') |
20 line.progress = 0 | 64 line.progress = 0 |
21 print(' ', data.objectiveIndex,'|cFF0088FF-|r', data.objectiveType, data.text) | 65 print(' ', data.objectiveIndex,'|cFF0088FF-|r', data.objectiveType, data.text) |
22 if data.flags then | 66 if data.flags then |
39 print('line.type =', data.type) | 83 print('line.type =', data.type) |
40 print(' ** qtyStr:', data.quantityString, 'qty:', data.quantity, 'assetID:', data.assetID) | 84 print(' ** qtyStr:', data.quantityString, 'qty:', data.quantity, 'assetID:', data.assetID) |
41 end | 85 end |
42 | 86 |
43 Cheevs.Select = function(self) | 87 Cheevs.Select = function(self) |
44 --mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT) | 88 T:Update(Cheevs.updateReasonModule) |
45 end | 89 end |
90 | |
46 Cheevs.Remove = function(self) | 91 Cheevs.Remove = function(self) |
47 | 92 |
48 RemoveTrackedAchievement(self.info.cheevID) | 93 RemoveTrackedAchievement(self.info.cheevID) |
49 end | 94 end |
50 Cheevs.OnMouseUp = function(self, button) | 95 Cheevs.OnMouseUp = function(self, button) |