Mercurial > wow > buffalo2
comparison ObjectiveInfo.lua @ 0:3dbcad2b387d
initial push
author | Nenue |
---|---|
date | Wed, 30 Mar 2016 02:24:56 -0400 |
parents | |
children | b0447b382f36 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3dbcad2b387d |
---|---|
1 local B = select(2,...).frame | |
2 local wipe, pairs, ipairs, min, max, unpack = table.wipe, pairs, ipairs, min, max, unpack | |
3 local GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo = GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo | |
4 local GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo = GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo | |
5 local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') | |
6 local print = B.print('Objectives') | |
7 | |
8 local Tracker, AutoQuest, Quest, Cheevs = mod.Tracker, mod.AutoQuest, mod.Quest, mod.Cheevs | |
9 -------------------------------------------------------------------- | |
10 --- Tracker-specific data retrieval functions | |
11 -------------------------------------------------------------------- | |
12 | |
13 Quest.GetNumWatched = function() | |
14 return GetNumQuestWatches () | |
15 end | |
16 Quest.GetInfo = function (self, watchIndex) | |
17 print('|cFF00DDFFQuest|r.|cFF0088FFGetInfo(|r'.. tostring(watchIndex)..'|r)') | |
18 local questID, title, questLogIndex, numObjectives, requiredMoney, isComplete, | |
19 startEvent, isAutoComplete, failureTime, timeElapsed, questType, isTask, isStory, isOnMap, hasLocalPOI = GetQuestWatchInfo(watchIndex) | |
20 print(GetQuestWatchInfo(watchIndex)) | |
21 if not questID then | |
22 return | |
23 end | |
24 print(self.Info) | |
25 self.Info[questID] = self.Info[questID] or {} | |
26 | |
27 local q = self.Info[questID] | |
28 q.watchIndex = watchIndex | |
29 q.type = 'Quest' | |
30 q.questID = questID | |
31 q.title = title | |
32 q.questLogIndex = questLogIndex | |
33 q.numObjectives = numObjectives | |
34 q.requiredMoney = requiredMoney | |
35 q.isComplete = isComplete | |
36 q.startEvent = startEvent | |
37 q.isAutoComplete = isAutoComplete | |
38 q.failureTime = failureTime | |
39 q.timeElapsed = timeElapsed | |
40 q.questType = questType | |
41 q.isTask = isTask | |
42 q.isStory = isStory | |
43 q.isOnMap = isOnMap | |
44 q.hasLocalPOI = hasLocalPOI | |
45 | |
46 --- Start QuestLogEntry calls | |
47 ----------------------------------------- | |
48 SelectQuestLogEntry(questLogIndex) | |
49 q.greenRange = GetQuestGreenRange() | |
50 q.isDaily = QuestIsDaily() | |
51 q.isWeekly = QuestIsWeekly() | |
52 ----------------------------------------- | |
53 | |
54 --- End QuestLogEntry calls | |
55 print(' |cFF0088FF', q.isDaily, q.isWeekly) | |
56 | |
57 q.isComplete = IsQuestComplete(questID) | |
58 q.isBreadCrumb = IsBreadcrumbQuest(questID) | |
59 q.isStoryQuest = IsStoryQuest(questID) | |
60 q.completionText= GetQuestLogCompletionText(questLogIndex) | |
61 q.trackingID = questID | |
62 q.superTracked = (questID == GetSuperTrackedQuestID()) -- call directly so artifact data doesn't become an issue | |
63 q.numObjectives = GetNumQuestLeaderBoards(questLogIndex) | |
64 q.objectives = {} | |
65 for i = 1, q.numObjectives do | |
66 local text, type, finished = GetQuestLogLeaderBoard(i, questLogIndex) | |
67 q.objectives[i] = { | |
68 type = type, | |
69 text = text, | |
70 finished = finished | |
71 } | |
72 if type == 'event' then | |
73 elseif type == 'monster' then | |
74 elseif type == 'object' then | |
75 elseif type == 'reputation' then | |
76 elseif type == 'item' then | |
77 end | |
78 end | |
79 | |
80 local link, icon, charges = GetQuestLogSpecialItemInfo(questLogIndex) | |
81 local start, duration, enable = GetQuestLogSpecialItemCooldown(questLogIndex) | |
82 if link or icon or charges then | |
83 q.specialItem = { | |
84 link = link, | |
85 charges = charges, | |
86 icon = icon, | |
87 start = start, | |
88 duration = duration, | |
89 enable = enable, | |
90 } | |
91 end | |
92 | |
93 self.LogInfo[questLogIndex] = q | |
94 print('|cFF0088FFGetQuestInfo('..questID..')|r', questLogIndex, title) | |
95 return q | |
96 end | |
97 | |
98 Cheevs.GetNumWatched = function(self) | |
99 Cheevs.trackedCheevs = {GetTrackedAchievements()} | |
100 return GetNumTrackedAchievements() | |
101 end | |
102 Cheevs.GetInfo = function(self, index) | |
103 local cheevID = Cheevs.trackedCheevs[index] | |
104 local id, name, points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy = GetAchievementInfo(cheevID) | |
105 | |
106 print('|cFF00FF00', GetAchievementNumCriteria(cheevID)) | |
107 self.Info[cheevID] = {} | |
108 local c = self.Info[cheevID] | |
109 c.type = 'Cheevs' | |
110 c.watchIndex = index | |
111 c.cheevID = cheevID | |
112 c.title = name | |
113 c.points, c.completed, c.month, c.day, c.year, c.description, c.flags, c.icon, c.rewardText, c.isGuildAch, c.wasEarnedByMe, c.earnedBy = | |
114 points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy | |
115 c.numObjectives = GetAchievementNumCriteria(cheevID) | |
116 c.objectives = {} | |
117 for i = 1, c.numObjectives do | |
118 local description, type, completed, quantity, requiredQuantity, characterName, flags, assetID, quantityString, criteriaID = GetAchievementCriteriaInfo(cheevID, i) | |
119 c.objectives[i] = { | |
120 text = description, | |
121 type = type, | |
122 finished = completed, | |
123 quantity = quantity, | |
124 requiredQuantity = requiredQuantity, | |
125 characterName = characterName, | |
126 flags = flags, | |
127 assetID = assetID, | |
128 quantityString = quantityString, | |
129 criteriaID = criteriaID, | |
130 } | |
131 end | |
132 | |
133 self.WatchInfo[index] = c | |
134 return self.Info[cheevID] | |
135 end |