annotate ObjectiveInfo.lua @ 21:d5ee940de273

use hardcoded aesthetic manipulations over loadstring cramming
author Nenue
date Fri, 08 Apr 2016 06:12:05 -0400
parents 605e8f0e46db
children 9b3fa734abff
rev   line source
Nenue@0 1 local B = select(2,...).frame
Nenue@18 2 local wipe, pairs, ipairs, min, max, unpack, format = table.wipe, pairs, ipairs, min, max, unpack, format
Nenue@18 3 local tinsert, tostring = tinsert, tostring
Nenue@18 4 local GetQuestTagInfo, GetQuestLogTitle = GetQuestTagInfo, GetQuestLogTitle
Nenue@18 5 local GetNumQuestLogEntries, GetNumQuestWatches, GetQuestLogCompletionText, IsQuestWatched, IsQuestHardWatched, GetQuestLogSpecialItemInfo, GetQuestLogSpecialItemCooldown = GetNumQuestLogEntries, GetNumQuestWatches, GetQuestLogCompletionText, IsQuestWatched, IsQuestHardWatched, GetQuestLogSpecialItemInfo, GetQuestLogSpecialItemCooldown
Nenue@18 6 local GetNumAutoQuestPopUps, GetAutoQuestPopUp, GetTasksTable, GetNumQuestLogTasks, GetTaskInfo, GetQuestObjectiveInfo = GetNumAutoQuestPopUps, GetAutoQuestPopUp, GetTasksTable, GetNumQuestLogTasks, GetTaskInfo, GetQuestObjectiveInfo
Nenue@18 7 local GetNumQuestLogRewardCurrencies, GetQuestLogRewardCurrencyInfo, GetNumQuestLogRewards, GetQuestLogRewardInfo, GetQuestLogRewardMoney, GetMoneyString = GetNumQuestLogRewardCurrencies, GetQuestLogRewardCurrencyInfo, GetNumQuestLogRewards, GetQuestLogRewardInfo, GetQuestLogRewardMoney, GetMoneyString
Nenue@0 8 local GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo = GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo
Nenue@16 9 local GetQuestWatchIndex, GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo = GetQuestWatchIndex, GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo
Nenue@18 10 local QuestHasPOIInfo, GetDistanceSqToQuest, GetQuestFactionGroup = QuestHasPOIInfo, GetDistanceSqToQuest, GetQuestFactionGroup
Nenue@18 11 local GetTrackedAchievements, GetNumTrackedAchievements, GetAchievementInfo = GetTrackedAchievements, GetNumTrackedAchievements, GetAchievementInfo
Nenue@0 12 local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
Nenue@14 13 local print = B.print('TrackerInfo')
Nenue@18 14 local QUEST_TAG_DUNGEON = QUEST_TAG_DUNGEON
Nenue@18 15 local QUEST_TAG_GROUP = QUEST_TAG_GROUP
Nenue@18 16 local QUEST_TAG_ACCOUNT = QUEST_TAG_ACCOUNT
Nenue@18 17 local QUEST_TAG_TCOORDS = QUEST_TAG_TCOORDS
Nenue@18 18 local LE_QUEST_FREQUENCY_DAILY = LE_QUEST_FREQUENCY_DAILY
Nenue@18 19 local LE_QUEST_FREQUENCY_WEEKLY = LE_QUEST_FREQUENCY_WEEKLY
Nenue@18 20 local FACTION_ALLIANCE, LE_QUEST_FACTION_HORDE, FACTION_HORDE, LE_QUEST_FACTION_HORDE = FACTION_ALLIANCE, LE_QUEST_FACTION_HORDE, FACTION_HORDE, LE_QUEST_FACTION_HORDE
Nenue@0 21
Nenue@19 22 local Tracker, Bonus, AutoQuest, Quest, Cheevs = mod.DefaultTracker, mod.Bonus, mod.AutoQuest, mod.Quest, mod.Cheevs
Nenue@0 23 --------------------------------------------------------------------
Nenue@0 24 --- Tracker-specific data retrieval functions
Nenue@0 25 --------------------------------------------------------------------
Nenue@13 26
Nenue@13 27
Nenue@13 28 -----------------------------
Nenue@13 29 --- AUTO_QUEST
Nenue@16 30 AutoQuest.LogInfo = {}
Nenue@16 31 AutoQuest.LogBlock = {}
Nenue@16 32 AutoQuest.QuestBlock = {}
Nenue@16 33 AutoQuest.WatchBlock = {}
Nenue@19 34 function AutoQuest:GetNumWatched ()
Nenue@19 35 print(self.name, self)
Nenue@21 36 Quest:GetNumWatched()
Nenue@19 37 self.numWatched = GetNumAutoQuestPopUps()
Nenue@21 38
Nenue@19 39 return self.numWatched
Nenue@16 40 end
Nenue@16 41 AutoQuest.GetInfo = function(self, popupIndex)
Nenue@16 42
Nenue@16 43 local questID, type = GetAutoQuestPopUp(popupIndex)
Nenue@16 44 local questIndex = GetQuestLogIndexByID(questID)
Nenue@21 45 local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questIndex)
Nenue@16 46
Nenue@16 47 self.Info[questID] = {
Nenue@21 48 title = title,
Nenue@16 49 description = type,
Nenue@16 50 popupType = type,
Nenue@16 51 questID = questID,
Nenue@16 52 questIndex = questIndex,
Nenue@16 53 popupIndex = popupIndex,
Nenue@16 54 }
Nenue@21 55 self.WatchInfo[popupIndex] = self.Info[questID]
Nenue@16 56
Nenue@16 57
Nenue@16 58 return self.Info[questID]
Nenue@13 59 end
Nenue@13 60
Nenue@13 61 -----------------------------
Nenue@14 62 --- BONUS OBJECTIVE
Nenue@21 63 -- The default UI pops them up as you enter their relevant areas, but the data is actually available at all times.
Nenue@21 64 -- The only requirement is that you've been to said area and progressed any of the objectives.
Nenue@21 65 -- Blizzard deal with this fact by caching any task data collected during session and masking out whatever gets completed.
Nenue@21 66 -- For the addon's module structure to work, GetNumWatched method also invokes a tasks table scan.
Nenue@21 67 -- That composes the table searched by GetInfo().
Nenue@14 68
Nenue@21 69 ------------------------------------------------------------------------------------------
Nenue@21 70 --- These functions are copied from Blizzard_BonusObjectiveTracker.lua;
Nenue@21 71 -- It's kind of dumb, but this avoids the risk of code taint.
Nenue@21 72
Nenue@21 73 --- Returns a tasks table modified to include recently completed objectives
Nenue@21 74 local completedTasks = {}
Nenue@21 75 local InternalGetTasksTable = function()
Nenue@21 76 local tasks = GetTasksTable()
Nenue@21 77 for questID, data in pairs(completedTasks) do
Nenue@21 78 if questID > 0 then
Nenue@21 79 local found = false
Nenue@21 80 for i = 1, #tasks do
Nenue@21 81 if tasks[i] == questID then
Nenue@21 82 found = true
Nenue@21 83 break
Nenue@21 84 end
Nenue@21 85 end
Nenue@21 86 -- if it's not part of the current table, then try to insert it where it was last found
Nenue@21 87 if not found then
Nenue@21 88 if data.watchIndex < #tasks then
Nenue@21 89 tinsert(tasks, data.watchIndex, data)
Nenue@21 90 else
Nenue@21 91 tinsert(tasks, data)
Nenue@21 92 end
Nenue@21 93 end
Nenue@21 94 end
Nenue@21 95 end
Nenue@21 96 return tasks
Nenue@21 97 end
Nenue@21 98
Nenue@21 99 --- Returns an entry from the composed tasks table if possible, otherwise makes an API pull
Nenue@21 100 local InternalGetTaskInfo = function(questID)
Nenue@21 101 if completedTasks[questID] then
Nenue@21 102 return true, true, #completedTasks[questID].objectives
Nenue@21 103 else
Nenue@21 104 return GetTaskInfo(questID)
Nenue@21 105 end
Nenue@21 106 end
Nenue@21 107
Nenue@21 108 --- Same as above but for the objective entries
Nenue@21 109 local InternalGetQuestObjectiveInfo = function(questID, objectiveIndex)
Nenue@21 110 if ( completedTasks[questID] ) then
Nenue@21 111 return completedTasks[questID].objectives[objectiveIndex], completedTasks[questID].objectiveType, true;
Nenue@21 112 else
Nenue@21 113 return GetQuestObjectiveInfo(questID, objectiveIndex, false);
Nenue@21 114 end
Nenue@21 115 end
Nenue@21 116
Nenue@21 117 --- end redundant copy of silliness
Nenue@21 118 ------------------------------------------------------------------------------------------
Nenue@21 119
Nenue@21 120 Bonus.Completed = {}
Nenue@21 121 Bonus.POI = {}
Nenue@21 122 Bonus.Scenario = {}
Nenue@14 123 Bonus.QuestBlock = {}
Nenue@19 124 function Bonus:GetNumWatched ()
Nenue@19 125 print(self.name, self)
Nenue@21 126 local tasks = InternalGetTasksTable()
Nenue@21 127 local numWatched = 0
Nenue@21 128 local numAll = 0
Nenue@21 129 self.WatchInfo = {}
Nenue@16 130 print('|cFFFFFF00Bonus.GetNumWatched()|r', #tasks)
Nenue@16 131 for i, questID in ipairs(tasks) do
Nenue@21 132 local isInArea, isOnMap, numObjectives = InternalGetTaskInfo(questID)
Nenue@21 133 local existingTask = self.QuestBlock[questID]
Nenue@21 134 local displayObjectiveHeader = false;
Nenue@21 135 print (' |cFF00FF00taskIndex', i, 'questID', questID, 'inArea', isInArea, 'onMap', isOnMap, 'existing', (existingTask and 'Y' or 'N'))
Nenue@21 136 if isInArea or isOnMap then
Nenue@21 137 self.Info[questID] = self.Info[questID] or {}
Nenue@21 138
Nenue@21 139 local t = self.Info[questID]
Nenue@21 140 local title = GetQuestLogTitle(questID)
Nenue@21 141 self.WatchInfo[i] = t
Nenue@21 142 t.title = title
Nenue@21 143 t.isInArea = isInArea
Nenue@21 144 t.isOnMap = isOnMap
Nenue@21 145 t.existingTask = existingTask
Nenue@21 146 t.questID = questID
Nenue@21 147 t.objectives = {}
Nenue@21 148 t.taskIndex = i
Nenue@21 149
Nenue@21 150 local taskFinished = true;
Nenue@21 151 for objectiveIndex = 1, numObjectives do
Nenue@21 152 local text, objectiveType, finished, displayAsObjective = InternalGetQuestObjectiveInfo(questID, objectiveIndex, false);
Nenue@21 153 displayObjectiveHeader = displayObjectiveHeader or displayAsObjective;
Nenue@21 154 print(' --', text, objectiveType, finished, displayAsObjective)
Nenue@21 155 t.objectives[objectiveIndex] = t.objectives[objectiveIndex] or {}
Nenue@21 156 local o = t.objectives[objectiveIndex]
Nenue@21 157
Nenue@21 158 o.objectiveIndex = objectiveIndex
Nenue@21 159 o.text = text
Nenue@21 160 o.objectiveType = objectiveType
Nenue@21 161 o.finished = finished
Nenue@21 162 o.displayAsObjective = displayAsObjective
Nenue@21 163 print(' |cFF00FF88*', objectiveIndex, text)
Nenue@21 164 end
Nenue@14 165 end
Nenue@14 166 end
Nenue@21 167
Nenue@21 168
Nenue@21 169 self.numAll = #tasks
Nenue@21 170 self.numWatched = #self.WatchInfo
Nenue@21 171 print(' stats:', self.numAll, 'active tasks,', self.numWatched, 'nearby or animating')
Nenue@21 172 --return #tasks
Nenue@14 173 return GetNumQuestLogTasks()
Nenue@14 174 end
Nenue@16 175
Nenue@16 176 Bonus.GetInfo = function(self, taskIndex)
Nenue@19 177 print(self.name, self)
Nenue@21 178 return self.WatchInfo[taskIndex]
Nenue@16 179 end
Nenue@16 180
Nenue@21 181 Bonus.Store = function(questID)
Nenue@16 182
Nenue@14 183 if not questID then
Nenue@16 184 print('|cFFFF4400invalid quest ID', questID)
Nenue@14 185 return
Nenue@14 186 end
Nenue@14 187
Nenue@16 188 Bonus.Info[questID] = Bonus.Info[questID] or {}
Nenue@16 189 local t = Bonus.Info[questID]
Nenue@16 190 local isInArea, isOnMap, numObjectives = GetTaskInfo(questID)
Nenue@16 191 t.questID = questID
Nenue@16 192 t.numObjectives = numObjectives
Nenue@16 193 t.isInArea = isInArea
Nenue@16 194 t.isOnMap = isOnMap
Nenue@14 195
Nenue@16 196 print(' isInArea', isInArea, 'isOnMap', isOnMap, 'numObj', numObjectives)
Nenue@16 197 local displayObjectives = false
Nenue@16 198 local isComplete = true
Nenue@16 199 if numObjectives >= 1 then
Nenue@16 200 print(' ', numObjectives,'objective rows')
Nenue@14 201 t.objectives = {}
Nenue@14 202 for i = 1, t.numObjectives do
Nenue@14 203 t.objectives[i] = {}
Nenue@14 204 local o = t.objectives[i]
Nenue@14 205 o.index = i
Nenue@16 206 --local text, objectiveType, finished, displayAsObjective =
Nenue@16 207 o.text, o.objectiveType, o.finished, o.displayAsObjective = GetQuestObjectiveInfo(questID, i, false)
Nenue@14 208
Nenue@14 209 print(i, '==>', o.text, o.objectiveType, o.finished, o.displayAsObjective)
Nenue@14 210 t.displayObjectives = t.displayObjectives or o.displayAsObjective
Nenue@14 211 t.isComplete = t.isComplete and o.finished
Nenue@14 212
Nenue@14 213 end
Nenue@14 214 end
Nenue@16 215
Nenue@16 216 t.displayObjectives = displayObjectives
Nenue@16 217
Nenue@16 218
Nenue@16 219 local rewards = {}
Nenue@16 220 t.numCurrencies = GetNumQuestLogRewardCurrencies(questID)
Nenue@16 221 for i = 1, t.numCurrencies do
Nenue@16 222 local name, texture, count = GetQuestLogRewardCurrencyInfo(i, questID)
Nenue@16 223 tinsert(rewards,{
Nenue@16 224 type = 'currency',
Nenue@16 225 index = i,
Nenue@16 226 name = name,
Nenue@16 227 texture = texture,
Nenue@16 228 count = count
Nenue@16 229 });
Nenue@16 230 end
Nenue@16 231 -- items
Nenue@16 232 t.numItems = GetNumQuestLogRewards(questID)
Nenue@16 233 for i = 1, t.numItems do
Nenue@16 234 local name, texture, count, quality, isUsable = GetQuestLogRewardInfo(i, questID)
Nenue@16 235 tinsert(rewards, {
Nenue@16 236 type = 'item',
Nenue@16 237 index = i ,
Nenue@16 238 name = name,
Nenue@16 239 texture = texture,
Nenue@16 240 count = count,
Nenue@16 241 quality = quality,
Nenue@16 242 isUsable = isUsable
Nenue@16 243 });
Nenue@16 244 end
Nenue@16 245 -- money
Nenue@16 246
Nenue@16 247 local money = GetQuestLogRewardMoney(questID)
Nenue@16 248 if ( money > 0 ) then
Nenue@16 249 tinsert(rewards, {
Nenue@16 250 type = 'money',
Nenue@16 251 name = GetMoneyString(money),
Nenue@16 252 texture = "Interface\\Icons\\inv_misc_coin_01",
Nenue@16 253 count = 0,
Nenue@16 254 });
Nenue@16 255 end
Nenue@16 256
Nenue@16 257 if #rewards >= 1 then
Nenue@16 258 t.rewardInfo = rewards
Nenue@16 259 end
Nenue@16 260
Nenue@14 261 Bonus.TasksTable[questID] = t
Nenue@14 262
Nenue@14 263 return t
Nenue@14 264 end
Nenue@14 265
Nenue@14 266 -----------------------------
Nenue@13 267 --- QUEST
Nenue@1 268 Quest.itemButtons = {}
Nenue@1 269 Quest.freeButtons = {}
Nenue@1 270 Quest.POI = {}
Nenue@5 271 Quest.QuestBlock = {}
Nenue@16 272 Quest.LogBlock = {}
Nenue@16 273 Quest.LogInfo = {}
Nenue@18 274
Nenue@19 275 function Quest:GetNumWatched ()
Nenue@19 276 print(self.name, self)
Nenue@19 277 self.numAll = GetNumQuestLogEntries()
Nenue@19 278 self.numWatched = GetNumQuestWatches()
Nenue@19 279 return self.numWatched, self.numAll
Nenue@0 280 end
Nenue@0 281 Quest.GetInfo = function (self, watchIndex)
Nenue@0 282 print('|cFF00DDFFQuest|r.|cFF0088FFGetInfo(|r'.. tostring(watchIndex)..'|r)')
Nenue@1 283 local questID, title, questIndex, numObjectives, requiredMoney, isComplete,
Nenue@0 284 startEvent, isAutoComplete, failureTime, timeElapsed, questType, isTask, isStory, isOnMap, hasLocalPOI = GetQuestWatchInfo(watchIndex)
Nenue@13 285
Nenue@19 286 if not questIndex then
Nenue@19 287 return
Nenue@19 288 end
Nenue@19 289
Nenue@14 290 local _, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, _, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questIndex)
Nenue@18 291
Nenue@13 292
Nenue@0 293 if not questID then
Nenue@0 294 return
Nenue@0 295 end
Nenue@16 296 Quest.Info[questID] = Quest.Info[questID] or {}
Nenue@0 297
Nenue@16 298 local q = Quest.Info[questID]
Nenue@0 299 q.watchIndex = watchIndex
Nenue@0 300 q.type = 'Quest'
Nenue@0 301 q.questID = questID
Nenue@0 302 q.title = title
Nenue@13 303 q.level = level
Nenue@18 304 q.displayQuestID = displayQuestID
Nenue@18 305 q.suggestedGroup = suggestedGroup
Nenue@1 306 q.questLogIndex = questIndex
Nenue@0 307 q.numObjectives = numObjectives
Nenue@0 308 q.requiredMoney = requiredMoney
Nenue@0 309 q.isComplete = isComplete
Nenue@0 310 q.startEvent = startEvent
Nenue@0 311 q.isAutoComplete = isAutoComplete
Nenue@0 312 q.failureTime = failureTime
Nenue@0 313 q.timeElapsed = timeElapsed
Nenue@0 314 q.questType = questType
Nenue@0 315 q.isTask = isTask
Nenue@0 316 q.isStory = isStory
Nenue@0 317 q.isOnMap = isOnMap
Nenue@0 318 q.hasLocalPOI = hasLocalPOI
Nenue@18 319 q.frequency = frequency
Nenue@13 320 q.isComplete = isComplete
Nenue@13 321 q.isStory = isStory
Nenue@13 322 q.isTask = isTask
Nenue@14 323
Nenue@18 324 --- resolve icon type and template
Nenue@18 325 local tagID, tagName = GetQuestTagInfo(questID)
Nenue@18 326 if ( tagName ) then
Nenue@18 327 local factionGroup = GetQuestFactionGroup(questID);
Nenue@18 328 -- Faction-specific account quests have additional info in the tooltip
Nenue@18 329 if ( tagID == QUEST_TAG_ACCOUNT and factionGroup ) then
Nenue@18 330 local factionString = FACTION_ALLIANCE;
Nenue@18 331 if ( factionGroup == LE_QUEST_FACTION_HORDE ) then
Nenue@18 332 factionString = FACTION_HORDE;
Nenue@18 333 end
Nenue@18 334 tagName = format("%s (%s)", tagName, factionString);
Nenue@18 335 end
Nenue@18 336 if ( QUEST_TAG_TCOORDS[tagID] ) then
Nenue@18 337 local questTypeIcon;
Nenue@18 338 if ( tagID == QUEST_TAG_ACCOUNT and factionGroup ) then
Nenue@18 339 q.typeTag = QUEST_TAG_TCOORDS["ALLIANCE"];
Nenue@18 340 if ( factionGroup == LE_QUEST_FACTION_HORDE ) then
Nenue@18 341 q.typeTag= QUEST_TAG_TCOORDS["HORDE"];
Nenue@18 342 end
Nenue@18 343 else
Nenue@18 344 q.typeTag = QUEST_TAG_TCOORDS[tagID];
Nenue@18 345 end
Nenue@18 346 end
Nenue@14 347 end
Nenue@14 348
Nenue@18 349 if ( frequency == LE_QUEST_FREQUENCY_DAILY ) then
Nenue@18 350 q.frequencyTag = QUEST_TAG_TCOORDS["DAILY"]
Nenue@18 351 q.mainStyle = 'Daily'
Nenue@18 352 elseif ( frequency == LE_QUEST_FREQUENCY_WEEKLY ) then
Nenue@18 353 q.frequencyTag = QUEST_TAG_TCOORDS["WEEKLY"]
Nenue@18 354 q.mainStyle = 'Daily'
Nenue@18 355 end
Nenue@18 356 if ( isComplete and isComplete < 0 ) then
Nenue@18 357 q.completionTag = QUEST_TAG_TCOORDS["FAILED"]
Nenue@18 358 q.subStyle = 'Failed'
Nenue@18 359 elseif isComplete then
Nenue@18 360 q.completionTag = QUEST_TAG_TCOORDS["COMPLETED"]
Nenue@18 361 q.subStyle = 'Complete'
Nenue@18 362 end
Nenue@18 363 q.tagID = tagID
Nenue@18 364 q.tagName = tagName
Nenue@18 365
Nenue@18 366
Nenue@18 367
Nenue@13 368 --q.isBreadCrumb = isBreadCrumb
Nenue@1 369 q.completionText= GetQuestLogCompletionText(questIndex)
Nenue@1 370 q.numObjectives = GetNumQuestLeaderBoards(questIndex)
Nenue@0 371 q.objectives = {}
Nenue@0 372 for i = 1, q.numObjectives do
Nenue@1 373 local text, type, finished = GetQuestLogLeaderBoard(i, questIndex)
Nenue@0 374 q.objectives[i] = {
Nenue@14 375 index = i,
Nenue@0 376 type = type,
Nenue@0 377 text = text,
Nenue@0 378 finished = finished
Nenue@0 379 }
Nenue@0 380 if type == 'event' then
Nenue@0 381 elseif type == 'monster' then
Nenue@0 382 elseif type == 'object' then
Nenue@0 383 elseif type == 'reputation' then
Nenue@0 384 elseif type == 'item' then
Nenue@0 385 end
Nenue@0 386 end
Nenue@0 387
Nenue@1 388 local link, icon, charges = GetQuestLogSpecialItemInfo(questIndex)
Nenue@1 389 local start, duration, enable = GetQuestLogSpecialItemCooldown(questIndex)
Nenue@0 390 if link or icon or charges then
Nenue@0 391 q.specialItem = {
Nenue@1 392 questID = questID,
Nenue@1 393 questIndex = questIndex,
Nenue@0 394 link = link,
Nenue@0 395 charges = charges,
Nenue@0 396 icon = icon,
Nenue@0 397 start = start,
Nenue@0 398 duration = duration,
Nenue@0 399 enable = enable,
Nenue@0 400 }
Nenue@0 401 end
Nenue@0 402
Nenue@1 403 if QuestHasPOIInfo(questID) then
Nenue@1 404 local distance, onContinent = GetDistanceSqToQuest(questIndex)
Nenue@1 405 if distance ~= nil and distance > 0 then
Nenue@1 406 self.POI[questIndex] = {
Nenue@1 407 questIndex = questIndex,
Nenue@1 408 questID = questID,
Nenue@1 409 distance = distance,
Nenue@1 410 onContinent = onContinent
Nenue@1 411 }
Nenue@1 412 end
Nenue@1 413 end
Nenue@1 414
Nenue@18 415
Nenue@18 416 q.selected = (questID == GetSuperTrackedQuestID()) -- call directly so artifact data doesn't become an issue
Nenue@8 417 self.WatchInfo[watchIndex] = q
Nenue@1 418 self.LogInfo[questIndex] = q
Nenue@2 419 print('- logIndex =', questIndex, 'title =', title)
Nenue@0 420 return q
Nenue@0 421 end
Nenue@0 422
Nenue@1 423 Quest.GetClosest = function()
Nenue@1 424 local minID
Nenue@1 425 local minDist = math.huge
Nenue@1 426 for i = 1, Quest.GetNumWatched() do
Nenue@1 427 local info = Quest.GetInfo(i)
Nenue@1 428 if info.hasLocalPOI then
Nenue@1 429 local distance, onContinent = GetDistanceSqToQuest(info.questIndex)
Nenue@1 430 end
Nenue@1 431 end
Nenue@1 432 end
Nenue@1 433
Nenue@6 434
Nenue@0 435 Cheevs.GetNumWatched = function(self)
Nenue@21 436 print('|cFF00FF00' .. GetTime())
Nenue@0 437 Cheevs.trackedCheevs = {GetTrackedAchievements()}
Nenue@0 438 return GetNumTrackedAchievements()
Nenue@0 439 end
Nenue@0 440 Cheevs.GetInfo = function(self, index)
Nenue@0 441 local cheevID = Cheevs.trackedCheevs[index]
Nenue@0 442 local id, name, points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy = GetAchievementInfo(cheevID)
Nenue@0 443
Nenue@0 444 self.Info[cheevID] = {}
Nenue@0 445 local c = self.Info[cheevID]
Nenue@0 446 c.type = 'Cheevs'
Nenue@0 447 c.watchIndex = index
Nenue@0 448 c.cheevID = cheevID
Nenue@0 449 c.title = name
Nenue@0 450 c.points, c.completed, c.month, c.day, c.year, c.description, c.flags, c.icon, c.rewardText, c.isGuildAch, c.wasEarnedByMe, c.earnedBy =
Nenue@0 451 points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy
Nenue@0 452 c.numObjectives = GetAchievementNumCriteria(cheevID)
Nenue@0 453 c.objectives = {}
Nenue@0 454 for i = 1, c.numObjectives do
Nenue@0 455 local description, type, completed, quantity, requiredQuantity, characterName, flags, assetID, quantityString, criteriaID = GetAchievementCriteriaInfo(cheevID, i)
Nenue@0 456 c.objectives[i] = {
Nenue@21 457 objectiveIndex = i,
Nenue@8 458 cheevID = cheevID,
Nenue@0 459 text = description,
Nenue@0 460 type = type,
Nenue@0 461 finished = completed,
Nenue@14 462 value = quantity,
Nenue@14 463 maxValue = requiredQuantity,
Nenue@0 464 characterName = characterName,
Nenue@0 465 flags = flags,
Nenue@0 466 assetID = assetID,
Nenue@0 467 quantityString = quantityString,
Nenue@0 468 criteriaID = criteriaID,
Nenue@0 469 }
Nenue@0 470 end
Nenue@3 471 print('Cheevs.|cFF0088FFGetInfo|r('..index..')', 'obj:', GetAchievementNumCriteria(cheevID), name, description)
Nenue@0 472
Nenue@0 473 self.WatchInfo[index] = c
Nenue@0 474 return self.Info[cheevID]
Nenue@0 475 end