Module:GetRandomCreature: Difference between revisions

Jump to navigation Jump to search
no edit summary
m (Undo revision 2983 by Teamtoto (talk))
No edit summary
Line 1: Line 1:
local p = {}
local p = {}
local cargo = mw.ext.cargo


function p.decode(frame)
function p.Main(frame)
local subtype = string.sub(frame.args[1],0,1)
  local buildcode=string.lower(frame.args[1])
local stats = string.sub(frame.args[1],2,8)
  local genotype
local statsstring = "U"
  local subtype
local subtypetable = {['A'] = "Truekin", ['B'] = "Mutant"}
  local classcalled
local statstable = {
  local attributes = {}
['A'] = "6",
  if (string.len(buildcode)>=8) then
['B'] = "7",
    local genotypeC = string.match(buildcode,'%w')
['C'] = "8",
    if (genotypeC == 'a') then
['D'] = "9",
      genotype="True Kin"
['E'] = "10",
      classcalled = "Caste:"
['F'] = "11",
    elseif (genotypeC == 'b') then
['G'] = "12",
      genotype="Mutated Human"
['H'] = "13",
      classcalled = "Calling:"
['I'] = "14",
    else
['J'] = "15",
      print("The genotype code " .. genotypeC .. " does not exist!")
['K'] = "16",
    end
['L'] = "17",
    local subtypeC = string.sub(buildcode,2,2)
['M'] = "18",
    subtype = p.TrueKinSubtype(subtypeC)
['N'] = "19",
    local attributesC = string.sub(buildcode,2,8)
['O'] = "20",
    print("\n att: "..subtype[1])
['P'] = "21",
    local i = 1
['Q'] = "22",
    for char in string.gmatch(attributesC, "%w") do
['R'] = "23",
      attributes[i] = string.byte(char)-59
['S'] = "24",
      i = i+1
['T'] = "25",
    end
['U'] = "26",
  else
['V'] = "27"}
    print("This build code is too short(<8)!")
  end
end


for i=0,4,1
function p.TrueKinSubtype(code)
do
--[1 NAME, stats (2 STR, 3 AGI, 4 TUF, 5 INT, 6 WIL, 7 EGO),]--
statsstring = statsstring .. " " .. statstable[string.sub(stats,i,1+i)]
--[8 Skills, Resist(9 ACID, 10 ELEC, 11 COLD, 12 HEAT, 13 BLEED), 14 bonusstart]--
local caste= {
  --[The Toxic Arboreta of Ekuemekiyye, the Holy City]
  ['a'] = {"Horticulturist", 0,0,0,3,0,0,"Harvestry, Axe Proficiency, Steady Hands, Draw a Bead, Wilderness Lore: Jungles",0,0,0,0,2, "Start with a bio-scanning bracelet"},
  ['b'] = {"Priest of All Suns", 0,0,0,0,0,3,"Cudgel Proficiency, Heal, Snake Oiler, Intimidate, Wilderness Lore: Jungles",0,0,0,0,2,"Start with a smiling sun mask"},
  ['c'] = {"Priest of All Moons", 0,0,2,0,2,0,"Axe Proficiency, Butchery, Lionheart, Poison Tolerance, Wilderness Lore: Jungles",0,0,0,0,2, "Start with a frowning moon mask"},
  ['e'] = {"Syzygyrior", 0,3,0,0,0,0,"Offhand Strikes, Ambidexterity, Wayfaring: Jungle",0,0,0,0,0, "Start with a bio-scanning bracelet"},
  --[he Ice-Sheathed Arcology of Ibul]
  ['e'] = {"Artifex", 0,0,0,3,0,0,"Repair, Disassemble,Deploy Turret, Tinker I, Tinker II",0,0,15,0,0,""},
  ['f'] = {"Consul", 0,0,0,0,0,3,"Inspiring Presence, Proselytize",0,0,15,0,0, ""},
  ['g'] = {"Praetorian", 2,0,1,0,1,0,"Long Blade Proficiency, Shield Slam, Steady Hands, Draw a Bead", 0,0,15,0,0,""},
  ['h'] = {"Eunuch", 0,2,0,2,0,0,"Hobble, Weak Spotter, Spry, Hurdle",0,0,15,0,0,""},
  --[The Crustal Mortars of Yawningmoon]
  ['i'] = {"Child of the Hearth", 3,0,0,0,0,0,"Slam, Calloused, Strapping Shoulders",0,0,0,15,0, ""},
  ['j'] = {"Child of the Wheel", 1,2,0,0,0,1,"Short Blades Proficiency, Cleave, Offhand Strikes, Iron Mind",0,0,0,15,0,""},
  ['k'] = {"Child of the Deep", 0,0,3,0,0,0,"Tank, Strapping Shoulders, Shake It Off, Wilderness Lore: Mountains, Wilderness Long: Canyons",0,0,0,15,0, ""},
  ['l'] = {"Fuming God-Child", 0,0,0,0,4,0,"Fasting Way, Lionheart, Poison Tolerance, Intimidate",0,0,0,15,0, ""}
}
return caste[code]
end
end


