Module:Sandbox/User:Robert571/Chronicle fragment

From WIDEVERSE Wiki
Revision as of 21:23, 4 November 2021 by Admin (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Documentation for this module may be created at Module:Sandbox/User:Robert571/Chronicle fragment/doc

local yn = require('Module:Yesno')

local p = {}

local guthixXP = {51.6, 52.8, 53.6, 54.8, 55.6, 56.8, 57.6, 58.4, 59.6, 69.6, 71.2, 72.8, 74.4, 76, 77.6, 79.2, 80.8, 82.4, 84, 93.6, 95.6, 97.6, 100, 102, 104, 106, 108, 110.4, 112, 140.4, 144, 147.2, 150.4, 153.6, 156.4, 159.6, 162.8, 165.6, 168.4, 211.2, 216.4, 221.2, 226, 230.8, 235.6, 240, 244.8, 249.2, 253.2, 294.8, 301.6, 308.8, 315.2, 322, 328.4, 334.4, 340.8, 346.4, 352, 401.2, 411.2, 421.2, 430.8, 440, 448.8, 457.6, 466, 474.4, 482, 544.8, 557.6, 569.6, 581.6, 592.8, 603.6, 614, 624, 633.2, 641.6, 695.6, 713.2, 727.2, 738, 745.2, 787.6, 805.2, 819.2, 829.2, 835.6, 891.6, 910.4, 924.8, 934.8, 940, 964, 985.6, 1001.2, 1010.4, 1012.8}
local mayXP = {38.7, 39.6, 40.2, 41.1, 41.7, 42.6, 43.2, 43.8, 44.7, 52.2, 53.4, 54.6, 55.8, 57, 58.2, 59.4, 60.6, 61.8, 63, 70.2, 71.7, 71.7, 75, 76.5, 78, 79.5, 81, 82.8, 84, 105.3, 108, 110.4, 112.8, 115.2, 117.3, 119.7, 122.1, 124.2, 126.3, 158.4, 162.3, 165.9, 169.5, 173.1, 176.7, 180, 183.6, 186.9, 189.9, 221.1, 226.2, 231.6, 236.4, 241.5, 246.3, 250.8, 255.6, 259.8, 264, 300.9, 308.4, 315.9, 323.1, 330, 336.6, 343.2, 349.5, 355.8, 361.5, 408.6, 418.2, 427.2, 436.2, 444.6, 452.7, 460.5, 468, 474.9, 481.2, 521.7, 534.9, 545.4, 553.5, 558.9, 590.7, 603.9, 614.4, 621.9, 626.7, 668.7, 682.8, 693.6, 701.1, 705, 723, 739.2, 750.9, 757.8, 759.6}

function p.main(frame)
	local args = frame:getParent().args
	local level = tonumber(args.level)
	local num = tonumber(args.num)
	local guthix = yn(args.guthix)
	
	local xp = 0

	if guthix then
		xp = num * guthixXP[level]
	else
		xp = num * mayXP[level]
	end
	
	local str = {'Offering ', num, ' chronicles to '}
	if guthix then
		table.insert(str, 'the Shrine of Guthix')
	else
		table.insert(str, 'May Stormbrewer or Eilwynn')
	end
	table.insert(str, string.format(' at level %s Divination grants a total of %s experience.', level, xp))
	
	return table.concat(str, '')
end

return p