Mercurial > wow > buffalo2
comparison ObjectiveTracker/Quests.lua @ 39:92534dc793f2
- restore the previous QuestLogSelection after pulling for selection-restricted quest data; fixes icon mixups while quest map is open
- moved progressbar builders into the schema environment, with all the other Frame.lua functions; prep for configuration access
- relegate the various removal events to a framescript in their corresponding blocks; this takes care of resolving dead frames
| author | Nenue |
|---|---|
| date | Thu, 21 Apr 2016 16:43:37 -0400 |
| parents | 1f8f9cc3d956 |
| children | 03ed70f846de |
comparison
equal
deleted
inserted
replaced
| 38:1f8f9cc3d956 | 39:92534dc793f2 |
|---|---|
| 122 print(' |cFF00FF00FreeBlock (' .. block:GetName() .. '):', reason) | 122 print(' |cFF00FF00FreeBlock (' .. block:GetName() .. '):', reason) |
| 123 block:Hide() | 123 block:Hide() |
| 124 tremove(used, info.posIndex) | 124 tremove(used, info.posIndex) |
| 125 tinsert(free, block) | 125 tinsert(free, block) |
| 126 end | 126 end |
| 127 | 127 end |
| 128 | 128 |
| 129 end | 129 Quest.OnRemoved = function(block) |
| 130 | |
| 131 end | |
| 132 | |
| 133 Quest.GetBlock = function(self, index) | |
| 134 local block = Default.GetBlock(self, index) | |
| 135 block:SetScript('OnEvent', Quest.OnRemoved) | |
| 136 block:RegisterEvent('QUEST_REMOVED') | |
| 137 return block | |
| 138 end | |
| 139 | |
| 130 local watchesChecked = {} | 140 local watchesChecked = {} |
| 131 local infosChecked = {} | 141 local infosChecked = {} |
| 132 local blocksChecked = {} | 142 local blocksChecked = {} |
| 133 local GetQuestWatchIndex = GetQuestWatchIndex | 143 local GetQuestWatchIndex = GetQuestWatchIndex |
| 134 --- Get a total of things to show, and straighten out the index while we're at it | 144 --- Get a total of things to show, and straighten out the index while we're at it |
| 302 | 312 |
| 303 temp_status = 'PROGRESS_OBJECTIVES' | 313 temp_status = 'PROGRESS_OBJECTIVES' |
| 304 -- Case 3: quest in progress | 314 -- Case 3: quest in progress |
| 305 -- * Multiple objective lines | 315 -- * Multiple objective lines |
| 306 -- * Possible extra lines for money and timer data respectively | 316 -- * Possible extra lines for money and timer data respectively |
| 317 self.print(' QuestInfo', title, questType, isAutoComplete) | |
| 307 objectives = Quest.GetObjectives(logIndex, numObjectives, false, isSequenced, isStory) | 318 objectives = Quest.GetObjectives(logIndex, numObjectives, false, isSequenced, isStory) |
| 308 q.objectives = objectives | 319 q.objectives = objectives |
| 309 | 320 |
| 310 --- anything past here gets appended to existing objectives | 321 --- anything past here gets appended to existing objectives |
| 311 | 322 |
| 503 end | 514 end |
| 504 | 515 |
| 505 Quest.GetObjectives = function(logIndex, numObjectives, isComplete, isSequenced, isStory) | 516 Quest.GetObjectives = function(logIndex, numObjectives, isComplete, isSequenced, isStory) |
| 506 local print = Quest.print | 517 local print = Quest.print |
| 507 local objectives = {} | 518 local objectives = {} |
| 519 if not logIndex then | |
| 520 return | |
| 521 end | |
| 522 | |
| 508 for i = 1, numObjectives do | 523 for i = 1, numObjectives do |
| 509 local text, type, finished = GetQuestLogLeaderBoard(i, logIndex) | 524 local text, type, finished = GetQuestLogLeaderBoard(i, logIndex) |
| 510 print('GetObjectives', format('|cFF88FF88#%d %s %s %s', i, tostring(type), tostring(text), tostring(finished))) | 525 |
| 526 local progress = 0 | |
| 527 if finished then | |
| 528 progress = 1 | |
| 529 elseif text then | |
| 530 local quantity, maxQuantity = text:match('^(%d+)/(%d+)') | |
| 531 if quantity and maxQuantity then | |
| 532 progress = quantity / maxQuantity | |
| 533 --print('GetObjectives', 'calculated objective progress:', quantity, '/', maxQuantity, '=', progress) | |
| 534 end | |
| 535 end | |
| 536 | |
| 537 print('GetObjectives', format('|cFF88FF88#%d %s %s %s', i, tostring(type), tostring(text), tostring(finished)), '('.. tostring(progress)..')') | |
| 538 | |
| 539 | |
| 511 objectives[i] = { | 540 objectives[i] = { |
| 512 index = i, | 541 index = i, |
| 513 type = type, | 542 type = type, |
| 514 text = text, | 543 text = text, |
| 515 finished = finished | 544 finished = finished, |
| 545 progress = progress | |
| 516 } | 546 } |
| 517 end | 547 end |
| 518 return objectives | 548 return objectives |
| 519 end | 549 end |
| 520 | 550 |
