Mercurial > wow > buffalo2
comparison ObjectiveTracker/ObjectiveTracker.lua @ 45:dd1ae565f559
Hooks and Handlers:
- correct argument mix-ups for AcceptQuest/QUEST_ACCEPTED handlers; fixes auto-watch
- respond to AcknowledgeAutoAcceptQuest; fixes lingering popups
- include Popup and Quest trackers in the response code for CompleteQuest; fixes content artifacts following the rollover of repeating popups seen in Ashran
- clean up wacky OnEvent header
Layout
- add alpha blend options
QuestData
- reset objectives data when a quest is in a completed state; keeps old data from ever reaching the Default.x code
| author | Nenue |
|---|---|
| date | Tue, 26 Apr 2016 14:57:18 -0400 |
| parents | 756e8aeb040b |
| children | 1a322b92dbfa |
comparison
equal
deleted
inserted
replaced
| 44:756e8aeb040b | 45:dd1ae565f559 |
|---|---|
| 21 | 21 |
| 22 --- Done once per ui load | 22 --- Done once per ui load |
| 23 local BlizzHooks = { | 23 local BlizzHooks = { |
| 24 'AcceptQuest', | 24 'AcceptQuest', |
| 25 'AddQuestWatch', | 25 'AddQuestWatch', |
| 26 'CompleteQuest', | |
| 26 'RemoveQuestWatch', | 27 'RemoveQuestWatch', |
| 27 'AbandonQuest', | 28 'AbandonQuest', |
| 28 'AcknowledgeAutoAcceptQuest', | 29 'AcknowledgeAutoAcceptQuest', |
| 29 'AddAutoQuestPopUp', | 30 'AddAutoQuestPopUp', |
| 30 'RemoveAutoQuestPopUp', | 31 'RemoveAutoQuestPopUp', |
| 268 Event.QUEST_LOG_UPDATE = function() | 269 Event.QUEST_LOG_UPDATE = function() |
| 269 return OBJECTIVE_TRACKER_UPDATE_QUEST | 270 return OBJECTIVE_TRACKER_UPDATE_QUEST |
| 270 end | 271 end |
| 271 local GetNumQuestWatches, AddQuestWatch, SetSuperTrackedQuestID = GetNumQuestWatches, AddQuestWatch, SetSuperTrackedQuestID | 272 local GetNumQuestWatches, AddQuestWatch, SetSuperTrackedQuestID = GetNumQuestWatches, AddQuestWatch, SetSuperTrackedQuestID |
| 272 Event.QUEST_ACCEPTED = function(questLogIndex, questID, added) | 273 Event.QUEST_ACCEPTED = function(questLogIndex, questID, added) |
| 274 | |
| 275 --todo: stall non-confirmed autoquests | |
| 276 AddQuestWatch(questLogIndex) | |
| 273 if ( IsQuestTask(questID) ) then | 277 if ( IsQuestTask(questID) ) then |
| 274 return OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED + OBJECTIVE_TRACKER_UPDATE_TASK_ADDED, questID, added | 278 return OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED + OBJECTIVE_TRACKER_UPDATE_TASK_ADDED, questID, added |
| 275 else | 279 else |
| 276 return OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, questID, added | 280 return OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, questID, added |
| 277 end | 281 end |
| 278 AddQuestWatch(questID) | |
| 279 end | 282 end |
| 280 | 283 |
| 281 Event.QUEST_WATCH_LIST_CHANGED = function(questID, added) | 284 Event.QUEST_WATCH_LIST_CHANGED = function(questID, added) |
| 282 if ( added == true ) then | 285 if ( added == true ) then |
| 283 if ( not IsQuestTask(questID) ) then | 286 if ( not IsQuestTask(questID) ) then |
| 444 end | 447 end |
| 445 | 448 |
| 446 local Play = function(file) if Devian and Devian.InWorkspace() then PlaySoundFile(file) end end | 449 local Play = function(file) if Devian and Devian.InWorkspace() then PlaySoundFile(file) end end |
| 447 | 450 |
| 448 local tprint = B.print('Tracker') | 451 local tprint = B.print('Tracker') |
| 452 local ignoredNames = { | |
| 453 ['SelectQuestLogEntry'] = true | |
| 454 } | |
| 449 T.OnHookedFunc = function(name, ...) | 455 T.OnHookedFunc = function(name, ...) |
| 450 print('|cFFFF8800securehook:|r', name, '|cFF00FFFFargs:|r', ...) | 456 --tprint('|cFFFF8800securehook:|r', name, '|cFF00FFFFargs:|r', ...) |
| 451 local updateReason, arg1, arg2, arg3 = T[name](...) | 457 local updateReason, arg1, arg2, arg3 = T[name](...) |
| 452 if updateReason then | 458 if updateReason then |
| 453 print('|cFF00FFFFupdate reason:|r', updateReason, arg1, arg2, arg3) | 459 tprint('OnHookedFunc(|cFF00FFFF'..name..'|r):', ...) |
| 454 T:Update(updateReason, arg1, arg2, arg3) | 460 T:Update(updateReason, arg1, arg2, arg3) |
| 461 elseif not ignoredNames[name] then | |
| 462 tprint('OnHookedFunc(|cFFFF4400'..name..'|r):', ...) | |
| 455 end | 463 end |
| 456 end | 464 end |
| 457 | 465 |
| 458 function T:OnEvent (event, ...) | 466 function T:OnEvent (event, ...) |
| 459 local isHandled | 467 local isHandled |
| 466 Play([[Interface\Addons\SharedMedia_MyMedia\sound\Heart.ogg]]) | 474 Play([[Interface\Addons\SharedMedia_MyMedia\sound\Heart.ogg]]) |
| 467 reason = Event[event] | 475 reason = Event[event] |
| 468 end | 476 end |
| 469 else | 477 else |
| 470 print('no event handler set for', event) | 478 print('no event handler set for', event) |
| 479 tprint('no event handler set for', event) | |
| 471 Play([[Interface\Addons\SharedMedia_MyMedia\sound\IM.ogg]]) | 480 Play([[Interface\Addons\SharedMedia_MyMedia\sound\IM.ogg]]) |
| 472 end | 481 end |
| 473 if reason then | 482 if reason then |
| 474 tprint('OnEvent(|cFF00FF00'.. event ..'|r):', ...) | 483 local args = (reason or '0') |
| 484 if arg1 then args = args .. ', ' .. tostring(arg1) end | |
| 485 if arg2 then args = args .. ', ' .. tostring(arg2) end | |
| 486 if arg3 then args = args .. ', ' .. tostring(arg3) end | |
| 487 print('OnEvent(|cFF00FF00'.. event ..'|r):', ..., '|cFFFFFF00=> Update (|r', args,'|cFFFFFF00)|r') | |
| 488 tprint('OnEvent(|cFF00FF00'.. event ..'|r):', ..., '|cFFFFFF00=> Update (|r', args,'|cFFFFFF00)|r') | |
| 475 T:Update(reason, arg1, arg2, arg3) | 489 T:Update(reason, arg1, arg2, arg3) |
| 476 else | 490 else |
| 477 print('OnEvent(|cFFFF4400'.. event ..'|r):', ...) | 491 tprint('OnEvent(|cFFFF4400'.. event ..'|r):', ...) |
| 478 print('no detected reason') | 492 print('no detected reason') |
| 479 --Play([[Interface\Addons\SharedMedia_MyMedia\sound\Quack.ogg]]) | 493 --Play([[Interface\Addons\SharedMedia_MyMedia\sound\Quack.ogg]]) |
| 480 end | 494 end |
| 481 local args = (reason or '0') | |
| 482 if arg1 then args = args .. ', ' .. tostring(arg1) end | |
| 483 if arg2 then args = args .. ', ' .. tostring(arg2) end | |
| 484 if arg3 then args = args .. ', ' .. tostring(arg3) end | |
| 485 tprint('OnEvent(|cFF00FF00'.. event ..'|r):', ..., '|cFFFFFF00=> Update (|r', args,'|cFFFFFF00)|r') | |
| 486 | 495 |
| 487 end | 496 end |
| 488 | 497 |
| 489 | 498 |
| 490 function T:OnInitialize() | 499 function T:OnInitialize() |
| 504 end | 513 end |
| 505 end | 514 end |
| 506 end | 515 end |
| 507 | 516 |
| 508 | 517 |
| 518 local weekDays = {'Su', 'M', 'T', 'W', 'R' ,'F', 'Sa'} | |
| 519 Wrapper.Clock:SetScript('OnUpdate', function(self) | |
| 520 local weekday, month, day, year = CalendarGetDate() | |
| 521 local hour, min = GetGameTime() | |
| 522 self.time:SetFormattedText("%s.%s.%s %d:%02d", weekDays[weekday], month, day, hour, min) | |
| 523 end) | |
| 509 | 524 |
| 510 ObjectiveTrackerFrame:UnregisterAllEvents() | 525 ObjectiveTrackerFrame:UnregisterAllEvents() |
| 511 ObjectiveTrackerFrame:Hide() | 526 ObjectiveTrackerFrame:Hide() |
| 512 _G.MinimapCluster:Hide() | 527 _G.MinimapCluster:Hide() |
| 513 | 528 |
