forked from Dusk/ShaguTweaks-ClassicAPI
Release 3.8.2: healing predictions and native API improvements
This commit is contained in:
@@ -90,6 +90,19 @@ API.eventutils = type(_G.C_EventUtils) == "table"
|
||||
API.timer = type(_G.C_Timer) == "table"
|
||||
and type(_G.C_Timer.After) == "function"
|
||||
|
||||
API.durationtimers = type(_G.C_DurationUtil) == "table"
|
||||
and type(_G.C_DurationUtil.CreateDuration) == "function"
|
||||
and type(_G.C_DurationUtil.CreateDurationTextBinding) == "function"
|
||||
and type(_G.C_StringUtil) == "table"
|
||||
and type(_G.C_StringUtil.CreateNumericRuleFormatter) == "function"
|
||||
and type(_G.C_Timer) == "table" and type(_G.C_Timer.NewTimer) == "function"
|
||||
and type(_G.Enum) == "table" and type(_G.Enum.StatusBarInterpolation) == "table"
|
||||
and type(_G.Enum.StatusBarTimerDirection) == "table"
|
||||
and type(_G.Enum.NumericRuleFormatRounding) == "table"
|
||||
and _G.Enum.StatusBarInterpolation.Immediate ~= nil
|
||||
and _G.Enum.StatusBarTimerDirection.ElapsedTime ~= nil
|
||||
and _G.Enum.NumericRuleFormatRounding.Down ~= nil
|
||||
|
||||
API.regionmouseover = _G.UIParent
|
||||
and type(_G.UIParent.IsMouseOver) == "function"
|
||||
|
||||
@@ -155,6 +168,10 @@ API.tooltipsetitem = API.tooltipitem
|
||||
API.unitrange = type(_G.UnitInRange) == "function"
|
||||
|
||||
API.macrospell = type(_G.GetMacroSpell) == "function"
|
||||
API.macrodisplay = type(_G.C_Macro) == "table"
|
||||
and type(_G.C_Macro.SetMacroDisplay) == "function"
|
||||
and type(_G.C_Macro.GetMacroIcon) == "function"
|
||||
API.nativemacrocommands = API.macrodisplay and type(_G.RunMacroText) == "function"
|
||||
API.attackverbs = type(_G.StartAttack) == "function"
|
||||
and type(_G.StopAttack) == "function"
|
||||
API.focus = type(_G.FocusUnit) == "function"
|
||||
@@ -378,6 +395,38 @@ API.Defer = function(callback)
|
||||
end
|
||||
end
|
||||
|
||||
-- Layout consumers must wait for world entry, then for other modules' first
|
||||
-- OnUpdates, before restoring/detaching frames. Each request is one-shot and
|
||||
-- releases its scripts when finished. The standalone layout needs a second
|
||||
-- update without native timers; the action-bar layout only needs the first.
|
||||
-- Schedule during module enable, before the first PLAYER_ENTERING_WORLD.
|
||||
API.AfterWorldReady = function(callback, extraFrame)
|
||||
local ready = CreateFrame("Frame")
|
||||
local function Finish()
|
||||
ready:SetScript("OnUpdate", nil)
|
||||
ready:Hide()
|
||||
callback()
|
||||
end
|
||||
ready:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
ready:SetScript("OnEvent", function()
|
||||
ready:UnregisterAllEvents()
|
||||
ready:SetScript("OnEvent", nil)
|
||||
ready:SetScript("OnUpdate", function()
|
||||
ready:SetScript("OnUpdate", nil)
|
||||
ready:Hide()
|
||||
if API.timer then
|
||||
API.Defer(callback)
|
||||
elseif extraFrame then
|
||||
ready:SetScript("OnUpdate", Finish)
|
||||
ready:Show()
|
||||
else
|
||||
callback()
|
||||
end
|
||||
end)
|
||||
end)
|
||||
return ready
|
||||
end
|
||||
|
||||
API.IsMouseOver = function(region, topOffset, bottomOffset, leftOffset, rightOffset)
|
||||
if API.regionmouseover and region then
|
||||
return region:IsMouseOver(topOffset, bottomOffset, leftOffset, rightOffset)
|
||||
@@ -456,6 +505,12 @@ API.IsAltKeyDown = function()
|
||||
return false
|
||||
end
|
||||
|
||||
-- All frame movers/previews use the same three-key chord. Individual key
|
||||
-- queries above retain ClassicAPI's left/right state and vanilla fallback.
|
||||
API.AreMoveModifiersDown = function()
|
||||
return API.IsShiftKeyDown() and API.IsControlKeyDown() and API.IsAltKeyDown()
|
||||
end
|
||||
|
||||
-- Direct item IDs avoid a class of Turtle WoW custom-item failures caused by
|
||||
-- relying exclusively on legacy item-link parsing.
|
||||
local function GetItemIDFromLink(link)
|
||||
|
||||
Reference in New Issue
Block a user