Difference between revisions of "Module:RankTable"

From Tokyo Afterschool Summoners
Jump to navigation Jump to search
m (fixed rank 60 having wrong values, added 61 to 65)
(fixed ranks 90 to 100, added ranks 101 to 110)
 
(11 intermediate revisions by the same user not shown)
Line 62: Line 62:
[56] = { [s]=69, [t]=59, [f]=24, [e]=19500 },
[56] = { [s]=69, [t]=59, [f]=24, [e]=19500 },
[57] = { [s]=70, [t]=59, [f]=24, [e]=22500 },
[57] = { [s]=70, [t]=59, [f]=24, [e]=22500 },
[58] = { [s]=71, [t]=59, [f]=25, [e]=22500 },
[58] = { [s]=71, [t]=59, [f]=25, [e]=25500 },
[59] = { [s]=72, [t]=60, [f]=25, [e]=30500 },
[59] = { [s]=72, [t]=60, [f]=25, [e]=30500 },
[60] = { [s]=73, [t]=60, [f]=26, [e]=36000 },
[60] = { [s]=73, [t]=60, [f]=26, [e]=36000 },
Line 69: Line 69:
[63] = { [s]=76, [t]=62, [f]=27, [e]=54500 },
[63] = { [s]=76, [t]=62, [f]=27, [e]=54500 },
[64] = { [s]=77, [t]=62, [f]=28, [e]=61000 },
[64] = { [s]=77, [t]=62, [f]=28, [e]=61000 },
[65] = { [s]=78, [t]=63, [f]=28, [e]=67500 },
[65] = { [s]=78, [t]=62, [f]=28, [e]=67500 },
[66] = { [s]=79, [t]=63, [f]=29, [e]=74000 },
[66] = { [s]=79, [t]=63, [f]=29, [e]=74000 },
[67] = { [s]=80, [t]=63, [f]=29, [e]=81000 },
[68] = { [s]=81, [t]=63, [f]=30, [e]=88000 },
[69] = { [s]=82, [t]=64, [f]=30, [e]=95000 },
[70] = { [s]=83, [t]=64, [f]=31, [e]=102000},
[71] = { [s]=84, [t]=65, [f]=31, [e]=109000},
[72] = { [s]=85, [t]=65, [f]=32, [e]=116000},
[73] = { [s]=86, [t]=66, [f]=32, [e]=123000},
[74] = { [s]=87, [t]=66, [f]=33, [e]=130000},
[75] = { [s]=88, [t]=66, [f]=33, [e]=137000},
[76] = { [s]=89, [t]=67, [f]=34, [e]=144000},
[77] = { [s]=90, [t]=67, [f]=34, [e]=151000},
[78] = { [s]=91, [t]=67, [f]=35, [e]=158000},
[79] = { [s]=92, [t]=68, [f]=35, [e]=167000},
[80] = { [s]=93, [t]=68, [f]=36, [e]=172000},
[81] = { [s]=94, [t]=68, [f]=36, [e]=180000},
[82] = { [s]=95, [t]=69, [f]=36, [e]=188000},
[83] = { [s]=96, [t]=69, [f]=36, [e]=196000},
[84] = { [s]=97, [t]=69, [f]=37, [e]=204000},
[85] = { [s]=98, [t]=70, [f]=37, [e]=212000},
[86] = { [s]=99, [t]=70, [f]=37, [e]=220000},
[87] = { [s]=100, [t]=70, [f]=37, [e]=230000},
[88] = { [s]=101, [t]=71, [f]=38, [e]=240000},
[89] = { [s]=102, [t]=71, [f]=38, [e]=250000},
[90] = { [s]=103, [t]=71, [f]=38, [e]=260000},
[91] = { [s]=104, [t]=72, [f]=38, [e]=275000},
[92] = { [s]=105, [t]=72, [f]=39, [e]=290000},
[93] = { [s]=106, [t]=72, [f]=39, [e]=305000},
[94] = { [s]=107, [t]=73, [f]=39, [e]=320000},
[95] = { [s]=108, [t]=73, [f]=39, [e]=335000},
[96] = { [s]=109, [t]=73, [f]=40, [e]=350000},
[97] = { [s]=110, [t]=74, [f]=40, [e]=365000},
[98] = { [s]=111, [t]=74, [f]=40, [e]=380000},
[99] = { [s]=112, [t]=74, [f]=40, [e]=400000},
[100] = { [s]=113, [t]=75, [f]=40, [e]=420000},
[101] = { [s]=114, [t]=75, [f]=41, [e]=450000},
[102] = { [s]=115, [t]=75, [f]=41, [e]=480000},
[103] = { [s]=116, [t]=75, [f]=41, [e]=510000},
[104] = { [s]=117, [t]=76, [f]=41, [e]=540000},
[105] = { [s]=118, [t]=76, [f]=41, [e]=570000},
[106] = { [s]=119, [t]=76, [f]=42, [e]=600000},
[107] = { [s]=120, [t]=76, [f]=42, [e]=640000},
[108] = { [s]=121, [t]=77, [f]=42, [e]=680000},
[109] = { [s]=122, [t]=77, [f]=42, [e]=720000},
[110] = { [s]=123, [t]=77, [f]=42, [e]=9999999},
}
}


