Module:CryptogullJrOld: Difference between revisions

m
no edit summary
mNo edit summary
mNo edit summary
Line 4: Line 4:


function p.Main(frame)
function p.Main(frame)
local buildcode = string.lower(frame.args[1])
local buildcode = frame.args[1]
     local beta = frame.args['beta'] or '1'
     local beta = frame.args['beta'] or '1'
     return p.decode(buildcode, beta, frame)
     return p.decode(buildcode, beta)
end
end


function p.decode(buildcode, beta, frame)
function p.decode(buildcode, beta)
     local genotype
     local genotype
     local subtype
     local subtype
Line 81: Line 81:
               attributes = p.fixattributes(bonus, attributes)
               attributes = p.fixattributes(bonus, attributes)
             end
             end
            if not frame then
 
            output = {buildcode, genotype, subtype, classcalled, extname, attributes, bonus, exts,}
             output = p.MakeUpSheet(buildcode, genotype, subtype,
            else
            classcalled, extname, attributes, bonus, exts)
             output = p.MakeUpSheet(buildcode, genotype, subtype, classcalled, extname, attributes, bonus, exts, frame)
            end
             return output
             return output
         end
         end
Line 148: Line 146:
end
end


function p.MakeUpSheet(codeIn, genoIn, subtype, classcalledIn, extnameIn, attributes, bonus, extsIn, frame)
function p.MakeUpSheet(codeIn, genoIn, subtype, classcalledIn, extnameIn,
 
attributes, bonus, exts)
local frame = mw.getCurrentFrame()
     return frame:expandTemplate {
     return frame:expandTemplate {
         title = 'Crypto result',
         title = 'Crypto result',
Line 164: Line 163:
             ego = attributes[6] .. bonus[6],
             ego = attributes[6] .. bonus[6],
             extname = extnameIn,
             extname = extnameIn,
             exts = utilTable.concat(extsIn, "</br>"),
             exts = utilTable.concat(exts, "</br>"),
             skills = subtype[8],
             skills = subtype[8],
             notes = subtype[14]
             notes = subtype[14]
Line 170: Line 169:
     }
     }
end
end
 
function p.test()
return p.Main({["args"]={"BGMMMKMKBABJBPD1", ["beta"]=1}})
end
return p
return p