No edit summary |
No edit summary |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
local p = {} | |||
local currentFrame = 0 | |||
local wikitext = "<div class=\"frameChart\">" | |||
< | function p.drawFrameData(frame) | ||
-- Startup is the first active frame. Sets to true if empty. Otherwise it's false. | |||
local startupIsFirstActive | |||
if frame.args['startupIsFirstActive'] == nil then | |||
startupIsFirstActive = true | |||
else | |||
startupIsFirstActive = false | |||
end | |||
-- Startup of move, substract 1 if startupIsFirstActive | |||
local startup = frame.args['startup'] | |||
if tonumber(startup) ~= nil then | |||
if startupIsFirstActive and tonumber(startup) > 0 then | |||
startup = tonumber(startup) - 1 | |||
end | |||
end | |||
-- Active of move | |||
local active = frame.args['active'] | |||
-- Inactive of move | |||
local inactive = frame.args['inactive'] | |||
-- Recovery of move | |||
local recovery = frame.args['recovery'] | |||
-- Special Recovery of move | |||
local specialRecovery = frame.args['specialRecovery'] | |||
-- How many frames into active frames the inactive period occurs | |||
local offset = frame.args['offset'] | |||
-- Display projectile spawn bar after startup? | |||
local isProjectile = frame.args['isProjectile'] | |||
drawFrame(startup, "startup") | |||
if isProjectile ~= nil then | |||
wikitext = wikitext .. "<div class=\"spawn-projectile\"></div>" | |||
end | |||
-- Alternate way of inputting multihits | |||
if offset ~= nil then | |||
drawFrame(offset, "active") | |||
drawFrame(inactive, "inactive") | |||
drawFrame(active-offset, "active") | |||
else | |||
drawFrame(active, "active") | |||
end | |||
local index = 2 | |||
while tonumber(frame.args['active' .. index]) ~= nil or tonumber(frame.args['inactive' .. index]) ~= nil do | |||
drawFrame(frame.args['active' .. index], "active") | |||
drawFrame(frame.args['inactive' .. index], "inactive") | |||
index = index + 1 | |||
end | |||
drawFrame(recovery, "recovery") | |||
drawFrame(specialRecovery, "specialRecovery") | |||
wikitext = wikitext .. "</div>" | |||
return wikitext | |||
end | |||
function drawFrame(frames, frameType) | |||
if tonumber(frames) ~= nil then | |||
for i=1, tonumber(frames) do | |||
currentFrame = currentFrame + 1 | |||
wikitext = wikitext .. "<div class=\"frame-data-" .. frameType .. "\"></div>" | |||
end | |||
end | |||
end | |||
return p |
Latest revision as of 20:44, 4 September 2022
local p = {}
local currentFrame = 0
local wikitext = "
"
function p.drawFrameData(frame)
-- Startup is the first active frame. Sets to true if empty. Otherwise it's false. local startupIsFirstActive if frame.args['startupIsFirstActive'] == nil then startupIsFirstActive = true else startupIsFirstActive = false end -- Startup of move, substract 1 if startupIsFirstActive local startup = frame.args['startup'] if tonumber(startup) ~= nil then if startupIsFirstActive and tonumber(startup) > 0 then startup = tonumber(startup) - 1 end end -- Active of move local active = frame.args['active'] -- Inactive of move local inactive = frame.args['inactive'] -- Recovery of move local recovery = frame.args['recovery'] -- Special Recovery of move local specialRecovery = frame.args['specialRecovery'] -- How many frames into active frames the inactive period occurs local offset = frame.args['offset'] -- Display projectile spawn bar after startup? local isProjectile = frame.args['isProjectile'] drawFrame(startup, "startup") if isProjectile ~= nil thenwikitext = wikitext .. ""
end -- Alternate way of inputting multihits if offset ~= nil then drawFrame(offset, "active") drawFrame(inactive, "inactive") drawFrame(active-offset, "active") else drawFrame(active, "active") end local index = 2 while tonumber(frame.args['active' .. index]) ~= nil or tonumber(frame.args['inactive' .. index]) ~= nil do drawFrame(frame.args['active' .. index], "active") drawFrame(frame.args['inactive' .. index], "inactive") index = index + 1 end drawFrame(recovery, "recovery") drawFrame(specialRecovery, "specialRecovery")wikitext = wikitext .. "
"
return wikitext
end
function drawFrame(frames, frameType)
if tonumber(frames) ~= nil then for i=1, tonumber(frames) do currentFrame = currentFrame + 1
wikitext = wikitext .. "
"
end end
end
return p