mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 08:24:44 +00:00
2
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
## Interface: 11200
|
## Interface: 11200
|
||||||
## Title: !Compatibility
|
## Title: !Compatibility
|
||||||
## Notes: Compatibility functions for Vanilla
|
## Notes: Compatibility functions for Vanilla
|
||||||
## Version: 1.1
|
## Version: 1.0
|
||||||
|
|
||||||
errorHandler.lua
|
errorHandler.lua
|
||||||
api\api.xml
|
api\api.xml
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
-- Cache global variables
|
--Cache global variables
|
||||||
local assert = assert
|
local assert = assert
|
||||||
local error = error
|
local error = error
|
||||||
local geterrorhandler = geterrorhandler
|
local geterrorhandler = geterrorhandler
|
||||||
@@ -9,7 +9,7 @@ local type = type
|
|||||||
local unpack = unpack
|
local unpack = unpack
|
||||||
local ceil, floor = math.ceil, math.floor
|
local ceil, floor = math.ceil, math.floor
|
||||||
local find, format, gsub, sub = string.find, string.format, string.gsub, string.sub
|
local find, format, gsub, sub = string.find, string.format, string.gsub, string.sub
|
||||||
local getn, insert = table.getn, table.insert
|
local getn, tinsert = table.getn, table.insert
|
||||||
|
|
||||||
math.huge = 1/0
|
math.huge = 1/0
|
||||||
string.gmatch = string.gfind
|
string.gmatch = string.gfind
|
||||||
@@ -22,9 +22,9 @@ function difftime(time2, time1)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function select(n, ...)
|
function select(n, ...)
|
||||||
assert(type(n) == "number" or type(n) == "string", format("bad argument #1 to 'select' (number expected, got %s)", n and type(n) or "no value"))
|
assert(type(n) == "number" or (type(n) == "string" and n == "#"), format("bad argument #1 to 'select' (number expected, got %s)", n and type(n) or "no value"))
|
||||||
|
|
||||||
if type(n) == "string" and n == "#" then
|
if type(n) == "string" then
|
||||||
if type(arg) == "table" then
|
if type(arg) == "table" then
|
||||||
return getn(arg)
|
return getn(arg)
|
||||||
else
|
else
|
||||||
@@ -35,7 +35,7 @@ function select(n, ...)
|
|||||||
local temp = {}
|
local temp = {}
|
||||||
|
|
||||||
for i = n, getn(arg) do
|
for i = n, getn(arg) do
|
||||||
insert(temp, arg[i])
|
tinsert(temp, arg[i])
|
||||||
end
|
end
|
||||||
|
|
||||||
return unpack(temp)
|
return unpack(temp)
|
||||||
@@ -71,9 +71,9 @@ function string.match(str, pattern, index)
|
|||||||
assert(type(pattern) == "string", format("bad argument #2 to 'match' (string expected, got %s)", pattern and type(pattern) or "no value"))
|
assert(type(pattern) == "string", format("bad argument #2 to 'match' (string expected, got %s)", pattern and type(pattern) or "no value"))
|
||||||
|
|
||||||
str = type(str) == "number" and tostring(str) or str
|
str = type(str) == "number" and tostring(str) or str
|
||||||
local _, _, match = find(index and sub(str, index) or str, "("..pattern..")")
|
local i, j = find(index and sub(str, index) or str, pattern)
|
||||||
|
|
||||||
return match
|
return i and sub(str, i, j)
|
||||||
end
|
end
|
||||||
strmatch = string.match
|
strmatch = string.match
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,26 @@
|
|||||||
-- Cache global variables
|
--Cache global variables
|
||||||
local _G = _G
|
local _G = _G
|
||||||
local assert = assert
|
local assert = assert
|
||||||
local date = date
|
local date = date
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
|
local select = select
|
||||||
local tonumber = tonumber
|
local tonumber = tonumber
|
||||||
local type = type
|
local type = type
|
||||||
local unpack = unpack
|
local unpack = unpack
|
||||||
local format, gsub, lower, match, upper = string.format, string.gsub, string.lower, string.match, string.upper
|
local format, gsub, lower, match, upper = string.format, string.gsub, string.lower, string.match, string.upper
|
||||||
local getn = table.getn
|
local getn = table.getn
|
||||||
-- WoW API
|
--WoW API
|
||||||
local GetQuestGreenRange = GetQuestGreenRange
|
local GetQuestGreenRange = GetQuestGreenRange
|
||||||
local GetRealZoneText = GetRealZoneText
|
local GetRealZoneText = GetRealZoneText
|
||||||
local IsInInstance = IsInInstance
|
local IsInInstance = IsInInstance
|
||||||
local UnitBuff = UnitBuff
|
local UnitBuff = UnitBuff
|
||||||
local UnitDebuff = UnitDebuff
|
local UnitDebuff = UnitDebuff
|
||||||
local UnitLevel = UnitLevel
|
local UnitLevel = UnitLevel
|
||||||
-- WoW Variables
|
--WoW Variables
|
||||||
local DUNGEON_DIFFICULTY1 = DUNGEON_DIFFICULTY1
|
local DUNGEON_DIFFICULTY1 = DUNGEON_DIFFICULTY1
|
||||||
local TIMEMANAGER_AM = gsub(TIME_TWELVEHOURAM, "^.-(%w+)$", "%1")
|
local TIMEMANAGER_AM = gsub(TIME_TWELVEHOURAM, "^.-(%w+)$", "%1")
|
||||||
local TIMEMANAGER_PM = gsub(TIME_TWELVEHOURPM, "^.-(%w+)$", "%1")
|
local TIMEMANAGER_PM = gsub(TIME_TWELVEHOURPM, "^.-(%w+)$", "%1")
|
||||||
-- Libs
|
--Libs
|
||||||
local LBC = LibStub("LibBabble-Class-3.0"):GetLookupTable()
|
local LBC = LibStub("LibBabble-Class-3.0"):GetLookupTable()
|
||||||
local LBZ = LibStub("LibBabble-Zone-3.0"):GetLookupTable()
|
local LBZ = LibStub("LibBabble-Zone-3.0"):GetLookupTable()
|
||||||
|
|
||||||
@@ -94,15 +95,15 @@ function hooksecurefunc(arg1, arg2, arg3)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[ issecurevariable
|
--[[ issecurevariable([table], variable)
|
||||||
Returns 1, nil for undefined variables. This is because an undefined variable is secure since you have not tainted it.
|
Returns 1, nil for undefined variables. This is because an undefined variable is secure since you have not tainted it.
|
||||||
Returns 1, nil for all untainted variables (i.e. Blizzard variables).
|
Returns 1, nil for all untainted variables (i.e. Blizzard variables).
|
||||||
Returns nil for any global variable that is hooked insecurely (tainted), even unprotected ones like UnitName().
|
Returns nil for any global variable that is hooked insecurely (tainted), even unprotected ones like UnitName().
|
||||||
Returns nil for all user defined global variables.
|
Returns nil for all user defined global variables.
|
||||||
If a table is passed first, it checks table.variable (e.g. issecurevariable(PlayerFrame, "Show") checks PlayerFrame["Show"] or PlayerFrame.Show (they are the same thing)).
|
If a table is passed first, it checks table.variable (e.g. issecurevariable(PlayerFrame, "Show") checks PlayerFrame["Show"] or PlayerFrame.Show (they are the same thing)).
|
||||||
]]
|
]]
|
||||||
function issecurevariable(tab, var)
|
function issecurevariable(t, var)
|
||||||
-- assert(type(tab) == "table" and type(var) == "string", "Usage: issecurevariable([table,] \"variable\")")
|
-- assert(type(t) == "table" and type(var) == "string", "Usage: issecurevariable([table,] \"variable\")")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -232,11 +233,7 @@ function GetCurrentMapAreaID()
|
|||||||
if not IsInInstance() then return end
|
if not IsInInstance() then return end
|
||||||
local zoneName = GetRealZoneText()
|
local zoneName = GetRealZoneText()
|
||||||
|
|
||||||
if zoneName ~= "" and zoneInfo[zoneName] then
|
return zoneInfo[zoneName] and zoneInfo[zoneName].mapID or 0
|
||||||
return zoneInfo[zoneName].mapID
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function GetMapNameByID(id)
|
function GetMapNameByID(id)
|
||||||
@@ -280,7 +277,7 @@ local function OnOrientationChanged(self, orientation)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function OnSizeChanged()
|
local function OnSizeChanged()
|
||||||
local width, height = ElvUF_Player.Health:GetWidth(), ElvUF_Player.Health:GetHeight()
|
local width, height = this:GetWidth(), this:GetHeight()
|
||||||
this.texturePointer.width = width
|
this.texturePointer.width = width
|
||||||
this.texturePointer.height = height
|
this.texturePointer.height = height
|
||||||
this.texturePointer:SetWidth(width)
|
this.texturePointer:SetWidth(width)
|
||||||
@@ -288,11 +285,13 @@ local function OnSizeChanged()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function OnValueChanged()
|
local function OnValueChanged()
|
||||||
|
local value = arg1
|
||||||
local _, max = this:GetMinMaxValues()
|
local _, max = this:GetMinMaxValues()
|
||||||
|
|
||||||
if this.texturePointer.verticalOrientation then
|
if this.texturePointer.verticalOrientation then
|
||||||
this.texturePointer:SetHeight(this.texturePointer.height * (arg1 / max))
|
this.texturePointer:SetHeight(this.texturePointer.height * (value / max))
|
||||||
else
|
else
|
||||||
this.texturePointer:SetWidth(this.texturePointer.width * (arg1 / max))
|
this.texturePointer:SetWidth(this.texturePointer.width * (value / max))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -342,7 +341,6 @@ function GetThreatStatus(currentThreat, maxThreat)
|
|||||||
assert(type(currentThreat) == "number" and type(maxThreat) == "number", "Usage: GetThreatStatus(currentThreat, maxThreat)")
|
assert(type(currentThreat) == "number" and type(maxThreat) == "number", "Usage: GetThreatStatus(currentThreat, maxThreat)")
|
||||||
|
|
||||||
if not maxThreat or maxThreat == 0 then
|
if not maxThreat or maxThreat == 0 then
|
||||||
maxThreat = 0
|
|
||||||
maxThreat = 1
|
maxThreat = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -358,3 +356,15 @@ function GetThreatStatus(currentThreat, maxThreat)
|
|||||||
return 0, threatPercent
|
return 0, threatPercent
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Credits: @Shagu - pfUI
|
||||||
|
-- https://github.com/shagu/pfUI/blob/7999f612ad464261306bbf6f309bb63b54bd44af/api/api.lua#L123
|
||||||
|
function GetItemLinkByName(name)
|
||||||
|
for itemID = 1, 25818 do
|
||||||
|
local itemName, itemLink, itemQuality = GetItemInfo(itemID)
|
||||||
|
if itemName and itemName == name then
|
||||||
|
local hex = select(4, GetItemQualityColor(tonumber(itemQuality)))
|
||||||
|
return hex.. "|H"..itemLink.."|h["..itemName.."]|h|r"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
_G = getfenv()
|
_G = getfenv()
|
||||||
|
|
||||||
-- Cache global variables
|
--Cache global variables
|
||||||
local strmatch = strmatch
|
local strmatch = strmatch
|
||||||
-- WoW API
|
--WoW API
|
||||||
local GetCVar = GetCVar
|
local GetCVar = GetCVar
|
||||||
local IsAddOnLoaded = IsAddOnLoaded
|
local IsAddOnLoaded = IsAddOnLoaded
|
||||||
local LoadAddOn = LoadAddOn
|
local LoadAddOn = LoadAddOn
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
-- Cache global variables
|
--Cache global variables
|
||||||
local strmatch = strmatch
|
local strmatch = strmatch
|
||||||
|
--WoW API
|
||||||
|
local IsAddOnLoaded = IsAddOnLoaded
|
||||||
|
|
||||||
local checked
|
local checked
|
||||||
local function LoadDebugTools()
|
local function LoadDebugTools()
|
||||||
if checked then return end
|
if checked then return end
|
||||||
|
|
||||||
local _, _, _, lod, _, reason = GetAddOnInfo("!DebugTools")
|
local _, _, _, loadable, _, reason = GetAddOnInfo("!DebugTools")
|
||||||
checked = true
|
checked = true
|
||||||
|
|
||||||
if reason == "MISSING" then return end
|
if reason == "MISSING" then return end
|
||||||
|
|
||||||
if lod then
|
if loadable then
|
||||||
LoadAddOn("!DebugTools")
|
LoadAddOn("!DebugTools")
|
||||||
else
|
else
|
||||||
EnableAddOn("!DebugTools")
|
EnableAddOn("!DebugTools")
|
||||||
@@ -41,11 +43,17 @@ SLASH_EVENTTRACE1 = "/eventtrace"
|
|||||||
SLASH_EVENTTRACE2 = "/etrace"
|
SLASH_EVENTTRACE2 = "/etrace"
|
||||||
SlashCmdList["EVENTTRACE"] = function(msg)
|
SlashCmdList["EVENTTRACE"] = function(msg)
|
||||||
LoadDebugTools()
|
LoadDebugTools()
|
||||||
|
|
||||||
|
if IsAddOnLoaded("!DebugTools") then
|
||||||
EventTraceFrame_HandleSlashCmd(msg)
|
EventTraceFrame_HandleSlashCmd(msg)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
SLASH_DUMP1 = "/dump"
|
SLASH_DUMP1 = "/dump"
|
||||||
SlashCmdList["DUMP"] = function(msg)
|
SlashCmdList["DUMP"] = function(msg)
|
||||||
LoadDebugTools()
|
LoadDebugTools()
|
||||||
|
|
||||||
|
if IsAddOnLoaded("!DebugTools") then
|
||||||
DevTools_DumpCommand(msg)
|
DevTools_DumpCommand(msg)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@@ -106,12 +106,12 @@ function EventTraceFrame_OnEvent (self, event, ...)
|
|||||||
self.framesSinceLast[nextIndex] = 0;
|
self.framesSinceLast[nextIndex] = 0;
|
||||||
self.eventids[nextIndex] = GetCurrentEventID();
|
self.eventids[nextIndex] = GetCurrentEventID();
|
||||||
|
|
||||||
local numArgs = select("#", arg);
|
local numArgs = select("#", unpack(arg));
|
||||||
for i=1, numArgs do
|
for i=1, numArgs do
|
||||||
if (not self.args[i]) then
|
if (not self.args[i]) then
|
||||||
self.args[i] = {};
|
self.args[i] = {};
|
||||||
end
|
end
|
||||||
self.args[i][nextIndex] = select(i, arg);
|
self.args[i][nextIndex] = arg[i];
|
||||||
end
|
end
|
||||||
|
|
||||||
if (self.eventsToCapture) then
|
if (self.eventsToCapture) then
|
||||||
@@ -135,7 +135,7 @@ function EventTraceFrame_OnShow(self)
|
|||||||
scrollBar:SetValue(maxValue);
|
scrollBar:SetValue(maxValue);
|
||||||
end
|
end
|
||||||
|
|
||||||
function EventTraceFrame_OnUpdate ()
|
function EventTraceFrame_OnUpdate (self, elapsed)
|
||||||
EventTraceFrame_Update();
|
EventTraceFrame_Update();
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -528,7 +528,7 @@ function ScriptErrorsFrame_OnLoad (self)
|
|||||||
_ScriptErrorsFrame = self;
|
_ScriptErrorsFrame = self;
|
||||||
end
|
end
|
||||||
|
|
||||||
function ScriptErrorsFrame_OnShow ()
|
function ScriptErrorsFrame_OnShow (self)
|
||||||
ScriptErrorsFrame_Update();
|
ScriptErrorsFrame_Update();
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -669,7 +669,7 @@ function FrameStackTooltip_OnLoad(self)
|
|||||||
self:RegisterEvent("DISPLAY_SIZE_CHANGED")
|
self:RegisterEvent("DISPLAY_SIZE_CHANGED")
|
||||||
end
|
end
|
||||||
|
|
||||||
function FrameStackTooltip_OnEvent(self, event)
|
function FrameStackTooltip_OnEvent(self, event, ...)
|
||||||
if (event == "DISPLAY_SIZE_CHANGED") then
|
if (event == "DISPLAY_SIZE_CHANGED") then
|
||||||
FrameStackTooltip_OnDisplaySizeChanged(self)
|
FrameStackTooltip_OnDisplaySizeChanged(self)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -375,7 +375,7 @@
|
|||||||
EventTraceFrame_OnShow(this);
|
EventTraceFrame_OnShow(this);
|
||||||
</OnShow>
|
</OnShow>
|
||||||
<OnEvent>
|
<OnEvent>
|
||||||
EventTraceFrame_OnEvent(this, event, arg);
|
EventTraceFrame_OnEvent(this, event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15);
|
||||||
</OnEvent>
|
</OnEvent>
|
||||||
<OnUpdate>
|
<OnUpdate>
|
||||||
EventTraceFrame_OnUpdate(this, arg1);
|
EventTraceFrame_OnUpdate(this, arg1);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ local mod = math.mod
|
|||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
local tostring = tostring
|
local tostring = tostring
|
||||||
local format, match = string.format, string.match
|
local format, match = string.format, string.match
|
||||||
local getn, tinsert, tsort, twipe = table.getn, table.insert, table.sort, table.wipe
|
local getn, setn, tinsert, tsort, twipe = table.getn, table.setn, table.insert, table.sort, table.wipe
|
||||||
-- WoW API
|
-- WoW API
|
||||||
local GetTime = GetTime
|
local GetTime = GetTime
|
||||||
|
|
||||||
@@ -86,11 +86,7 @@ local function FrameStackSort(b, a)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if a and b then
|
|
||||||
return a < b
|
return a < b
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function UpdateFrameStack(tooltip, showHidden)
|
function UpdateFrameStack(tooltip, showHidden)
|
||||||
@@ -99,6 +95,7 @@ function UpdateFrameStack(tooltip, showHidden)
|
|||||||
for i = 1, getn(frameStackList) do
|
for i = 1, getn(frameStackList) do
|
||||||
frameStackList[i] = nil
|
frameStackList[i] = nil
|
||||||
end
|
end
|
||||||
|
setn(frameStackList, 0)
|
||||||
|
|
||||||
for k in pairs(frameStackLevels) do
|
for k in pairs(frameStackLevels) do
|
||||||
frameStackLevels[k] = nil
|
frameStackLevels[k] = nil
|
||||||
|
|||||||
Reference in New Issue
Block a user