Module:Sandbox/User:Teamtoto/LuaModule: Difference between revisions

m
no edit summary
mNo edit summary
mNo edit summary
Line 1: Line 1:
local zlib = mw.ext.zlib
local zlib = mw.ext.zlib
local util_table = require('Module:Table Utility')
local utilTable = require('Module:Table Utility')
local data = require('Module:CryptogullJr/Data')
local data = require('Module:CryptogullJr/Data')
local p = {}
local p = {}
Line 23: Line 23:
local version = decoded["gameversion"]
local version = decoded["gameversion"]
local genotype = decoded["modules"][1]["data"]["Genotype"]
local genotype = decoded["modules"][1]["data"]["Genotype"]
local class_called = "Calling: "
local classCalled = "Calling: "
local ext_called = "Mutations: "
local extCalled = "Mutations: "
local subtype = decoded["modules"][2]["data"]["Subtype"]
local subtype = decoded["modules"][2]["data"]["Subtype"]
local base_stat = 10
local baseStat = 10
local stats = nil
local stats = nil
local bonus_int = {}
local bonusInt = {}
local exts = {}
local exts = {}
local bonus = {
local bonus = {
Line 41: Line 41:
if genotype == "True Kin" then
if genotype == "True Kin" then
-- if true kin, stats are [3] and cybernetics are [4]
-- if true kin, stats are [3] and cybernetics are [4]
class_called= "Caste: "
classCalled= "Caste: "
ext_called = "Cybernetics: "
extCalled = "Cybernetics: "
stats = decoded["modules"][3]["data"]["PointsPurchased"]
stats = decoded["modules"][3]["data"]["PointsPurchased"]
-- No cybernetics means extra toughness
-- No cybernetics means extra toughness
Line 58: Line 58:


end
end
for stat_name, stat_value in pairs(stats) do
-- add 10 to stats chosen...
stats[stat_name] = stats[stat_name] + base_stat
for statName, statValue in pairs(stats) do
stats[statName] = stats[statName] + baseStat
end
end
mw.logObject(stats)


for name, num in pairs(bonus_int) do
-- Add stat bonuses from subtype and mutations/cybernetics...
local bonusInt= data.getTotalStatBonuses(subtype, ext)
for name, num in pairs(bonusInt) do
if num > 0 then
if num > 0 then
bonus[name] = "+" .. num
bonus[name] = "+" .. num
Line 90: Line 91:
             ego = attributes["Ego"] .. bonus["Ego"],
             ego = attributes["Ego"] .. bonus["Ego"],
             extname = extnameIn,
             extname = extnameIn,
             exts = util_table.concat(exts, ", ")
             exts = utilTable.concat(exts, ", ")
         }
         }
     }
     }