mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
feat(lua): retail SharedXML helpers, Spline, ExportUtil and MixinUtil
Ports from retail's Blizzard_ObjectAPI, SharedXML, SharedXMLBase and
FrameXMLUtil, in Blizzard's own text, from the _forever_ build:
- ObjectCache.lua and SpellBookItemLocation.lua (ObjectAPI).
- TypeUtil.lua: ValueToBoolean and StringToBoolean.
- SortUtil.lua: SortUtil.CreateSortManager and the comparators.
- Sequencer.lua, Spline.lua (Catmull-Rom splines), TaggableObject.lua,
ObjectUpdater.lua and ExportUtil.lua (base64 export/import streams).
- AnimationSystem.lua: SetUpAnimation and CancelAnimations.
- SmoothStatusBar.lua: SmoothStatusBarMixin.
- MixinUtil.lua: DrawLine, LineMixin, SparseGridMixin,
DoublyLinkedListMixin, DirtiableMixin, DirtyPhaseMixin and more. 1.12
has no global wipe, so the file reads table.wipe, as the other ports do.
FrameDeltaLerp now takes retail's three arguments and reads the frame
time from GetTickTime(). The old form needed a fourth elapsed argument,
so SmoothStatusBar's per-frame ticker would have errored. Nothing else
called it.
DebugTools drops its private StringToBoolean copy and calls the global
one from TypeUtil for the /framestack arguments.
FadingFrame.lua is not ported: 1.12's own FrameXML defines the same
FadingFrame_* names with no-argument `this` signatures, and ZoneText
calls FadingFrame_OnUpdate() every frame.
Verified in game: StringToBoolean, ValueToBoolean and
SpellBookItemLocation return the expected values, a 2D spline's midpoint
is (5, 10), an export stream round-trips 200 and 9, the sort manager
orders {3,1,2}, the linked list enumerates 0 1 2, ObjectUpdater,
Sequencer and SetUpAnimation finish, a smoothed status bar reaches 100,
and /framestack still opens.
This commit is contained in:
@@ -1027,20 +1027,6 @@ end
|
||||
|
||||
FRAMESTACK_UPDATE_TIME = .1;
|
||||
|
||||
-- Blizzard_SharedXML's StringToBoolean, for the /framestack arguments.
|
||||
local function _StringToBoolean(stringToCheck, defaultReturn)
|
||||
stringToCheck = string.lower(stringToCheck);
|
||||
local firstChar = string.sub(stringToCheck, 1, 1);
|
||||
if (firstChar == "0" or firstChar == "n" or firstChar == "f" or
|
||||
stringToCheck == "off" or stringToCheck == "disabled") then
|
||||
return false;
|
||||
elseif (string.find(firstChar, "^[1-9yt]") or
|
||||
stringToCheck == "on" or stringToCheck == "enabled") then
|
||||
return true;
|
||||
end
|
||||
return defaultReturn;
|
||||
end
|
||||
|
||||
local function _WrapColor(text, colorHex)
|
||||
return "|c" .. colorHex .. text .. "|r";
|
||||
end
|
||||
@@ -1266,8 +1252,8 @@ function FrameStackTooltip_HandleSlashCmd(msg)
|
||||
showHiddenArg, msg = string.match(msg or "", "^%s*(%S+)(.*)$");
|
||||
showRegionsArg, msg = string.match(msg or "", "^%s*(%S+)(.*)$");
|
||||
|
||||
local showHidden = _StringToBoolean(showHiddenArg or "", false);
|
||||
local showRegions = _StringToBoolean(showRegionsArg or "", true);
|
||||
local showHidden = StringToBoolean(showHiddenArg or "", false);
|
||||
local showRegions = StringToBoolean(showRegionsArg or "", true);
|
||||
|
||||
FrameStackTooltip_Toggle(showHidden, showRegions);
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user