User Tools

Site Tools


user:mhoram:scripts:level_up

Introduction

This is a client-side perl script for Crossfire, which reports which skills are nearing the next level. It reports any (including overall player level) that are within 10% of the next level, and that percentage can be changed in the code on line 6. I thought this would be handy for determining which skills to concentrate on for fastest improvement.

Requirements

  • Perl

Code

#!/usr/bin/perl
use warnings;
use strict;
$| = 1;
 
my $percent = 10;  # percentage of points needed to level up
 
print "request stat xp\n";
my @stats;
my $line = <STDIN>;
chomp $line;
@stats = split ' ', $line;
shift @stats for (1..3);
print STDERR join ' ', @stats, "\n";
 
my @xp_for = ( 0,0,2000,4000, 8000, 16000,32000,64000,125000,250000, 500000,
	       900000,1400000,2000000,2600000,
	       3300000,4100000,4900000,5700000,6600000, 7500000,
	       8500000,  9500000, 10600000, 11800000, 13000000,
	       14300000, 15600000, 17000000, 18500000, 20000000,
	       21700000, 23400000, 25200000, 27000000, 29000000,
	       31100000, 33300000, 35600000, 38000000, 40500000,
	       43200000, 46000000, 48900000, 52000000, 55200000,
	       58600000, 62100000, 65900000, 69800000, 73900000,
	       78200000, 82700000, 87500000, 92500000, 97800000,
	       103300000, 109100000, 115200000, 121500000, 128200000,
	       135300000, 142700000, 150400000, 158600000, 167100000,
	       176100000, 185600000, 195500000, 205900000, 216800000,
	       228300000, 240300000, 252900000, 266200000, 280200000,
	       294800000, 310200000, 326300000, 343200000, 361000000,
	       379700000, 399300000, 419900000, 441500000, 464200000,
	       488100000, 513100000, 539400000, 567000000, 596000000,
	       626400000, 658300000, 691900000, 727100000, 764100000,
	       802900000, 843700000, 886500000, 931500000, 978700000,
	       1028200000, 1080300000, 1134900000, 1192300000, 1252500000,
	       1315800000, 1382200000, 1451900000, 1525100000, 2100000000,
	       4200000000, 8400000000, 16800000000,
	       33600000000, 67200000000,
	     );
 
my @skills = qw(
		overall
		null
		lockpicking
		hide
		smithery
		bowyer
		jeweler
		alchemist
		stealing
		literacy
		bargaining
		jumping
		sense_magic
		oratory
		singing
		sense_curse
		find_traps
		meditation
		punching
		flame_touch
		karate
		climbing
		woodsman
		inscription
		one_handed_weapons
		missile_weap
		throwing
		use_magic_item
		disarm_traps
		set_trap
		thaumaturgy
		praying
		clawing
		levitation
		summoning
		pyromancy
		evocation
		sorcery
		two_handed_weapons
	       );
 
print "draw 4 Skills within $percent\% of leveling up:\n";
for my $skill (@skills){
  my $level = shift @stats;
  my $xp    = shift @stats;
  next if $xp == 0;
  $level++;
  my $needed = $xp_for[$level] - $xp;
  print STDERR "$skill : $level : $xp : $needed\n";
  if( $needed < ( $xp_for[$level] * $percent/100 )){
    print "draw 5 $skill: $needed for level $level\n";
  }
}

Notes & Comments

I've hardcoded the XP tables and skill list as it exists as of 2006-12-28, so future changes in the XP table or rearranging the order of the skills reported by the client will break it. It's not possible (as far as I know) for a client-side script to get those thing from the server, so the only choices are to hard-code them, or to build them dynamically from the source code, which many people may not have.


Possibility: The script could issue the skills command, watch all the subsequent drawinfo and then distill and highlight useful information there.

References

user/mhoram/scripts/level_up.txt · Last modified: 2007/06/19 11:07 (external edit)