forked from Dusk/ShaguTweaks-ClassicAPI
Release 3.8.6: module fixes and native timer optimizations
This commit is contained in:
@@ -60,9 +60,6 @@ API.containeritems = type(_G.C_Container) == "table"
|
||||
API.containeriteminfo = type(_G.C_Container) == "table"
|
||||
and type(_G.C_Container.GetContainerItemInfo) == "function"
|
||||
|
||||
API.containeropenable = type(_G.C_Container) == "table"
|
||||
and type(_G.C_Container.IsContainerItemOpenable) == "function"
|
||||
|
||||
API.items = type(_G.C_Item) == "table"
|
||||
API.iteminfo = API.items and type(_G.C_Item.GetItemInfo) == "function"
|
||||
API.iteminfoinstant = API.items
|
||||
@@ -145,11 +142,6 @@ API.loothistoryevents = API.loothistory and API.eventutils
|
||||
and _G.C_EventUtils.IsEventValid("LOOT_HISTORY_FULL_UPDATE")
|
||||
API.lootrollitemid = type(_G.GetLootRollItemID) == "function"
|
||||
|
||||
API.aoeloot = type(_G.C_Loot) == "table"
|
||||
and type(_G.C_Loot.GetNearbyLootableUnits) == "function"
|
||||
and type(_G.C_Loot.IsScanInProgress) == "function"
|
||||
and type(_G.C_Loot.LootAllCorpses) == "function"
|
||||
|
||||
API.overridebindings = type(_G.SetOverrideBindingClick) == "function"
|
||||
and type(_G.ClearOverrideBindings) == "function"
|
||||
|
||||
@@ -247,6 +239,24 @@ API.GetChannelInfo = function(unit)
|
||||
isTradeSkill, notInterruptible, spellID, true
|
||||
end
|
||||
|
||||
-- Native cast durations are snapshots: fetch again after pushback/channel
|
||||
-- updates. Synthetic/SuperWoW timing uses a separate reusable object, never
|
||||
-- mutating a duration returned by the engine.
|
||||
API.GetCastDuration = function(unit, channel, startTime, endTime, fallback)
|
||||
if not API.durationtimers then return end
|
||||
local query = channel and _G.UnitChannelDuration or _G.UnitCastingDuration
|
||||
if type(query) == "function" then
|
||||
local duration = query(unit)
|
||||
if duration and math.abs(duration:GetStartTime() - startTime) < .001
|
||||
and math.abs(duration:GetEndTime() - endTime) < .001 then
|
||||
return duration, fallback
|
||||
end
|
||||
end
|
||||
fallback = fallback or _G.C_DurationUtil.CreateDuration()
|
||||
fallback:SetTimeSpan(startTime, endTime)
|
||||
return fallback, fallback
|
||||
end
|
||||
|
||||
API.IsSpellInRange = function(spell, unit)
|
||||
if API.spellrange then
|
||||
return _G.C_Spell.IsSpellInRange(spell, unit)
|
||||
@@ -442,30 +452,6 @@ API.GetContainerNumFreeSlots = function(bag)
|
||||
return 0, 0
|
||||
end
|
||||
|
||||
API.IsContainerItemOpenable = function(bag, slot)
|
||||
if API.containeropenable then
|
||||
return _G.C_Container.IsContainerItemOpenable(bag, slot)
|
||||
end
|
||||
end
|
||||
|
||||
API.GetNearbyLootableUnits = function()
|
||||
if API.aoeloot then
|
||||
return _G.C_Loot.GetNearbyLootableUnits()
|
||||
end
|
||||
end
|
||||
|
||||
API.IsLootScanInProgress = function()
|
||||
return API.aoeloot and _G.C_Loot.IsScanInProgress() or false
|
||||
end
|
||||
|
||||
API.LootAllCorpses = function(maxCount)
|
||||
if API.aoeloot then
|
||||
if maxCount then return _G.C_Loot.LootAllCorpses(maxCount) end
|
||||
return _G.C_Loot.LootAllCorpses()
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- ClassicAPI updates its own left/right modifier bitmap before firing
|
||||
-- MODIFIER_STATE_CHANGED. Prefer that state over vanilla's merged Win32 key
|
||||
-- state when the richer ClassicAPI functions are available.
|
||||
|
||||
Reference in New Issue
Block a user