# HG changeset patch
# User Nenue
# Date 1483313126 18000
# Node ID caded26687015b95a545e994a9e84c8a752343d7
# Parent d41c7dc3012f0b5d4bef2bec38308e5db0630dfd
Curseforge migration and source tree cleaning
diff -r d41c7dc3012f -r caded2668701 Constants.lua
--- a/Constants.lua Tue Oct 25 12:33:20 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,347 +0,0 @@
---- ${PACKAGE_NAME}
--- @file-author@
--- @project-revision@ @project-hash@
--- @file-revision@ @file-hash@
--- Created: 3/22/2016 3:14 PM
-local _, A = ...
-local B = A.frame
-
------------------------
--- Buff frames metadata
------------------------
-local legendAlpha = 0.5
-B.displays.BuffButton = {
- legendColor = {0, 1, 0, legendAlpha},
- maxIcons = BUFF_MAX_DISPLAY,
- actualIcons = function () return _G.BUFF_ACTUAL_DISPLAY end,
- buffName = 'BuffButton',
- drawCount = {},
- filters = 'HELPFUL',
- anchorTemplate = 'VeneerAnchorTemplate',
-}
-B.displays.DebuffButton = {
- legendColor = {1, 0, 0, legendAlpha},
- maxIcons = DEBUFF_MAX_DISPLAY,
- actualIcons = function () return _G.DEBUFF_ACTUAL_DISPLAY end,
- buffName = 'DebuffButton',
- drawCount = {},
- filters = 'HARMFUL',
- anchorTemplate = 'VeneerAnchorTemplate',
-}
-B.displays.TempEnchant = {
- legendColor = {1, 0, 0.5, legendAlpha},
- maxIcons = NUM_TEMP_ENCHANT_FRAMES,
- actualIcons = function () return BuffFrame.numEnchants end,
- buffName = 'TempEnchant',
- drawCount = {},
- anchorTemplate = 'VeneerAnchorTemplate',
-}
-B.displays.ConsolidatedBuff = {
- legendColor = {0.5, 0.5, 0.5, legendAlpha},
- maxIcons = 9,
- actualIcons = function() return select(2, GetRaidBuffInfo()) end,
- buffName = 'ConsolidatedBuff',
- anchorTemplate = 'VeneerConsolidatedBuffsAnchor',
- buffTemplate = 'VeneerRaidBuffTemplate',
- drawCount = {},
- filters = 'HELPFUL',
-}
-
------------------------
--- RaidBuff visual args
------------------------
-B.BuffStyles = {
- ["active"] = {
- SetDesaturated = false,
- Color = {1, 1, 1, 1},
- SetBlendMode = 'BLEND',
- TextColor = {1,1,1,1},
- },
- ["missing"] = {
- SetDesaturated = false,
- Color = {1, 0, 0, 0.5},
- SetBlendMode = 'ADD',
- TextColor = {1,0,0,1},
- },
- ["available"] = {
- SetDesaturated = true,
- Color = {0.35, 1, 0.35, 0.5},
- SetBlendMode = 'ADD',
- TextColor = {1, 1, 0, 1},
- },
-}
-
---- RaidBuff availability criteria
--- @field spellID - UnitAura() == true
--- @field spec - test for spec choice
--- @field auraType - UnitAura() == true, and no other tests of the same value have returned true prior
--- @field talent - test for talent selection
--- @field petFamily - test pet family
--- @field [true] - passive group aura
-B.ClassRaidBuffs = {
- -- stats
- [1] = {
- ['HUNTER'] = {
- {talent = {155228}, spellID = 160206, spellName = 'Lone Wolf: Power of the Primates', auraType = 'lonewolf'},
- {petFamily = 'Dog'}, -- active pet family
- {petFamily = 'Gorilla'},
- {petFamily = 'Shale Spider'},
- {petFamily = 'Worm'},
- },
- ['DRUID'] = {
- {spellID = 1126, spellName = 'Mark of the Wild'},
- },
- ['MONK'] = {
- {spellID = 115921, spellName = 'Legacy of the Emperor'},
- {spellID = 116781, spellName = 'Legacy of the White Tiger'} -- windwalker, replaces emperor internally
- },
- ['PALADIN'] = {spellID = 20217, spellName = 'Blessing of Kings', auraType = 'blessing'},
- },
-
- -- stamina
- [2] = {
- ['HUNTER'] = {
- {talent = {155228}, spellID = 160199, spellName = 'Lone Wolf: Fortitude of the Bear', auraType = 'lonewolf'},
- {petFamily = 'Bear'}, -- active pet family
- {petFamily = 'Goat'},
- {petFamily = 'Rylak'},
- {petFamily = 'Silithid'},
- },
- ['PRIEST'] = {
- {spellID = 21562, 'Power Word: Fortitude'}
- },
- ['WARRIOR'] = {
- {spellID = 469, spellName = 'Commanding Shout', auraType = 'shout'}
- },
- ['WARLOCK'] = {
- {true}
- }
- },
-
- -- attack power
- [3] = {
- ['HUNTER'] = {
- {true},
- },
- ['DEATHKNIGHT'] = {
- {spec = 2},
- {spec = 3},
- },
- ['WARRIOR'] = {
- {spellName = 'Battle Shout', auraType = 'shout'}
- }
- },
-
- -- HASTE
- [4] = {
- ['HUNTER'] = {
- {talent = {155228}, spellID = 160203, spellName = 'Lone Wolf: Haste of the Hyena', auraType = 'lonewolf'},
- {petFamily = 'Hyena'}, -- active pet family
- {petFamily = 'Sporebat'},
- {petFamily = 'Rylak'},
- {petFamily = 'Wasp'},
- },
- ['DEATHKNIGHT'] = {
- {spec = 2}, -- unholy aura
- {spec = 3},
- },
- ['PRIEST'] = {
- {spec = 3}, -- mind quickening
- },
- ['ROGUE'] = {
- true -- swiftblade's
- },
- ['SHAMAN'] = {
- true -- grace of air
- },
- },
-
- -- SPELL POWER
- [5] = {
- ['HUNTER'] = {
- {talent = {155228}, spellID = 160205, spellName = 'Lone Wolf: Wisdom of the Serpent', auraType = 'lonewolf'},
- {petFamily = 'Waterstrider'}, -- active pet family
- {petFamily = 'Serpent'},
- {petFamily = 'Silithid'},
- },
- ['MAGE'] = {
- {spellID = 1459, spellName = 'Arcane Brilliance'}, -- arcane brilliance
- {spellID = 61316, spellName = 'Dalaran Brilliance'}, -- dalaran brilliance
- },
- ['WARLOCK'] = {
- {spellID = 109773,spellName = 'Dark Intent' }
- },
- },
-
- -- CRITICAL STRIKE
- [6] = {
- ['HUNTER'] = {
- {talent = {155228}, spellID = 160200, spellName = 'Lone Wolf: Ferocity of the Raptor', auraType = 'lonewolf'},
- {petFamily = 'Devilsaur'}, -- active pet family
- {petFamily = 'Quilen'},
- {petFamily = 'Raptor'},
- {petFamily = 'Shale Spider'},
- {petFamily = 'Waterstrider'},
- {petFamily = 'Wolf'},
- },
- ['DRUID'] = {
- {spec = 2, spellID = 17007, auraType = 'druidform'}
- },
- ['MAGE'] = {
- {spellID = 1459, spellName = 'Arcane Brilliance'}, -- arcane brilliance
- {spellID = 61316, spellName = 'Dalaran Brilliance'}, -- dalaran brilliance
- },
- ['MONK'] = {
- {spellID = 116781, spellName = 'Legacy of the White Tiger', spec = 2} -- windwalker
- }
- },
-
- -- MASTERY
- [7] = {
- ['HUNTER'] = {
- {talent = {155228}, spellID = 160198, spellName = 'Lone Wolf: Grace of the Cat', auraType = 'lonewolf'},
- {petFamily = 'Cat'}, -- active pet family
- {petFamily = 'Hydra'},
- {petFamily = 'Spirit Beast'},
- {petFamily = 'Tallstrider'},
- },
- ['DEATHKNIGHT'] = {
- {spec = 1}
- },
- ['DRUID'] = {
- {spec = 1, spellID = 24907, auraType = 'druidform'},
- },
- ['PALADIN'] = {
- {spec = 1, spellID = 19740, spellName = 'Blessing of Might', auraType = 'blessing'}
- },
- ['SHAMAN'] = {true},
- },
-
- -- MULTISTRIKE
- [8] = {
- ['HUNTER'] = {
- {talent = {155228}, spellID = 172968, spellName = 'Lone Wolf: Quickness of the Dragonhawk', auraType = 'lonewolf'},
- {petFamily = 'Bat'}, -- active pet family
- {petFamily = 'Clefthoof'},
- {petFamily = 'Corehound'},
- {petFamily = 'Dragonhawk'},
- {petFamily = 'Wind Serpent'},
- },
- ['MONK'] = {
- {spec = 2 }
- }, -- Windflurry,
- ['PRIEST'] = {
- {spec = 3 }
- }, -- quickening,
- ['ROGUE'] = {true}, -- swiftblade's
- ['WARLOCK'] = {
- {spellID = 109773,spellName = 'Dark Intent' }
- },
- },
-
- -- VERSATILITY
- [9] = {
- ['HUNTER'] = {
- {talent = {155228}, spellID = 172967, spellName = 'Lone Wolf: Versatility of the Ravager', auraType = 'lonewolf'},
- {petFamily = 'Ravager'}, -- active pet family
- {petFamily = 'Boar'},
- {petFamily = 'Porcupine'},
- {petFamily = 'Clefthoof'},
- {petFamily = 'Stag'},
- {petFamily = 'Worm'},
- {petFamily = 'Bird of Prey'},
- },
- ['DEATH KNIGHT'] = {
- {spec = 2}, -- unholy aura
- {spec = 3},
- },
- ['DRUID'] = {
- {spellID = 1126, spellName = 'Mark of the Wild'},
- },
- ['PALADIN'] = {
- {spec = 2}, -- retribution
- },
- ['WARRIOR'] = {
- {spec = 2}, -- arms or fury
- {spec = 3},
- },
- }
-}
-
--------------------------
--- Default config values
--------------------------
-B.ConfDefaults = {
- -- defaulted to on for first-time setup
- ConfigMode = true,
- GuidesMode = true,
-
- BuffButtonAnchor = {'TOPRIGHT', 'UIParent', 'TOPRIGHT', -200, -5},
- BuffButtonMax = 24,
- BuffButtonPerRow = 10,
- BuffButtonSize = 50,
- BuffButtonSpacing = 4,
- BuffButtonZoom = 15,
- BuffButtonVertexColor = {},
- BuffButtonPoint = {'TOPRIGHT', 'TOPRIGHT'},
- BuffButtonDurationSize = 16,
- BuffButtonDurationPoint = {'BOTTOM', 'BOTTOM', 0, -1},
- BuffButtonCountSize = 18,
- BuffButtonCountPoint = {'TOPRIGHT', 'TOPRIGHT', -3, -3},
- BuffButtonRelativeX = -1,
- BuffButtonRelativeY = -1,
-
- BuffButtonColor = {1, 1, 1, 1},
- BuffButtonPlayerColor = {1,1,1,1},
- BuffButtonRaidColor = {0.25,1,0.25,1},
- BuffButtonBossColor = {1,0.5,0,1},
- BuffButtonBorder = 1,
-
- BuffButtonWarningFade = true,
- BuffButtonShowSelfCast = true,
-
- DebuffButtonAnchor = {'TOPRIGHT', 'UIParent', 'TOPRIGHT', -200, -200},
- DebuffButtonMax = 12,
- DebuffButtonPerRow = 10,
- DebuffButtonSize = 50,
- DebuffButtonSpacing = 4,
- DebuffButtonDurationSize = 16,
- DebuffButtonZoom = 15,
- DebuffButtonVertexColor = {},
- DebuffButtonPoint = {'TOPRIGHT','TOPRIGHT'},
- DebuffButtonRelativeX = -1,
- DebuffButtonRelativeY = -1,
-
-
- TempEnchantAnchor = {'TOPRIGHT', 'UIParent', 'TOPRIGHT', -200, -300},
- TempEnchantMax = 2,
- TempEnchantPerRow = 10,
- TempEnchantSize = 50,
- TempEnchantSpacing = 4,
- TempEnchantDurationSize = 16,
- TempEnchantZoom = 15,
- TempEnchantVertexColor = {},
- TempEnchantPoint = {'TOPRIGHT', 'TOPRIGHT'},
- TempEnchantRelativeX = -1,
- TempEnchantRelativeY = -1,
- TempEnchantColor = {1,0,0.5,1},
-
- ConsolidatedBuffAnchor = {'TOPRIGHT', 'UIParent', 'TOPRIGHT', 0, 0},
- ConsolidatedBuffIcon = false,
- ConsolidatedBuffMax = 9,
- ConsolidatedBuffSize = 16,
- ConsolidatedBuffParent = 'BuffButton',
- ConsolidatedBuffPosition = 1,
- ConsolidatedBuffSpacing = 1,
- ConsolidatedBuffBorder = 0,
- ConsolidatedBuffPerRow = 3,
- ConsolidatedBuffPoint = {'TOPRIGHT', 'TOPRIGHT'},
- ConsolidatedBuffRelativeX = -1,
- ConsolidatedBuffRelativeY = -1,
- ConsolidatedBuffDurationSize = 0,
- ConsolidatedBuffDurationPoint = {'BOTTOM', 'BOTTOM', 0, 0},
- ConsolidatedBuffCountPoint = {'BOTTOM', 'BOTTOM', 0, 0},
-
- RaidShowMissing = true,
-
-}
\ No newline at end of file
diff -r d41c7dc3012f -r caded2668701 Modules/BuffFrame.lua
--- a/Modules/BuffFrame.lua Tue Oct 25 12:33:20 2016 -0400
+++ b/Modules/BuffFrame.lua Sun Jan 01 18:25:26 2017 -0500
@@ -133,7 +133,7 @@
end
region:Hide()
- tprint('|cFF0088FFborder:SetVertexColor|r', r,g,b,a)
+ --tprint('|cFF0088FFborder:SetVertexColor|r', r,g,b,a)
self.progress.fg:SetColorTexture(r,g,b,a)
self.border:SetColorTexture(r,g,b,a)
self.border:Show()
@@ -157,17 +157,17 @@
end)
else
hooksecurefunc(region, method, function(self,...)
- tprint('|cFF0088FF'.. self:GetName().. ':', method)
+ --tprint('|cFF0088FF'.. self:GetName().. ':', method)
self:ClearAllPoints()
veneer:Show()
veneer[method](veneer, ...)
if self:GetName():match('Debuff.+Count') then
- print('|cFF00FFFF'.. self:GetName().. ':'.. method, '->', veneer:GetName()..':'..method..'(', ...,')')
- print(veneer:IsVisible(),veneer:GetStringWidth(),veneer:GetText())
- print(veneer:GetTop(), veneer:GetLeft())
- print(veneer:GetPoint(1))
+ --print('|cFF00FFFF'.. self:GetName().. ':'.. method, '->', veneer:GetName()..':'..method..'(', ...,')')
+ --print(veneer:IsVisible(),veneer:GetStringWidth(),veneer:GetText())
+ --print(veneer:GetTop(), veneer:GetLeft())
+ --print(veneer:GetPoint(1))
end
end)
@@ -180,11 +180,12 @@
local frame = self.Buttons[target]
if not (self.Buttons[target]) then
+
local name = target:GetName()
local id = target:GetID()
print('|cFF88FF00Creating', name,'Veneer')
+ frame = vn:Acquire(target, 'VeneerBuffTemplate')
- frame = vn:Acquire(target, 'VeneerBuffTemplate')
frame.progress[OFFSET_PARALLELS[PROGRESS_ANCHOR][3]](frame.progress, BUFF_PROGRESS_SIZE + (BUFF_PROGRESS_INSET * 2))
print(BUFF_PROGRESS_SIZE + (BUFF_PROGRESS_INSET * 2))
@@ -241,7 +242,7 @@
hooksecurefunc("BuffFrame_Update", function(...) self:OnBuffFrameUpdate(...) end)
- hooksecurefunc("AuraButton_UpdateDuration", function(...) self:OnUpdateDuration(...) end)
+ --hooksecurefunc("AuraButton_UpdateDuration", function(...) self:OnUpdateDuration(...) end)
hooksecurefunc("AuraButton_Update", function(...) self:OnAuraButton_Update(...) end)
hooksecurefunc("BuffFrame_UpdateAllBuffAnchors", function(...) self:OnUpdateAllBuffAnchors(...) end)
hooksecurefunc("TemporaryEnchantFrame_Update", function(...) self:OnTemporaryEnchantFrameUpdate(...) end)
@@ -251,6 +252,13 @@
end
end
+function VeneerBuffFrameMixin:SetHidden(region)
+ if not self.hiddenRegions[region] then
+ self.hiddenRegions[region] = true
+ region:SetShown(false)
+ hooksecurefunc(region)
+ end
+end
function VeneerBuffFrameMixin:SetupButton (name)
local frame = _G[name ]
@@ -287,9 +295,12 @@
veneer.border:Show()
end
- if count and count:GetText() then
+ if count then
count:ClearAllPoints()
- veneer.count:SetText(count:GetText())
+ hooksecurefunc(count, 'Show', function(self) self:Hide() end)
+ if count:GetText() then
+ veneer.count:SetText(count:GetText())
+ end
end
if duration then
duration:ClearAllPoints()
@@ -354,7 +365,7 @@
local nw = (w - (w * progress))
if veneer.elapsed >= 0.25 then
- tprint(t, startTime, floor(progress*100), w * progress, nw, w)
+ --tprint(t, startTime, floor(progress*100), w * progress, nw, w)
veneer.elapsed = 0.25 - veneer.elapsed
end
if (progress >= 1) or not frame:IsVisible() then
@@ -481,16 +492,15 @@
local debuff = _G['DebuffButton'..i]
if debuff then
numBuffs = numBuffs + 1
- if numBuffs == 1 then
- if topBuff then
- debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V)
- else
- debuff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -120, -6)
- end
- topBuff = debuff
- elseif mod(numBuffs, BUFFS_PER_ROW) == 1 then
- debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V)
- topBuff = debuff
+ if mod(numBuffs, BUFFS_PER_ROW) == 1 then
+
+ if topBuff then
+ debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V)
+ else
+ debuff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', BUFF_FRAMES_X, BUFF_FRAMES_Y)
+ end
+ topBuff = debuff
+
else
debuff:SetPoint('TOPRIGHT', lastBuff, 'TOPLEFT', -BUFF_BUTTON_SPACING_H, 0)
end
@@ -509,6 +519,9 @@
end
function VeneerBuffFrameMixin:UpdateConfigLayers (configMode)
self:SetShown(configMode)
+ for _, button in pairs(self.Buttons) do
+ button:SetShown(configMode)
+ end
end
function VeneerBuffFrameMixin:OnUpdateDuration (frame, timeLeft)
local veneer = self:Acquire(frame)
diff -r d41c7dc3012f -r caded2668701 Modules/ObjectiveTracker.lua
--- a/Modules/ObjectiveTracker.lua Tue Oct 25 12:33:20 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
--- Veneer
--- ObjectiveTracker.lua
--- Created: 8/16/2016 8:19 AM
--- %file-revision%
--- Fixes objective tracker positioning in relation to buff frame alterations
-
-local plugin = CreateFrame('Frame', 'VeneerObjectives', UIParent)
-local vn, print = LibStub("LibKraken").register(VeneerController, plugin)
-local ot
-local otvn
-
-local INSET_V = -20
-
-local GetVeneer = function()
-
- print('|cFFFF4400ObjectiveTracker_Initialize|r')
- otvn = vn.GetVeneer(ot)
- print(otvn:GetHeight())
-
-
- for i = 1, #ot.MODULES do
- print(i, ot.MODULES[i])
- end
- ot:ClearAllPoints()
- ot:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -5, -140)
-
- --vn.GetVeneer(ot):SetAllPoints(ot)
-end
-
-local UpdateVeneer = function()
- if not ot.initialized or not otvn then
- return
- end
-
-
-
- ot:ClearAllPoints()
- ot:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -5, -140)
-
-end
-
-local CreateVeneer = function()
- ot = ObjectiveTrackerFrame
- hooksecurefunc('ObjectiveTracker_Initialize', GetVeneer)
- hooksecurefunc('ObjectiveTracker_Update', UpdateVeneer)
-end
-
-plugin.init = function()
- if ObjectiveTrackerFrame then
- print('tracker is already loaded')
- CreateVeneer()
- else
- plugin:RegisterEvent('ADDON_LOADED')
- plugin.ADDON_LOADED = function(self, addon)
- if addon == 'Blizzard_ObjectiveTracker' then
- print('responding to blizzard tracker loadin')
- CreateVeneer()
- end
- end
- end
-end
-
diff -r d41c7dc3012f -r caded2668701 Modules/PaperDoll.lua
--- a/Modules/PaperDoll.lua Tue Oct 25 12:33:20 2016 -0400
+++ b/Modules/PaperDoll.lua Sun Jan 01 18:25:26 2017 -0500
@@ -3,248 +3,418 @@
-- Created: 8/16/2016 8:18 AM
-- %file-revision%
-- Displays the item level and modifications of character sheet equipment, including artifact power
+local print = DEVIAN_WORKSPACE and function(...) print('PaperDoll', ...) end or nop
-local plugin = CreateFrame('Frame', 'VeneerPaper', UIParent)
-local vn, print = LibStub("LibKraken").register(Veneer, plugin)
+local slot_overlays = {}
+VeneerPaperDollMixin = {
+ anchorFrame = 'CharacterFrame',
+ anchorPoint = 'TOPLEFT',
+ KnownRelics = {},
+}
+
+local relic_slot_paths = {
+ Arcane = {"Relic-Arcane-Slot", [[Interface\Artifacts\Artifacts.BLP]], 72, 72, 0.849609375, 0.919921875, 0.1181640625, 0.1884765625, false, false},
+ Blood = {"Relic-Blood-Slot", [[Interface\Artifacts\Artifacts.BLP]], 72, 72, 0.921875, 0.9921875, 0.1181640625, 0.1884765625, false, false},
+ Fel = {"Relic-Fel-Slot", [[Interface\Artifacts\Artifacts.BLP]], 72, 72, 0.59765625, 0.66796875, 0.572265625, 0.642578125, false, false},
+ Fire = {"Relic-Fire-Slot", [[Interface\Artifacts\Artifacts.BLP]], 72, 72, 0.669921875, 0.740234375, 0.572265625, 0.642578125, false, false},
+ Frost = {"Relic-Frost-Slot", [[Interface\Artifacts\Artifacts.BLP]], 72, 72, 0.7421875, 0.8125, 0.572265625, 0.642578125, false, false},
+ Holy = {"Relic-Holy-Slot", [[Interface\Artifacts\Artifacts.BLP]], 72, 72, 0.814453125, 0.884765625, 0.572265625, 0.642578125, false, false},
+ Iron = {"Relic-Iron-Slot", [[Interface\Artifacts\Artifacts.BLP]], 72, 72, 0.88671875, 0.95703125, 0.572265625, 0.642578125, false, false},
+ Life = {"Relic-Life-Slot", [[Interface\Artifacts\Artifacts.BLP]], 72, 72, 0.59765625, 0.66796875, 0.64453125, 0.71484375, false, false},
+ Shadow = {"Relic-Shadow-Slot", [[Interface\Artifacts\Artifacts.BLP]], 72, 72, 0.59765625, 0.66796875, 0.716796875, 0.787109375, false, false},
+ Water = {"Relic-Water-Slot", [[Interface\Artifacts\Artifacts.BLP]], 72, 72, 0.59765625, 0.66796875, 0.7890625, 0.859375, false, false},
+ Wind = {"Relic-Wind-Slot", [[Interface\Artifacts\Artifacts.BLP]], 72, 72, 0.59765625, 0.66796875, 0.861328125, 0.931640625, false, false},
+}
+
+local slots_left = {'TOPLEFT', 'TOPRIGHT', 1, 0, 'TOPLEFT', 'BOTTOMLEFT', 0, -1}
+local slots_right = {'TOPRIGHT', 'TOPLEFT', -1, 0, 'TOPRIGHT', 'BOTTOMRIGHT', 0, -1}
+local slots_bottomleft = {'BOTTOMRIGHT', 'TOPRIGHT', 0, 1, 'BOTTOMRIGHT', 'TOPRIGHT', 0, 1 }
+local slots_bottomright = {'BOTTOMLEFT', 'TOPLEFT', 0, -1, 'BOTTOMLEFT', 'TOPLEFT', 0, 1}
local slot_anchors = {
- [1] = 'TOPLEFT',
- [2] = 'TOPLEFT',
- [3] = 'TOPLEFT',
- [15] = 'TOPLEFT',
- [5] = 'TOPLEFT',
- [9] = 'TOPLEFT',
+ [1] = slots_left,
+ [2] = slots_left,
+ [3] = slots_left,
+ [15] = slots_left,
+ [5] = slots_left,
+ [9] = slots_left,
- [10] = 'TOPRIGHT',
- [6] = 'TOPRIGHT',
- [7] = 'TOPRIGHT',
- [8] = 'TOPRIGHT',
- [11] = 'TOPRIGHT',
- [12] = 'TOPRIGHT',
- [13] = 'TOPRIGHT',
- [14] = 'TOPRIGHT',
+ [10] = slots_right,
+ [6] = slots_right,
+ [7] = slots_right,
+ [8] = slots_right,
+ [11] = slots_right,
+ [12] = slots_right,
+ [13] = slots_right,
+ [14] = slots_right,
- [16] = 'BOTTOMRIGHT',
- [17] = 'BOTTOMLEFT',
+ [16] = slots_bottomleft,
+ [17] = slots_bottomright,
}
-local slot_relative = {
- [1] = 'TOPRIGHT',
- [2] = 'TOPRIGHT',
- [3] = 'TOPRIGHT',
- [15] = 'TOPRIGHT',
- [5] = 'TOPRIGHT',
- [9] = 'TOPRIGHT',
- [10] = 'TOPLEFT',
- [6] = 'TOPLEFT',
- [7] = 'TOPLEFT',
- [8] = 'TOPLEFT',
- [11] = 'TOPLEFT',
- [12] = 'TOPLEFT',
- [13] = 'TOPLEFT',
- [14] = 'TOPLEFT',
+function VeneerPaperDollMixin:OnLoad()
+ hooksecurefunc("PaperDollItemSlotButton_Update", function(...)
+ self:GetSlotButton(PaperDollItemsFrame, ...)
+ end)
- [16] = 'TOPRIGHT',
- [17] = 'TOPLEFT',
-}
-local ticker
-local vnslot = {}
-local pendingSlots = {}
+ hooksecurefunc("PaperDollFrame_UpdateStats", function(...)
+ self:GetStats(PaperDollItemsFrame, ...)
+ end)
+ self:RegisterEvent('ADDON_LOADED')
+ self:RegisterEvent('INSPECT_READY')
-local GetEquippedArtifactInfo = _G.C_ArtifactUI.GetEquippedArtifactInfo
-local GetCostForPointAtRank = _G.C_ArtifactUI.GetCostForPointAtRank
-local tooltip = CreateFrame('GameTooltip', 'VeneerTooltip', UIParent, 'GameTooltipTemplate')
-local jewel = {}
-
-local artifactBar_OnEvent = function (self)
- local itemID, altItemID, name, icon, totalXP, pointsSpent = GetEquippedArtifactInfo()
- if not itemID then
- self:Hide()
- return
- end
-
- local numRelicSlots = C_ArtifactUI.GetNumRelicSlots() or 0;
- for i = 1, numRelicSlots do
-
- end
-
- local pointsAvailable = 0
- local nextRankCost = GetCostForPointAtRank(pointsSpent + pointsAvailable) or 0
-
- while totalXP >= nextRankCost do
- totalXP = totalXP - nextRankCost
- pointsAvailable = pointsAvailable + 1
- nextRankCost = GetCostForPointAtRank(pointsSpent + pointsAvailable) or 0
- end
- self.Header:SetText(name)
- self.Level:SetText((pointsAvailable >= 1) and (pointsSpent .. ' ('.. pointsAvailable..')') or (pointsSpent))
- self.ProgressText:SetFormattedText("|cFF00FFFF%d|r / %d", totalXP, nextRankCost)
-
- self.ProgressBar:SetPoint('TOPRIGHT', self.ProgressBG, 'TOPLEFT', self:GetWidth()*(totalXP/nextRankCost), 0)
- self.ProgressBar:SetColorTexture(1,.5,0)
-
- self:Show()
+ self.SocketType = {}
end
-
-local artifactBar = CreateFrame('Frame', 'VnPaperDollArtifact', CharacterModelFrame, 'VeneerStatusBarTemplate')
-artifactBar:ClearAllPoints()
-artifactBar:SetHeight(28)
-artifactBar:SetPoint('LEFT', CharacterModelFrame, 'LEFT', 30, 0)
-artifactBar:SetPoint('RIGHT', CharacterModelFrame, 'RIGHT', -30, 0)
-artifactBar:SetPoint('BOTTOM', CharacterMainHandSlotFrame, 'TOP', 0, 1)
-artifactBar.ProgressBG:SetColorTexture(0.5, 0.5, 0.5)
-artifactBar.Header:Show()
-artifactBar:RegisterEvent('ARTIFACT_UPDATE')
-artifactBar:SetScript('OnEvent', artifactBar_OnEvent)
-
-plugin.artifactBar = artifactBar
-print(CharacterMainHandSlotFrame:GetPoint(1))
-print(artifactBar:GetPoint(3))
-
-for i = 1, 3 do
- local relicSlot = CreateFrame('Frame', 'VnPaperDollRelic'..i, artifactBar)
- relicSlot:SetSize(40,40)
- relicSlot:SetPoint('BOTTOM', artifactBar, 'TOP', (i-2)*40, 24)
- relicSlot.relicArt = relicSlot:CreateTexture(nil, 'BACKGROUND')
- artifactBar['RelicSlot'..i] = relicSlot
+function VeneerPaperDollMixin:SetupInspectFrame()
+ hooksecurefunc("InspectPaperDollItemSlotButton_Update", function(...)
+ self:GetSlotButton(InspectFrame, ...)
+ end)
+ self:RegisterEvent('INSPECT_READY')
+end
+function VeneerPaperDollMixin:SetupArtifactUI()
+ self:RegisterEvent('ARTIFACT_UPDATE')
end
+function VeneerPaperDollMixin:Setup()
+ VeneerData.PaperDoll = VeneerData.PaperDoll or {}
+ VeneerData.PaperDoll.KnownRelics = VeneerData.PaperDoll.KnownRelics or {}
+ self.KnownRelics = VeneerData.PaperDoll.KnownRelics
-artifactBar:EnableMouse(true)
-artifactBar:SetScript('OnMouseUp', function()
- SocketInventoryItem(16)
-end)
+ self:RegisterEvent('UNIT_INVENTORY_CHANGED')
+ self:RegisterEvent('PLAYER_EQUIPMENT_CHANGED')
+ self:RegisterEvent('PLAYER_SPECIALIZATION_CHANGED')
-local UpdateVeneer = function(itemslot, frame)
- local slot = itemslot:GetID()
- if itemslot.hasItem then
- local unit = frame.target.unit or 'player'
- frame.link = GetInventoryItemLink(unit, slot)
- tooltip:SetOwner(frame, 'ANCHOR_NONE')
- tooltip:SetInventoryItem(unit, slot)
- tooltip:Show()
- --print(tooltip:NumLines())
- if tooltip:NumLines() >= 3 then
-
- local ilvl
- if _G['VeneerTooltipTextLeft2'] then
- ilvl = _G['VeneerTooltipTextLeft2']:GetText():match("Item Level (%d+)")
- --print('l2', ilvl)
- end
-
- if _G['VeneerTooltipTextLeft3'] then
- if not ilvl then
- ilvl = _G['VeneerTooltipTextLeft3']:GetText():match("Item Level (%d+)")
- --print('l3', ilvl)
- end
- end
-
- if ilvl then
- frame.label:SetText(ilvl)
- end
- end
-
- local quality = GetInventoryItemQuality(unit, slot)
- if slot == 16 and quality == LE_ITEM_QUALITY_ARTIFACT then
- artifactBar_OnEvent(plugin.artifactBar)
- end
-
-
-
-
- frame:Show()
- else
- frame:Hide()
- end
+ self:MarkForUpdate()
end
-local UpdateNext = function(frame)
-
- plugin.next(function()
- print('updating', frame:GetName())
- UpdateVeneer(frame:GetParent(), frame)
- end)
-end
-
-
-local UpdateAll = function()
- for index, frame in pairs(vnslot) do
- if frame:IsVisible() then
- print('forcing', index, frame:GetName())
- UpdateNext(frame)
+function VeneerPaperDollMixin:MarkForUpdate()
+ for frame, overlays in pairs(slot_overlays) do
+ for slot, overlay in pairs(overlays) do
+ if overlay:IsVisible() then
+ overlay:Update()
+ else
+ overlay.isDirty = true
+ end
end
end
end
+function VeneerPaperDollMixin:GetStats()
+end
+function VeneerPaperDollMixin:GetSlotButton(panel, frame)
+ print('|cFF00FF88'..self:GetName()..':GetSlotButton()', frame:GetName(), frame:GetID())
+ local slot = frame:GetID()
+ local unit = panel.unit or 'player'
+ if slot_anchors[slot] then
+ slot_overlays[panel] = slot_overlays[panel] or {}
+ local overlay = slot_overlays[panel][slot]
+ if not overlay then
+ overlay = CreateFrame('Frame', 'VeneerPaperDollSlot' .. unit .. slot, frame, 'VeneerPaperDollSlotInfoTemplate')
+ overlay:SetID(slot)
+ slot_overlays[panel][slot] = overlay
+ overlay.checkRelic = frame.checkRelic
--- PaperDollFrame is separate from InspectUI handlers
-local PaperDollItemSlotButton_Update = function(self)
- local name = self:GetName()
- local slot = self:GetID()
- if not slot_anchors[slot] then
- return
+ local anchorPoint, relativePoint, dX, dY, statPoint, statRelative, statdX, statdY = unpack(slot_anchors[slot])
+ local offset = 7
+ overlay:SetPoint(anchorPoint, frame, relativePoint, dX * offset, dY * offset)
+ overlay:SetSize(frame:GetWidth()*3, frame:GetHeight())
+
+ local relativeFrame = overlay
+ for i, region in ipairs(overlay.StatsLeft) do
+ region:ClearAllPoints()
+ print(statPoint, relativeFrame, (i == 1) and statPoint or statRelative)
+ region:SetPoint(statPoint, relativeFrame, (i == 1) and statPoint or statRelative, 0, 0)
+ relativeFrame = region
+ end
+ if slot == 16 then
+ overlay.Sockets:ClearAllPoints()
+ overlay.Sockets:SetPoint('BOTTOM', CharacterFrameInsetBg, 'BOTTOM', 0, frame:GetHeight() + 14)
+ overlay.ItemLevel:SetFontObject(VeneerNumberFontLarge)
+ overlay.ItemLevel:ClearAllPoints()
+ overlay.ItemLevel:SetPoint('BOTTOM', overlay.Sockets, 'TOP', 0, 4)
+ end
+
+ print(overlay.Sockets:GetPoint(1))
+ overlay.anchors = slot_anchors[slot]
+ end
+
+ overlay.unit = unit
+ overlay.checkRelic = (unit == 'player' and slot == 16)
+
+
+ if frame.hasItem then
+ overlay.isDirty = true
+ overlay:Show()
+ else
+ overlay:Hide()
+ end
end
- print(self:GetName())
-
- local frame = _G[name .. 'Veneer']
-
- if not frame then
-
- frame = CreateFrame('Frame', name..'Veneer', self)
- vnslot[slot] = frame
-
- frame.label = frame:CreateFontString(nil, 'OVERLAY', 'VeneerNumberFont')
- frame.gemslot = {}
-
-
- frame.target = self
- frame.gemslot = {}
- frame:SetAllPoints(self)
- frame:SetParent(self)
- frame.label:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', 2, 2)
-
- tinsert(pendingSlots, frame)
- end
-
- UpdateVeneer(self, frame)
-
end
-local PaperDollFrame_UpdateStats = function()
-end
+function VeneerPaperDollMixin:OnEvent(event, arg)
+ print(event, arg)
+ if event == 'ADDON_LOADED' then
+ if IsLoggedIn() and not self.initialized then
+ self:Setup()
+ self.initialized = true
+ end
-plugin.event = function(self, event, ...)
- print(self, event, ...)
-
- if event == 'PLAYER_EQUIPMENT_CHANGED' then
- local slot, hasItem = ...
- if vnslot[slot] then
- UpdateVeneer(vnslot[slot]:GetParent(), vnslot[slot])
+ if arg == 'Blizzard_InspectUI' then
+ self:SetupInspectFrame()
+ end
+ if arg == 'Blizzard_ArtifactUI' then
+ self:SetupArtifactUI()
+ self:MarkForUpdate()
+ end
+ elseif event == 'ARTIFACT_UPDATE' then
+ self:MarkForUpdate()
+ else
+ if (event == 'PLAYER_SPECIALIZATION_CHANGED' or event == 'UNIT_INVENTORY_CHANGED') then
+ if arg ~= 'player' then
+ return
+ end
+ elseif event == 'INSPECT_READY' then
end
- elseif event == 'PLAYER_ENTERING_WORLD' then
- UpdateAll()
+ self:MarkForUpdate()
end
-
-end
-local artifactBarCreated
-plugin.init = function()
- LoadAddOn('Blizzard_ArtifactUI')
end
---plugin:SetScript('OnEvent', plugin.event)
-plugin:RegisterEvent('PLAYER_EQUIPMENT_CHANGED')
-plugin:RegisterEvent('PLAYER_ENTERING_WORLD')
+VeneerPaperDollSlotMixin = {}
-hooksecurefunc("PaperDollItemSlotButton_Update", PaperDollItemSlotButton_Update)
+function VeneerPaperDollSlotMixin:OnLoad()
+ self.SocketText = {}
+ self.SocketType = {}
+ self.SocketLink = {}
+end
+function VeneerPaperDollSlotMixin:OnShow()
+ if self.isDirty then
+ self:Update()
+ end
+end
+function VeneerPaperDollSlotMixin:OnUpdate()
+ if self.isDirty then
+ --print('|cFF00FF00pushing update for', self:GetID())
+ self:Update()
+ end
-hooksecurefunc("PaperDollFrame_UpdateStats", PaperDollFrame_UpdateStats)
\ No newline at end of file
+ if self.checkRelic then
+ self.tooltipLink = nil
+ for i = 1, 3 do
+ if self.SocketLink[i] and self.Sockets.SocketIcon[i]:IsMouseOver() then
+ self.tooltipLink = self.SocketLink[i]
+ end
+ end
+
+ if self.tooltipLink then
+ if not GameTooltip:IsOwned(self) then
+ GameTooltip:SetOwner(self, 'ANCHOR_CURSOR')
+ GameTooltip:SetHyperlink(self.tooltipLink)
+
+ GameTooltip:Show()
+ end
+ else
+ if GameTooltip:IsOwned(self) then
+ GameTooltip:Hide()
+ end
+ end
+ end
+end
+
+function VeneerPaperDollSlotMixin:UpdateRelicInfo()
+
+
+ local itemID = GetInventoryItemID(self.unit, 16)
+ if not itemID then
+ return
+ end
+ print('|cFF00FFFFRelic Sweep:', itemID)
+
+
+ local guid = UnitGUID(self.unit or 'player')
+ local relicCache = VeneerPaperDoll.KnownRelics[guid] and VeneerPaperDoll.KnownRelics[guid][itemID]
+ if VeneerPaperDoll.KnownRelics[guid] then
+ for k, v in pairs(VeneerPaperDoll.KnownRelics[guid]) do
+ if tonumber(k) and tonumber(k) < 72 then
+ VeneerPaperDoll.KnownRelics[guid][k] = nil
+ end
+ end
+ end
+
+
+ if not relicCache then
+ relicCache = {}
+ VeneerPaperDoll.KnownRelics[guid] = VeneerPaperDoll.KnownRelics[guid] or {}
+ VeneerPaperDoll.KnownRelics[guid][itemID] = relicCache
+ end
+
+ local numRelics = C_ArtifactUI.GetNumRelicSlots()
+ local isEquipped = C_ArtifactUI.IsViewedArtifactEquipped()
+ local tooltip = VeneerPaperDollTooltip
+ tooltip:SetOwner(self, 'ANCHOR_NONE')
+ self.hasRelicSlots = true
+ if numRelics and isEquipped then
+ print('Relic Query:', itemID, numRelics)
+ self.checkRelic = nil
+ for i = 1, numRelics do
+ local lockedReason, relicName, relicIcon, relicLink = C_ArtifactUI.GetRelicInfo(i);
+ local relicType = C_ArtifactUI.GetRelicSlotType(i);
+ if relicIcon then
+ tooltip:SetHyperlink(relicLink)
+ print(tooltip:NumLines())
+
+ local line1 = _G['VeneerPaperDollTooltipTextLeft2']
+ local line2 = _G['VeneerPaperDollTooltipTextLeft3']
+ local text1 = line1 and line1:GetText()
+ local text2 = line2 and line2:GetText()
+ if text1 or text2 then
+ self.SocketText[i] = text1:match('Item Level (%d+)') or text2:match('Item Level (%d+)')
+ end
+
+ self.SocketInfo[i] = relicIcon
+ self.SocketType[i] = relicType
+ self.SocketLink[i] = relicLink
+ print('storing', i, self.SocketInfo[i], self.SocketText[i], self.SocketType[i], self.SocketLink[i])
+ else
+
+ self.SocketInfo[i] = "Interface\\CharacterFrame\\TempPortraitAlphaMask"
+ self.SocketType[i] = relicType
+ self.SocketLink[i] = nil
+ end
+
+ relicCache[i] = {self.SocketInfo[i], self.SocketText[i], self.SocketType[i], self.SocketLink[i]}
+ end
+ end
+
+ for i = 1, 3 do
+ if relicCache[i] then
+ local relicIcon, relicLevel, relicType, relicLink = unpack(relicCache[i])
+
+ print('loading', i, relicIcon, relicLevel, relicType, relicLink)
+ self.SocketInfo[i] = relicIcon
+ self.SocketText[i] = relicLevel
+ self.SocketType[i] = relicType
+ self.SocketLink[i] = relicLink
+ end
+ end
+end
+
+local SocketIcon_Update = function(frame)
+end
+
+function VeneerPaperDollSlotMixin:Update()
+ local id = self:GetID()
+
+ self.SocketInfo = self.SocketInfo or {}
+ table.wipe(self.SocketInfo)
+ self.ItemLevel:SetText(nil)
+
+ local tooltip = VeneerPaperDollTooltip
+ tooltip:SetOwner(self, 'ANCHOR_NONE')
+ print('refresh', self.unit, id)
+ tooltip:SetInventoryItem(self.unit or 'player', id)
+ tooltip:Show()
+
+ local numLines = tooltip:NumLines()
+ local numTextures = 0
+ local itemLevel
+ local itemLevelLine
+ print('|cFFFFFF00Sockets scan:', numLines)
+ for i = 1, numLines do
+ local line = _G['VeneerPaperDollTooltipTextLeft'..i]
+ local text = line and line:GetText()
+ if text then
+ itemLevel = text:match('Item Level (%d+)')
+ if itemLevel then
+ self.ItemLevel:SetText(itemLevel)
+ break
+ end
+ end
+
+ local texture = _G['VeneerPaperDollTooltipTexture'..i]
+ if texture and texture:IsShown() then
+ numTextures = numTextures + 1
+ print('picked up socket', numTextures, texture:GetTexture())
+ self.SocketInfo[numTextures] = texture:GetTexture()
+ end
+ end
+ if self.checkRelic then
+ self:UpdateRelicInfo()
+ end
+
+
+ local relativeIcon
+ local socketsWidth = 0
+ local socketsHeight = 24
+ for index, icon in ipairs(self.Sockets.SocketIcon) do
+ if self.SocketInfo[index] then
+ print('|cFF0088FFsocketInfo|r', index, self.SocketInfo[index])
+ icon:ClearAllPoints()
+
+ icon:SetTexture(self.SocketInfo[index])
+ icon:SetSize(16, 16)
+ icon:Show()
+ if index == 1 then
+ icon:SetPoint('LEFT', self.Sockets, 'LEFT', 0, 0)
+ socketsWidth = socketsWidth + icon:GetWidth()
+ socketsHeight = icon:GetHeight()
+ else
+ if id == 16 then
+ icon:SetPoint('LEFT', relativeIcon, 'RIGHT', 14, 0)
+ socketsWidth = socketsWidth + 14
+ else
+ icon:SetPoint('LEFT', relativeIcon, 'RIGHT', 2, 0)
+ socketsWidth = socketsWidth + 2
+ end
+ socketsWidth = socketsWidth + icon:GetWidth()
+ end
+
+ local label = self.Sockets.SocketLabel[index]
+ label:ClearAllPoints()
+ label:SetPoint('BOTTOM', icon, 'TOP',0, 2)
+ label:SetFontObject(VeneerNumberFont)
+ label:SetText(self.SocketText[index])
+
+ if self.checkRelic then
+ local relicAtlasName = ("Relic-%s-Slot"):format(self.SocketType[index]);
+ self.Sockets.SocketBg = self.Sockets.SocketBg or {}
+ self.Sockets.SocketBg[index] = self.Sockets.SocketBg[index] or self.Sockets:CreateTexture()
+ self.Sockets.SocketBg[index]:SetAtlas(relicAtlasName)
+ self.Sockets.SocketBg[index]:SetPoint('TOPRIGHT', icon, 'TOPRIGHT', 12, 12)
+ self.Sockets.SocketBg[index]:SetPoint('BOTTOMLEFT', icon, 'BOTTOMLEFT', -12,-12)
+ print('', self.SocketType[index], relicAtlasName)
+
+ socketsHeight = self.Sockets.SocketBg[index]:GetHeight()
+ end
+
+
+ relativeIcon = icon
+ else
+ if self.checkRelic and self.Sockets.SocketBg and self.Sockets.SocketBg[index] then
+ self.Sockets.SocketBg[index]:SetTexture(nil)
+ self.Sockets.SocketLabel[index]:SetText(nil)
+ end
+
+ icon:Hide()
+ end
+
+
+ end
+ self.Sockets:SetWidth(socketsWidth)
+ self.Sockets:SetHeight(socketsHeight)
+
+
+
+
+
+ self.isDirty = nil
+end
\ No newline at end of file
diff -r d41c7dc3012f -r caded2668701 Modules/TalkingHead.lua
--- a/Modules/TalkingHead.lua Tue Oct 25 12:33:20 2016 -0400
+++ b/Modules/TalkingHead.lua Sun Jan 01 18:25:26 2017 -0500
@@ -17,19 +17,19 @@
addonTrigger = 'Blizzard_TalkingHeadUI'
}
+
+local qf = {}
+
+
function VeneerTalkingHeadMixin:OnLoad()
Veneer:AddHandler(self, self.anchorPoint)
end
-
-
function VeneerTalkingHeadMixin:Setup()
print('|cFF00AAFF'..self:GetName()..'|r:Setup()', TalkingHeadFrame:IsShown(), self:IsShown())
self:SetSize(TalkingHeadFrame:GetSize())
self:SetParent(TalkingHeadFrame)
- TalkingHeadFrame:ClearAllPoints()
- TalkingHeadFrame:SetPoint('BOTTOM', self, 'BOTTOM')
hooksecurefunc(TalkingHeadFrame, 'SetPoint', function(...)
print('SetPoint', ...)
diff -r d41c7dc3012f -r caded2668701 Modules/WorldState.lua
--- a/Modules/WorldState.lua Tue Oct 25 12:33:20 2016 -0400
+++ b/Modules/WorldState.lua Sun Jan 01 18:25:26 2017 -0500
@@ -13,10 +13,14 @@
addonTrigger = 'Blizzard_OrderHallUI',
addonFrame = 'OrderHallCommandBar',
}
+VeneerWorldStateHeadsUpMixin = {
+
+}
+
VeneerWorldStateCurrencyMixin = {
}
VeneerWorldStateProgressMixin = {
- keepOpen = true,
+ keepOpen = false,
}
VeneerWorldStateMixin = {
maxHeight = 0,
@@ -107,7 +111,7 @@
local lastFrame
for i, frame in ipairs(self.modules) do
print(' '..frame:GetName()..':',frame:IsShown(), frame:IsVisible(), frame:GetHeight())
- if frame:IsShown() then
+ if frame:IsVisible() then
if lastFrame then
frame:SetPoint('TOP', lastFrame, 'BOTTOM')
else
@@ -130,6 +134,9 @@
if not isUpdate then
Veneer:InternalReanchor(self, print)
end
+
+ WorldStateAlwaysUpFrame:ClearAllPoints()
+ WorldStateAlwaysUpFrame:SetPoint('TOP', self, 'BOTTOM', 0, 0)
end
@@ -204,23 +211,34 @@
function VeneerWorldStateCurrencyMixin:OnEvent (event, arg)
self:Update()
end
+local zoneCurrency = {
+ ['Suramar'] = 1155,
+ ["Sashj'tar Ruins"] = 1155,
+ ["Faronaar Ruins"] = 1155
+}
+local zoneBountyInfo = {
+ ['Suramar'] = 1859,
+ ["Sashj'tar Ruins"] = 1859,
+ ["Faronaar Ruins"] = 1859,
-
+ ['Azsuna'] = 1900,
+}
+local globalBountyInfo = {
+}
function VeneerWorldStateCurrencyMixin:Update(isBatchUpdate)
-
- print(' Zone:', GetZoneText())
- if GetZoneText() == 'Suramar' then
- local name, earned, texture, earnedThisWeek, weeklyMax, totalMax = GetCurrencyInfo(1155)
-
- self.Icon:SetTexture(texture)
- self.Label:SetFormattedText("%d / %d", earned, totalMax)
- self:Show()
- self:SetWidth(self.Icon:GetWidth() + self.Label:GetStringWidth() + 6)
+ local zoneText = GetRealZoneText()
+ if zoneText then
+ local currency = zoneCurrency[zoneText]
+ if currency then
+ local name, earned, texture, earnedThisWeek, weeklyMax, totalMax = GetCurrencyInfo(zoneCurrency[zoneText])
+ self.Icon:SetTexture(texture)
+ self.Label:SetFormattedText("%d / %d", earned, totalMax)
+ self:Show()
+ self:SetWidth(self.Icon:GetWidth() + self.Label:GetStringWidth() + 6)
+ end
else
self:Hide()
end
-
-
end
function VeneerWorldStateProgressMixin:OnUpdate(sinceLast)
@@ -228,15 +246,11 @@
if self.keepOpen then
return
end
- if self.timeLived >= 3 and not self.TransitionFadeOut:IsPlaying() then
- if not self.timeOut then
- self.timeOut = true
- self.TimedFadeOut:Play()
- end
+ if self.timeLived >= 3 and not self.TimedFadeOut:IsPlaying() then
+ self.TimedFadeOut:Play()
end
end
-
function VeneerWorldStateProgressMixin:OnLoad()
self:RegisterEvent('PLAYER_EQUIPMENT_CHANGED')
@@ -375,7 +389,7 @@
function VeneerWorldStateProgressMixin:Update(isBatchUpdate)
local progressChange = false
- print(' current mode:', self.mode)
+ print(' current mode:', self.mode, 'vis:', self:IsVisible())
if (not self.mode) or (not progressHandlers[self.mode]) then
self:HidePanel()
return
@@ -388,6 +402,7 @@
self.timeLived = 0
end
+
if not self:IsVisible() then
self.TransitionFadeIn:Play()
else
@@ -454,8 +469,11 @@
self.timeLived = 1000
else
self.keepOpen = true
+
+ self.modeChanged = true
end
print('keepOpen =', self.keepOpen)
+ self:Update()
else
if self.mode == 'xp' then
@@ -486,6 +504,7 @@
function WorldStateBlockMixin:ShowPanel()
print('|cFF0088FF'..self:GetName()..':ShowPanel()')
self:SetShown(true)
+ self:SetAlpha(1)
VeneerWorldState:Show()
end
function WorldStateBlockMixin:HidePanel()
@@ -522,4 +541,5 @@
self.keepOpen = true
self:Setup()
end
-end
\ No newline at end of file
+end
+
diff -r d41c7dc3012f -r caded2668701 Modules/WorldState.xml
--- a/Modules/WorldState.xml Tue Oct 25 12:33:20 2016 -0400
+++ b/Modules/WorldState.xml Sun Jan 01 18:25:26 2017 -0500
@@ -3,12 +3,13 @@
-
+
+
@@ -22,7 +23,7 @@
self:GetParent().faded = true
- --print('VnWorldState', '|cFF44FF00stopped fadeout')
+ print('VnWorldState', '|cFF44FF00stopped fadeout')
self:GetParent():Update()
@@ -53,6 +54,13 @@
+
+
+
+ --print('VnWorldState', '|cFFFFFF00end of fadeout')
+ self:GetParent():Hide()
+
+
diff -r d41c7dc3012f -r caded2668701 ObjectiveTracker/ObjectiveCore.lua
--- a/ObjectiveTracker/ObjectiveCore.lua Tue Oct 25 12:33:20 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,501 +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 T = 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
-
-T.strings = {}
-T.strings.CLICK_TO_ACCCEPT = 'Click to Accept'
-T.strings.CLICK_TO_COMPLETE = 'Click to complete'
-T.colors ={
- enable = true,
- 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.watchMoneyReasons = 0
-
---- Baseline defaults table; values defined in the files that they pertain to
-T.defaults = {}
-
---- Tracker display order
-T.orderedNames = {'Bonus', 'AutoQuest', 'Quest', 'Cheevs'}
-
---- ipairs() argument tables
-T.orderedHandlers = setmetatable({}, {__mode = "k"})
-T.orderedTrackers = setmetatable({}, {__mode = "k"})
-T.indexedTrackers = setmetatable({}, {__mode = "k"})
-
---- pairs() argument tables
-T.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
-
-T.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
-T.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
-}
-
-T.AutoQuest = {
- name = "AutoQuest",
- displayName = "Notice",
- updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST,
- updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST +
- OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED,
-}
-T.Quest = {
- name = "Quest",
- displayName = "Quests",
- updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST,
- updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST +
- OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED,
- itemButtons = {},
- freeButtons = {},
-}
-T.Cheevs = {
- name = "Cheevs",
- displayName = "Achievements",
- updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT,
- updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT +
- OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT_ADDED,
-}
-T.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)
- local c = T.Conf.Wrapper
- print('Initializing |cFF00FFFF'..name..'|r module...')
-
- local handler = setmetatable(T[name] or {}, {
- __tostring = Tracker_string,
- __call = Tracker_call
- })
- if type(T.orderedHandlers[index]) == 'table' then
- return T.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
-
- T[name] = handler
-
- local trackerName = 'Veneer'..name..'Tracker'
- local handler = T[name]
- local frame = CreateFrame('Frame', trackerName, _G.VeneerObjectiveScroll, 'VeneerTrackerTemplate')
- frame.title:SetText(handler.displayName)
- frame:SetWidth(c.Width)
- handler.frame = frame
- handler.trackerName = trackerName
- handler.lines = {}
- T.orderedTrackers[index] = frame
- T.namedTrackers[name] = frame
- T.indexedTrackers[handler] = frame
- print('|cFFFF0088' .. trackerName .. '|r created for |cFF00FFFF' .. handler.displayName .. '|r module')
-
- T.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 ~= T.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();
- T.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();
- T.currentZoneArea = GetCurrentMapAreaID()
- print('Updating zone ID to', T.currentZoneArea, '=', GetZoneText(), GetMinimapZoneText())
-
-
- return OBJECTIVE_TRACKER_UPDATE_TASK_ADDED
-end
-
-
-Event.PLAYER_MONEY = function()
- if T.watchMoneyReasons > 0 then
- return T.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
- T.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
-T.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
-
-T.SetWatchMoney = function(watchMoney, reason)
- if watchMoney then
- if band(T.watchMoneyReasons, reason) == 0 then
- T.watchMoneyReasons = T.watchMoneyReasons + reason;
- end
- else
- if band(T.watchMoneyReasons, reason) > 0 then
- T.watchMoneyReasons = T.watchMoneyReasons - reason;
- end
- end
-end
-T.animateReasons = 0
-T.SetAnimate = function(reason)
- print('comparing', T.animateReasons, reason)
- if animate then
- if band(T.animateReasons, reason) == 0 then
- T.animateReasons = T.animateReasons + reason
- end
- else
- if band(T.animateReasons, reason) > 0 then
- T.animateReasons = T.animateReasons - reason
- end
- end
-end
-
-local Play = function(file) if Devian and Devian.InWorkspace() then PlaySoundFile(file) end end
-
-function T: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
- T: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
- T:Update(reason, arg1, arg2, arg3)
- else
- print('no reason value returned')
- Play([[Interface\Addons\SharedMedia_MyMedia\sound\Quack.ogg]])
- end
-
-end
-
-
-function T:OnInitialize()
- local c = T.Conf.Wrapper
- VeneerData = _G.VeneerData
- VeneerData.CallLog = VeneerData.CallLog or {}
- if not T.isHooked then
- T.isHooked = true
- for blizzFunc, veneerFunc in pairs(BlizzHooks) do
- if T[veneerFunc] then
- hooksecurefunc(blizzFunc, T[veneerFunc])
- else
- hooksecurefunc(blizzFunc, function(...)
- print('|cFFFF0088securehook('..tostring(blizzFunc)..')|r args:', ...)
- tinsert(VeneerData.CallLog, {blizzFunc, ...})
- end)
- end
- end
- end
-
- T.Conf.TasksLog = T.Conf.TasksLog or {}
-
- ObjectiveTrackerFrame:UnregisterAllEvents()
- ObjectiveTrackerFrame:Hide()
-
-
- for id, name in ipairs(T.orderedNames) do
- if not T.orderedHandlers[id] then
- Handler_Initialize(T.DefaultHandler, name, id)
- end
- end
- self:SetSize(c.Width, 40)
- T.InitializeWidgets()
-end
-
---- Done any time the the minimize button is toggled up
-function T:OnEnable()
-
- print(B.Conf.VeneerObjectiveWrapper.enabled)
- if not B.Conf.VeneerObjectiveWrapper.enabled then
- return
- end
-
- for event, action in pairs(Event) do
- print('|cFFFF0088listen to', event, 'for action|r', tostring(action))
- Wrapper:RegisterEvent(event)
- end
-
- local c = T.Conf.Wrapper
-
- Scroller:SetScrollChild(Scroll)
- Scroller:SetWidth(c.Width)
- Scroll:SetWidth(c.Width)
- Scroll:ClearAllPoints()
- Scroll:SetPoint('TOP', Scroller, 'TOP')
- self:SetScript('OnEvent', T.OnEvent)
-
- Scroller:Show()
-
- local from, target, to, x, y = Wrapper:GetPoint(1)
- print(from, target:GetName(), to, x,y)
-
- T:Update()
-
- -- run once to prime the data structure
- T.UpdateActionButtons()
-end
-
-function T:OnDisable()
- self:UnregisterAllEvents()
- Scroller:Hide()
-end
-
diff -r d41c7dc3012f -r caded2668701 ObjectiveTracker/ObjectiveEvents.lua
--- a/ObjectiveTracker/ObjectiveEvents.lua Tue Oct 25 12:33:20 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +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
-
- 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 d41c7dc3012f -r caded2668701 ObjectiveTracker/ObjectiveFrame.lua
--- a/ObjectiveTracker/ObjectiveFrame.lua Tue Oct 25 12:33:20 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,861 +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 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 headerHeight, headerColor, headerSpacing = 16, {1,1,1,1}, 2
-local headerbg = {'VERTICAL', 1, 1, 0.5, 0.5, 1, 1, 0.5, 0}
-local headerFont, headerSize, headerOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 14, 'OUTLINE'
-
-local titlebg = {'HORIZONTAL', 1, 0, .7, .25, 1, 0, .7, .125}
-local titlebg_daily = {'HORIZONTAL', 0, .7, 1, .25, 0, 1, .7, .125 }
-local titlebg_account = {'HORIZONTAL', 0, .45, 1, .25, 0, .45, 1, .125}
-local titleFont, titleSize, titleOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'OUTLINE'
-
-local textbg = {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0 }
-local textbg_daily = {'HORIZONTAL', 0, .7, 1, .1, 0, 1, .7, .075 }
-local textbg_account = {'HORIZONTAL', 0, .45, 1, 0.4, 0, .41, 1, .085 }
-local textFont, textSize, textOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]], 16, 'OUTLINE'
-
-
-local selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225}
-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 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.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(T.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(T.colors.default.textbg))
-
- block.SelectionOverlay:SetGradientAlpha(unpack(T.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.clickZone:SetScript('OnMouseUp', function(self, ...) handler.OnMouseUp(block, ...) end)
- block.clickZone:SetScript('OnMouseDown', function(self, ...) handler.OnMouseDown(block, ...) end)
- 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
-
-
- --- 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.description and #info.description >= 1 then
- print(' |cFF00FFFF header line:|r', info.description)
- line.status:SetText(info.description)
- line.height = floor(line.status:GetStringHeight()+.5) + textSpacing
- if line.widget then
- line.widget:Hide()
- end
- T.AddLine(block, line)
-
- lineIndex = lineIndex + 1
- line = T.GetLine(handler, block, lineIndex)
- end
-
- if (info.isComplete == true or info.isComplete == nil) and info.completionText then
- print(' overriding line #1 for completion text:', info.completionText)
- line.status:SetText(info.completionText)
- line.height = floor(line.status:GetStringHeight()+.5) + textSpacing
- if line.widget then
- line.widget:Hide()
- end
- 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 = headerHeight
-
- tracker.title:SetFont(headerFont, headerSize, headerOutline)
- tracker.titlebg:SetHeight(headerHeight)
- tracker.title:SetTextColor(unpack(headerColor))
- --tracker.titlebg:SetGradientAlpha(unpack(headerbg))
-
- 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
- if tracker.isEmpty then
- tracker.headerFade:Play()
- tracker.isEmpty = nil
- end
- tracker.height = trackerHeight
- tracker:SetHeight(tracker.height)
- tracker:Show()
- else
- tracker.isEmpty = true
- 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()
- --T.UpdateActionButtons(reason)
-end
-
---- Queue any active item buttons for update for that frame
-local iprint = B.print('ItemButton')
-T.UpdateActionButtons = function(updateReason)
- local print = iprint
- 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(Quest.itemButtons) 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)
- local print = iprint
- 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 d41c7dc3012f -r caded2668701 ObjectiveTracker/ObjectiveInfo.lua
--- a/ObjectiveTracker/ObjectiveInfo.lua Tue Oct 25 12:33:20 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,341 +0,0 @@
-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(questLogIndex)
-
- 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)
-
- if #self.info.rewardInfo >= 1 then
- for i, reward in ipairs(self.info.rewardInfo) do
- --[[
- type = 'item',
- index = i ,
- name = name,
- texture = texture,
- count = count,
- quality = quality,
- isUsable = isUsable
- ]]
- print(' reward ', i, ' ', reward.type, reward.name, reward.count)
-
- end
- end
-
- 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.watchReasonModule)
- 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 d41c7dc3012f -r caded2668701 ObjectiveTracker/ObjectiveWidgets.lua
--- a/ObjectiveTracker/ObjectiveWidgets.lua Tue Oct 25 12:33:20 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,440 +0,0 @@
-local B = select(2,...).frame
-local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
-local print = B.print('WidgetFactory')
-local _G, UIParent = _G, UIParent
-local GetQuestLogSpecialItemInfo, IsQuestLogSpecialItemInRange, GetQuestLogSpecialItemCooldown = GetQuestLogSpecialItemInfo, IsQuestLogSpecialItemInRange, GetQuestLogSpecialItemCooldown
-local CooldownFrame_SetTimer, SetItemButtonTextureVertexColor, CreateFrame, VeneerObjectiveScroll = CooldownFrame_SetTimer, SetItemButtonTextureVertexColor, CreateFrame, VeneerObjectiveScroll
-local tremove, tContains, pairs, ipairs, setmetatable, floor = tremove, tContains, pairs, ipairs, setmetatable, floor
-local SetItemButtonTexture, SetItemButtonCount = SetItemButtonTexture, SetItemButtonCount
-local ToggleWorldMap, GetTrackedAchievements, GetTasksTable = ToggleWorldMap, GetTrackedAchievements, GetTasksTable
--- GLOBALS: Veneer_QuestObjectiveItem_UpdateCooldown, Veneer_QuestObjectiveItem_OnUpdate
---- frame refs
-local Wrapper = _G.VeneerObjectiveWrapper
-local Scroller = Wrapper.scrollArea
-local CloseButton = Wrapper.CloseButton
-local QuestMapButton = Wrapper.QuestMapButton
-local Scroll = _G.VeneerObjectiveScroll
-local usedButtons = T.Quest.itemButtons
-local freeButtons = T.Quest.freeButtons
-
-T.buttons = {
- 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;
- --T:Update()
- --T: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())
-
- T.UpdateActionButtons('SCROLLING')
-end
-
-local UpdatePanelButton = function (self, state)
- state = state or true
- local swatch = (state == true) and self.openSwatch or self.closedSwatch
- print((state ~= true) and 'closedSwatch' or 'openSwatch')
- 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)
- T:SetEnabled()
- UpdatePanelButton(self, T.Conf.enabled)
-end
-
-OnClick.QuestMapButton = function()
- ToggleWorldMap()
-end
-
-
-T.InitializeWidgets = function()
- local panelButtons = T.buttons
- --- 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, T.Conf.enabled)
- end
-end
-
-----------------------------------------------------------------------------------------
---- modified version of the itemButton initializer used by Barjack's 'QuestKing 2' addon,
---- url: http://mods.curse.com/addons/wow/questking
-----------------------------------------------------------------------------------------
-T.SetItemButton = function(block, info)
- local itemInfo = info.specialItem
- if not itemInfo then
- return
- end
-
- 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 = T.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
- T.Quest.numButtons = T.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
-T.FreeItemButtons = function(block)
-
- if block.itemButton then
- local itemButton = block.itemButton
- if itemButton.questID ~= block.info.questID then
- block.itemButton = nil
- itemButton.block = T.Quest.InfoBlock[itemButton.questID]
- else
- itemButton.block = nil
- itemButton:Hide()
-
- usedButtons[itemButton.questID] = nil
- freeButtons[#freeButtons + 1] = itemButton
- T.Quest.numButtons = T.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
- T: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
-T.WidgetRegistry = {}
-local wr = T.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
-T.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
- T.InitializeWidget(widget)
- return widget
-end
-
---- WidgetTemplate 'OnLoad'
-T.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'
-T.InitializeWidget = setmetatable({}, {
- __call = function(t, frame)
- -- todo: config pull
-
- frame:SetWidth(T.Conf.Wrapper.Width - T.Conf.Style.Format.status.Indent * 2)
- frame:SetScript('OnEvent', T.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)
- T.UpdateWidget[frame.widgetType](frame)
- end,
-})
-
---- WidgetTemplate 'OnEvent'
-T.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'
-T.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
-T.CleanWidgets = function()
- local print = B.print('ObjectiveWidgets')
- local tracked = {GetTrackedAchievements() }
- local tasks = GetTasksTable()
- for type, reg in pairs(T.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
-
-
-
-T.defaults.WidgetStyle = {
-
-}
-
-local progressHeight = 16
-local progressBorder = 1
-local progressIndent = 3
-local progressFont = _G.VeneerCriteriaFontNormal
-
-
-T.InitializeWidget.ProgressBar = function(self)
- local c = T.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
-
-T.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
-
-
-T.InitializeWidget.Hidden = function (self)
- self.height = 0
-end
-T.UpdateWidget.Hidden = function (self)
- self.height= 0
-end
\ No newline at end of file
diff -r d41c7dc3012f -r caded2668701 ObjectiveTracker/ObjectiveWidgets.xml
--- a/ObjectiveTracker/ObjectiveWidgets.xml Tue Oct 25 12:33:20 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 d41c7dc3012f -r caded2668701 ObjectiveTracker/QuestTracker.lua
--- a/ObjectiveTracker/QuestTracker.lua Tue Oct 25 12:33:20 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,318 +0,0 @@
-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 iprint = B.print('Info')
-
-local colors = T.colors
-
-local tprint = B.print('Tracker')
-Quest.Update = function(self, reason, ...)
- local print = tprint
- print('QuestTracker:Update() received')
- T.UpdateActionButtons()
- Default.Update(self, reason, ...)
-end
-
-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.isComplete then
- if info.isAutoComplete then
- local questID, popupType = GetAutoQuestPopUp(info.questLogIndex)
- if popupType == 'COMPLETE' then
- print(' :: auto-complete quest :: set the message')
- info.completionText = T.strings.CLICK_TO_COMPLETE
- end
- else
- if not completionText or info.completionText then
- info.completionText = GetQuestLogCompletionText(info.questLogIndex)
- end
- 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.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)
- local print = iprint
- print('|cFF00DDFFQuest|r.|cFF0088FFGetInfo(|r'.. tostring(watchIndex)..'|r)')
- local questID, title, questIndex, numObjectives, requiredMoney, _,
- _, isAutoComplete, failureTime, timeElapsed, questType, _, _, _, _ = 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)
- for k,v in pairs(q) do
- print('|cFFFFFF00'..k..'|r:', v)
- end
- 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 d41c7dc3012f -r caded2668701 ObjectiveTracker/XPTracker.lua
--- a/ObjectiveTracker/XPTracker.lua Tue Oct 25 12:33:20 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
diff -r d41c7dc3012f -r caded2668701 Templates.lua
--- a/Templates.lua Tue Oct 25 12:33:20 2016 -0400
+++ b/Templates.lua Sun Jan 01 18:25:26 2017 -0500
@@ -19,7 +19,6 @@
end
end
-
function VeneerConfigLayerMixin:OnUpdate()
local handler = self:GetParent()
handler.ConfigLayers = handler.ConfigLayers or {}
@@ -28,20 +27,6 @@
self.ConfigID:SetText(handler:GetID())
end
-
-function VeneerHandlerMixin:OnShow()
- self:Reanchor()
- Veneer:StaticReanchor(self)
-end
-function VeneerHandlerMixin:OnHide()
- Veneer:DynamicReanchor()
-end
-function VeneerHandlerMixin:Reanchor (anchorAll)
- if not anchorAll then
- Veneer:InternalReanchor(self)
- end
-end
-
function VeneerAnimationMixin:OnPlay()
PlaySoundKitID(229)
self.animating = true
@@ -56,4 +41,17 @@
PlaySoundKitID(229)
self.animating = nil
print('|cFF00FF00Anim:OnFinish|r @', unpack(self.destPoint))
+end
+
+function VeneerHandlerMixin:OnShow()
+ self:Reanchor()
+ Veneer:StaticReanchor(self)
+end
+function VeneerHandlerMixin:OnHide()
+ Veneer:DynamicReanchor()
+end
+function VeneerHandlerMixin:Reanchor (anchorAll)
+ if not anchorAll then
+ Veneer:InternalReanchor(self)
+ end
end
\ No newline at end of file
diff -r d41c7dc3012f -r caded2668701 Veneer.lua
--- a/Veneer.lua Tue Oct 25 12:33:20 2016 -0400
+++ b/Veneer.lua Sun Jan 01 18:25:26 2017 -0500
@@ -8,6 +8,8 @@
SLASH_VENEER1 = "/veneer"
SLASH_VENEER2 = "/vn"
local VENEER_VERSION = 703
+local type, strrep, ipairs, tinsert, tostring, select = type, string.rep, ipairs, tinsert, tostring, select
+local pairs, tremove = pairs, tremove
SlashCmdList.VENEER = function(cmd)
@@ -27,7 +29,8 @@
pendingCalls = {},
AddOnCheck = {}
}
-local print = DEVIAN_WORKSPACE and function(...) print('Veneer', ...) end or nop
+
+local print = DEVIAN_WORKSPACE and function(...) _G.print('Veneer', ...) end or nop
local wipe = table.wipe
local defaults = {
@@ -44,7 +47,6 @@
local configMode
local anonID = 0
-local tostring = tostring
local IsFrameHandle = IsFrameHandle
local GetAnonymousName = function(key)
if not key then
@@ -148,28 +150,23 @@
self:StopMovingOrSizing()
end
+local VeneerModule_Setup = function(frame)
+ if (not frame.addonTrigger) or select(2,IsAddOnLoaded(frame.addonTrigger)) then
+ if not frame.initialized then
+ frame:Setup()
+ frame.initialized = true
+ end
+ end
+end
+
function VeneerCore:Setup ()
local resetConfig = (not VeneerData)
if (not VeneerData) then
VeneerData = defaults
VeneerData.version = VENEER_VERSION
- self:print('Fresh install.')
- elseif (VeneerData.version and VeneerData.version < VENEER_VERSION) then
- local oldVars = VeneerData
- VeneerData = defaults
- VeneerData.version = VENEER_VERSION
- VeneerData.oldSettings = oldVars
- self:print('Resetting to temp defaults. Use /vn retro to use old settings.')
end
self.data = VeneerData
- self:ExecuteOnClusters(nil, function(frame)
- if (not frame.addonTrigger) or select(2,IsAddOnLoaded(frame.addonTrigger)) then
- if not frame.initialized then
- frame:Setup()
- frame.initialized = true
- end
- end
- end)
+ self:ExecuteOnClusters(nil, VeneerModule_Setup)
self.ConfigMode = VeneerData.ConfigMode
self:UpdateConfigLayers()
@@ -208,6 +205,7 @@
end)
end
+
function VeneerCore:GetClusterFromArgs (...)
local primaryAnchor
local insertPosition
@@ -224,7 +222,7 @@
end
clusterTable[arg] = clusterTable[arg] or {}
clusterTable = clusterTable[arg]
- print(string.rep(' ', i)..'anchor cluster', i, arg)
+ print(strrep(' ', i)..'anchor cluster', i, arg)
elseif argType == 'boolean' then
insertPosition = 1
end
diff -r d41c7dc3012f -r caded2668701 Veneer.toc
--- a/Veneer.toc Tue Oct 25 12:33:20 2016 -0400
+++ b/Veneer.toc Sun Jan 01 18:25:26 2017 -0500
@@ -7,11 +7,12 @@
## X-Category: Interface Enhancements
## DefaultState: Enabled
## LoadOnDemand: 0
-## OptionalDeps: LibKraken, Devian
+## OptionalDeps: Devian
Veneer.xml
##Options.lua
-##Modules\PaperDoll.lua
+
Modules\WorldState.xml
Modules\TalkingHead.xml
-Modules\BuffFrame.xml
\ No newline at end of file
+Modules\BuffFrame.xml
+Modules\PaperDoll.xml
\ No newline at end of file
diff -r d41c7dc3012f -r caded2668701 Veneer_Objectives/ObjectiveTracker.lua
--- a/Veneer_Objectives/ObjectiveTracker.lua Tue Oct 25 12:33:20 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,559 +0,0 @@
--- Veneer
--- Veneer_WorldQuests.lua
--- Created: 8/16/2016 8:19 AM
--- %file-revision%
--- This is more or less a copy of the blizzard code with some customization stuff added
-
-local plugin = VeneerObjectives
-local vn, print = LibStub("LibKraken").register(Veneer, VeneerObjectives)
-local ot
-local otvn
-
-local band, floor, min = bit.band, math.floor, math.min
-
-
-local X_QUEST = 0x00001;
-local X_QUEST_ADDED = 0x00002;
-local X_TASK_ADDED = 0x00004;
-local X_WORLD_QUEST_ADDED = 0x00008;
-local X_SCENARIO = 0x00010;
-local X_SCENARIO_NEW_STAGE = 0x00020;
-local X_ACHIEVEMENT = 0x00040;
-local X_ACHIEVEMENT_ADDED = 0x00080;
-local X_SCENARIO_BONUS_DELAYED = 0x00100;
-local X_SUPER_TRACK_CHANGED = 0x00200;
--- these are for the specific module ONLY!
-local X_MODULE_QUEST = 0x00400;
-local X_MODULE_AUTO_QUEST_POPUP = 0x00800;
-local X_MODULE_BONUS_OBJECTIVE = 0x01000;
-local X_MODULE_WORLD_QUEST = 0x02000;
-local X_MODULE_SCENARIO = 0x04000;
-local X_MODULE_ACHIEVEMENT = 0x08000;
-local X_SCENARIO_SPELLS = 0x10000;
--- special updates
-local X_STATIC = 0x0000;
-local X_ALL = 0xFFFF;
-
--- state information
-local X_REASON = X_ALL; -- default
-local X_MONEY = 0
-local X_ANIMATION = 0
-local X_ID = 0;
-
-local INSET_V = -20
-
-
-
-local trackerWidth = 240
-local blockIndent = 12
-local blockSpacing = 3
-
-local tracker = {
- freeBlocks = {},
- usedBlocks = {},
- freeProgressBars = {},
- usedProgressBars = {},
- freeTimers = {},
- usedTimers = {},
- freeLines = {},
-
- headerText = 'Default Header',
- contentHeight = 0,
- animationHeight = 0,
- updateReasonModule = 0,
- updateReasonEvents = 0,
-}
-local GetTrackerHandler = function(handler)
- handler = handler or {}
- setmetatable(handler, {__index=tracker})
- return handler
-end
-
-local Header_OnAnimationStart = function (self, forced)
- local header = self:GetParent()
- header.animating = true
- plugin:UpdateAnimation(header)
-end
-
-local Header_OnAnimationFinished = function (self, forced)
- local header = self:GetParent()
- header.animating = nil
- plugin:Update(X_ANIMATION)
-end
-
--- reset generic flags for layout compilation
-function tracker:InitLayout (isStatic)
- print('|cFF00FFFFlayout|r', self.headerText)
- self.firstBlock = nil
- self.lastBlock = nil
- self.currentBlock = nil
- self.oldContentHeight = self.contentHeight
- self.oldAnimationHeight = self.animationHeight
- self.numBlocks = 0
- for id, block in pairs(self.usedBlocks) do
- block.used = nil
- end
- if not isStatic then
- self.hasSkippedBlocks = false
- end
-
- if not self.header then
- self:SetHeader(self.headerText, X_REASON)
- self.header:SetPoint('TOPLEFT', plugin, 'TOPLEFT', 0, -plugin.contentHeight)
- plugin.contentHeight = plugin.contentHeight + self.header:GetHeight()
- end
-
-
- self.contentHeight = 0
-
-end
-
--- clear out generic flags and set aside block frames for re-use
-tracker.EndLayout = function(self)
- self.lastBlock = self.currentBlock
- for id, block in pairs(self.usedBlocks) do
- if not block.used then
- self:FreeBlock(block)
- end
- end
-end
-
-function tracker:SetHeader (text, animateReason)
- if self.header then
- return self.header
- end
-
- local block = CreateFrame('Button', nil, plugin, 'VeneerObjectiveHeader')
- block.handler = self
- block.text:SetText(self.headerText)
-
- self.currentBlock = block
- self.header = block
- return block
-end
-
-function tracker:FreeBlock(block)
- self.usedBlocks[block.id] = nil
- print('|cFF0088FFfree|r', block:GetName())
- tinsert(self.freeBlocks, block)
-
- block.numLines = 0
- block:SetHeight(0)
- block:Hide()
-end
-
--- should only be used in an N-lastN loop
-function tracker:FreeLine(line)
- if line.block then
- line.block.lines[line.index] = nil
- end
- print('|cFF0088FFfree|r', line:GetName())
- local freeLines = line.type or self.freeLines
- tinsert(freeLines, line)
-end
-
-local blocksn = 0
-tracker.GetBlock = function(self, id)
- local block = self.usedBlocks[id]
- if not block then
- local numFree = #self.freeBlocks
- if numFree >= 1 then
- block = tremove(self.freeBlocks, numFree)
- else
- blocksn = blocksn + 1
- block = CreateFrame('Button', 'OTVNBlock'..blocksn, plugin, 'VeneerObjectiveBlock')
- block.lines = {}
- end
- self.usedBlocks[id] = block
- block.id = id
- block.handler = self
- end
-
- block.used = true
- block.currentLine = nil
- block.numLines = 0
-
- if block.lines then
- for i, line in ipairs(block.lines) do
- line.used = nil
- end
- end
-
- block.contentHeight = blockSpacing
- block:SetWidth(trackerWidth)
- block:SetHeight(0)
-
- return block
-end
-
--- obtain line
-local linesn = 0
-function tracker:GetLine(block, index, lineType)
- local line = block.lines[index]
- if line and line.lineType ~= lineType then
-
- tinsert(self.freeLines, line)
- line = nil
- end
-
- if not line then
- local freeLines = (lineType and lineType.freeLines) or self.freeLines
- local numFreeLines = #freeLines
- if numFreeLines >= 1 then
- line = tremove(freeLines, numFreeLines)
- else
- linesn = linesn + 1
- line = CreateFrame('Frame', 'OTVNLine'.. linesn, block, (lineType and lineType.template) or 'VeneerObjectiveLine')
- end
- line:SetParent(block)
- end
-
- line.type = lineType
- line.index = index
- line.used = true
- line.block = block
- line.text:SetPoint('TOPLEFT', line, 'TOPLEFT', blockIndent, 0)
- line:SetHeight(0) -- in order for GetStringHeight to be useful
-
- block.lines[index] = line
-
- return line
-end
-
-function tracker:AddProgressBar(block, line, questID)
-end
-
-function tracker:FreeProgressBar(block, line)
-end
-
-function tracker:AddTimerBar(block, line, duration, startTime)
-end
-
-function tracker:FreeTimerBar(block, line)
-end
-
--- Checks for space and anchors or frees the block accordingly
-function tracker:AddBlock (block, force)
- local anchor = self.currentBlock or self.header
- self.numBlocks = self.numBlocks + 1
-
- if block.header then
- print('header!', floor(block.contentHeight), '+', floor(block.header:GetStringHeight()))
- block.contentHeight = block.contentHeight + block.header:GetStringHeight()
- self.used = true
- end
-
-
- if self.currentBlock then
- self.currentBlock.nextBlock = block
- block.prevBlock = self.currentBlock
- else
- self.firstBlock = block
- end
-
- self.contentHeight = self.contentHeight + block.contentHeight
- self.currentBlock = block
-
- if not plugin.currentBlock then
- plugin.firstBlock = block
- end
- plugin.currentBlock = block
-
-
-
- block:SetHeight(block.contentHeight)
- print('block|cFF88FF00', self.numBlocks, block, '|rto', anchor, 'size', block.contentHeight)
- block:ClearAllPoints()
- block:SetPoint('TOPLEFT', anchor, 'BOTTOMLEFT', 0, -blockSpacing)
- block:Show()
-
- -- free unused lines
- local numLines = #block.lines
- for i = 1, numLines do
- local line = block.lines[i]
- if not line.used or block.collapsed then
- print('|cFFFF4400!|r')
- self:FreeLine(line)
- else
- if not line:IsShown() then
- line:Show()
- end
- end
- end
-
- return true
-end
-
-function tracker:SetLine(block, index, lineType, textOrFunc)
- local anchor = block.currentLine or block.header
- local line = self:GetLine(block, index, lineType)
-
- if line.ticker then
- line.ticker:Cancel()
- line.ticker = nil
- end
-
- local text = textOrFunc
- if type(textOrFunc) == 'function' then
- text = textOrFunc()
-
- line.ticker = C_Timer.NewTicker(10, function()
- line.height = tracker:SetLineText(line.text, textOrTextFunc())
- line:SetHeight(line.height)
- end)
- end
- line.height = tracker:SetLineText(line.text, text)
- line:SetHeight(line.height)
-
- print('line|cFFFFFF00', line:GetName(), '|rto', anchor:GetName(), 'size', line.height)
- line:SetPoint('TOPLEFT', anchor, 'BOTTOMLEFT', 0, 0)
-
- block.contentHeight = block.contentHeight + line.height
- block.numLines = block.numLines + 1
-
- if block.currentLine then
- line.prevLine = block.currentLine
- block.currentLine.nextLine = line
- else
- block.firstLine = line
- end
-
- block.currentLine = line
- plugin.currentLine = line
-
-end
-
-function tracker:SetLineText(fontString, text)
- fontString:SetText(text)
- return fontString:GetStringHeight()
-end
-
--- Update lite
-function tracker:ResetAnchors ()
- self:InitLayout()
-
- self:EndLayout()
-end
-
-
-local UpdateQuestTracker = function(watchIndex, logIndex)
- return true
-end
-
--- top-down updaters
-
-local questTracker = GetTrackerHandler({
- headerText = 'Quests',
- updateReasonModule = X_MODULE_QUEST,
- updateReasonEvents = (X_QUEST + X_QUEST_ADDED),
-})
-function questTracker:Update ()
- self:InitLayout()
- for watchIndex = 1, GetNumQuestWatches() do
- local questID, title, questLogIndex, numObjectives, requiredMoney, isComplete, startEvent, isAutoComplete, failureTime, timeElapsed, questType, isTask, isBounty, isStory, isOnMap, hasLocalPOI = GetQuestWatchInfo(watchIndex)
- if not questID then
- -- stop parsing; end of data or variables haven't completely loaded
- break
- end
- local showQuest = true
- if isTask or (isBounty and not IsQuestComplete(questID)) then
- -- do nothing
- else
- -- obtain a block
- local block = self:GetBlock(questID)
-
- block.header:SetText(title)
-
- for i = 1, numObjectives do
- local text, objectiveType, finished = GetQuestLogLeaderBoard(i, questLogIndex)
- if text then
- self:SetLine(block, i, nil, text)
- end
- end
-
- block:SetScript('OnClick', self.OnClick)
- block:RegisterForClicks('AnyDown')
-
- self:AddBlock(block)
- end
- end
-
- self:EndLayout()
-end
-questTracker.OnClick = function(block, button)
- if button == 'RightButton' then
- ObjectiveTracker_ToggleDropDown(block, QuestObjectiveTracker_OnOpenDropDown)
- else
- CloseDropDownMenus()
-
- local questLogIndex = GetQuestLogIndexByID(block.id)
- if ( IsModifiedClick("QUESTWATCHTOGGLE") ) then
- QuestObjectiveTracker_UntrackQuest(nil, block.id);
- else
- if ( IsQuestComplete(block.id) and GetQuestLogIsAutoComplete(questLogIndex) ) then
- AutoQuestPopupTracker_RemovePopUp(block.id);
- ShowQuestComplete(questLogIndex);
- else
- QuestLogPopupDetailFrame_Show(questLogIndex);
- end
- end
- end
-end
-
-local UpdateAchievementTracker = function() end
-local UpdateTaskTracker = function() end
-local UpdateScenarioTracker = function() end
-
-function plugin:Update(reason, id)
-
- print('update', reason, #plugin.trackers)
-
- if plugin.minimized then
- for i, tracker in ipairs(plugin.trackers) do
- tracker:Hide()
- end
- return
- end
-
-
- local X_REASON = reason or X_ALL
- local X_ID = id
-
- plugin.maxHeight = plugin:GetHeight()
- plugin.oldContentsHeight = plugin.contentHeight
- plugin.contentHeight = 0
- plugin.currentBlock = nil
- plugin.firstBlock = nil
- plugin:SetWidth(trackerWidth)
-
- -- pad for header
- plugin.contentHeight = plugin.header:GetHeight()
-
- for i, header in ipairs(plugin.trackers) do
- header.used = nil
- end
-
-
- local addedSpace = false
- for i, tracker in ipairs(plugin.trackers) do
- if ( band(X_REASON, tracker.updateReasonModule + tracker.updateReasonEvents ) > 0 ) then
- print('->', tracker.headerText)
- tracker:Update()
- if tracker.oldContentHeight - tracker.contentHeight >= 1 then
- addedSpace = true
- end
- else
- -- if we can fit another header or an animation handler popped, contents need to be generated
- if addedSpace or (tracker.header and tracker.header.animating) then
- print('->', tracker.headerText, 'added space')
- tracker:Update()
- else
- print('->', tracker.headerText, 'lite update')
- -- otherwise, measure contents and hide anything that won't fit
- tracker:ResetAnchors()
- end
- end
- end
-
- for i, tracker in ipairs(plugin.trackers) do
- if tracker.currentBlock then
- if not tracker.header:IsShown() then
- tracker.header:Show()
- end
- else
- if tracker.header:IsShown() then
- tracker.header:Hide()
- end
- end
- end
-
- if VeneerBuffFrame and VeneerBuffFrame.lastBuff then
- plugin:ClearAllPoints()
- plugin:SetPoint('TOP', VeneerBuffFrame.lastBuff, 'BOTTOM', 0, -4)
- plugin:SetPoint('RIGHT', UIParent, 'RIGHT', -6, 0)
- else
- plugin:ClearAllPoints()
- plugin:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -6, -120)
- end
-
- plugin:Show()
-end
-
-plugin.init = function()
-
- plugin:RegisterEvent("QUEST_LOG_UPDATE")
- plugin:RegisterEvent("TRACKED_ACHIEVEMENT_LIST_CHANGED")
- plugin:RegisterEvent("QUEST_WATCH_LIST_CHANGED")
- plugin:RegisterEvent("QUEST_AUTOCOMPLETE")
- plugin:RegisterEvent("QUEST_ACCEPTED")
- plugin:RegisterEvent("SUPER_TRACKED_QUEST_CHANGED")
- plugin:RegisterEvent("SCENARIO_UPDATE")
- plugin:RegisterEvent("SCENARIO_CRITERIA_UPDATE")
- plugin:RegisterEvent("SCENARIO_SPELL_UPDATE")
- plugin:RegisterEvent("TRACKED_ACHIEVEMENT_UPDATE")
- plugin:RegisterEvent("ZONE_CHANGED_NEW_AREA");
- plugin:RegisterEvent("ZONE_CHANGED");
- plugin:RegisterEvent("QUEST_POI_UPDATE");
- plugin:RegisterEvent("VARIABLES_LOADED");
- plugin:RegisterEvent("QUEST_TURNED_IN");
- plugin:RegisterEvent("PLAYER_MONEY");
-
- plugin.trackers = {
- questTracker,
- }
- print('bub')
-end
-function plugin:event(event, ...)
- print('|cFFFF0088' .. event, ...)
- if event == 'QUEST_WATCH_LIST_CHANGED' then
- local questID, added = ...
- if added then
- if not IsQuestBounty(questID) or IsQuestComplete(questId) then
- print(questID, added)
- plugin:Update(X_QUEST_ADDED, questID)
- end
- else
- print()
- plugin:Update(X_QUEST)
- end
- elseif event == 'QUEST_LOG_UPDATE' then
- plugin:Update(X_MODULE_QUEST)
- elseif event == 'QUEST_POI_UPDATE' then
-
- if GetCVar("trackQuestSorting") == "proximity" then
- -- todo: sort blocks
- end
- plugin:Update(X_MODULE_QUEST)
- elseif event == 'PLAYER_MONEY' then
- plugin:Update(X_MONEY)
- end
-
-end
-
--- adjusts money events bitcode when a tracker is displaying money data
-function plugin:UpdateMoneyFlag(watchMoney, reason)
- if watchMoney then
- if (band(X_MONEY, reason) == 0) then
- X_MONEY = X_MONEY - reason
- end
- else
- if (band(X_MONEY, reason) > 0) then
- X_MONEY = X_MONEY + reason
- end
- end
-end
-
--- used by framescripts to poke the updater when an animation has ended
-function plugin:UpdateAnimation(block)
-
- local reason = block.handler.updateReasonEvents
- if block.animating then
- if (band(X_ANIMATION, reason) == 0) then
- X_ANIMATION = X_ANIMATION - reason
- end
- else
- if (band(X_ANIMATION, reason) > 0) then
- X_ANIMATION = X_ANIMATION + reason
- end
- end
-end
\ No newline at end of file
diff -r d41c7dc3012f -r caded2668701 Veneer_Objectives/Veneer_Objectives.iml
--- a/Veneer_Objectives/Veneer_Objectives.iml Tue Oct 25 12:33:20 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff -r d41c7dc3012f -r caded2668701 Veneer_Objectives/Veneer_Objectives.toc
--- a/Veneer_Objectives/Veneer_Objectives.toc Tue Oct 25 12:33:20 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-## Interface: 70000
-## Title: Veneer |cFF00FF00Objective Tracker|r
-## Notes: Objectives frame hooker-upper
-## Author: Krakyn
-## Version: 1.0-@project-revision@
-## SavedVariables: VeneerData
-## X-Category: Interface Enhancements
-## DefaultState: Enabled
-## LoadOnDemand: 0
-## Dependencies: Veneer
-
-Veneer_Objectives.xml
-ObjectiveTracker.lua
\ No newline at end of file
diff -r d41c7dc3012f -r caded2668701 Veneer_Objectives/Veneer_Objectives.xml
--- a/Veneer_Objectives/Veneer_Objectives.xml Tue Oct 25 12:33:20 2016 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file