Stellarcore.net

Stellarcore.net

Here is a csh version of the script. This one was written by Steve Frostrom just to prove it could be done.

#!/bin/csh -f

clear

if ("$1") then
	set MAXLEVEL = $1
else
	set MAXLEVEL = 40
endif

set fmt = "%5s %9s %11s %11s %9s %9s\n"

printf "$fmt" ''		''		'Class'		'Cross-Class'	''		''
printf "$fmt" 'Char'	''		'Skill'		'Skill'			''		'Stat'
printf "$fmt" 'Level'	'XP'	'Max Ranks'	'Max Ranks'		'Feats'	'Increases'

@ level	= 1
@ xp	= 0
@ feats	= 1
@ stats	= 0

while ($level <= $MAXLEVEL)
	set say_level = $level

		# sum xp
	@ xp+= ($level - 1) * 1000
	set say_xp = 0

		# calc max skill ranks (and print cc with .5)
	@ maxranks = $level + 3
	@ maxcc = $maxranks / 2
	if ($maxranks % 2) set maxcc = "${maxcc}.5"

		# new feat every 3 levels, but start with 1
	if ($level == 1) then
		@ say_feats = 1
	else
		if ($level % 3) then
			@ say_feats = 0
		else
			@ feats++
			set say_feats = $feats
		endif
	endif

		# stat bonus every 4 levels
	if ($level % 4) then
		@ say_stats = 0
	else
		@ stats++
		@ say_stats = $stats
	endif

		# ok, here we have to get nasty
	foreach say (say_level say_feats say_stats)
			# note this doesn't set say, it sets the value of say
			# i.e. say_level, etc...
		switch (`eval echo \$$say`)
		case 0:			# 0
			set $say = "--"
			breaksw
		case *0:		# *0th, *4-9th, 11-13th
		case *[4-9]:
		case 1?:
			set $say = `eval echo \$$say`th
			breaksw
		case *1:		# 1st
			set $say = `eval echo \$$say`st
			breaksw
		case *2:		# 2nd
			set $say = `eval echo \$$say`nd
			breaksw
		case *3:		# 3rd
			set $say = `eval echo \$$say`rd
			breaksw
		endsw
	end

		# print the line
	printf "$fmt" $say_level $say_xp $maxranks $maxcc $say_feats $say_stats

	@ level++
end

# vi: ts=4 sw=4