Mercurial > wow > buffalo2
view ObjectiveEvents.lua @ 14:ed642234f017
ObjectiveFrame
- implement proper tracker name text
- expanded tracker prototypes to cover "objective lines" formatting and accommodation of widget variables
- implement the progress bars for bonus objectives
ObjectiveStyle
- moved `UpdateWrapperStyle` over and renamed it to fit semantics
- change the formula for block.`height` to measure non-widget content only
- allows widgets to position relative to text
- size FontString `status` to match block.`height`
- full block height is acquired by adding block.`height` and block.`attachmentHeight` which is calculated during objective parsing
ObjectiveWidgets
- use string keys for generated widgets to deal with multiple objectives under the same questID, and maybe dungeon objectives
- wrapper buttons use a common code path
- specialized handlers for wheel scrolling moved over to fit semantics
author | Nenue |
---|---|
date | Mon, 04 Apr 2016 03:16:22 -0400 |
parents | 7923243ae972 |
children | 880828018bf4 |
line wrap: on
line source
--- ${PACKAGE_NAME} -- @file-author@ -- @project-revision@ @project-hash@ -- @file-revision@ @file-hash@ -- Created: 3/30/2016 1:23 AM local B = select(2,...).frame local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') local print = B.print('ObjectiveEvent') local isHooked local SmallEvents = { QUEST_ACCEPTED = 'OnQuestAccepted', QUEST_REMOVED = 'OnQuestRemoved' } local HandlerEvents = { QUEST_ACCEPTED = mod.Quest, QUEST_REMOVED = mod.Quest, QUEST_WATCH_LIST_CHANGED = mod.Quest, SUPER_TRACKED_QUEST_CHANGED = mod.Quest, QUEST_LOG_UPDATE = mod.Quest, TRACKED_ACHIEVEMENT_LIST_CHANGED = mod.Cheevs, TRACKED_ACHIEVEMENT_UPDATE = mod.Cheevs } local BlizzHooks = { ['AddQuestWatch'] = 'AddQuestWatch', ['RemoveQuestWatch'] = 'RemoveQuestWatch', ['AbandonQuest'] = 'AbandonQuest', ['AcknowledgeAutoAcceptQuest'] = 'AcknowledgeAutoAcceptQuest', ['AddAutoQuestPopUp'] = 'AddAutoQuestPopUp', ['RemoveTrackedAchievement'] = 'RemoveTrackedAchievement' } mod.SetEvents = function() for event, _ in pairs(SmallEvents) do mod:RegisterEvent(event) end for event, _ in pairs(HandlerEvents) do mod:RegisterEvent(event) end mod:SetScript('OnEvent', mod.OnEvent) if not isHooked then VeneerData.CallLog = {} isHooked = true for blizzFunc, veneerFunc in pairs(BlizzHooks) do if mod[veneerFunc] then hooksecurefunc(blizzFunc, mod[veneerFunc]) else hooksecurefunc(blizzFunc, function(...) print('catching', blizzFunc, ...) tinsert(VeneerData.CallLog, {blizzFunc, ...}) end) end end end end function mod:OnEvent (event, ...) local isHandled if SmallEvents[event] then print('|cFF00FF00'..SmallEvents[event]..'(' ..event..'|r', ...) mod[SmallEvents[event]](event, ...) isHandled = true end if HandlerEvents[event] then print('|cFF0088FF'..event..'|r wrapper update') mod.UpdateWrapper() isHandled = true end if not isHandled then print('|cFFFF4400'..event..'|r', ...) end end -------------------------------------------------------------------- --- Events that are handled by Blizzard_ObjectiveTracker -------------------------------------------------------------------- print(mod:GetName()) mod.OnQuestAccepted = function(_, questLogIndex, questID) AddQuestWatch(questLogIndex) SetSuperTrackedQuestID(questID) end mod.OnQuestComplete = function(_, questLogIndex, questID) QuestPOIUpdateIcons() end mod.OnQuestFinished = function(_, questLogIndex, questID) mod.TrackClosest() RemoveQuestWatch(questLogIndex) end mod.OnQuestRemoved = function(_, questLogIndex, questID) mod.UpdateWrapper() end mod.OnQuestFromLocation = function(event) end ------------------------------------------------------------------- --- Function hooks for BlizzUI compatibility ------------------------------------------------------------------- mod.AddQuestWatch = function(questID) mod.UpdateWrapper() end mod.RemoveQuestWatch = function(questIndex, ...) print('|cFFFF8800RemoveQuestWatch', questIndex, ...) local info = mod.Quest.LogInfo[questIndex] -- remove quest refs mod.Quest.LogBlock[questIndex] = nil mod.Quest.QuestBlock[info.questID] = nil -- remove if they still match if mod.Quest.WatchInfo[info.watchIndex] == info then print('cleaning dead WatchInfo entry') mod.Quest.WatchInfo[info.watchIndex] = nil end mod.UpdateWrapper() QuestPOIUpdateIcons() end mod.RemoveTrackedAchievement = function(cheevID) print('|cFFFF8800UntrackAchievement', cheevID) mod.CleanWidgets() end mod.AcceptQuest = function() end mod.AbandonQuest = function() QuestPOIUpdateIcons() end mod.TurnInQuest = function() QuestPOIUpdateIcons() end