# HG changeset patch
# User Nenue
# Date 1460277332 14400
# Node ID e837384ac3635da9f29106a47d6e5bfe96a71166
# Parent 9b3fa734abff0c6ed91ebb62432863190462fae9
Separating objective tracker module
diff -r 9b3fa734abff -r e837384ac363 ObjectiveCore.lua
--- a/ObjectiveCore.lua Sat Apr 09 07:32:45 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,436 +0,0 @@
---- ${PACKAGE_NAME}
--- @file-author@
--- @project-revision@ @project-hash@
--- @file-revision@ @file-hash@
--- Created: 3/26/2016 1:51 AM
-local B, _G = select(2,...).frame, _G
-local pairs, setmetatable, type, tostring, band, format = _G.pairs, _G.setmetatable, _G.type, _G.tostring, bit.band, string.format
-local ipairs, tinsert, hooksecurefunc = _G.ipairs, _G.tinsert, _G.hooksecurefunc
-local PlaySoundFile, IsQuestTask, SortQuestWatches, GetCurrentMapAreaID, GetZoneText, GetMinimapZoneText = PlaySoundFile, IsQuestTask, SortQuestWatches, GetCurrentMapAreaID, GetZoneText, GetMinimapZoneText
-local AddQuestWatch, SetSuperTrackedQuestID, GetNumQuestWatches, AUTO_QUEST_WATCH, MAX_WATCHABLE_QUESTS = AddQuestWatch, SetSuperTrackedQuestID, GetNumQuestWatches, AUTO_QUEST_WATCH, MAX_WATCHABLE_QUESTS
-local QuestPOIUpdateIcons, GetCVar, IsPlayerInMicroDungeon, WorldMapFrame, GetCVarBool, SetMapToCurrentZone = QuestPOIUpdateIcons, GetCVar, IsPlayerInMicroDungeon, WorldMapFrame, GetCVarBool, SetMapToCurrentZone
-local AddAutoQuestPopUp = AddAutoQuestPopUp
-local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
-local print = B.print('Objectives')
-local ObjectiveTrackerFrame, VeneerObjectiveScroll, CreateFrame = _G.ObjectiveTrackerFrame, _G.VeneerObjectiveScroll, _G.CreateFrame
-local Wrapper = _G.VeneerObjectiveWrapper
-local Scroller = VeneerObjectiveWrapper.scrollArea
-local Scroll = _G.VeneerObjectiveScroll
-
---- Performance values
---[[
- self:RegisterEvent("QUEST_LOG_UPDATE");
- self:RegisterEvent("TRACKED_ACHIEVEMENT_LIST_CHANGED");
- self:RegisterEvent("QUEST_WATCH_LIST_CHANGED");
- self:RegisterEvent("QUEST_AUTOCOMPLETE");
- self:RegisterEvent("QUEST_ACCEPTED");
- self:RegisterEvent("SUPER_TRACKED_QUEST_CHANGED");
- self:RegisterEvent("SCENARIO_UPDATE");
- self:RegisterEvent("SCENARIO_CRITERIA_UPDATE");
- self:RegisterEvent("TRACKED_ACHIEVEMENT_UPDATE");
- self:RegisterEvent("ZONE_CHANGED_NEW_AREA");
- self:RegisterEvent("ZONE_CHANGED");
- self:RegisterEvent("QUEST_POI_UPDATE");
- self:RegisterEvent("VARIABLES_LOADED");
- self:RegisterEvent("QUEST_TURNED_IN");
- self:RegisterEvent("PLAYER_MONEY");
- ]]
-
-
---- These are the bitfields used by Blizzard_ObjectiveTracker to determine which segments get parsed.
---- They are replicated here so that plugins can make use of any securehook args involving this info.
-local OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST -- 0x0100
-local OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP = OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP -- 0x0200
-local OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE = OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE -- 0x0400
-local OBJECTIVE_TRACKER_UPDATE_MODULE_SCENARIO = OBJECTIVE_TRACKER_UPDATE_MODULE_SCENARIO -- 0x0800
-local OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT = OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT -- 0x1000
-
-
-local OBJECTIVE_TRACKER_UPDATE_STATIC = OBJECTIVE_TRACKER_UPDATE_STATIC -- 0x0000
-local OBJECTIVE_TRACKER_UPDATE_ALL = OBJECTIVE_TRACKER_UPDATE_ALL -- 0xFFFF
-local OBJECTIVE_TRACKER_UPDATE_ID = OBJECTIVE_TRACKER_UPDATE_ID -- 0
-
-local OBJECTIVE_TRACKER_UPDATE_QUEST = OBJECTIVE_TRACKER_UPDATE_QUEST -- 0x0001
-local OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED = OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED -- 0x0002
-local OBJECTIVE_TRACKER_UPDATE_TASK_ADDED = OBJECTIVE_TRACKER_UPDATE_TASK_ADDED -- 0x0004
-local OBJECTIVE_TRACKER_UPDATE_SCENARIO = OBJECTIVE_TRACKER_UPDATE_SCENARIO -- 0x0008
-local OBJECTIVE_TRACKER_UPDATE_SCENARIO_NEW_STAGE = OBJECTIVE_TRACKER_UPDATE_SCENARIO_NEW_STAGE -- 0x0010
-local OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT = OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT -- 0x0020
-local OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT_ADDED = OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT_ADDED -- 0x0040
-local OBJECTIVE_TRACKER_UPDATE_SCENARIO_BONUS_DELAYED = OBJECTIVE_TRACKER_UPDATE_SCENARIO_BONUS_DELAYED -- 0x0080
-
-local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_ALL -- default
---- Used to determine which trackers are listening for money events
-mod.watchMoneyReasons = 0
-
---- Baseline defaults table; values defined in the files that they pertain to
-mod.defaults = {}
-
---- Tracker display order
-mod.orderedNames = {'Bonus', 'AutoQuest', 'Quest', 'Cheevs'}
-
---- ipairs() argument tables
-mod.orderedHandlers = setmetatable({}, {__mode = "k"})
-mod.orderedTrackers = setmetatable({}, {__mode = "k"})
-mod.indexedTrackers = setmetatable({}, {__mode = "k"})
-
---- pairs() argument tables
-mod.namedTrackers = setmetatable({}, {__mode = "k"})
-
-local WRAPPER_ANCHOR_POINT = 'TOPRIGHT'
-local WRAPPER_OFFSET_X = 0
-local WRAPPER_OFFSET_Y = -200
-local WRAPPER_MAX_HEIGHT = 670
-local WRAPPER_WIDTH = 280
-local WRAPPER_HEADER_HEIGHT = 24
-
-mod.defaults.Wrapper = {
- AnchorPoint = WRAPPER_ANCHOR_POINT,
- OffsetX = WRAPPER_OFFSET_X,
- OffsetY = WRAPPER_OFFSET_Y,
- Height = WRAPPER_MAX_HEIGHT,
- Width = WRAPPER_WIDTH,
- HeaderHeight = WRAPPER_HEADER_HEIGHT,
- TextSpacing = 3,
- TitleSpacing = 3,
-}
-
-
-
---- Tracker module definitions begin here; innards dealing with data retreival and output are defined further in
-mod.DefaultHandler = {
- previousHeight = 0,
-
- name = "temp",
- displayName = "temp",
- updateReasonModule = 0xFF00,
- updateReasonEvent = 0x00FF,
-
- numWatched = 0, --- number of entries being handled
- numBlocks = 0, --- number of blocks created
- actualBlocks = 0, --- number of blocks in use
-
- freeBlocks = {}, --- block heap
- usedBlocks = {},
-
- Info = {}, -- find data by ID
- BlockInfo = {}, -- find data by block ID
- Watched = {}, -- find watchIndex by data ID
- WatchInfo = {}, -- find data by watch index
- WatchBlock = {}, -- find block by watch index
-}
-
-mod.AutoQuest = {
- name = "AutoQuest",
- displayName = "Notice",
- updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST,
- updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST +
- OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED,
-}
-mod.Quest = {
- name = "Quest",
- displayName = "Quests",
- updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST,
- updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST +
- OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED,
-}
-mod.Cheevs = {
- name = "Cheevs",
- displayName = "Achievements",
- updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT,
- updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT +
- OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT_ADDED,
-}
-mod.Bonus = {
- name = "Bonus",
- displayName = "Bonus Objectives",
- updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE,
- updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST + OBJECTIVE_TRACKER_UPDATE_TASK_ADDED
-}
-
-local Tracker_string = function (self)
- return self.name
-end
-local Tracker_call = function (self, reason)
- self:Update(reason)
-end
-local Handler_Initialize = function (self, name, index)
- print('Initializing |cFF00FFFF'..name..'|r module...')
-
- local handler = setmetatable(mod[name] or {}, {
- __tostring = Tracker_string,
- __call = Tracker_call
- })
- if type(mod.orderedHandlers[index]) == 'table' then
- return mod.orderedHandlers[index]
- end
-
- print('|cFFFFFF00Acquiring locals')
- local preset = {}
- for k, _ in pairs(handler) do
- preset[k] = true
- end
-
-
- print('|cFFFF8800Inheriting')
- for k, v in pairs(self) do
- if not handler[k] then
- if type(v) == 'table' then
- -- assume all tables to be local data; don't inherit or ref
- handler[k] = {}
- else
- handler[k] = self[k]
- end
- print('copying', k)
- end
- end
- print('|cFFFF4400'..tostring(name)..'|r:')
- for k, v in pairs(handler) do
- print(format("%32s %8s %s", (preset[k] and '|cFFFFFFFF' or '|cFFFFFF00') .. k .. '|r', type(v), tostring(v)))
- end
-
- mod[name] = handler
-
- local trackerName = 'Veneer'..name..'Tracker'
- local handler = mod[name]
- local frame = CreateFrame('Frame', trackerName, _G.VeneerObjectiveScroll, 'VeneerTrackerTemplate')
- frame.title:SetText(handler.displayName)
- mod.SetBlockStyle(frame, 'Tracker', 'Normal')
- handler.frame = frame
- handler.trackerName = trackerName
- handler.lines = {}
- mod.orderedTrackers[index] = frame
- mod.namedTrackers[name] = frame
- mod.indexedTrackers[handler] = frame
- print('|cFFFF0088' .. trackerName .. '|r created for |cFF00FFFF' .. handler.displayName .. '|r module')
-
- mod.orderedHandlers[index] = handler
- return true
-end
-
-local Event = {}
-Event.QUEST_LOG_UPDATE = function()
- return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST + OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE
-end
-Event.QUEST_ACCEPTED = function(questLogIndex, questID)
- if ( IsQuestTask(questID) ) then
- return OBJECTIVE_TRACKER_UPDATE_TASK_ADDED, questID
- else
- if ( AUTO_QUEST_WATCH == "1" and GetNumQuestWatches() < MAX_WATCHABLE_QUESTS ) then
- AddQuestWatch(questLogIndex);
- SetSuperTrackedQuestID(questID);
- end
- return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST
- end
-end
-Event.QUEST_WATCH_LIST_CHANGED = function(questID, added)
- if ( added ) then
- if ( not IsQuestTask(questID) ) then
- return OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, questID, added
- end
- else
- return OBJECTIVE_TRACKER_UPDATE_QUEST, questID, added
- end
-end
-Event.QUEST_POI_UPDATE = function()
-
- QuestPOIUpdateIcons();
- if ( GetCVar("trackQuestSorting") == "proximity" ) then
- SortQuestWatches();
- end
-
- return OBJECTIVE_TRACKER_UPDATE_ALL
-
-end
-Event.SUPER_TRACKED_QUEST_CHANGED = function()
- return OBJECTIVE_TRACKER_UPDATE_QUEST
-end
-Event.ZONE_CHANGED = function()
-
- local inMicroDungeon = IsPlayerInMicroDungeon();
- if ( inMicroDungeon ~= mod.inMicroDungeon ) then
- if ( not WorldMapFrame:IsShown() and GetCVarBool("questPOI") ) then
- SetMapToCurrentZone(); -- update the zone to get the right POI numbers for the tracker
- end
- --SortQuestWatches();
- mod.inMicroDungeon = inMicroDungeon;
- end
-end
-Event.QUEST_AUTOCOMPLETE = function(questId)
- AddAutoQuestPopUp(questId, "COMPLETE");
- return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST + OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP
-end
-Event.SCENARIO_CRITERIA_UPDATE = function()
- return OBJECTIVE_TRACKER_UPDATE_SCENARIO
-end
-Event.SCENARIO_UPDATE = function(newStage)
- if ( newStage ) then
- return OBJECTIVE_TRACKER_UPDATE_SCENARIO_NEW_STAGE
- else
- return OBJECTIVE_TRACKER_UPDATE_SCENARIO
- end
-end
-Event.TRACKED_ACHIEVEMENT_UPDATE = function()
- return OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT
-end
-Event.TRACKED_ACHIEVEMENT_LIST_CHANGED = function(achievementID, added)
- if ( added ) then
- return OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT_ADDED, achievementID
- else
- return OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT
- end
-end
-Event.ZONE_CHANGED_NEW_AREA = function ()
- if ( not WorldMapFrame:IsShown() and GetCVarBool("questPOI") ) then
- SetMapToCurrentZone(); -- update the zone to get the right POI numbers for the tracker
- end
- SortQuestWatches();
- mod.currentZoneArea = GetCurrentMapAreaID()
- print('Updating zone ID to', mod.currentZoneArea, '=', GetZoneText(), GetMinimapZoneText())
-
-
- return OBJECTIVE_TRACKER_UPDATE_TASK_ADDED
-end
-
-
-Event.PLAYER_MONEY = function()
- if mod.watchMoneyReasons > 0 then
- return mod.watchMoneyReasons
- end
-end
-Event.CRITERIA_COMPLETE = function()
- return OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE
-end
-Event.QUEST_TURN_IN = function(questID, xp, money)
- if ( IsQuestTask(questID) ) then
- mod.Bonus:OnTurnIn(questID, xp, money)
- print('updating bonus modules (code', OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE, ',', questID, xp, money)
- return OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE, questID, xp, money
- else
- return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST, questID, xp, money
- end
-end
-mod.Event = Event
-
---- Done once per ui load
-local BlizzHooks = {
- ['AddQuestWatch'] = 'AddQuestWatch',
- ['RemoveQuestWatch'] = 'RemoveQuestWatch',
- ['AbandonQuest'] = 'AbandonQuest',
- ['AcknowledgeAutoAcceptQuest'] = 'AcknowledgeAutoAcceptQuest',
- ['AddAutoQuestPopUp'] = 'AddAutoQuestPopUp',
- ['RemoveAutoQuestPopUp'] = 'RemoveAutoQuestPopUp',
- ['AddTrackedAchievement'] = 'AddTrackedAchievement',
- ['RemoveTrackedAchievement'] = 'RemoveTrackedAchievement',
- ['SetSuperTrackedQuestID'] = 'SetSuperTrackedQuestID'
-}
-local VeneerData
-
-mod.SetWatchMoney = function(watchMoney, reason)
- if watchMoney then
- if band(mod.watchMoneyReasons, reason) == 0 then
- mod.watchMoneyReasons = mod.watchMoneyReasons + reason;
- end
- else
- if band(mod.watchMoneyReasons, reason) > 0 then
- mod.watchMoneyReasons = mod.watchMoneyReasons - reason;
- end
- end
-end
-
-
-function mod:OnInitialize()
- local c = mod.Conf.Wrapper
- VeneerData = _G.VeneerData
- VeneerData.CallLog = VeneerData.CallLog or {}
- if not mod.isHooked then
- mod.isHooked = true
- for blizzFunc, veneerFunc in pairs(BlizzHooks) do
- if mod[veneerFunc] then
- hooksecurefunc(blizzFunc, mod[veneerFunc])
- else
- hooksecurefunc(blizzFunc, function(...)
- print('|cFFFF0088securehook('..tostring(blizzFunc)..')|r args:', ...)
- tinsert(VeneerData.CallLog, {blizzFunc, ...})
- end)
- end
- end
- end
-
- mod.Conf.TasksLog = mod.Conf.TasksLog or {}
-
- Scroller:SetScrollChild(Scroll)
- Scroller:SetWidth(c.Width)
- Scroll:SetWidth(c.Width)
- Scroll:ClearAllPoints()
- Scroll:SetPoint('TOP', Scroller, 'TOP')
- ObjectiveTrackerFrame:UnregisterAllEvents()
- ObjectiveTrackerFrame:Hide()
-end
-
-function mod:OnEvent (event, ...)
- local isHandled
- print('OnEvent(|cFF00FF00'.. event ..'|r):', ...)
- local reason, arg1, arg2, arg3
- if Event[event] then
- if type(Event[event]) == 'function' then
- PlaySoundFile([[Interface\Addons\SharedMedia_MyMedia\sound\Info.ogg]])
- reason, arg1, arg2, arg3 = Event[event](...)
- elseif type(Event[event]) == 'table' then
- PlaySoundFile([[Interface\Addons\SharedMedia_MyMedia\sound\Link.ogg]])
- for i, action in ipairs(Event[event]) do
- if type(action) == 'function' then
- reason, arg1, arg2, arg3 = action(event, ...)
- else
- reason = action
- end
-
- if reason then
- mod:Update(reason, arg1, arg2, arg3)
- end
- end
- else
- PlaySoundFile([[Interface\Addons\SharedMedia_MyMedia\sound\Heart.ogg]])
- reason = Event[event]
- end
- else
- PlaySoundFile([[Interface\Addons\SharedMedia_MyMedia\sound\Quack.ogg]])
- end
- if reason then
- mod:Update(reason, arg1, arg2, arg3)
- else
- print('no reason value returned')
- PlaySoundFile([[Interface\Addons\SharedMedia_MyMedia\sound\Quack.ogg]])
- end
-end
-
---- Done any time the the minimize button is toggled up
-function mod:OnEnable()
- for id, name in ipairs(mod.orderedNames) do
- if not mod.orderedHandlers[id] then
- Handler_Initialize(mod.DefaultHandler, name, id)
- end
- end
-
- for event, action in pairs(Event) do
- print('|cFFFF0088listen to', event, 'for action|r', tostring(action))
- Wrapper:RegisterEvent(event)
- end
-
- Wrapper:SetScript('OnEvent', mod.OnEvent)
-
- local c = mod.Conf.Wrapper
- --Wrapper:SetPoint(c.AnchorPoint, UIParent, c.AnchorPoint, c.OffsetX, c.OffsetY)
- --B.Conf.FramePosition[Wrapper:GetName()] = {c.AnchorPoint, c.AnchorPoint, c.OffsetX, c.OffsetY}
- Wrapper:SetWidth(c.Width)
-
-
- mod.InitializeWidgets()
- mod:Update()
-end
-
-function mod:OnDisable()
- Wrapper:UnregisterAllEvents()
-end
-
-
diff -r 9b3fa734abff -r e837384ac363 ObjectiveEvents.lua
--- a/ObjectiveEvents.lua Sat Apr 09 07:32:45 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
---- ${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('Objectives')
-
---------------------------------------------------------------------
---- Events that are handled by Blizzard_ObjectiveTracker
---------------------------------------------------------------------
-
--------------------------------------------------------------------
---- Function hooks for BlizzUI compatibility
--------------------------------------------------------------------
-mod.AddQuestWatch = function(questID)
- mod:Update(0x00000003)
-end
-
-local Quest = mod.Quest
-mod.RemoveQuestWatch = function(questIndex, ...)
- print('|cFFFF8800RemoveQuestWatch', questIndex, ...)
-
- local info = mod.Quest.LogInfo[questIndex]
-
- -- remove quest refs
- local block = Quest.QuestBlock[info.questID]
- Quest.QuestBlock[info.questID] = nil
- Quest.LogBlock[questIndex] = nil
-
- -- remove if they still match
- if Quest.WatchInfo[info.watchIndex] == info then
- print('cleaning dead WatchInfo entry')
- Quest.WatchInfo[info.watchIndex] = nil
- end
- for i = 1, #info.objectives do
- Quest.lines[block.blockIndex][i]:Hide()
- end
-
- mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST)
-end
-
-mod.AddTrackedAchievement = function(cheevID)
- mod.CleanWidgets()
- mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT)
-end
-
-
-mod.RemoveTrackedAchievement = function(cheevID)
- print('|cFFFF8800UntrackAchievement', cheevID)
- mod.CleanWidgets()
- mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT)
-end
-
-mod.AcceptQuest = function()
- mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST_ADDED)
-end
-
-mod.AbandonQuest = function()
- QuestPOIUpdateIcons()
- mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST)
-end
-mod.TurnInQuest = function()
- QuestPOIUpdateIcons()
- mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST)
-end
-mod.AddAutoQuestPopUp = function(...)
- mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP)
-end
-mod.RemoveAutoQuestPopUp = function(...)
- mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP)
-end
-
-
-
-mod.SetSuperTrackedQuestID = function(questID)
- --mod:Update()
-end
\ No newline at end of file
diff -r 9b3fa734abff -r e837384ac363 ObjectiveFrame.lua
--- a/ObjectiveFrame.lua Sat Apr 09 07:32:45 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,825 +0,0 @@
---- ${PACKAGE_NAME}
--- @file-author@
--- @project-revision@ @project-hash@
--- @file-revision@ @file-hash@
--- Created: 3/30/2016 12:49 AM
-local B = select(2,...).frame
-local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
-local ipairs, max, min, unpack, floor, pairs, tostring, type, band = ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band
-local IsResting, UnitXP, UnitXPMax, GetXPExhaustion = IsResting, UnitXP, UnitXPMax, GetXPExhaustion
-local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent
-local Default, AutoQuest, Quest, Bonus, Cheevs = mod.DefaultHandler, mod.AutoQuest, mod.Quest, mod.Bonus, mod.Cheevs
-local CreateFrame = CreateFrame
-local print = B.print('Tracker')
-local unitLevel = 1
-local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_REASON
-local debug = false
---------------------------------------------------------------------
---- Global frame layout
---------------------------------------------------------------------
-
---- Upvalues
-local Wrapper = VeneerObjectiveWrapper
-local Scroller = Wrapper.scrollArea
-local Scroll = VeneerObjectiveScroll
-local orderedHandlers = mod.orderedHandlers
-local orderedNames = mod.orderedNames
-
---- Temp values set during updates
-local wrapperWidth, wrapperHeight
-local scrollWidth, scrollHeight
-local previousBlock
-local currentBlock
---- todo: source these from config
-local itemButtonSize, itemButtonSpacing = 36, 1
-local titleFont, textFont = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]]
-local titleSize, textSize = 16, 16
-local titlebg, textbg = {'HORIZONTAL', 1, 0, .7, .25, 1, 0, .7, .125}, {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0}
-local titleOutline, textOutline = "OUTLINE", "OUTLINE"
-local titleSpacing, textSpacing = 3, 3
-local titleIndent, textIndent = 2, 5
-local blockSpacing = 1
-local wrapperMaxWidth, wrapperMaxHeight = 270, 490 -- these are the hard bounds, actual *Height variables are changed
-local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE'
-local headerFont, headerSize, headerHeight = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 18, 24
-local headerOutline, headerColor, headerSpacing = 'OUTLINE', {1,1,1,1}, 2
-local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0 }
-local rewardSize = 32
-local oprint = B.print('Objectives')
-local bprint = B.print('Block')
-local tprint = B.print('Tracker')
-local lprint = B.print('Line')
-
-local band = bit.band
-local currentPosition, anchorFrame, anchorPoint
-
-Default.GetLine = function(handler, blockIndex, lineIndex)
- local print = lprint
- if not handler.lines[blockIndex] then
- handler.lines[blockIndex] = {}
- end
- local lines = handler.lines[blockIndex]
- if not lines[lineIndex] then
- print(' |cFF00FF88created line #'..lineIndex..' from for '..handler.name..' block #'..blockIndex)
- lines[lineIndex] = CreateFrame('Frame', 'Vn'..handler.name .. blockIndex..'ObjectiveLine'..lineIndex, handler:GetBlock(blockIndex), 'VeneerTrackerObjective')
- local line = lines[lineIndex]
- line.index = lineIndex
- line.height = 0
- line.status:SetSpacing(textSpacing)
- line.status:SetPoint('LEFT', line, 'LEFT', textIndent, 0)
- B.SetConfigLayers(line)
-
- if lines[lineIndex+1] then
- lines[lineIndex+1]:ClearAllPoints()
- end
-
- if debug then
- for _, region in ipairs(lines[lineIndex].debug) do
- region:Show()
- end
- end
-
- end
- return lines[lineIndex]
-end
-
-Default.GetBlock = function(handler, blockIndex)
- local print = bprint
- local block = handler.usedBlocks[blockIndex]
-
- if not handler.usedBlocks[blockIndex] then
- if #handler.freeBlocks >= 1 then
- block = handler.freeBlocks[#handler.freeBlocks]
- handler.freeBlocks[#handler.freeBlocks] = nil
- else
- block = CreateFrame('Frame', 'Veneer'..tostring(handler)..'Block'..blockIndex, Scroll, 'VeneerTrackerBlock')
- block.GetLine = function(block, lineIndex, data) return handler:GetLine(blockIndex, lineIndex, data) end
- block.UpdateLine = function(block, lineIndex, data) return handler:UpdateLine(block, lineIndex, data) end
- block.UpdateObjectives = function(block) return handler:UpdateObjectives(block) end
- block.SetTag = function(block, ...) return handler.SetTag(block, ...) end
-
- local c = mod.Conf.Wrapper
- block.blockIndex = blockIndex
- block.SetStyle = mod.SetBlockStyle
- block:SetWidth(c.Width)
-
- block.title:SetSpacing(c.TitleSpacing)
- block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing)
-
- block.titlebg:SetTexture(1,1,1,1)
- block.titlebg:SetGradientAlpha(unpack(titlebg))
- block.titlebg:SetPoint('TOP', block, 'TOP', 0, 0)
- block.titlebg:SetPoint('BOTTOM', block.title, 'BOTTOM', 0, -titleSpacing)
-
- block.status:SetSpacing(c.TextSpacing)
- block.status:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, -textSpacing)
- block.status:SetPoint('LEFT', block.titlebg, 'LEFT', textIndent, 0)
-
- block.statusbg:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, 0)
- block.statusbg:SetPoint('BOTTOM', block, 'BOTTOM', 0, 0)
- block.statusbg:SetTexture(1,1,1,1)
- block.statusbg:SetGradientAlpha(unpack(textbg))
-
- block.SelectionOverlay:SetPoint('TOPLEFT')
- block.SelectionOverlay:SetPoint('BOTTOMRIGHT')
-
- block.icon:SetSize(rewardSize, rewardSize)
- block.icon:SetPoint('TOPRIGHT', block, 'TOPRIGHT', -2, -2)
-
-
- --- methods for event handlers
-
- block.Select = handler.Select
- block.Open = handler.Open
- block.Remove = handler.Remove
- block.Link = handler.Link
- block:SetScript('OnMouseUp', handler.OnMouseUp)
- block:SetScript('OnMouseDown', handler.OnMouseDown)
- block.attachmentHeight = 0
- block:ClearAllPoints()
-
- B.SetConfigLayers(block)
-
- if debug then
- for _, region in ipairs(block.debug) do
- region:Show()
- end
- end
- end
- handler.usedBlocks[blockIndex] = block
- end
- return handler.usedBlocks[blockIndex]
-end
-
-Default.SetTag = function (block, tagName, tagPoint, tagAnchor, tagRelative)
- local print = bprint
- local tag = block[tagName]
- if block.info[tagName] and tag then
- tag:SetTexCoord(unpack(block.info[tagName]))
- tag:Show()
- tag:SetPoint(tagPoint, tagAnchor, tagRelative, 0, 0)
- tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', tag, 'TOPLEFT'
- else
- block[tagName]:Hide()
- end
- return tagPoint, tagAnchor, tagRelative
-end
-
-Default.UpdateObjectives = function(handler, block)
- local print = lprint
- local info = block.info
-
- print(' |cFF00FF00doing objectives', block:GetName())
-
- -- set the starting positions
- block.endPoint = block.status
- local completionScore, completionMax = 0, 0
- local displayObjectiveHeader = false
-
- if info.description and #info.description >= 1 then
- print(' |cFF00FFFF header line:|r', info.description)
- block.status:SetText(info.description)
- displayObjectiveHeader = true
- end
-
- local attachmentHeight = 0
- if info.objectives then
- attachmentHeight = textSpacing * 2
- for i, data in ipairs(info.objectives) do
- print(' |cFF88FF00#', i, data.type, data.text)
- displayObjectiveHeader = true
- local line = block:GetLine(i)
- line.height = 0
- block:UpdateLine(line, data)
-
- line:ClearAllPoints()
- if line.widget then
- local widgetPosition = 0
- line.widget:SetPoint('TOP', line, 'TOP', 0, -widgetPosition)
- line.widget:Show()
- line.height = line.widget:GetHeight() + textSpacing
-
- if line.displayText and #line.displayText >= 1 then
- widgetPosition = line.status:GetHeight() + textSpacing
- line.status:SetText(line.displayText)
- line.height = floor(line.status:GetStringHeight()+.5) + textSpacing + line.widget.height
- print(' - progressbar has text, adjust')
- end
- elseif line.displayText then
- line.status:SetText(line.displayText)
- line.height = floor(line.status:GetStringHeight()+.5) + textSpacing
-
- end
- attachmentHeight = attachmentHeight + line.height
-
- line:Show()
-
- line:SetPoint('LEFT', block, 'LEFT', 0, 0)
- line:SetPoint('TOP', block.endPoint, 'BOTTOM', 0, 0)
- line:SetPoint('RIGHT', block, 'RIGHT', 0, 0)
- line:SetHeight(line.height)
-
-
- print(' sz', line:GetSize())
- print(' pt', line:GetPoint(1))
- print(' |cFF44BBFF#', i, 'anchoring line, size:', line.height, 'current endpoint:', line.statusbg)
-
- block.endPoint = line
- end
-
- if attachmentHeight > 0 then
- block.attachmentHeight = attachmentHeight
- print(' |cFF00FF00attachment:', block.attachmentHeight)
- end
-
- local lines = handler.lines[block.blockIndex]
- local numObjectives = #info.objectives
- local numLines = #lines
- if lines and numLines > numObjectives then
- print(' has extra lines, need to clean up;', numLines, numObjectives)
- for i = numObjectives+1, numLines do
- print(' hide', i, lines[i]:GetName())
- lines[i]:Hide()
- end
- end
- end
-
-
-
- print(' displayHeader:', displayObjectiveHeader)
-
- if debug then
- for i, region in ipairs(block.debug) do
- for j = 1, region:GetNumPoints() do
- local _, target = region:GetPoint(j)
- if target:IsVisible() then
- region:Hide()
- else
- region:Show()
- end
- end
- end
- end
-
- block.completionScore = completionScore / completionMax
-end
-
-Bonus.UpdateObjectives = function(handler, block)
- Default.UpdateObjectives(handler, block)
-end
-
-local CLICK_TO_COMPLETE = 'Click to Complete'
-local CLICK_TO_ACCEPT = 'Click to Accept'
-
-AutoQuest.UpdateObjectives = function(handler, block)
- local print = lprint
- if block.info.type == 'OFFER' then
- block.status:SetText(CLICK_TO_ACCEPT)
- end
-
-end
-
-Quest.UpdateObjectives = function(handler, block)
- local print = lprint
- print('|cFF00FFFFUpdateObjectives()')
- local info = block.info
- local completionText
- if info.isAutoComplete then
- local questID, popupType = GetAutoQuestPopUp(info.questLogIndex)
- if popupType == 'COMPLETE' then
- completionText = CLICK_TO_COMPLETE
- end
- end
- if info.isComplete then
- if not completionText then
- completionText = GetQuestLogCompletionText(info.questLogIndex)
- end
- else
- Default.UpdateObjectives(handler, block)
- end
-end
-
---- Module-specific display variables
--- * height - height of whatever display widget is involved in conveying the task
--- * money - boolean that determines listening for money events or not
--- * progress - number ranging 0 to 2 indicating none/partial/full completion respectively
-
-Quest.UpdateLine = function(handler, block, line, data)
- local print = lprint
- print(' |cFFFF0088', block:GetName(), line.index, data.type)
- local objectiveType = data.type
- local r, g, b, a = 0, 1, 1, 1
- line.progress = 0
- if data.finished then
- line.progress = 2
- r, g, b, a = 0, 1, 0, 1
- elseif objectiveType == 'monster' then
- r, g, b, a = 1, 0, .45, 1
- elseif objectiveType == 'item' then
- r, g, b, a = .8, .8, .8, 1
- elseif objectiveType == 'object' then
- r, g, b, a = 1, 1, 1, 1
- elseif objectiveType == 'player' then
- r, g, b, a = 0, 0.8, 1, 1
- end
-
- line.displayColor = {r, g, b, a}
- line.status:SetTextColor(r, g, b, a)
- line.displayText = data.text
-
- return line
-end
-
-Bonus.UpdateLine = function(handler, block, line, data)
- local info = block.info
- local print = lprint
-
-
- line.displayColor = 'FFFFFF'
- line.displayText = data.text
- line.progress = 0
- print(' ', data.objectiveIndex,'|cFFFF0088-|r', data.objectiveType, data.text)
- if data.objectiveType == 'progressbar' then
- line.widgetType = 'ProgressBar'
- print(' |cFFFF44DDpercent='..tostring(GetQuestProgressBarPercent(info.questID)))
- data.value = GetQuestProgressBarPercent(info.questID) or 0
- data.maxValue = 100
- if data.value >= data.maxValue then
- line.progress = 1
- elseif data.value > 0 then
- line.progress = 2
- end
- line.format = PERCENTAGE_STRING
- local widget = mod.SetWidget(line, data, 'ProgressBar', info.questID..'-'..data.objectiveIndex)
- print(' |cFFFF0022** text:|r', data.text, '|cFFFF0022value:|r', data.value, '|cFFFF0022max:|r', data.maxValue)
- widget:SetPoint('TOP', line, 'TOP', 0, 0)
-
- line.widget = widget
- line.height = widget.height
- else
- line.displayText = data.text
- line.widget = nil
- end
- return line
-end
-
-Cheevs.UpdateLine = function(handler, block, line, data)
- local print = B.print('CheevsLine')
- line.progress = 0
- print(' ', data.objectiveIndex,'|cFF0088FF-|r', data.objectiveType, data.text)
- if data.flags then
- if band(data.flags, 0x00000001) > 0 then
- line.format = "%d/%d"
- line.widget = mod.SetWidget(line, data, 'ProgressBar', data.criteriaID)
- line.height = line.widget.height
- elseif band(data.flags, 0x00000002) then
- line.widget = nil
- else
- line.widget = nil
- line.displayColor = 'FFFFFF'
- line.displayText = line.text
-
- end
- else
-
- line.displayText = data.text
- end
- print('line.type =', data.type)
- print(' ** qtyStr:', data.quantityString, 'qty:', data.quantity, 'assetID:', data.assetID)
-end
-Default.UpdateLine = function(block, line)
- if line.finished then
- line.progress = 2
- elseif line.quantity > 0 then
- line.progress = 1
- else
- line.progress = 0
- end
- return line
-end
-
-
-mod.Quest.numButtons = 0
-local usedButtons = mod.Quest.itemButtons
-local freeButtons = mod.Quest.freeButtons
---[=[
-mod.UpdateWrapper = function(reason)
- print('|cFF00FFFFUpdateWrapper:|r', reason)
- unitLevel = UnitLevel('player')
- wrapperWidth = mod.Conf.Wrapper.WrapperWidth
- scrollWidth = mod.Conf.Wrapper.WrapperWidth
- local wrapperBlocks = 0
- -- Update scroll child vertical size
- scrollHeight = 0
- for i, handler in ipairs(orderedHandlers) do
- mod.UpdateTracker(handler)
- local frame = handler.frame
- if handler.actualBlocks >= 1 then
- frame:SetParent(Scroll)
- frame:SetPoint('TOPLEFT', Scroll, 'TOPLEFT', 0, - scrollHeight)
- frame:SetSize(wrapperWidth, frame.height)
- print('|cFF00FFFF'..frame:GetName()..'|r h:|cFF00FF00', frame.height, '|r y:|cFF00FF00', -scrollHeight)
- scrollHeight = scrollHeight + frame.height
- frame:Show()
- else
- frame:Hide()
- end
- wrapperBlocks = wrapperBlocks + handler.actualBlocks
- end
- print('final scrollHeight:', scrollHeight)
-
-
-
- -- Update frame dimensions
- if scrollHeight > wrapperMaxHeight then
- print(' is larger than', wrapperMaxHeight)
- wrapperHeight = wrapperMaxHeight
- else
- wrapperHeight = scrollHeight
- B.Conf.ObjectiveScroll = 0
- end
- scrollWidth = floor(scrollWidth+.5)
- scrollHeight = floor(scrollHeight+.5)
- wrapperWidth = floor(wrapperWidth+.5)
- wrapperHeight = floor(wrapperHeight+.5)
- headerHeight = floor(headerHeight+.5)
-
- if wrapperBlocks >= 1 then
- for i, region in ipairs(Wrapper.headerComplex) do
- region:Show()
- end
- else
- for i, region in ipairs(Wrapper.headerComplex) do
- region:Hide()
- end
- return
- end
- --[[wrapperHeight = scrollHeight
-
- print('|cFFFFFF00params:|r scroller:', scrollWidth .. ',' .. scrollHeight, 'scroll:', scrollWidth .. ',' .. scrollHeight,
- 'wrapper:', wrapperWidth .. ',' .. wrapperHeight,
- 'header:', headerHeight)]]
-
- --Scroller:SetSize(wrapperWidth, wrapperHeight)
- Scroller:SetPoint('TOPLEFT', Wrapper, 'TOPLEFT', 0, 0)
- Scroller:SetPoint('BOTTOMRIGHT', Wrapper, 'BOTTOMRIGHT')
-
-
- Scroll:SetSize(scrollWidth, scrollHeight)
- Scroll:SetPoint('TOPLEFT', Scroller, 'TOPLEFT', 0, B.Conf.ObjectiveScroll or 0)
- Scroll:SetPoint('RIGHT', Scroller, 'RIGHT')
-
- --Scroller:UpdateScrollChildRect()
- Wrapper:SetSize(wrapperWidth, wrapperHeight)
-
- --[[ update action buttons
- print('|cFF00FF00'..Scroll:GetName()..'|r:', Scroll:GetWidth(), Scroll:GetHeight(),
- '|cFF00FF00'..Scroller:GetName()..'|r:', Scroller:GetWidth(), Scroller:GetHeight(),
- '|cFF00FF00'..Wrapper:GetName()..'|r:', Wrapper:GetWidth(), Wrapper:GetHeight(),
- '|cFF0088FFvScrollRange|r:', floor(Scroller:GetVerticalScrollRange()+.5)
- )
- --]]
- mod.UpdateActionButtons()
-
-end
---]=]
-
-
-Default.Update = function (self, reason, ...)
- local print = tprint
- local tracker = self.frame
- local blockIndex = 0
- local trackerHeight = floor(tracker.titlebg:GetHeight()+.5)
-
- self.currentAnchor = tracker.titlebg
- local numWatched = self:GetNumWatched()
- local numBlocks = self.numBlocks
- local actualBlocks = 0
- for watchIndex = 1, 25 do
- blockIndex = blockIndex + 1
- if watchIndex <= numWatched then
- local info = self:GetInfo(watchIndex)
- if info then
- local currentBlock = self:UpdateBlock(blockIndex, info)
- currentBlock:SetPoint('TOPLEFT', self.currentAnchor, 'BOTTOMLEFT', 0, 0)
- currentBlock:SetPoint('RIGHT', tracker,'RIGHT', 0, 0)
- self.currentAnchor = currentBlock
- print(' |cFFFFFF00'..watchIndex..'|r', '|cFF00FF00'..currentBlock:GetName()..'|r', currentBlock.height, trackerHeight)
- trackerHeight = trackerHeight + currentBlock.height
- numBlocks = max(numBlocks, watchIndex)
- actualBlocks = actualBlocks + 1
- else
- print(' |cFFFF0000bad GetInfo data for #'..watchIndex)
- end
-
- elseif watchIndex <= numBlocks then
- local used = self.usedBlocks
- local free = self.freeBlocks
- print('clean up dead quest block')
- if used[blockIndex] then
- used[blockIndex]:Hide()
- used[blockIndex]:ClearAllPoints()
- free[#free+1]= used[blockIndex]
- used[blockIndex] = nil
- end
- else
- print(' |cFFFF9900END|r @', blockIndex)
- break -- done with quest stuff
- end
- end
- self.numWatched = numWatched
- self.numBlocks = numBlocks
- self.actualBlocks = actualBlocks
-
- tracker.previousHeight = tracker.height
- if numBlocks >= 1 then
- previousBlock = nil
-
- tracker.height = trackerHeight
- tracker:SetHeight(tracker.height)
- tracker:Show()
-
-
- else
- tracker.height = 0
- tracker:Hide()
- end
-
- return tracker.numWatched, tracker.numAll
-end
-
---- Updates the selected block frame to display the given info batch
--- If `previousBlock` is set, it will attempt to anchor to that
--- @param blockNum the ordered block to be updated, not a watchIndex value
--- @param info the reference returned by the GetXInfo functions
--- REMEMBER: t.info and questData[questID] are the same table
-Default.UpdateBlock = function (self, blockIndex, info)
- local print = bprint
- print(' Read list item |cFF00FFFF'..blockIndex..'|r')
- if not blockIndex or not info then
- return
- end
- local frame = self.frame
- local block = self:GetBlock(blockIndex)
- block.handler = self
- block.info = info
- block.mainStyle = info.mainStyle or 'Normal'
- block.subStyle = info.subStyle
-
- info.blockIndex = blockIndex
- if info.questID then self.QuestBlock[info.questID] = block end
- if info.questLogIndex then self.LogBlock[info.questLogIndex] = block end
- if info.watchIndex then self.WatchBlock[info.watchIndex] = block end
- self.BlockInfo[blockIndex] = info
-
- block.endPoint = block.titlebg
- block.attachmentHeight = 0
- block:UpdateObjectives()
-
- block.title:SetText(info.title)
- local titleHeight = floor(block.title:GetHeight()+.5)
- local statusHeight = floor(block.status:GetHeight()+.5)
- local attachmentHeight =floor(block.attachmentHeight + .5)
- local titlebgHeight = titleHeight + titleSpacing*2
- local statusbgHeight = statusHeight + textSpacing*2
-
- block.titlebg:SetHeight(titlebgHeight)
-
-
- print(' |cFF0088FFanchor to', self.currentAnchor:GetName())
-
- print(' |cFF00FF00total sizes:')
- print(' attachment:', attachmentHeight)
- print(' title:', titlebgHeight, '('.. titleHeight..')')
- --block.titlebg:SetHeight(block.title:GetHeight() + mod.Conf.Wrapper.TitleSpacing)
- block.height = titlebgHeight + attachmentHeight
- if statusHeight > 1 then
- block.height = block.height + statusbgHeight
- print(' status:', statusbgHeight, '('.. statusHeight..')')
- else
- print(' |cFFFF0088 skipped')
- end
- block:SetHeight(block.height)
-
- print(' |cFFFFFF00height|r:', block.height)
- print(' |cFF00FFFF)|r -> ', block, block:GetHeight())
-
- block:Show()
-
-
- if info.specialItem and not info.itemButton then
- print(' - |cFF00FFFFgenerating item button for info set')
- info.itemButton = mod.SetItemButton(block, info)
- else
- --info.itemButton = nil
- end
-
- local tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', block, 'TOPRIGHT'
- if info.rewardInfo then
- print('has immediate reward')
- if info.rewardInfo[1].type == 'currency' or info.rewardInfo[1].type == 'item' then
- block.icon:Show()
- block.iconLabel:SetText(info.rewardInfo[1].count)
- block.icon:SetPoint(tagPoint, tagAnchor, tagRelative, -2, -2)
- tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', block.icon, 'TOPLEFT'
- block.icon:SetTexture(info.rewardInfo[1].texture)
- end
- else
- block.icon:Hide()
- end
-
- if info.selected then
- block.SelectionOverlay:Show()
- else
- block.SelectionOverlay:Hide()
- end
-
- -- workaround for scrollchild issue where layers fall out of sync: in this case, it's by 1 vertical pixel
- block.highlight:SetPoint('TOPLEFT', block, 'TOPLEFT', 0, 1)
- block.lowlight:SetPoint('BOTTOMLEFT', block, 'BOTTOMLEFT', 0, 1)
-
- tagPoint, tagAnchor, tagRelative = block:SetTag('frequencyTag', tagPoint, tagAnchor, tagRelative)
- tagPoint, tagAnchor, tagRelative = block:SetTag('typeTag', tagPoint, tagAnchor, tagRelative)
- tagPoint, tagAnchor, tagRelative = block:SetTag('completionTag', tagPoint, tagAnchor, tagRelative)
-
- return block
-end
-----------
---- Top level methods
-
-local tick = 0
-function mod:Update (reason, ...)
- tick = tick + 1
- local print = tprint
- reason = reason or OBJECTIVE_TRACKER_UPDATE_REASON
- local updateWrapper = 0
- local hasStuff
- local insertingStuff
-
- print(format('%d |cFFFF%04X Update()', tick, bit.lshift(reason, 4)), reason, ...)
- currentPosition = 0
- anchorPoint = 'TOP'
- anchorFrame = Scroll
-
- local wrapperHeight = 0
- for id, handler in pairs(mod.orderedHandlers) do
- local frame = handler.frame
-
- print(format('|cFF00FFFF%s and(%04X vs %04x+%04x) = %04X|r', handler.name, reason, handler.updateReasonModule, handler.updateReasonEvents, band(reason, handler.updateReasonModule + handler.updateReasonEvents)))
- if band(reason, handler.updateReasonModule + handler.updateReasonEvents) > 0 then
- handler:Update(reason, ...)
- print(' |cFF00FF00'..id..'|r', handler.displayName, 'count:', handler.numWatched)
- insertingStuff = true
- else
- print(' |cFFFF0088'..id..'|r', 'no reason to update')
- end
-
- if handler.numWatched >= 1 then
- hasStuff = true
- currentPosition = currentPosition + 1
- frame:SetParent(Scroll)
- frame:SetPoint('TOP', anchorFrame, anchorPoint, 0, 0)
- print(' |cFF00BBFFpinning to', anchorFrame:GetName(), anchorPoint)
- anchorFrame = handler.frame
- anchorPoint = 'BOTTOM'
-
- print('current frame height:', frame.height)
- wrapperHeight = wrapperHeight + frame.height
- print('|cFFFF0088total height:', wrapperHeight)
- else
- handler.frame:Hide()
- end
- end
-
-
- if hasStuff or insertingStuff then
- print('updating height to', wrapperHeight)
- Wrapper:SetHeight(wrapperHeight)
- Scroller:SetHeight(wrapperHeight)
- Scroll:SetHeight(wrapperHeight)
- Scroller:SetVerticalScroll(B.Conf.ObjectiveScroll or 0)
- print('|cFFFF8800Wrapper:', Wrapper:GetSize())
- for i = 1, Wrapper:GetNumPoints() do
- print(' ', Wrapper:GetPoint(i))
- end
- print(' |cFF00FFFFScroller:', Scroller:GetSize())
- for i = 1, Scroller:GetNumPoints() do
- print(' ', Scroller:GetPoint(i))
- end
- print(' |cFF00FFFFScroll:', Scroll:GetSize())
- for i = 1, Scroll:GetNumPoints() do
- print(' ', Scroll:GetPoint(i))
- end
-
- Wrapper:Show()
- Scroller:Show()
- Scroll:Show()
- end
-
-end
-
---- Queue any active item buttons for update for that frame
-mod.UpdateActionButtons = function(updateReason)
- Scroller.snap_upper = 0
- Scroller.snap_lower = 0
- local print = B.print('ItemButton')
- if updateReason then
- print = B.print('IB_'..updateReason)
- end
-
- local previousItem
- for questID, itemButton in pairs(usedButtons) do
- local info= mod.Quest.Info[questID]
-
- print('|cFF00FFFF'.. questID .. '|r', itemButton:GetName())
- local block = mod.Quest.QuestBlock[questID]
- if block then
- -- Dispatch the probe
- if IsQuestWatched(info.questLogIndex) then
- itemButton.previousItem = previousItem
- print(' |cFFFFFF00probing', block:GetName())
- block:SetScript('OnUpdate', function()
- if block:GetBottom() and not InCombatLockdown() then
- print(' '..block:GetName()..' |cFF00FF00probe hit!')
- mod.UpdateBlockAction(block, itemButton, itemButton.previousItem) -- needs to be previousItem from this scope
- block:SetScript('OnUpdate', nil)
-
- end
- end)
- previousItem = itemButton
- else
- print('hidden block or unwatched quest')
- itemButton.previousItem = nil
- itemButton:Hide()
- end
- elseif itemButton:IsVisible() then
- print(' |cFFFF0088hiding unwatched quest button', itemButton:GetName())
- itemButton.previousItem = nil
- itemButton:Hide()
- else
- print(' |cFFBBBBBBignoring hidden log quest button', itemButton:GetName())
- end
- end
-end
-
-mod.UpdateBlockAction = function (block, itemButton)
- print('**|cFF0088FF'..itemButton:GetName(), '|r:Update()')
- if itemButton.questID ~= block.info.questID then
- print('** |cFFFF0088mismatched block assignment', itemButton.questID,'<~>', block.info.questID)
- -- something happened between this and last frame, go back and set new probes
- return mod.UpdateActionButtons()
- end
-
- local previousItem = itemButton.previousItem
- local upper_bound = Scroller:GetTop() + Scroller.snap_upper
- local lower_bound = Scroller:GetBottom() + Scroller.snap_lower + itemButtonSize
- local point, anchor, relative
-
- if block:GetBottom() < lower_bound then
- print('** ',block:GetName() ,'|cFFFFFF00bottom =', floor(block:GetBottom()+.5), 'threschold =', floor(lower_bound+.5))
- if previousItem then
- print('adjusting', previousItem:GetName())
- previousItem:ClearAllPoints()
- previousItem:SetPoint('BOTTOM', itemButton, 'TOP', 0, itemButtonSpacing)
- end
- itemButton:ClearAllPoints()
- itemButton.x = Wrapper:GetLeft() -4
- itemButton.y = Wrapper:GetBottom()
- point, anchor, relative = 'BOTTOMRIGHT', UIParent, 'BOTTOMLEFT'
- Scroller.snap_lower = Scroller.snap_lower + itemButtonSize + itemButtonSpacing
-
- elseif block:GetTop() > upper_bound then
- print('** ',block:GetName() ,'|cFFFFFF00top =', floor(block:GetTop()+.5), 'threschold =', floor(upper_bound+.5))
- itemButton:ClearAllPoints()
- if previousItem then
- print('latch onto another piece')
- point, anchor, relative ='TOP', previousItem, 'BOTTOM'
- itemButton.x = 0
- itemButton.y = -itemButtonSpacing
- else
- print('latch at corner', Scroller:GetLeft() -itemButtonSpacing, Scroller:GetTop())
- point, anchor, relative = 'TOPRIGHT', UIParent, 'BOTTOMLEFT'
- itemButton.x = Scroller:GetLeft() -4
- itemButton.y = Scroller:GetTop()
- end
- itemButton:Show()
- Scroller.snap_upper = Scroller.snap_upper - (itemButtonSize + itemButtonSpacing)
- else
- print('** ',block:GetName() ,'|cFF00FF00span =', floor(block:GetBottom()+.5), floor(block:GetTop()+.5), 'threschold =', floor(lower_bound+.5))
- itemButton:ClearAllPoints()
- itemButton.x = block:GetLeft() - itemButtonSpacing
- itemButton.y = block:GetTop()
- point, anchor, relative = 'TOPRIGHT', UIParent, 'BOTTOMLEFT'
- end
-
- itemButton:SetPoint(point, anchor, relative, itemButton.x, itemButton.y)
- itemButton:Show()
-end
-
-mod.UpdateItemButtonCooldown = function(button)
-
-end
-
-local unitLevel = UnitLevel('player')
-
-
diff -r 9b3fa734abff -r e837384ac363 ObjectiveInfo.lua
--- a/ObjectiveInfo.lua Sat Apr 09 07:32:45 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,573 +0,0 @@
-local B = select(2,...).frame
-local wipe, pairs, ipairs, min, max, unpack, format, mod = table.wipe, pairs, ipairs, min, max, unpack, format, mod
-local tinsert, tostring = tinsert, tostring
-local GetQuestTagInfo, GetQuestLogTitle = GetQuestTagInfo, GetQuestLogTitle
-local GetNumQuestLogEntries, GetNumQuestWatches, GetQuestLogCompletionText, IsQuestWatched, IsQuestHardWatched, GetQuestLogSpecialItemInfo, GetQuestLogSpecialItemCooldown = GetNumQuestLogEntries, GetNumQuestWatches, GetQuestLogCompletionText, IsQuestWatched, IsQuestHardWatched, GetQuestLogSpecialItemInfo, GetQuestLogSpecialItemCooldown
-local GetNumAutoQuestPopUps, GetAutoQuestPopUp, GetTasksTable, GetNumQuestLogTasks, GetTaskInfo, GetQuestObjectiveInfo = GetNumAutoQuestPopUps, GetAutoQuestPopUp, GetTasksTable, GetNumQuestLogTasks, GetTaskInfo, GetQuestObjectiveInfo
-local GetNumQuestLogRewardCurrencies, GetQuestLogRewardCurrencyInfo, GetNumQuestLogRewards, GetQuestLogRewardInfo, GetQuestLogRewardMoney, GetMoneyString = GetNumQuestLogRewardCurrencies, GetQuestLogRewardCurrencyInfo, GetNumQuestLogRewards, GetQuestLogRewardInfo, GetQuestLogRewardMoney, GetMoneyString
-local GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo = GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo
-local GetQuestWatchIndex, GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo = GetQuestWatchIndex, GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo
-local QuestHasPOIInfo, GetDistanceSqToQuest, GetQuestFactionGroup = QuestHasPOIInfo, GetDistanceSqToQuest, GetQuestFactionGroup
-local GetTrackedAchievements, GetNumTrackedAchievements, GetAchievementInfo = GetTrackedAchievements, GetNumTrackedAchievements, GetAchievementInfo
-local GetMoney, floor = GetMoney, floor
-local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
-local print = B.print('Info')
-local QUEST_TAG_DUNGEON = QUEST_TAG_DUNGEON
-local QUEST_TAG_GROUP = QUEST_TAG_GROUP
-local QUEST_TAG_ACCOUNT = QUEST_TAG_ACCOUNT
-local QUEST_TAG_TCOORDS = QUEST_TAG_TCOORDS
-local LE_QUEST_FREQUENCY_DAILY = LE_QUEST_FREQUENCY_DAILY
-local LE_QUEST_FREQUENCY_WEEKLY = LE_QUEST_FREQUENCY_WEEKLY
-local FACTION_ALLIANCE, LE_QUEST_FACTION_HORDE, FACTION_HORDE, LE_QUEST_FACTION_HORDE = FACTION_ALLIANCE, LE_QUEST_FACTION_HORDE, FACTION_HORDE, LE_QUEST_FACTION_HORDE
-
-local Tracker, Bonus, AutoQuest, Quest, Cheevs = T.DefaultTracker, T.Bonus, T.AutoQuest, T.Quest, T.Cheevs
---------------------------------------------------------------------
---- Tracker-specific data retrieval functions
---------------------------------------------------------------------
-
-
-local DoQuestRewards= function(t, questID)
- local rewards = {}
- t.numCurrencies = GetNumQuestLogRewardCurrencies(questID)
- for i = 1, t.numCurrencies do
- local name, texture, count = GetQuestLogRewardCurrencyInfo(i, questID)
- tinsert(rewards,{
- type = 'currency',
- index = i,
- name = name,
- texture = texture,
- count = count
- });
- end
- -- items
- t.numItems = GetNumQuestLogRewards(questID)
- for i = 1, t.numItems do
- local name, texture, count, quality, isUsable = GetQuestLogRewardInfo(i, questID)
- tinsert(rewards, {
- type = 'item',
- index = i ,
- name = name,
- texture = texture,
- count = count,
- quality = quality,
- isUsable = isUsable
- });
- end
- -- money
-
- local money = GetQuestLogRewardMoney(questID)
- if ( money > 0 ) then
- tinsert(rewards, {
- type = 'money',
- name = GetMoneyString(money),
- texture = "Interface\\Icons\\inv_misc_coin_01",
- count = 0,
- });
- end
-
- if #rewards >= 1 then
- t.rewardInfo = rewards
- end
-end
-
-
------------------------------
---- AUTO_QUEST
-AutoQuest.LogInfo = {}
-AutoQuest.LogBlock = {}
-AutoQuest.QuestBlock = {}
-AutoQuest.WatchBlock = {}
-function AutoQuest:GetNumWatched ()
- print(self.name, self)
- Quest:GetNumWatched()
- self.numWatched = GetNumAutoQuestPopUps()
-
- return self.numWatched
-end
-AutoQuest.GetInfo = function(self, popupIndex)
-
-
- local questID, type = GetAutoQuestPopUp(popupIndex)
- local questIndex = GetQuestLogIndexByID(questID)
- local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questIndex)
-
- self.Info[questID] = self.Info[questID] or {}
- local popup = self.Info[questID]
- popup.title = title
- popup.description = type
- popup.popupType = type
- popup.questID = questID
- popup.questIndex = questIndex
- popup.popupIndex = popupIndex
-
- self.Info[questID] = popup
- self.WatchInfo[popupIndex] = popup
-
-
- return self.Info[questID]
-end
-
------------------------------
---- BONUS OBJECTIVE
--- The default UI pops them up as you enter their relevant areas, but the data is actually available at all times.
--- The only requirement is that you've been to said area and progressed any of the objectives.
--- Blizzard deal with this fact by caching any task data collected during session and masking out whatever gets completed.
--- For the addon's module structure to work, GetNumWatched method also invokes a tasks table scan.
--- That composes the table searched by GetInfo().
-
-------------------------------------------------------------------------------------------
---- These functions are copied from Blizzard_BonusObjectiveTracker.lua;
--- It's kind of dumb, but this avoids the risk of code taint.
-
---- Returns a tasks table modified to include recently completed objectives
-local UnitName, GetRealmName = UnitName, GetRealmName
-local InternalGetTasksTable = function()
- local completedTasks = T.Conf.TasksLog
- local char = UnitName("player")
- local realm = GetRealmName()
- local tasks = GetTasksTable()
-
- for questID, data in pairs(Bonus.Info) do
-
- print(' -- questID:', questID, #data.objectives)
- for i, o in ipairs(data.objectives) do
- print(' --', i, o.text)
- end
-
- end
-
-
- for questID, data in pairs(completedTasks) do
- if questID > 0 then
- local found = false
- for i = 1, #tasks do
- if tasks[i] == questID then
- found = true
- break
- end
- end
- -- if it's not part of the current table, then try to insert it where it was last found
- if not found then
- if data.watchIndex < #tasks then
- tinsert(tasks, data.watchIndex, data)
- else
- tinsert(tasks, data)
- end
- end
- end
- end
- return tasks
-end
-
---- Returns an entry from the composed tasks table if possible, otherwise makes an API pull
-local InternalGetTaskInfo = function(questID)
- local completedTasks = T.Conf.TasksLog
- if completedTasks[questID] then
- return true, true, #completedTasks[questID].objectives
- else
- return GetTaskInfo(questID)
- end
-end
-
---- Same as above but for the objective entries
-local InternalGetQuestObjectiveInfo = function(questID, objectiveIndex)
- local completedTasks = T.Conf.TasksLog
- if ( completedTasks[questID] ) then
- print('using internal data')
- return completedTasks[questID].objectives[objectiveIndex], completedTasks[questID].objectiveType, true;
- else
- return GetQuestObjectiveInfo(questID, objectiveIndex, false);
- end
-end
-
---- end redundant copy of silliness
-------------------------------------------------------------------------------------------
-
-Bonus.Completed = {}
-Bonus.POI = {}
-Bonus.Scenario = {}
-Bonus.QuestBlock = {}
-Bonus.WatchInfo = {}
-function Bonus:GetNumWatched ()
- print(self.name, self)
-
- local tasks = InternalGetTasksTable()
- local numWatched = 0
- local numAll = 0
- self.WatchInfo = {}
- print('|cFFFFFF00Bonus.GetNumWatched()|r', #tasks)
- print(' TasksTable pull:')
- for i, questID in ipairs(tasks) do
- local isInArea, isOnMap, numObjectives = InternalGetTaskInfo(questID)
- local existingTask = self.QuestBlock[questID]
- local displayObjectiveHeader = false;
- local test = (isInArea or (isOnMap and existingTask))
- --local test = true
- if test then
- self.Info[questID] = self.Info[questID] or {}
-
- local t = self.Info[questID]
- self.WatchInfo[i] = t
- t.isInArea = isInArea
- t.isOnMap = isOnMap
- t.existingTask = existingTask
- t.questID = questID
- t.objectives = {}
- t.taskIndex = i
-
-
- DoQuestRewards(t, questID)
-
- local taskTitle
- local taskFinished = true;
- for objectiveIndex = 1, numObjectives do
- local text, objectiveType, finished, displayAsObjective = InternalGetQuestObjectiveInfo(questID, objectiveIndex, false);
- displayObjectiveHeader = displayObjectiveHeader or displayAsObjective;
- if not taskTitle then
- if objectiveType == 'progressbar' and not text:match('^%d%+\\%d+') then
- taskTitle = text
- text = ''
- end
- end
-
-
- print(' --', text, objectiveType, finished, displayAsObjective)
- t.objectives[objectiveIndex] = t.objectives[objectiveIndex] or {}
- local o = t.objectives[objectiveIndex]
-
- o.objectiveIndex = objectiveIndex
- o.text = text
- o.objectiveType = objectiveType
- o.finished = finished
- o.displayAsObjective = displayAsObjective
- print(' |cFF00FF88*', objectiveIndex, text)
- end
-
- -- didn't get a name from progress bar? what about area name
- if not taskTitle then
- if isInArea then
- taskTitle = GetMapNameByID(GetCurrentMapAreaID())
- end
- end
- t.title = taskTitle
- end
-
- print (' |cFF00FF88#', i, 'questID', questID, 'inArea', isInArea, 'onMap', isOnMap, 'existing', (existingTask and 'Y' or 'N'), (test and '|cFF00FF00show|r' or '|cFFFF0088hide|r'))
- end
-
-
- self.numAll = #tasks
- self.numWatched = #self.WatchInfo
- print(' stats:', self.numAll, 'active tasks,', self.numWatched, 'nearby or animating')
- --return #tasks
- return #self.WatchInfo
-end
-
---- info cleanup done when turn-ins are detected
-Bonus.OnTurnIn = function(self, questID, xp, money)
- print('|cFFFF8800'..self.name..':OnTurnIn call', questID, xp, money)
-
-
-
-end
-
-Bonus.GetInfo = function(self, taskIndex)
- print(self.name, self)
- return self.WatchInfo[taskIndex]
-end
-
-Bonus.Store = function(questID)
-
- if not questID then
- print('|cFFFF4400invalid quest ID', questID)
- return
- end
-
- Bonus.Info[questID] = Bonus.Info[questID] or {}
- local t = Bonus.Info[questID]
- local isInArea, isOnMap, numObjectives = GetTaskInfo(questID)
- t.questID = questID
- t.numObjectives = numObjectives
- t.isInArea = isInArea
- t.isOnMap = isOnMap
-
- print(' isInArea', isInArea, 'isOnMap', isOnMap, 'numObj', numObjectives)
- local displayObjectives = false
- local isComplete = true
- if numObjectives >= 1 then
- print(' ', numObjectives,'objective rows')
- t.objectives = {}
- for i = 1, t.numObjectives do
- t.objectives[i] = {}
- local o = t.objectives[i]
- o.index = i
- --local text, objectiveType, finished, displayAsObjective =
- o.text, o.objectiveType, o.finished, o.displayAsObjective = GetQuestObjectiveInfo(questID, i, false)
-
- print(i, '==>', o.text, o.objectiveType, o.finished, o.displayAsObjective)
- t.displayObjectives = t.displayObjectives or o.displayAsObjective
- t.isComplete = t.isComplete and o.finished
-
- end
- end
-
- t.displayObjectives = displayObjectives
-
- DoQuestRewards(t, questID)
-
- Bonus.TasksTable[questID] = t
-
- return t
-end
-
------------------------------
---- QUEST
-Quest.itemButtons = {}
-Quest.freeButtons = {}
-Quest.POI = {}
-Quest.QuestBlock = {}
-Quest.LogBlock = {}
-Quest.LogInfo = {}
-
-function Quest:GetNumWatched ()
- print(self.name, self)
- self.numAll = GetNumQuestLogEntries()
- self.numWatched = GetNumQuestWatches()
- return self.numWatched, self.numAll
-end
-Quest.GetInfo = function (self, watchIndex)
- print('|cFF00DDFFQuest|r.|cFF0088FFGetInfo(|r'.. tostring(watchIndex)..'|r)')
- local questID, title, questIndex, numObjectives, requiredMoney, isComplete,
- startEvent, isAutoComplete, failureTime, timeElapsed, questType, isTask, isStory, isOnMap, hasLocalPOI = GetQuestWatchInfo(watchIndex)
-
- if not questIndex then
- return
- end
-
- local _, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, _, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questIndex)
-
-
- if not questID then
- return
- end
- Quest.Info[questID] = Quest.Info[questID] or {}
-
- local q = Quest.Info[questID]
- q.watchIndex = watchIndex
- q.type = 'Quest'
- q.questID = questID
- q.title = title
- q.level = level
- q.displayQuestID = displayQuestID
- q.suggestedGroup = suggestedGroup
- q.questLogIndex = questIndex
- q.numObjectives = numObjectives
- q.requiredMoney = requiredMoney
- q.isComplete = isComplete
- q.startEvent = startEvent
- q.isAutoComplete = isAutoComplete
- q.failureTime = failureTime
- q.timeElapsed = timeElapsed
- q.questType = questType
- q.isTask = isTask
- q.isStory = isStory
- q.isOnMap = isOnMap
- q.hasLocalPOI = hasLocalPOI
- q.frequency = frequency
- q.isComplete = isComplete
- q.isStory = isStory
- q.isTask = isTask
-
- --- resolve icon type and template
- local tagID, tagName = GetQuestTagInfo(questID)
- if ( tagName ) then
- local factionGroup = GetQuestFactionGroup(questID);
- -- Faction-specific account quests have additional info in the tooltip
- if ( tagID == QUEST_TAG_ACCOUNT and factionGroup ) then
- local factionString = FACTION_ALLIANCE;
- if ( factionGroup == LE_QUEST_FACTION_HORDE ) then
- factionString = FACTION_HORDE;
- end
- tagName = format("%s (%s)", tagName, factionString);
- end
- if ( QUEST_TAG_TCOORDS[tagID] ) then
- local questTypeIcon;
- if ( tagID == QUEST_TAG_ACCOUNT and factionGroup ) then
- q.typeTag = QUEST_TAG_TCOORDS["ALLIANCE"];
- if ( factionGroup == LE_QUEST_FACTION_HORDE ) then
- q.typeTag= QUEST_TAG_TCOORDS["HORDE"];
- end
- else
- q.typeTag = QUEST_TAG_TCOORDS[tagID];
- end
- end
- end
-
- if ( frequency == LE_QUEST_FREQUENCY_DAILY ) then
- q.frequencyTag = QUEST_TAG_TCOORDS["DAILY"]
- q.mainStyle = 'Daily'
- elseif ( frequency == LE_QUEST_FREQUENCY_WEEKLY ) then
- q.frequencyTag = QUEST_TAG_TCOORDS["WEEKLY"]
- q.mainStyle = 'Daily'
- end
- if ( isComplete and isComplete < 0 ) then
- q.completionTag = QUEST_TAG_TCOORDS["FAILED"]
- q.subStyle = 'Failed'
- elseif isComplete then
- q.completionTag = QUEST_TAG_TCOORDS["COMPLETED"]
- q.subStyle = 'Complete'
- end
- q.tagID = tagID
- q.tagName = tagName
-
-
-
- --q.isBreadCrumb = isBreadCrumb
- q.completionText= GetQuestLogCompletionText(questIndex)
- q.numObjectives = GetNumQuestLeaderBoards(questIndex)
- q.objectives = {}
- for i = 1, q.numObjectives do
- local text, type, finished = GetQuestLogLeaderBoard(i, questIndex)
- print(format(' #%d %s %s %s', i, tostring(type), tostring(text), tostring(finished)))
- q.objectives[i] = {
- index = i,
- type = type,
- text = text,
- finished = finished
- }
- if type == 'event' then
- elseif type == 'monster' then
- elseif type == 'object' then
- elseif type == 'reputation' then
- elseif type == 'item' then
- end
- end
-
- if requiredMoney >= 1 then
- local money = GetMoney()
- local moneyText = money
- local requiredSilver, requiredCopper
- local requiredGold = (requiredMoney > 10000) and (floor(requiredMoney/10000)) or nil
- if mod(requiredMoney, 10000) ~= 0 then
- requiredSilver = (requiredMoney > 100) and (mod(requiredMoney, 10000) / 100) or nil
- if mod(requiredMoney, 100) ~= 0 then
- requiredCopper = mod(requiredMoney, 100)
- end
- end
-
- -- round the money value down
- if requiredMoney > 9999 and not (requiredSilver or requiredCopper) then
- moneyText = floor(money/10000)
- elseif requiredMoney < 10000 and mod(requiredMoney,100) == 0 then
- moneyText = floor(money/100)
- end
-
- local text = moneyText
- local index = #q.objectives + 1
- local finished = (GetMoney() >= requiredMoney)
-
- if not finished then
- text = text .. ' / ' .. GetCoinTextureString(requiredMoney, 15)
- else
- text = '' .. GetCoinTextureString(requiredMoney, 15)
- end
- q.objectives[index] = {
- index = index,
- type = 'progressbar',
- quantity = money,
- requiredQuantity = requiredMoney,
- text = text,
- finished = finished
- }
- print(format(' #%d %s %s %s', index, 'money', text, tostring(finished)))
- end
-
-
- local link, icon, charges = GetQuestLogSpecialItemInfo(questIndex)
- local start, duration, enable = GetQuestLogSpecialItemCooldown(questIndex)
- if link or icon or charges then
- q.specialItem = {
- questID = questID,
- questIndex = questIndex,
- link = link,
- charges = charges,
- icon = icon,
- start = start,
- duration = duration,
- enable = enable,
- }
- end
-
- if QuestHasPOIInfo(questID) then
- local distance, onContinent = GetDistanceSqToQuest(questIndex)
- if distance ~= nil and distance > 0 then
- self.POI[questIndex] = {
- questIndex = questIndex,
- questID = questID,
- distance = distance,
- onContinent = onContinent
- }
- end
- end
-
-
- q.selected = (questID == GetSuperTrackedQuestID()) -- call directly so artifact data doesn't become an issue
- self.WatchInfo[watchIndex] = q
- self.LogInfo[questIndex] = q
- print('- logIndex =', questIndex, 'title =', title)
- return q
-end
-
-Quest.GetClosest = function()
- local minID
- local minDist = math.huge
- for i = 1, Quest.GetNumWatched() do
- local info = Quest.GetInfo(i)
- if info.hasLocalPOI then
- local distance, onContinent = GetDistanceSqToQuest(info.questIndex)
- end
- end
-end
-
-
-Cheevs.GetNumWatched = function(self)
- print('|cFF00FF00' .. GetTime())
- Cheevs.trackedCheevs = {GetTrackedAchievements()}
- return GetNumTrackedAchievements()
-end
-Cheevs.GetInfo = function(self, index)
- local cheevID = Cheevs.trackedCheevs[index]
- local id, name, points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy = GetAchievementInfo(cheevID)
-
- self.Info[cheevID] = {}
- local c = self.Info[cheevID]
- c.type = 'Cheevs'
- c.watchIndex = index
- c.cheevID = cheevID
- c.title = name
- c.points, c.completed, c.month, c.day, c.year, c.description, c.flags, c.icon, c.rewardText, c.isGuildAch, c.wasEarnedByMe, c.earnedBy =
- points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy
- c.numObjectives = GetAchievementNumCriteria(cheevID)
- c.objectives = {}
- for i = 1, c.numObjectives do
- local description, type, completed, quantity, requiredQuantity, characterName, flags, assetID, quantityString, criteriaID = GetAchievementCriteriaInfo(cheevID, i)
- c.objectives[i] = {
- objectiveIndex = i,
- cheevID = cheevID,
- text = description,
- type = type,
- finished = completed,
- value = quantity,
- maxValue = requiredQuantity,
- characterName = characterName,
- flags = flags,
- assetID = assetID,
- quantityString = quantityString,
- criteriaID = criteriaID,
- }
- end
- print('Cheevs.|cFF0088FFGetInfo|r('..index..')', 'obj:', GetAchievementNumCriteria(cheevID), name, description)
-
- self.WatchInfo[index] = c
- return self.Info[cheevID]
-end
diff -r 9b3fa734abff -r e837384ac363 ObjectiveSecure.xml
--- a/ObjectiveSecure.xml Sat Apr 09 07:32:45 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-
-
-
-
\ No newline at end of file
diff -r 9b3fa734abff -r e837384ac363 ObjectiveStyle.lua
--- a/ObjectiveStyle.lua Sat Apr 09 07:32:45 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,506 +0,0 @@
-local B = select(2,...).frame
-local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
-local print = B.print('SetStyle')
--------------------------------------------------------------
---- Deals with swapping between different color palettes
----
-
-local titleFont, textFont = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]]
-local titleSize, textSize = 16, 15
-local titleOutline, textOutline = "OUTLINE", "OUTLINE"
-local titleSpacing, textSpacing = 3, 3
-local unpack, type, pairs, tconcat = unpack, type, pairs, table.concat
-local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE'
-local headerFont, headerSize = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 24
-local headerOutline, headerSpacing = 'OUTLINE', 2
-
-
-mod.defaults.Style = {
- Format = {
- Frame = {
- Width = 270,
- },
- title = {
- Indent = 0,
- Spacing = 0,
- },
- status = {
- Indent = 5,
- Spacing = 0,
- }
- },
- FontBank = {
- ['Normal'] = _G.VeneerCriteriaFontNormal,
- ['Progress'] = _G.VeneerCriteriaFontProgress,
- ['Complete'] = _G.VeneerCriteriaFontComplete,
- ['Failed'] = _G.VeneerCriteriaFontFailed,
- },
- Normal = {
- title = {
- TextColor = {1, 1, 1, 1},
- Width = 270,
- Spacing = 0,
- Indent = 2,
- },
- titlebg = {
- },
- status = {
- Width = 270,
- Spacing = 0,
- },
- statusbg = {
- },
- Frame = {
- }
- },
- Tracker = {
- Normal = {
- title = {
- Font = {headerFont, headerSize, headerOutline}, Spacing = headerSpacing,
- Indent = 2,
- TextColor = {1, .9, .2, 1},
- },
- titlebg = {
- Gradient = {'VERTICAL', MinColor = {0,0,0,0.25}, MaxColor = {0,0,0,.15}},
- }
- }
- },
- TrackerBlock = {
- Normal = {
- titlebg = {
- Indent = 2,
- Gradient = { 'HORIZONTAL', MinColor = {0.7, 0, 0.9, 1}, MaxColor = {.7, 0, 0.9, .1}},
- },
- title = {
- TextColor = {1,1,1,1},
- Font = {titleFont, titleSize, titleOutline},
- Spacing = titleSpacing,
- },
- status = {
- TextColor = {1,1,1,1},
- Font = {textFont, textSize, textOutline},
- Spacing = textSpacing,
- },
- statusbg = {
- Gradient = { 'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, .1}},
- }
- },
- Daily = {
- titlebg = {
- Gradient = {'HORIZONTAL', MinColor = {0, .4, 1, 1}, MaxColor = {0, 0.4, 1, .1}, },
- },
- statusbg = {
- Gradient = {'HORIZONTAL', MinColor = {0, .4, 1, 1}, MaxColor = {0, 0.35, .90, .1}, },
- },
- title = {
- TextColor = {0.7,1,1,1},
- Font = {titleFont, titleSize, titleOutline},
- Spacing = titleSpacing,
- },
- status = {
- TextColor = {1,1,1,1},
- Font = {textFont, textSize, textOutline},
- Spacing = textSpacing,
- },
- },
- Super = {
- title = {
- TextColor = {1,1,1,1},
- Font = {titleFont, titleSize, titleOutline},
- Spacing = titleSpacing, BackgroundFullWidth = true
- },
- titlebg = {
- Gradient = { 'HORIZONTAL', MinColor = {0, .7, .6, 1}, MaxColor = {0, .7, .6, 1}},
- },
- status = {
- TextColor = {1,1,1,1},
- Font = {textFont, textSize, textOutline},
- Spacing = textSpacing,
- },
- statusbg = {
- Gradient = { 'HORIZONTAL', MinColor = {0, .7, .6, 1}, MaxColor = {0, .7, .6, 1} },
- },
- },
- MouseDown = {
- title = {
- Font = {titleFont, titleSize, titleOutline},
- Spacing = titleSpacing,
- },
- titlebg = {
- Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {0.2, .4, 1, 1}, },
- },
- status = {
- Font = {textFont, textSize, textOutline},
- Spacing = textSpacing,
- },
- statusbg = {
- Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {0.2, .4, 1, 1}, },
- }
- },
- Complete = {
- title = {
- TextColor = {1,1,1,1},
- Font = {titleFont, titleSize, titleOutline}, Spacing = titleSpacing,
- },
- titlebg = {
- Gradient = {'HORIZONTAL', MinColor = {0, 1, 0, 1}, MaxColor = {0, 1, 0, 1}, },
- },
- status = {
- TextColor = {1,1,1,1},
- Font = {textFont, textSize, textOutline}, Spacing = textSpacing,
- },
- statusbg = {
- Gradient = {'HORIZONTAL', MinColor = {0, 1, 0, 1}, MaxColor = {0, 1, 0, 1}, },
- }
- },
- AutoQuest = {
- Normal = {
- titlebg = {
- Indent = 2,
- Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, 1}},
- },
- title = {
- TextColor = {1,1,1,1},
- Font = {titleFont, titleSize, titleOutline},
- Spacing = titleSpacing,
- },
- status = {
- TextColor = {0,1,0,1},
- Font = {textFont, textSize, textOutline},
- Spacing = textSpacing,
- },
- statusbg = {
- Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, 1}},
- }
- },
- },
- Cheevs = {
- Normal = {
-
- title = {
- Font = {titleFont, titleSize, titleOutline},
- Spacing = titleSpacing,
- },
- titlebg = {
- Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, 1}},
-
- },
- status = {
- Font = {textFont, textSize, textOutline},
- Spacing = textSpacing,
- },
- statusbg = {
- Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, 1}},
- },
- },
- Complete = {
- title = {
- Font = {titleFont, titleSize, titleOutline},
- Spacing = titleSpacing,
- },
- titlebg = {
- Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, 1}},
- },
- status = {
- Font = {textFont, textSize, textOutline},
- Spacing = textSpacing,
- },
- statusbg = {
- Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, 1}},
- },
- },
- }
- }
-}
-
-local style_cache_func = {}
-local block_vars = {
- ['titleSize'] = {'titleWidth', 'titleHeight'},
- ['FrameSize'] = {'width', 'height'}
-}
-local attrib_vars = {
- ['Font'] = {'height'},
-}
-
-mod.BlockStyleCache = {}
-local style_cache = mod.BlockStyleCache
-mod.regions = {}
-mod.regionStyles = {}
-mod.SetBlockStyle = function(frame, frameType, ...)
- -- var names intended to reflect argument order
- print('|cFFFFFF00'..frame:GetName()..'|r', frameType, ...)
- --@debug@
- local c = mod.defaults.Normal
- local style_list = {... }
- local styleName = frameType .. '-' .. table.concat(style_list,'')
- local previousClass = {mod.Conf.Style[frameType] }
- local previousClassString = {'frame' }
- local parentName
-
- if not style_cache[styleName] then
- local style = {}
-
- --[[
- if mod.defaults.Style[frameType] then
- print(' setting style class |cFF00FFFF'..frameType)
- else
- print(' resorting to class Normal (missing |cFFFF8800'.. frameType..'|r)')
- end
- --]]
- local normal = mod.defaults.Style.Normal
- local root = mod.defaults.Style[frameType] or normal
- for i, className in ipairs(style_list) do
- print('|cFF00FF00'..i..'|r', className)
- local class = normal
- local childClass
- if previousClass then
- for i = #previousClass, 1, -1 do
- print('checking if '..className..' child of '.. previousClassString[i])
- if previousClass[i][className] then
- print(' it is!')
- childClass = previousClass[i][className]
- parentName = previousClassString[i]
- break
- end
- end
- end
- if childClass then
- class = childClass
- print(' ChildClass '..parentName..'.|cFFFF0088'.. className .. '|r')
- elseif root[className] then
- class = root[className]
- print(' SubClass |cFF0088FF'.. className .. '|r')
- elseif normal[className] then
- class = normal[className]
- print(' SubClass Normal.|cFFFF0088'..className..'|r')
- else
- --print(' SubClass not found '..className..'')
- end
- tinsert(previousClass, class)
- tinsert(previousClassString, className)
-
- for elementName, element in pairs(class) do
- if not elementName:match('^%u') then
- --print(' scanning Element |cFF8800FF'.. elementName ..'|r')
- if not style[elementName] then
- style[elementName] = {}
- end
- for key, value in pairs(element) do
- if mod.SetBlockAttribute[key] then
- --print(' |cFF00FF00'..elementName..'|r.|cFF00FFFF'..key..' =', (type(value) == 'table' and ('{'..table.concat(value,', ')..'}') or tostring(value)))
- style[elementName][key] = value
- end
-
- end
- end
-
- end
- end
-
- for k, elements in pairs(mod.defaults.Style.Normal) do
- if not style[k] and type(elements) ~= 'table' then
- style[k] = elements
- end
- end
-
-
- --[[print('result for: ', frame:GetName())
- for k,v in pairs(style) do
- if type(v) == 'table' and not k:match('^%u') then
- for kk, vv in pairs(v) do
- --print(' |cFFFFFF00'..k..'|r.|cFF00FF00'..kk..'|r =', (type(vv) == 'table' and ('{'..table.concat(vv,', ')..'}') or tostring(vv)))
- end
- else
- --print(' |cFFFFFFFF' .. k ..'|r =', tostring(v))
- end
- end
- --]]
- print('saving |cFFFFFF00'..styleName)
- style_cache[styleName] = style
- else
-
- print('using |cFFFF00FF'..styleName)
- end
-
- local style = style_cache[styleName]
-
- if not style_cache_func[styleName] then
- local code =
- "return function (frame)\n"..
- " local func = Veneer.ObjectiveTracker.SetBlockAttribute\n"..
- " local cache = Veneer.ObjectiveTracker.BlockStyleCache"
- --.. " print('CacheFunc', '|cFFFFFF00SET|r "..styleName.." |cFFFFFF00ON|r', frame:GetName()) "
-
- for elementName, styleset in pairs(style) do
- code = code ..
- "\n if frame['"..elementName.."'] then"
-
- for attributeName, value in pairs(styleset) do
- if mod.SetBlockAttribute[attributeName] then
- --print(' add function '..elementName..':'.. attributeName ..'(', (type(value) == 'table' and ('{'..table.concat(value,', ')..'}') or tostring(value)), ')')
-
-
- --mod.SetBlockAttribute[attributeName](region, value)
- code = code
- --.. "\n print('CacheFunc', ' applying', '|cFF00FFFF" .. attributeName .. "|r to', '|cFF0088FF"..elementName.."|r', cache['"..styleName.."']['"..elementName.."']['".. attributeName .."'])"
- .. "\n\n func['" .. attributeName .. "'](frame['"..elementName.."'],"..
- " cache['"..styleName.."']['"..elementName.."']['".. attributeName .."'])"
-
- --- Set any frame.blah variables used in Updates
- if block_vars[elementName .. attributeName] then
- --print('|cFF008800BVar|r', elementName..attributeName)
- for i, blockKey in ipairs(block_vars[elementName .. attributeName]) do
- --print(' assigning |cFF008800'..blockKey..'|r')
- frame[blockKey] = (type(value) == 'table') and value[i] or value
- end
- end
-
- end
- end
- code = code ..
- "\n else"..
- --"\n print('CacheFunc', ' |cFFFF4400missing', frame:GetName()..'."..elementName.."')"..
- "\n end"
- end
- code = code .. "\nend"
- local result = assert(loadstring(code))
- --print('storing style func', styleName, result())
- style_cache_func[styleName] = result()
-
- end
- style_cache_func[styleName](frame)
-
- --- Hardcoding the sizing vars for sanity
- local defaultWidth = mod.Conf.Wrapper.Width
- local normalSettings = mod.defaults.Style.Format
- frame.width = defaultWidth
- frame.statusWidth = defaultWidth - normalSettings.status.Indent
- frame.titleWidth = defaultWidth - normalSettings.title.Indent
- frame.attachmentHeight = frame.attachmentHeight or 0
-
- if frame.title then
- frame.titleHeight = frame.title and frame.title:GetStringHeight() or 0
- if frame.titleHeight > 0 then
- print('add spacing to', frame.titleHeight)
- frame.titleHeight = frame.titleHeight + (frame.title.spacing or 0)*2
- end
-
- frame.title.spacing = frame.title.spacing or frame.title:GetSpacing()
- frame.title:SetPoint('LEFT', frame, 'LEFT', normalSettings.title.Indent)
- frame.title:SetPoint('TOP', frame, 'TOP', 0, -frame.title.spacing)
- frame.title:SetWidth(frame.width)
- if frame.titlebg then
- frame.titlebg:SetHeight(frame.titleHeight)
- frame.titlebg:SetWidth(frame.width)
- end
- print(' titleHeight', frame.titleHeight, 'indent', normalSettings.title.Indent, 'spacing', frame.title.spacing)
- print(' -- text:', frame.title:GetSize())
- print(' -- bg:', frame.titlebg:GetSize())
-
- else
- frame.titleHeight = 0
- end
-
-
- if frame.status and (frame.status:GetText() or frame.attachmentHeight > 0) then
- frame.statusHeight = frame.status and frame.status:GetStringHeight() or 0
- if frame.statusHeight > 0 then
- frame.statusHeight = frame.statusHeight + (frame.status.spacing or 0)*2
- end
-
- frame.status.spacing = frame.status.spacing or frame.status:GetSpacing()
-
- frame.status:SetWidth(frame.width)
- frame.status:SetPoint('LEFT', frame, 'LEFT', normalSettings.status.Indent, 0)
- frame.status:SetPoint('TOP', frame.titlebg, 'BOTTOM', 0, 0)
- --frame.status:SetHeight(frame.statusHeight)
- if frame.statusbg then
-
- --frame.statusbg:SetHeight(frame.statusHeight + (frame.attachmentHeight or 0))
- --frame.statusbg:SetPoint('BOTTOM', frame, 'BOTTOM', 0, 0)
- frame.statusbg:SetWidth(frame.width)
- end
- print(' status tHeight', frame.statusHeight, 'indent', normalSettings.status.Indent, 'spacing', frame.status.spacing)
- else
- if frame.status then
- frame.status:Hide()
- end
- if frame.statusbg then
- frame.statusbg:Hide()
- end
- frame.statusHeight = 0
- end
-
- frame.height = frame.titleHeight + frame.statusHeight + (frame.attachmentHeight or 0)
- frame:SetSize(frame.width, frame.height)
- print(' |cFF0088FFsizing frame', frame.width, frame.height)
-end
-
---- Argument containers
-local o -- text flag
-local a1, a2, a3, a4, b1, b2, b3, b4 -- color1, color2
-local f1, f2, f3 -- font
-local w1, w2 -- size
-local p1, p2, p3, x, y -- path/point args
-mod.SetBlockAttribute = {}
-local sb = mod.SetBlockAttribute
-local print = B.print('Attribute')
-sb.Gradient = function(region, value)
- print('|cFF8844FFGradient|r', region:GetName(), unpack(value))
- o = value[1]
- a1, a2, a3, a4 = unpack(value.MinColor)
- b1, b2, b3, b4 = unpack(value.MaxColor)
- region:SetVertexColor(1,1,1)
- region:SetTexture(1,1,1,1)
- region:SetGradientAlpha(o, a1, a2, a3, a4, b1, b2, b3, b4)
-end
-
-sb.Background = function(region, value)
- print('|cFF0088FFBackground|r', unpack(value))
- region:SetVertexColor(1,1,1) -- reset
- region:SetTexture(unpack(value))
-end
-sb.BackgroundComplex = function (region, value)
- local left, tile, right = value.Left, value.Tile, value.Right
-
-end
-sb.Font = function(region, value)
- f1, f2, f3 = unpack(value)
- print('|cFFFFFF00Font|r', f1, f2, f3)
- region:SetFont(f1, f2, f3)
-end
-
-sb.Spacing = function(region, value)
- print('FontSpacing', region:GetName(), value)
- region:SetSpacing(value)
- region.spacing = value
-end
-
-sb.TextColor = function(region, value)
- a1, a2, a3, a4 = unpack(value)
- print('TextColor', a1, a2, a3, a4)
- region:SetTextColor(a1, a2, a3, a4)
-end
-sb.Texture = function(region, value)
-
- p1, a1, a2, a3, a4 = unpack(value)
- print('Texture', p1, a1, a2, a3, a4)
- region:SetTexture(p1)
- if a1 then
- region:SetTexCoord(a1, a2, a3, a4)
- end
-end
-sb.Width = function(region, value)
- w1 = value
- region:SetWidth(w1)
-end
-
-sb.Height = function(region, value)
- w2 = value
- region:SetHeight(w2)
-end
-sb.Size = function(region, value)
- w1, w2 = unpack(value)
- region:SetSize(w1, w2)
-end
-
diff -r 9b3fa734abff -r e837384ac363 ObjectiveTracker.xml
--- a/ObjectiveTracker.xml Sat Apr 09 07:32:45 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,475 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- self.toggle = true
- --self.drag = true
- Veneer.OnLoad(self)
-
-
-
-
- Veneer.OnDragStart(self)
-
-
- Veneer.OnDragStop(self)
- Veneer.ObjectiveTracker.UpdateActionButtons()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff -r 9b3fa734abff -r e837384ac363 ObjectiveTracker/ObjectiveCore.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ObjectiveTracker/ObjectiveCore.lua Sun Apr 10 04:35:32 2016 -0400
@@ -0,0 +1,451 @@
+--- ${PACKAGE_NAME}
+-- @file-author@
+-- @project-revision@ @project-hash@
+-- @file-revision@ @file-hash@
+-- Created: 3/26/2016 1:51 AM
+local B, _G = select(2,...).frame, _G
+local pairs, setmetatable, type, tostring, band, format = _G.pairs, _G.setmetatable, _G.type, _G.tostring, bit.band, string.format
+local ipairs, tinsert, hooksecurefunc = _G.ipairs, _G.tinsert, _G.hooksecurefunc
+local PlaySoundFile, IsQuestTask, SortQuestWatches, GetCurrentMapAreaID, GetZoneText, GetMinimapZoneText = PlaySoundFile, IsQuestTask, SortQuestWatches, GetCurrentMapAreaID, GetZoneText, GetMinimapZoneText
+local AddQuestWatch, SetSuperTrackedQuestID, GetNumQuestWatches, AUTO_QUEST_WATCH, MAX_WATCHABLE_QUESTS = AddQuestWatch, SetSuperTrackedQuestID, GetNumQuestWatches, AUTO_QUEST_WATCH, MAX_WATCHABLE_QUESTS
+local QuestPOIUpdateIcons, GetCVar, IsPlayerInMicroDungeon, WorldMapFrame, GetCVarBool, SetMapToCurrentZone = QuestPOIUpdateIcons, GetCVar, IsPlayerInMicroDungeon, WorldMapFrame, GetCVarBool, SetMapToCurrentZone
+local AddAutoQuestPopUp = AddAutoQuestPopUp
+local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
+local print = B.print('Objectives')
+local ObjectiveTrackerFrame, VeneerObjectiveScroll, CreateFrame = _G.ObjectiveTrackerFrame, _G.VeneerObjectiveScroll, _G.CreateFrame
+local Wrapper = _G.VeneerObjectiveWrapper
+local Scroller = VeneerObjectiveWrapper.scrollArea
+local Scroll = _G.VeneerObjectiveScroll
+
+--- Performance values
+--[[
+ self:RegisterEvent("QUEST_LOG_UPDATE");
+ self:RegisterEvent("TRACKED_ACHIEVEMENT_LIST_CHANGED");
+ self:RegisterEvent("QUEST_WATCH_LIST_CHANGED");
+ self:RegisterEvent("QUEST_AUTOCOMPLETE");
+ self:RegisterEvent("QUEST_ACCEPTED");
+ self:RegisterEvent("SUPER_TRACKED_QUEST_CHANGED");
+ self:RegisterEvent("SCENARIO_UPDATE");
+ self:RegisterEvent("SCENARIO_CRITERIA_UPDATE");
+ self:RegisterEvent("TRACKED_ACHIEVEMENT_UPDATE");
+ self:RegisterEvent("ZONE_CHANGED_NEW_AREA");
+ self:RegisterEvent("ZONE_CHANGED");
+ self:RegisterEvent("QUEST_POI_UPDATE");
+ self:RegisterEvent("VARIABLES_LOADED");
+ self:RegisterEvent("QUEST_TURNED_IN");
+ self:RegisterEvent("PLAYER_MONEY");
+ ]]
+
+
+--- These are the bitfields used by Blizzard_ObjectiveTracker to determine which segments get parsed.
+--- They are replicated here so that plugins can make use of any securehook args involving this info.
+local OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST -- 0x0100
+local OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP = OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP -- 0x0200
+local OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE = OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE -- 0x0400
+local OBJECTIVE_TRACKER_UPDATE_MODULE_SCENARIO = OBJECTIVE_TRACKER_UPDATE_MODULE_SCENARIO -- 0x0800
+local OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT = OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT -- 0x1000
+
+
+local OBJECTIVE_TRACKER_UPDATE_STATIC = OBJECTIVE_TRACKER_UPDATE_STATIC -- 0x0000
+local OBJECTIVE_TRACKER_UPDATE_ALL = OBJECTIVE_TRACKER_UPDATE_ALL -- 0xFFFF
+local OBJECTIVE_TRACKER_UPDATE_ID = OBJECTIVE_TRACKER_UPDATE_ID -- 0
+
+local OBJECTIVE_TRACKER_UPDATE_QUEST = OBJECTIVE_TRACKER_UPDATE_QUEST -- 0x0001
+local OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED = OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED -- 0x0002
+local OBJECTIVE_TRACKER_UPDATE_TASK_ADDED = OBJECTIVE_TRACKER_UPDATE_TASK_ADDED -- 0x0004
+local OBJECTIVE_TRACKER_UPDATE_SCENARIO = OBJECTIVE_TRACKER_UPDATE_SCENARIO -- 0x0008
+local OBJECTIVE_TRACKER_UPDATE_SCENARIO_NEW_STAGE = OBJECTIVE_TRACKER_UPDATE_SCENARIO_NEW_STAGE -- 0x0010
+local OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT = OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT -- 0x0020
+local OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT_ADDED = OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT_ADDED -- 0x0040
+local OBJECTIVE_TRACKER_UPDATE_SCENARIO_BONUS_DELAYED = OBJECTIVE_TRACKER_UPDATE_SCENARIO_BONUS_DELAYED -- 0x0080
+
+local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_ALL -- default
+--- Used to determine which trackers are listening for money events
+mod.watchMoneyReasons = 0
+
+--- Baseline defaults table; values defined in the files that they pertain to
+mod.defaults = {}
+
+--- Tracker display order
+mod.orderedNames = {'Bonus', 'AutoQuest', 'Quest', 'Cheevs'}
+
+--- ipairs() argument tables
+mod.orderedHandlers = setmetatable({}, {__mode = "k"})
+mod.orderedTrackers = setmetatable({}, {__mode = "k"})
+mod.indexedTrackers = setmetatable({}, {__mode = "k"})
+
+--- pairs() argument tables
+mod.namedTrackers = setmetatable({}, {__mode = "k"})
+
+local WRAPPER_ANCHOR_POINT = 'TOPRIGHT'
+local WRAPPER_OFFSET_X = 0
+local WRAPPER_OFFSET_Y = -200
+local WRAPPER_MAX_HEIGHT = 670
+local WRAPPER_WIDTH = 280
+local WRAPPER_HEADER_HEIGHT = 24
+
+mod.defaults.Wrapper = {
+ AnchorPoint = WRAPPER_ANCHOR_POINT,
+ OffsetX = WRAPPER_OFFSET_X,
+ OffsetY = WRAPPER_OFFSET_Y,
+ Height = WRAPPER_MAX_HEIGHT,
+ Width = WRAPPER_WIDTH,
+ HeaderHeight = WRAPPER_HEADER_HEIGHT,
+ TextSpacing = 3,
+ TitleSpacing = 3,
+}
+
+
+
+--- Tracker module definitions begin here; innards dealing with data retreival and output are defined further in
+mod.DefaultHandler = {
+ previousHeight = 0,
+
+ name = "temp",
+ displayName = "temp",
+ updateReasonModule = 0xFF00,
+ updateReasonEvent = 0x00FF,
+
+ numWatched = 0, --- number of entries being handled
+ numBlocks = 0, --- number of blocks created
+ actualBlocks = 0, --- number of blocks in use
+
+ freeBlocks = {}, --- block heap
+ usedBlocks = {},
+
+ Info = {}, -- find data by ID
+ BlockInfo = {}, -- find data by block ID
+ Watched = {}, -- find watchIndex by data ID
+ WatchInfo = {}, -- find data by watch index
+ WatchBlock = {}, -- find block by watch index
+}
+
+mod.AutoQuest = {
+ name = "AutoQuest",
+ displayName = "Notice",
+ updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST,
+ updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST +
+ OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED,
+}
+mod.Quest = {
+ name = "Quest",
+ displayName = "Quests",
+ updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST,
+ updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST +
+ OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED,
+}
+mod.Cheevs = {
+ name = "Cheevs",
+ displayName = "Achievements",
+ updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT,
+ updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT +
+ OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT_ADDED,
+}
+mod.Bonus = {
+ name = "Bonus",
+ displayName = "Bonus Objectives",
+ updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE,
+ updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST + OBJECTIVE_TRACKER_UPDATE_TASK_ADDED
+}
+
+local Tracker_string = function (self)
+ return self.name
+end
+local Tracker_call = function (self, reason)
+ self:Update(reason)
+end
+local Handler_Initialize = function (self, name, index)
+ print('Initializing |cFF00FFFF'..name..'|r module...')
+
+ local handler = setmetatable(mod[name] or {}, {
+ __tostring = Tracker_string,
+ __call = Tracker_call
+ })
+ if type(mod.orderedHandlers[index]) == 'table' then
+ return mod.orderedHandlers[index]
+ end
+
+ print('|cFFFFFF00Acquiring locals')
+ local preset = {}
+ for k, _ in pairs(handler) do
+ preset[k] = true
+ end
+
+
+ print('|cFFFF8800Inheriting')
+ for k, v in pairs(self) do
+ if not handler[k] then
+ if type(v) == 'table' then
+ -- assume all tables to be local data; don't inherit or ref
+ handler[k] = {}
+ else
+ handler[k] = self[k]
+ end
+ print('copying', k)
+ end
+ end
+ print('|cFFFF4400'..tostring(name)..'|r:')
+ for k, v in pairs(handler) do
+ print(format("%32s %8s %s", (preset[k] and '|cFFFFFFFF' or '|cFFFFFF00') .. k .. '|r', type(v), tostring(v)))
+ end
+
+ mod[name] = handler
+
+ local trackerName = 'Veneer'..name..'Tracker'
+ local handler = mod[name]
+ local frame = CreateFrame('Frame', trackerName, _G.VeneerObjectiveScroll, 'VeneerTrackerTemplate')
+ frame.title:SetText(handler.displayName)
+ mod.SetBlockStyle(frame, 'Tracker', 'Normal')
+ handler.frame = frame
+ handler.trackerName = trackerName
+ handler.lines = {}
+ mod.orderedTrackers[index] = frame
+ mod.namedTrackers[name] = frame
+ mod.indexedTrackers[handler] = frame
+ print('|cFFFF0088' .. trackerName .. '|r created for |cFF00FFFF' .. handler.displayName .. '|r module')
+
+ mod.orderedHandlers[index] = handler
+ return true
+end
+
+local Event = {}
+Event.QUEST_LOG_UPDATE = function()
+ return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST + OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE
+end
+Event.QUEST_ACCEPTED = function(questLogIndex, questID)
+ if ( IsQuestTask(questID) ) then
+ return OBJECTIVE_TRACKER_UPDATE_TASK_ADDED, questID
+ else
+ if ( AUTO_QUEST_WATCH == "1" and GetNumQuestWatches() < MAX_WATCHABLE_QUESTS ) then
+ AddQuestWatch(questLogIndex);
+ SetSuperTrackedQuestID(questID);
+ end
+ return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST
+ end
+end
+
+Event.QUEST_WATCH_LIST_CHANGED = function(questID, added)
+ if ( added ) then
+ if ( not IsQuestTask(questID) ) then
+ return OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, questID, added
+ end
+ else
+ return OBJECTIVE_TRACKER_UPDATE_QUEST, questID, added
+ end
+end
+
+Event.QUEST_POI_UPDATE = function()
+ QuestPOIUpdateIcons();
+ if ( GetCVar("trackQuestSorting") == "proximity" ) then
+ SortQuestWatches();
+ end
+ return OBJECTIVE_TRACKER_UPDATE_ALL
+end
+Event.SUPER_TRACKED_QUEST_CHANGED = function()
+ return OBJECTIVE_TRACKER_UPDATE_QUEST
+end
+Event.ZONE_CHANGED = function()
+
+ local inMicroDungeon = IsPlayerInMicroDungeon();
+ if ( inMicroDungeon ~= mod.inMicroDungeon ) then
+ if ( not WorldMapFrame:IsShown() and GetCVarBool("questPOI") ) then
+ SetMapToCurrentZone(); -- update the zone to get the right POI numbers for the tracker
+ end
+ --SortQuestWatches();
+ mod.inMicroDungeon = inMicroDungeon;
+ end
+end
+Event.QUEST_AUTOCOMPLETE = function(questId)
+ AddAutoQuestPopUp(questId, "COMPLETE");
+ return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST + OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP
+end
+Event.SCENARIO_CRITERIA_UPDATE = function()
+ return OBJECTIVE_TRACKER_UPDATE_SCENARIO
+end
+Event.SCENARIO_UPDATE = function(newStage)
+ if ( newStage ) then
+ return OBJECTIVE_TRACKER_UPDATE_SCENARIO_NEW_STAGE
+ else
+ return OBJECTIVE_TRACKER_UPDATE_SCENARIO
+ end
+end
+Event.TRACKED_ACHIEVEMENT_UPDATE = function()
+ return OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT
+end
+Event.TRACKED_ACHIEVEMENT_LIST_CHANGED = function(achievementID, added)
+ if ( added ) then
+ return OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT_ADDED, achievementID
+ else
+ return OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT
+ end
+end
+Event.ZONE_CHANGED_NEW_AREA = function ()
+ if ( not WorldMapFrame:IsShown() and GetCVarBool("questPOI") ) then
+ SetMapToCurrentZone(); -- update the zone to get the right POI numbers for the tracker
+ end
+ SortQuestWatches();
+ mod.currentZoneArea = GetCurrentMapAreaID()
+ print('Updating zone ID to', mod.currentZoneArea, '=', GetZoneText(), GetMinimapZoneText())
+
+
+ return OBJECTIVE_TRACKER_UPDATE_TASK_ADDED
+end
+
+
+Event.PLAYER_MONEY = function()
+ if mod.watchMoneyReasons > 0 then
+ return mod.watchMoneyReasons
+ end
+end
+Event.CRITERIA_COMPLETE = function()
+ return OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE
+end
+Event.QUEST_TURN_IN = function(questID, xp, money)
+ if ( IsQuestTask(questID) ) then
+ mod.Bonus:OnTurnIn(questID, xp, money)
+ print('updating bonus modules (code', OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE, ',', questID, xp, money)
+ return OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE, questID, xp, money
+ else
+ return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST, questID, xp, money
+ end
+end
+mod.Event = Event
+
+--- Done once per ui load
+local BlizzHooks = {
+ ['AddQuestWatch'] = 'AddQuestWatch',
+ ['RemoveQuestWatch'] = 'RemoveQuestWatch',
+ ['AbandonQuest'] = 'AbandonQuest',
+ ['AcknowledgeAutoAcceptQuest'] = 'AcknowledgeAutoAcceptQuest',
+ ['AddAutoQuestPopUp'] = 'AddAutoQuestPopUp',
+ ['RemoveAutoQuestPopUp'] = 'RemoveAutoQuestPopUp',
+ ['AddTrackedAchievement'] = 'AddTrackedAchievement',
+ ['RemoveTrackedAchievement'] = 'RemoveTrackedAchievement',
+ ['SetSuperTrackedQuestID'] = 'SetSuperTrackedQuestID'
+}
+local VeneerData
+
+mod.SetWatchMoney = function(watchMoney, reason)
+ if watchMoney then
+ if band(mod.watchMoneyReasons, reason) == 0 then
+ mod.watchMoneyReasons = mod.watchMoneyReasons + reason;
+ end
+ else
+ if band(mod.watchMoneyReasons, reason) > 0 then
+ mod.watchMoneyReasons = mod.watchMoneyReasons - reason;
+ end
+ end
+end
+mod.animateReasons = 0
+mod.SetAnimate = function(animate, reason)
+ if animate then
+ if band(mod.animateReasons, reason) == 0 then
+ mod.animateReasons = mod.animateReasons + reason
+ end
+ else
+ if band(mod.animateReasons, reason) > 0 then
+ mod.animateReasons = mod.animateReasons - reason
+ end
+ end
+end
+
+
+function mod:OnInitialize()
+ local c = mod.Conf.Wrapper
+ VeneerData = _G.VeneerData
+ VeneerData.CallLog = VeneerData.CallLog or {}
+ if not mod.isHooked then
+ mod.isHooked = true
+ for blizzFunc, veneerFunc in pairs(BlizzHooks) do
+ if mod[veneerFunc] then
+ hooksecurefunc(blizzFunc, mod[veneerFunc])
+ else
+ hooksecurefunc(blizzFunc, function(...)
+ print('|cFFFF0088securehook('..tostring(blizzFunc)..')|r args:', ...)
+ tinsert(VeneerData.CallLog, {blizzFunc, ...})
+ end)
+ end
+ end
+ end
+
+ mod.Conf.TasksLog = mod.Conf.TasksLog or {}
+
+ Scroller:SetScrollChild(Scroll)
+ Scroller:SetWidth(c.Width)
+ Scroll:SetWidth(c.Width)
+ Scroll:ClearAllPoints()
+ Scroll:SetPoint('TOP', Scroller, 'TOP')
+ ObjectiveTrackerFrame:UnregisterAllEvents()
+ ObjectiveTrackerFrame:Hide()
+
+ if B.Conf.FrameState[Wrapper:GetName()] == 0 then
+ Scroller:Hide()
+ end
+end
+
+local Play = function(file) if Devian and Devian.InWorkspace() then PlaySoundFile(file) end end
+
+function mod:OnEvent (event, ...)
+ local isHandled
+ print('OnEvent(|cFF00FF00'.. event ..'|r):', ...)
+ local reason, arg1, arg2, arg3
+ if Event[event] then
+ if type(Event[event]) == 'function' then
+ Play([[Interface\Addons\SharedMedia_MyMedia\sound\Info.ogg]])
+ reason, arg1, arg2, arg3 = Event[event](...)
+ elseif type(Event[event]) == 'table' then
+ Play([[Interface\Addons\SharedMedia_MyMedia\sound\Link.ogg]])
+ for i, action in ipairs(Event[event]) do
+ if type(action) == 'function' then
+ reason, arg1, arg2, arg3 = action(event, ...)
+ else
+ reason = action
+ end
+
+ if reason then
+ mod:Update(reason, arg1, arg2, arg3)
+ end
+ end
+ else
+ Play([[Interface\Addons\SharedMedia_MyMedia\sound\Heart.ogg]])
+ reason = Event[event]
+ end
+ else
+ Play([[Interface\Addons\SharedMedia_MyMedia\sound\Quack.ogg]])
+ end
+ if reason then
+ mod:Update(reason, arg1, arg2, arg3)
+ else
+ print('no reason value returned')
+ Play([[Interface\Addons\SharedMedia_MyMedia\sound\Quack.ogg]])
+ end
+end
+
+--- Done any time the the minimize button is toggled up
+function mod:OnEnable()
+ for id, name in ipairs(mod.orderedNames) do
+ if not mod.orderedHandlers[id] then
+ Handler_Initialize(mod.DefaultHandler, name, id)
+ end
+ end
+
+ for event, action in pairs(Event) do
+ print('|cFFFF0088listen to', event, 'for action|r', tostring(action))
+ Wrapper:RegisterEvent(event)
+ end
+
+ Wrapper:SetScript('OnEvent', mod.OnEvent)
+ local c = mod.Conf.Wrapper
+ Wrapper:SetWidth(c.Width)
+
+ mod.InitializeWidgets()
+ mod:Update()
+
+
+end
+
+function mod:OnDisable()
+ Wrapper:UnregisterAllEvents()
+end
+
+
diff -r 9b3fa734abff -r e837384ac363 ObjectiveTracker/ObjectiveEvents.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ObjectiveTracker/ObjectiveEvents.lua Sun Apr 10 04:35:32 2016 -0400
@@ -0,0 +1,76 @@
+--- ${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('Objectives')
+
+--------------------------------------------------------------------
+--- Events that are handled by Blizzard_ObjectiveTracker
+--------------------------------------------------------------------
+
+-------------------------------------------------------------------
+--- Function hooks for BlizzUI compatibility
+-------------------------------------------------------------------
+mod.AddQuestWatch = function(questID)
+ mod:Update(0x00000003)
+end
+
+local Quest = mod.Quest
+mod.RemoveQuestWatch = function(questIndex, ...)
+ print('|cFFFF8800RemoveQuestWatch', questIndex, ...)
+
+ local info = mod.Quest.LogInfo[questIndex]
+
+ -- remove quest refs
+ local block = Quest.QuestBlock[info.questID]
+ Quest.QuestBlock[info.questID] = nil
+ Quest.LogBlock[questIndex] = nil
+
+ -- remove if they still match
+ if Quest.WatchInfo[info.watchIndex] == info then
+ print('cleaning dead WatchInfo entry')
+ Quest.WatchInfo[info.watchIndex] = nil
+ end
+
+ mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST)
+end
+
+mod.AddTrackedAchievement = function(cheevID)
+ mod.CleanWidgets()
+ mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT)
+end
+
+
+mod.RemoveTrackedAchievement = function(cheevID)
+ print('|cFFFF8800UntrackAchievement', cheevID)
+ mod.CleanWidgets()
+ mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT)
+end
+
+mod.AcceptQuest = function()
+ mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST_ADDED)
+end
+
+mod.AbandonQuest = function()
+ QuestPOIUpdateIcons()
+ mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST)
+end
+mod.TurnInQuest = function()
+ QuestPOIUpdateIcons()
+ mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST)
+end
+mod.AddAutoQuestPopUp = function(...)
+ mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP)
+end
+mod.RemoveAutoQuestPopUp = function(...)
+ mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP)
+end
+
+
+
+mod.SetSuperTrackedQuestID = function(questID)
+ --mod:Update()
+end
\ No newline at end of file
diff -r 9b3fa734abff -r e837384ac363 ObjectiveTracker/ObjectiveFrame.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ObjectiveTracker/ObjectiveFrame.lua Sun Apr 10 04:35:32 2016 -0400
@@ -0,0 +1,861 @@
+--- ${PACKAGE_NAME}
+-- @file-author@
+-- @project-revision@ @project-hash@
+-- @file-revision@ @file-hash@
+-- Created: 3/30/2016 12:49 AM
+local B = select(2,...).frame
+local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
+local _G, ipairs, max, min, unpack, floor, pairs, tostring, type, band = _G, ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band
+local IsResting, UnitXP, UnitXPMax, GetXPExhaustion = IsResting, UnitXP, UnitXPMax, GetXPExhaustion
+local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent
+local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText
+local PERCENTAGE_STRING, GetQuestProgressBarPercent = PERCENTAGE_STRING, GetQuestProgressBarPercent
+local Default, AutoQuest, Quest, Bonus, Cheevs = T.DefaultHandler, T.AutoQuest, T.Quest, T.Bonus, T.Cheevs
+local InCombatLockdown, format, lshift, CreateFrame = InCombatLockdown, format, bit.lshift, CreateFrame
+local print = B.print('Tracker')
+local unitLevel = 1
+local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_REASON
+local debug = false
+--------------------------------------------------------------------
+--- Global frame layout
+--------------------------------------------------------------------
+
+--- Upvalues
+local Wrapper = _G.VeneerObjectiveWrapper
+local Scroller = Wrapper.scrollArea
+local Scroll = _G.VeneerObjectiveScroll
+local orderedHandlers = T.orderedHandlers
+local orderedNames = T.orderedNames
+
+--- Temp values set during updates
+local wrapperWidth, wrapperHeight
+local scrollWidth, scrollHeight
+local previousBlock
+local currentBlock
+--- todo: source these from config
+local itemButtonSize, itemButtonSpacing = 36, 1
+local titleFont, textFont = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]]
+local titleSize, textSize = 16, 16
+local titlebg, textbg = {'HORIZONTAL', 1, 0, .7, .25, 1, 0, .7, .125}, {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0 }
+local titlebg_daily, textbg_daily = {'HORIZONTAL', 0, .7, 1, .25, 0, 1, .7, .125}, {'HORIZONTAL', 0, .7, 1, .1, 0, 1, .7, .075 }
+local textbg_account,titlebg_account = {'HORIZONTAL', 0, .45, 1, .25, 0, .45, 1, .125}, {'HORIZONTAL', 0, .45, 1, 0.4, 0, .41, 1, .085 }
+local selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225}
+local titleOutline, textOutline = "OUTLINE", "OUTLINE"
+local titleSpacing, textSpacing, blockSpacing = 3, 3, 1
+local titleIndent, textIndent,selectionIndent = 2, 5, 50
+local wrapperMaxWidth, wrapperMaxHeight = 270, 490 -- these are the hard bounds, actual *Height variables are changed
+local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE'
+local headerFont, headerSize, headerHeight = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 18, 24
+local headerOutline, headerColor, headerSpacing = 'OUTLINE', {1,1,1,1}, 2
+local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0 }
+local rewardSize = 32
+local oprint = B.print('Objectives')
+local bprint = B.print('Block')
+local tprint = B.print('Tracker')
+local lprint = B.print('Line')
+
+local currentPosition, anchorFrame, anchorPoint
+
+T.colors ={
+ default = {
+ titlebg = {'HORIZONTAL', 1, 0, .7, .25, 1, 0, .7, .125},
+ textbg = {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0 },
+ selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225},
+ },
+ daily = {
+ titlebg = {'HORIZONTAL', 0, .7, 1, .25, 0, 1, .7, .125},
+ textbg = {'HORIZONTAL', 0, .7, 1, .1, 0, 1, .7, .075 },
+ },
+ weekly = {
+ titlebg = {'HORIZONTAL', 0, .35, .7, .25, 0, .35, .7, .125},
+ textbg = {'HORIZONTAL', 0, .35, .7, .1, 0, .35, .7, .075 },
+ },
+ account = {
+ titlebg = {'HORIZONTAL', .1, .1, .1, .25, .1, .1, .1, .125},
+ textbg = {'HORIZONTAL', .1, .1, .1, 0.4, .1, .1, .1, .085 },
+ },
+ -- alliance
+ faction_1 = {
+ titlebg = {'HORIZONTAL', .2, .4, 1, 0.4, .2, .4, 1, .085 },
+ textbg = {'HORIZONTAL', .2, .4, 1, 0.4, .2, .4, 1, .085 },
+ },
+ -- horde
+ faction_2 = {
+ titlebg = {'HORIZONTAL', .6, 0, 0.4, 0.4, .6, 0, 0.4, .085 },
+ textbg = {'HORIZONTAL', .6, 0, 0.4, 0.4, .6, 0, 0.4, .085 },
+ }
+}
+
+T.AddBlock = function(handler, block)
+ local print = bprint
+end
+
+--- Used as an iterator of sorts for cascaded tag icon placements (the daily/faction/account icons)
+T.AddTag = function (block, tagName, tagPoint, tagAnchor, tagRelative)
+ local print = bprint
+ local tag = block[tagName]
+ if block.info[tagName] and tag then
+ tag:SetTexCoord(unpack(block.info[tagName]))
+ tag:Show()
+ tag:SetPoint(tagPoint, tagAnchor, tagRelative, 0, 0)
+ tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', tag, 'TOPLEFT'
+ else
+ block[tagName]:Hide()
+ end
+ return tagPoint, tagAnchor, tagRelative
+end
+
+--- Adds the given line to the current content and advances the anchor pointer to that new line for the following call.
+T.AddLine = function(block, line)
+ local print = lprint
+ line:ClearAllPoints()
+ line:SetPoint('LEFT', block, 'LEFT', 0, 0)
+ line:SetPoint('TOP', block.endPoint, 'BOTTOM', 0, -textSpacing)
+ line:SetPoint('RIGHT', block, 'RIGHT', 0, 0)
+ line:SetHeight(line.height)
+ line:Show()
+
+ block.endIndex = line.index
+ block.numLines = block.numLines + 1
+ block.attachmentHeight = block.attachmentHeight + (line.height + textSpacing)
+ print(' |cFF0088FFsetting line #'..block.numLines..' for|r', block.info.title, "\n |cFF0088FFsize:|r", line.height,
+ "|cFF0088FFpoint:|r", line:GetPoint(1), "|cFF0088FFwidget:|r", (line.widget and 'Y' or 'N'))
+ block.endPoint = line
+end
+
+--- Creates or retrieves a complete line data object
+T.GetLine = function(handler, block, lineIndex)
+ local print = lprint
+ local blockIndex = block.index
+ if not block.lines then
+ block.lines = {}
+ end
+ local lines = block.lines
+ if not lines[lineIndex] then
+ print(' |cFF00FF88created line #'..lineIndex..' from for '..handler.name..' block #'..blockIndex)
+ lines[lineIndex] = CreateFrame('Frame', 'Vn'..handler.name .. blockIndex..'ObjectiveLine'..lineIndex, block, 'VeneerTrackerObjective')
+ local line = lines[lineIndex]
+ line.index = lineIndex
+ line.height = 0
+ line.status:SetSpacing(textSpacing)
+ line.status:SetPoint('LEFT', line, 'LEFT', textIndent, 0)
+ B.SetConfigLayers(line)
+
+ if lines[lineIndex+1] then
+ lines[lineIndex+1]:ClearAllPoints()
+ end
+
+ if debug then
+ for _, region in ipairs(lines[lineIndex].debug) do
+ region:Show()
+ end
+ end
+
+ end
+ return lines[lineIndex]
+end
+
+--- Creates or retrieves a complete block frame object
+T.GetBlock = function(handler, blockIndex)
+ local print = bprint
+ local block = handler.usedBlocks[blockIndex]
+
+ if not handler.usedBlocks[blockIndex] then
+ if #handler.freeBlocks >= 1 then
+ block = handler.freeBlocks[#handler.freeBlocks]
+ handler.freeBlocks[#handler.freeBlocks] = nil
+ else
+ block = CreateFrame('Frame', 'Veneer'..tostring(handler)..'Block'..blockIndex, Scroll, 'VeneerTrackerBlock')
+
+
+
+ local c = T.Conf.Wrapper
+ block.index = blockIndex
+ block.SetStyle = T.SetBlockStyle
+ block:SetWidth(c.Width)
+
+ block.title:SetSpacing(c.TitleSpacing)
+ block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing)
+
+ block.titlebg:SetTexture(1,1,1,1)
+ block.titlebg:SetGradientAlpha(unpack(colors.default.titlebg))
+ block.titlebg:SetPoint('TOP', block, 'TOP', 0, 0)
+ block.titlebg:SetPoint('BOTTOM', block.title, 'BOTTOM', 0, -titleSpacing)
+
+ block.status:SetSpacing(c.TextSpacing)
+ block.status:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, -textSpacing)
+ block.status:SetPoint('LEFT', block.titlebg, 'LEFT', textIndent, 0)
+
+ block.statusbg:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, 0)
+ block.statusbg:SetPoint('BOTTOM', block, 'BOTTOM', 0, 0)
+ block.statusbg:SetTexture(1,1,1,1)
+ block.statusbg:SetGradientAlpha(unpack(colors.default.textbg))
+
+ block.SelectionOverlay:SetGradientAlpha(unpack(colors.default.selectionbg))
+ block.SelectionOverlay:SetPoint('TOPLEFT', selectionIndent, 0)
+ block.SelectionOverlay:SetPoint('BOTTOMRIGHT')
+
+ block.icon:SetSize(rewardSize, rewardSize)
+ block.icon:SetPoint('TOPRIGHT', block, 'TOPRIGHT', -2, -2)
+
+
+ --- methods for event handlers
+
+ block.Select = handler.Select
+ block.Open = handler.Open
+ block.Remove = handler.Remove
+ block.Link = handler.Link
+ block:SetScript('OnMouseUp', handler.OnMouseUp)
+ block:SetScript('OnMouseDown', handler.OnMouseDown)
+ block.attachmentHeight = 0
+ block:ClearAllPoints()
+
+ B.SetConfigLayers(block)
+
+ if debug then
+ for _, region in ipairs(block.debug) do
+ region:Show()
+ end
+ end
+ end
+ handler.usedBlocks[blockIndex] = block
+ end
+ return handler.usedBlocks[blockIndex]
+end
+
+--- Module-specific data wrangling that has to happen during UpdateBlock()
+ -- Most of this is sculpting objectives data into a parsible list.
+ -- Some of it is additional block manipulation that doesn't quite fit with the other modules..
+Bonus.UpdateObjectives = function(handler, block)
+ Default.UpdateObjectives(handler, block)
+end
+
+
+--- They are not exactly quests, but the aliases used to signal that a quest was pushed into your log by the environment.
+ -- Once accepted they never appear again unless the quest is dropped (daily reset/abandon quest)
+local CLICK_TO_COMPLETE = 'Click to Complete'
+local CLICK_TO_ACCEPT = 'Click to Accept'
+AutoQuest.UpdateObjectives = function(handler, block)
+ local print = lprint
+ if block.info.type == 'OFFER' then
+ block.status:SetText(CLICK_TO_ACCEPT)
+ end
+end
+
+
+
+
+--- Does the main iterations for populating block content.
+ -- Hooked by corresponding handler functions where additional details need to be sorted.
+Default.UpdateObjectives = function(handler, block)
+ local print = lprint
+ local info = block.info
+ print(' |cFF00FF00default objectives routine', block:GetName())
+
+ -- reset the starting positions
+ block.attachmentHeight = 0
+ block.endPoint = block.titlebg
+ local completionScore, completionMax = 0, 0
+ local displayObjectiveHeader = false
+
+ if info.description and #info.description >= 1 then
+ print(' |cFF00FFFF header line:|r', info.description)
+ block.status:SetText(info.description)
+ displayObjectiveHeader = true
+ end
+
+ --- The first line is going to be used no matter what, so it is hard-pulled.
+ -- It also ensures that we're in the right position for cleaning up the leftover lines.
+ local lineIndex = 1
+ local line = T.GetLine(handler, block, lineIndex)
+
+ block.numLines = 0
+ block.attachmentHeight = 0
+ if info.isComplete then
+ print(' overriding line #1 for a completed block')
+ if line.widget then
+ line.widget:Hide()
+ end
+ line.status:SetText(info.completionText)
+ line.height = floor(line.status:GetHeight()+.5) + textSpacing
+ T.AddLine(block, line)
+ else
+ if info.objectives then
+ for i, data in ipairs(info.objectives) do
+ print(' |cFF88FF00#', i, data.type, data.text)
+ displayObjectiveHeader = true
+ line.height = 0
+ handler:UpdateLine(block, line, data)
+
+ -- For progressbar and timer lines, status text may be used as the title heading
+ if line.widget then
+ local widgetPosition = 0
+ --- WIDGET POSITION -------------------------------------------------
+ line.widget:SetPoint('TOP', line, 'TOP', 0, -widgetPosition)
+ line.widget:Show()
+ line.height = line.widget:GetHeight() + textSpacing
+ ---------------------------------------------------------------------
+ if line.displayText and #line.displayText >= 1 then
+ widgetPosition = line.status:GetHeight() + textSpacing
+ line.status:SetText(line.displayText)
+ line.height = floor(line.status:GetStringHeight()+.5) + textSpacing + line.widget.height
+ print(' - progressbar has text, adjust')
+ end
+ elseif line.displayText then
+ line.status:SetText(line.displayText)
+ line.height = floor(line.status:GetStringHeight()+.5)
+ end
+
+ T.AddLine(block, line)
+
+ --print(' sz', line:GetWidth(), line:GetHeight(), 'pt', line:GetPoint(1))
+ --print(' |cFF44BBFF#', i, 'anchoring line, size:', line.height, 'current endpoint:', line.statusbg)
+
+ lineIndex = lineIndex + 1
+ line = T.GetLine(handler, block, lineIndex)
+ end
+ end
+ end
+
+ while (block.lines[lineIndex+1]) do
+ print(' - hide |cFFFF0088'..lineIndex..'|r')
+ block.lines[lineIndex]:Hide()
+ lineIndex = lineIndex +1
+ end
+
+
+
+ if lineIndex > 0 then
+ block.attachmentHeight = block.attachmentHeight + textSpacing * 2
+ print(' |cFF00FF00attachment:', block.attachmentHeight)
+ end
+
+
+ --[[
+ local lines = handler.lines[block.index]
+ if lines and #lines > block.numLines then
+ print(' |cFFFF008' .. (#lines - block.numLines) .. ' extra lines to hide.')
+ for i = block.numLines + 1, #lines do
+ print(' hide', i, lines[i]:GetName())
+ lines[i]:Hide()
+ end
+ end
+ ]]
+
+
+ if debug then
+ for i, region in ipairs(block.debug) do
+ for j = 1, region:GetNumPoints() do
+ local _, target = region:GetPoint(j)
+ if target:IsVisible() then
+ region:Hide()
+ else
+ region:Show()
+ end
+ end
+ end
+ end
+
+ block.completionScore = completionScore / completionMax
+end
+
+
+--- Module-specific display variables
+-- * height - height of whatever display widget is involved in conveying the task
+-- * money - boolean that determines listening for money events or not
+-- * progress - number ranging 0 to 2 indicating none/partial/full completion respectively
+
+
+
+Bonus.UpdateLine = function(handler, block, line, data)
+ local info = block.info
+ local print = lprint
+
+
+ line.displayColor = 'FFFFFF'
+ line.displayText = data.text
+ line.progress = 0
+ print(' ', data.objectiveIndex,'|cFFFF0088-|r', data.objectiveType, data.text)
+ if data.objectiveType == 'progressbar' then
+ line.widgetType = 'ProgressBar'
+ print(' |cFFFF44DDpercent='..tostring(GetQuestProgressBarPercent(info.questID)))
+ data.value = GetQuestProgressBarPercent(info.questID) or 0
+ data.maxValue = 100
+ if data.value >= data.maxValue then
+ line.progress = 1
+ elseif data.value > 0 then
+ line.progress = 2
+ end
+ line.format = PERCENTAGE_STRING
+ local widget = T.SetWidget(line, data, 'ProgressBar', info.questID..'-'..data.objectiveIndex)
+ print(' |cFFFF0022** text:|r', data.text, '|cFFFF0022value:|r', data.value, '|cFFFF0022max:|r', data.maxValue)
+ widget:SetPoint('TOP', line, 'TOP', 0, 0)
+
+ line.widget = widget
+ line.height = widget.height
+ else
+ line.displayText = data.text
+ line.widget = nil
+ end
+ return line
+end
+
+Cheevs.UpdateLine = function(handler, block, line, data)
+ local print = B.print('CheevsLine')
+ line.progress = 0
+ print(' ', data.objectiveIndex,'|cFF0088FF-|r', data.objectiveType, data.text)
+ if data.flags then
+ if band(data.flags, 0x00000001) > 0 then
+ line.format = "%d/%d"
+ line.widget = T.SetWidget(line, data, 'ProgressBar', data.criteriaID)
+ line.height = line.widget.height
+ elseif band(data.flags, 0x00000002) then
+ line.widget = nil
+ else
+ line.widget = nil
+ line.displayColor = 'FFFFFF'
+ line.displayText = line.text
+
+ end
+ else
+
+ line.displayText = data.text
+ end
+ print('line.type =', data.type)
+ print(' ** qtyStr:', data.quantityString, 'qty:', data.quantity, 'assetID:', data.assetID)
+end
+Default.UpdateLine = function(block, line)
+ if line.finished then
+ line.progress = 2
+ elseif line.quantity > 0 then
+ line.progress = 1
+ else
+ line.progress = 0
+ end
+ return line
+end
+
+
+T.Quest.numButtons = 0
+local usedButtons = T.Quest.itemButtons
+local freeButtons = T.Quest.freeButtons
+--[=[
+T.UpdateWrapper = function(reason)
+ print('|cFF00FFFFUpdateWrapper:|r', reason)
+ unitLevel = UnitLevel('player')
+ wrapperWidth = T.Conf.Wrapper.WrapperWidth
+ scrollWidth = T.Conf.Wrapper.WrapperWidth
+ local wrapperBlocks = 0
+ -- Update scroll child vertical size
+ scrollHeight = 0
+ for i, handler in ipairs(orderedHandlers) do
+ T.UpdateTracker(handler)
+ local frame = handler.frame
+ if handler.actualBlocks >= 1 then
+ frame:SetParent(Scroll)
+ frame:SetPoint('TOPLEFT', Scroll, 'TOPLEFT', 0, - scrollHeight)
+ frame:SetSize(wrapperWidth, frame.height)
+ print('|cFF00FFFF'..frame:GetName()..'|r h:|cFF00FF00', frame.height, '|r y:|cFF00FF00', -scrollHeight)
+ scrollHeight = scrollHeight + frame.height
+ frame:Show()
+ else
+ frame:Hide()
+ end
+ wrapperBlocks = wrapperBlocks + handler.actualBlocks
+ end
+ print('final scrollHeight:', scrollHeight)
+
+
+
+ -- Update frame dimensions
+ if scrollHeight > wrapperMaxHeight then
+ print(' is larger than', wrapperMaxHeight)
+ wrapperHeight = wrapperMaxHeight
+ else
+ wrapperHeight = scrollHeight
+ B.Conf.ObjectiveScroll = 0
+ end
+ scrollWidth = floor(scrollWidth+.5)
+ scrollHeight = floor(scrollHeight+.5)
+ wrapperWidth = floor(wrapperWidth+.5)
+ wrapperHeight = floor(wrapperHeight+.5)
+ headerHeight = floor(headerHeight+.5)
+
+ if wrapperBlocks >= 1 then
+ for i, region in ipairs(Wrapper.headerComplex) do
+ region:Show()
+ end
+ else
+ for i, region in ipairs(Wrapper.headerComplex) do
+ region:Hide()
+ end
+ return
+ end
+ --[[wrapperHeight = scrollHeight
+
+ print('|cFFFFFF00params:|r scroller:', scrollWidth .. ',' .. scrollHeight, 'scroll:', scrollWidth .. ',' .. scrollHeight,
+ 'wrapper:', wrapperWidth .. ',' .. wrapperHeight,
+ 'header:', headerHeight)]]
+
+ --Scroller:SetSize(wrapperWidth, wrapperHeight)
+ Scroller:SetPoint('TOPLEFT', Wrapper, 'TOPLEFT', 0, 0)
+ Scroller:SetPoint('BOTTOMRIGHT', Wrapper, 'BOTTOMRIGHT')
+
+
+ Scroll:SetSize(scrollWidth, scrollHeight)
+ Scroll:SetPoint('TOPLEFT', Scroller, 'TOPLEFT', 0, B.Conf.ObjectiveScroll or 0)
+ Scroll:SetPoint('RIGHT', Scroller, 'RIGHT')
+
+ --Scroller:UpdateScrollChildRect()
+ Wrapper:SetSize(wrapperWidth, wrapperHeight)
+
+ --[[ update action buttons
+ print('|cFF00FF00'..Scroll:GetName()..'|r:', Scroll:GetWidth(), Scroll:GetHeight(),
+ '|cFF00FF00'..Scroller:GetName()..'|r:', Scroller:GetWidth(), Scroller:GetHeight(),
+ '|cFF00FF00'..Wrapper:GetName()..'|r:', Wrapper:GetWidth(), Wrapper:GetHeight(),
+ '|cFF0088FFvScrollRange|r:', floor(Scroller:GetVerticalScrollRange()+.5)
+ )
+ --]]
+ T.UpdateActionButtons()
+
+end
+--]=]
+
+
+Default.Update = function (self, reason, ...)
+ local print = tprint
+ local tracker = self.frame
+ local blockIndex = 0
+ local trackerHeight = floor(tracker.titlebg:GetHeight()+.5)
+
+ self.currentAnchor = tracker.titlebg
+ local numWatched = self:GetNumWatched()
+ local numBlocks = self.numBlocks
+ local actualBlocks = 0
+ for watchIndex = 1, 25 do
+ blockIndex = blockIndex + 1
+ if watchIndex <= numWatched then
+ local info = self:GetInfo(watchIndex)
+ if info then
+ local currentBlock = self:UpdateBlock(blockIndex, info)
+ currentBlock:SetPoint('TOPLEFT', self.currentAnchor, 'BOTTOMLEFT', 0, 0)
+ currentBlock:SetPoint('RIGHT', tracker,'RIGHT', 0, 0)
+ self.currentAnchor = currentBlock
+ print(' |cFFFFFF00'..watchIndex..'|r', '|cFF00FF00'..currentBlock:GetName()..'|r', currentBlock.height, trackerHeight)
+ trackerHeight = trackerHeight + currentBlock.height
+ numBlocks = max(numBlocks, watchIndex)
+ actualBlocks = actualBlocks + 1
+ else
+ print(' |cFFFF0000bad GetInfo data for #'..watchIndex)
+ end
+
+ elseif watchIndex <= numBlocks then
+ local used = self.usedBlocks
+ local free = self.freeBlocks
+ print('clean up dead quest block')
+ if used[blockIndex] then
+ used[blockIndex]:Hide()
+ used[blockIndex]:ClearAllPoints()
+ free[#free+1]= used[blockIndex]
+ used[blockIndex] = nil
+ end
+ else
+ print(' |cFFFF9900END|r @', blockIndex)
+ break -- done with quest stuff
+ end
+ end
+ self.numWatched = numWatched
+ self.numBlocks = numBlocks
+ self.actualBlocks = actualBlocks
+
+ tracker.previousHeight = tracker.height
+ if numBlocks >= 1 then
+ previousBlock = nil
+
+ tracker.height = trackerHeight
+ tracker:SetHeight(tracker.height)
+ tracker:Show()
+
+
+ else
+ tracker.height = 0
+ tracker:Hide()
+ end
+
+ return tracker.numWatched, tracker.numAll
+end
+
+--- Updates the selected block frame to display the given info batch
+-- If `previousBlock` is set, it will attempt to anchor to that
+-- @param blockNum the ordered block to be updated, not a watchIndex value
+-- @param info the reference returned by the GetXInfo functions
+-- REMEMBER: t.info and questData[questID] are the same table
+Default.UpdateBlock = function (handler, blockIndex, info)
+ local print = bprint
+ print(' Read list item |cFF00FFFF'..blockIndex..'|r')
+ if not blockIndex or not info then
+ return
+ end
+ local frame = handler.frame
+ local block = T.GetBlock(handler, blockIndex)
+ block.handler = handler
+ block.info = info
+ block.mainStyle = info.mainStyle or 'Normal'
+ block.subStyle = info.subStyle
+
+ info.blockIndex = blockIndex
+ if info.questID then handler.QuestBlock[info.questID] = block end
+ if info.questLogIndex then handler.LogBlock[info.questLogIndex] = block end
+ if info.watchIndex then handler.WatchBlock[info.watchIndex] = block end
+ handler.BlockInfo[blockIndex] = info
+
+ block.endPoint = block.titlebg
+ block.attachmentHeight = 0
+ handler:UpdateObjectives(block)
+
+ block.title:SetText(info.title)
+ local titleHeight = floor(block.title:GetHeight()+.5)
+ local statusHeight = floor(block.status:GetHeight()+.5)
+ local attachmentHeight =floor(block.attachmentHeight + .5)
+ local titlebgHeight = titleHeight + titleSpacing*2
+ local statusbgHeight = statusHeight + textSpacing*2
+
+ block.titlebg:SetHeight(titlebgHeight)
+
+
+ print(' |cFF0088FFanchor to', handler.currentAnchor:GetName())
+
+ print(' |cFF00FF00total sizes:')
+ print(' attachment:', attachmentHeight)
+ print(' title:', titlebgHeight, '('.. titleHeight..')')
+ --block.titlebg:SetHeight(block.title:GetHeight() + T.Conf.Wrapper.TitleSpacing)
+ block.height = titlebgHeight + attachmentHeight
+ if statusHeight > 1 then
+ block.height = block.height + statusbgHeight
+ print(' status:', statusbgHeight, '('.. statusHeight..')')
+ else
+ print(' |cFFFF0088 skipped')
+ end
+ block:SetHeight(block.height)
+
+ print(' |cFFFFFF00height|r:', block.height)
+ print(' |cFF00FFFF)|r -> ', block, block:GetHeight())
+
+ block:Show()
+
+ if info.specialItem and not info.itemButton then
+ print(' - |cFF00FFFFgenerating item button for info set')
+ info.itemButton = T.SetItemButton(block, info)
+ else
+ --info.itemButton = nil
+ end
+
+ local tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', block, 'TOPRIGHT'
+ if info.rewardInfo then
+ print('has immediate reward')
+ if info.rewardInfo[1].type == 'currency' or info.rewardInfo[1].type == 'item' then
+ block.icon:Show()
+ block.iconLabel:SetText(info.rewardInfo[1].count)
+ block.icon:SetPoint(tagPoint, tagAnchor, tagRelative, -2, -2)
+ tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', block.icon, 'TOPLEFT'
+ block.icon:SetTexture(info.rewardInfo[1].texture)
+ end
+ else
+ block.icon:Hide()
+ end
+
+ if info.selected then
+ block.SelectionOverlay:Show()
+ else
+ block.SelectionOverlay:Hide()
+ end
+ -- workaround for scrollchild issue where layers fall out of sync: in this case, it's by 1 vertical pixel
+ --block.highlight:SetPoint('TOPLEFT', block, 'TOPLEFT', 0, 1)
+ --block.lowlight:SetPoint('BOTTOMLEFT', block, 'BOTTOMLEFT', 0, 1)
+
+ tagPoint, tagAnchor, tagRelative = T.AddTag(block, 'frequencyTag', tagPoint, tagAnchor, tagRelative)
+ tagPoint, tagAnchor, tagRelative = T.AddTag(block, 'typeTag', tagPoint, tagAnchor, tagRelative)
+ tagPoint, tagAnchor, tagRelative = T.AddTag(block, 'completionTag', tagPoint, tagAnchor, tagRelative)
+
+ return block
+end
+----------
+--- Top level methods
+
+local tick = 0
+function T:Update (reason, ...)
+ tick = tick + 1
+ local print = tprint
+ reason = reason or OBJECTIVE_TRACKER_UPDATE_REASON
+ local updateWrapper = 0
+ local hasStuff
+ local insertingStuff
+
+ print(format('%d |cFFFF%04X Update()', tick, lshift(reason, 4)), reason, ...)
+ currentPosition = 0
+ anchorPoint = 'TOP'
+ anchorFrame = Scroll
+
+ local wrapperHeight = 0
+ for id, handler in pairs(T.orderedHandlers) do
+ local frame = handler.frame
+
+ print(format('|cFF00FFFF%s and(%04X vs %04x+%04x) = %04X|r', handler.name, reason, handler.updateReasonModule, handler.updateReasonEvents, band(reason, handler.updateReasonModule + handler.updateReasonEvents)))
+ if band(reason, handler.updateReasonModule + handler.updateReasonEvents) > 0 then
+ handler:Update(reason, ...)
+ print(' |cFF00FF00'..id..'|r', handler.displayName, 'count:', handler.numWatched)
+ insertingStuff = true
+ else
+ print(' |cFFFF0088'..id..'|r', 'no reason to update')
+ end
+
+ if handler.numWatched >= 1 then
+ hasStuff = true
+ currentPosition = currentPosition + 1
+ frame:SetParent(Scroll)
+ frame:SetPoint('TOP', anchorFrame, anchorPoint, 0, 0)
+ print(' |cFF00BBFFpinning to', anchorFrame:GetName(), anchorPoint)
+ anchorFrame = handler.frame
+ anchorPoint = 'BOTTOM'
+
+ print('current frame height:', frame.height)
+ wrapperHeight = wrapperHeight + frame.height
+ print('|cFFFF0088total height:', wrapperHeight)
+ else
+ handler.frame:Hide()
+ end
+ end
+
+
+ if hasStuff or insertingStuff then
+ print('updating height to', wrapperHeight)
+ Wrapper:SetHeight(wrapperHeight)
+ Scroller:SetHeight(wrapperHeight)
+ Scroll:SetHeight(wrapperHeight)
+ Scroller:SetVerticalScroll(B.Conf.ObjectiveScroll or 0)
+ print('|cFFFF8800Wrapper:', Wrapper:GetSize())
+ for i = 1, Wrapper:GetNumPoints() do
+ print(' ', Wrapper:GetPoint(i))
+ end
+ print(' |cFF00FFFFScroller:', Scroller:GetSize())
+ for i = 1, Scroller:GetNumPoints() do
+ print(' ', Scroller:GetPoint(i))
+ end
+ print(' |cFF00FFFFScroll:', Scroll:GetSize())
+ for i = 1, Scroll:GetNumPoints() do
+ print(' ', Scroll:GetPoint(i))
+ end
+
+ Wrapper:Show()
+ Scroller:Show()
+ Scroll:Show()
+ end
+ Quest.GetClosest()
+
+end
+
+--- Queue any active item buttons for update for that frame
+T.UpdateActionButtons = function(updateReason)
+ Scroller.snap_upper = 0
+ Scroller.snap_lower = 0
+ local print = B.print('ItemButton')
+ if updateReason then
+ print = B.print('IB_'..updateReason)
+ end
+
+ local previousItem
+ for questID, itemButton in pairs(usedButtons) do
+ local info= T.Quest.Info[questID]
+
+ print('|cFF00FFFF'.. questID .. '|r', itemButton:GetName())
+ local block = T.Quest.QuestBlock[questID]
+ if block then
+ -- Dispatch the probe
+ if IsQuestWatched(info.questLogIndex) then
+ itemButton.previousItem = previousItem
+ print(' |cFFFFFF00probing', block:GetName())
+ block:SetScript('OnUpdate', function()
+ if block:GetBottom() and not InCombatLockdown() then
+ print(' '..block:GetName()..' |cFF00FF00probe hit!')
+ T.UpdateBlockAction(block, itemButton, itemButton.previousItem) -- needs to be previousItem from this scope
+ block:SetScript('OnUpdate', nil)
+
+ end
+ end)
+ previousItem = itemButton
+ else
+ print('hidden block or unwatched quest')
+ itemButton.previousItem = nil
+ itemButton:Hide()
+ end
+ elseif itemButton:IsVisible() then
+ print(' |cFFFF0088hiding unwatched quest button', itemButton:GetName())
+ itemButton.previousItem = nil
+ itemButton:Hide()
+ else
+ print(' |cFFBBBBBBignoring hidden log quest button', itemButton:GetName())
+ end
+ end
+end
+
+T.UpdateBlockAction = function (block, itemButton)
+ print('**|cFF0088FF'..itemButton:GetName(), '|r:Update()')
+ if itemButton.questID ~= block.info.questID then
+ print('** |cFFFF0088mismatched block assignment', itemButton.questID,'<~>', block.info.questID)
+ -- something happened between this and last frame, go back and set new probes
+ return T.UpdateActionButtons()
+ end
+
+ local previousItem = itemButton.previousItem
+ local upper_bound = Scroller:GetTop() + Scroller.snap_upper
+ local lower_bound = Scroller:GetBottom() + Scroller.snap_lower + itemButtonSize
+ local point, anchor, relative
+
+ if block:GetBottom() < lower_bound then
+ print('** ',block:GetName() ,'|cFFFFFF00bottom =', floor(block:GetBottom()+.5), 'threschold =', floor(lower_bound+.5))
+ if previousItem then
+ print('adjusting', previousItem:GetName())
+ previousItem:ClearAllPoints()
+ previousItem:SetPoint('BOTTOM', itemButton, 'TOP', 0, itemButtonSpacing)
+ end
+ itemButton:ClearAllPoints()
+ itemButton.x = Wrapper:GetLeft() -4
+ itemButton.y = Wrapper:GetBottom()
+ point, anchor, relative = 'BOTTOMRIGHT', UIParent, 'BOTTOMLEFT'
+ Scroller.snap_lower = Scroller.snap_lower + itemButtonSize + itemButtonSpacing
+
+ elseif block:GetTop() > upper_bound then
+ print('** ',block:GetName() ,'|cFFFFFF00top =', floor(block:GetTop()+.5), 'threschold =', floor(upper_bound+.5))
+ itemButton:ClearAllPoints()
+ if previousItem then
+ print('latch onto another piece')
+ point, anchor, relative ='TOP', previousItem, 'BOTTOM'
+ itemButton.x = 0
+ itemButton.y = -itemButtonSpacing
+ else
+ print('latch at corner', Scroller:GetLeft() -itemButtonSpacing, Scroller:GetTop())
+ point, anchor, relative = 'TOPRIGHT', UIParent, 'BOTTOMLEFT'
+ itemButton.x = Scroller:GetLeft() -4
+ itemButton.y = Scroller:GetTop()
+ end
+ itemButton:Show()
+ Scroller.snap_upper = Scroller.snap_upper - (itemButtonSize + itemButtonSpacing)
+ else
+ print('** ',block:GetName() ,'|cFF00FF00span =', floor(block:GetBottom()+.5), floor(block:GetTop()+.5), 'threschold =', floor(lower_bound+.5))
+ itemButton:ClearAllPoints()
+ itemButton.x = block:GetLeft() - itemButtonSpacing
+ itemButton.y = block:GetTop()
+ point, anchor, relative = 'TOPRIGHT', UIParent, 'BOTTOMLEFT'
+ end
+
+ itemButton:SetPoint(point, anchor, relative, itemButton.x, itemButton.y)
+ itemButton:Show()
+end
+
+T.UpdateItemButtonCooldown = function(button)
+
+end
+
+local unitLevel = UnitLevel('player')
+
+
diff -r 9b3fa734abff -r e837384ac363 ObjectiveTracker/ObjectiveInfo.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ObjectiveTracker/ObjectiveInfo.lua Sun Apr 10 04:35:32 2016 -0400
@@ -0,0 +1,324 @@
+local B = select(2,...).frame
+local wipe, pairs, ipairs, min, max, unpack = table.wipe, pairs, ipairs, min, max, unpack
+local tinsert, tostring, format, mod = tinsert, tostring, format, mod
+local GetQuestTagInfo, GetQuestLogTitle = GetQuestTagInfo, GetQuestLogTitle
+local GetNumQuestLogEntries, GetNumQuestWatches, GetQuestLogCompletionText, IsQuestWatched, IsQuestHardWatched, GetQuestLogSpecialItemInfo, GetQuestLogSpecialItemCooldown = GetNumQuestLogEntries, GetNumQuestWatches, GetQuestLogCompletionText, IsQuestWatched, IsQuestHardWatched, GetQuestLogSpecialItemInfo, GetQuestLogSpecialItemCooldown
+local GetNumAutoQuestPopUps, GetAutoQuestPopUp, GetTasksTable, GetNumQuestLogTasks, GetTaskInfo, GetQuestObjectiveInfo = GetNumAutoQuestPopUps, GetAutoQuestPopUp, GetTasksTable, GetNumQuestLogTasks, GetTaskInfo, GetQuestObjectiveInfo
+local GetNumQuestLogRewardCurrencies, GetQuestLogRewardCurrencyInfo, GetNumQuestLogRewards, GetQuestLogRewardInfo, GetQuestLogRewardMoney, GetMoneyString = GetNumQuestLogRewardCurrencies, GetQuestLogRewardCurrencyInfo, GetNumQuestLogRewards, GetQuestLogRewardInfo, GetQuestLogRewardMoney, GetMoneyString
+local GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo = GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo
+local GetQuestWatchIndex, GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo = GetQuestWatchIndex, GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo
+local QuestHasPOIInfo, GetDistanceSqToQuest, GetQuestFactionGroup = QuestHasPOIInfo, GetDistanceSqToQuest, GetQuestFactionGroup
+local GetTrackedAchievements, GetNumTrackedAchievements, GetAchievementInfo = GetTrackedAchievements, GetNumTrackedAchievements, GetAchievementInfo
+local GetMoney, floor = GetMoney, floor
+local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
+local print = B.print('Info')
+local QUEST_TAG_DUNGEON = QUEST_TAG_DUNGEON
+local QUEST_TAG_GROUP = QUEST_TAG_GROUP
+local QUEST_TAG_ACCOUNT = QUEST_TAG_ACCOUNT
+local QUEST_TAG_TCOORDS = QUEST_TAG_TCOORDS
+local LE_QUEST_FREQUENCY_DAILY = LE_QUEST_FREQUENCY_DAILY
+local LE_QUEST_FREQUENCY_WEEKLY = LE_QUEST_FREQUENCY_WEEKLY
+local FACTION_ALLIANCE, LE_QUEST_FACTION_HORDE, FACTION_HORDE, LE_QUEST_FACTION_HORDE = FACTION_ALLIANCE, LE_QUEST_FACTION_HORDE, FACTION_HORDE, LE_QUEST_FACTION_HORDE
+
+local Tracker, Bonus, AutoQuest, Quest, Cheevs = T.DefaultTracker, T.Bonus, T.AutoQuest, T.Quest, T.Cheevs
+--------------------------------------------------------------------
+--- Tracker-specific data retrieval functions
+--------------------------------------------------------------------
+
+
+local DoQuestRewards= function(t, questID)
+ local rewards = {}
+ t.numCurrencies = GetNumQuestLogRewardCurrencies(questID)
+ for i = 1, t.numCurrencies do
+ local name, texture, count = GetQuestLogRewardCurrencyInfo(i, questID)
+ tinsert(rewards,{
+ type = 'currency',
+ index = i,
+ name = name,
+ texture = texture,
+ count = count
+ });
+ end
+ -- items
+ t.numItems = GetNumQuestLogRewards(questID)
+ for i = 1, t.numItems do
+ local name, texture, count, quality, isUsable = GetQuestLogRewardInfo(i, questID)
+ tinsert(rewards, {
+ type = 'item',
+ index = i ,
+ name = name,
+ texture = texture,
+ count = count,
+ quality = quality,
+ isUsable = isUsable
+ });
+ end
+ -- money
+
+ local money = GetQuestLogRewardMoney(questID)
+ if ( money > 0 ) then
+ tinsert(rewards, {
+ type = 'money',
+ name = GetMoneyString(money),
+ texture = "Interface\\Icons\\inv_misc_coin_01",
+ count = 0,
+ });
+ end
+
+ if #rewards >= 1 then
+ t.rewardInfo = rewards
+ end
+end
+
+
+-----------------------------
+--- AUTO_QUEST
+AutoQuest.LogInfo = {}
+AutoQuest.LogBlock = {}
+AutoQuest.QuestBlock = {}
+AutoQuest.WatchBlock = {}
+function AutoQuest:GetNumWatched ()
+ print(self.name, self)
+ Quest:GetNumWatched()
+ self.numWatched = GetNumAutoQuestPopUps()
+
+ return self.numWatched
+end
+AutoQuest.GetInfo = function(self, popupIndex)
+
+
+ local questID, type = GetAutoQuestPopUp(popupIndex)
+ local questLogIndex = GetQuestLogIndexByID(questID)
+ local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questIndex)
+
+ self.Info[questID] = self.Info[questID] or {}
+ local popup = self.Info[questID]
+ popup.title = title
+ popup.description = type
+ popup.popupType = type
+ popup.questID = questID
+ popup.questLogIndex = questLogIndex
+ popup.popupIndex = popupIndex
+
+ self.Info[questID] = popup
+ self.WatchInfo[popupIndex] = popup
+
+
+ return self.Info[questID]
+end
+
+-----------------------------
+--- BONUS OBJECTIVE
+-- The default UI pops them up as you enter their relevant areas, but the data is actually available at all times.
+-- The only requirement is that you've been to said area and progressed any of the objectives.
+-- Blizzard deal with this fact by caching any task data collected during session and masking out whatever gets completed.
+-- For the addon's module structure to work, GetNumWatched method also invokes a tasks table scan.
+-- That composes the table searched by GetInfo().
+
+------------------------------------------------------------------------------------------
+--- These functions are copied from Blizzard_BonusObjectiveTracker.lua;
+-- It's kind of dumb, but this avoids the risk of code taint.
+
+--- Returns a tasks table modified to include recently completed objectives
+local UnitName, GetRealmName = UnitName, GetRealmName
+local InternalGetTasksTable = function()
+ local savedTasks = T.Conf.TasksLog
+ local char = UnitName("player")
+ local realm = GetRealmName()
+ local tasks = GetTasksTable()
+
+ for questID, data in pairs(Bonus.Info) do
+
+ print(' -- questID:', questID, #data.objectives)
+ for i, o in ipairs(data.objectives) do
+ print(' --', i, o.text)
+ end
+
+ end
+
+
+ for questID, data in pairs(savedTasks) do
+ if questID > 0 then
+ local found = false
+ for i = 1, #tasks do
+ if tasks[i] == questID then
+ found = true
+ break
+ end
+ end
+ -- if it's not part of the current table, then try to insert it where it was last found
+ if not found then
+ if data.watchIndex < #tasks then
+ tinsert(tasks, data.watchIndex, data)
+ else
+ tinsert(tasks, data)
+ end
+ end
+ end
+ end
+ return tasks
+end
+
+--- Returns an entry from the composed tasks table if possible, otherwise makes an API pull
+local InternalGetTaskInfo = function(questID)
+ local completedTasks = T.Conf.TasksLog
+ if completedTasks[questID] then
+ return true, true, #completedTasks[questID].objectives
+ else
+ return GetTaskInfo(questID)
+ end
+end
+
+--- Same as above but for the objective entries
+local InternalGetQuestObjectiveInfo = function(questID, objectiveIndex)
+ local completedTasks = T.Conf.TasksLog
+ if ( completedTasks[questID] ) then
+ print('using internal data')
+ return completedTasks[questID].objectives[objectiveIndex], completedTasks[questID].objectiveType, true;
+ else
+ return GetQuestObjectiveInfo(questID, objectiveIndex, false);
+ end
+end
+
+--- end redundant copy of silliness
+------------------------------------------------------------------------------------------
+
+Bonus.Completed = {}
+Bonus.POI = {}
+Bonus.Scenario = {}
+Bonus.QuestBlock = {}
+Bonus.WatchInfo = {}
+function Bonus:GetNumWatched ()
+ print(self.name, self)
+
+ local tasks = InternalGetTasksTable()
+ local numWatched = 0
+ local numAll = 0
+ self.WatchInfo = {}
+ print('|cFFFFFF00Bonus.GetNumWatched()|r', #tasks)
+ print(' TasksTable pull:')
+ for i, questID in ipairs(tasks) do
+ local isInArea, isOnMap, numObjectives = InternalGetTaskInfo(questID)
+ local existingTask = self.QuestBlock[questID]
+ local displayObjectiveHeader = false;
+ local test = (isInArea or (isOnMap and existingTask))
+ --local test = true
+ if test then
+ self.Info[questID] = self.Info[questID] or {}
+
+ local t = self.Info[questID]
+ self.WatchInfo[i] = t
+ t.isInArea = isInArea
+ t.isOnMap = isOnMap
+ t.existingTask = existingTask
+ t.questID = questID
+ t.objectives = {}
+ t.taskIndex = i
+
+
+ DoQuestRewards(t, questID)
+
+ local taskTitle
+ local taskFinished = true;
+ for objectiveIndex = 1, numObjectives do
+ local text, objectiveType, finished, displayAsObjective = InternalGetQuestObjectiveInfo(questID, objectiveIndex, false);
+ displayObjectiveHeader = displayObjectiveHeader or displayAsObjective;
+ if not taskTitle then
+ if objectiveType == 'progressbar' and not text:match('^%d%+\\%d+') then
+ taskTitle = text
+ text = ''
+ end
+ end
+
+
+ print(' --', text, objectiveType, finished, displayAsObjective)
+ t.objectives[objectiveIndex] = t.objectives[objectiveIndex] or {}
+ local o = t.objectives[objectiveIndex]
+
+ o.objectiveIndex = objectiveIndex
+ o.text = text
+ o.objectiveType = objectiveType
+ o.finished = finished
+ o.displayAsObjective = displayAsObjective
+ print(' |cFF00FF88*', objectiveIndex, text)
+ end
+
+ -- didn't get a name from progress bar? what about area name
+ if not taskTitle then
+ if isInArea then
+ taskTitle = GetMapNameByID(GetCurrentMapAreaID())
+ end
+ end
+ t.title = taskTitle
+ end
+
+ print (' |cFF00FF88#', i, 'questID', questID, 'inArea', isInArea, 'onMap', isOnMap, 'existing', (existingTask and 'Y' or 'N'), (test and '|cFF00FF00show|r' or '|cFFFF0088hide|r'))
+ end
+
+
+ self.numAll = #tasks
+ self.numWatched = #self.WatchInfo
+ print(' stats:', self.numAll, 'active tasks,', self.numWatched, 'nearby or animating')
+ --return #tasks
+ return #self.WatchInfo
+end
+
+--- info cleanup done when turn-ins are detected
+Bonus.OnTurnIn = function(self, questID, xp, money)
+ print('|cFFFF8800'..self.name..':OnTurnIn call', questID, xp, money)
+ local savedTasks = B.Conf.TasksLog
+
+ self.Info[questID].completedTime = GetTime()
+ self.Info[questID].animate = true
+ T.SetAnimate(self.watchReason)
+ savedTasks[questID] = self.Info[questID]
+end
+
+Bonus.GetInfo = function(self, taskIndex)
+ print(self.name, self)
+ return self.WatchInfo[taskIndex]
+end
+
+
+
+Cheevs.GetNumWatched = function(self)
+ print('|cFF00FF00' .. GetTime())
+ Cheevs.trackedCheevs = {GetTrackedAchievements()}
+ return GetNumTrackedAchievements()
+end
+Cheevs.GetInfo = function(self, index)
+ local cheevID = Cheevs.trackedCheevs[index]
+ local id, name, points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy = GetAchievementInfo(cheevID)
+
+ self.Info[cheevID] = {}
+ local c = self.Info[cheevID]
+ c.type = 'Cheevs'
+ c.watchIndex = index
+ c.cheevID = cheevID
+ c.title = name
+ c.points, c.completed, c.month, c.day, c.year, c.description, c.flags, c.icon, c.rewardText, c.isGuildAch, c.wasEarnedByMe, c.earnedBy =
+ points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy
+ c.numObjectives = GetAchievementNumCriteria(cheevID)
+ c.objectives = {}
+ for i = 1, c.numObjectives do
+ local description, type, completed, quantity, requiredQuantity, characterName, flags, assetID, quantityString, criteriaID = GetAchievementCriteriaInfo(cheevID, i)
+ c.objectives[i] = {
+ objectiveIndex = i,
+ cheevID = cheevID,
+ text = description,
+ type = type,
+ finished = completed,
+ value = quantity,
+ maxValue = requiredQuantity,
+ characterName = characterName,
+ flags = flags,
+ assetID = assetID,
+ quantityString = quantityString,
+ criteriaID = criteriaID,
+ }
+ end
+ print('Cheevs.|cFF0088FFGetInfo|r('..index..')', 'obj:', GetAchievementNumCriteria(cheevID), name, description)
+
+ self.WatchInfo[index] = c
+ return self.Info[cheevID]
+end
diff -r 9b3fa734abff -r e837384ac363 ObjectiveTracker/ObjectiveSecure.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ObjectiveTracker/ObjectiveSecure.xml Sun Apr 10 04:35:32 2016 -0400
@@ -0,0 +1,66 @@
+
+
+
+
\ No newline at end of file
diff -r 9b3fa734abff -r e837384ac363 ObjectiveTracker/ObjectiveStyle.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ObjectiveTracker/ObjectiveStyle.lua Sun Apr 10 04:35:32 2016 -0400
@@ -0,0 +1,506 @@
+local B = select(2,...).frame
+local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
+local print = B.print('SetStyle')
+-------------------------------------------------------------
+--- Deals with swapping between different color palettes
+---
+
+local titleFont, textFont = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]]
+local titleSize, textSize = 16, 15
+local titleOutline, textOutline = "OUTLINE", "OUTLINE"
+local titleSpacing, textSpacing = 3, 3
+local unpack, type, pairs, tconcat = unpack, type, pairs, table.concat
+local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE'
+local headerFont, headerSize = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 24
+local headerOutline, headerSpacing = 'OUTLINE', 2
+
+
+mod.defaults.Style = {
+ Format = {
+ Frame = {
+ Width = 270,
+ },
+ title = {
+ Indent = 0,
+ Spacing = 0,
+ },
+ status = {
+ Indent = 5,
+ Spacing = 0,
+ }
+ },
+ FontBank = {
+ ['Normal'] = _G.VeneerCriteriaFontNormal,
+ ['Progress'] = _G.VeneerCriteriaFontProgress,
+ ['Complete'] = _G.VeneerCriteriaFontComplete,
+ ['Failed'] = _G.VeneerCriteriaFontFailed,
+ },
+ Normal = {
+ title = {
+ TextColor = {1, 1, 1, 1},
+ Width = 270,
+ Spacing = 0,
+ Indent = 2,
+ },
+ titlebg = {
+ },
+ status = {
+ Width = 270,
+ Spacing = 0,
+ },
+ statusbg = {
+ },
+ Frame = {
+ }
+ },
+ Tracker = {
+ Normal = {
+ title = {
+ Font = {headerFont, headerSize, headerOutline}, Spacing = headerSpacing,
+ Indent = 2,
+ TextColor = {1, .9, .2, 1},
+ },
+ titlebg = {
+ Gradient = {'VERTICAL', MinColor = {0,0,0,0.25}, MaxColor = {0,0,0,.15}},
+ }
+ }
+ },
+ TrackerBlock = {
+ Normal = {
+ titlebg = {
+ Indent = 2,
+ Gradient = { 'HORIZONTAL', MinColor = {0.7, 0, 0.9, 1}, MaxColor = {.7, 0, 0.9, .1}},
+ },
+ title = {
+ TextColor = {1,1,1,1},
+ Font = {titleFont, titleSize, titleOutline},
+ Spacing = titleSpacing,
+ },
+ status = {
+ TextColor = {1,1,1,1},
+ Font = {textFont, textSize, textOutline},
+ Spacing = textSpacing,
+ },
+ statusbg = {
+ Gradient = { 'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, .1}},
+ }
+ },
+ Daily = {
+ titlebg = {
+ Gradient = {'HORIZONTAL', MinColor = {0, .4, 1, 1}, MaxColor = {0, 0.4, 1, .1}, },
+ },
+ statusbg = {
+ Gradient = {'HORIZONTAL', MinColor = {0, .4, 1, 1}, MaxColor = {0, 0.35, .90, .1}, },
+ },
+ title = {
+ TextColor = {0.7,1,1,1},
+ Font = {titleFont, titleSize, titleOutline},
+ Spacing = titleSpacing,
+ },
+ status = {
+ TextColor = {1,1,1,1},
+ Font = {textFont, textSize, textOutline},
+ Spacing = textSpacing,
+ },
+ },
+ Super = {
+ title = {
+ TextColor = {1,1,1,1},
+ Font = {titleFont, titleSize, titleOutline},
+ Spacing = titleSpacing, BackgroundFullWidth = true
+ },
+ titlebg = {
+ Gradient = { 'HORIZONTAL', MinColor = {0, .7, .6, 1}, MaxColor = {0, .7, .6, 1}},
+ },
+ status = {
+ TextColor = {1,1,1,1},
+ Font = {textFont, textSize, textOutline},
+ Spacing = textSpacing,
+ },
+ statusbg = {
+ Gradient = { 'HORIZONTAL', MinColor = {0, .7, .6, 1}, MaxColor = {0, .7, .6, 1} },
+ },
+ },
+ MouseDown = {
+ title = {
+ Font = {titleFont, titleSize, titleOutline},
+ Spacing = titleSpacing,
+ },
+ titlebg = {
+ Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {0.2, .4, 1, 1}, },
+ },
+ status = {
+ Font = {textFont, textSize, textOutline},
+ Spacing = textSpacing,
+ },
+ statusbg = {
+ Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {0.2, .4, 1, 1}, },
+ }
+ },
+ Complete = {
+ title = {
+ TextColor = {1,1,1,1},
+ Font = {titleFont, titleSize, titleOutline}, Spacing = titleSpacing,
+ },
+ titlebg = {
+ Gradient = {'HORIZONTAL', MinColor = {0, 1, 0, 1}, MaxColor = {0, 1, 0, 1}, },
+ },
+ status = {
+ TextColor = {1,1,1,1},
+ Font = {textFont, textSize, textOutline}, Spacing = textSpacing,
+ },
+ statusbg = {
+ Gradient = {'HORIZONTAL', MinColor = {0, 1, 0, 1}, MaxColor = {0, 1, 0, 1}, },
+ }
+ },
+ AutoQuest = {
+ Normal = {
+ titlebg = {
+ Indent = 2,
+ Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, 1}},
+ },
+ title = {
+ TextColor = {1,1,1,1},
+ Font = {titleFont, titleSize, titleOutline},
+ Spacing = titleSpacing,
+ },
+ status = {
+ TextColor = {0,1,0,1},
+ Font = {textFont, textSize, textOutline},
+ Spacing = textSpacing,
+ },
+ statusbg = {
+ Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, 1}},
+ }
+ },
+ },
+ Cheevs = {
+ Normal = {
+
+ title = {
+ Font = {titleFont, titleSize, titleOutline},
+ Spacing = titleSpacing,
+ },
+ titlebg = {
+ Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, 1}},
+
+ },
+ status = {
+ Font = {textFont, textSize, textOutline},
+ Spacing = textSpacing,
+ },
+ statusbg = {
+ Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, 1}},
+ },
+ },
+ Complete = {
+ title = {
+ Font = {titleFont, titleSize, titleOutline},
+ Spacing = titleSpacing,
+ },
+ titlebg = {
+ Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, 1}},
+ },
+ status = {
+ Font = {textFont, textSize, textOutline},
+ Spacing = textSpacing,
+ },
+ statusbg = {
+ Gradient = {'HORIZONTAL', MinColor = {0.2, .4, 1, 1}, MaxColor = {.7, 0, 0.9, 1}},
+ },
+ },
+ }
+ }
+}
+
+local style_cache_func = {}
+local block_vars = {
+ ['titleSize'] = {'titleWidth', 'titleHeight'},
+ ['FrameSize'] = {'width', 'height'}
+}
+local attrib_vars = {
+ ['Font'] = {'height'},
+}
+
+mod.BlockStyleCache = {}
+local style_cache = mod.BlockStyleCache
+mod.regions = {}
+mod.regionStyles = {}
+mod.SetBlockStyle = function(frame, frameType, ...)
+ -- var names intended to reflect argument order
+ print('|cFFFFFF00'..frame:GetName()..'|r', frameType, ...)
+ --@debug@
+ local c = mod.defaults.Normal
+ local style_list = {... }
+ local styleName = frameType .. '-' .. table.concat(style_list,'')
+ local previousClass = {mod.Conf.Style[frameType] }
+ local previousClassString = {'frame' }
+ local parentName
+
+ if not style_cache[styleName] then
+ local style = {}
+
+ --[[
+ if mod.defaults.Style[frameType] then
+ print(' setting style class |cFF00FFFF'..frameType)
+ else
+ print(' resorting to class Normal (missing |cFFFF8800'.. frameType..'|r)')
+ end
+ --]]
+ local normal = mod.defaults.Style.Normal
+ local root = mod.defaults.Style[frameType] or normal
+ for i, className in ipairs(style_list) do
+ print('|cFF00FF00'..i..'|r', className)
+ local class = normal
+ local childClass
+ if previousClass then
+ for i = #previousClass, 1, -1 do
+ print('checking if '..className..' child of '.. previousClassString[i])
+ if previousClass[i][className] then
+ print(' it is!')
+ childClass = previousClass[i][className]
+ parentName = previousClassString[i]
+ break
+ end
+ end
+ end
+ if childClass then
+ class = childClass
+ print(' ChildClass '..parentName..'.|cFFFF0088'.. className .. '|r')
+ elseif root[className] then
+ class = root[className]
+ print(' SubClass |cFF0088FF'.. className .. '|r')
+ elseif normal[className] then
+ class = normal[className]
+ print(' SubClass Normal.|cFFFF0088'..className..'|r')
+ else
+ --print(' SubClass not found '..className..'')
+ end
+ tinsert(previousClass, class)
+ tinsert(previousClassString, className)
+
+ for elementName, element in pairs(class) do
+ if not elementName:match('^%u') then
+ --print(' scanning Element |cFF8800FF'.. elementName ..'|r')
+ if not style[elementName] then
+ style[elementName] = {}
+ end
+ for key, value in pairs(element) do
+ if mod.SetBlockAttribute[key] then
+ --print(' |cFF00FF00'..elementName..'|r.|cFF00FFFF'..key..' =', (type(value) == 'table' and ('{'..table.concat(value,', ')..'}') or tostring(value)))
+ style[elementName][key] = value
+ end
+
+ end
+ end
+
+ end
+ end
+
+ for k, elements in pairs(mod.defaults.Style.Normal) do
+ if not style[k] and type(elements) ~= 'table' then
+ style[k] = elements
+ end
+ end
+
+
+ --[[print('result for: ', frame:GetName())
+ for k,v in pairs(style) do
+ if type(v) == 'table' and not k:match('^%u') then
+ for kk, vv in pairs(v) do
+ --print(' |cFFFFFF00'..k..'|r.|cFF00FF00'..kk..'|r =', (type(vv) == 'table' and ('{'..table.concat(vv,', ')..'}') or tostring(vv)))
+ end
+ else
+ --print(' |cFFFFFFFF' .. k ..'|r =', tostring(v))
+ end
+ end
+ --]]
+ print('saving |cFFFFFF00'..styleName)
+ style_cache[styleName] = style
+ else
+
+ print('using |cFFFF00FF'..styleName)
+ end
+
+ local style = style_cache[styleName]
+
+ if not style_cache_func[styleName] then
+ local code =
+ "return function (frame)\n"..
+ " local func = Veneer.ObjectiveTracker.SetBlockAttribute\n"..
+ " local cache = Veneer.ObjectiveTracker.BlockStyleCache"
+ --.. " print('CacheFunc', '|cFFFFFF00SET|r "..styleName.." |cFFFFFF00ON|r', frame:GetName()) "
+
+ for elementName, styleset in pairs(style) do
+ code = code ..
+ "\n if frame['"..elementName.."'] then"
+
+ for attributeName, value in pairs(styleset) do
+ if mod.SetBlockAttribute[attributeName] then
+ --print(' add function '..elementName..':'.. attributeName ..'(', (type(value) == 'table' and ('{'..table.concat(value,', ')..'}') or tostring(value)), ')')
+
+
+ --mod.SetBlockAttribute[attributeName](region, value)
+ code = code
+ --.. "\n print('CacheFunc', ' applying', '|cFF00FFFF" .. attributeName .. "|r to', '|cFF0088FF"..elementName.."|r', cache['"..styleName.."']['"..elementName.."']['".. attributeName .."'])"
+ .. "\n\n func['" .. attributeName .. "'](frame['"..elementName.."'],"..
+ " cache['"..styleName.."']['"..elementName.."']['".. attributeName .."'])"
+
+ --- Set any frame.blah variables used in Updates
+ if block_vars[elementName .. attributeName] then
+ --print('|cFF008800BVar|r', elementName..attributeName)
+ for i, blockKey in ipairs(block_vars[elementName .. attributeName]) do
+ --print(' assigning |cFF008800'..blockKey..'|r')
+ frame[blockKey] = (type(value) == 'table') and value[i] or value
+ end
+ end
+
+ end
+ end
+ code = code ..
+ "\n else"..
+ --"\n print('CacheFunc', ' |cFFFF4400missing', frame:GetName()..'."..elementName.."')"..
+ "\n end"
+ end
+ code = code .. "\nend"
+ local result = assert(loadstring(code))
+ --print('storing style func', styleName, result())
+ style_cache_func[styleName] = result()
+
+ end
+ style_cache_func[styleName](frame)
+
+ --- Hardcoding the sizing vars for sanity
+ local defaultWidth = mod.Conf.Wrapper.Width
+ local normalSettings = mod.defaults.Style.Format
+ frame.width = defaultWidth
+ frame.statusWidth = defaultWidth - normalSettings.status.Indent
+ frame.titleWidth = defaultWidth - normalSettings.title.Indent
+ frame.attachmentHeight = frame.attachmentHeight or 0
+
+ if frame.title then
+ frame.titleHeight = frame.title and frame.title:GetStringHeight() or 0
+ if frame.titleHeight > 0 then
+ print('add spacing to', frame.titleHeight)
+ frame.titleHeight = frame.titleHeight + (frame.title.spacing or 0)*2
+ end
+
+ frame.title.spacing = frame.title.spacing or frame.title:GetSpacing()
+ frame.title:SetPoint('LEFT', frame, 'LEFT', normalSettings.title.Indent)
+ frame.title:SetPoint('TOP', frame, 'TOP', 0, -frame.title.spacing)
+ frame.title:SetWidth(frame.width)
+ if frame.titlebg then
+ frame.titlebg:SetHeight(frame.titleHeight)
+ frame.titlebg:SetWidth(frame.width)
+ end
+ print(' titleHeight', frame.titleHeight, 'indent', normalSettings.title.Indent, 'spacing', frame.title.spacing)
+ print(' -- text:', frame.title:GetSize())
+ print(' -- bg:', frame.titlebg:GetSize())
+
+ else
+ frame.titleHeight = 0
+ end
+
+
+ if frame.status and (frame.status:GetText() or frame.attachmentHeight > 0) then
+ frame.statusHeight = frame.status and frame.status:GetStringHeight() or 0
+ if frame.statusHeight > 0 then
+ frame.statusHeight = frame.statusHeight + (frame.status.spacing or 0)*2
+ end
+
+ frame.status.spacing = frame.status.spacing or frame.status:GetSpacing()
+
+ frame.status:SetWidth(frame.width)
+ frame.status:SetPoint('LEFT', frame, 'LEFT', normalSettings.status.Indent, 0)
+ frame.status:SetPoint('TOP', frame.titlebg, 'BOTTOM', 0, 0)
+ --frame.status:SetHeight(frame.statusHeight)
+ if frame.statusbg then
+
+ --frame.statusbg:SetHeight(frame.statusHeight + (frame.attachmentHeight or 0))
+ --frame.statusbg:SetPoint('BOTTOM', frame, 'BOTTOM', 0, 0)
+ frame.statusbg:SetWidth(frame.width)
+ end
+ print(' status tHeight', frame.statusHeight, 'indent', normalSettings.status.Indent, 'spacing', frame.status.spacing)
+ else
+ if frame.status then
+ frame.status:Hide()
+ end
+ if frame.statusbg then
+ frame.statusbg:Hide()
+ end
+ frame.statusHeight = 0
+ end
+
+ frame.height = frame.titleHeight + frame.statusHeight + (frame.attachmentHeight or 0)
+ frame:SetSize(frame.width, frame.height)
+ print(' |cFF0088FFsizing frame', frame.width, frame.height)
+end
+
+--- Argument containers
+local o -- text flag
+local a1, a2, a3, a4, b1, b2, b3, b4 -- color1, color2
+local f1, f2, f3 -- font
+local w1, w2 -- size
+local p1, p2, p3, x, y -- path/point args
+mod.SetBlockAttribute = {}
+local sb = mod.SetBlockAttribute
+local print = B.print('Attribute')
+sb.Gradient = function(region, value)
+ print('|cFF8844FFGradient|r', region:GetName(), unpack(value))
+ o = value[1]
+ a1, a2, a3, a4 = unpack(value.MinColor)
+ b1, b2, b3, b4 = unpack(value.MaxColor)
+ region:SetVertexColor(1,1,1)
+ region:SetTexture(1,1,1,1)
+ region:SetGradientAlpha(o, a1, a2, a3, a4, b1, b2, b3, b4)
+end
+
+sb.Background = function(region, value)
+ print('|cFF0088FFBackground|r', unpack(value))
+ region:SetVertexColor(1,1,1) -- reset
+ region:SetTexture(unpack(value))
+end
+sb.BackgroundComplex = function (region, value)
+ local left, tile, right = value.Left, value.Tile, value.Right
+
+end
+sb.Font = function(region, value)
+ f1, f2, f3 = unpack(value)
+ print('|cFFFFFF00Font|r', f1, f2, f3)
+ region:SetFont(f1, f2, f3)
+end
+
+sb.Spacing = function(region, value)
+ print('FontSpacing', region:GetName(), value)
+ region:SetSpacing(value)
+ region.spacing = value
+end
+
+sb.TextColor = function(region, value)
+ a1, a2, a3, a4 = unpack(value)
+ print('TextColor', a1, a2, a3, a4)
+ region:SetTextColor(a1, a2, a3, a4)
+end
+sb.Texture = function(region, value)
+
+ p1, a1, a2, a3, a4 = unpack(value)
+ print('Texture', p1, a1, a2, a3, a4)
+ region:SetTexture(p1)
+ if a1 then
+ region:SetTexCoord(a1, a2, a3, a4)
+ end
+end
+sb.Width = function(region, value)
+ w1 = value
+ region:SetWidth(w1)
+end
+
+sb.Height = function(region, value)
+ w2 = value
+ region:SetHeight(w2)
+end
+sb.Size = function(region, value)
+ w1, w2 = unpack(value)
+ region:SetSize(w1, w2)
+end
+
diff -r 9b3fa734abff -r e837384ac363 ObjectiveTracker/ObjectiveTracker.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ObjectiveTracker/ObjectiveTracker.xml Sun Apr 10 04:35:32 2016 -0400
@@ -0,0 +1,486 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ self.toggle = true
+ --self.drag = true
+ Veneer.OnLoad(self)
+
+
+
+
+ Veneer.OnDragStart(self)
+
+
+ Veneer.OnDragStop(self)
+ Veneer.ObjectiveTracker.UpdateActionButtons()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r 9b3fa734abff -r e837384ac363 ObjectiveTracker/ObjectiveUI.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ObjectiveTracker/ObjectiveUI.lua Sun Apr 10 04:35:32 2016 -0400
@@ -0,0 +1,118 @@
+--- ${PACKAGE_NAME}
+-- @file-author@
+-- @project-revision@ @project-hash@
+-- @file-revision@ @file-hash@
+-- Created: 3/29/2016 7:07 PM
+local B = select(2,...).frame
+local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
+local print = B.print('Objectives')
+local Default, AutoQuest, Quest, Cheevs = mod.DefaultHandler, mod.AutoQuest, mod.Quest, mod.Cheevs
+local itemButtonSize, itemButtonSpacing = 36, 1
+local tremove, tremovebyval = table.remove, table.removebyval
+
+--------------------------------------------------------------------
+--- Functions responsible for:
+--- - UI interactions that propagate to the BlizzardUI (sending RemoveQuestWatch() on remove quest action)
+--- -
+--------------------------------------------------------------------
+
+Default.Select = function(self) end
+Default.Open = function(self) end
+Default.Remove = function(self) end
+Default.Report = function(self)
+ print('Stats:', self.numWatched,'items tracked,', self.numBlocks,'blocks assigned.')
+end
+
+Default.OnMouseUp = function(self, button)
+ print(self.handler.name, self.mainStyle, self.subStyle)
+ if button == 'LeftButton' then
+ if IsModifiedClick("CHATLINK") and ChatEdit_GetActiveWindow() then
+ self:Link()
+ elseif IsModifiedClick("QUESTWATCHTOGGLE") then
+ self:Remove()
+ else
+ self:Select()
+ end
+ elseif button == 'RightButton' then
+ self:Open()
+ end
+ self.initialButton = nil
+ self.modChatLink = nil
+ self.modQuestWatch = nil
+ mod:Update(self.handler.updateReasonModule)
+ print('|cFFFF8800'..tostring(self:GetName())..':MouseUp()|r')
+end
+
+Default.OnMouseDown = function(self, button)
+ print(IsModifiedClick("CHATLINK"), IsModifiedClick("QUESTWATCHTOGGLE"))
+ print(self.info.title)
+end
+
+
+AutoQuest.Select = function(self)
+ if self.info.popupType == 'OFFER' then
+ ShowQuestOffer(self.info.questIndex)
+ else
+ ShowQuestComplete(self.info.questIndex)
+ end
+ RemoveAutoQuestPopUp(self.info.questID)
+end
+
+Quest.Select = function(self)
+ if self.info.isAutoComplete and self.info.isComplete then
+ ShowQuestComplete(self.info.questLogIndex)
+ else
+ SetSuperTrackedQuestID(self.info.questID)
+ end
+end
+
+Quest.Link = function(self)
+ local questLink = GetQuestLink(block.questLogIndex);
+ if ( questLink ) then
+ ChatEdit_InsertLink(questLink);
+ end
+end
+Quest.Open = function(self)
+ QuestMapFrame_OpenToQuestDetails(self.info.questID)
+end
+
+Quest.Remove = function(self)
+ print('removing', self.info.questLogIndex, 'from watcher')
+ RemoveQuestWatch(self.info.questLogIndex)
+end
+
+
+-----------------------------
+--- CHEEVS
+Cheevs.Select = function(self)
+ --mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT)
+end
+Cheevs.Remove = function(self)
+ RemoveTrackedAchievement(self.info.cheevID)
+end
+Cheevs.OnMouseUp = function(self, button)
+ Default.OnMouseUp(self, button)
+end
+Cheevs.Link = function(self)
+ local achievementLink = GetAchievementLink(self.info.cheevID);
+ if ( achievementLink ) then
+ ChatEdit_InsertLink(achievementLink);
+ end
+end
+
+Cheevs.Open = function(self)
+ if ( not AchievementFrame ) then
+ AchievementFrame_LoadUI();
+ end
+ if ( not AchievementFrame:IsShown() ) then
+ AchievementFrame_ToggleAchievementFrame();
+ end
+ AchievementFrame_SelectAchievement(self.info.cheevID);
+end
+
+local Bonus = mod.Bonus
+Bonus.Select = function(self, questID)
+ Bonus:OnTurnIn(self.info.questID, 0, 30800)
+end
+Bonus.Remove = function(self, questID)
+end
\ No newline at end of file
diff -r 9b3fa734abff -r e837384ac363 ObjectiveTracker/ObjectiveWidgets.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ObjectiveTracker/ObjectiveWidgets.lua Sun Apr 10 04:35:32 2016 -0400
@@ -0,0 +1,439 @@
+local B = select(2,...).frame
+local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
+local print = B.print('WidgetFactory')
+local UIParent = UIParent
+local GetQuestLogSpecialItemInfo, IsQuestLogSpecialItemInRange, GetQuestLogSpecialItemCooldown = GetQuestLogSpecialItemInfo, IsQuestLogSpecialItemInRange, GetQuestLogSpecialItemCooldown
+local CooldownFrame_SetTimer, SetItemButtonTextureVertexColor, CreateFrame, VeneerObjectiveScroll = CooldownFrame_SetTimer, SetItemButtonTextureVertexColor, CreateFrame, VeneerObjectiveScroll
+local tremove, tinsert, tContains, pairs, setmetatable = tremove, tinsert, tContains, pairs, setmetatable
+
+--- frame refs
+local Wrapper = _G.VeneerObjectiveWrapper
+local Scroller = Wrapper.scrollArea
+local CloseButton = Wrapper.CloseButton
+local QuestMapButton = Wrapper.QuestMapButton
+local Scroll = _G.VeneerObjectiveScroll
+
+local panelButtons = {
+ CloseButton = {
+ closedSwatch = {
+ [[Interface\Buttons\UI-Panel-QuestHideButton]],
+ [[Interface\Buttons\UI-Panel-QuestHideButton]],
+ 0, 0.5, 0.5, 1,
+ 0.5, 1, 0.5, 1,
+ },
+ openSwatch = {
+ [[Interface\Buttons\UI-Panel-QuestHideButton]],
+ [[Interface\Buttons\UI-Panel-QuestHideButton]],
+ 0.5, 1, 0.5, 1,
+ 0, 0.5, 0.5, 1,
+ },
+ parent = 'VeneerObjectiveWrapper'
+ },
+ QuestMapButton = {
+ closedSwatch = {
+ [[Interface\QUESTFRAME\UI-QUESTMAP_BUTTON]],
+ [[Interface\QUESTFRAME\UI-QUESTMAP_BUTTON]],
+ 0, 1, 0.5, 1,
+ 0, 1, 0, 0.5,
+ },
+ openSwatch = {
+ [[Interface\QUESTFRAME\UI-QUESTMAP_BUTTON]],
+ [[Interface\QUESTFRAME\UI-QUESTMAP_BUTTON]],
+ 0, 1, 0, 0.5,
+ 0, 1, 0.5, 1,
+ }
+ }
+}
+
+local Scroller_OnShow = function()
+ Wrapper.watchMoneyReasons = 0;
+ --mod:Update()
+ --mod:OnInitialize()
+ for i, region in ipairs(Wrapper.headerComplex) do
+ region:Show()
+ end
+end
+
+local Scroller_OnHide = function()
+ local self = Wrapper
+ Wrapper:UnregisterAllEvents()
+ Wrapper:SetScript('OnEvent', nil)
+ for i, region in ipairs(Wrapper.headerComplex) do
+ region:Hide()
+ end
+end
+
+local Scroller_OnMouseWheel = function(self, delta)
+ local r = Scroll:GetHeight() - Scroller:GetHeight()
+ local s = B.Conf.ObjectiveScroll - delta * floor(r/5+.5)
+ local from = self:GetVerticalScroll()
+ print('|cFF00FF00OnMouseWheel', 'scroll =', s)
+ if s >= r then
+ s = r
+ elseif s < 1 then
+ s = 0
+ end
+ self:SetVerticalScroll(s)
+ B.Conf.ObjectiveScroll = s
+ print('|cFF00FF00OnMouseWheel', 'from = ', from, 'scroll =', s, ' range =', r, 'current =', self:GetVerticalScroll())
+
+ mod.UpdateActionButtons('SCROLLING')
+end
+
+local UpdatePanelButton = function (self, state)
+ state = state and B.Conf.FrameState[state] or 1
+ local swatch = (state == 1) and self.openSwatch or self.closedSwatch
+ self:SetNormalTexture(swatch[1])
+ self:SetPushedTexture(swatch[2])
+ if #swatch >= 6 then
+ self:GetNormalTexture():SetTexCoord(swatch[3], swatch[4], swatch[5], swatch[6])
+ end
+ if #swatch == 10 then
+ self:GetPushedTexture():SetTexCoord(swatch[7], swatch[8], swatch[9], swatch[10])
+ end
+
+end
+
+local OnClick = {}
+OnClick.CloseButton = function(self)
+ Wrapper:Minimize()
+ UpdatePanelButton(self, self.parent)
+end
+
+OnClick.QuestMapButton = function()
+ ToggleWorldMap()
+end
+
+
+mod.InitializeWidgets = function()
+ --- tracker scroll
+ Scroller:SetScript('OnMouseWheel', Scroller_OnMouseWheel)
+ Scroller:SetScript('OnShow', Scroller_OnShow)
+ Scroller:SetScript('OnHide', Scroller_OnHide)
+ for name, swatch in pairs(panelButtons) do
+ local source = swatch and swatch or panelButtons.CloseButton
+ local button = Wrapper[name]
+ button.parent = swatch.parent
+ button.openSwatch = source.openSwatch
+ button.closedSwatch = source.closedSwatch
+ if OnClick[name] then
+ button:SetScript('OnClick', OnClick[name])
+ end
+ UpdatePanelButton(button, button.parent)
+ end
+end
+
+----------------------------------------------------------------------------------------
+--- XML and script code lifted from "QuestKing 2" by Barjack,
+--- found at http://mods.curse.com/addons/wow/questking
+----------------------------------------------------------------------------------------
+local usedButtons = mod.Quest.itemButtons
+local freeButtons = mod.Quest.freeButtons
+mod.SetItemButton = function(block, info)
+ local itemInfo = info.specialItem
+ if not itemInfo then
+ return
+ end
+
+ --- Quest.GetInfo().specialItem :: {link = link, charges = charges, icon = icon, start = start, duration = duration, enable = enable}
+
+
+ local itemButton
+ if not info.itemButton then
+ if #freeButtons >= 1 then
+ print(' |cFF00FFFFfound a free button')
+ itemButton = freeButtons[#freeButtons]
+ freeButtons[#freeButtons] = nil
+ if itemButton.block then
+ itemButton.block.itemButton = nil
+ itemButton.block = nil
+ end
+ else
+ local buttonIndex = mod.Quest.numButtons + #freeButtons + 1
+ itemButton = CreateFrame('Button', 'VeneerQuestItemButton' .. buttonIndex, UIParent, 'VeneerItemButtonTemplate')
+ itemButton.buttonIndex = buttonIndex
+ itemButton:SetSize(36, 36)
+ itemButton:GetNormalTexture():SetSize(36 * (5/3), 36 * (5/3))
+ print(' |cFFFF4400starting new button', itemButton:GetName())
+ end
+ mod.Quest.numButtons = mod.Quest.numButtons + 1
+ else
+ itemButton = info.itemButton
+ print(' |cFF00FF00found assigned button', itemButton:GetName())
+
+ end
+ -- set values
+
+ info.itemButton = itemButton
+ usedButtons[info.questID] = itemButton
+ print(' |cFF8800FFassigning|r', itemButton:GetName(), 'to quest|cFF00FF00', info.questID, '|rat|cFFFFFF00', block:GetName(),'|r')
+
+ for k,v in pairs(usedButtons) do
+ print('|cFFFF44DD'..k..'|r', v:GetName())
+ end
+
+ itemButton:SetAttribute("type", "item")
+ itemButton:SetAttribute("item", itemInfo.link)
+
+ itemButton.questID = info.questID
+ itemButton.questLogIndex = info.questLogIndex
+ itemButton.charges = itemInfo.charges
+ itemButton.rangeTimer = -1
+ itemButton.block = block
+
+ SetItemButtonTexture(itemButton, itemInfo.icon)
+ SetItemButtonCount(itemButton, itemInfo.charges)
+ Veneer_QuestObjectiveItem_UpdateCooldown(itemButton);
+
+ return itemButton
+end
+--- Clear an itemButton from the given block
+mod.FreeItemButtons = function(block)
+
+ if block.itemButton then
+ local itemButton = block.itemButton
+ if itemButton.questID ~= block.info.questID then
+ block.itemButton = nil
+ itemButton.block = mod.Quest.InfoBlock[itemButton.questID]
+ else
+ itemButton.block = nil
+ itemButton:Hide()
+
+ usedButtons[itemButton.questID] = nil
+ freeButtons[#freeButtons + 1] = itemButton
+ mod.Quest.numButtons = mod.Quest.numButtons - 1
+ print('|cFFFF0088released', itemButton:GetName(),'and', block:GetName())
+ end
+ end
+end
+
+function Veneer_QuestObjectiveItem_OnUpdate (self, elapsed)
+ -- Handle range indicator
+ local rangeTimer = self.rangeTimer
+ if (rangeTimer) then
+ rangeTimer = rangeTimer - elapsed
+ if (rangeTimer <= 0) then
+ local link, item, charges, showItemWhenComplete = GetQuestLogSpecialItemInfo(self.questLogIndex)
+ if ((not charges) or (charges ~= self.charges)) then
+ mod:Update()
+ return
+ end
+
+ local count = self.HotKey
+ local valid = IsQuestLogSpecialItemInRange(self.questLogIndex)
+ if (valid == 0) then
+ count:Show()
+ count:SetVertexColor(1.0, 0.1, 0.1)
+ elseif (valid == 1) then
+ count:Show()
+ count:SetVertexColor(0.6, 0.6, 0.6)
+ else
+ count:Hide()
+ end
+ rangeTimer = TOOLTIP_UPDATE_TIME
+ end
+
+ self.rangeTimer = rangeTimer
+ end
+end
+
+function Veneer_QuestObjectiveItem_UpdateCooldown (itemButton)
+ local start, duration, enable = GetQuestLogSpecialItemCooldown(itemButton.questLogIndex)
+ if (start) then
+ CooldownFrame_SetTimer(itemButton.Cooldown, start, duration, enable)
+ if (duration > 0 and enable == 0) then
+ SetItemButtonTextureVertexColor(itemButton, 0.4, 0.4, 0.4)
+ else
+ SetItemButtonTextureVertexColor(itemButton, 1, 1, 1)
+ end
+ end
+end
+
+-----------------------------------------
+-- Criteria frames
+
+--[[
+ text = description,
+ type = type,
+ finished = completed,
+ quantity = quantity,
+ requiredQuantity = requiredQuantity,
+ characterName = characterName,
+ flags = flags,
+ assetID = assetID,
+ quantityString = quantityString,
+ criteriaID = criteriaID,
+]]
+local newWidgetID = 0
+mod.WidgetRegistry = {}
+local wr = mod.WidgetRegistry
+
+--- Get a usable widget for the given achievement criteria set.
+-- Returns a frame object with dimensioning parameters needed to size the receiving tracker block
+mod.SetWidget = function(line, data, objectiveType, objectiveKey)
+ local print = B.print('ObjectiveWidgets')
+ local widgetType = objectiveType
+ local widget
+ if wr[widgetType] and wr[widgetType].used[objectiveKey] then
+ widget = wr[widgetType].used[objectiveKey]
+ print('|cFF00FF00Updating ('..objectiveKey..')', widget)
+ elseif not wr[widgetType] or #wr[widgetType].free == 0 then
+ widget = CreateFrame('Frame', 'VeneerObjective' .. widgetType .. (wr[widgetType] and (wr[widgetType].lastn+1) or (1)), VeneerObjectiveScroll, 'VeneerObjectiveCriteria' .. widgetType)
+
+ print('|cFFFF0088Creating `'..widget:GetName()..'` id', wr[widgetType].lastn)
+ else
+ widget = tremove(wr[widgetType].free)
+ print('|cFFFFFF00Acquiring released widget', widget:GetName())
+ end
+
+
+ wr[widgetType].used[objectiveKey] = widget
+ widget.line = line
+ widget.objective = data
+ widget.key = objectiveKey
+ mod.InitializeWidget(widget)
+ return widget
+end
+
+--- WidgetTemplate 'OnLoad'
+mod.RegisterWidget = function(frame)
+ local print = B.print('ObjectiveWidgets')
+ local widgetType = frame.widgetType
+ if not wr[frame.widgetType] then
+ print('|cFFFF4400[[WidgetTemplate]]|r', widgetType)
+ wr[widgetType] = { lastn = 1, free = {}, used = {}, usedIndex = {}, freeIndex = {} }
+ else
+ print('|cFF0088FF+ [[WidgetTemplate]]r', widgetType, wr[widgetType].lastn)
+ wr[widgetType].lastn = wr[widgetType].lastn + 1
+ end
+end
+
+--- WidgetTemplate 'OnShow'
+mod.InitializeWidget = setmetatable({}, {
+ __call = function(t, frame)
+ -- todo: config pull
+
+ frame:SetWidth(mod.Conf.Wrapper.Width - mod.Conf.Style.Format.status.Indent * 2)
+ frame:SetScript('OnEvent', mod.UpdateWidget[frame.widgetType])
+ frame:RegisterEvent('TRACKED_ACHIEVEMENT_UPDATE')
+ frame:RegisterEvent('TRACKED_ACHIEVEMENT_LIST_CHANGED')
+ frame:RegisterEvent('CRITERIA_UPDATE')
+ frame:RegisterEvent('CRITERIA_COMPLETE')
+ frame:RegisterEvent('CRITERIA_EARNED')
+ t[frame.widgetType](frame)
+ mod.UpdateWidget[frame.widgetType](frame)
+ end,
+})
+
+--- WidgetTemplate 'OnEvent'
+mod.UpdateWidget = setmetatable({}, {
+ __call = function(t, frame)
+ if not frame.widgetType then
+ error('Invalid widget template, needs .widgetType')
+ return
+ end
+
+ return t[frame.widgetType](frame)
+ end
+})
+
+--- WidgetTemplate 'OnHide'
+mod.ReleaseWidget = function(frame)
+ --[[
+ local print = B.print('ObjectiveWidgets')
+ local reg = wr[frame.widgetType]
+ if reg and reg.used[frame.key] then
+ reg.used[frame.key] = nil
+ frame.line = nil
+ frame.info = nil
+ frame:UnregisterAllEvents()
+ tinsert(reg.free, frame)
+ print('|cFFBBBBBBreleased from service', frame:GetName())
+ end
+ ]]
+end
+
+--- RemoveTrackedAchievement post-hook
+mod.CleanWidgets = function()
+ local print = B.print('ObjectiveWidgets')
+ local tracked = {GetTrackedAchievements() }
+ local tasks = GetTasksTable()
+ for type, reg in pairs(mod.WidgetRegistry) do
+ print('collecting', type)
+ for key, frame in pairs(reg.used) do
+ if frame.objective.cheevID then
+ local id = frame.objective.cheevID
+
+ if id and not tContains(tracked, id) then
+
+ print(' untracked achievement', id, 'associated with', key, frame:GetName())
+ frame:Hide()
+ end
+ elseif frame.objective.questID then
+ -- do something for quest task
+ end
+ end
+ end
+end
+
+
+
+mod.defaults.WidgetStyle = {
+
+}
+
+local progressHeight = 16
+local progressBorder = 1
+local progressIndent = 3
+local progressFont = _G.VeneerCriteriaFontNormal
+
+
+mod.InitializeWidget.ProgressBar = function(self)
+ local c = mod.Conf.Wrapper
+ self.height = progressHeight + c.TextSpacing
+ self.width = c.Width - c.TextSpacing
+ self.indent = progressIndent
+
+ self:SetHeight(progressHeight)
+ self.bg:SetHeight(progressHeight)
+ self.bg:SetWidth(self.width)
+ self.fg:ClearAllPoints()
+ self.fg:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', progressBorder, progressBorder)
+ self.fg:SetHeight(progressHeight - progressBorder * 2)
+ self.status:SetFontObject(progressFont)
+ self.status:SetText(self.objective.quantityString)
+end
+
+mod.UpdateWidget.ProgressBar = function (self)
+ local quantity, requiredQuantity = self.objective.value, self.objective.maxValue
+ print('update vals:')
+ for k,v in pairs(self.line) do
+ print(k, v)
+ end
+
+ if self.line.format then
+ self.status:SetFormattedText(self.line.format, quantity, requiredQuantity)
+ end
+
+ local progress = (quantity / requiredQuantity)
+ if progress >= 1 then
+ self.fg:Show()
+ self.fg:SetWidth(self.width - progressBorder * 2)
+ elseif progress > 0 then
+ self.fg:Show()
+ print('color:', 1-progress*2 , progress*2 - 1,0,1)
+ print('width:', (self.width -progressBorder * 2) * progress)
+ self.fg:SetTexture(1-progress*2 , progress*2,0,1)
+ self.fg:SetWidth((self.width -progressBorder * 2) * progress)
+ else
+ self.fg:Hide()
+ end
+end
+
+
+mod.InitializeWidget.Hidden = function (self)
+ self.height = 0
+end
+mod.UpdateWidget.Hidden = function (self)
+ self.height= 0
+end
\ No newline at end of file
diff -r 9b3fa734abff -r e837384ac363 ObjectiveTracker/ObjectiveWidgets.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ObjectiveTracker/ObjectiveWidgets.xml Sun Apr 10 04:35:32 2016 -0400
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+ self.widgetType = 'ProgressBar'
+ Veneer.ObjectiveTracker.RegisterWidget(self)
+
+
+ Veneer.ObjectiveTracker.InitializeWidget(self)
+
+
+ Veneer.ObjectiveTracker.ReleaseWidget(self)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ self.widgetType = 'Event'
+ self.lines = 1
+ Veneer.ObjectiveTracker.RegisterWidget(self)
+
+
+ Veneer.ObjectiveTracker.InitializeWidget(self)
+
+
+ Veneer.ObjectiveTracker.ReleaseWidget(self)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ self.widgetType = 'Hidden'
+ self.lines = 0
+ Veneer.ObjectiveTracker.RegisterWidget(self)
+
+
+ Veneer.ObjectiveTracker.InitializeWidget(self)
+
+
+ Veneer.ObjectiveTracker.ReleaseWidget(self)
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r 9b3fa734abff -r e837384ac363 ObjectiveTracker/QuestTracker.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ObjectiveTracker/QuestTracker.lua Sun Apr 10 04:35:32 2016 -0400
@@ -0,0 +1,307 @@
+local B = select(2,...).frame
+local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
+local _G, ipairs, max, min, unpack, floor, pairs, tostring, type, band = _G, ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band
+local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText
+local Default, Quest = T.DefaultHandler, T.Quest
+local format = format
+local print = B.print('Tracker')
+local lprint = B.print('Line')
+
+local colors = T.colors
+Quest.UpdateObjectives = function(handler, block)
+ local print = lprint
+ print('|cFF00FFFFUpdateObjectives()')
+ local info = block.info
+
+ local titlebg, textbg = colors.default.titlebg, colors.default.textbg
+ print((info.isAccount and 'isAccount' or ''), (info.isFaction and 'isFaction' or ''), (info.isDaily and 'isDaily' or ''), (info.isWeekly and 'isWeekly' or ''), info.tagID, info.tagName)
+
+ if info.isAccount then
+ if info.isFaction then
+ print(' faction', info.tagID)
+ titlebg, textbg = colors['faction_'..info.tagID].titlebg, colors.default.textbg
+ else
+ print(' account', info.isAccount, info.isFaction)
+ titlebg, textbg = colors.account.titlebg, colors.account.textbg
+ end
+ elseif info.isDaily then
+ print(' daily', info.frequency)
+ titlebg, textbg = colors.daily.titlebg, colors.daily.textbg
+ elseif info.isWeekly then
+ print(' weekly', info.frequency)
+ titlebg, textbg = colors.weekly.titlebg, colors.weekly.textbg
+ end
+
+ block.titlebg:SetGradientAlpha(unpack(titlebg))
+ block.statusbg:SetGradientAlpha(unpack(textbg))
+
+ local completionText
+ if info.isAutoComplete then
+ local questID, popupType = GetAutoQuestPopUp(info.questLogIndex)
+ if popupType == 'COMPLETE' then
+ print(' :: auto-complete quest :: set the message')
+ info.completionText = CLICK_TO_COMPLETE
+ end
+ end
+ if info.isComplete then
+ if not completionText or info.completionText then
+ info.completionText = GetQuestLogCompletionText(info.questLogIndex)
+ end
+ print(' :: complete quest :: show instruction: "'.. tostring(info.completionText) .. '"')
+ end
+
+ Default.UpdateObjectives(handler, block)
+end
+
+Quest.UpdateLine = function(handler, block, line, data)
+ local print = lprint
+ local objectiveType = data.type
+ local r, g, b, a = 0, 1, 1, 1
+
+ line.progress = 0
+ if data.finished then
+ line.progress = 2
+ r, g, b, a = 0, 1, 0, 1
+ elseif objectiveType == 'monster' then
+ r, g, b, a = 1, .55, .2, 1
+ elseif objectiveType == 'item' then
+ r, g, b, a = .8, .8, .8, 1
+ elseif objectiveType == 'object' then
+ r, g, b, a = 1, 1, 1, 1
+ elseif objectiveType == 'player' then
+ r, g, b, a = 0, 0.8, 1, 1
+ end
+ print(format(' |cFF%02X%02X%02X%0.1f, %0.1f, %0.1f|r', (r * 255), g * 255, b * 255, r, g, b))
+
+ line.displayColor = {r, g, b, a}
+ line.status:SetTextColor(r, g, b, a)
+ line.displayText = data.text
+
+ return line
+end
+
+-----------------------------
+--- QUEST
+Quest.itemButtons = {}
+Quest.freeButtons = {}
+Quest.POI = {}
+Quest.QuestBlock = {}
+Quest.LogBlock = {}
+Quest.LogInfo = {}
+
+function Quest:GetNumWatched ()
+ print(self.name, self)
+ self.numAll = GetNumQuestLogEntries()
+ self.numWatched = GetNumQuestWatches()
+ return self.numWatched, self.numAll
+end
+Quest.GetInfo = function (self, watchIndex)
+ print('|cFF00DDFFQuest|r.|cFF0088FFGetInfo(|r'.. tostring(watchIndex)..'|r)')
+ local questID, title, questIndex, numObjectives, requiredMoney, isComplete,
+ startEvent, isAutoComplete, failureTime, timeElapsed, questType, isTask, isStory, isOnMap, hasLocalPOI = GetQuestWatchInfo(watchIndex)
+
+ if not questIndex then
+ return
+ end
+
+ local _, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, _, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questIndex)
+
+
+ if not questID then
+ return
+ end
+ Quest.Info[questID] = Quest.Info[questID] or {}
+
+ local q = Quest.Info[questID]
+ q.watchIndex = watchIndex
+ q.type = 'Quest'
+ q.questID = questID
+ q.title = title
+ q.level = level
+ q.displayQuestID = displayQuestID
+ q.suggestedGroup = suggestedGroup
+ q.questLogIndex = questIndex
+ q.numObjectives = numObjectives
+ q.requiredMoney = requiredMoney
+ q.isComplete = isComplete
+ q.startEvent = startEvent
+ q.isAutoComplete = isAutoComplete
+ q.failureTime = failureTime
+ q.timeElapsed = timeElapsed
+ q.questType = questType
+ q.isTask = isTask
+ q.isStory = isStory
+ q.isOnMap = isOnMap
+ q.hasLocalPOI = hasLocalPOI
+ q.frequency = frequency
+ q.isComplete = isComplete
+ q.isStory = isStory
+ q.isTask = isTask
+
+ --- resolve icon type and template
+ local questTagID, tagName = GetQuestTagInfo(questID)
+ local tagID
+
+ local factionGroup = GetQuestFactionGroup(questID);
+ if( questTagID and questTagID == QUEST_TAG_ACCOUNT ) then
+ if( factionGroup ) then
+ tagID = "ALLIANCE";
+ if ( factionGroup == LE_QUEST_FACTION_HORDE ) then
+ tagID = "HORDE";
+ end
+ q.isFaction = true
+ else
+ tagID = QUEST_TAG_ACCOUNT;
+ q.isAccount = true
+ end
+ q.typeTag = QUEST_TAG_TCOORDS[tagID]
+ elseif ( factionGroup) then
+ tagID = "ALLIANCE";
+ if ( factionGroup == LE_QUEST_FACTION_HORDE ) then
+ tagID = "HORDE";
+ end
+ q.isFaction = true
+ end
+
+ if( frequency == LE_QUEST_FREQUENCY_DAILY and (not isComplete or isComplete == 0) ) then
+ tagID = "DAILY";
+ q.frequencyTag = QUEST_TAG_TCOORDS["DAILY"]
+ q.isDaily = true
+ elseif( frequency == LE_QUEST_FREQUENCY_WEEKLY and (not isComplete or isComplete == 0) )then
+ tagID = "WEEKLY";
+ q.frequencyTag = QUEST_TAG_TCOORDS["WEEKLY"]
+ q.isWeekly = true
+ elseif( questTagID ) then
+ tagID = questTagID;
+ end
+
+ if ( isComplete and isComplete < 0 ) then
+ q.completionTag = QUEST_TAG_TCOORDS["FAILED"]
+ q.isFailed = true
+ elseif isComplete then
+ q.completionTag = QUEST_TAG_TCOORDS["COMPLETED"]
+ end
+
+
+ q.tagID = questTagID
+ q.tagName = tagName
+
+
+
+ --q.isBreadCrumb = isBreadCrumb
+ q.completionText= GetQuestLogCompletionText(questIndex)
+ q.numObjectives = GetNumQuestLeaderBoards(questIndex)
+ q.objectives = {}
+ for i = 1, q.numObjectives do
+ local text, type, finished = GetQuestLogLeaderBoard(i, questIndex)
+ print(format(' #%d %s %s %s', i, tostring(type), tostring(text), tostring(finished)))
+ q.objectives[i] = {
+ index = i,
+ type = type,
+ text = text,
+ finished = finished
+ }
+ if type == 'event' then
+ elseif type == 'monster' then
+ elseif type == 'object' then
+ elseif type == 'reputation' then
+ elseif type == 'item' then
+ end
+ end
+
+ if requiredMoney >= 1 then
+ local money = GetMoney()
+ local moneyText = money
+ local requiredSilver, requiredCopper
+ local requiredGold = (requiredMoney > 10000) and (floor(requiredMoney/10000)) or nil
+ if mod(requiredMoney, 10000) ~= 0 then
+ requiredSilver = (requiredMoney > 100) and (mod(requiredMoney, 10000) / 100) or nil
+ if mod(requiredMoney, 100) ~= 0 then
+ requiredCopper = mod(requiredMoney, 100)
+ end
+ end
+
+ -- round the money value down
+ if requiredMoney > 9999 and not (requiredSilver or requiredCopper) then
+ moneyText = floor(money/10000)
+ elseif requiredMoney < 10000 and mod(requiredMoney,100) == 0 then
+ moneyText = floor(money/100)
+ end
+
+ local text = moneyText
+ local index = #q.objectives + 1
+ local finished = (GetMoney() >= requiredMoney)
+
+ if not finished then
+ text = text .. ' / ' .. GetCoinTextureString(requiredMoney, 12)
+ else
+ text = '' .. GetCoinTextureString(requiredMoney, 12)
+ end
+ q.objectives[index] = {
+ index = index,
+ type = 'progressbar',
+ quantity = money,
+ requiredQuantity = requiredMoney,
+ text = text,
+ finished = finished
+ }
+ print(format(' #%d %s %s %s', index, 'money', text, tostring(finished)))
+ end
+
+
+ local link, icon, charges = GetQuestLogSpecialItemInfo(questIndex)
+ local start, duration, enable = GetQuestLogSpecialItemCooldown(questIndex)
+ if link or icon or charges then
+ q.specialItem = {
+ questID = questID,
+ questIndex = questIndex,
+ link = link,
+ charges = charges,
+ icon = icon,
+ start = start,
+ duration = duration,
+ enable = enable,
+ }
+ end
+
+ if QuestHasPOIInfo(questID) then
+ local distance, onContinent = GetDistanceSqToQuest(questIndex)
+ if distance ~= nil and distance > 0 then
+ self.POI[questIndex] = {
+ questIndex = questIndex,
+ questID = questID,
+ distance = distance,
+ onContinent = onContinent
+ }
+ end
+ end
+
+
+ q.selected = (questID == GetSuperTrackedQuestID()) -- call directly so artifact data doesn't become an issue
+ self.WatchInfo[watchIndex] = q
+ self.LogInfo[questIndex] = q
+ print('- logIndex =', questIndex, 'title =', title)
+ return q
+end
+
+Quest.GetClosest = function()
+ local minID, minTitle
+ local minDist = math.huge
+ local numQuests = GetNumQuestLogEntries()
+ for questIndex = 1, numQuests do
+ local distance, onContinent = GetDistanceSqToQuest(questIndex)
+ local title, level, _, _, _, _, _, _, questID = GetQuestLogTitle(questIndex)
+ if onContinent and distance < minDist then
+ minDist = distance
+ minTitle = title
+ minID = questID
+ end
+ end
+
+ print('nearest quest is', minTitle, 'by', math.sqrt(minDist))
+ return minID, minTitle, minDist
+end
+
+Quest.OnTurnIn = function(self, questID, xp, money)
+
+end
\ No newline at end of file
diff -r 9b3fa734abff -r e837384ac363 ObjectiveTracker/XPTracker.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ObjectiveTracker/XPTracker.lua Sun Apr 10 04:35:32 2016 -0400
@@ -0,0 +1,92 @@
+--- ${PACKAGE_NAME}
+-- @file-author@
+-- @project-revision@ @project-hash@
+-- @file-revision@ @file-hash@
+-- Created: 4/6/2016 4:44 AM
+
+local B = select(2,...).frame
+local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
+local tostring = tostring
+local UnitLevel, IsResting, UnitXP, UnitXPMax, GetXPExhaustion, IsXPUserDisabled = UnitLevel, IsResting, UnitXP, UnitXPMax, GetXPExhaustion, IsXPUserDisabled
+local Wrapper = _G.VeneerObjectiveWrapper
+local print = B.print('XPTracker')
+
+mod.InitializeXPTracker = function()
+ local XPBar = Wrapper.XPBar
+ if UnitLevel('player') == 100 then
+ XPBar:Hide()
+ return
+ end
+
+ --- xp bar
+ XPBar:SetWidth(mod.Conf.Wrapper.WrapperWidth - Wrapper.CloseButton:GetWidth())
+ XPBar.statusbg:SetAllPoints(XPBar)
+ XPBar:RegisterEvent('DISABLE_XP_GAIN')
+ XPBar:RegisterEvent('ENABLE_XP_GAIN')
+ XPBar:SetScript('OnEvent', mod.UpdateXP)
+
+ if not IsXPUserDisabled() then
+ mod.EnableXP(XPBar)
+ else
+ mod.DisableXP(XPBar)
+ end
+
+ mod.UpdateXP(XPBar)
+end
+
+mod.EnableXP = function(self)
+ self:RegisterEvent('PLAYER_XP_UPDATE')
+ self:RegisterEvent('PLAYER_LEVEL_UP')
+ self:RegisterEvent('PLAYER_UPDATE_RESTING')
+ self.statusbg:SetTexture(0,0,0,.25)
+ self:Show()
+end
+
+mod.DisableXP = function(self)
+ self:UnregisterEvent('PLAYER_XP_UPDATE')
+ self:UnregisterEvent('PLAYER_LEVEL_UP')
+ self:UnregisterEvent('PLAYER_UPDATE_RESTING')
+ self.statusbg:SetTexture(0.5,0.5,0.5,0.5)
+ self:Hide()
+end
+
+mod.UpdateXP = function(self, event)
+ if event == 'DISABLE_XP_GAIN' then
+ mod.DisableXP(self)
+ elseif event == 'ENABLE_XP_GAIN' then
+ mod.EnableXP(self)
+ end
+
+ if not IsXPUserDisabled() then
+
+ local xp = UnitXP('player')
+ local xpmax = UnitXPMax('player')
+ local rest = GetXPExhaustion()
+ self.foreground:SetWidth((xp/xpmax) * self:GetWidth())
+ if rest then
+ self.rested:ClearAllPoints()
+ if xp == 0 then
+ self.rested:SetPoint('TOPLEFT', self, 'TOPLEFT', 0, 0)
+ else
+ self.rested:SetPoint('TOPLEFT', self.fg, 'TOPRIGHT', 0, 0)
+ end
+
+ if (xp + rest) > xpmax then
+ self.rested:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', 0, 0)
+ else
+ self.rested:SetWidth((rest/xpmax) * self:GetWidth())
+ end
+ self.rested:SetPoint('BOTTOM', self, 'BOTTOM')
+ self.rested:Show()
+ else
+ self.rested:Hide()
+ end
+
+ if IsResting() then
+ self.statusbg:SetTexture(.2,.8,.2,.5)
+ else
+ self.statusbg:SetTexture(0,0,0,.25)
+ end
+ self.xpText:SetText(xp .. '/'.. xpmax .. (rest and (' ('..tostring(rest)..')') or ''))
+ end
+end
\ No newline at end of file
diff -r 9b3fa734abff -r e837384ac363 ObjectiveUI.lua
--- a/ObjectiveUI.lua Sat Apr 09 07:32:45 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
---- ${PACKAGE_NAME}
--- @file-author@
--- @project-revision@ @project-hash@
--- @file-revision@ @file-hash@
--- Created: 3/29/2016 7:07 PM
-local B = select(2,...).frame
-local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
-local print = B.print('Objectives')
-local Default, AutoQuest, Quest, Cheevs = mod.DefaultHandler, mod.AutoQuest, mod.Quest, mod.Cheevs
-local itemButtonSize, itemButtonSpacing = 36, 1
-local tremove, tremovebyval = table.remove, table.removebyval
-
---------------------------------------------------------------------
---- Functions responsible for:
---- - UI interactions that propagate to the BlizzardUI (sending RemoveQuestWatch() on remove quest action)
---- -
---------------------------------------------------------------------
-
-Default.Select = function(self) end
-Default.Open = function(self) end
-Default.Remove = function(self) end
-Default.Report = function(self)
- print('Stats:', self.numWatched,'items tracked,', self.numBlocks,'blocks assigned.')
-end
-
-Default.OnMouseUp = function(self, button)
- print(self.handler.name, self.mainStyle, self.subStyle)
- if button == 'LeftButton' then
- if IsModifiedClick("CHATLINK") and ChatEdit_GetActiveWindow() then
- self:Link()
- elseif IsModifiedClick("QUESTWATCHTOGGLE") then
- self:Remove()
- else
- self:Select()
- end
- elseif button == 'RightButton' then
- self:Open()
- end
- self.initialButton = nil
- self.modChatLink = nil
- self.modQuestWatch = nil
- mod:Update(self.handler.updateReasonModule)
- print('|cFFFF8800'..tostring(self:GetName())..':MouseUp()|r')
-end
-
-Default.OnMouseDown = function(self, button)
- print(IsModifiedClick("CHATLINK"), IsModifiedClick("QUESTWATCHTOGGLE"))
- print(self.info.title)
-end
-
-
-AutoQuest.Select = function(self)
- if self.info.popupType == 'OFFER' then
- ShowQuestOffer(self.info.questIndex)
- else
- ShowQuestComplete(self.info.questIndex)
- end
- RemoveAutoQuestPopUp(self.info.questID)
-end
-
-Quest.Select = function(self)
- if self.info.isAutoComplete and self.info.isComplete then
- ShowQuestComplete(self.info.questLogIndex)
- else
- SetSuperTrackedQuestID(self.info.questID)
- end
-end
-
-Quest.Link = function(self)
- local questLink = GetQuestLink(block.questLogIndex);
- if ( questLink ) then
- ChatEdit_InsertLink(questLink);
- end
-end
-Quest.Open = function(self)
- QuestMapFrame_OpenToQuestDetails(self.info.questID)
-end
-
-Quest.Remove = function(self)
- print('removing', self.info.questLogIndex, 'from watcher')
- RemoveQuestWatch(self.info.questLogIndex)
-end
-
-
------------------------------
---- CHEEVS
-Cheevs.Select = function(self)
- --mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT)
-end
-Cheevs.Remove = function(self)
- RemoveTrackedAchievement(self.info.cheevID)
-end
-Cheevs.OnMouseUp = function(self, button)
- Default.OnMouseUp(self, button)
-end
-Cheevs.Link = function(self)
- local achievementLink = GetAchievementLink(self.info.cheevID);
- if ( achievementLink ) then
- ChatEdit_InsertLink(achievementLink);
- end
-end
-
-Cheevs.Open = function(self)
- if ( not AchievementFrame ) then
- AchievementFrame_LoadUI();
- end
- if ( not AchievementFrame:IsShown() ) then
- AchievementFrame_ToggleAchievementFrame();
- end
- AchievementFrame_SelectAchievement(self.info.cheevID);
-end
-
-local Bonus = mod.Bonus
-Bonus.Select = function(self, questID)
- Bonus:OnTurnIn(self.info.questID, 0, 30800)
-end
-Bonus.Remove = function(self, questID)
-end
\ No newline at end of file
diff -r 9b3fa734abff -r e837384ac363 ObjectiveWidgets.lua
--- a/ObjectiveWidgets.lua Sat Apr 09 07:32:45 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,439 +0,0 @@
-local B = select(2,...).frame
-local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
-local print = B.print('WidgetFactory')
-local UIParent = UIParent
-local GetQuestLogSpecialItemInfo, IsQuestLogSpecialItemInRange, GetQuestLogSpecialItemCooldown = GetQuestLogSpecialItemInfo, IsQuestLogSpecialItemInRange, GetQuestLogSpecialItemCooldown
-local CooldownFrame_SetTimer, SetItemButtonTextureVertexColor, CreateFrame, VeneerObjectiveScroll = CooldownFrame_SetTimer, SetItemButtonTextureVertexColor, CreateFrame, VeneerObjectiveScroll
-local tremove, tinsert, tContains, pairs, setmetatable = tremove, tinsert, tContains, pairs, setmetatable
-
---- frame refs
-local Wrapper = _G.VeneerObjectiveWrapper
-local Scroller = Wrapper.scrollArea
-local CloseButton = Wrapper.CloseButton
-local QuestMapButton = Wrapper.QuestMapButton
-local Scroll = _G.VeneerObjectiveScroll
-
-local panelButtons = {
- CloseButton = {
- closedSwatch = {
- [[Interface\Buttons\UI-Panel-QuestHideButton]],
- [[Interface\Buttons\UI-Panel-QuestHideButton]],
- 0, 0.5, 0.5, 1,
- 0.5, 1, 0.5, 1,
- },
- openSwatch = {
- [[Interface\Buttons\UI-Panel-QuestHideButton]],
- [[Interface\Buttons\UI-Panel-QuestHideButton]],
- 0.5, 1, 0.5, 1,
- 0, 0.5, 0.5, 1,
- },
- parent = 'VeneerObjectiveWrapper'
- },
- QuestMapButton = {
- closedSwatch = {
- [[Interface\QUESTFRAME\UI-QUESTMAP_BUTTON]],
- [[Interface\QUESTFRAME\UI-QUESTMAP_BUTTON]],
- 0, 1, 0.5, 1,
- 0, 1, 0, 0.5,
- },
- openSwatch = {
- [[Interface\QUESTFRAME\UI-QUESTMAP_BUTTON]],
- [[Interface\QUESTFRAME\UI-QUESTMAP_BUTTON]],
- 0, 1, 0, 0.5,
- 0, 1, 0.5, 1,
- }
- }
-}
-
-local Scroller_OnShow = function()
- Wrapper.watchMoneyReasons = 0;
- --mod:Update()
- --mod:OnInitialize()
- for i, region in ipairs(Wrapper.headerComplex) do
- region:Show()
- end
-end
-
-local Scroller_OnHide = function()
- local self = Wrapper
- Wrapper:UnregisterAllEvents()
- Wrapper:SetScript('OnEvent', nil)
- for i, region in ipairs(Wrapper.headerComplex) do
- region:Hide()
- end
-end
-
-local Scroller_OnMouseWheel = function(self, delta)
- local r = Scroll:GetHeight() - Scroller:GetHeight()
- local s = B.Conf.ObjectiveScroll - delta * floor(r/5+.5)
- local from = self:GetVerticalScroll()
- print('|cFF00FF00OnMouseWheel', 'scroll =', s)
- if s >= r then
- s = r
- elseif s < 1 then
- s = 0
- end
- self:SetVerticalScroll(s)
- B.Conf.ObjectiveScroll = s
- print('|cFF00FF00OnMouseWheel', 'from = ', from, 'scroll =', s, ' range =', r, 'current =', self:GetVerticalScroll())
-
- mod.UpdateActionButtons('SCROLLING')
-end
-
-local UpdatePanelButton = function (self, state)
- state = state and B.Conf.FrameState[state] or 1
- local swatch = (state == 1) and self.openSwatch or self.closedSwatch
- self:SetNormalTexture(swatch[1])
- self:SetPushedTexture(swatch[2])
- if #swatch >= 6 then
- self:GetNormalTexture():SetTexCoord(swatch[3], swatch[4], swatch[5], swatch[6])
- end
- if #swatch == 10 then
- self:GetPushedTexture():SetTexCoord(swatch[7], swatch[8], swatch[9], swatch[10])
- end
-
-end
-
-local OnClick = {}
-OnClick.CloseButton = function(self)
- Wrapper:Minimize()
- UpdatePanelButton(self, self.parent)
-end
-
-OnClick.QuestMapButton = function()
- ToggleWorldMap()
-end
-
-
-mod.InitializeWidgets = function()
- --- tracker scroll
- Scroller:SetScript('OnMouseWheel', Scroller_OnMouseWheel)
- Scroller:SetScript('OnShow', Scroller_OnShow)
- Scroller:SetScript('OnHide', Scroller_OnHide)
- for name, swatch in pairs(panelButtons) do
- local source = swatch and swatch or panelButtons.CloseButton
- local button = Wrapper[name]
- button.parent = swatch.parent
- button.openSwatch = source.openSwatch
- button.closedSwatch = source.closedSwatch
- if OnClick[name] then
- button:SetScript('OnClick', OnClick[name])
- end
- UpdatePanelButton(button, button.parent)
- end
-end
-
-----------------------------------------------------------------------------------------
---- XML and script code lifted from "QuestKing 2" by Barjack,
---- found at http://mods.curse.com/addons/wow/questking
-----------------------------------------------------------------------------------------
-local usedButtons = mod.Quest.itemButtons
-local freeButtons = mod.Quest.freeButtons
-mod.SetItemButton = function(block, info)
- local itemInfo = info.specialItem
- if not itemInfo then
- return
- end
-
- --- Quest.GetInfo().specialItem :: {link = link, charges = charges, icon = icon, start = start, duration = duration, enable = enable}
-
-
- local itemButton
- if not info.itemButton then
- if #freeButtons >= 1 then
- print(' |cFF00FFFFfound a free button')
- itemButton = freeButtons[#freeButtons]
- freeButtons[#freeButtons] = nil
- if itemButton.block then
- itemButton.block.itemButton = nil
- itemButton.block = nil
- end
- else
- local buttonIndex = mod.Quest.numButtons + #freeButtons + 1
- itemButton = CreateFrame('Button', 'VeneerQuestItemButton' .. buttonIndex, UIParent, 'VeneerItemButtonTemplate')
- itemButton.buttonIndex = buttonIndex
- itemButton:SetSize(36, 36)
- itemButton:GetNormalTexture():SetSize(36 * (5/3), 36 * (5/3))
- print(' |cFFFF4400starting new button', itemButton:GetName())
- end
- mod.Quest.numButtons = mod.Quest.numButtons + 1
- else
- itemButton = info.itemButton
- print(' |cFF00FF00found assigned button', itemButton:GetName())
-
- end
- -- set values
-
- info.itemButton = itemButton
- usedButtons[info.questID] = itemButton
- print(' |cFF8800FFassigning|r', itemButton:GetName(), 'to quest|cFF00FF00', info.questID, '|rat|cFFFFFF00', block:GetName(),'|r')
-
- for k,v in pairs(usedButtons) do
- print('|cFFFF44DD'..k..'|r', v:GetName())
- end
-
- itemButton:SetAttribute("type", "item")
- itemButton:SetAttribute("item", itemInfo.link)
-
- itemButton.questID = info.questID
- itemButton.questLogIndex = info.questLogIndex
- itemButton.charges = itemInfo.charges
- itemButton.rangeTimer = -1
- itemButton.block = block
-
- SetItemButtonTexture(itemButton, itemInfo.icon)
- SetItemButtonCount(itemButton, itemInfo.charges)
- Veneer_QuestObjectiveItem_UpdateCooldown(itemButton);
-
- return itemButton
-end
---- Clear an itemButton from the given block
-mod.FreeItemButtons = function(block)
-
- if block.itemButton then
- local itemButton = block.itemButton
- if itemButton.questID ~= block.info.questID then
- block.itemButton = nil
- itemButton.block = mod.Quest.InfoBlock[itemButton.questID]
- else
- itemButton.block = nil
- itemButton:Hide()
-
- usedButtons[itemButton.questID] = nil
- freeButtons[#freeButtons + 1] = itemButton
- mod.Quest.numButtons = mod.Quest.numButtons - 1
- print('|cFFFF0088released', itemButton:GetName(),'and', block:GetName())
- end
- end
-end
-
-function Veneer_QuestObjectiveItem_OnUpdate (self, elapsed)
- -- Handle range indicator
- local rangeTimer = self.rangeTimer
- if (rangeTimer) then
- rangeTimer = rangeTimer - elapsed
- if (rangeTimer <= 0) then
- local link, item, charges, showItemWhenComplete = GetQuestLogSpecialItemInfo(self.questLogIndex)
- if ((not charges) or (charges ~= self.charges)) then
- mod:Update()
- return
- end
-
- local count = self.HotKey
- local valid = IsQuestLogSpecialItemInRange(self.questLogIndex)
- if (valid == 0) then
- count:Show()
- count:SetVertexColor(1.0, 0.1, 0.1)
- elseif (valid == 1) then
- count:Show()
- count:SetVertexColor(0.6, 0.6, 0.6)
- else
- count:Hide()
- end
- rangeTimer = TOOLTIP_UPDATE_TIME
- end
-
- self.rangeTimer = rangeTimer
- end
-end
-
-function Veneer_QuestObjectiveItem_UpdateCooldown (itemButton)
- local start, duration, enable = GetQuestLogSpecialItemCooldown(itemButton.questLogIndex)
- if (start) then
- CooldownFrame_SetTimer(itemButton.Cooldown, start, duration, enable)
- if (duration > 0 and enable == 0) then
- SetItemButtonTextureVertexColor(itemButton, 0.4, 0.4, 0.4)
- else
- SetItemButtonTextureVertexColor(itemButton, 1, 1, 1)
- end
- end
-end
-
------------------------------------------
--- Criteria frames
-
---[[
- text = description,
- type = type,
- finished = completed,
- quantity = quantity,
- requiredQuantity = requiredQuantity,
- characterName = characterName,
- flags = flags,
- assetID = assetID,
- quantityString = quantityString,
- criteriaID = criteriaID,
-]]
-local newWidgetID = 0
-mod.WidgetRegistry = {}
-local wr = mod.WidgetRegistry
-
---- Get a usable widget for the given achievement criteria set.
--- Returns a frame object with dimensioning parameters needed to size the receiving tracker block
-mod.SetWidget = function(line, data, objectiveType, objectiveKey)
- local print = B.print('ObjectiveWidgets')
- local widgetType = objectiveType
- local widget
- if wr[widgetType] and wr[widgetType].used[objectiveKey] then
- widget = wr[widgetType].used[objectiveKey]
- print('|cFF00FF00Updating ('..objectiveKey..')', widget)
- elseif not wr[widgetType] or #wr[widgetType].free == 0 then
- widget = CreateFrame('Frame', 'VeneerObjective' .. widgetType .. (wr[widgetType] and (wr[widgetType].lastn+1) or (1)), VeneerObjectiveScroll, 'VeneerObjectiveCriteria' .. widgetType)
-
- print('|cFFFF0088Creating `'..widget:GetName()..'` id', wr[widgetType].lastn)
- else
- widget = tremove(wr[widgetType].free)
- print('|cFFFFFF00Acquiring released widget', widget:GetName())
- end
-
-
- wr[widgetType].used[objectiveKey] = widget
- widget.line = line
- widget.objective = data
- widget.key = objectiveKey
- mod.InitializeWidget(widget)
- return widget
-end
-
---- WidgetTemplate 'OnLoad'
-mod.RegisterWidget = function(frame)
- local print = B.print('ObjectiveWidgets')
- local widgetType = frame.widgetType
- if not wr[frame.widgetType] then
- print('|cFFFF4400[[WidgetTemplate]]|r', widgetType)
- wr[widgetType] = { lastn = 1, free = {}, used = {}, usedIndex = {}, freeIndex = {} }
- else
- print('|cFF0088FF+ [[WidgetTemplate]]r', widgetType, wr[widgetType].lastn)
- wr[widgetType].lastn = wr[widgetType].lastn + 1
- end
-end
-
---- WidgetTemplate 'OnShow'
-mod.InitializeWidget = setmetatable({}, {
- __call = function(t, frame)
- -- todo: config pull
-
- frame:SetWidth(mod.Conf.Wrapper.Width - mod.Conf.Style.Format.status.Indent * 2)
- frame:SetScript('OnEvent', mod.UpdateWidget[frame.widgetType])
- frame:RegisterEvent('TRACKED_ACHIEVEMENT_UPDATE')
- frame:RegisterEvent('TRACKED_ACHIEVEMENT_LIST_CHANGED')
- frame:RegisterEvent('CRITERIA_UPDATE')
- frame:RegisterEvent('CRITERIA_COMPLETE')
- frame:RegisterEvent('CRITERIA_EARNED')
- t[frame.widgetType](frame)
- mod.UpdateWidget[frame.widgetType](frame)
- end,
-})
-
---- WidgetTemplate 'OnEvent'
-mod.UpdateWidget = setmetatable({}, {
- __call = function(t, frame)
- if not frame.widgetType then
- error('Invalid widget template, needs .widgetType')
- return
- end
-
- return t[frame.widgetType](frame)
- end
-})
-
---- WidgetTemplate 'OnHide'
-mod.ReleaseWidget = function(frame)
- --[[
- local print = B.print('ObjectiveWidgets')
- local reg = wr[frame.widgetType]
- if reg and reg.used[frame.key] then
- reg.used[frame.key] = nil
- frame.line = nil
- frame.info = nil
- frame:UnregisterAllEvents()
- tinsert(reg.free, frame)
- print('|cFFBBBBBBreleased from service', frame:GetName())
- end
- ]]
-end
-
---- RemoveTrackedAchievement post-hook
-mod.CleanWidgets = function()
- local print = B.print('ObjectiveWidgets')
- local tracked = {GetTrackedAchievements() }
- local tasks = GetTasksTable()
- for type, reg in pairs(mod.WidgetRegistry) do
- print('collecting', type)
- for key, frame in pairs(reg.used) do
- if frame.objective.cheevID then
- local id = frame.objective.cheevID
-
- if id and not tContains(tracked, id) then
-
- print(' untracked achievement', id, 'associated with', key, frame:GetName())
- frame:Hide()
- end
- elseif frame.objective.questID then
- -- do something for quest task
- end
- end
- end
-end
-
-
-
-mod.defaults.WidgetStyle = {
-
-}
-
-local progressHeight = 16
-local progressBorder = 1
-local progressIndent = 3
-local progressFont = _G.VeneerCriteriaFontNormal
-
-
-mod.InitializeWidget.ProgressBar = function(self)
- local c = mod.Conf.Wrapper
- self.height = progressHeight + c.TextSpacing
- self.width = c.Width - c.TextSpacing
- self.indent = progressIndent
-
- self:SetHeight(progressHeight)
- self.bg:SetHeight(progressHeight)
- self.bg:SetWidth(self.width)
- self.fg:ClearAllPoints()
- self.fg:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', progressBorder, progressBorder)
- self.fg:SetHeight(progressHeight - progressBorder * 2)
- self.status:SetFontObject(progressFont)
- self.status:SetText(self.objective.quantityString)
-end
-
-mod.UpdateWidget.ProgressBar = function (self)
- local quantity, requiredQuantity = self.objective.value, self.objective.maxValue
- print('update vals:')
- for k,v in pairs(self.line) do
- print(k, v)
- end
-
- if self.line.format then
- self.status:SetFormattedText(self.line.format, quantity, requiredQuantity)
- end
-
- local progress = (quantity / requiredQuantity)
- if progress >= 1 then
- self.fg:Show()
- self.fg:SetWidth(self.width - progressBorder * 2)
- elseif progress > 0 then
- self.fg:Show()
- print('color:', 1-progress*2 , progress*2 - 1,0,1)
- print('width:', (self.width -progressBorder * 2) * progress)
- self.fg:SetTexture(1-progress*2 , progress*2,0,1)
- self.fg:SetWidth((self.width -progressBorder * 2) * progress)
- else
- self.fg:Hide()
- end
-end
-
-
-mod.InitializeWidget.Hidden = function (self)
- self.height = 0
-end
-mod.UpdateWidget.Hidden = function (self)
- self.height= 0
-end
\ No newline at end of file
diff -r 9b3fa734abff -r e837384ac363 ObjectiveWidgets.xml
--- a/ObjectiveWidgets.xml Sat Apr 09 07:32:45 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-
-
-
-
-
-
-
- self.widgetType = 'ProgressBar'
- Veneer.ObjectiveTracker.RegisterWidget(self)
-
-
- Veneer.ObjectiveTracker.InitializeWidget(self)
-
-
- Veneer.ObjectiveTracker.ReleaseWidget(self)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- self.widgetType = 'Event'
- self.lines = 1
- Veneer.ObjectiveTracker.RegisterWidget(self)
-
-
- Veneer.ObjectiveTracker.InitializeWidget(self)
-
-
- Veneer.ObjectiveTracker.ReleaseWidget(self)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- self.widgetType = 'Hidden'
- self.lines = 0
- Veneer.ObjectiveTracker.RegisterWidget(self)
-
-
- Veneer.ObjectiveTracker.InitializeWidget(self)
-
-
- Veneer.ObjectiveTracker.ReleaseWidget(self)
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff -r 9b3fa734abff -r e837384ac363 Veneer.toc
--- a/Veneer.toc Sat Apr 09 07:32:45 2016 -0400
+++ b/Veneer.toc Sun Apr 10 04:35:32 2016 -0400
@@ -10,4 +10,4 @@
## OptionalDeps: Devian
Core.xml
BuffFrame.xml
-ObjectiveTracker.xml
\ No newline at end of file
+ObjectiveTracker\ObjectiveTracker.xml
\ No newline at end of file
diff -r 9b3fa734abff -r e837384ac363 XPTracker.lua
--- a/XPTracker.lua Sat Apr 09 07:32:45 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
---- ${PACKAGE_NAME}
--- @file-author@
--- @project-revision@ @project-hash@
--- @file-revision@ @file-hash@
--- Created: 4/6/2016 4:44 AM
-
-local B = select(2,...).frame
-local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
-local tostring = tostring
-local UnitLevel, IsResting, UnitXP, UnitXPMax, GetXPExhaustion, IsXPUserDisabled = UnitLevel, IsResting, UnitXP, UnitXPMax, GetXPExhaustion, IsXPUserDisabled
-local Wrapper = _G.VeneerObjectiveWrapper
-local print = B.print('XPTracker')
-
-mod.InitializeXPTracker = function()
- local XPBar = Wrapper.XPBar
- if UnitLevel('player') == 100 then
- XPBar:Hide()
- return
- end
-
- --- xp bar
- XPBar:SetWidth(mod.Conf.Wrapper.WrapperWidth - Wrapper.CloseButton:GetWidth())
- XPBar.statusbg:SetAllPoints(XPBar)
- XPBar:RegisterEvent('DISABLE_XP_GAIN')
- XPBar:RegisterEvent('ENABLE_XP_GAIN')
- XPBar:SetScript('OnEvent', mod.UpdateXP)
-
- if not IsXPUserDisabled() then
- mod.EnableXP(XPBar)
- else
- mod.DisableXP(XPBar)
- end
-
- mod.UpdateXP(XPBar)
-end
-
-mod.EnableXP = function(self)
- self:RegisterEvent('PLAYER_XP_UPDATE')
- self:RegisterEvent('PLAYER_LEVEL_UP')
- self:RegisterEvent('PLAYER_UPDATE_RESTING')
- self.statusbg:SetTexture(0,0,0,.25)
- self:Show()
-end
-
-mod.DisableXP = function(self)
- self:UnregisterEvent('PLAYER_XP_UPDATE')
- self:UnregisterEvent('PLAYER_LEVEL_UP')
- self:UnregisterEvent('PLAYER_UPDATE_RESTING')
- self.statusbg:SetTexture(0.5,0.5,0.5,0.5)
- self:Hide()
-end
-
-mod.UpdateXP = function(self, event)
- if event == 'DISABLE_XP_GAIN' then
- mod.DisableXP(self)
- elseif event == 'ENABLE_XP_GAIN' then
- mod.EnableXP(self)
- end
-
- if not IsXPUserDisabled() then
-
- local xp = UnitXP('player')
- local xpmax = UnitXPMax('player')
- local rest = GetXPExhaustion()
- self.foreground:SetWidth((xp/xpmax) * self:GetWidth())
- if rest then
- self.rested:ClearAllPoints()
- if xp == 0 then
- self.rested:SetPoint('TOPLEFT', self, 'TOPLEFT', 0, 0)
- else
- self.rested:SetPoint('TOPLEFT', self.fg, 'TOPRIGHT', 0, 0)
- end
-
- if (xp + rest) > xpmax then
- self.rested:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', 0, 0)
- else
- self.rested:SetWidth((rest/xpmax) * self:GetWidth())
- end
- self.rested:SetPoint('BOTTOM', self, 'BOTTOM')
- self.rested:Show()
- else
- self.rested:Hide()
- end
-
- if IsResting() then
- self.statusbg:SetTexture(.2,.8,.2,.5)
- else
- self.statusbg:SetTexture(0,0,0,.25)
- end
- self.xpText:SetText(xp .. '/'.. xpmax .. (rest and (' ('..tostring(rest)..')') or ''))
- end
-end
\ No newline at end of file