Mercurial > wow > buffalo2
comparison ObjectiveTracker/ObjectiveCore.lua @ 24:66b927b46776
Refine the XML data logic, and sort out some EnableMouse inconsistencies.
| author | Nenue |
|---|---|
| date | Mon, 11 Apr 2016 09:07:40 -0400 |
| parents | e837384ac363 |
| children | 4b3da1b221de |
comparison
equal
deleted
inserted
replaced
| 23:e837384ac363 | 24:66b927b46776 |
|---|---|
| 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 | 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 | 11 local QuestPOIUpdateIcons, GetCVar, IsPlayerInMicroDungeon, WorldMapFrame, GetCVarBool, SetMapToCurrentZone = QuestPOIUpdateIcons, GetCVar, IsPlayerInMicroDungeon, WorldMapFrame, GetCVarBool, SetMapToCurrentZone |
| 12 local AddAutoQuestPopUp = AddAutoQuestPopUp | 12 local AddAutoQuestPopUp = AddAutoQuestPopUp |
| 13 local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') | 13 local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') |
| 14 local print = B.print('Objectives') | 14 local print = B.print('Objectives') |
| 15 local ObjectiveTrackerFrame, VeneerObjectiveScroll, CreateFrame = _G.ObjectiveTrackerFrame, _G.VeneerObjectiveScroll, _G.CreateFrame | 15 local ObjectiveTrackerFrame, VeneerObjectiveScroll, CreateFrame = _G.ObjectiveTrackerFrame, _G.VeneerObjectiveScroll, _G.CreateFrame |
| 16 local Wrapper = _G.VeneerObjectiveWrapper | 16 local Wrapper = _G.VeneerObjectiveWrapper |
| 17 local Scroller = VeneerObjectiveWrapper.scrollArea | 17 local Scroller = VeneerObjectiveWrapper.scrollArea |
| 18 local Scroll = _G.VeneerObjectiveScroll | 18 local Scroll = _G.VeneerObjectiveScroll |
| 59 local OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT_ADDED = OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT_ADDED -- 0x0040 | 59 local OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT_ADDED = OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT_ADDED -- 0x0040 |
| 60 local OBJECTIVE_TRACKER_UPDATE_SCENARIO_BONUS_DELAYED = OBJECTIVE_TRACKER_UPDATE_SCENARIO_BONUS_DELAYED -- 0x0080 | 60 local OBJECTIVE_TRACKER_UPDATE_SCENARIO_BONUS_DELAYED = OBJECTIVE_TRACKER_UPDATE_SCENARIO_BONUS_DELAYED -- 0x0080 |
| 61 | 61 |
| 62 local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_ALL -- default | 62 local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_ALL -- default |
| 63 --- Used to determine which trackers are listening for money events | 63 --- Used to determine which trackers are listening for money events |
| 64 mod.watchMoneyReasons = 0 | 64 |
| 65 T.strings = {} | |
| 66 T.strings.CLICK_TO_ACCCEPT = 'Click to Accept' | |
| 67 T.strings.CLICK_TO_COMPLETE = 'Click to complete' | |
| 68 T.colors ={ | |
| 69 enable = true, | |
| 70 default = { | |
| 71 titlebg = {'HORIZONTAL', 1, 0, .7, .25, 1, 0, .7, .125}, | |
| 72 textbg = {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0 }, | |
| 73 selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225}, | |
| 74 }, | |
| 75 daily = { | |
| 76 titlebg = {'HORIZONTAL', 0, .7, 1, .25, 0, 1, .7, .125}, | |
| 77 textbg = {'HORIZONTAL', 0, .7, 1, .1, 0, 1, .7, .075 }, | |
| 78 }, | |
| 79 weekly = { | |
| 80 titlebg = {'HORIZONTAL', 0, .35, .7, .25, 0, .35, .7, .125}, | |
| 81 textbg = {'HORIZONTAL', 0, .35, .7, .1, 0, .35, .7, .075 }, | |
| 82 }, | |
| 83 account = { | |
| 84 titlebg = {'HORIZONTAL', .1, .1, .1, .25, .1, .1, .1, .125}, | |
| 85 textbg = {'HORIZONTAL', .1, .1, .1, 0.4, .1, .1, .1, .085 }, | |
| 86 }, | |
| 87 -- alliance | |
| 88 faction_1 = { | |
| 89 titlebg = {'HORIZONTAL', .2, .4, 1, 0.4, .2, .4, 1, .085 }, | |
| 90 textbg = {'HORIZONTAL', .2, .4, 1, 0.4, .2, .4, 1, .085 }, | |
| 91 }, | |
| 92 -- horde | |
| 93 faction_2 = { | |
| 94 titlebg = {'HORIZONTAL', .6, 0, 0.4, 0.4, .6, 0, 0.4, .085 }, | |
| 95 textbg = {'HORIZONTAL', .6, 0, 0.4, 0.4, .6, 0, 0.4, .085 }, | |
| 96 } | |
| 97 } | |
| 98 | |
| 99 T.watchMoneyReasons = 0 | |
| 65 | 100 |
| 66 --- Baseline defaults table; values defined in the files that they pertain to | 101 --- Baseline defaults table; values defined in the files that they pertain to |
| 67 mod.defaults = {} | 102 T.defaults = {} |
| 68 | 103 |
| 69 --- Tracker display order | 104 --- Tracker display order |
| 70 mod.orderedNames = {'Bonus', 'AutoQuest', 'Quest', 'Cheevs'} | 105 T.orderedNames = {'Bonus', 'AutoQuest', 'Quest', 'Cheevs'} |
| 71 | 106 |
| 72 --- ipairs() argument tables | 107 --- ipairs() argument tables |
| 73 mod.orderedHandlers = setmetatable({}, {__mode = "k"}) | 108 T.orderedHandlers = setmetatable({}, {__mode = "k"}) |
| 74 mod.orderedTrackers = setmetatable({}, {__mode = "k"}) | 109 T.orderedTrackers = setmetatable({}, {__mode = "k"}) |
| 75 mod.indexedTrackers = setmetatable({}, {__mode = "k"}) | 110 T.indexedTrackers = setmetatable({}, {__mode = "k"}) |
| 76 | 111 |
| 77 --- pairs() argument tables | 112 --- pairs() argument tables |
| 78 mod.namedTrackers = setmetatable({}, {__mode = "k"}) | 113 T.namedTrackers = setmetatable({}, {__mode = "k"}) |
| 79 | 114 |
| 80 local WRAPPER_ANCHOR_POINT = 'TOPRIGHT' | 115 local WRAPPER_ANCHOR_POINT = 'TOPRIGHT' |
| 81 local WRAPPER_OFFSET_X = 0 | 116 local WRAPPER_OFFSET_X = 0 |
| 82 local WRAPPER_OFFSET_Y = -200 | 117 local WRAPPER_OFFSET_Y = -200 |
| 83 local WRAPPER_MAX_HEIGHT = 670 | 118 local WRAPPER_MAX_HEIGHT = 670 |
| 84 local WRAPPER_WIDTH = 280 | 119 local WRAPPER_WIDTH = 280 |
| 85 local WRAPPER_HEADER_HEIGHT = 24 | 120 local WRAPPER_HEADER_HEIGHT = 24 |
| 86 | 121 |
| 87 mod.defaults.Wrapper = { | 122 T.defaults.Wrapper = { |
| 88 AnchorPoint = WRAPPER_ANCHOR_POINT, | 123 AnchorPoint = WRAPPER_ANCHOR_POINT, |
| 89 OffsetX = WRAPPER_OFFSET_X, | 124 OffsetX = WRAPPER_OFFSET_X, |
| 90 OffsetY = WRAPPER_OFFSET_Y, | 125 OffsetY = WRAPPER_OFFSET_Y, |
| 91 Height = WRAPPER_MAX_HEIGHT, | 126 Height = WRAPPER_MAX_HEIGHT, |
| 92 Width = WRAPPER_WIDTH, | 127 Width = WRAPPER_WIDTH, |
| 96 } | 131 } |
| 97 | 132 |
| 98 | 133 |
| 99 | 134 |
| 100 --- Tracker module definitions begin here; innards dealing with data retreival and output are defined further in | 135 --- Tracker module definitions begin here; innards dealing with data retreival and output are defined further in |
| 101 mod.DefaultHandler = { | 136 T.DefaultHandler = { |
| 102 previousHeight = 0, | 137 previousHeight = 0, |
| 103 | 138 |
| 104 name = "temp", | 139 name = "temp", |
| 105 displayName = "temp", | 140 displayName = "temp", |
| 106 updateReasonModule = 0xFF00, | 141 updateReasonModule = 0xFF00, |
| 118 Watched = {}, -- find watchIndex by data ID | 153 Watched = {}, -- find watchIndex by data ID |
| 119 WatchInfo = {}, -- find data by watch index | 154 WatchInfo = {}, -- find data by watch index |
| 120 WatchBlock = {}, -- find block by watch index | 155 WatchBlock = {}, -- find block by watch index |
| 121 } | 156 } |
| 122 | 157 |
| 123 mod.AutoQuest = { | 158 T.AutoQuest = { |
| 124 name = "AutoQuest", | 159 name = "AutoQuest", |
| 125 displayName = "Notice", | 160 displayName = "Notice", |
| 126 updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST, | 161 updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST, |
| 127 updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST + | 162 updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST + |
| 128 OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, | 163 OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, |
| 129 } | 164 } |
| 130 mod.Quest = { | 165 T.Quest = { |
| 131 name = "Quest", | 166 name = "Quest", |
| 132 displayName = "Quests", | 167 displayName = "Quests", |
| 133 updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST, | 168 updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST, |
| 134 updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST + | 169 updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST + |
| 135 OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, | 170 OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, |
| 136 } | 171 itemButtons = {}, |
| 137 mod.Cheevs = { | 172 freeButtons = {}, |
| 173 } | |
| 174 T.Cheevs = { | |
| 138 name = "Cheevs", | 175 name = "Cheevs", |
| 139 displayName = "Achievements", | 176 displayName = "Achievements", |
| 140 updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT, | 177 updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT, |
| 141 updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT + | 178 updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT + |
| 142 OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT_ADDED, | 179 OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT_ADDED, |
| 143 } | 180 } |
| 144 mod.Bonus = { | 181 T.Bonus = { |
| 145 name = "Bonus", | 182 name = "Bonus", |
| 146 displayName = "Bonus Objectives", | 183 displayName = "Bonus Objectives", |
| 147 updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE, | 184 updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE, |
| 148 updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST + OBJECTIVE_TRACKER_UPDATE_TASK_ADDED | 185 updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST + OBJECTIVE_TRACKER_UPDATE_TASK_ADDED |
| 149 } | 186 } |
| 155 self:Update(reason) | 192 self:Update(reason) |
| 156 end | 193 end |
| 157 local Handler_Initialize = function (self, name, index) | 194 local Handler_Initialize = function (self, name, index) |
| 158 print('Initializing |cFF00FFFF'..name..'|r module...') | 195 print('Initializing |cFF00FFFF'..name..'|r module...') |
| 159 | 196 |
| 160 local handler = setmetatable(mod[name] or {}, { | 197 local handler = setmetatable(T[name] or {}, { |
| 161 __tostring = Tracker_string, | 198 __tostring = Tracker_string, |
| 162 __call = Tracker_call | 199 __call = Tracker_call |
| 163 }) | 200 }) |
| 164 if type(mod.orderedHandlers[index]) == 'table' then | 201 if type(T.orderedHandlers[index]) == 'table' then |
| 165 return mod.orderedHandlers[index] | 202 return T.orderedHandlers[index] |
| 166 end | 203 end |
| 167 | 204 |
| 168 print('|cFFFFFF00Acquiring locals') | 205 print('|cFFFFFF00Acquiring locals') |
| 169 local preset = {} | 206 local preset = {} |
| 170 for k, _ in pairs(handler) do | 207 for k, _ in pairs(handler) do |
| 187 print('|cFFFF4400'..tostring(name)..'|r:') | 224 print('|cFFFF4400'..tostring(name)..'|r:') |
| 188 for k, v in pairs(handler) do | 225 for k, v in pairs(handler) do |
| 189 print(format("%32s %8s %s", (preset[k] and '|cFFFFFFFF' or '|cFFFFFF00') .. k .. '|r', type(v), tostring(v))) | 226 print(format("%32s %8s %s", (preset[k] and '|cFFFFFFFF' or '|cFFFFFF00') .. k .. '|r', type(v), tostring(v))) |
| 190 end | 227 end |
| 191 | 228 |
| 192 mod[name] = handler | 229 T[name] = handler |
| 193 | 230 |
| 194 local trackerName = 'Veneer'..name..'Tracker' | 231 local trackerName = 'Veneer'..name..'Tracker' |
| 195 local handler = mod[name] | 232 local handler = T[name] |
| 196 local frame = CreateFrame('Frame', trackerName, _G.VeneerObjectiveScroll, 'VeneerTrackerTemplate') | 233 local frame = CreateFrame('Frame', trackerName, _G.VeneerObjectiveScroll, 'VeneerTrackerTemplate') |
| 197 frame.title:SetText(handler.displayName) | 234 frame.title:SetText(handler.displayName) |
| 198 mod.SetBlockStyle(frame, 'Tracker', 'Normal') | 235 T.SetBlockStyle(frame, 'Tracker', 'Normal') |
| 199 handler.frame = frame | 236 handler.frame = frame |
| 200 handler.trackerName = trackerName | 237 handler.trackerName = trackerName |
| 201 handler.lines = {} | 238 handler.lines = {} |
| 202 mod.orderedTrackers[index] = frame | 239 T.orderedTrackers[index] = frame |
| 203 mod.namedTrackers[name] = frame | 240 T.namedTrackers[name] = frame |
| 204 mod.indexedTrackers[handler] = frame | 241 T.indexedTrackers[handler] = frame |
| 205 print('|cFFFF0088' .. trackerName .. '|r created for |cFF00FFFF' .. handler.displayName .. '|r module') | 242 print('|cFFFF0088' .. trackerName .. '|r created for |cFF00FFFF' .. handler.displayName .. '|r module') |
| 206 | 243 |
| 207 mod.orderedHandlers[index] = handler | 244 T.orderedHandlers[index] = handler |
| 208 return true | 245 return true |
| 209 end | 246 end |
| 210 | 247 |
| 211 local Event = {} | 248 local Event = {} |
| 212 Event.QUEST_LOG_UPDATE = function() | 249 Event.QUEST_LOG_UPDATE = function() |
| 245 return OBJECTIVE_TRACKER_UPDATE_QUEST | 282 return OBJECTIVE_TRACKER_UPDATE_QUEST |
| 246 end | 283 end |
| 247 Event.ZONE_CHANGED = function() | 284 Event.ZONE_CHANGED = function() |
| 248 | 285 |
| 249 local inMicroDungeon = IsPlayerInMicroDungeon(); | 286 local inMicroDungeon = IsPlayerInMicroDungeon(); |
| 250 if ( inMicroDungeon ~= mod.inMicroDungeon ) then | 287 if ( inMicroDungeon ~= T.inMicroDungeon ) then |
| 251 if ( not WorldMapFrame:IsShown() and GetCVarBool("questPOI") ) then | 288 if ( not WorldMapFrame:IsShown() and GetCVarBool("questPOI") ) then |
| 252 SetMapToCurrentZone(); -- update the zone to get the right POI numbers for the tracker | 289 SetMapToCurrentZone(); -- update the zone to get the right POI numbers for the tracker |
| 253 end | 290 end |
| 254 --SortQuestWatches(); | 291 --SortQuestWatches(); |
| 255 mod.inMicroDungeon = inMicroDungeon; | 292 T.inMicroDungeon = inMicroDungeon; |
| 256 end | 293 end |
| 257 end | 294 end |
| 258 Event.QUEST_AUTOCOMPLETE = function(questId) | 295 Event.QUEST_AUTOCOMPLETE = function(questId) |
| 259 AddAutoQuestPopUp(questId, "COMPLETE"); | 296 AddAutoQuestPopUp(questId, "COMPLETE"); |
| 260 return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST + OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP | 297 return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST + OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP |
| 282 Event.ZONE_CHANGED_NEW_AREA = function () | 319 Event.ZONE_CHANGED_NEW_AREA = function () |
| 283 if ( not WorldMapFrame:IsShown() and GetCVarBool("questPOI") ) then | 320 if ( not WorldMapFrame:IsShown() and GetCVarBool("questPOI") ) then |
| 284 SetMapToCurrentZone(); -- update the zone to get the right POI numbers for the tracker | 321 SetMapToCurrentZone(); -- update the zone to get the right POI numbers for the tracker |
| 285 end | 322 end |
| 286 SortQuestWatches(); | 323 SortQuestWatches(); |
| 287 mod.currentZoneArea = GetCurrentMapAreaID() | 324 T.currentZoneArea = GetCurrentMapAreaID() |
| 288 print('Updating zone ID to', mod.currentZoneArea, '=', GetZoneText(), GetMinimapZoneText()) | 325 print('Updating zone ID to', T.currentZoneArea, '=', GetZoneText(), GetMinimapZoneText()) |
| 289 | 326 |
| 290 | 327 |
| 291 return OBJECTIVE_TRACKER_UPDATE_TASK_ADDED | 328 return OBJECTIVE_TRACKER_UPDATE_TASK_ADDED |
| 292 end | 329 end |
| 293 | 330 |
| 294 | 331 |
| 295 Event.PLAYER_MONEY = function() | 332 Event.PLAYER_MONEY = function() |
| 296 if mod.watchMoneyReasons > 0 then | 333 if T.watchMoneyReasons > 0 then |
| 297 return mod.watchMoneyReasons | 334 return T.watchMoneyReasons |
| 298 end | 335 end |
| 299 end | 336 end |
| 300 Event.CRITERIA_COMPLETE = function() | 337 Event.CRITERIA_COMPLETE = function() |
| 301 return OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE | 338 return OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE |
| 302 end | 339 end |
| 303 Event.QUEST_TURN_IN = function(questID, xp, money) | 340 Event.QUEST_TURN_IN = function(questID, xp, money) |
| 304 if ( IsQuestTask(questID) ) then | 341 if ( IsQuestTask(questID) ) then |
| 305 mod.Bonus:OnTurnIn(questID, xp, money) | 342 T.Bonus:OnTurnIn(questID, xp, money) |
| 306 print('updating bonus modules (code', OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE, ',', questID, xp, money) | 343 print('updating bonus modules (code', OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE, ',', questID, xp, money) |
| 307 return OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE, questID, xp, money | 344 return OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE, questID, xp, money |
| 308 else | 345 else |
| 309 return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST, questID, xp, money | 346 return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST, questID, xp, money |
| 310 end | 347 end |
| 311 end | 348 end |
| 312 mod.Event = Event | 349 T.Event = Event |
| 313 | 350 |
| 314 --- Done once per ui load | 351 --- Done once per ui load |
| 315 local BlizzHooks = { | 352 local BlizzHooks = { |
| 316 ['AddQuestWatch'] = 'AddQuestWatch', | 353 ['AddQuestWatch'] = 'AddQuestWatch', |
| 317 ['RemoveQuestWatch'] = 'RemoveQuestWatch', | 354 ['RemoveQuestWatch'] = 'RemoveQuestWatch', |
| 323 ['RemoveTrackedAchievement'] = 'RemoveTrackedAchievement', | 360 ['RemoveTrackedAchievement'] = 'RemoveTrackedAchievement', |
| 324 ['SetSuperTrackedQuestID'] = 'SetSuperTrackedQuestID' | 361 ['SetSuperTrackedQuestID'] = 'SetSuperTrackedQuestID' |
| 325 } | 362 } |
| 326 local VeneerData | 363 local VeneerData |
| 327 | 364 |
| 328 mod.SetWatchMoney = function(watchMoney, reason) | 365 T.SetWatchMoney = function(watchMoney, reason) |
| 329 if watchMoney then | 366 if watchMoney then |
| 330 if band(mod.watchMoneyReasons, reason) == 0 then | 367 if band(T.watchMoneyReasons, reason) == 0 then |
| 331 mod.watchMoneyReasons = mod.watchMoneyReasons + reason; | 368 T.watchMoneyReasons = T.watchMoneyReasons + reason; |
| 332 end | 369 end |
| 333 else | 370 else |
| 334 if band(mod.watchMoneyReasons, reason) > 0 then | 371 if band(T.watchMoneyReasons, reason) > 0 then |
| 335 mod.watchMoneyReasons = mod.watchMoneyReasons - reason; | 372 T.watchMoneyReasons = T.watchMoneyReasons - reason; |
| 336 end | 373 end |
| 337 end | 374 end |
| 338 end | 375 end |
| 339 mod.animateReasons = 0 | 376 T.animateReasons = 0 |
| 340 mod.SetAnimate = function(animate, reason) | 377 T.SetAnimate = function(animate, reason) |
| 341 if animate then | 378 if animate then |
| 342 if band(mod.animateReasons, reason) == 0 then | 379 if band(T.animateReasons, reason) == 0 then |
| 343 mod.animateReasons = mod.animateReasons + reason | 380 T.animateReasons = T.animateReasons + reason |
| 344 end | 381 end |
| 345 else | 382 else |
| 346 if band(mod.animateReasons, reason) > 0 then | 383 if band(T.animateReasons, reason) > 0 then |
| 347 mod.animateReasons = mod.animateReasons - reason | 384 T.animateReasons = T.animateReasons - reason |
| 348 end | 385 end |
| 349 end | |
| 350 end | |
| 351 | |
| 352 | |
| 353 function mod:OnInitialize() | |
| 354 local c = mod.Conf.Wrapper | |
| 355 VeneerData = _G.VeneerData | |
| 356 VeneerData.CallLog = VeneerData.CallLog or {} | |
| 357 if not mod.isHooked then | |
| 358 mod.isHooked = true | |
| 359 for blizzFunc, veneerFunc in pairs(BlizzHooks) do | |
| 360 if mod[veneerFunc] then | |
| 361 hooksecurefunc(blizzFunc, mod[veneerFunc]) | |
| 362 else | |
| 363 hooksecurefunc(blizzFunc, function(...) | |
| 364 print('|cFFFF0088securehook('..tostring(blizzFunc)..')|r args:', ...) | |
| 365 tinsert(VeneerData.CallLog, {blizzFunc, ...}) | |
| 366 end) | |
| 367 end | |
| 368 end | |
| 369 end | |
| 370 | |
| 371 mod.Conf.TasksLog = mod.Conf.TasksLog or {} | |
| 372 | |
| 373 Scroller:SetScrollChild(Scroll) | |
| 374 Scroller:SetWidth(c.Width) | |
| 375 Scroll:SetWidth(c.Width) | |
| 376 Scroll:ClearAllPoints() | |
| 377 Scroll:SetPoint('TOP', Scroller, 'TOP') | |
| 378 ObjectiveTrackerFrame:UnregisterAllEvents() | |
| 379 ObjectiveTrackerFrame:Hide() | |
| 380 | |
| 381 if B.Conf.FrameState[Wrapper:GetName()] == 0 then | |
| 382 Scroller:Hide() | |
| 383 end | 386 end |
| 384 end | 387 end |
| 385 | 388 |
| 386 local Play = function(file) if Devian and Devian.InWorkspace() then PlaySoundFile(file) end end | 389 local Play = function(file) if Devian and Devian.InWorkspace() then PlaySoundFile(file) end end |
| 387 | 390 |
| 388 function mod:OnEvent (event, ...) | 391 function T:OnEvent (event, ...) |
| 389 local isHandled | 392 local isHandled |
| 390 print('OnEvent(|cFF00FF00'.. event ..'|r):', ...) | 393 print('OnEvent(|cFF00FF00'.. event ..'|r):', ...) |
| 391 local reason, arg1, arg2, arg3 | 394 local reason, arg1, arg2, arg3 |
| 392 if Event[event] then | 395 if Event[event] then |
| 393 if type(Event[event]) == 'function' then | 396 if type(Event[event]) == 'function' then |
| 401 else | 404 else |
| 402 reason = action | 405 reason = action |
| 403 end | 406 end |
| 404 | 407 |
| 405 if reason then | 408 if reason then |
| 406 mod:Update(reason, arg1, arg2, arg3) | 409 T:Update(reason, arg1, arg2, arg3) |
| 407 end | 410 end |
| 408 end | 411 end |
| 409 else | 412 else |
| 410 Play([[Interface\Addons\SharedMedia_MyMedia\sound\Heart.ogg]]) | 413 Play([[Interface\Addons\SharedMedia_MyMedia\sound\Heart.ogg]]) |
| 411 reason = Event[event] | 414 reason = Event[event] |
| 412 end | 415 end |
| 413 else | 416 else |
| 414 Play([[Interface\Addons\SharedMedia_MyMedia\sound\Quack.ogg]]) | 417 Play([[Interface\Addons\SharedMedia_MyMedia\sound\Quack.ogg]]) |
| 415 end | 418 end |
| 416 if reason then | 419 if reason then |
| 417 mod:Update(reason, arg1, arg2, arg3) | 420 T:Update(reason, arg1, arg2, arg3) |
| 418 else | 421 else |
| 419 print('no reason value returned') | 422 print('no reason value returned') |
| 420 Play([[Interface\Addons\SharedMedia_MyMedia\sound\Quack.ogg]]) | 423 Play([[Interface\Addons\SharedMedia_MyMedia\sound\Quack.ogg]]) |
| 421 end | 424 end |
| 425 | |
| 426 end | |
| 427 | |
| 428 | |
| 429 function T:OnInitialize() | |
| 430 local c = T.Conf.Wrapper | |
| 431 VeneerData = _G.VeneerData | |
| 432 VeneerData.CallLog = VeneerData.CallLog or {} | |
| 433 if not T.isHooked then | |
| 434 T.isHooked = true | |
| 435 for blizzFunc, veneerFunc in pairs(BlizzHooks) do | |
| 436 if T[veneerFunc] then | |
| 437 hooksecurefunc(blizzFunc, T[veneerFunc]) | |
| 438 else | |
| 439 hooksecurefunc(blizzFunc, function(...) | |
| 440 print('|cFFFF0088securehook('..tostring(blizzFunc)..')|r args:', ...) | |
| 441 tinsert(VeneerData.CallLog, {blizzFunc, ...}) | |
| 442 end) | |
| 443 end | |
| 444 end | |
| 445 end | |
| 446 | |
| 447 T.Conf.TasksLog = T.Conf.TasksLog or {} | |
| 448 | |
| 449 ObjectiveTrackerFrame:UnregisterAllEvents() | |
| 450 ObjectiveTrackerFrame:Hide() | |
| 451 | |
| 452 | |
| 453 for id, name in ipairs(T.orderedNames) do | |
| 454 if not T.orderedHandlers[id] then | |
| 455 Handler_Initialize(T.DefaultHandler, name, id) | |
| 456 end | |
| 457 end | |
| 458 self:SetSize(c.Width, 40) | |
| 459 T.InitializeWidgets() | |
| 422 end | 460 end |
| 423 | 461 |
| 424 --- Done any time the the minimize button is toggled up | 462 --- Done any time the the minimize button is toggled up |
| 425 function mod:OnEnable() | 463 function T:OnEnable() |
| 426 for id, name in ipairs(mod.orderedNames) do | 464 |
| 427 if not mod.orderedHandlers[id] then | 465 print(B.Conf.VeneerObjectiveWrapper.enabled) |
| 428 Handler_Initialize(mod.DefaultHandler, name, id) | 466 if not B.Conf.VeneerObjectiveWrapper.enabled then |
| 429 end | 467 return |
| 430 end | 468 end |
| 431 | 469 |
| 432 for event, action in pairs(Event) do | 470 for event, action in pairs(Event) do |
| 433 print('|cFFFF0088listen to', event, 'for action|r', tostring(action)) | 471 print('|cFFFF0088listen to', event, 'for action|r', tostring(action)) |
| 434 Wrapper:RegisterEvent(event) | 472 Wrapper:RegisterEvent(event) |
| 435 end | 473 end |
| 436 | 474 |
| 437 Wrapper:SetScript('OnEvent', mod.OnEvent) | 475 local c = T.Conf.Wrapper |
| 438 local c = mod.Conf.Wrapper | 476 |
| 439 Wrapper:SetWidth(c.Width) | 477 Scroller:SetScrollChild(Scroll) |
| 440 | 478 Scroller:SetWidth(c.Width) |
| 441 mod.InitializeWidgets() | 479 Scroll:SetWidth(c.Width) |
| 442 mod:Update() | 480 Scroll:ClearAllPoints() |
| 443 | 481 Scroll:SetPoint('TOP', Scroller, 'TOP') |
| 444 | 482 self:SetScript('OnEvent', T.OnEvent) |
| 445 end | 483 |
| 446 | 484 Scroller:Show() |
| 447 function mod:OnDisable() | 485 |
| 448 Wrapper:UnregisterAllEvents() | 486 local from, target, to, x, y = Wrapper:GetPoint(1) |
| 449 end | 487 print(from, target:GetName(), to, x,y) |
| 450 | 488 |
| 451 | 489 T:Update() |
| 490 | |
| 491 -- run once to prime the data structure | |
| 492 T.UpdateActionButtons() | |
| 493 end | |
| 494 | |
| 495 function T:OnDisable() | |
| 496 self:UnregisterAllEvents() | |
| 497 Scroller:Hide() | |
| 498 end | |
| 499 |
