Module:Stat Factors Table
This module is meant to be used by Template:Stat Factors Table Row, which in turn is meant to be used alogside Template:Stat Factors Table.
This module returns the rows used in said table. It accept 8 inputs: skillBase, skillBonus, statMin, statMax, capImportance, capLimit, resultCols, LV, Ln
Any value not given is assumed 0. There are exceptions for the default values of Stat Maximum (99999999) and statMin (0), both of which are defined on Template:Stat Factors Table.
This can probably be further improved. Regardless, this represents a 71% improvement over the ParserFunctions method.
Examples:
{{Stat Factors Table}}
on the Butchery Efficiency page would produce:
Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Cooking Skill Level | Butchery Efficiency | ||
---|---|---|---|
100% Manipulation | 125% Manipulation | 150% Manipulation |
{{Stat Factors Table|Foraged Food Amount}}
on any page would produce:
Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Plants Skill Level | Foraged Food Amount | ||
---|---|---|---|
100% Sight | 125% Sight | 150% Sight |
Example when limit is 100%:
{{Stat Factors Table|Arrest Success Chance}}
it produces:
Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Social Skill Level | Arrest Success Chance |
---|
Example when limit is >100% but <125%: Note: Research Speed is not an appropriate use of the template, as it relies equally on two different capacities, however, at the time of writing no compatible example of an inter-column limit exists:
{{Stat Factors Table|Research Speed }}
on any page would produce:
Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Intellectual Skill Level | Research Speed | |
---|---|---|
100% Manipulation | 110%+ Manipulation |
Example when skills have to be specifically defined:
{{Stat Factors Table|Plant Harvest Yield|l0=0.60|l1=0.70|l2=0.75|l3=0.80|l4=0.85|l5=0.90|l6=0.95|l7=0.98|l8=1.00|l9=1.01|l10=1.02|l11=1.03|l12=1.04|l13=1.05|l14=1.06|l15=1.07|l16=1.08|l17=1.09|l18=1.10|l19=1.12|l20=1.13}}
it produces:
Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Plants Skill Level | Plant Harvest Yield | ||
---|---|---|---|
100% Manipulation | 125% Manipulation | 150% Manipulation |
Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.Script error: The module returned a nil value. It is supposed to return an export table.
Medical Skill Level | Medical Surgery Success Chance | ||
---|---|---|---|
100% Manipulation | 125% Manipulation | 150% Manipulation |
local getArgs = require('Module:Arguments').getArgs local p = {} --local wrap = {} -- Holds wrapper functions that process arguments from #invoke. These act as intemediary between functions meant for #invoke and functions meant for Lua. --Stat Factors Table Row function p.TableRow(argumento) local args = getArgs(argumento) return p._TableRow(args) end function p._TableRow(skillBase, skillBonus, statMin, statMax, capImportance, capLimit, resultCols, LV, Ln) argumentos={skillBase,skillBonus,statMin,statMax,capImportance,capLimit,resultCols,LV,Ln} for i = 1,8 do --This should prevent errors if a number is not defined. if type(argumentos[i])~='number' then argumentos[i]=0 end end -- Do note that statMin, statMax are handled by "Template:Stat Factors Table". -- While I could set fallbacks, I decided against it. if tonumber(Ln)==nil then --Sanitizes input and allows for 0. factor = skillBase + skillBonus * LV else factor = Ln end local Pval = math.min(math.max(factor,statMin),statMax) R_Pval = tostring(math.floor(Pval*10000+0.5)/100).."%" -- This formats the number as a 2 digit percent value, rounded up. if tonumber(resultCols)>1 then Pval = factor * ( 1 + capImportance * math.min(capLimit-1, 0.25)) Pval = math.min(math.max(Pval,statMin),statMax) R_Sval="<td>"..tostring(math.floor(Pval*10000+0.5)/100).."% </td>" else R_Sval="" end if tonumber(resultCols)>2 then Pval = factor * ( 1 + capImportance * math.min(capLimit-1, 0.5)) Pval = math.min(math.max(Pval,statMin),statMax) R_Tval="<td>"..tostring(math.floor(Pval*10000+0.5)/100).."% </td>" else R_Tval="" end return "|-\r\n!"..LV.."\r\n|"..R_Pval..R_Sval..R_Tval end -- END OF MODULE