Mercurial > wow > buffalo2
comparison ObjectiveTracker/Achievements.lua @ 30:7583684becf4
- implement procedural block contents generation
- redo anchor calculations to allow for transitional animation
- attempt to sort out event handling quirks related to autopopup quest completion and turn-in
- revise the data structures created by the different GetInfo's
- start on trimming out redundant variables
author | Nenue |
---|---|
date | Thu, 14 Apr 2016 17:11:13 -0400 |
parents | adcd7c328d07 |
children | 9856ebc63fa4 |
comparison
equal
deleted
inserted
replaced
29:adcd7c328d07 | 30:7583684becf4 |
---|---|
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 band = bit.band | 8 local band = bit.band |
9 local ChatEdit_InsertLink, RemoveTrackedAchievement, GetAchievementLink, AchievementFrame, AchievementFrame_LoadUI = ChatEdit_InsertLink, RemoveTrackedAchievement, GetAchievementLink, AchievementFrame, AchievementFrame_LoadUI | 9 local RemoveTrackedAchievement, GetAchievementLink = RemoveTrackedAchievement, GetAchievementLink |
10 local AchievementFrame_ToggleAchievementFrame, AchievementFrame_SelectAchievement = AchievementFrame_ToggleAchievementFrame, AchievementFrame_SelectAchievement | 10 local AchievementFrame_ToggleAchievementFrame, AchievementFrame_SelectAchievement = AchievementFrame_ToggleAchievementFrame, AchievementFrame_SelectAchievement |
11 local GetTime, GetAchievementNumCriteria, GetAchievementCriteriaInfo = GetTime, GetAchievementNumCriteria, GetAchievementCriteriaInfo | 11 local GetTime, GetAchievementNumCriteria, GetAchievementCriteriaInfo = GetTime, GetAchievementNumCriteria, GetAchievementCriteriaInfo |
12 local GetNumTrackedAchievements, GetTrackedAchievements, GetAchievementInfo = GetNumTrackedAchievements, GetTrackedAchievements, GetAchievementInfo | 12 local GetNumTrackedAchievements, GetTrackedAchievements, GetAchievementInfo = GetNumTrackedAchievements, GetTrackedAchievements, GetAchievementInfo |
13 local Default, Cheevs = T.DefaultHandler, T.Cheevs | 13 local Default, Cheevs = T.DefaultHandler, T.Cheevs |
14 local print = B.print('Tracker') | 14 local print = B.print('Tracker') |
27 | 27 |
28 self.Info[cheevID] = {} | 28 self.Info[cheevID] = {} |
29 local c = self.Info[cheevID] | 29 local c = self.Info[cheevID] |
30 c.type = 'Cheevs' | 30 c.type = 'Cheevs' |
31 c.watchIndex = index | 31 c.watchIndex = index |
32 c.id = cheevID | |
32 c.cheevID = cheevID | 33 c.cheevID = cheevID |
33 c.title = name | 34 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 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 points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy |
36 c.numObjectives = GetAchievementNumCriteria(cheevID) | 37 c.numObjectives = GetAchievementNumCriteria(cheevID) |
38 | |
39 local tagInfo = {} | |
40 | |
41 | |
37 c.objectives = {} | 42 c.objectives = {} |
38 for i = 1, c.numObjectives do | 43 for i = 1, c.numObjectives do |
39 local description, type, completed, quantity, requiredQuantity, characterName, flags, assetID, quantityString, criteriaID = GetAchievementCriteriaInfo(cheevID, i) | 44 local description, type, completed, quantity, requiredQuantity, characterName, flags, assetID, quantityString, criteriaID = GetAchievementCriteriaInfo(cheevID, i) |
40 c.objectives[i] = { | 45 c.objectives[i] = { |
41 objectiveIndex = i, | 46 objectiveIndex = i, |
52 criteriaID = criteriaID, | 57 criteriaID = criteriaID, |
53 } | 58 } |
54 end | 59 end |
55 print('Cheevs.|cFF0088FFGetInfo|r('..index..')', 'obj:', GetAchievementNumCriteria(cheevID), name, description) | 60 print('Cheevs.|cFF0088FFGetInfo|r('..index..')', 'obj:', GetAchievementNumCriteria(cheevID), name, description) |
56 | 61 |
62 c.tagInfo = tagInfo | |
57 self.WatchInfo[index] = c | 63 self.WatchInfo[index] = c |
58 return self.Info[cheevID] | 64 return self.Info[cheevID] |
59 end | 65 end |
60 | 66 |
61 --- Content handlers | 67 --- Content handlers |
62 Cheevs.UpdateLine = function(handler, block, line, data) | 68 Cheevs.UpdateLine = function(handler, block, line, data) |
63 local print = B.print('CheevsLine') | 69 local print = B.print('CheevsLine') |
70 local attachment | |
64 line.progress = 0 | 71 line.progress = 0 |
65 print(' ', data.objectiveIndex,'|cFF0088FF-|r', data.objectiveType, data.text) | 72 print(' ', data.objectiveIndex,'|cFF0088FF-|r', data.objectiveType, data.text) |
66 if data.flags then | 73 if data.flags then |
67 if band(data.flags, 0x00000001) > 0 then | 74 if band(data.flags, 0x00000001) > 0 then |
68 line.format = "%d/%d" | 75 line.format = "%d/%d" |
80 | 87 |
81 line.displayText = data.text | 88 line.displayText = data.text |
82 end | 89 end |
83 print('line.type =', data.type) | 90 print('line.type =', data.type) |
84 print(' ** qtyStr:', data.quantityString, 'qty:', data.quantity, 'assetID:', data.assetID) | 91 print(' ** qtyStr:', data.quantityString, 'qty:', data.quantity, 'assetID:', data.assetID) |
92 return line.displayText, line.widget | |
85 end | 93 end |
86 | 94 |
87 Cheevs.Select = function(self) | 95 Cheevs.Select = function(self, block) |
88 T:Update(Cheevs.updateReasonModule) | 96 Cheevs.Link(self, block) |
89 end | 97 end |
90 | 98 |
91 Cheevs.Remove = function(self) | 99 Cheevs.Remove = function(self, block) |
92 | 100 |
93 RemoveTrackedAchievement(self.info.cheevID) | 101 RemoveTrackedAchievement(block.info.cheevID) |
94 end | 102 end |
95 Cheevs.OnMouseUp = function(self, button) | 103 Cheevs.OnMouseUp = function(self, button) |
96 | 104 |
97 Default.OnMouseUp(self, button) | 105 Default.OnMouseUp(self, button) |
98 end | 106 end |
99 Cheevs.Link = function(self) | 107 Cheevs.Link = function(self, block) |
100 | 108 local achievementLink = GetAchievementLink(block.info.cheevID); |
101 local achievementLink = GetAchievementLink(self.info.cheevID); | |
102 if ( achievementLink ) then | 109 if ( achievementLink ) then |
103 ChatEdit_InsertLink(achievementLink); | 110 _G.ChatEdit_InsertLink(achievementLink); |
104 end | 111 end |
105 end | 112 end |
106 | 113 |
107 Cheevs.Open = function(self) | 114 Cheevs.Open = function(self, block) |
108 | 115 |
109 if ( not AchievementFrame ) then | 116 if ( not _G.AchievementFrame ) then |
110 AchievementFrame_LoadUI(); | 117 _G.AchievementFrame_LoadUI(); |
111 end | 118 end |
112 if ( not AchievementFrame:IsShown() ) then | 119 if ( not _G.AchievementFrame:IsShown() ) then |
113 AchievementFrame_ToggleAchievementFrame(); | 120 _G.AchievementFrame_ToggleAchievementFrame(); |
114 end | 121 end |
115 AchievementFrame_SelectAchievement(self.info.cheevID); | 122 _G.AchievementFrame_SelectAchievement(block.info.cheevID); |
116 end | 123 end |