local function formatInteger( number )
if number == "-" then return number end
local i, j, minus, int, fraction = tostring( number ):find( '([-]?)(%d+)([.]?%d*)' )
int = int:reverse():gsub( "(%d%d%d)", "%1," )
return minus .. int:reverse():gsub("^,", "") .. fraction
end
local function CheckEqualValues( tocheck, tosend )
local function CheckEqualValues( tocheck, tosend )
if tocheck and ( tocheck == tosend ) then
if tocheck and ( tocheck == tosend ) then
Line 78: Line 131:
end
end


return "<b>".. tosend .."</b>"
return tosend
end
end


Line 84: Line 137:
local wiki_table =
local wiki_table =
[[
[[
{| class="wikitable" style="width: 80%;"
{| class="wikitable" style="width: 80%; text-align: center;"
! style="text-align: center;" | Rank
! Rank
! style="text-align: center;" | Stamina
! Stamina
! style="text-align: center;" | Team Cost
! Team Cost
! style="text-align: center;" | Friend Limit
! Friend Limit
! style="text-align: center;" | EXP Required<br>for Rank Up
! EXP Required<br>for Rank Up
! style="text-align: center;" | EXP in Total<br>from Rank Up
! EXP in Total<br>from Rank Up
]]
]]
local exptotal = 0
local exptotal = 0
Line 96: Line 149:


for rank, tbl in ipairs( p.RankData ) do
for rank, tbl in ipairs( p.RankData ) do
local pxdevn = #p.RankData - 30
local pxmath = math.floor(math.max( 14, (rank - pxdevn) / (#p.RankData - pxdevn) * 26 ))
wiki_table = wiki_table ..
wiki_table = wiki_table ..
[[
[[
|-
|- style="font-size: ]].. pxmath ..[[px;" |
| ]] .. rank .. [[  
| <b>]] .. rank .. [[</b>
| ]] .. CheckEqualValues( preval[s], tbl[s] ) .. [[  
| style="text-align: left;" | ]] .. CheckEqualValues( preval[s], tbl[s] ) .. [[  
| ]] .. CheckEqualValues( preval[t], tbl[t] ) .. [[  
| style="text-align: left;" | ]] .. CheckEqualValues( preval[t], tbl[t] ) .. [[  
| ]] .. CheckEqualValues( preval[f], tbl[f] ) .. [[  
| style="text-align: left;" | ]] .. CheckEqualValues( preval[f], tbl[f] ) .. [[  
| ]] .. CheckEqualValues( preval[e], tbl[e] ) .. [[  
| style="text-align: left;" | ]] .. formatInteger(CheckEqualValues( preval[e], tbl[e] )) .. [[  
| ]] .. exptotal .. [[  
| style="text-align: left;" | ]] .. formatInteger( exptotal ) .. [[  
]]
]]


Line 111: Line 167:
end
end


return wiki_table .. '|}' --inspect( p.RankData )
wiki_table = wiki_table ..
[[
|- style="font-size: 26px;" |
| colspan="5" | Current EXP Total sum of all Ranks
| ]] .. formatInteger(exptotal) .. [[
]]
 
return wiki_table .. "\n\t\t" .. '|}' --inspect( p.RankData )
end
end


return p
return p

Latest revision as of 16:15, 18 September 2018

RankTable.lua

This module is for the only usage in https://wiki.housamo.xyz/Rank_Table.

Functions

Functions that RankTable.lua uses.

module.AddRankData

Argument Name Description Argument Default
level Rank level to add data to. N/A
team Team Cost that Rank will have. N/A
friend Friend Limit that Rank will have. From previously added data.
expreq Exp Requirement that Rank will require. N/A
stamdelt Delta of Stamina that Rank will receive. 1

module.AddRankExp

Argument Name Description Argument Default
level Rank level to add data to. N/A
expreq Exp Requirement that Rank will require. N/A
teamdelt Delta of Team Cost that Rank will receive. 0
stamdelt Delta of Stamina that Rank will receive. 1

module.AddRankExpLoop

Argument Name Description Argument Default
levelstart Rank level that will start for loop. N/A
expreqs LUA Table of all Exp Requirements the Ranks will require each. N/A
teamgap Gap from the team cost adding. Only deltas of 1. N/A

module.RankDataReturn

Returns a parsable wikitable format.

Editing the data

In order to add more rank data, you have to edit it from Module:RankTable.

Invoking the module and their functions will not do anything.


--local inspect = require( 'Module:Inspect' )

local p = {}
local s, t, f, e = 'stamina', 'teamcost', 'friendlimit', 'expreq'

p.RankData = {
	[1] = { [s]=15, [t]=36, [f]=10, [e]=3 },
	[2] = { [s]=15, [t]=37, [f]=11, [e]=5 },
	[3] = { [s]=16, [t]=38, [f]=12, [e]=6 },
	[4] = { [s]=17, [t]=39, [f]=13, [e]=12 },
	[5] = { [s]=18, [t]=40, [f]=14, [e]=20 },
	[6] = { [s]=19, [t]=41, [f]=15, [e]=25 },
	[7] = { [s]=20, [t]=42, [f]=16, [e]=30 },
	[8] = { [s]=21, [t]=43, [f]=17, [e]=45 },
	[9] = { [s]=22, [t]=44, [f]=18, [e]=54 },
	[10] = { [s]=23, [t]=45, [f]=19, [e]=70 },
	[11] = { [s]=24, [t]=45, [f]=20, [e]=90 },
	[12] = { [s]=25, [t]=46, [f]=20, [e]=110 },
	[13] = { [s]=26, [t]=46, [f]=20, [e]=130 },
	[14] = { [s]=27, [t]=47, [f]=20, [e]=150 },
	[15] = { [s]=28, [t]=47, [f]=20, [e]=170 },
	[16] = { [s]=29, [t]=48, [f]=20, [e]=190 },
	[17] = { [s]=30, [t]=48, [f]=20, [e]=210 },
	[18] = { [s]=31, [t]=49, [f]=20, [e]=230 },
	[19] = { [s]=32, [t]=49, [f]=20, [e]=250 },
	[20] = { [s]=33, [t]=50, [f]=20, [e]=280 },
	[21] = { [s]=34, [t]=50, [f]=20, [e]=320 },
	[22] = { [s]=35, [t]=50, [f]=20, [e]=360 },
	[23] = { [s]=36, [t]=51, [f]=20, [e]=410 },
	[24] = { [s]=37, [t]=51, [f]=20, [e]=460 },
	[25] = { [s]=38, [t]=51, [f]=20, [e]=520 },
	[26] = { [s]=39, [t]=52, [f]=20, [e]=580 },
	[27] = { [s]=40, [t]=52, [f]=20, [e]=640 },
	[28] = { [s]=41, [t]=52, [f]=20, [e]=700 },
	[29] = { [s]=42, [t]=52, [f]=20, [e]=760 },
	[30] = { [s]=43, [t]=52, [f]=20, [e]=820 },
	[31] = { [s]=44, [t]=53, [f]=20, [e]=880 },
	[32] = { [s]=45, [t]=53, [f]=20, [e]=940 },
	[33] = { [s]=46, [t]=53, [f]=20, [e]=1000 },
	[34] = { [s]=47, [t]=53, [f]=20, [e]=1060 },
	[35] = { [s]=48, [t]=53, [f]=20, [e]=1120 },
	[36] = { [s]=49, [t]=54, [f]=20, [e]=1180 },
	[37] = { [s]=50, [t]=54, [f]=20, [e]=1240 },
	[38] = { [s]=51, [t]=54, [f]=20, [e]=1300 },
	[39] = { [s]=52, [t]=54, [f]=20, [e]=1420 },
	[40] = { [s]=53, [t]=54, [f]=20, [e]=1540 },
	[41] = { [s]=54, [t]=55, [f]=20, [e]=1660 },
	[42] = { [s]=55, [t]=55, [f]=20, [e]=1780 },
	[43] = { [s]=56, [t]=55, [f]=20, [e]=1900 },
	[44] = { [s]=57, [t]=55, [f]=20, [e]=2050 },
	[45] = { [s]=58, [t]=55, [f]=20, [e]=2280 },
	[46] = { [s]=59, [t]=56, [f]=20, [e]=2500 },
	[47] = { [s]=60, [t]=56, [f]=20, [e]=3000 },
	[48] = { [s]=61, [t]=56, [f]=20, [e]=4000 },
	[49] = { [s]=62, [t]=56, [f]=20, [e]=5500 },
	[50] = { [s]=63, [t]=56, [f]=20, [e]=7000 },
	[51] = { [s]=64, [t]=57, [f]=21, [e]=8500 },
	[52] = { [s]=65, [t]=57, [f]=22, [e]=10000 },
	[53] = { [s]=66, [t]=58, [f]=22, [e]=12000 },
	[54] = { [s]=67, [t]=58, [f]=23, [e]=14000 },
	[55] = { [s]=68, [t]=58, [f]=23, [e]=16500 },
	[56] = { [s]=69, [t]=59, [f]=24, [e]=19500 },
	[57] = { [s]=70, [t]=59, [f]=24, [e]=22500 },
	[58] = { [s]=71, [t]=59, [f]=25, [e]=25500 },
	[59] = { [s]=72, [t]=60, [f]=25, [e]=30500 },
	[60] = { [s]=73, [t]=60, [f]=26, [e]=36000 },
	[61] = { [s]=74, [t]=61, [f]=26, [e]=42000 },
	[62] = { [s]=75, [t]=61, [f]=27, [e]=48000 },
	[63] = { [s]=76, [t]=62, [f]=27, [e]=54500 },
	[64] = { [s]=77, [t]=62, [f]=28, [e]=61000 },
	[65] = { [s]=78, [t]=62, [f]=28, [e]=67500 },
	[66] = { [s]=79, [t]=63, [f]=29, [e]=74000 },
	[67] = { [s]=80, [t]=63, [f]=29, [e]=81000 },
	[68] = { [s]=81, [t]=63, [f]=30, [e]=88000 },
	[69] = { [s]=82, [t]=64, [f]=30, [e]=95000 },
	[70] = { [s]=83, [t]=64, [f]=31, [e]=102000},
	[71] = { [s]=84, [t]=65, [f]=31, [e]=109000},
	[72] = { [s]=85, [t]=65, [f]=32, [e]=116000},
	[73] = { [s]=86, [t]=66, [f]=32, [e]=123000},
	[74] = { [s]=87, [t]=66, [f]=33, [e]=130000},
	[75] = { [s]=88, [t]=66, [f]=33, [e]=137000},
	[76] = { [s]=89, [t]=67, [f]=34, [e]=144000},
	[77] = { [s]=90, [t]=67, [f]=34, [e]=151000},
	[78] = { [s]=91, [t]=67, [f]=35, [e]=158000},
	[79] = { [s]=92, [t]=68, [f]=35, [e]=167000},
	[80] = { [s]=93, [t]=68, [f]=36, [e]=172000},
	[81] = { [s]=94, [t]=68, [f]=36, [e]=180000},
	[82] = { [s]=95, [t]=69, [f]=36, [e]=188000},
	[83] = { [s]=96, [t]=69, [f]=36, [e]=196000},
	[84] = { [s]=97, [t]=69, [f]=37, [e]=204000},
	[85] = { [s]=98, [t]=70, [f]=37, [e]=212000},
	[86] = { [s]=99, [t]=70, [f]=37, [e]=220000},
	[87] = { [s]=100, [t]=70, [f]=37, [e]=230000},
	[88] = { [s]=101, [t]=71, [f]=38, [e]=240000},
	[89] = { [s]=102, [t]=71, [f]=38, [e]=250000},
	[90] = { [s]=103, [t]=71, [f]=38, [e]=260000},
	[91] = { [s]=104, [t]=72, [f]=38, [e]=275000},
	[92] = { [s]=105, [t]=72, [f]=39, [e]=290000},
	[93] = { [s]=106, [t]=72, [f]=39, [e]=305000},
	[94] = { [s]=107, [t]=73, [f]=39, [e]=320000},
	[95] = { [s]=108, [t]=73, [f]=39, [e]=335000},
	[96] = { [s]=109, [t]=73, [f]=40, [e]=350000},
	[97] = { [s]=110, [t]=74, [f]=40, [e]=365000},
	[98] = { [s]=111, [t]=74, [f]=40, [e]=380000},
	[99] = { [s]=112, [t]=74, [f]=40, [e]=400000},
	[100] = { [s]=113, [t]=75, [f]=40, [e]=420000},
	[101] = { [s]=114, [t]=75, [f]=41, [e]=450000},
	[102] = { [s]=115, [t]=75, [f]=41, [e]=480000},
	[103] = { [s]=116, [t]=75, [f]=41, [e]=510000},
	[104] = { [s]=117, [t]=76, [f]=41, [e]=540000},
	[105] = { [s]=118, [t]=76, [f]=41, [e]=570000},
	[106] = { [s]=119, [t]=76, [f]=42, [e]=600000},
	[107] = { [s]=120, [t]=76, [f]=42, [e]=640000},
	[108] = { [s]=121, [t]=77, [f]=42, [e]=680000},
	[109] = { [s]=122, [t]=77, [f]=42, [e]=720000},
	[110] = { [s]=123, [t]=77, [f]=42, [e]=9999999},
}


local function formatInteger( number )
	if number == "-" then return number end

	local i, j, minus, int, fraction = tostring( number ):find( '([-]?)(%d+)([.]?%d*)' )
	int = int:reverse():gsub( "(%d%d%d)", "%1," )

	return minus .. int:reverse():gsub("^,", "") .. fraction
end
local function CheckEqualValues( tocheck, tosend )
	if tocheck and ( tocheck == tosend ) then
		return "-"
	end

	return tosend
end

function p.RankDataReturn( frame )
	local wiki_table =
		[[
		{| class="wikitable" style="width: 80%; text-align: center;"
		! Rank
		! Stamina
		! Team Cost
		! Friend Limit
		! EXP Required<br>for Rank Up
		! EXP in Total<br>from Rank Up
		]]
	local exptotal = 0
	local preval = { [s]=1, [t]=1, [f]=1, [e]=1 }

	for rank, tbl in ipairs( p.RankData ) do
		local pxdevn = #p.RankData - 30
		local pxmath = math.floor(math.max( 14, (rank - pxdevn) / (#p.RankData - pxdevn) * 26 ))

		wiki_table = wiki_table ..
		[[
		|- style="font-size: ]].. pxmath ..[[px;" |
		| <b>]] .. rank .. [[</b> 
		| style="text-align: left;" | ]] .. CheckEqualValues( preval[s], tbl[s] ) .. [[ 
		| style="text-align: left;" | ]] .. CheckEqualValues( preval[t], tbl[t] ) .. [[ 
		| style="text-align: left;" | ]] .. CheckEqualValues( preval[f], tbl[f] ) .. [[ 
		| style="text-align: left;" | ]] .. formatInteger(CheckEqualValues( preval[e], tbl[e] )) .. [[ 
		| style="text-align: left;" | ]] .. formatInteger( exptotal ) .. [[ 
		]]

		preval = tbl
		exptotal = exptotal + tbl[e]
	end

	wiki_table = wiki_table ..
		[[
		|- style="font-size: 26px;" |
		| colspan="5" | Current EXP Total sum of all Ranks
		| ]] .. formatInteger(exptotal) .. [[
		]]

	return wiki_table .. "\n\t\t" .. '|}' --inspect( p.RankData )
end

return p