Module:CryptogullJrOld: Difference between revisions

Jump to navigation Jump to search
m
no edit summary
m (Teamtoto moved page Module:CryptogullJr to Module:CryptogullJrOld without leaving a redirect)
mNo edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
local p = {}
local p = {}
local decode = require'Module:CryptogullJr/Codes'
local decode = require'Module:CryptogullJr/Codes'
local utilTable = require('Module:Table Utility')


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


function p.decode(buildcode, beta, frame)
function p.decode(buildcode, beta, title)
     local genotype
     local genotype
     local subtype
     local subtype
Line 28: Line 30:
         if (genotypeC == 'a') then
         if (genotypeC == 'a') then
             genotype = "True Kin"
             genotype = "True Kin"
             classcalled = "Caste: "
             classcalled = "Caste"
             extname = "Implants: "
             extname = "Implants"
             subtype = decode.TrueKinSubtype(subtypeC)
             subtype = decode.TrueKinSubtype(subtypeC)
         elseif (genotypeC == 'b') then
         elseif (genotypeC == 'b') then
             genotype = "Mutated Human"
             genotype = "Mutated Human"
             classcalled = "Calling: "
             classcalled = "Calling"
             extname = "Mutations: "
             extname = "Mutations: "
             subtype = decode.MutantSubtype(subtypeC)
             subtype = decode.MutantSubtype(subtypeC)
Line 70: Line 72:
                 else
                 else
                 previouscode = chars
                 previouscode = chars
                     exts[i] = decode.getexts(chars, subtypeC)
                     exts[i] = decode.getexts(chars, subtypeC)[1]
                     i = i + 1
                     i = i + 1
                     end
                     end
Line 80: Line 82:
               attributes = p.fixattributes(bonus, attributes)
               attributes = p.fixattributes(bonus, attributes)
             end
             end
            if not frame then
output = p.MakeUpSheet(buildcode, genotype, subtype,
            output = {buildcode, genotype, subtype, classcalled, extname, attributes, bonus, exts,}
            classcalled, extname, attributes, bonus, exts, title)
            else
            output = p.MakeUpSheet(buildcode, genotype, subtype, classcalled, extname, attributes, bonus, exts, frame)
            end
             return output
             return output
         end
         end
Line 147: Line 146:
end
end


function p.MakeUpSheet(codeIn, genoIn, subtype, classcalledIn, extnameIn, attributes, bonus, extsIn, frame)
function p.MakeUpSheet(codeIn, genoIn, subtype, classcalledIn, extnameIn,
    local mutstring = ""
attributes, bonus, exts, title)
    for _, ext in ipairs(extsIn) do
local frame = mw.getCurrentFrame()
        mutstring = mutstring .. ", " .. ext[1]
    end
 
     return frame:expandTemplate {
     return frame:expandTemplate {
         title = 'Crypto result',
         title = 'Crypto result',
Line 167: Line 163:
             ego = attributes[6] .. bonus[6],
             ego = attributes[6] .. bonus[6],
             extname = extnameIn,
             extname = extnameIn,
             exts = mutstring:sub(3),
             exts = utilTable.concat(exts, "</br>"),
             skills = subtype[8],
             skills = subtype[8],
             notes = subtype[14]
             notes = subtype[14],
            buildname = title,
            author = "Legacy Build Code"
         }
         }
     }
     }
end
end
 
function p.test()
return p.Main({["args"]={"BGMMMKMKBABJBPD1", ["beta"]=1}})
end
return p
return p

Navigation menu