Mercurial > wow > buffalo2
comparison ObjectiveTracker/ObjectiveTracker.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 | a3afe6c3771e |
comparison
equal
deleted
inserted
replaced
| 29:adcd7c328d07 | 30:7583684becf4 |
|---|---|
| 5 -- Created: 3/26/2016 1:51 AM | 5 -- Created: 3/26/2016 1:51 AM |
| 6 local B, _G = select(2,...).frame, _G | 6 local B, _G = select(2,...).frame, _G |
| 7 local pairs, setmetatable, type, tostring, band, format = _G.pairs, _G.setmetatable, _G.type, _G.tostring, bit.band, string.format | 7 local pairs, setmetatable, type, tostring, band, format = _G.pairs, _G.setmetatable, _G.type, _G.tostring, bit.band, string.format |
| 8 local ipairs, tinsert, hooksecurefunc = _G.ipairs, _G.tinsert, _G.hooksecurefunc | 8 local ipairs, tinsert, hooksecurefunc = _G.ipairs, _G.tinsert, _G.hooksecurefunc |
| 9 local PlaySoundFile, IsQuestTask, SortQuestWatches, GetCurrentMapAreaID, GetZoneText, GetMinimapZoneText = PlaySoundFile, IsQuestTask, SortQuestWatches, GetCurrentMapAreaID, GetZoneText, GetMinimapZoneText | 9 local PlaySoundFile, IsQuestTask, SortQuestWatches, GetCurrentMapAreaID, GetZoneText, GetMinimapZoneText = PlaySoundFile, IsQuestTask, SortQuestWatches, GetCurrentMapAreaID, GetZoneText, GetMinimapZoneText |
| 10 local AddQuestWatch, SetSuperTrackedQuestID, GetNumQuestWatches, AUTO_QUEST_WATCH, MAX_WATCHABLE_QUESTS = AddQuestWatch, SetSuperTrackedQuestID, GetNumQuestWatches, AUTO_QUEST_WATCH, MAX_WATCHABLE_QUESTS | |
| 11 local QuestPOIUpdateIcons, GetCVar, IsPlayerInMicroDungeon, WorldMapFrame, GetCVarBool, SetMapToCurrentZone = QuestPOIUpdateIcons, GetCVar, IsPlayerInMicroDungeon, WorldMapFrame, GetCVarBool, SetMapToCurrentZone | 10 local QuestPOIUpdateIcons, GetCVar, IsPlayerInMicroDungeon, WorldMapFrame, GetCVarBool, SetMapToCurrentZone = QuestPOIUpdateIcons, GetCVar, IsPlayerInMicroDungeon, WorldMapFrame, GetCVarBool, SetMapToCurrentZone |
| 12 local AddAutoQuestPopUp = AddAutoQuestPopUp | 11 local AddAutoQuestPopUp = AddAutoQuestPopUp |
| 13 local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') | 12 local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') |
| 14 local print = B.print('Objectives') | 13 local print = B.print('Objectives') |
| 15 local ObjectiveTrackerFrame, VeneerObjectiveScroll, CreateFrame = _G.ObjectiveTrackerFrame, _G.VeneerObjectiveScroll, _G.CreateFrame | 14 local ObjectiveTrackerFrame, VeneerObjectiveScroll, CreateFrame = _G.ObjectiveTrackerFrame, _G.VeneerObjectiveScroll, _G.CreateFrame |
| 245 local trackerName = 'Veneer'..name..'Tracker' | 244 local trackerName = 'Veneer'..name..'Tracker' |
| 246 local handler = T[name] | 245 local handler = T[name] |
| 247 local frame = CreateFrame('Frame', trackerName, _G.VeneerObjectiveScroll, 'VeneerTrackerTemplate') | 246 local frame = CreateFrame('Frame', trackerName, _G.VeneerObjectiveScroll, 'VeneerTrackerTemplate') |
| 248 frame.title:SetText(handler.displayName) | 247 frame.title:SetText(handler.displayName) |
| 249 frame:SetWidth(c.Width) | 248 frame:SetWidth(c.Width) |
| 249 frame.previousOffset = 0 | |
| 250 | 250 |
| 251 handler.frame = frame | 251 handler.frame = frame |
| 252 handler.numBlocks = 0 | 252 handler.numBlocks = 0 |
| 253 handler.actualBlocks = 0 | 253 handler.actualBlocks = 0 |
| 254 handler.trackerName = trackerName | 254 handler.trackerName = trackerName |
| 264 | 264 |
| 265 local Event = {} | 265 local Event = {} |
| 266 Event.QUEST_LOG_UPDATE = function() | 266 Event.QUEST_LOG_UPDATE = function() |
| 267 return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST + OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE | 267 return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST + OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE |
| 268 end | 268 end |
| 269 Event.QUEST_ACCEPTED = function(questLogIndex, questID) | 269 local GetNumQuestWatches, AddQuestWatch, SetSuperTrackedQuestID = GetNumQuestWatches, AddQuestWatch, SetSuperTrackedQuestID |
| 270 Event.QUEST_ACCEPTED = function(questLogIndex, questID, added) | |
| 270 if ( IsQuestTask(questID) ) then | 271 if ( IsQuestTask(questID) ) then |
| 271 return OBJECTIVE_TRACKER_UPDATE_TASK_ADDED, questID | 272 return OBJECTIVE_TRACKER_UPDATE_TASK_ADDED, questID |
| 272 else | 273 else |
| 273 if ( AUTO_QUEST_WATCH == "1" and GetNumQuestWatches() < MAX_WATCHABLE_QUESTS ) then | 274 if ( _G.AUTO_QUEST_WATCH == "1" ) then |
| 274 AddQuestWatch(questLogIndex); | 275 AddQuestWatch(questLogIndex); |
| 275 SetSuperTrackedQuestID(questID); | 276 SetSuperTrackedQuestID(questID); |
| 276 end | 277 end |
| 277 return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST | 278 return OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, questID, added |
| 278 end | 279 end |
| 280 end | |
| 281 | |
| 282 Event.QUEST_REMOVED = function(questLogIndex, questID) | |
| 283 return OBJECTIVE_TRACKER_UPDATE_QUEST, questID, false | |
| 279 end | 284 end |
| 280 | 285 |
| 281 Event.QUEST_WATCH_LIST_CHANGED = function(questID, added) | 286 Event.QUEST_WATCH_LIST_CHANGED = function(questID, added) |
| 282 if ( added ) then | 287 if ( added ) then |
| 283 if ( not IsQuestTask(questID) ) then | 288 if ( not IsQuestTask(questID) ) then |
| 426 if reason then | 431 if reason then |
| 427 T:Update(reason, arg1, arg2, arg3) | 432 T:Update(reason, arg1, arg2, arg3) |
| 428 end | 433 end |
| 429 end | 434 end |
| 430 else | 435 else |
| 431 Play([[Interface\Addons\SharedMedia_MyMedia\sound\Heart.ogg]]) | 436 --Play([[Interface\Addons\SharedMedia_MyMedia\sound\Heart.ogg]]) |
| 432 reason = Event[event] | 437 reason = Event[event] |
| 433 end | 438 end |
| 434 else | 439 else |
| 435 Play([[Interface\Addons\SharedMedia_MyMedia\sound\Quack.ogg]]) | 440 print('no event handler set for', event) |
| 441 Play([[Interface\Addons\SharedMedia_MyMedia\sound\IM.ogg]]) | |
| 436 end | 442 end |
| 437 if reason then | 443 if reason then |
| 444 print('update reason:', reason, 'args:', arg1, arg2, arg3) | |
| 438 T:Update(reason, arg1, arg2, arg3) | 445 T:Update(reason, arg1, arg2, arg3) |
| 439 else | 446 else |
| 440 print('no reason value returned') | 447 print('no reason value returned') |
| 441 Play([[Interface\Addons\SharedMedia_MyMedia\sound\Quack.ogg]]) | 448 Play([[Interface\Addons\SharedMedia_MyMedia\sound\Quack.ogg]]) |
| 442 end | 449 end |
| 489 print('|cFFFF0088listen to', event, 'for action|r', tostring(action)) | 496 print('|cFFFF0088listen to', event, 'for action|r', tostring(action)) |
| 490 Wrapper:RegisterEvent(event) | 497 Wrapper:RegisterEvent(event) |
| 491 end | 498 end |
| 492 | 499 |
| 493 local c = T.Conf.Wrapper | 500 local c = T.Conf.Wrapper |
| 494 | 501 Wrapper.previousHeight = 0 |
| 495 Scroller:SetScrollChild(Scroll) | 502 Scroller:SetScrollChild(Scroll) |
| 496 Scroller:SetWidth(c.Width) | 503 Scroller:SetWidth(c.Width) |
| 497 Scroll:SetWidth(c.Width) | 504 Scroll:SetWidth(c.Width) |
| 498 Scroll:ClearAllPoints() | 505 Scroll:ClearAllPoints() |
| 499 Scroll:SetPoint('TOP', Scroller, 'TOP') | 506 Scroll:SetPoint('TOP', Scroller, 'TOP') |
| 502 Scroller:Show() | 509 Scroller:Show() |
| 503 | 510 |
| 504 local from, target, to, x, y = Wrapper:GetPoint(1) | 511 local from, target, to, x, y = Wrapper:GetPoint(1) |
| 505 print(from, target:GetName(), to, x,y) | 512 print(from, target:GetName(), to, x,y) |
| 506 | 513 |
| 507 T:Update() | |
| 508 | 514 |
| 509 -- run once to prime the data structure | 515 -- run once to prime the data structure |
| 510 T.UpdateActionButtons() | 516 T.UpdateActionButtons() |
| 511 end | 517 end |
| 512 | 518 |
