|
|
第1行: |
第1行: |
| local getArgs = require('Module:Arguments').getArgs
| |
| local p = {}
| |
|
| |
|
| function generateAwakenTable(step,frag,over)
| |
| local fragStrA,stepStrA,overStrA="","",""
| |
| local fragStrB,stepStrB,overStrB="","",""
| |
|
| |
| for i=1,15 do
| |
| if i==1 then
| |
| fragStrA=fragStrA.."|"..string.format("%0.0f",frag[i])
| |
| stepStrA=stepStrA.."|"..string.format("%0.0f",step[i])
| |
| overStrA=overStrA.."|"..string.format("%0.0f",over[i])
| |
| else
| |
| fragStrA=fragStrA.."||"..string.format("%0.0f",frag[i])
| |
| stepStrA=stepStrA.."||"..string.format("%0.0f",step[i])
| |
| overStrA=overStrA.."||"..string.format("%0.0f",over[i])
| |
| end
| |
| end
| |
|
| |
| for i=16,30 do
| |
| if i==1 then
| |
| fragStrB=fragStrB.."|"..string.format("%0.0f",frag[i])
| |
| stepStrB=stepStrB.."|"..string.format("%0.0f",step[i])
| |
| overStrB=overStrB.."|"..string.format("%0.0f",over[i])
| |
| else
| |
| fragStrB=fragStrB.."||"..string.format("%0.0f",frag[i])
| |
| stepStrB=stepStrB.."||"..string.format("%0.0f",step[i])
| |
| overStrB=overStrB.."||"..string.format("%0.0f",over[i])
| |
| end
| |
| end
| |
|
| |
| local body = {
| |
| '{| class="wikitable" border="1" cellspacing="1" cellpadding="5" style="text-align:center"'
| |
| }
| |
|
| |
| table.insert(
| |
| body,
| |
| table.concat(
| |
| {
| |
| '!属性',
| |
| '!1!!2!!3!!4!!5!!6!!7!!8!!9!!10!!11!!12!!13!!14!!15',
| |
| '|-',
| |
| '!Frag',
| |
| fragStrA,
| |
| '|-',
| |
| '!Step',
| |
| stepStrA,
| |
| '|-',
| |
| '!Over',
| |
| overStrA,
| |
| '|-',
| |
| '!属性',
| |
| '!16!!17!!18!!19!!20!!21!!22!!23!!24!!25!!26!!27!!28!!29!!30',
| |
| '|-',
| |
| '!Frag',
| |
| fragStrB,
| |
| '|-',
| |
| '!Step',
| |
| stepStrB,
| |
| '|-',
| |
| '!Over',
| |
| overStrB
| |
| },
| |
| '\n'
| |
| )
| |
| )
| |
|
| |
| table.insert(body, '|}')
| |
|
| |
| return table.concat(body, '\n')
| |
| end
| |
|
| |
| function generateNormalTable(step,frag,over)
| |
| local fragStr,stepStr,overStr="","",""
| |
|
| |
| for i=1,20 do
| |
| if i==1 then
| |
| fragStr=fragStr.."|"..string.format("%0.0f",frag[i])
| |
| stepStr=stepStr.."|"..string.format("%0.0f",step[i])
| |
| overStr=overStr.."|"..string.format("%0.0f",over[i])
| |
| else
| |
| fragStr=fragStr.."||"..string.format("%0.0f",frag[i])
| |
| stepStr=stepStr.."||"..string.format("%0.0f",step[i])
| |
| overStr=overStr.."||"..string.format("%0.0f",over[i])
| |
| end
| |
| end
| |
|
| |
| local body = {
| |
| '{| class="wikitable" border="1" cellspacing="1" cellpadding="5" style="text-align:center"'
| |
| }
| |
|
| |
| table.insert(
| |
| body,
| |
| table.concat(
| |
| {
| |
| '!属性',
| |
| '!1!!2!!3!!4!!5!!6!!7!!8!!9!!10!!11!!12!!13!!14!!15!!16!!17!!18!!19!!20',
| |
| '|-',
| |
| '!Frag',
| |
| fragStr,
| |
| '|-',
| |
| '!Step',
| |
| stepStr,
| |
| '|-',
| |
| '!Over',
| |
| overStr
| |
| },
| |
| '\n'
| |
| )
| |
| )
| |
|
| |
| table.insert(body, '|}')
| |
|
| |
| return table.concat(body, '\n')
| |
| end
| |
|
| |
| function calculationt(level1,level2,value1,value2,awaken)
| |
| local awaken=true
| |
| local list={
| |
| [1] = 0,
| |
| [2] = 1,
| |
| [3] = 8,
| |
| [4] = 27,
| |
| [5] = 64,
| |
| [6] = 125,
| |
| [7] = 216,
| |
| [8] = 343,
| |
| [9] = 512,
| |
| [10] = 729,
| |
| [11] = 985.75,
| |
| [12] = 1202.75,
| |
| [13] = 1371.75,
| |
| [14] = 1498.75,
| |
| [15] = 1589.75,
| |
| [16] = 1650.75,
| |
| [17] = 1687.75,
| |
| [18] = 1706.75,
| |
| [19] = 1713.75,
| |
| [20] = 1714.75,
| |
| }
| |
|
| |
| local s1=list[level1]
| |
| local s2=list[level2]
| |
| local s3=(value2-value1)/(s2-s1)
| |
| local s4=value1-s1*s3
| |
| local result={}
| |
| local long=20
| |
| if awaken then long=30 end
| |
| for i=1,long do
| |
| if i<=20
| |
| then
| |
| result[i]=s4+s3*list[i]
| |
| else
| |
| result[i]=result[20]+i-20
| |
| end
| |
| end
| |
| return result
| |
|
| |
| end
| |
|
| |
| function p.main(frame)
| |
| local args = getArgs(frame)
| |
|
| |
| local awaken=false
| |
| if args.awaken then awaken=true end
| |
|
| |
| local step=calculationt(tonumber(args["stepLevel1"]),tonumber(args["stepLevel2"]),args["stepValue1"],args["stepValue2"],awaken)
| |
| local frag=calculationt(tonumber(args["fragLevel1"]),tonumber(args["fragLevel2"]),args["fragValue1"],args["fragValue2"],awaken)
| |
| local over=calculationt(tonumber(args["overLevel1"]),tonumber(args["overLevel2"]),args["overValue1"],args["overValue2"],awaken)
| |
|
| |
| if awaken then return generateAwakenTable(step,frag,over) else return generateNormalTable(step,frag,over) end
| |
|
| |
| end
| |
|
| |
| return p
| |