initial commit
This commit is contained in:
195
Modules/Blizzard/AlertFrame.lua
Normal file
195
Modules/Blizzard/AlertFrame.lua
Normal file
@@ -0,0 +1,195 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local B = E:GetModule('Blizzard')
|
||||
local Misc = E:GetModule('Misc')
|
||||
|
||||
local _G = _G
|
||||
local pairs = pairs
|
||||
local ipairs = ipairs
|
||||
local CreateFrame = CreateFrame
|
||||
local hooksecurefunc = hooksecurefunc
|
||||
|
||||
local POSITION, ANCHOR_POINT, YOFFSET = 'TOP', 'BOTTOM', -10
|
||||
|
||||
function E:PostAlertMove()
|
||||
local AlertFrameMover = _G.AlertFrameMover
|
||||
local AlertFrameHolder = _G.AlertFrameHolder
|
||||
|
||||
local _, y = AlertFrameMover:GetCenter()
|
||||
local screenHeight = E.UIParent:GetTop()
|
||||
if y > (screenHeight / 2) then
|
||||
POSITION = 'TOP'
|
||||
ANCHOR_POINT = 'BOTTOM'
|
||||
YOFFSET = -10
|
||||
AlertFrameMover:SetText(AlertFrameMover.textString..' (Grow Down)')
|
||||
else
|
||||
POSITION = 'BOTTOM'
|
||||
ANCHOR_POINT = 'TOP'
|
||||
YOFFSET = 10
|
||||
AlertFrameMover:SetText(AlertFrameMover.textString..' (Grow Up)')
|
||||
end
|
||||
|
||||
local AlertFrame = _G.AlertFrame
|
||||
local GroupLootContainer = _G.GroupLootContainer
|
||||
|
||||
local rollBars = Misc.RollBars
|
||||
if E.private.general.lootRoll then
|
||||
local lastframe, lastShownFrame
|
||||
for i, frame in pairs(rollBars) do
|
||||
frame:ClearAllPoints()
|
||||
if i ~= 1 then
|
||||
if POSITION == 'TOP' then
|
||||
frame:Point('TOP', lastframe, 'BOTTOM', 0, -4)
|
||||
else
|
||||
frame:Point('BOTTOM', lastframe, 'TOP', 0, 4)
|
||||
end
|
||||
else
|
||||
if POSITION == 'TOP' then
|
||||
frame:Point('TOP', AlertFrameHolder, 'BOTTOM', 0, -4)
|
||||
else
|
||||
frame:Point('BOTTOM', AlertFrameHolder, 'TOP', 0, 4)
|
||||
end
|
||||
end
|
||||
lastframe = frame
|
||||
|
||||
if frame:IsShown() then
|
||||
lastShownFrame = frame
|
||||
end
|
||||
end
|
||||
|
||||
AlertFrame:ClearAllPoints()
|
||||
GroupLootContainer:ClearAllPoints()
|
||||
if lastShownFrame then
|
||||
AlertFrame:SetAllPoints(lastShownFrame)
|
||||
GroupLootContainer:Point(POSITION, lastShownFrame, ANCHOR_POINT, 0, YOFFSET)
|
||||
else
|
||||
AlertFrame:SetAllPoints(AlertFrameHolder)
|
||||
GroupLootContainer:Point(POSITION, AlertFrameHolder, ANCHOR_POINT, 0, YOFFSET)
|
||||
end
|
||||
if GroupLootContainer:IsShown() then
|
||||
B.GroupLootContainer_Update(GroupLootContainer)
|
||||
end
|
||||
else
|
||||
AlertFrame:ClearAllPoints()
|
||||
AlertFrame:SetAllPoints(AlertFrameHolder)
|
||||
GroupLootContainer:ClearAllPoints()
|
||||
GroupLootContainer:Point(POSITION, AlertFrameHolder, ANCHOR_POINT, 0, YOFFSET)
|
||||
if GroupLootContainer:IsShown() then
|
||||
B.GroupLootContainer_Update(GroupLootContainer)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function B:AdjustAnchors(relativeAlert)
|
||||
if self.alertFrame:IsShown() then
|
||||
self.alertFrame:ClearAllPoints()
|
||||
self.alertFrame:Point(POSITION, relativeAlert, ANCHOR_POINT, 0, YOFFSET)
|
||||
return self.alertFrame
|
||||
end
|
||||
return relativeAlert
|
||||
end
|
||||
|
||||
function B:AdjustAnchorsNonAlert(relativeAlert)
|
||||
if self.anchorFrame:IsShown() then
|
||||
self.anchorFrame:ClearAllPoints()
|
||||
self.anchorFrame:Point(POSITION, relativeAlert, ANCHOR_POINT, 0, YOFFSET)
|
||||
return self.anchorFrame
|
||||
end
|
||||
return relativeAlert
|
||||
end
|
||||
|
||||
function B:AdjustQueuedAnchors(relativeAlert)
|
||||
for alertFrame in self.alertFramePool:EnumerateActive() do
|
||||
alertFrame:ClearAllPoints()
|
||||
alertFrame:Point(POSITION, relativeAlert, ANCHOR_POINT, 0, YOFFSET)
|
||||
relativeAlert = alertFrame
|
||||
end
|
||||
return relativeAlert
|
||||
end
|
||||
|
||||
function B:GroupLootContainer_Update()
|
||||
local lastIdx
|
||||
|
||||
for i=1, self.maxIndex do
|
||||
local frame = self.rollFrames[i]
|
||||
if frame then
|
||||
frame:ClearAllPoints()
|
||||
|
||||
local prevFrame = self.rollFrames[i-1]
|
||||
if prevFrame and prevFrame ~= frame then
|
||||
frame:Point(POSITION, prevFrame, ANCHOR_POINT, 0, YOFFSET)
|
||||
else
|
||||
frame:Point(POSITION, self, POSITION, 0, YOFFSET)
|
||||
end
|
||||
|
||||
lastIdx = i
|
||||
end
|
||||
end
|
||||
|
||||
if lastIdx then
|
||||
self:Height(self.reservedSize * lastIdx)
|
||||
self:Show()
|
||||
else
|
||||
self:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
local function AlertSubSystem_AdjustPosition(alertFrameSubSystem)
|
||||
if alertFrameSubSystem.alertFramePool then --queued alert system
|
||||
alertFrameSubSystem.AdjustAnchors = B.AdjustQueuedAnchors
|
||||
elseif not alertFrameSubSystem.anchorFrame then --simple alert system
|
||||
alertFrameSubSystem.AdjustAnchors = B.AdjustAnchors
|
||||
elseif alertFrameSubSystem.anchorFrame then --anchor frame system
|
||||
alertFrameSubSystem.AdjustAnchors = B.AdjustAnchorsNonAlert
|
||||
end
|
||||
end
|
||||
|
||||
function B:AlertMovers()
|
||||
local AlertFrameHolder = CreateFrame('Frame', 'AlertFrameHolder', E.UIParent)
|
||||
AlertFrameHolder:Size(180, 20)
|
||||
AlertFrameHolder:Point('TOP', E.UIParent, 'TOP', -1, -18)
|
||||
|
||||
_G.GroupLootContainer:EnableMouse(false) -- Prevent this weird non-clickable area stuff since 8.1; Monitor this, as it may cause addon compatibility.
|
||||
_G.UIPARENT_MANAGED_FRAME_POSITIONS.GroupLootContainer = nil
|
||||
E:CreateMover(AlertFrameHolder, 'AlertFrameMover', L["Loot / Alert Frames"], nil, nil, E.PostAlertMove, nil, nil, 'general,blizzUIImprovements')
|
||||
|
||||
--Replace AdjustAnchors functions to allow alerts to grow down if needed.
|
||||
--We will need to keep an eye on this in case it taints. It shouldn't, but you never know.
|
||||
for _, alertFrameSubSystem in ipairs(_G.AlertFrame.alertFrameSubSystems) do
|
||||
AlertSubSystem_AdjustPosition(alertFrameSubSystem)
|
||||
end
|
||||
|
||||
--This should catch any alert systems that are created by other addons
|
||||
hooksecurefunc(_G.AlertFrame, 'AddAlertFrameSubSystem', function(_, alertFrameSubSystem)
|
||||
AlertSubSystem_AdjustPosition(alertFrameSubSystem)
|
||||
end)
|
||||
|
||||
self:SecureHook(_G.AlertFrame, 'UpdateAnchors', E.PostAlertMove)
|
||||
hooksecurefunc('GroupLootContainer_Update', B.GroupLootContainer_Update)
|
||||
|
||||
--[=[ Code you can use for alert testing
|
||||
--Queued Alerts:
|
||||
/run AchievementAlertSystem:AddAlert(5192)
|
||||
/run CriteriaAlertSystem:AddAlert(9023, 'Doing great!')
|
||||
/run LootAlertSystem:AddAlert('\124cffa335ee\124Hitem:18832::::::::::\124h[Brutality Blade]\124h\124r', 1, 1, 1, 1, false, false, 0, false, false)
|
||||
/run LootUpgradeAlertSystem:AddAlert('\124cffa335ee\124Hitem:18832::::::::::\124h[Brutality Blade]\124h\124r', 1, 1, 1, nil, nil, false)
|
||||
/run MoneyWonAlertSystem:AddAlert(81500)
|
||||
/run NewRecipeLearnedAlertSystem:AddAlert(204)
|
||||
|
||||
--Simple Alerts
|
||||
/run GuildChallengeAlertSystem:AddAlert(3, 2, 5)
|
||||
/run InvasionAlertSystem:AddAlert(678, DUNGEON_FLOOR_THENEXUS1, true, 1, 1)
|
||||
/run WorldQuestCompleteAlertSystem:AddAlert(AlertFrameMixin:BuildQuestData(42114))
|
||||
/run GarrisonBuildingAlertSystem:AddAlert(GARRISON_CACHE)
|
||||
/run GarrisonFollowerAlertSystem:AddAlert(204, 'Ben Stone', 90, 3, false)
|
||||
/run GarrisonMissionAlertSystem:AddAlert(681) (Requires a mission ID that is in your mission list.)
|
||||
/run GarrisonShipFollowerAlertSystem:AddAlert(592, 'Test', 'Transport', 'GarrBuilding_Barracks_1_H', 3, 2, 1)
|
||||
/run LegendaryItemAlertSystem:AddAlert('\124cffa335ee\124Hitem:18832::::::::::\124h[Brutality Blade]\124h\124r')
|
||||
/run EntitlementDeliveredAlertSystem:AddAlert('', [[Interface\Icons\Ability_pvp_gladiatormedallion]], TRINKET0SLOT, 214)
|
||||
/run RafRewardDeliveredAlertSystem:AddAlert('', [[Interface\Icons\Ability_pvp_gladiatormedallion]], TRINKET0SLOT, 214)
|
||||
/run DigsiteCompleteAlertSystem:AddAlert('Human')
|
||||
|
||||
--Bonus Rolls
|
||||
/run BonusRollFrame_CloseBonusRoll()
|
||||
/run BonusRollFrame_StartBonusRoll(242969,'test',10,515,1273,14) --515 is darkmoon token, change to another currency id you have
|
||||
]=]
|
||||
end
|
||||
178
Modules/Blizzard/AltPower.lua
Normal file
178
Modules/Blizzard/AltPower.lua
Normal file
@@ -0,0 +1,178 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local B = E:GetModule('Blizzard')
|
||||
local LSM = E.Libs.LSM
|
||||
|
||||
local _G = _G
|
||||
local floor = floor
|
||||
local format = format
|
||||
local CreateFrame = CreateFrame
|
||||
local UnitPowerMax = UnitPowerMax
|
||||
local UnitPower = UnitPower
|
||||
local GetUnitPowerBarInfo = GetUnitPowerBarInfo
|
||||
local GetUnitPowerBarStrings = GetUnitPowerBarStrings
|
||||
|
||||
local function updateTooltip(self)
|
||||
if _G.GameTooltip:IsForbidden() then return end
|
||||
|
||||
if self.powerName and self.powerTooltip then
|
||||
_G.GameTooltip:SetText(self.powerName, 1, 1, 1)
|
||||
_G.GameTooltip:AddLine(self.powerTooltip, nil, nil, nil, 1)
|
||||
_G.GameTooltip:Show()
|
||||
end
|
||||
end
|
||||
|
||||
local function onEnter(self)
|
||||
if (not self:IsVisible()) or _G.GameTooltip:IsForbidden() then return end
|
||||
|
||||
_G.GameTooltip:ClearAllPoints()
|
||||
_G.GameTooltip_SetDefaultAnchor(_G.GameTooltip, self)
|
||||
updateTooltip(self)
|
||||
end
|
||||
|
||||
local function onLeave()
|
||||
_G.GameTooltip:Hide()
|
||||
end
|
||||
|
||||
function B:SetAltPowerBarText(text, name, value, max, percent)
|
||||
local textFormat = E.db.general.altPowerBar.textFormat
|
||||
if textFormat == 'NONE' or not textFormat then
|
||||
text:SetText('')
|
||||
elseif textFormat == 'NAME' then
|
||||
text:SetText(format('%s', name))
|
||||
elseif textFormat == 'NAMEPERC' then
|
||||
text:SetText(format('%s: %s%%', name, percent))
|
||||
elseif textFormat == 'NAMECURMAX' then
|
||||
text:SetText(format('%s: %s / %s', name, value, max))
|
||||
elseif textFormat == 'NAMECURMAXPERC' then
|
||||
text:SetText(format('%s: %s / %s - %s%%', name, value, max, percent))
|
||||
elseif textFormat == 'PERCENT' then
|
||||
text:SetText(format('%s%%', percent))
|
||||
elseif textFormat == 'CURMAX' then
|
||||
text:SetText(format('%s / %s', value, max))
|
||||
elseif textFormat == 'CURMAXPERC' then
|
||||
text:SetText(format('%s / %s - %s%%', value, max, percent))
|
||||
end
|
||||
end
|
||||
|
||||
function B:PositionAltPowerBar()
|
||||
local holder = CreateFrame('Frame', 'AltPowerBarHolder', E.UIParent)
|
||||
holder:Point('TOP', E.UIParent, 'TOP', -1, -36)
|
||||
holder:Size(128, 50)
|
||||
|
||||
_G.PlayerPowerBarAlt:ClearAllPoints()
|
||||
_G.PlayerPowerBarAlt:Point('CENTER', holder, 'CENTER')
|
||||
_G.PlayerPowerBarAlt:SetParent(holder)
|
||||
_G.PlayerPowerBarAlt:SetMovable(true)
|
||||
_G.PlayerPowerBarAlt:SetUserPlaced(true)
|
||||
_G.UIPARENT_MANAGED_FRAME_POSITIONS.PlayerPowerBarAlt = nil
|
||||
|
||||
E:CreateMover(holder, 'AltPowerBarMover', L["Alternative Power"], nil, nil, nil, nil, nil, 'general,alternativePowerGroup')
|
||||
end
|
||||
|
||||
function B:UpdateAltPowerBarColors()
|
||||
local bar = _G.ElvUI_AltPowerBar
|
||||
|
||||
if E.db.general.altPowerBar.statusBarColorGradient then
|
||||
if bar.colorGradientR and bar.colorGradientG and bar.colorGradientB then
|
||||
bar:SetStatusBarColor(bar.colorGradientR, bar.colorGradientG, bar.colorGradientB)
|
||||
elseif bar.powerValue then
|
||||
local power, maxPower = bar.powerValue or 0, bar.powerMaxValue or 0
|
||||
local value = (maxPower > 0 and power / maxPower) or 0
|
||||
bar.colorGradientValue = value
|
||||
|
||||
local r, g, b = E:ColorGradient(value, 0.8,0,0, 0.8,0.8,0, 0,0.8,0)
|
||||
bar.colorGradientR, bar.colorGradientG, bar.colorGradientB = r, g, b
|
||||
|
||||
bar:SetStatusBarColor(r, g, b)
|
||||
else
|
||||
bar:SetStatusBarColor(0.6, 0.6, 0.6) -- uh, fallback!
|
||||
end
|
||||
else
|
||||
local color = E.db.general.altPowerBar.statusBarColor
|
||||
bar:SetStatusBarColor(color.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
|
||||
function B:UpdateAltPowerBarSettings()
|
||||
local bar = _G.ElvUI_AltPowerBar
|
||||
local db = E.db.general.altPowerBar
|
||||
|
||||
bar:Size(db.width or 250, db.height or 20)
|
||||
bar:SetStatusBarTexture(LSM:Fetch('statusbar', db.statusBar))
|
||||
bar.text:FontTemplate(LSM:Fetch('font', db.font), db.fontSize or 12, db.fontOutline or 'OUTLINE')
|
||||
_G.AltPowerBarHolder:Size(bar.backdrop:GetSize())
|
||||
|
||||
E:SetSmoothing(bar, db.smoothbars)
|
||||
|
||||
B:SetAltPowerBarText(bar.text, bar.powerName or '', bar.powerValue or 0, bar.powerMaxValue or 0, bar.powerPercent or 0)
|
||||
end
|
||||
|
||||
function B:UpdateAltPowerBar()
|
||||
_G.PlayerPowerBarAlt:UnregisterAllEvents()
|
||||
_G.PlayerPowerBarAlt:Hide()
|
||||
|
||||
local barInfo = GetUnitPowerBarInfo('player');
|
||||
local powerName, powerTooltip = GetUnitPowerBarStrings('player');
|
||||
if barInfo then
|
||||
local power = UnitPower('player', _G.ALTERNATE_POWER_INDEX)
|
||||
local maxPower = UnitPowerMax('player', _G.ALTERNATE_POWER_INDEX) or 0
|
||||
local perc = (maxPower > 0 and floor(power / maxPower * 100)) or 0
|
||||
|
||||
self.powerMaxValue = maxPower
|
||||
self.powerName = powerName
|
||||
self.powerPercent = perc
|
||||
self.powerTooltip = powerTooltip
|
||||
self.powerValue = power
|
||||
|
||||
self:Show()
|
||||
self:SetMinMaxValues(barInfo.minPower, maxPower)
|
||||
self:SetValue(power)
|
||||
|
||||
if E.db.general.altPowerBar.statusBarColorGradient then
|
||||
local value = (maxPower > 0 and power / maxPower) or 0
|
||||
self.colorGradientValue = value
|
||||
|
||||
local r, g, b = E:ColorGradient(value, 0.8,0,0, 0.8,0.8,0, 0,0.8,0)
|
||||
self.colorGradientR, self.colorGradientG, self.colorGradientB = r, g, b
|
||||
|
||||
self:SetStatusBarColor(r, g, b)
|
||||
end
|
||||
|
||||
B:SetAltPowerBarText(self.text, powerName or '', power or 0, maxPower, perc)
|
||||
else
|
||||
self.powerMaxValue = nil
|
||||
self.powerName = nil
|
||||
self.powerPercent = nil
|
||||
self.powerTooltip = nil
|
||||
self.powerValue = nil
|
||||
|
||||
self:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
function B:SkinAltPowerBar()
|
||||
if not E.db.general.altPowerBar.enable then return end
|
||||
|
||||
local powerbar = CreateFrame('StatusBar', 'ElvUI_AltPowerBar', E.UIParent)
|
||||
powerbar:CreateBackdrop(nil, true)
|
||||
powerbar:SetMinMaxValues(0, 200)
|
||||
powerbar:Point('CENTER', _G.AltPowerBarHolder)
|
||||
powerbar:Hide()
|
||||
|
||||
powerbar:SetScript('OnEnter', onEnter)
|
||||
powerbar:SetScript('OnLeave', onLeave)
|
||||
|
||||
powerbar.text = powerbar:CreateFontString(nil, 'OVERLAY')
|
||||
powerbar.text:Point('CENTER', powerbar, 'CENTER')
|
||||
powerbar.text:SetJustifyH('CENTER')
|
||||
|
||||
B:UpdateAltPowerBarSettings()
|
||||
B:UpdateAltPowerBarColors()
|
||||
|
||||
--Event handling
|
||||
powerbar:RegisterEvent('UNIT_POWER_UPDATE')
|
||||
powerbar:RegisterEvent('UNIT_POWER_BAR_SHOW')
|
||||
powerbar:RegisterEvent('UNIT_POWER_BAR_HIDE')
|
||||
powerbar:RegisterEvent('PLAYER_ENTERING_WORLD')
|
||||
powerbar:SetScript('OnEvent', B.UpdateAltPowerBar)
|
||||
end
|
||||
120
Modules/Blizzard/Blizzard.lua
Normal file
120
Modules/Blizzard/Blizzard.lua
Normal file
@@ -0,0 +1,120 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local B = E:GetModule('Blizzard')
|
||||
local Skins = E:GetModule('Skins')
|
||||
local TT = E:GetModule('Tooltip')
|
||||
|
||||
local _G = _G
|
||||
local CreateFrame = CreateFrame
|
||||
local GetQuestLogRewardXP = GetQuestLogRewardXP
|
||||
local GetRewardXP = GetRewardXP
|
||||
local IsAddOnLoaded = IsAddOnLoaded
|
||||
local UnitXP = UnitXP
|
||||
local UnitXPMax = UnitXPMax
|
||||
local hooksecurefunc = hooksecurefunc
|
||||
local C_QuestLog_ShouldShowQuestRewards = C_QuestLog.ShouldShowQuestRewards
|
||||
local C_QuestLog_GetSelectedQuest = C_QuestLog.GetSelectedQuest
|
||||
|
||||
--This changes the growth direction of the toast frame depending on position of the mover
|
||||
local function PostBNToastMove(mover)
|
||||
local x, y = mover:GetCenter();
|
||||
local screenHeight = E.UIParent:GetTop();
|
||||
local screenWidth = E.UIParent:GetRight()
|
||||
|
||||
local anchorPoint
|
||||
if y > (screenHeight / 2) then
|
||||
anchorPoint = (x > (screenWidth/2)) and 'TOPRIGHT' or 'TOPLEFT'
|
||||
else
|
||||
anchorPoint = (x > (screenWidth/2)) and 'BOTTOMRIGHT' or 'BOTTOMLEFT'
|
||||
end
|
||||
mover.anchorPoint = anchorPoint
|
||||
|
||||
_G.BNToastFrame:ClearAllPoints()
|
||||
_G.BNToastFrame:Point(anchorPoint, mover)
|
||||
end
|
||||
|
||||
function B:Initialize()
|
||||
B.Initialized = true
|
||||
|
||||
B:EnhanceColorPicker()
|
||||
B:KillBlizzard()
|
||||
B:DisableHelpTip()
|
||||
B:DisableNPE()
|
||||
B:AlertMovers()
|
||||
B:PositionCaptureBar()
|
||||
B:PositionDurabilityFrame()
|
||||
B:PositionGMFrames()
|
||||
B:SkinBlizzTimers()
|
||||
B:PositionVehicleFrame()
|
||||
B:PositionTalkingHead()
|
||||
B:Handle_LevelUpDisplay_BossBanner()
|
||||
B:Handle_UIWidgets()
|
||||
B:GarrisonDropDown()
|
||||
|
||||
if not IsAddOnLoaded('DugisGuideViewerZ') then
|
||||
B:MoveObjectiveFrame()
|
||||
end
|
||||
|
||||
if not IsAddOnLoaded('SimplePowerBar') then
|
||||
B:PositionAltPowerBar()
|
||||
B:SkinAltPowerBar()
|
||||
end
|
||||
|
||||
E:CreateMover(_G.LossOfControlFrame, 'LossControlMover', L["Loss Control Icon"])
|
||||
|
||||
-- Battle.Net Frame
|
||||
_G.BNToastFrame:Point('TOPRIGHT', _G.MMHolder or _G.Minimap, 'BOTTOMRIGHT', 0, -10)
|
||||
E:CreateMover(_G.BNToastFrame, 'BNETMover', L["BNet Frame"], nil, nil, PostBNToastMove)
|
||||
_G.BNToastFrame.mover:Size(_G.BNToastFrame:GetSize())
|
||||
TT:SecureHook(_G.BNToastFrame, 'SetPoint', 'RepositionBNET')
|
||||
|
||||
-- Quick Join Bug
|
||||
CreateFrame('Frame'):SetScript('OnUpdate', function()
|
||||
if _G.LFRBrowseFrame.timeToClear then
|
||||
_G.LFRBrowseFrame.timeToClear = nil
|
||||
end
|
||||
end)
|
||||
|
||||
--Add (+X%) to quest rewards experience text
|
||||
hooksecurefunc('QuestInfo_Display', function()
|
||||
local unitXP, unitXPMax = UnitXP('player'), UnitXPMax('player')
|
||||
if _G.QuestInfoFrame.questLog then
|
||||
local selectedQuest = C_QuestLog_GetSelectedQuest()
|
||||
if C_QuestLog_ShouldShowQuestRewards(selectedQuest) then
|
||||
local xp = GetQuestLogRewardXP()
|
||||
if xp and xp > 0 then
|
||||
local text = _G.MapQuestInfoRewardsFrame.XPFrame.Name:GetText()
|
||||
if text then _G.MapQuestInfoRewardsFrame.XPFrame.Name:SetFormattedText('%s (|cff4beb2c+%.2f%%|r)', text, (((unitXP + xp) / unitXPMax) - (unitXP / unitXPMax))*100) end
|
||||
end
|
||||
end
|
||||
else
|
||||
local xp = GetRewardXP()
|
||||
if xp and xp > 0 then
|
||||
local text = _G.QuestInfoXPFrame.ValueText:GetText()
|
||||
if text then _G.QuestInfoXPFrame.ValueText:SetFormattedText('%s (|cff4beb2c+%.2f%%|r)', text, (((unitXP + xp) / unitXPMax) - (unitXP / unitXPMax))*100) end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- MicroButton Talent Alert
|
||||
local TalentMicroButtonAlert = _G.TalentMicroButtonAlert
|
||||
if TalentMicroButtonAlert then -- why do we need to check this?
|
||||
if E.global.general.showMissingTalentAlert then
|
||||
TalentMicroButtonAlert:ClearAllPoints()
|
||||
TalentMicroButtonAlert:Point('CENTER', E.UIParent, 'TOP', 0, -75)
|
||||
TalentMicroButtonAlert:StripTextures()
|
||||
TalentMicroButtonAlert.Arrow:Hide()
|
||||
TalentMicroButtonAlert.Text:FontTemplate()
|
||||
TalentMicroButtonAlert:CreateBackdrop('Transparent')
|
||||
Skins:HandleCloseButton(TalentMicroButtonAlert.CloseButton)
|
||||
|
||||
TalentMicroButtonAlert.tex = TalentMicroButtonAlert:CreateTexture(nil, 'OVERLAY')
|
||||
TalentMicroButtonAlert.tex:Point('RIGHT', -10, 0)
|
||||
TalentMicroButtonAlert.tex:SetTexture([[Interface\DialogFrame\UI-Dialog-Icon-AlertNew]])
|
||||
TalentMicroButtonAlert.tex:Size(32, 32)
|
||||
else
|
||||
TalentMicroButtonAlert:Kill() -- Kill it, because then the blizz default will show
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
E:RegisterModule(B:GetName())
|
||||
28
Modules/Blizzard/CaptureBar.lua
Normal file
28
Modules/Blizzard/CaptureBar.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local B = E:GetModule('Blizzard')
|
||||
|
||||
local _G = _G
|
||||
local hooksecurefunc = hooksecurefunc
|
||||
|
||||
local function CaptureUpdate()
|
||||
if _G.NUM_EXTENDED_UI_FRAMES then
|
||||
local captureBar
|
||||
for i=1, _G.NUM_EXTENDED_UI_FRAMES do
|
||||
captureBar = _G['WorldStateCaptureBar' .. i]
|
||||
|
||||
if captureBar and captureBar:IsVisible() then
|
||||
captureBar:ClearAllPoints()
|
||||
|
||||
if i == 1 then
|
||||
captureBar:Point('TOP', E.UIParent, 'TOP', 0, -170)
|
||||
else
|
||||
captureBar:Point('TOPLEFT', _G['WorldStateCaptureBar' .. i - 1], 'TOPLEFT', 0, -45)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function B:PositionCaptureBar()
|
||||
hooksecurefunc('UIParent_ManageFramePositions', CaptureUpdate)
|
||||
end
|
||||
404
Modules/Blizzard/ColorPicker.lua
Normal file
404
Modules/Blizzard/ColorPicker.lua
Normal file
@@ -0,0 +1,404 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- Credit to Jaslm, most of this code is his from the addon ColorPickerPlus.
|
||||
-- Modified and optimized by Simpy.
|
||||
------------------------------------------------------------------------------
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local B = E:GetModule('Blizzard')
|
||||
local S = E:GetModule('Skins')
|
||||
|
||||
local _G = _G
|
||||
local strlen, strjoin, gsub = strlen, strjoin, gsub
|
||||
local tonumber, floor, strsub, wipe = tonumber, floor, strsub, wipe
|
||||
local CreateFrame = CreateFrame
|
||||
local IsAddOnLoaded = IsAddOnLoaded
|
||||
local IsControlKeyDown = IsControlKeyDown
|
||||
local IsModifierKeyDown = IsModifierKeyDown
|
||||
local CALENDAR_COPY_EVENT, CALENDAR_PASTE_EVENT = CALENDAR_COPY_EVENT, CALENDAR_PASTE_EVENT
|
||||
local CLASS, DEFAULT = CLASS, DEFAULT
|
||||
|
||||
local colorBuffer = {}
|
||||
local function alphaValue(num)
|
||||
return num and floor(((1 - num) * 100) + .05) or 0
|
||||
end
|
||||
|
||||
local function UpdateAlphaText(alpha)
|
||||
if not alpha then alpha = alphaValue(_G.OpacitySliderFrame:GetValue()) end
|
||||
|
||||
_G.ColorPPBoxA:SetText(alpha)
|
||||
end
|
||||
|
||||
local function UpdateAlpha(tbox)
|
||||
local num = tbox:GetNumber()
|
||||
if num > 100 then
|
||||
tbox:SetText(100)
|
||||
num = 100
|
||||
end
|
||||
|
||||
_G.OpacitySliderFrame:SetValue(1 - (num / 100))
|
||||
end
|
||||
|
||||
local function expandFromThree(r, g, b)
|
||||
return strjoin('',r,r,g,g,b,b)
|
||||
end
|
||||
|
||||
local function extendToSix(str)
|
||||
for _=1, 6-strlen(str) do str=str..0 end
|
||||
return str
|
||||
end
|
||||
|
||||
local function GetHexColor(box)
|
||||
local rgb, rgbSize = box:GetText(), box:GetNumLetters()
|
||||
if rgbSize == 3 then
|
||||
rgb = gsub(rgb, '(%x)(%x)(%x)$', expandFromThree)
|
||||
elseif rgbSize < 6 then
|
||||
rgb = gsub(rgb, '(.+)$', extendToSix)
|
||||
end
|
||||
|
||||
local r, g, b = tonumber(strsub(rgb,0,2),16) or 0, tonumber(strsub(rgb,3,4),16) or 0, tonumber(strsub(rgb,5,6),16) or 0
|
||||
|
||||
return r/255, g/255, b/255
|
||||
end
|
||||
|
||||
local function UpdateColorTexts(r, g, b, box)
|
||||
if not (r and g and b) then
|
||||
r, g, b = _G.ColorPickerFrame:GetColorRGB()
|
||||
|
||||
if box then
|
||||
if box == _G.ColorPPBoxH then
|
||||
r, g, b = GetHexColor(box)
|
||||
else
|
||||
local num = box:GetNumber()
|
||||
if num > 255 then num = 255 end
|
||||
local c = num/255
|
||||
if box == _G.ColorPPBoxR then
|
||||
r = c
|
||||
elseif box == _G.ColorPPBoxG then
|
||||
g = c
|
||||
elseif box == _G.ColorPPBoxB then
|
||||
b = c
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- we want those /255 values
|
||||
r, g, b = r*255, g*255, b*255
|
||||
|
||||
_G.ColorPPBoxH:SetText(('%.2x%.2x%.2x'):format(r, g, b))
|
||||
_G.ColorPPBoxR:SetText(r)
|
||||
_G.ColorPPBoxG:SetText(g)
|
||||
_G.ColorPPBoxB:SetText(b)
|
||||
end
|
||||
|
||||
local function UpdateColor()
|
||||
local r, g, b = GetHexColor(_G.ColorPPBoxH)
|
||||
_G.ColorPickerFrame:SetColorRGB(r, g, b)
|
||||
_G.ColorSwatch:SetColorTexture(r, g, b)
|
||||
end
|
||||
|
||||
local function ColorPPBoxA_SetFocus()
|
||||
_G.ColorPPBoxA:SetFocus()
|
||||
end
|
||||
|
||||
local function ColorPPBoxR_SetFocus()
|
||||
_G.ColorPPBoxR:SetFocus()
|
||||
end
|
||||
|
||||
local delayWait, delayFunc = 0.15
|
||||
local function delayCall()
|
||||
if delayFunc then
|
||||
delayFunc()
|
||||
delayFunc = nil
|
||||
end
|
||||
end
|
||||
local function onColorSelect(frame, r, g, b)
|
||||
if frame.noColorCallback then return end
|
||||
|
||||
_G.ColorSwatch:SetColorTexture(r, g, b)
|
||||
UpdateColorTexts(r, g, b)
|
||||
|
||||
if r == 0 and g == 0 and b == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
if not frame:IsVisible() then
|
||||
delayCall()
|
||||
elseif not delayFunc then
|
||||
delayFunc = _G.ColorPickerFrame.func
|
||||
E:Delay(delayWait, delayCall)
|
||||
end
|
||||
end
|
||||
|
||||
local function onValueChanged(frame, value)
|
||||
local alpha = alphaValue(value)
|
||||
if frame.lastAlpha ~= alpha then
|
||||
frame.lastAlpha = alpha
|
||||
|
||||
UpdateAlphaText(alpha)
|
||||
|
||||
if not _G.ColorPickerFrame:IsVisible() then
|
||||
delayCall()
|
||||
else
|
||||
local opacityFunc = _G.ColorPickerFrame.opacityFunc
|
||||
if delayFunc and (delayFunc ~= opacityFunc) then
|
||||
delayFunc = opacityFunc
|
||||
elseif not delayFunc then
|
||||
delayFunc = opacityFunc
|
||||
E:Delay(delayWait, delayCall)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function B:EnhanceColorPicker()
|
||||
if IsAddOnLoaded('ColorPickerPlus') then return end
|
||||
|
||||
--Skin the default frame, move default buttons into place
|
||||
_G.ColorPickerFrame:SetClampedToScreen(true)
|
||||
_G.ColorPickerFrame:CreateBackdrop('Transparent')
|
||||
_G.ColorPickerFrame.Border:Hide()
|
||||
|
||||
_G.ColorPickerFrame.Header:StripTextures()
|
||||
_G.ColorPickerFrame.Header:ClearAllPoints()
|
||||
_G.ColorPickerFrame.Header:Point('TOP', _G.ColorPickerFrame, 0, 0)
|
||||
|
||||
_G.ColorPickerCancelButton:ClearAllPoints()
|
||||
_G.ColorPickerOkayButton:ClearAllPoints()
|
||||
_G.ColorPickerCancelButton:Point('BOTTOMRIGHT', _G.ColorPickerFrame, 'BOTTOMRIGHT', -6, 6)
|
||||
_G.ColorPickerCancelButton:Point('BOTTOMLEFT', _G.ColorPickerFrame, 'BOTTOM', 0, 6)
|
||||
_G.ColorPickerOkayButton:Point('BOTTOMLEFT', _G.ColorPickerFrame,'BOTTOMLEFT', 6,6)
|
||||
_G.ColorPickerOkayButton:Point('RIGHT', _G.ColorPickerCancelButton,'LEFT', -4,0)
|
||||
S:HandleSliderFrame(_G.OpacitySliderFrame)
|
||||
S:HandleButton(_G.ColorPickerOkayButton)
|
||||
S:HandleButton(_G.ColorPickerCancelButton)
|
||||
|
||||
_G.ColorPickerFrame:HookScript('OnShow', function(frame)
|
||||
-- get color that will be replaced
|
||||
local r, g, b = frame:GetColorRGB()
|
||||
_G.ColorPPOldColorSwatch:SetColorTexture(r,g,b)
|
||||
|
||||
-- show/hide the alpha box
|
||||
if frame.hasOpacity then
|
||||
_G.ColorPPBoxA:Show()
|
||||
_G.ColorPPBoxLabelA:Show()
|
||||
_G.ColorPPBoxH:SetScript('OnTabPressed', ColorPPBoxA_SetFocus)
|
||||
UpdateAlphaText()
|
||||
UpdateColorTexts()
|
||||
frame:Width(405)
|
||||
else
|
||||
_G.ColorPPBoxA:Hide()
|
||||
_G.ColorPPBoxLabelA:Hide()
|
||||
_G.ColorPPBoxH:SetScript('OnTabPressed', ColorPPBoxR_SetFocus)
|
||||
UpdateColorTexts()
|
||||
frame:Width(345)
|
||||
end
|
||||
|
||||
-- Memory Fix, Colorpicker will call the self.func() 100x per second, causing fps/memory issues,
|
||||
-- We overwrite these two scripts and set a limit on how often we allow a call their update functions
|
||||
_G.OpacitySliderFrame:SetScript('OnValueChanged', onValueChanged)
|
||||
frame:SetScript('OnColorSelect', onColorSelect)
|
||||
end)
|
||||
|
||||
-- make the Color Picker dialog a bit taller, to make room for edit boxes
|
||||
_G.ColorPickerFrame:Height(_G.ColorPickerFrame:GetHeight() + 40)
|
||||
|
||||
-- move the Color Swatch
|
||||
_G.ColorSwatch:ClearAllPoints()
|
||||
_G.ColorSwatch:Point('TOPLEFT', _G.ColorPickerFrame, 'TOPLEFT', 215, -45)
|
||||
|
||||
-- add Color Swatch for original color
|
||||
local t = _G.ColorPickerFrame:CreateTexture('ColorPPOldColorSwatch')
|
||||
local w, h = _G.ColorSwatch:GetSize()
|
||||
t:Size(w*0.75,h*0.75)
|
||||
t:SetColorTexture(0,0,0)
|
||||
-- OldColorSwatch to appear beneath ColorSwatch
|
||||
t:SetDrawLayer('BORDER')
|
||||
t:Point('BOTTOMLEFT', 'ColorSwatch', 'TOPRIGHT', -(w/2), -(h/3))
|
||||
|
||||
-- add Color Swatch for the copied color
|
||||
t = _G.ColorPickerFrame:CreateTexture('ColorPPCopyColorSwatch')
|
||||
t:SetColorTexture(0,0,0)
|
||||
t:Size(w,h)
|
||||
t:Hide()
|
||||
|
||||
-- add copy button to the _G.ColorPickerFrame
|
||||
local b = CreateFrame('Button', 'ColorPPCopy', _G.ColorPickerFrame, 'UIPanelButtonTemplate, BackdropTemplate')
|
||||
S:HandleButton(b)
|
||||
b:SetText(CALENDAR_COPY_EVENT)
|
||||
b:Size(60, 22)
|
||||
b:Point('TOPLEFT', 'ColorSwatch', 'BOTTOMLEFT', 0, -5)
|
||||
|
||||
-- copy color into buffer on button click
|
||||
b:SetScript('OnClick', function()
|
||||
-- copy current dialog colors into buffer
|
||||
colorBuffer.r, colorBuffer.g, colorBuffer.b = _G.ColorPickerFrame:GetColorRGB()
|
||||
|
||||
-- enable Paste button and display copied color into swatch
|
||||
_G.ColorPPPaste:Enable()
|
||||
_G.ColorPPCopyColorSwatch:SetColorTexture(colorBuffer.r, colorBuffer.g, colorBuffer.b)
|
||||
_G.ColorPPCopyColorSwatch:Show()
|
||||
|
||||
colorBuffer.a = (_G.ColorPickerFrame.hasOpacity and _G.OpacitySliderFrame:GetValue()) or nil
|
||||
end)
|
||||
|
||||
--class color button
|
||||
b = CreateFrame('Button', 'ColorPPClass', _G.ColorPickerFrame, 'UIPanelButtonTemplate, BackdropTemplate')
|
||||
b:SetText(CLASS)
|
||||
S:HandleButton(b)
|
||||
b:Size(80, 22)
|
||||
b:Point('TOP', 'ColorPPCopy', 'BOTTOMRIGHT', 0, -7)
|
||||
|
||||
b:SetScript('OnClick', function()
|
||||
local color = E:ClassColor(E.myclass, true)
|
||||
_G.ColorPickerFrame:SetColorRGB(color.r, color.g, color.b)
|
||||
_G.ColorSwatch:SetColorTexture(color.r, color.g, color.b)
|
||||
if _G.ColorPickerFrame.hasOpacity then
|
||||
_G.OpacitySliderFrame:SetValue(0)
|
||||
end
|
||||
end)
|
||||
|
||||
-- add paste button to the _G.ColorPickerFrame
|
||||
b = CreateFrame('Button', 'ColorPPPaste', _G.ColorPickerFrame, 'UIPanelButtonTemplate, BackdropTemplate')
|
||||
b:SetText(CALENDAR_PASTE_EVENT)
|
||||
S:HandleButton(b)
|
||||
b:Size(60, 22)
|
||||
b:Point('TOPLEFT', 'ColorPPCopy', 'TOPRIGHT', 2, 0)
|
||||
b:Disable() -- enable when something has been copied
|
||||
|
||||
-- paste color on button click, updating frame components
|
||||
b:SetScript('OnClick', function()
|
||||
_G.ColorPickerFrame:SetColorRGB(colorBuffer.r, colorBuffer.g, colorBuffer.b)
|
||||
_G.ColorSwatch:SetColorTexture(colorBuffer.r, colorBuffer.g, colorBuffer.b)
|
||||
if _G.ColorPickerFrame.hasOpacity then
|
||||
if colorBuffer.a then --color copied had an alpha value
|
||||
_G.OpacitySliderFrame:SetValue(colorBuffer.a)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- add defaults button to the _G.ColorPickerFrame
|
||||
b = CreateFrame('Button', 'ColorPPDefault', _G.ColorPickerFrame, 'UIPanelButtonTemplate, BackdropTemplate')
|
||||
b:SetText(DEFAULT)
|
||||
S:HandleButton(b)
|
||||
b:Size(80, 22)
|
||||
b:Point('TOPLEFT', 'ColorPPClass', 'BOTTOMLEFT', 0, -7)
|
||||
b:Disable() -- enable when something has been copied
|
||||
b:SetScript('OnHide', function(btn)
|
||||
if btn.colors then
|
||||
wipe(btn.colors)
|
||||
end
|
||||
end)
|
||||
b:SetScript('OnShow', function(btn)
|
||||
if btn.colors then
|
||||
btn:Enable()
|
||||
else
|
||||
btn:Disable()
|
||||
end
|
||||
end)
|
||||
|
||||
-- paste color on button click, updating frame components
|
||||
b:SetScript('OnClick', function(btn)
|
||||
local colors = btn.colors
|
||||
_G.ColorPickerFrame:SetColorRGB(colors.r, colors.g, colors.b)
|
||||
_G.ColorSwatch:SetColorTexture(colors.r, colors.g, colors.b)
|
||||
if _G.ColorPickerFrame.hasOpacity then
|
||||
if colors.a then
|
||||
_G.OpacitySliderFrame:SetValue(colors.a)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- position Color Swatch for copy color
|
||||
_G.ColorPPCopyColorSwatch:Point('BOTTOM', 'ColorPPPaste', 'TOP', 0, 10)
|
||||
|
||||
-- move the Opacity Slider Frame to align with bottom of Copy ColorSwatch
|
||||
_G.OpacitySliderFrame:ClearAllPoints()
|
||||
_G.OpacitySliderFrame:Point('BOTTOM', 'ColorPPDefault', 'BOTTOM', 0, 0)
|
||||
_G.OpacitySliderFrame:Point('RIGHT', 'ColorPickerFrame', 'RIGHT', -35, 18)
|
||||
|
||||
-- set up edit box frames and interior label and text areas
|
||||
local boxes = { 'R', 'G', 'B', 'H', 'A' }
|
||||
for i = 1, #boxes do
|
||||
local rgb = boxes[i]
|
||||
local box = CreateFrame('EditBox', 'ColorPPBox'..rgb, _G.ColorPickerFrame, 'InputBoxTemplate, BackdropTemplate')
|
||||
box:Point('TOP', 'ColorPickerWheel', 'BOTTOM', 0, -15)
|
||||
box:SetFrameStrata('DIALOG')
|
||||
box:SetAutoFocus(false)
|
||||
box:SetTextInsets(0,7,0,0)
|
||||
box:SetJustifyH('RIGHT')
|
||||
box:Height(24)
|
||||
box:SetID(i)
|
||||
S:HandleEditBox(box)
|
||||
|
||||
-- hex entry box
|
||||
if i == 4 then
|
||||
box:SetMaxLetters(6)
|
||||
box:Width(56)
|
||||
box:SetNumeric(false)
|
||||
else
|
||||
box:SetMaxLetters(3)
|
||||
box:Width(40)
|
||||
box:SetNumeric(true)
|
||||
end
|
||||
|
||||
-- label
|
||||
local label = box:CreateFontString('ColorPPBoxLabel'..rgb, 'ARTWORK', 'GameFontNormalSmall')
|
||||
label:Point('RIGHT', 'ColorPPBox'..rgb, 'LEFT', -5, 0)
|
||||
label:SetText(i == 4 and '#' or rgb)
|
||||
label:SetTextColor(1, 1, 1)
|
||||
|
||||
-- set up scripts to handle event appropriately
|
||||
if i == 5 then
|
||||
box:SetScript('OnKeyUp', function(eb, key)
|
||||
local copyPaste = IsControlKeyDown() and key == 'V'
|
||||
if key == 'BACKSPACE' or copyPaste or (strlen(key) == 1 and not IsModifierKeyDown()) then
|
||||
UpdateAlpha(eb)
|
||||
elseif key == 'ENTER' or key == 'ESCAPE' then
|
||||
eb:ClearFocus()
|
||||
UpdateAlpha(eb)
|
||||
end
|
||||
end)
|
||||
else
|
||||
box:SetScript('OnKeyUp', function(eb, key)
|
||||
local copyPaste = IsControlKeyDown() and key == 'V'
|
||||
if key == 'BACKSPACE' or copyPaste or (strlen(key) == 1 and not IsModifierKeyDown()) then
|
||||
if i ~= 4 then UpdateColorTexts(nil, nil, nil, eb) end
|
||||
if i == 4 and eb:GetNumLetters() ~= 6 then return end
|
||||
UpdateColor()
|
||||
elseif key == 'ENTER' or key == 'ESCAPE' then
|
||||
eb:ClearFocus()
|
||||
UpdateColorTexts(nil, nil, nil, eb)
|
||||
UpdateColor()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
box:SetScript('OnEditFocusGained', function(eb) eb:SetCursorPosition(0) eb:HighlightText() end)
|
||||
box:SetScript('OnEditFocusLost', function(eb) eb:HighlightText(0,0) end)
|
||||
box:Show()
|
||||
end
|
||||
|
||||
-- finish up with placement
|
||||
_G.ColorPPBoxA:Point('RIGHT', 'OpacitySliderFrame', 'RIGHT', 10, 0)
|
||||
_G.ColorPPBoxH:Point('RIGHT', 'ColorPPDefault', 'RIGHT', -10, 0)
|
||||
_G.ColorPPBoxB:Point('RIGHT', 'ColorPPDefault', 'LEFT', -40, 0)
|
||||
_G.ColorPPBoxG:Point('RIGHT', 'ColorPPBoxB', 'LEFT', -25, 0)
|
||||
_G.ColorPPBoxR:Point('RIGHT', 'ColorPPBoxG', 'LEFT', -25, 0)
|
||||
|
||||
-- define the order of tab cursor movement
|
||||
_G.ColorPPBoxR:SetScript('OnTabPressed', function() _G.ColorPPBoxG:SetFocus() end)
|
||||
_G.ColorPPBoxG:SetScript('OnTabPressed', function() _G.ColorPPBoxB:SetFocus() end)
|
||||
_G.ColorPPBoxB:SetScript('OnTabPressed', function() _G.ColorPPBoxH:SetFocus() end)
|
||||
_G.ColorPPBoxA:SetScript('OnTabPressed', function() _G.ColorPPBoxR:SetFocus() end)
|
||||
|
||||
-- make the color picker movable.
|
||||
local mover = CreateFrame('Frame', nil, _G.ColorPickerFrame)
|
||||
mover:Point('TOPLEFT', _G.ColorPickerFrame, 'TOP', -60, 0)
|
||||
mover:Point('BOTTOMRIGHT', _G.ColorPickerFrame, 'TOP', 60, -15)
|
||||
mover:SetScript('OnMouseDown', function() _G.ColorPickerFrame:StartMoving() end)
|
||||
mover:SetScript('OnMouseUp', function() _G.ColorPickerFrame:StopMovingOrSizing() end)
|
||||
mover:EnableMouse(true)
|
||||
|
||||
_G.ColorPickerFrame:SetUserPlaced(true)
|
||||
_G.ColorPickerFrame:EnableKeyboard(false)
|
||||
end
|
||||
32
Modules/Blizzard/Durability.lua
Normal file
32
Modules/Blizzard/Durability.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local B = E:GetModule('Blizzard')
|
||||
|
||||
--Lua functions
|
||||
local _G = _G
|
||||
local hooksecurefunc = hooksecurefunc
|
||||
local CreateFrame = CreateFrame
|
||||
local DurabilityFrame = _G.DurabilityFrame
|
||||
|
||||
local function SetPosition(frame, _, parent)
|
||||
if parent ~= _G.DurabilityFrameHolder then
|
||||
frame:ClearAllPoints()
|
||||
frame:SetPoint('CENTER', _G.DurabilityFrameHolder, 'CENTER')
|
||||
end
|
||||
end
|
||||
|
||||
function B:UpdateDurabilityScale()
|
||||
DurabilityFrame:SetScale(E.db.general.durabilityScale or 1)
|
||||
end
|
||||
|
||||
function B:PositionDurabilityFrame()
|
||||
local DurabilityFrameHolder = CreateFrame('Frame', 'DurabilityFrameHolder', E.UIParent)
|
||||
DurabilityFrameHolder:Size(DurabilityFrame:GetSize())
|
||||
DurabilityFrameHolder:Point('TOPRIGHT', E.UIParent, 'TOPRIGHT', -135, -300)
|
||||
|
||||
E:CreateMover(DurabilityFrameHolder, 'DurabilityFrameMover', L["Durability Frame"], nil, nil, nil, nil, nil, 'all,general')
|
||||
|
||||
DurabilityFrame:SetFrameStrata('HIGH')
|
||||
B:UpdateDurabilityScale()
|
||||
|
||||
hooksecurefunc(DurabilityFrame, 'SetPoint', SetPosition)
|
||||
end
|
||||
23
Modules/Blizzard/GM.lua
Normal file
23
Modules/Blizzard/GM.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local B = E:GetModule('Blizzard')
|
||||
|
||||
local _G = _G
|
||||
local hooksecurefunc = hooksecurefunc
|
||||
|
||||
local function SetPosition(frame, _, anchor)
|
||||
if anchor and (anchor == _G.UIParent) then
|
||||
frame:ClearAllPoints()
|
||||
frame:Point('TOPLEFT', _G.GMMover, 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function B:PositionGMFrames()
|
||||
local TicketStatusFrame = _G.TicketStatusFrame
|
||||
|
||||
TicketStatusFrame:ClearAllPoints()
|
||||
TicketStatusFrame:Point('TOPLEFT', E.UIParent, 'TOPLEFT', 250, -5)
|
||||
E:CreateMover(TicketStatusFrame, 'GMMover', L["GM Ticket Frame"])
|
||||
|
||||
--Blizzard repositions this frame now in UIParent_UpdateTopFramePositions
|
||||
hooksecurefunc(TicketStatusFrame, 'SetPoint', SetPosition)
|
||||
end
|
||||
82
Modules/Blizzard/Garrison.lua
Normal file
82
Modules/Blizzard/Garrison.lua
Normal file
@@ -0,0 +1,82 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local B = E:GetModule('Blizzard')
|
||||
|
||||
local _G = _G
|
||||
|
||||
local C_Garrison_GetLandingPageGarrisonType = C_Garrison.GetLandingPageGarrisonType
|
||||
local ShowGarrisonLandingPage = ShowGarrisonLandingPage
|
||||
local IsAddOnLoaded = IsAddOnLoaded
|
||||
local HideUIPanel = HideUIPanel
|
||||
local PlaySound = PlaySound
|
||||
local StopSound = StopSound
|
||||
|
||||
local SOUNDKIT_UI_GARRISON_GARRISON_REPORT_OPEN = SOUNDKIT.UI_GARRISON_GARRISON_REPORT_OPEN
|
||||
local SOUNDKIT_UI_GARRISON_GARRISON_REPORT_CLOSE = SOUNDKIT.UI_GARRISON_GARRISON_REPORT_CLOSE
|
||||
|
||||
local WAR_CAMPAIGN = WAR_CAMPAIGN
|
||||
local GARRISON_LANDING_PAGE_TITLE = GARRISON_LANDING_PAGE_TITLE
|
||||
local ORDER_HALL_LANDING_PAGE_TITLE = ORDER_HALL_LANDING_PAGE_TITLE
|
||||
|
||||
function B:GarrisonDropDown()
|
||||
-- Right click Menu for Garrision Button all Credits to Foxlit (WarPlan)
|
||||
if IsAddOnLoaded('WarPlan') then return; end
|
||||
|
||||
local function ShowLanding(page)
|
||||
HideUIPanel(_G.GarrisonLandingPage)
|
||||
ShowGarrisonLandingPage(page)
|
||||
end
|
||||
|
||||
local function MaybeStopSound(sound)
|
||||
return sound and StopSound(sound)
|
||||
end
|
||||
|
||||
local landingChoices
|
||||
_G.GarrisonLandingPageMinimapButton:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
|
||||
_G.GarrisonLandingPageMinimapButton:HookScript('PreClick', function(btn, b)
|
||||
btn.landingVisiblePriorToClick = _G.GarrisonLandingPage and _G.GarrisonLandingPage:IsVisible() and _G.GarrisonLandingPage.garrTypeID
|
||||
if b == 'RightButton' then
|
||||
local openOK, openID = PlaySound(SOUNDKIT_UI_GARRISON_GARRISON_REPORT_OPEN)
|
||||
local closeOK, closeID = PlaySound(SOUNDKIT_UI_GARRISON_GARRISON_REPORT_CLOSE)
|
||||
btn.openSoundID = openOK and openID
|
||||
btn.closeSoundID = closeOK and closeID
|
||||
end
|
||||
end)
|
||||
|
||||
_G.GarrisonLandingPageMinimapButton:HookScript('OnClick', function(btn, b)
|
||||
if b == 'LeftButton' then
|
||||
if _G.GarrisonLandingPage.garrTypeID ~= C_Garrison_GetLandingPageGarrisonType() then
|
||||
ShowLanding(C_Garrison_GetLandingPageGarrisonType())
|
||||
end
|
||||
return
|
||||
elseif b == 'RightButton' then
|
||||
if (C_Garrison_GetLandingPageGarrisonType() or 0) > 3 then
|
||||
if btn.landingVisiblePriorToClick then
|
||||
ShowLanding(btn.landingVisiblePriorToClick)
|
||||
else
|
||||
HideUIPanel(_G.GarrisonLandingPage)
|
||||
end
|
||||
MaybeStopSound(btn.openSoundID)
|
||||
MaybeStopSound(btn.closeSoundID)
|
||||
if not landingChoices then
|
||||
local function ShowLanding_(_, ...)
|
||||
return ShowLanding(...)
|
||||
end
|
||||
landingChoices = {
|
||||
{text = GARRISON_LANDING_PAGE_TITLE, func = ShowLanding_, arg1 = 2, notCheckable = true},
|
||||
{text = ORDER_HALL_LANDING_PAGE_TITLE, func = ShowLanding_, arg1 = 3, notCheckable = true},
|
||||
{text = WAR_CAMPAIGN, func = ShowLanding_, arg1 = C_Garrison_GetLandingPageGarrisonType(), notCheckable = true},
|
||||
}
|
||||
end
|
||||
E.DataTexts:SetEasyMenuAnchor(E.DataTexts.EasyMenu, btn)
|
||||
_G.EasyMenu(landingChoices, E.DataTexts.EasyMenu, nil, nil, nil, 'MENU')
|
||||
elseif _G.GarrisonLandingPage.garrTypeID == 3 then
|
||||
ShowLanding(2)
|
||||
MaybeStopSound(btn.closeSoundID)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
_G.GarrisonLandingPageMinimapButton:HookScript('PostClick', function(btn)
|
||||
btn.closeSoundID, btn.openSoundID = nil, nil
|
||||
end)
|
||||
end
|
||||
45
Modules/Blizzard/Kill.lua
Normal file
45
Modules/Blizzard/Kill.lua
Normal file
@@ -0,0 +1,45 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local B = E:GetModule('Blizzard')
|
||||
|
||||
local _G = _G
|
||||
local hooksecurefunc = hooksecurefunc
|
||||
|
||||
function B:KillBlizzard()
|
||||
_G.Display_UIScaleSlider:Kill()
|
||||
_G.Display_UseUIScale:Kill()
|
||||
end
|
||||
|
||||
local function AcknowledgeTips()
|
||||
for frame in _G.HelpTip.framePool:EnumerateActive() do
|
||||
frame:Acknowledge()
|
||||
end
|
||||
end
|
||||
|
||||
function B:DisableHelpTip() -- auto complete helptips
|
||||
if not E.global.general.disableTutorialButtons then return end
|
||||
|
||||
hooksecurefunc(_G.HelpTip, 'Show', AcknowledgeTips)
|
||||
E:Delay(1, AcknowledgeTips)
|
||||
end
|
||||
|
||||
-- NOTE: ActionBars heavily conflicts with NPE
|
||||
local function ShutdownNPE(event)
|
||||
local NPE = _G.NewPlayerExperience
|
||||
if NPE then
|
||||
if NPE:GetIsActive() then
|
||||
NPE:Shutdown()
|
||||
end
|
||||
|
||||
if event then
|
||||
B:UnregisterEvent(event)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function B:DisableNPE() -- disable new player experience
|
||||
if _G.NewPlayerExperience then
|
||||
ShutdownNPE()
|
||||
else
|
||||
B:RegisterEvent('ADDON_LOADED', ShutdownNPE)
|
||||
end
|
||||
end
|
||||
32
Modules/Blizzard/LevelUpBossBanner.lua
Normal file
32
Modules/Blizzard/LevelUpBossBanner.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local B = E:GetModule('Blizzard')
|
||||
|
||||
local _G = _G
|
||||
local hooksecurefunc = hooksecurefunc
|
||||
local CreateFrame = CreateFrame
|
||||
|
||||
local Holder
|
||||
local function Reanchor(frame, _, anchor)
|
||||
if anchor and (anchor ~= Holder) then
|
||||
frame:ClearAllPoints()
|
||||
frame:Point('TOP', Holder)
|
||||
end
|
||||
end
|
||||
|
||||
function B:Handle_LevelUpDisplay_BossBanner()
|
||||
if not Holder then
|
||||
Holder = CreateFrame('Frame', 'LevelUpBossBannerHolder', E.UIParent)
|
||||
Holder:Size(200, 20)
|
||||
Holder:Point('TOP', E.UIParent, 'TOP', -1, -120)
|
||||
end
|
||||
|
||||
E:CreateMover(Holder, 'LevelUpBossBannerMover', L["Level Up Display / Boss Banner"])
|
||||
|
||||
_G.LevelUpDisplay:ClearAllPoints()
|
||||
_G.LevelUpDisplay:Point('TOP', Holder)
|
||||
hooksecurefunc(_G.LevelUpDisplay, 'SetPoint', Reanchor)
|
||||
|
||||
_G.BossBanner:ClearAllPoints()
|
||||
_G.BossBanner:Point('TOP', Holder)
|
||||
hooksecurefunc(_G.BossBanner, 'SetPoint', Reanchor)
|
||||
end
|
||||
17
Modules/Blizzard/Load_Blizzard.xml
Normal file
17
Modules/Blizzard/Load_Blizzard.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<Ui xmlns='http://www.blizzard.com/wow/ui/'>
|
||||
<Script file='Blizzard.lua'/>
|
||||
<Script file='ColorPicker.lua'/>
|
||||
<Script file='Kill.lua'/>
|
||||
<Script file='ObjectiveFrame.lua'/>
|
||||
<Script file='Vehicle.lua'/>
|
||||
<Script file='TimerTracker.lua'/>
|
||||
<Script file='GM.lua'/>
|
||||
<Script file='Durability.lua'/>
|
||||
<Script file='CaptureBar.lua'/>
|
||||
<Script file='AlertFrame.lua'/>
|
||||
<Script file='AltPower.lua'/>
|
||||
<Script file='TalkingHeadFrame.lua'/>
|
||||
<Script file='LevelUpBossBanner.lua'/>
|
||||
<Script file='WidgetsUI.lua'/>
|
||||
<Script file='Garrison.lua'/>
|
||||
</Ui>
|
||||
96
Modules/Blizzard/ObjectiveFrame.lua
Normal file
96
Modules/Blizzard/ObjectiveFrame.lua
Normal file
@@ -0,0 +1,96 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local B = E:GetModule('Blizzard')
|
||||
|
||||
local _G = _G
|
||||
local min = min
|
||||
local CreateFrame = CreateFrame
|
||||
local GetScreenHeight = GetScreenHeight
|
||||
local GetInstanceInfo = GetInstanceInfo
|
||||
local GetScreenWidth = GetScreenWidth
|
||||
local hooksecurefunc = hooksecurefunc
|
||||
local RegisterStateDriver = RegisterStateDriver
|
||||
local UnregisterStateDriver = UnregisterStateDriver
|
||||
|
||||
function B:SetObjectiveFrameHeight()
|
||||
local top = _G.ObjectiveTrackerFrame:GetTop() or 0
|
||||
local screenHeight = GetScreenHeight()
|
||||
local gapFromTop = screenHeight - top
|
||||
local maxHeight = screenHeight - gapFromTop
|
||||
local objectiveFrameHeight = min(maxHeight, E.db.general.objectiveFrameHeight)
|
||||
|
||||
_G.ObjectiveTrackerFrame:Height(objectiveFrameHeight)
|
||||
end
|
||||
|
||||
local function IsFramePositionedLeft(frame)
|
||||
local x = frame:GetCenter()
|
||||
local screenWidth = GetScreenWidth()
|
||||
local positionedLeft = false
|
||||
|
||||
if x and x < (screenWidth / 2) then
|
||||
positionedLeft = true
|
||||
end
|
||||
|
||||
return positionedLeft
|
||||
end
|
||||
|
||||
function B:SetObjectiveFrameAutoHide()
|
||||
if not _G.ObjectiveTrackerFrame.AutoHider then return end --Kaliel's Tracker prevents B:MoveObjectiveFrame() from executing
|
||||
|
||||
if E.db.general.objectiveFrameAutoHide then
|
||||
RegisterStateDriver(_G.ObjectiveTrackerFrame.AutoHider, 'objectiveHider', '[@arena1,exists][@arena2,exists][@arena3,exists][@arena4,exists][@arena5,exists][@boss1,exists][@boss2,exists][@boss3,exists][@boss4,exists] 1;0')
|
||||
else
|
||||
UnregisterStateDriver(_G.ObjectiveTrackerFrame.AutoHider, 'objectiveHider')
|
||||
end
|
||||
end
|
||||
|
||||
function B:MoveObjectiveFrame()
|
||||
local ObjectiveFrameHolder = CreateFrame('Frame', 'ObjectiveFrameHolder', E.UIParent)
|
||||
ObjectiveFrameHolder:Point('TOPRIGHT', E.UIParent, 'TOPRIGHT', -135, -300)
|
||||
ObjectiveFrameHolder:Size(130, 22)
|
||||
|
||||
E:CreateMover(ObjectiveFrameHolder, 'ObjectiveFrameMover', L["Objective Frame"], nil, nil, nil, nil, nil, 'general,blizzUIImprovements')
|
||||
ObjectiveFrameHolder:SetAllPoints(_G.ObjectiveFrameMover)
|
||||
|
||||
local ObjectiveTrackerFrame = _G.ObjectiveTrackerFrame
|
||||
ObjectiveTrackerFrame:SetClampedToScreen(false)
|
||||
ObjectiveTrackerFrame:ClearAllPoints()
|
||||
ObjectiveTrackerFrame:Point('TOP', ObjectiveFrameHolder, 'TOP')
|
||||
ObjectiveTrackerFrame:SetMovable(true)
|
||||
ObjectiveTrackerFrame:SetUserPlaced(true) -- UIParent.lua line 3090 stops it from being moved <3
|
||||
B:SetObjectiveFrameHeight()
|
||||
|
||||
local function RewardsFrame_SetPosition(block)
|
||||
local rewardsFrame = _G.ObjectiveTrackerBonusRewardsFrame
|
||||
rewardsFrame:ClearAllPoints()
|
||||
if E.db.general.bonusObjectivePosition == 'RIGHT' or (E.db.general.bonusObjectivePosition == 'AUTO' and IsFramePositionedLeft(ObjectiveTrackerFrame)) then
|
||||
rewardsFrame:Point('TOPLEFT', block, 'TOPRIGHT', -10, -4)
|
||||
else
|
||||
rewardsFrame:Point('TOPRIGHT', block, 'TOPLEFT', 10, -4)
|
||||
end
|
||||
end
|
||||
hooksecurefunc('BonusObjectiveTracker_AnimateReward', RewardsFrame_SetPosition)
|
||||
|
||||
-- objectiveFrameAutoHide
|
||||
ObjectiveTrackerFrame.AutoHider = CreateFrame('Frame', nil, ObjectiveTrackerFrame, 'SecureHandlerStateTemplate')
|
||||
ObjectiveTrackerFrame.AutoHider:SetAttribute('_onstate-objectiveHider', 'if newstate == 1 then self:Hide() else self:Show() end')
|
||||
ObjectiveTrackerFrame.AutoHider:SetScript('OnHide', function()
|
||||
if not ObjectiveTrackerFrame.collapsed then
|
||||
if E.db.general.objectiveFrameAutoHideInKeystone then
|
||||
_G.ObjectiveTracker_Collapse()
|
||||
else
|
||||
local _, _, difficultyID = GetInstanceInfo()
|
||||
if difficultyID and difficultyID ~= 8 then -- ignore hide in keystone runs
|
||||
_G.ObjectiveTracker_Collapse()
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
ObjectiveTrackerFrame.AutoHider:SetScript('OnShow', function()
|
||||
if ObjectiveTrackerFrame.collapsed then
|
||||
_G.ObjectiveTracker_Expand()
|
||||
end
|
||||
end)
|
||||
|
||||
self:SetObjectiveFrameAutoHide()
|
||||
end
|
||||
62
Modules/Blizzard/TalkingHeadFrame.lua
Normal file
62
Modules/Blizzard/TalkingHeadFrame.lua
Normal file
@@ -0,0 +1,62 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local B = E:GetModule('Blizzard')
|
||||
|
||||
local _G = _G
|
||||
local ipairs, tremove = ipairs, tremove
|
||||
|
||||
function B:ScaleTalkingHeadFrame()
|
||||
local scale = E.db.general.talkingHeadFrameScale or 1
|
||||
local TalkingHeadFrame = _G.TalkingHeadFrame
|
||||
local width, height = TalkingHeadFrame:GetSize()
|
||||
TalkingHeadFrame.mover:Size(width * scale, height * scale)
|
||||
TalkingHeadFrame:SetScale(scale)
|
||||
|
||||
--Reset Model Camera
|
||||
local model = TalkingHeadFrame.MainFrame.Model
|
||||
if model.uiCameraID then
|
||||
model:RefreshCamera()
|
||||
_G.Model_ApplyUICamera(model, model.uiCameraID)
|
||||
end
|
||||
|
||||
--Use this to prevent the frame from auto closing, so you have time to test things.
|
||||
-- TalkingHeadFrame:UnregisterEvent('SOUNDKIT_FINISHED')
|
||||
-- TalkingHeadFrame:UnregisterEvent('TALKINGHEAD_CLOSE')
|
||||
-- TalkingHeadFrame:UnregisterEvent('LOADING_SCREEN_ENABLED')
|
||||
end
|
||||
|
||||
local function InitializeTalkingHead()
|
||||
local TalkingHeadFrame = _G.TalkingHeadFrame
|
||||
|
||||
--Prevent WoW from moving the frame around
|
||||
_G.UIPARENT_MANAGED_FRAME_POSITIONS.TalkingHeadFrame = nil
|
||||
|
||||
--Set default position
|
||||
TalkingHeadFrame:ClearAllPoints()
|
||||
TalkingHeadFrame:Point('BOTTOM', E.UIParent, 'BOTTOM', -1, 373)
|
||||
|
||||
E:CreateMover(TalkingHeadFrame, 'TalkingHeadFrameMover', L["Talking Head Frame"], nil, nil, nil, nil, nil, 'skins')
|
||||
|
||||
--Iterate through all alert subsystems in order to find the one created for TalkingHeadFrame, and then remove it.
|
||||
--We do this to prevent alerts from anchoring to this frame when it is shown.
|
||||
for index, alertFrameSubSystem in ipairs(_G.AlertFrame.alertFrameSubSystems) do
|
||||
if alertFrameSubSystem.anchorFrame and alertFrameSubSystem.anchorFrame == TalkingHeadFrame then
|
||||
tremove(_G.AlertFrame.alertFrameSubSystems, index)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function LoadTalkingHead()
|
||||
if not _G.TalkingHeadFrame then
|
||||
_G.TalkingHead_LoadUI()
|
||||
end
|
||||
|
||||
InitializeTalkingHead()
|
||||
B:ScaleTalkingHeadFrame()
|
||||
end
|
||||
|
||||
function B:PositionTalkingHead()
|
||||
if not E:IsAddOnEnabled('Blizzard_TalkingHeadUI') then return end
|
||||
|
||||
-- wait until first frame, then load talking head (if it isnt yet) and spawn the mover
|
||||
E:Delay(1, LoadTalkingHead)
|
||||
end
|
||||
46
Modules/Blizzard/TimerTracker.lua
Normal file
46
Modules/Blizzard/TimerTracker.lua
Normal file
@@ -0,0 +1,46 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local B = E:GetModule('Blizzard')
|
||||
|
||||
local _G = _G
|
||||
local select, unpack, pairs = select, unpack, pairs
|
||||
local CreateFrame = CreateFrame
|
||||
|
||||
local function SkinIt(bar)
|
||||
for i=1, bar:GetNumRegions() do
|
||||
local region = select(i, bar:GetRegions())
|
||||
if region:IsObjectType('Texture') then
|
||||
region:SetTexture()
|
||||
elseif region:IsObjectType('FontString') then
|
||||
region:FontTemplate(nil, 12, 'OUTLINE')
|
||||
end
|
||||
end
|
||||
|
||||
bar:SetStatusBarTexture(E.media.normTex)
|
||||
if E.PixelMode then
|
||||
bar:SetStatusBarColor(.31, .31, .31)
|
||||
else
|
||||
bar:SetStatusBarColor(unpack(E.media.bordercolor))
|
||||
end
|
||||
|
||||
if not bar.backdrop then
|
||||
bar.backdrop = CreateFrame('Frame', nil, bar, 'BackdropTemplate')
|
||||
bar.backdrop:SetFrameLevel(0)
|
||||
bar.backdrop:SetTemplate('Transparent')
|
||||
bar.backdrop:SetOutside()
|
||||
E:RegisterStatusBar(bar)
|
||||
end
|
||||
end
|
||||
|
||||
function B:START_TIMER()
|
||||
for _, b in pairs(_G.TimerTracker.timerList) do
|
||||
if b.bar and not b.bar.skinned then
|
||||
SkinIt(b.bar)
|
||||
b.bar.skinned = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function B:SkinBlizzTimers()
|
||||
B:RegisterEvent('START_TIMER')
|
||||
B:START_TIMER()
|
||||
end
|
||||
56
Modules/Blizzard/Vehicle.lua
Normal file
56
Modules/Blizzard/Vehicle.lua
Normal file
@@ -0,0 +1,56 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local B = E:GetModule('Blizzard')
|
||||
|
||||
local _G = _G
|
||||
local hooksecurefunc = hooksecurefunc
|
||||
local GetVehicleUIIndicator = GetVehicleUIIndicator
|
||||
local GetVehicleUIIndicatorSeat = GetVehicleUIIndicatorSeat
|
||||
local VehicleSeatIndicator_SetUpVehicle = VehicleSeatIndicator_SetUpVehicle
|
||||
|
||||
local function SetPosition(_,_,anchor)
|
||||
if anchor == 'MinimapCluster' or anchor == _G.MinimapCluster then
|
||||
_G.VehicleSeatIndicator:ClearAllPoints()
|
||||
_G.VehicleSeatIndicator:Point('TOPLEFT', _G.VehicleSeatMover, 'TOPLEFT', 0, 0)
|
||||
end
|
||||
end
|
||||
|
||||
local function VehicleSetUp(vehicleID)
|
||||
local size = E.db.general.vehicleSeatIndicatorSize
|
||||
_G.VehicleSeatIndicator:Size(size)
|
||||
|
||||
local _, numSeatIndicators = GetVehicleUIIndicator(vehicleID)
|
||||
if numSeatIndicators then
|
||||
local fourth = size / 4
|
||||
|
||||
for i = 1, numSeatIndicators do
|
||||
local button = _G['VehicleSeatIndicatorButton'..i]
|
||||
button:Size(fourth)
|
||||
|
||||
local _, xOffset, yOffset = GetVehicleUIIndicatorSeat(vehicleID, i)
|
||||
button:ClearAllPoints()
|
||||
button:Point('CENTER', button:GetParent(), 'TOPLEFT', xOffset * size, -yOffset * size)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function B:UpdateVehicleFrame()
|
||||
if _G.VehicleSeatIndicator.currSkin then
|
||||
VehicleSeatIndicator_SetUpVehicle(_G.VehicleSeatIndicator.currSkin)
|
||||
end
|
||||
end
|
||||
|
||||
function B:PositionVehicleFrame()
|
||||
local VehicleSeatIndicator = _G.VehicleSeatIndicator
|
||||
if not VehicleSeatIndicator.PositionVehicleFrameHooked then
|
||||
hooksecurefunc(VehicleSeatIndicator, 'SetPoint', SetPosition)
|
||||
hooksecurefunc('VehicleSeatIndicator_SetUpVehicle', VehicleSetUp)
|
||||
E:CreateMover(VehicleSeatIndicator, 'VehicleSeatMover', L["Vehicle Seat Frame"], nil, nil, nil, nil, nil, 'general,blizzUIImprovements')
|
||||
VehicleSeatIndicator.PositionVehicleFrameHooked = true
|
||||
end
|
||||
|
||||
VehicleSeatIndicator:Size(E.db.general.vehicleSeatIndicatorSize)
|
||||
|
||||
if VehicleSeatIndicator.currSkin then
|
||||
VehicleSetUp(VehicleSeatIndicator.currSkin)
|
||||
end
|
||||
end
|
||||
53
Modules/Blizzard/WidgetsUI.lua
Normal file
53
Modules/Blizzard/WidgetsUI.lua
Normal file
@@ -0,0 +1,53 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local B = E:GetModule('Blizzard')
|
||||
|
||||
local _G = _G
|
||||
local CreateFrame = CreateFrame
|
||||
local hooksecurefunc = hooksecurefunc
|
||||
|
||||
local function topCenterPosition(self, _, b)
|
||||
local holder = _G.TopCenterContainerHolder
|
||||
if b and (b ~= holder) then
|
||||
self:ClearAllPoints()
|
||||
self:Point('CENTER', holder)
|
||||
self:SetParent(holder)
|
||||
end
|
||||
end
|
||||
|
||||
local function belowMinimapPosition(self, _, b)
|
||||
local holder = _G.BelowMinimapContainerHolder
|
||||
if b and (b ~= holder) then
|
||||
self:ClearAllPoints()
|
||||
self:Point('CENTER', holder, 'CENTER')
|
||||
self:SetParent(holder)
|
||||
end
|
||||
end
|
||||
|
||||
local function UIWidgets()
|
||||
local topCenterContainer = _G.UIWidgetTopCenterContainerFrame
|
||||
local belowMiniMapcontainer = _G.UIWidgetBelowMinimapContainerFrame
|
||||
|
||||
local topCenterHolder = CreateFrame('Frame', 'TopCenterContainerHolder', E.UIParent)
|
||||
topCenterHolder:Point('TOP', E.UIParent, 'TOP', 0, -30)
|
||||
topCenterHolder:Size(10, 58)
|
||||
|
||||
local belowMiniMapHolder = CreateFrame('Frame', 'BelowMinimapContainerHolder', E.UIParent)
|
||||
belowMiniMapHolder:Point('TOPRIGHT', _G.Minimap, 'BOTTOMRIGHT', 0, -16)
|
||||
belowMiniMapHolder:Size(128, 40)
|
||||
|
||||
E:CreateMover(topCenterHolder, 'TopCenterContainerMover', L["UIWidgetTopContainer"], nil, nil, nil,'ALL,SOLO')
|
||||
E:CreateMover(belowMiniMapHolder, 'BelowMinimapContainerMover', L["UIWidgetBelowMinimapContainer"], nil, nil, nil,'ALL,SOLO')
|
||||
|
||||
topCenterContainer:ClearAllPoints()
|
||||
topCenterContainer:Point('CENTER', topCenterHolder)
|
||||
|
||||
belowMiniMapcontainer:ClearAllPoints()
|
||||
belowMiniMapcontainer:Point('CENTER', belowMiniMapHolder, 'CENTER')
|
||||
|
||||
hooksecurefunc(topCenterContainer, 'SetPoint', topCenterPosition)
|
||||
hooksecurefunc(belowMiniMapcontainer, 'SetPoint', belowMinimapPosition)
|
||||
end
|
||||
|
||||
function B:Handle_UIWidgets()
|
||||
UIWidgets()
|
||||
end
|
||||
Reference in New Issue
Block a user