#! /usr/bin/perl -w # level # A script for calculating mission levels in Anarchy Online # Originally by David Lawrence , September 2002 # AKA Whatsamatta, Bima, Laslingis, Golly, Goldfarb, Moonstride, Broady, # Scoey ... use Getopt::Std; $0 =~ s%.*/%%; $usage = "Usage: $0 [-c character-level] [-m mission level]\n"; getopts("c:m:") or die $usage; @ARGV == 0 or die $usage; if (defined($opt_c)) { $opt_c >= 1 && $opt_c <= 200 or die qq($0: "$opt_c" needs to be >= 1 and <= 200\n); push(@levels, $opt_c); } else { !defined($opt_m) || ($opt_m >= 1 && $opt_m <= 250) or die qq($0: "$opt_m" needs to be >= 1 and <= 250\n); @levels = (1..200); } foreach $level (@levels) { foreach $i (17.9, 15, 13, 12, 11, 10, 9, 8.5, 8, 7.5, 7) { $ql = int($level/10 * $i); $ql = 1 if $ql < 1; $ql = 250 if $ql > 250; push @qls, $ql; } push @output, [@qls]; @qls = (); } $i = 0; if (! $opt_m) { while (@output) { $qls = shift @output; printf "%3d: ", shift @levels if !$opt_c; while (@$qls) { print " " if @$qls == 6; printf "%3d ", shift @$qls; print " " if @$qls == 5; } print "\n"; print "\n" if ++$i % 5 == 0; } } else { print "Mission level $opt_m can be pulled at levels:\n\t"; while (@output) { $level = shift @levels; $qls = shift @output; while (@$qls) { if (@$qls->[0] == $opt_m) { print "$level "; last; } shift @$qls; } } print "\n"; } exit(0);