Commit 32a63aa7 authored by Blazeflack's avatar Blazeflack

Merge branch 'development'

# Conflicts:
#	CHANGELOG.md
parents 27ead846 6f343df3
## Interface: 70300
## Author: Elv
## Version: 10.69
## Version: 10.70
## Title: |cfffe7b2cElvUI|r
## Notes: User Interface replacement AddOn for World of Warcraft.
## SavedVariables: ElvDB, ElvPrivateDB
......
......@@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
]]
local MAJOR_VERSION = "LibActionButton-1.0-ElvUI"
local MINOR_VERSION = 11
local MINOR_VERSION = 13
if not LibStub then error(MAJOR_VERSION .. " requires LibStub.") end
local lib, oldversion = LibStub:NewLibrary(MAJOR_VERSION, MINOR_VERSION)
......@@ -1133,7 +1133,9 @@ function Update(self)
-- Zone ability button handling
self.zoneAbilityDisabled = false
self.icon:SetDesaturated(false)
if not self.saturationLocked then
self.icon:SetDesaturated(false)
end
if self._state_type == "action" then
local action_type, id = GetActionInfo(self._state_action)
if ((action_type == "spell" or action_type == "companion") and ZoneAbilityFrame and ZoneAbilityFrame.baseName and not HasZoneAbility()) then
......@@ -1142,7 +1144,9 @@ function Update(self)
if name == abilityName then
texture = GetLastZoneAbilitySpellTexture()
self.zoneAbilityDisabled = true
self.icon:SetDesaturated(true)
if not self.saturationLocked then
self.icon:SetDesaturated(true)
end
end
end
end
......@@ -1333,6 +1337,7 @@ function UpdateCooldown(self)
end
CooldownFrame_Set(self.cooldown, start, duration, enable, false, modRate)
end
lib.callbacks:Fire("OnCooldownUpdate", self, start, duration, enable, modRate)
end
function StartFlash(self)
......
local MAJOR, MINOR = "LibElvUIPlugin-1.0", 15
local MAJOR, MINOR = "LibElvUIPlugin-1.0", 18
local lib, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
if not lib then return end
--Cache global variables
--Lua functions
local pairs, tonumber = pairs, tonumber
local format, strsplit, gsub = format, strsplit, gsub
local pairs, tonumber, strmatch, strsub = pairs, tonumber, strmatch, strsub
local format, strsplit, strlen, gsub, ceil = format, strsplit, strlen, gsub, ceil
--WoW API / Variables
local CreateFrame = CreateFrame
local IsInInstance, IsInGroup, IsInRaid = IsInInstance, IsInGroup, IsInRaid
local IsInGroup, IsInRaid = IsInGroup, IsInRaid
local GetAddOnMetadata = GetAddOnMetadata
local IsAddOnLoaded = IsAddOnLoaded
local RegisterAddonMessagePrefix = RegisterAddonMessagePrefix
local SendAddonMessage = SendAddonMessage
local GetNumGroupMembers = GetNumGroupMembers
local LE_PARTY_CATEGORY_HOME = LE_PARTY_CATEGORY_HOME
local LE_PARTY_CATEGORY_INSTANCE = LE_PARTY_CATEGORY_INSTANCE
......@@ -87,11 +88,11 @@ function lib:RegisterPlugin(name,callback, isLib)
if not lib.ConfigFrame then
local configFrame = CreateFrame("Frame")
configFrame:RegisterEvent("ADDON_LOADED")
configFrame:SetScript("OnEvent", function(self,event,addon)
configFrame:SetScript("OnEvent", function(self, event, addon)
if addon == "ElvUI_Config" then
for _, plugin in pairs(lib.plugins) do
if(plugin.callback) then
plugin.callback()
for _, PlugIn in pairs(lib.plugins) do
if PlugIn.callback then
PlugIn.callback()
end
end
end
......@@ -151,20 +152,20 @@ end
function lib:VersionCheck(event, prefix, message, channel, sender)
local E = ElvUI[1]
if (event == "CHAT_MSG_ADDON") and sender and message and (message ~= "") and (prefix == lib.prefix) then
local myRealm = gsub(E.myrealm,'[%s%-]','')
local myName = E.myname..'-'..myRealm
if sender == myName then return end
if (event == "CHAT_MSG_ADDON") and sender and message and (not strmatch(message, "^%s-$")) and (prefix == lib.prefix) then
if not lib.myName then lib.myName = E.myname..'-'..gsub(E.myrealm,'[%s%-]','') end
if sender == lib.myName then return end
if not E["pluginRecievedOutOfDateMessage"] then
local name, version, plugin, Pname
for _, p in pairs({strsplit(";",message)}) do
if not p:match("^%s-$") then
local name, version = p:match("([%w_]+)=([%d%p]+)")
if not strmatch(p, "^%s-$") then
name, version = strmatch(p, "([%w_]+)=([%d%p]+)")
if lib.plugins[name] then
local plugin = lib.plugins[name]
plugin = lib.plugins[name]
if plugin.version ~= 'BETA' and version ~= nil and tonumber(version) ~= nil and plugin.version ~= nil and tonumber(plugin.version) ~= nil and tonumber(version) > tonumber(plugin.version) then
plugin.old = true
plugin.newversion = tonumber(version)
local Pname = GetAddOnMetadata(plugin.name, "Title")
Pname = GetAddOnMetadata(plugin.name, "Title")
E:Print(format(MSG_OUTDATED,Pname,plugin.version,plugin.newversion))
E["pluginRecievedOutOfDateMessage"] = true
end
......@@ -173,19 +174,28 @@ function lib:VersionCheck(event, prefix, message, channel, sender)
end
end
else
E.SendPluginVersionCheck = E.SendPluginVersionCheck or SendPluginVersionCheck
E["ElvUIPluginSendMSGTimer"] = E:ScheduleTimer("SendPluginVersionCheck", 2)
if not E.SendPluginVersionCheck then
E.SendPluginVersionCheck = SendPluginVersionCheck
end
local num = GetNumGroupMembers()
if num ~= lib.groupSize then
if num > 1 and lib.groupSize and num > lib.groupSize then
E["ElvUIPluginSendMSGTimer"] = E:ScheduleTimer("SendPluginVersionCheck", 12)
end
lib.groupSize = num
end
end
end
function lib:GeneratePluginList()
local list = ""
local E = ElvUI[1]
local list, E = "", ElvUI[1]
local author, Pname, color
for _, plugin in pairs(lib.plugins) do
if plugin.name ~= MAJOR then
local author = GetAddOnMetadata(plugin.name, "Author")
local Pname = GetAddOnMetadata(plugin.name, "Title") or plugin.name
local color = plugin.old and E:RGBToHex(1,0,0) or E:RGBToHex(0,1,0)
author = GetAddOnMetadata(plugin.name, "Author")
Pname = GetAddOnMetadata(plugin.name, "Title") or plugin.name
color = plugin.old and E:RGBToHex(1,0,0) or E:RGBToHex(0,1,0)
list = list .. Pname
if author then
list = list .. " ".. INFO_BY .." " .. author
......@@ -201,34 +211,24 @@ function lib:GeneratePluginList()
end
function lib:SendPluginVersionCheck(message)
if not message or (message == "") then return end
local plist = {strsplit(";",message)}
local m = ""
local delay = 1
local E = ElvUI[1]
for _, p in pairs(plist) do
if not p:match("^%s-$") then
if(#(m .. p .. ";") < 230) then
m = m .. p .. ";"
else
local _, instanceType = IsInInstance()
if IsInRaid() then
E:Delay(delay,SendAddonMessage(lib.prefix, m, (not IsInRaid(LE_PARTY_CATEGORY_HOME) and IsInRaid(LE_PARTY_CATEGORY_INSTANCE)) and "INSTANCE_CHAT" or "RAID"))
elseif IsInGroup() then
E:Delay(delay,SendAddonMessage(lib.prefix, m, (not IsInGroup(LE_PARTY_CATEGORY_HOME) and IsInGroup(LE_PARTY_CATEGORY_INSTANCE)) and "INSTANCE_CHAT" or "PARTY"))
end
m = p .. ";"
if (not message) or strmatch(message, "^%s-$") then return end
local ChatType = ((not IsInRaid(LE_PARTY_CATEGORY_HOME) and IsInRaid(LE_PARTY_CATEGORY_INSTANCE)) or (not IsInGroup(LE_PARTY_CATEGORY_HOME) and IsInGroup(LE_PARTY_CATEGORY_INSTANCE))) and "INSTANCE_CHAT" or (IsInRaid() and "RAID") or (IsInGroup() and "PARTY") or nil
if not ChatType then return end
local delay, maxChar, msgLength = 0, 250, strlen(message)
if msgLength > maxChar then
local splitMessage
for _=1, ceil(msgLength/maxChar) do
splitMessage = strmatch(strsub(message, 1, maxChar), '.+;')
if splitMessage then -- incase the string is over 250 but doesnt contain `;`
message = gsub(message, "^"..gsub(splitMessage, '([%(%)%.%%%+%-%*%?%[%^%$])','%%%1'), "")
ElvUI[1]:Delay(delay, SendAddonMessage, lib.prefix, splitMessage, ChatType)
delay = delay + 1
end
end
end
if m == "" then return end
-- Send the last message
local _, instanceType = IsInInstance()
if IsInRaid() then
E:Delay(delay+1,SendAddonMessage(lib.prefix, m, (not IsInRaid(LE_PARTY_CATEGORY_HOME) and IsInRaid(LE_PARTY_CATEGORY_INSTANCE)) and "INSTANCE_CHAT" or "RAID"))
elseif IsInGroup() then
E:Delay(delay+1,SendAddonMessage(lib.prefix, m, (not IsInGroup(LE_PARTY_CATEGORY_HOME) and IsInGroup(LE_PARTY_CATEGORY_INSTANCE)) and "INSTANCE_CHAT" or "PARTY"))
else
SendAddonMessage(lib.prefix, message, ChatType)
end
end
......
......@@ -521,7 +521,15 @@ local function onUpdate(self, elapsed)
self:SetValue(duration)
if(self.Spark) then
self.Spark:SetPoint('CENTER', self, 'LEFT', (duration / self.max) * self:GetWidth(), 0)
local horiz = self.horizontal
local size = self[horiz and 'GetWidth' or 'GetHeight'](self)
local offset = (duration / self.max) * size
if(self:GetReverseFill()) then
offset = size - offset
end
self.Spark:SetPoint('CENTER', self, horiz and 'LEFT' or 'BOTTOM', horiz and offset or 0, horiz and 0 or offset)
end
elseif(self.channeling) then
local duration = self.duration - elapsed
......@@ -553,7 +561,15 @@ local function onUpdate(self, elapsed)
self.duration = duration
self:SetValue(duration)
if(self.Spark) then
self.Spark:SetPoint('CENTER', self, 'LEFT', (duration / self.max) * self:GetWidth(), 0)
local horiz = self.horizontal
local size = self[horiz and 'GetWidth' or 'GetHeight'](self)
local offset = (duration / self.max) * size
if(self:GetReverseFill()) then
offset = size - offset
end
self.Spark:SetPoint('CENTER', self, horiz and 'LEFT' or 'BOTTOM', horiz and offset or 0, horiz and 0 or offset)
end
elseif(self.holdTime > 0) then
self.holdTime = self.holdTime - elapsed
......@@ -596,6 +612,7 @@ local function Enable(self, unit)
self:RegisterEvent("UNIT_SPELLCAST_FAILED_QUIET", UNIT_SPELLCAST_FAILED_QUIET)
end
element.horizontal = element:GetOrientation() == 'HORIZONTAL'
element.holdTime = 0
element:SetScript('OnUpdate', element.OnUpdate or onUpdate)
......
......@@ -285,7 +285,12 @@ local function initObject(unit, style, styleFunc, header, ...)
-- No need to enable this for *target frames.
if(not (unit:match('target') or suffix == 'target')) then
object:SetAttribute('toggleForVehicle', true)
if(unit:match('raid') or unit:match('party')) then
-- See issue #404
object:SetAttribute('toggleForVehicle', false)
else
object:SetAttribute('toggleForVehicle', true)
end
end
-- Other boss and target units are handled by :HandleUnit().
......@@ -519,7 +524,7 @@ do
end
-- There has to be an easier way to do this.
local initialConfigFunction = [[
local initialConfigFunctionTemp = [[
local header = self:GetParent()
local frames = table.new()
table.insert(frames, self)
......@@ -561,8 +566,7 @@ do
frame:SetAttribute('*type1', 'target')
frame:SetAttribute('*type2', 'togglemenu')
-- BUG: Blizzard has changed the way vehicles work for Antoran High Command
frame:SetAttribute('toggleForVehicle', false)
frame:SetAttribute('toggleForVehicle', %d == 1) -- See issue #404
frame:SetAttribute('oUF-guessUnit', unit)
end
......@@ -581,6 +585,9 @@ do
end
]]
-- Necessary for a vehicle support hack (see issue #404)
local initialConfigFunction = initialConfigFunctionTemp:format(1)
--[[ oUF:SpawnHeader(overrideName, template, visibility, ...)
Used to create a group header and apply the currently active style to it.
......@@ -649,6 +656,65 @@ do
return header
end
-- The remainder of this scope is a temporary fix for issue #404,
-- regarding vehicle support on headers for the Antorus raid instance.
local isHacked = false
local shouldHack
local function toggleHeaders(flag)
for _, header in next, headers do
header:SetAttribute('initialConfigFunction', initialConfigFunction)
for _, child in next, {header:GetChildren()} do
child:SetAttribute('toggleForVehicle', flag)
end
end
isHacked = not flag
shouldHack = nil
end
local eventHandler = CreateFrame('Frame')
eventHandler:RegisterEvent('PLAYER_LOGIN')
eventHandler:RegisterEvent('ZONE_CHANGED_NEW_AREA')
eventHandler:RegisterEvent('PLAYER_REGEN_ENABLED')
eventHandler:SetScript('OnEvent', function(_, event)
if(event == 'PLAYER_LOGIN') then
local _, _, _, _, _, _, _, id = GetInstanceInfo()
if(id == 1712) then
initialConfigFunction = initialConfigFunctionTemp:format(0)
-- This is here for layouts that don't use oUF:Factory
toggleHeaders(false)
end
elseif(event == 'ZONE_CHANGED_NEW_AREA') then
local _, _, _, _, _, _, _, id = GetInstanceInfo()
if(id == 1712 and not isHacked) then
initialConfigFunction = initialConfigFunctionTemp:format(0)
if(not InCombatLockdown()) then
toggleHeaders(false)
else
shouldHack = true
end
elseif(isHacked) then
initialConfigFunction = initialConfigFunctionTemp:format(1)
if(not InCombatLockdown()) then
toggleHeaders(true)
else
shouldHack = false
end
end
elseif(event == 'PLAYER_REGEN_ENABLED') then
if(isHacked and shouldHack == false) then
toggleHeaders(true)
elseif(not isHacked and shouldHack) then
toggleHeaders(false)
end
end
end)
end
--[[ oUF:Spawn(unit, overrideName)
......
local E, L, V, P, G = unpack(select(2, ...)); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local mod = E:GetModule('DataBars');
local LSM = LibStub("LibSharedMedia-3.0")
local LAP = LibStub("LibArtifactPower-1.0-ElvUI")
......
local E, L, V, P, G = unpack(select(2, ...)); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local mod = E:NewModule("DataBars", 'AceEvent-3.0')
E.DataBars = mod
......
local E, L, V, P, G = unpack(select(2, ...)); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local mod = E:GetModule('DataBars');
local LSM = LibStub("LibSharedMedia-3.0")
......
local E, L, V, P, G = unpack(select(2, ...)); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local mod = E:GetModule('DataBars');
local LSM = LibStub("LibSharedMedia-3.0")
......
local E, L, V, P, G = unpack(select(2, ...)); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local mod = E:GetModule('DataBars');
local LSM = LibStub("LibSharedMedia-3.0")
......@@ -25,17 +25,17 @@ function mod:UpdateReputation(event)
if not mod.db.reputation.enable then return end
local bar = self.repBar
local ID
local isFriend, friendText, standingLabel
local ID, isFriend, friendText, standingLabel
local name, reaction, min, max, value, factionID = GetWatchedFactionInfo()
if (C_Reputation_IsFactionParagon(factionID)) then
if factionID and C_Reputation_IsFactionParagon(factionID) then
local currentValue, threshold, _, hasRewardPending = C_Reputation_GetFactionParagonInfo(factionID)
min, max = 0, threshold
value = currentValue % threshold
if hasRewardPending then
value = value + threshold
if currentValue and threshold then
min, max = 0, threshold
value = currentValue % threshold
if hasRewardPending then
value = value + threshold
end
end
end
......@@ -113,22 +113,25 @@ function mod:ReputationBar_OnEnter()
GameTooltip:SetOwner(self, 'ANCHOR_CURSOR', 0, -4)
local name, reaction, min, max, value, factionID = GetWatchedFactionInfo()
if (C_Reputation_IsFactionParagon(factionID)) then
if factionID and C_Reputation_IsFactionParagon(factionID) then
local currentValue, threshold, _, hasRewardPending = C_Reputation_GetFactionParagonInfo(factionID)
min, max = 0, threshold
value = currentValue % threshold
if hasRewardPending then
value = value + threshold
if currentValue and threshold then
min, max = 0, threshold
value = currentValue % threshold
if hasRewardPending then
value = value + threshold
end
end
end
local friendID, _, _, _, _, _, friendTextLevel = GetFriendshipReputation(factionID);
if name then
GameTooltip:AddLine(name)
GameTooltip:AddLine(' ')
GameTooltip:AddDoubleLine(STANDING..':', friendID and friendTextLevel or _G['FACTION_STANDING_LABEL'..reaction], 1, 1, 1)
local friendID, friendTextLevel, _
if factionID then friendID, _, _, _, _, _, friendTextLevel = GetFriendshipReputation(factionID) end
GameTooltip:AddDoubleLine(STANDING..':', (friendID and friendTextLevel) or _G['FACTION_STANDING_LABEL'..reaction], 1, 1, 1)
GameTooltip:AddDoubleLine(REPUTATION..':', format('%d / %d (%d%%)', value - min, max - min, (value - min) / ((max - min == 0) and max or (max - min)) * 100), 1, 1, 1)
end
GameTooltip:Show()
......
local E, L, V, P, G = unpack(select(2, ...)); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local AB = E:GetModule('ActionBars');
--Cache global variables
......
local E, L, V, P, G = unpack(select(2, ...)); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local AB = E:NewModule('ActionBars', 'AceHook-3.0', 'AceEvent-3.0');
--Cache global variables
......@@ -411,7 +411,18 @@ function AB:CreateBar(id)
end
function AB:PLAYER_REGEN_ENABLED()
self:UpdateButtonSettings()
if AB.NeedsUpdateButtonSettings then
self:UpdateButtonSettings()
AB.NeedsUpdateButtonSettings = nil
end
if AB.NeedsUpdateMicroPositionDimensions then
self:UpdateMicroPositionDimensions()
AB.NeedsUpdateMicroPositionDimensions = nil
end
if AB.NeedsAdjustMaxStanceButtons then
AB:AdjustMaxStanceButtons(AB.NeedsAdjustMaxStanceButtons) --sometimes it holds the event, otherwise true. pass it before we nil it.
AB.NeedsAdjustMaxStanceButtons = nil
end
self:UnregisterEvent('PLAYER_REGEN_ENABLED')
end
......@@ -561,7 +572,12 @@ end
function AB:UpdateButtonSettings()
if E.private.actionbar.enable ~= true then return end
if InCombatLockdown() then self:RegisterEvent('PLAYER_REGEN_ENABLED'); return; end
if InCombatLockdown() then
AB.NeedsUpdateButtonSettings = true
self:RegisterEvent('PLAYER_REGEN_ENABLED')
return
end
for button, _ in pairs(self["handledbuttons"]) do
if button then
......@@ -881,7 +897,12 @@ function AB:DisableBlizzard()
end