return statsstring
function p.MutationSubtype(code)
--[NAME, stats (STR, AGI, TUF, INT, WIL, EGO),]--
--[Skills, Resist(ACID, ELEC, COLD, HEAT, BLEED), bonusstart]--
local calling = {
  ['a'] = {"Apostle", 0,0,0,0,0,2,"Intimidate, Proselytize, Tactful",0,0,0,0,0, ""},
  ['b'] = {"Arconaut", 0,2,0,0,0,0,"Short Blades Proficiency, Scavenger, Spry",0,0,0,0,0,"Start with random junk and artifacts"},
  ['c'] = {"Greybeard", -1,0,0,0,3,0,"Cudgel Proficiency, Berate, Calloused",0,0,0,0,0, "Start with +100 bear reputation"},
  ['e'] = {"Gunslinger", 0,2,0,0,0,0,"Weak Spotter",0,0,0,0,0, "Start with +200 reputation with mysterious strangers"},
  ['e'] = {"Marauder", 2,0,0,0,0,0,"Dismember, Charge, Butchery",0,0,0,0,0,""},
  ['f'] = {"Pilgrim", 0,0,0,0,2,0,"Meditate, Fasting Way, Iron Mind, Mind's Compass",0,0,0,0,0, ""},
  ['g'] = {"Nomad", 0,0,2,0,0,0,"Mind's Compass, Wilderness Lore: Salt Pans, Harvestry,Weathered", 0,0,15,15,0,"Starts with +200 Issachari reputation"},
  ['h'] = {"Scholar", 0,0,0,2,0,0,"Gadget Inspector, Heal, Harvestry, Hurdle, Tactful",0,0,0,0,0,""},
  ['i'] = {"Tinker", 0,0,0,2,0,0,"Gadget Inspector, Lay Mine, Disassemble, Repair, Tinker I",0,0,0,0,0, "Begins with a number of random artifacts and scrap and +100 Barathrumites reputation"},
  ['j'] = {"Warden", 2,0,0,0,0,0,"Long Blades Proficiency, Shield Slam, Steady Hands, Draw a Bead, Pistol Proficiency",0,0,0,0,0,"Starts with +300 Warden reputation"},
  ['k'] = {"Water Merchant", 0,0,0,0,0,2,"Menacing Stare, Snake Oiler",0,0,0,0,0, "Starts with trade goods and a merchant's token"},
  ['l'] = {"Watervine Farmer", 0,0,2,0,0,0,"Cooking and Gathering, Harvestry, Axe Proficiency, Wilderness Lore: Salt Marshes",0,0,0,0,0, "Starts with +100 reputation with the villagers of Joppa and a farmer's token"}
}
end
end
function p.nonxmlparse(frame)
local a = string.gsub(frame.args[1],"(&)(%w)([^&\n]*)", function(_,color,text)
        local luatable = {
            ['r'] = "#a64a2e",
            ['R'] = "#d74200",
            ['g'] = "#009403",
            ['G'] = "#00c420",
            ['b'] = "#0048bd",
            ['B'] = "#0096ff",
            ['c'] = "#40a4b9",
            ['C'] = "#77bfcf",
            ['m'] = "#b154cf",
            ['M'] = "#da5bd6",
            ['w'] = "#98875f",
            ['W'] = "#cfc041",
            ['k'] = "#0f3b3a",
            ['K'] = "#155352",
            ['y'] = "#b1c9c3",
            ['Y'] = "#FFFFFF",
            ['o'] = "#f15f22",
            ['O'] = "#e99f10"
        }
        return "<span style=\"color: " .. luatable[color] .. ";\">"  .. text .. "</span>"
    end)
return a
end
function p.parse(frame)
local b = string.gsub(frame.args[1],"([{}])", "")
local b = string.gsub(b,"(~J211)", "")
local a = string.gsub(b,"(&amp;)(%w)(%^?%w?)([^&\n]*)", function(_,color,background,text)
        local luatable = {
            ['r'] = "#a64a2e",
            ['R'] = "#d74200",
            ['g'] = "#009403",
            ['G'] = "#00c420",
            ['b'] = "#0048bd",
            ['B'] = "#0096ff",
            ['c'] = "#40a4b9",
            ['C'] = "#77bfcf",
            ['m'] = "#b154cf",
            ['M'] = "#da5bd6",
            ['w'] = "#98875f",
            ['W'] = "#cfc041",
            ['k'] = "#0f3b3a",
            ['K'] = "#155352",
            ['y'] = "#b1c9c3",
            ['Y'] = "#FFFFFF",
            ['o'] = "#f15f22",
            ['O'] = "#e99f10"
        }
local bgluatable = {
            ["^r"] = "#a64a2e",
            ["^R"] = "#d74200",
            ["^g"] = "#009403",
            ["^G"] = "#00c420",
            ["^b"] = "#0048bd",
            ["^B"] = "#0096ff",
            ["^c"] = "#40a4b9",
            ["^C"] = "#77bfcf",
            ["^m"] = "#b154cf",
            ["^M"] = "#da5bd6",
            ["^w"] = "#98875f",
            ["^W"] = "#cfc041",
            ["^k"] = "#0f3b3a",
            ["^K"] = "#155352",
            ["^y"] = "#b1c9c3",
            ["^Y"] = "#FFFFFF",
            ["^o"] = "#f15f22",
            ["^O"] = "#e99f10",
        }
local c = bgluatable[background]
if (c == nil or c == '')
then
c = "transparent"
end
        return "<span style=\"color: " .. luatable[color] .. "; background: " .. c ..";\">"  .. text .. "</span>"
    end)
return a
end
return p

Navigation menu