Module:XC2 enum enhance

local enhance_table = mw.loadData("Module:XC2 enum enhance/data") local enhance_table_2 = mw.loadData("Module:XC2 enum enhance/data 2") local enhance_ms_table = mw.loadData("Module:XC2 enum enhance/captions")

local xc2_enum_enhance = {}

function xc2_enum_enhance.formatEnhance(e,isTorna) extraParams = enhance_table_2[e[1]] if e[1] == 0 then extraParams = {0,0,0,0,0,0,0} end caption = enhance_ms_table[e[4]] if isTorna then caption = enhance_ms_table[e[5]] end -- this gsub format lets us do a single operation rather than "three but we usually only need one" caption = caption:gsub("%[ML:Enhance.-]",{["[ML:Enhance kind=Param1 ]"]=e[2],["[ML:Enhance kind=Param2 ]"]=e[3],["[ML:Enhance ]"]=extraParams[4]}) return caption end

function xc2_enum_enhance.getEnhanceName(frame) --	the idea of this is copied from the XC3 version, but it involves linking extraParams[5] to btl_buff_ms, which is a bit too weird to bother with right now end

function xc2_enum_enhance.getEnhanceCaption(frame) id = tonumber(frame.args[1]) isTorna = false if frame.args[2] == "y" then isTorna = true end enhanceEntry = enhance_table[id] if enhanceEntry then return frame:preprocess(xc2_enum_enhance.formatEnhance(enhanceEntry,isTorna)) else return "undefinedEnhance["..id.."]" end end

return xc2_enum_enhance