6,711 Pages

Documentation for this module may be created at Module:SpellData/doc

-- IMPORTANT NOTE FOR SMITE:
-- Smite and its upgrades share some parameters. Be aware, that changes in Smite's data can affect the upgrades, so be sure to check them if unsure. (Removed upgrades should NOT use this, so if an upgrade gets removed, be sure to manually add all missing parameters!)

-- <pre>
local p = {}

local spellData  = mw.loadData('Module:SpellData/data')
local lib        = require('Module:Feature')


function p.spellargument(frame)
	local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
	local s = args['spell'] or args[1]
	s = s:sub(1,1):upper()..s:sub(2)
	return s
end

function p.smiteswap(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    if args['spell'] == "Chilling Smite" or args['spell'] == "Challenging Smite" then args['spell'] = "Smite"
    end
    
    return args['spell']
end


function p.getdisp_name(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    return spellData[args['spell']].disp_name or spellData[p.smiteswap(frame)].disp_name or args['spell']
end


function p.getlink(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    return (
    	spellData[args['spell']] and spellData[args['spell']].link or 
    	spellData[p.smiteswap(frame)] and spellData[p.smiteswap(frame)].link or 
    	args['spell']
    )
end


function p.getfile(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    local FN = require("Module:Filename")
    
    return FN.spell{args['spell'], args['variant']}
end


function p.getcooldown(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    local result = spellData[args['spell']].cooldown or spellData[p.smiteswap(frame)].cooldown or ""
    return frame:preprocess(result)
end


function p.getrecharge(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    return spellData[args['spell']].recharge or spellData[p.smiteswap(frame)].recharge
end


function p.getcharges(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    return spellData[args['spell']].charges or spellData[p.smiteswap(frame)].charges
end


function p.getlevel(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    local result = spellData[args['spell']].level or spellData[p.smiteswap(frame)].level or ""
    return frame:preprocess(result)
end


function p.getrange(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    local result = spellData[args['spell']].range or spellData[p.smiteswap(frame)].range or ""
    return frame:preprocess(result)
end


function p.getstealth(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    return spellData[args['spell']].stealth or spellData[p.smiteswap(frame)].stealth
end


function p.getmaps(frame)
    local spell = p.smiteswap(frame)
    local s = ""

    for k,v in pairs(spellData[spell].maps or {}) do
    	if v then s = s .. k:upper() end
    end
    
    return s
end


function p.getsr(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    return spellData[args['spell']].maps.sr or spellData[p.smiteswap(frame)].maps.sr or false
end


function p.getha(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    return spellData[args['spell']].maps.ha or spellData[p.smiteswap(frame)].maps.ha or false
end


function p.gettt(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    return spellData[args['spell']].maps.tt or spellData[p.smiteswap(frame)].maps.tt or false
end


function p.getnb(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    return spellData[args['spell']].maps.nb or spellData[p.smiteswap(frame)].maps.nb or false
end


function p.getcs(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    return spellData[args['spell']].maps.cs or spellData[p.smiteswap(frame)].maps.cs or false
end


function p.geteffect(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    local result = spellData[args['spell']].effect or spellData[p.smiteswap(frame)].effect or ""
    return frame:preprocess(result)
end


function p.geteffect2(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    local result = spellData[args['spell']].effect2 or spellData[p.smiteswap(frame)].effect2 or ""
    return frame:preprocess(result)
end


function p.geteffect3(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    local result = spellData[args['spell']].effect3 or spellData[p.smiteswap(frame)].effect3 or ""
    return frame:preprocess(result)
end


function p.getdescription(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    local result = spellData[args['spell']].description or spellData[p.smiteswap(frame)].description or ""
    return frame:preprocess(result)
end


function p.getremoved(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    return spellData[args['spell']].removed or spellData[p.smiteswap(frame)].removed or false
end


function p.getpatch(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    return spellData[args['spell']].patch or spellData[p.smiteswap(frame)].patch
end

function p.getexample(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    return spellData[args['spell']].example or spellData[p.smiteswap(frame)].patch
end

function p.getexample2(frame)
    local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
    
    args['spell'] = p.spellargument(frame)
    
    return spellData[args['spell']].example2 or spellData[p.smiteswap(frame)].patch
end


return p

-- </pre>
-- [[Category:Lua]]
Community content is available under CC-BY-SA unless otherwise noted.