Commit 3b6bfede authored by Simpy's avatar Simpy 🐹
Browse files

11.52

parents 487725da 7d2b6e1e
......@@ -707,7 +707,6 @@ function E:Config_CreateButton(info, frame, unskinned, ...)
btn:HookScript('OnLeave', Config_ButtonOnLeave)
btn:SetScript('OnClick', info.func)
btn:SetWidth(btn:GetTextWidth() + 40)
btn.ignoreBorderColors = true
return btn
end
......
......@@ -4,7 +4,7 @@ local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, Profi
local _G = _G
local tonumber, pairs, ipairs, error, unpack, select, tostring = tonumber, pairs, ipairs, error, unpack, select, tostring
local strjoin, twipe, tinsert, tremove, tContains = strjoin, wipe, tinsert, tremove, tContains
local strsplit, strjoin, twipe, tinsert, tremove, tContains = strsplit, strjoin, wipe, tinsert, tremove, tContains
local format, find, strrep, strlen, sub, gsub = format, strfind, strrep, strlen, strsub, gsub
local assert, type, pcall, xpcall, next, print = assert, type, pcall, xpcall, next, print
local rawget, rawset, setmetatable = rawget, rawset, setmetatable
......@@ -480,7 +480,7 @@ end
function E:UpdateFontTemplates()
for text in pairs(E.texts) do
if text then
text:FontTemplate(text.font, text.fontSize, text.fontStyle)
text:FontTemplate(text.font, text.fontSize, text.fontStyle, true)
else
E.texts[text] = nil
end
......@@ -1710,7 +1710,11 @@ function E:Initialize()
twipe(E.global)
twipe(E.private)
E.myguid = UnitGUID('player')
local playerGUID = UnitGUID('player')
local _, serverID = strsplit('-', playerGUID)
E.serverID = tonumber(serverID)
E.myguid = playerGUID
E.data = E.Libs.AceDB:New('ElvDB', E.DF, true)
E.data.RegisterCallback(E, 'OnProfileChanged', 'StaggeredUpdateAll')
E.data.RegisterCallback(E, 'OnProfileCopied', 'StaggeredUpdateAll')
......
......@@ -27,11 +27,10 @@ local Uploads = {}
function D:Initialize()
self.Initialized = true
self:RegisterComm(REQUEST_PREFIX)
self:RegisterEvent('CHAT_MSG_ADDON')
D:UpdateSettings()
self.statusBar = CreateFrame('StatusBar', 'ElvUI_Download', E.UIParent)
E:RegisterStatusBar(self.statusBar)
self.statusBar:CreateBackdrop()
self.statusBar:SetStatusBarTexture(E.media.normTex)
self.statusBar:SetStatusBarColor(0.95, 0.15, 0.15)
......@@ -40,6 +39,17 @@ function D:Initialize()
self.statusBar.text:FontTemplate()
self.statusBar.text:SetPoint('CENTER')
self.statusBar:Hide()
E:RegisterStatusBar(self.statusBar)
end
function D:UpdateSettings()
if E.global.general.allowDistributor then
self:RegisterComm(REQUEST_PREFIX)
self:RegisterEvent('CHAT_MSG_ADDON')
else
self:UnregisterComm(REQUEST_PREFIX)
self:UnregisterEvent('CHAT_MSG_ADDON')
end
end
-- Used to start uploads
......@@ -123,7 +133,7 @@ function D:OnCommReceived(prefix, msg, dist, sender)
end,
button1 = ACCEPT,
button2 = CANCEL,
timeout = 32,
timeout = 30,
whileDead = 1,
hideOnEscape = 1,
}
......@@ -250,7 +260,8 @@ local blacklistedKeys = {
version = true,
eyefinity = true,
disableTutorialButtons = true,
showMissingTalentAlert = true
showMissingTalentAlert = true,
allowDistributor = true
},
chat = {
classColorMentionExcludedNames = true
......@@ -556,7 +567,7 @@ E.PopupDialogs.DISTRIBUTOR_WAITING = {
text = L["Profile request sent. Waiting for response from player."],
whileDead = 1,
hideOnEscape = 1,
timeout = 35,
timeout = 20,
}
E.PopupDialogs.DISTRIBUTOR_REQUEST_DENIED = {
......
......@@ -2,6 +2,7 @@ local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, Private
local LSM = E.Libs.LSM
local _G = _G
local strmatch = strmatch
local function SetFont(obj, font, size, style, sr, sg, sb, sa, sox, soy, r, g, b)
obj:SetFont(font, size, style)
......@@ -11,49 +12,31 @@ local function SetFont(obj, font, size, style, sr, sg, sb, sa, sox, soy, r, g, b
elseif r then obj:SetAlpha(r) end
end
local chatFontHeights = {6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}
function E:UpdateBlizzardFonts()
local NORMAL = E.media.normFont
local NUMBER = E.media.normFont
local COMBAT = LSM:Fetch('font', E.private.general.dmgfont)
local NAMEFONT = LSM:Fetch('font', E.private.general.namefont)
local BUBBLE = LSM:Fetch('font', E.private.general.chatBubbleFont)
local SHADOWCOLOR = _G.SHADOWCOLOR
local NORMALOFFSET = _G.NORMALOFFSET
local BIGOFFSET = _G.BIGOFFSET
local MONOCHROME = ''
_G.CHAT_FONT_HEIGHTS = {6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}
if E.db.general.font == 'Homespun' then
MONOCHROME = 'MONOCHROME'
end
if E.eyefinity then
-- set an invisible font for xp, honor kill, etc
COMBAT = E.Media.Fonts.Invisible
end
if E.private.general.replaceNameFont then
_G.UNIT_NAME_FONT = NAMEFONT
end
if E.private.general.replaceCombatFont then
_G.DAMAGE_TEXT_FONT = COMBAT
-- No matter what we do here with the Combat Font, the player Combat Font will always looks like shit, so just dont touch it.
--SetFont(_G.CombatTextFont, COMBAT, 200, 'OUTLINE') -- number here just increase the font quality.
end
local MONOCHROME = strmatch(E.db.general.fontStyle, 'MONOCHROME') and 'MONOCHROME' or ''
_G.CHAT_FONT_HEIGHTS = chatFontHeights
if E.eyefinity then COMBAT = E.Media.Fonts.Invisible end -- set an invisible font for xp, honor kill, etc
if E.private.general.replaceNameFont then _G.UNIT_NAME_FONT = NAMEFONT end
if E.private.general.replaceCombatFont then _G.DAMAGE_TEXT_FONT = COMBAT end
if E.private.general.replaceBlizzFonts then
--_G.NAMEPLATE_FONT = NAMEFONT
_G.STANDARD_TEXT_FONT = NORMAL
--SetFont(_G.NumberFontNormal, LSM:Fetch('font', 'Homespun'), 10, 'MONOCHROMEOUTLINE', 1, 1, 1, 0, 0, 0)
--SetFont(_G.GameFontNormalSmall, NORMAL, 12, nil, nil, nil, nil, nil, nil, nil, unpack(E.media.rgbvaluecolor))
SetFont(_G.AchievementFont_Small, NORMAL, E.db.general.fontSize) -- Achiev dates
--SetFont(_G.GameFontNormalSmall, NORMAL, 12, nil, nil, nil, nil, nil, nil, nil, unpack(E.media.rgbvaluecolor))
SetFont(_G.AchievementFont_Small, NORMAL, E.db.general.fontSize) -- Achiev dates
SetFont(_G.BossEmoteNormalHuge, NORMAL, 24) -- Talent Title
SetFont(_G.ChatBubbleFont, BUBBLE, E.private.general.chatBubbleFontSize, E.private.general.chatBubbleFontOutline)
SetFont(_G.CoreAbilityFont, NORMAL, 26) -- Core abilities(title)
SetFont(_G.DestinyFontHuge, NORMAL, 32, nil, SHADOWCOLOR, BIGOFFSET) -- Garrison Mission Report
SetFont(_G.DestinyFontHuge, NORMAL, 32) -- Garrison Mission Report
SetFont(_G.DestinyFontMed, NORMAL, 14) -- Added in 7.3.5 used for ?
SetFont(_G.Fancy12Font, NORMAL, 12) -- Added in 7.3.5 used for ?
SetFont(_G.Fancy14Font, NORMAL, 14) -- Added in 7.3.5 used for ?
......@@ -73,28 +56,28 @@ function E:UpdateBlizzardFonts()
SetFont(_G.Game42Font, NORMAL, 42) -- PVP Stuff
SetFont(_G.Game46Font, NORMAL, 46) -- Added in 7.3.5 used for ?
SetFont(_G.Game48Font, NORMAL, 48)
SetFont(_G.Game48FontShadow, NORMAL, 48, nil, SHADOWCOLOR, BIGOFFSET)
SetFont(_G.Game48FontShadow, NORMAL, 48)
SetFont(_G.Game60Font, NORMAL, 60)
SetFont(_G.Game72Font, NORMAL, 72)
SetFont(_G.Game120Font, NORMAL, 120)
SetFont(_G.GameFont_Gigantic, NORMAL, 32, nil, SHADOWCOLOR, BIGOFFSET) -- Used at the install steps
SetFont(_G.GameFont_Gigantic, NORMAL, 32) -- Used at the install steps
SetFont(_G.GameFontHighlightMedium, NORMAL, 15) -- Fix QuestLog Title mouseover
SetFont(_G.GameFontHighlightSmall2, NORMAL, E.db.general.fontSize) -- Skill or Recipe description on TradeSkill frame
SetFont(_G.GameFontHighlightSmall2, NORMAL, E.db.general.fontSize) -- Skill or Recipe description on TradeSkill frame
SetFont(_G.GameFontNormalHuge2, NORMAL, 24) -- Mythic weekly best dungeon name
SetFont(_G.GameFontNormalLarge2, NORMAL, 15) -- Garrison Follower Names
SetFont(_G.GameFontNormalMed1, NORMAL, 14) -- WoW Token Info
SetFont(_G.GameFontNormalMed2, NORMAL, E.db.general.fontSize*1.1) -- Quest tracker
SetFont(_G.GameFontNormalMed2, NORMAL, E.db.general.fontSize*1.1) -- Quest tracker
SetFont(_G.GameFontNormalMed3, NORMAL, 15)
SetFont(_G.GameFontNormalSmall2, NORMAL, 12) -- MissionUI Followers names
SetFont(_G.GameTooltipHeader, NORMAL, E.db.general.fontSize)
SetFont(_G.InvoiceFont_Med, NORMAL, 12) -- Mail
SetFont(_G.InvoiceFont_Small, NORMAL, E.db.general.fontSize) -- Mail
SetFont(_G.InvoiceFont_Small, NORMAL, E.db.general.fontSize) -- Mail
SetFont(_G.MailFont_Large, NORMAL, 14) -- Mail
SetFont(_G.NumberFont_Outline_Huge, NUMBER, 28, MONOCHROME..'THICKOUTLINE', 28)
SetFont(_G.NumberFont_Outline_Large, NUMBER, 15, MONOCHROME..'OUTLINE')
SetFont(_G.NumberFont_Outline_Med, NUMBER, E.db.general.fontSize*1.1, 'OUTLINE')
SetFont(_G.NumberFont_OutlineThick_Mono_Small, NUMBER, E.db.general.fontSize, 'OUTLINE')
SetFont(_G.NumberFont_Shadow_Med, NORMAL, E.db.general.fontSize) -- Chat EditBox
SetFont(_G.NumberFont_Shadow_Med, NORMAL, E.db.general.fontSize) -- Chat EditBox
SetFont(_G.NumberFont_Shadow_Small, NORMAL, E.db.general.fontSize)
SetFont(_G.NumberFontNormalSmall, NORMAL, 11, 'OUTLINE') -- Calendar, EncounterJournal
SetFont(_G.Number11Font, NORMAL, 11)
......@@ -104,13 +87,13 @@ function E:UpdateBlizzardFonts()
SetFont(_G.PVPArenaTextString, NORMAL, 22, MONOCHROME..'OUTLINE')
SetFont(_G.PVPInfoTextString, NORMAL, 22, MONOCHROME..'OUTLINE')
SetFont(_G.QuestFont, NORMAL, E.db.general.fontSize)
SetFont(_G.QuestFont_Enormous, NORMAL, 24, nil, SHADOWCOLOR, NORMALOFFSET) -- Garrison Titles
SetFont(_G.QuestFont_Huge, NORMAL, 15, nil, SHADOWCOLOR, BIGOFFSET) -- Quest rewards title(Rewards)
SetFont(_G.QuestFont_Enormous, NORMAL, 24) -- Garrison Titles
SetFont(_G.QuestFont_Huge, NORMAL, 15) -- Quest rewards title(Rewards)
SetFont(_G.QuestFont_Large, NORMAL, 14)
SetFont(_G.QuestFont_Shadow_Huge, NORMAL, 15, nil, SHADOWCOLOR, NORMALOFFSET) -- Quest Title
SetFont(_G.QuestFont_Shadow_Small, NORMAL, 14, nil, SHADOWCOLOR, NORMALOFFSET)
SetFont(_G.QuestFont_Super_Huge, NORMAL, 22, nil, SHADOWCOLOR, BIGOFFSET)
SetFont(_G.ReputationDetailFont, NORMAL, E.db.general.fontSize) -- Rep Desc when clicking a rep
SetFont(_G.QuestFont_Shadow_Huge, NORMAL, 15) -- Quest Title
SetFont(_G.QuestFont_Shadow_Small, NORMAL, 14)
SetFont(_G.QuestFont_Super_Huge, NORMAL, 22)
SetFont(_G.ReputationDetailFont, NORMAL, E.db.general.fontSize) -- Rep Desc when clicking a rep
SetFont(_G.SubZoneTextFont, NORMAL, 24, MONOCHROME..'OUTLINE') -- World Map(SubZone)
SetFont(_G.SubZoneTextString, NORMAL, 25, MONOCHROME..'OUTLINE')
SetFont(_G.SystemFont_Huge1, NORMAL, 20) -- Garrison Mission XP
......@@ -123,7 +106,7 @@ function E:UpdateBlizzardFonts()
SetFont(_G.SystemFont_OutlineThick_Huge2, NORMAL, 20, MONOCHROME..'THICKOUTLINE')
SetFont(_G.SystemFont_OutlineThick_WTF, NORMAL, 32, MONOCHROME..'OUTLINE') -- World Map
SetFont(_G.SystemFont_Shadow_Huge1, NORMAL, 20, MONOCHROME..'OUTLINE') -- Raid Warning, Boss emote frame too
SetFont(_G.SystemFont_Shadow_Huge3, NORMAL, 22, nil, SHADOWCOLOR, BIGOFFSET) -- FlightMap
SetFont(_G.SystemFont_Shadow_Huge3, NORMAL, 22) -- FlightMap
SetFont(_G.SystemFont_Shadow_Large, NORMAL, 15)
SetFont(_G.SystemFont_Shadow_Large2, NORMAL, 18) -- Auction House ItemDisplay
SetFont(_G.SystemFont_Shadow_Large_Outline, NUMBER, 20, 'OUTLINE')
......
......@@ -775,7 +775,7 @@ function E:Install()
f.Status.anim.progress:SetDuration(.3)
f.Status.text = f.Status:CreateFontString(nil, 'OVERLAY')
f.Status.text:FontTemplate()
f.Status.text:FontTemplate(nil, 14, 'OUTLINE')
f.Status.text:SetPoint('CENTER')
f.Status.text:SetText(CURRENT_PAGE..' / '..MAX_PAGE)
......
......@@ -3,7 +3,7 @@ local Sticky = E.Libs.SimpleSticky
local _G = _G
local type, unpack, pairs, error, ipairs = type, unpack, pairs, error, ipairs
local format, split, find, strupper, strlower = format, strsplit, strfind, strupper, strlower
local format, split, find, strupper = format, strsplit, strfind, strupper
local CreateFrame = CreateFrame
local IsShiftKeyDown = IsShiftKeyDown
......@@ -378,15 +378,10 @@ function E:ToggleMovers(show, which)
self.configMode = show
local upperText = strupper(which)
local lowerText = strlower(which)
for _, holder in pairs(E.CreatedMovers) do
if show then
if (holder.mover.name == which) or strlower(holder.mover.textString) == lowerText then
holder.mover:Show()
break -- we just are doing one
elseif holder.types[upperText] then
holder.mover:Show() -- we are showing a group
end
local isName = (holder.mover.name == which) or strupper(holder.mover.textString) == upperText
if show and (isName or holder.types[upperText]) then
holder.mover:Show()
else
holder.mover:Hide()
end
......
......@@ -245,7 +245,7 @@ function PI:CreateFrame()
f.Status.anim.progress:SetDuration(.3)
f.Status.text = f.Status:CreateFontString(nil, 'OVERLAY')
f.Status.text:FontTemplate()
f.Status.text:FontTemplate(nil, 14, 'OUTLINE')
f.Status.text:SetPoint('CENTER')
f.Option1 = CreateFrame('Button', 'PluginInstallOption1Button', f, 'UIPanelButtonTemplate')
......@@ -350,7 +350,7 @@ function PI:CreateFrame()
f.side:SetWidth(140)
f.side.text = f.side:CreateFontString(nil, 'OVERLAY')
f.side.text:SetPoint('TOP', f.side, 'TOP', 0, -4)
f.side.text:FontTemplate(E.media.normFont, 18, 'OUTLINE')
f.side.text:FontTemplate(nil, 18, 'OUTLINE')
f.side.text:SetText(L["Steps"])
f.side.Lines = {} --Table to keep shown lines
f.side:Hide()
......@@ -365,7 +365,7 @@ function PI:CreateFrame()
button.text = button:CreateFontString(nil, 'OVERLAY')
button.text:SetPoint('TOPLEFT', button, 'TOPLEFT', 2, -2)
button.text:SetPoint('BOTTOMRIGHT', button, 'BOTTOMRIGHT', -2, 2)
button.text:FontTemplate(E.media.normFont, 14, 'OUTLINE')
button.text:FontTemplate(nil, 14, 'OUTLINE')
button:SetScript('OnClick', function() if i <= f.MaxPage then SetPage(i, f.CurrentPage) end end)
button.text:SetText('')
f.side.Lines[i] = button
......
......@@ -300,7 +300,7 @@ end
do
local function NameHealthColor(tags,hex,unit,default)
if hex == 'class' or hex == 'reaction' then
return tags.namecolor(unit)
return tags.namecolor(unit) or default
elseif hex and strmatch(hex, '^%x%x%x%x%x%x$') then
return '|cFF'..hex
end
......@@ -532,13 +532,11 @@ ElvUF.Tags.Events['namecolor'] = 'UNIT_NAME_UPDATE UNIT_FACTION INSTANCE_ENCOUNT
ElvUF.Tags.Methods['namecolor'] = function(unit)
if UnitIsPlayer(unit) then
local _, unitClass = UnitClass(unit)
local class = ElvUF.colors.class[unitClass]
if class then
return Hex(class[1], class[2], class[3])
end
local cs = ElvUF.colors.class[unitClass]
return (cs and Hex(cs[1], cs[2], cs[3])) or '|cFFcccccc'
else
local color = ElvUF.colors.reaction[UnitReaction(unit, 'player')]
return (color and Hex(color[1], color[2], color[3])) or '|cFFC2C2C2'
local cr = ElvUF.colors.reaction[UnitReaction(unit, 'player')]
return (cr and Hex(cr[1], cr[2], cr[3])) or '|cFFcccccc'
end
end
......
......@@ -397,9 +397,12 @@ local function StripTexts(object, kill, alpha)
StripType(STRIP_FONT, object, kill, alpha)
end
local function FontTemplate(fs, font, size, style)
fs.font, fs.fontSize, fs.fontStyle = font or E.media.normFont, size or E.db.general.fontSize, style or E.db.general.fontStyle
fs:SetFont(fs.font, fs.fontSize, fs.fontStyle)
local function FontTemplate(fs, font, size, style, skip)
if not skip then -- ignore updates from UpdateFontTemplates
fs.font, fs.fontSize, fs.fontStyle = font, size, style
end
fs:SetFont(font or E.media.normFont, size or E.db.general.fontSize, style or E.db.general.fontStyle)
if style == 'NONE' then
fs:SetShadowOffset(1, -0.5)
......
## Interface: 80300
## Author: Elv, Simpy
## Version: 11.51
## Version: 11.52
## Title: |cff1784d1ElvUI|r
## Notes: User Interface replacement AddOn for World of Warcraft.
## SavedVariables: ElvDB, ElvPrivateDB
......
......@@ -30,7 +30,7 @@
-- @name AceAddon-3.0.lua
-- @release $Id$
local MAJOR, MINOR = "AceAddon-3.0", 12
local MAJOR, MINOR = "AceAddon-3.0", 13
local AceAddon, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
if not AceAddon then return end -- No Upgrade needed.
......@@ -601,10 +601,20 @@ function AceAddon:IterateAddonStatus() return pairs(self.statuses) end
function AceAddon:IterateEmbedsOnAddon(addon) return pairs(self.embeds[addon]) end
function AceAddon:IterateModulesOfAddon(addon) return pairs(addon.modules) end
-- Blizzard AddOns which can load very early in the loading process and mess with Ace3 addon loading
local BlizzardEarlyLoadAddons = {
Blizzard_DebugTools = true,
Blizzard_TimeManager = true,
Blizzard_BattlefieldMap = true,
Blizzard_MapCanvas = true,
Blizzard_SharedMapDataProviders = true,
Blizzard_CombatLog = true,
}
-- Event Handling
local function onEvent(this, event, arg1)
-- 2011-08-17 nevcairiel - ignore the load event of Blizzard_DebugTools, so a potential startup error isn't swallowed up
if (event == "ADDON_LOADED" and arg1 ~= "Blizzard_DebugTools") or event == "PLAYER_LOGIN" then
-- 2020-08-28 nevcairiel - ignore the load event of Blizzard addons which occur early in the loading process
if (event == "ADDON_LOADED" and (arg1 == nil or not BlizzardEarlyLoadAddons[arg1])) or event == "PLAYER_LOGIN" then
-- if a addon loads another addon, recursion could happen here, so we need to validate the table on every iteration
while(#AceAddon.initializequeue > 0) do
local addon = tremove(AceAddon.initializequeue, 1)
......
--[[
Copyright (c) 2010-2019, Hendrik "nevcairiel" Leppkes <h.leppkes@gmail.com>
Copyright (c) 2010-2020, Hendrik "nevcairiel" Leppkes <h.leppkes@gmail.com>
All rights reserved.
......@@ -26,31 +26,21 @@ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
]]
]]
local MAJOR_VERSION = "LibActionButton-1.0-ElvUI"
local MINOR_VERSION = 20 -- the real minor version is 74
local MINOR_VERSION = 21 -- the real minor version is 79
if not LibStub then error(MAJOR_VERSION .. " requires LibStub.") end
local lib, oldversion = LibStub:NewLibrary(MAJOR_VERSION, MINOR_VERSION)
if not lib then return end
-- Lua functions
local type, error, tostring, tonumber, assert, select = type, error, tostring, tonumber, assert, select
local setmetatable, wipe, unpack, pairs, next = setmetatable, wipe, unpack, pairs, next
local str_match, format, tinsert, tremove = string.match, format, tinsert, tremove
-- GLOBALS: ATTACK_BUTTON_FLASH_TIME, C_ToyBox, ClearCursor, COOLDOWN_TYPE_LOSS_OF_CONTROL, COOLDOWN_TYPE_NORMAL
-- GLOBALS: CooldownFrame_Set, CreateFrame, FindSpellBookSlotBySpellID, FlyoutHasSpell, GameTooltip, GameTooltip_SetDefaultAnchor
-- GLOBALS: GetActionCharges, GetActionCooldown, GetActionCount, GetActionInfo, GetActionLossOfControlCooldown, GetActionText
-- GLOBALS: GetActionTexture, GetBindingKey, GetBindingText, GetCursorInfo, GetCVar, GetCVarBool, GetItemCooldown, GetItemCount
-- GLOBALS: GetItemIcon, GetLastZoneAbilitySpellTexture, GetMacroInfo, GetMacroSpell, GetModifiedClick, GetMouseFocus, GetSpellCharges
-- GLOBALS: GetSpellCooldown, GetSpellCount, GetSpellInfo, GetSpellTexture, HasAction, HasZoneAbility, InCombatLockdown, IsActionInRange
-- GLOBALS: IsAltKeyDown, IsAttackAction, IsAttackSpell, IsAutoRepeatAction, IsAutoRepeatSpell, IsConsumableAction, IsConsumableItem
-- GLOBALS: IsConsumableSpell, IsControlKeyDown, IsCurrentAction, IsCurrentItem, IsCurrentSpell, IsEquippedAction, IsEquippedItem
-- GLOBALS: IsItemAction, IsItemInRange, IsShiftKeyDown, IsSpellInRange, IsSpellOverlayed, IsStackableAction, IsUsableAction, IsUsableItem
-- GLOBALS: IsUsableSpell, LibStub, PickupAction, PickupCompanion, PickupEquipmentSet, PickupItem, PickupMacro, PickupPetAction, PickupSpell
-- GLOBALS: RANGE_INDICATOR, SetBinding, SetBindingClick, SetClampedTextureRotation, SpellFlyout, TOOLTIP_UPDATE_TIME, UIParent, ZoneAbilityFrame
-- GLOBALS: GetOnBarHighlightMark
local WoWClassic = select(4, GetBuildInfo()) < 20000
local KeyBound = LibStub("LibKeyBound-1.0", true)
local CBH = LibStub("CallbackHandler-1.0")
......@@ -109,7 +99,7 @@ local type_meta_map = {
local ButtonRegistry, ActiveButtons, ActionButtons, NonActionButtons = lib.buttonRegistry, lib.activeButtons, lib.actionButtons, lib.nonActionButtons
local Update, UpdateButtonState, UpdateUsable, UpdateCount, UpdateCooldown, UpdateTooltip, UpdateNewAction, ClearNewActionHighlight
local Update, UpdateButtonState, UpdateUsable, UpdateCount, UpdateCooldown, UpdateTooltip, UpdateNewAction, UpdateSpellHighlight, ClearNewActionHighlight
local StartFlash, StopFlash, UpdateFlash, UpdateHotkeys, UpdateRangeTimer, UpdateOverlayGlow
local UpdateFlyout, ShowGrid, HideGrid, UpdateGrid, SetupSecureSnippets, WrapOnClick
local ShowOverlayGlow, HideOverlayGlow
......@@ -195,6 +185,7 @@ function lib:CreateButton(id, name, header, config)
-- adjust hotkey style for better readability
button.HotKey:SetFont(button.HotKey:GetFont(), 13, "OUTLINE")
button.HotKey:SetVertexColor(0.75, 0.75, 0.75)
button.HotKey:SetPoint("TOPLEFT", button, "TOPLEFT", -2, -4)
-- adjust count/stack size
button.Count:SetFont(button.Count:GetFont(), 16, "OUTLINE")
......@@ -702,8 +693,10 @@ function InitializeEventHandler()
lib.eventFrame:RegisterEvent("ACTIONBAR_SLOT_CHANGED")
lib.eventFrame:RegisterEvent("UPDATE_BINDINGS")
lib.eventFrame:RegisterEvent("UPDATE_SHAPESHIFT_FORM")
lib.eventFrame:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR")
lib.eventFrame:RegisterEvent("PLAYER_MOUNT_DISPLAY_CHANGED")
if not WoWClassic then
lib.eventFrame:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR")
end
lib.eventFrame:RegisterEvent("ACTIONBAR_UPDATE_STATE")
lib.eventFrame:RegisterEvent("ACTIONBAR_UPDATE_USABLE")
......@@ -711,23 +704,26 @@ function InitializeEventHandler()
lib.eventFrame:RegisterEvent("PLAYER_TARGET_CHANGED")
lib.eventFrame:RegisterEvent("TRADE_SKILL_SHOW")
lib.eventFrame:RegisterEvent("TRADE_SKILL_CLOSE")
lib.eventFrame:RegisterEvent("ARCHAEOLOGY_CLOSED")
lib.eventFrame:RegisterEvent("PLAYER_ENTER_COMBAT")
lib.eventFrame:RegisterEvent("PLAYER_LEAVE_COMBAT")
lib.eventFrame:RegisterEvent("START_AUTOREPEAT_SPELL")
lib.eventFrame:RegisterEvent("STOP_AUTOREPEAT_SPELL")
lib.eventFrame:RegisterEvent("UNIT_ENTERED_VEHICLE")
lib.eventFrame:RegisterEvent("UNIT_EXITED_VEHICLE")
lib.eventFrame:RegisterEvent("COMPANION_UPDATE")
lib.eventFrame:RegisterEvent("UNIT_INVENTORY_CHANGED")
lib.eventFrame:RegisterEvent("LEARNED_SPELL_IN_TAB")
lib.eventFrame:RegisterEvent("PET_STABLE_UPDATE")
lib.eventFrame:RegisterEvent("PET_STABLE_SHOW")
lib.eventFrame:RegisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_SHOW")
lib.eventFrame:RegisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_HIDE")
lib.eventFrame:RegisterEvent("SPELL_UPDATE_CHARGES")
lib.eventFrame:RegisterEvent("UPDATE_SUMMONPETS_ACTION")
lib.eventFrame:RegisterEvent("SPELL_UPDATE_ICON")
if not WoWClassic then
lib.eventFrame:RegisterEvent("ARCHAEOLOGY_CLOSED")
lib.eventFrame:RegisterEvent("UNIT_ENTERED_VEHICLE")
lib.eventFrame:RegisterEvent("UNIT_EXITED_VEHICLE")
lib.eventFrame:RegisterEvent("COMPANION_UPDATE")
lib.eventFrame:RegisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_SHOW")
lib.eventFrame:RegisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_HIDE")
lib.eventFrame:RegisterEvent("UPDATE_SUMMONPETS_ACTION")
end
-- With those two, do we still need the ACTIONBAR equivalents of them?
lib.eventFrame:RegisterEvent("SPELL_UPDATE_COOLDOWN")
......@@ -1063,13 +1059,13 @@ end
--- button management
function Generic:UpdateAction(force)
local type, action = self:GetAction()
if force or (type ~= self._state_type) or (action ~= self._state_action) then
local action_type, action = self:GetAction()
if force or (action_type ~= self._state_type) or (action ~= self._state_action) then
-- type changed, update the metatable
if force or (self._state_type ~= type) then
local meta = type_meta_map[type] or type_meta_map.empty
if force or (self._state_type ~= action_type) then
local meta = type_meta_map[action_type] or type_meta_map.empty
setmetatable(self, meta)
self._state_type = type
self._state_type = action_type
end
self._state_action = action
Update(self)
......@@ -1103,6 +1099,10 @@ function Update(self, fromUpdateConfig)
if self.chargeCooldown then
EndChargeCooldown(self.chargeCooldown)
end
if self.LevelLinkLockIcon then
self.LevelLinkLockIcon:SetShown(false)
end
end
-- Add a green border if button is an equipped item
......@@ -1148,7 +1148,6 @@ function Update(self, fromUpdateConfig)
self.icon:Show()
self.rangeTimer = - 1
self:SetNormalTexture("Interface\\Buttons\\UI-Quickslot2")
if not self.LBFSkinned and not self.MasqueSkinned then
self.NormalTexture:SetTexCoord(0, 0, 0, 0)
end
......@@ -1177,6 +1176,8 @@ function Update(self, fromUpdateConfig)
UpdateButtonState(self)
UpdateSpellHighlight(self)
if GameTooltip_GetOwnerForbidden() == self then
UpdateTooltip(self)
end
......@@ -1228,6 +1229,18 @@ function UpdateUsable(self)
else
self.icon:SetVertexColor(unpack(self.config.colors.usable))
end
if not WoWClassic and self._state_type == "action" then
local isLevelLinkLocked = C_LevelLink.IsActionLocked(self._state_action)
if not self.icon:IsDesaturated() then
self.icon:SetDesaturated(isLevelLinkLocked)
end
if self.LevelLinkLockIcon then
self.LevelLinkLockIcon:SetShown(isLevelLinkLocked)
end
end
lib.callbacks:Fire("OnButtonUsable", self)
end
......@@ -1331,7 +1344,7 @@ function UpdateCooldown(self)
self.cooldown.currentCooldownType = COOLDOWN_TYPE_NORMAL
end
if charges and maxCharges and charges > 0 and charges < maxCharges then
if charges and maxCharges and maxCharges > 1 and charges < maxCharges then
StartChargeCooldown(self, chargeStart, chargeDuration, chargeModRate)
self.chargeCooldown:SetDrawSwipe(duration <= 0 and self.config.useDrawSwipeOnCharges)
......@@ -1383,11 +1396,9 @@ function UpdateHotkeys(self)
local key = self:GetHotkey()
if not key or key == "" or self.config.hideElements.hotkey then
self.HotKey:SetText(RANGE_INDICATOR)
self.HotKey:SetPoint("TOPLEFT", self, "TOPLEFT", 1, - 2)
self.HotKey:Hide()
else
self.HotKey:SetText(key)
self.HotKey:SetPoint("TOPLEFT", self, "TOPLEFT", - 2, - 2)
self.HotKey:Show()
end
......@@ -1455,26 +1466,6 @@ hooksecurefunc("ClearNewActionHighlight", function(action, preventIdenticalActio
ClearNewActionHighlight(action, preventIdenticalActionsFromClearing, nil)
end)