Module:CryptogullJr/Codes: Difference between revisions

5,254 bytes removed ,  00:49, 28 January 2021
update for mutations rework
mNo edit summary
(update for mutations rework)
Line 1: Line 1:
local p = {}
local p = {}
local cargo = mw.ext.cargo
local cargo = mw.ext.cargo
 
local textutil = require'Module:Text Utility'
function p.getMutCodes()
local mutresult = cargo.query('Mutations', '_pageName=Name, CreationCode, Variants, Type',
  {where='_pageNamespace="0"',
default=nil,
orderBy='CreationCode ASC'} )
local resulttrue = 0
 
--[If there was no result, search by alias instead]
if not next(mutresult) then
error('There was no defined mutation table, or it wasn\'t found.')
else
    return mutresult
    end
end


     --[1 NAME, stats (2 STR, 3 AGI, 4 TUF, 5 INT, 6 WIL, 7 EGO),]--
     --[1 NAME, stats (2 STR, 3 AGI, 4 TUF, 5 INT, 6 WIL, 7 EGO),]--
Line 54: Line 40:
     }
     }


muts = {
        ['aa'] = { "Chimera", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['ab'] = { "Esper", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['uu'] = { "Unstable Genome", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['u2'] = { "Unstable Genome(2)", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['u3'] = { "Unstable Genome(3)", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['u4'] = { "Unstable Genome(4)", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['u5'] = { "Unstable Genome(5)", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['u6'] = { "Unstable Genome(6)", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['u7'] = { "Unstable Genome(7)", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['u8'] = { "Unstable Genome(8)", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['u9'] = { "Unstable Genome(9)", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['ba'] = { "Adrenal Control", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bb'] = { "Burrowing Claws", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bc'] = { "Carapace", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['b6'] = { "Carnivorous", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bd'] = { "Corrosive Gas Generation", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['be'] = { "Double-muscled", 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bf'] = { "Electrical Generation", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bg'] = { "Electromagnetic Pulse", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bh'] = { "Flaming Hands", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bi'] = { "Freezing Hands", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bj'] = { "Heightened Hearing", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bk'] = { "Heightened Quickness", 0, 0, -1, 0, 0, 0, 0, 0, 0, 0 },
        ['bl'] = { "Horns", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bm'] = { "Metamorphosis", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bn'] = { "Multiple Arms", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bo'] = { "Multiple Legs", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bp'] = { "Night Vision", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bq'] = { "Phasing", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['br'] = { "Photosynthetic Skin", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bs'] = { "Quills", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bt'] = { "Regeneration", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bu'] = { "Sleep Gas Generation", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bv'] = { "Slime Glands", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bw'] = { "Spinnerets", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bx'] = { "Stinger (Confusing Venom)", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['by'] = { "Stinger (Paralyzing Venom)", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['bz'] = { "Stinger (Poisoning Venom)", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['b1'] = { "Thick Fur", 0, 0, 0, 0, 0, 0, 0, 0, 4, 4 },
        ['b2'] = { "Triple-jointed", -1, 2, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['b3'] = { "Two-headed", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['b4'] = { "Two-hearted", 0, 0, 2, 0, 0, 0, 0, 0, 0, 0 },
        ['b5'] = { "Wings", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        --[phys defects]
        ['ca'] = { "Albino", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['cb'] = { "Amphibious", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['cc'] = { "Analgesia", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['cd'] = { "Beak", 0, 0, 0, 0, 0, -1, 0, 0, 0, 0 },
        ['ce'] = { "Cold-Blooded", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['cf'] = { "Brittle Bones", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['cg'] = { "Electromagnetic Impulse", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['ch'] = { "Hemophilia", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['ci'] = { "Hooks for Feet", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['cj'] = { "Myopia", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['ck'] = { "Spontaneous Combustion", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        --[mental muts]
        ['da'] = { "Beguiling", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['db'] = { "Burgeoning", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['dc'] = { "Clairvoyance", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['dd'] = { "Confusion", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['de'] = { "Cryokinesis", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['df'] = { "Domination", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['dg'] = { "Disintegration", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['dh'] = { "Ego Projection", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['di'] = { "Force Bubble", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['dj'] = { "Force Wall", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['dk'] = { "Kindle", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['dl'] = { "Light Manipulation", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['dm'] = { "Mass Mind", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['dn'] = { "Mental Mirror", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['do'] = { "Precognition", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['dp'] = { "Psychometry", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['dq'] = { "Pyrokinesis", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['dr'] = { "Sense Psychic", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['ds'] = { "Space-Time Vortex", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['dt'] = { "Stunning Force", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['du'] = { "Sunder Mind", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['dv'] = { "Syphon Vim", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['dw'] = { "Telepathy", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['dx'] = { "Teleportation", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['dy'] = { "Teleport Other", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['dz'] = { "Time Dilation", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['d1'] = { "Temporal Fugue", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        --[mental defects]
        ['ea'] = { "Amnesia", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['eb'] = { "Blinking Tic", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['ec'] = { "Evil Twin", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['ed'] = { "Narcolepsy", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['ee'] = { "Pack Rat", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['ef'] = { "Socially Repugnant", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['eg'] = { "Unwelcome Germination", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        --[cybernetics (to be added)]
        ['00'] = { "", 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 },
        ['01'] = { "dermal insulation", 0, 0, 0, 0, 0, 0, 6, 6, 6, 6 },
        ['04'] = { 'optical bioscanner', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['05'] = { 'optical technoscanner', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['06'] = { 'night vision', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['07'] = { 'hyper-elastic ankle tendons', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['08'] = { 'parabolic muscular subroutine', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['09'] = { 'translucent skin', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['11'] = { 'stabilizer arm locks', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['12'] = { 'rapid release finger flexors', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['13'] = { 'carbide hand bones', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['14'] = { 'pentaceps', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        ['15'] = { 'inflatable axons', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        -- subtypes A-D, E-H, I-L
        ['16'] = { 'nocturnal apex', 'cherubic visage', 'air current microsensor', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
    }
   


statBonus = {
['Doubled-muscled'] = {2, 0, 0, 0, 0, 0},
['Triple-jointed'] = {0, 2, 0, 0, 0, 0},
['Two-hearted'] = {0, 0, 2, 0, 0, 0},
['Beak'] = {0, 0, 0, 0, 0, 1},
['No Cybernetic'] = {0, 0, 1, 0, 0, 0}
}
function p.mergeCodes(muttable, cybtable)
    finaltable = muttable
    for k,v in pairs(cybtable) do
    if finaltable[k] then
    error("there are cybernetics and mutations that have the same creation code!")
    end
    finaltable[k] = v
    end
    return finaltable
end
function getMutCodes()
local mutresult = cargo.query('Mutations', '_pageName=Name, CreationCode, Variants, Type',
  {where='_pageNamespace="0" AND CreationCode <> ""',
default=nil,
orderBy='CreationCode ASC'} )
--[If there was no result, search by alias instead]
if not next(mutresult) then
error('There was no defined mutation table, or it wasn\'t found.')
else
-- Next, reorganize the table so it's [code] = {other, fields}
mutresulttable = {}
    for _,j in ipairs(mutresult) do
    mutresulttable[j['CreationCode']] = {j['Name'], textutil.split(j['Variants']), j['Type'] }
    end
    -- Add unstable genome stacks because they're not stored
    mutresulttable['u2'] = {"Unstable Genome(2)", "", "Genotype"}
        mutresulttable['u3'] = {"Unstable Genome(3)", "", "Genotype"}
        mutresulttable['u4'] = {"Unstable Genome(4)", "", "Genotype"}
        mutresulttable['u5'] = {"Unstable Genome(5)", "", "Genotype"}
        mutresulttable['u6'] = {"Unstable Genome(6)", "", "Genotype"}
        mutresulttable['u7'] = {"Unstable Genome(7)", "", "Genotype"}
        mutresulttable['u8'] = {"Unstable Genome(8)", "", "Genotype"}
        mutresulttable['u9'] = {"Unstable Genome(9)", "", "Genotype"}
    return mutresulttable
    end
end
function getCyberneticsCodes()
local cyberneticresult = cargo.query('Cybernetics',
'Name, CreationCode, StartingCybernetic',
  {where='_pageNamespace="10002" AND CreationCode <> ""',
default=nil,
orderBy='CreationCode ASC'} )
--[If there was no result, search by alias instead]
if not next(cyberneticresult) then
error('There was no defined cybernetic table, or it wasn\'t found.')
else
-- Next, reorganize the table so it's [code] = {other, fields}
cyberneticresulttable = {}
arcologycybertable = {}
    for _,j in ipairs(cyberneticresult) do
    if j['CreationCode'] ~= "16" then -- no 16 variants
    cyberneticresulttable[j['CreationCode']] = {j['Name'], j['StartingCybernetic']}
    end
    end
    -- add no cybernetic because its not stored
    cyberneticresulttable['00'] = {"No Cybernetic", "", ""}
    return cyberneticresulttable
    end
end
muts = p.mergeCodes(getMutCodes(), getCyberneticsCodes())


local mutationVariants = {
['cd'] = {'Beak' , 'Bill', 'Rostrum', 'Frill', 'proboscis'},  -- beak
['bh'] = {'Hands, Face, Feet'},  --flaming ray
['bi'] = {'Hands, Face, Feet'},  --freezing ray
['bl'] = {'horns', 'horn', 'antlers', 'casque'}  --horns
}


function p.TrueKinSubtype(code)
function p.TrueKinSubtype(code)
Line 179: Line 120:
function p.MutantSubtype(code)
function p.MutantSubtype(code)
     return calling[code]
     return calling[code]
end
function p.getStatBonus(code)
return statBonus[code]
end
end


Line 184: Line 129:
     if code ~= nil and code == '16' then
     if code ~= nil and code == '16' then
         if subtypeC < 'e' then
         if subtypeC < 'e' then
             return { 'nocturnal apex', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
             return { 'nocturnal apex'}
         elseif subtypeC < 'i' then
         elseif subtypeC < 'i' then
             return { 'cherubic visage', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
             return { 'cherubic visage'}
         else
         else
             return { 'air current microsensor', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
             return { 'air current microsensor'}
         end
         end
     else
     else
         return muts[code]
         return muts[code]
     end
     end
end
function p.getImplants(code, subtypeC)
end
end


return p
return p