View Single Post
  #246  
Unread 01-10-2005, 04:31 PM
tonyis3l33t's Avatar
tonyis3l33t tonyis3l33t is offline
a hedgehog
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Dec 2004
Server: Nagafen
Posts: 854
Default

SoulPl,
can we get the names of the parser/acad program you use?

Sunthas, those look great!


eq2 parser made just for maps :

Code:
#!/usr/local/bin/perl

use warnings;
use strict;

my %damagetype;
my %damagetype_damage;
my %mobs;
my %mobs_damage;
my %attacks;
my %attacks_damage;
my %species_resists;
my %attack_resists;
my %kills;
my $battlestart = 0;
my $battlestop = 0;
my $totalbattlelength = 0;
my $totaldamage = 0;
my $deathblows = 0;
my $numbattles = 0;
my $nowfighting = 0;

if (!($ARGV[0])) { print "usage: perl parser.pl logfile.txt\n"; exit; }

my $logfile = $ARGV[0];
 
open(LOGFILE, "<$logfile") || die "can't open $logfile!!\n";

while (<LOGFILE>) {
	if (m/YOUR (.*?) hits (.*?) for (\d*) points of (.*?) damage./ || m/YOU (hit) (.*?) for (\d*) points of (.*?) damage./) {
		$attacks{$1}++;
		$attacks_damage{$1} += $3;
		$mobs{$2}++;
		$mobs_damage{$2} += $3;
		$damagetype{$4}++;
		$damagetype_damage{$4} += $3;
		if ($nowfighting) {
			$totaldamage += $3;
		}
	} elsif (m/You have killed (.*?).$/) {
		$deathblows++;
		$kills{$1}++;
	} elsif (m/YOU try to (.*?) (.*?) with (.*?), but (.*?) resists./) {
		my $method = $1;
		my $target = $2;
		my $attack = $3;
		$species_resists{$2}++;
		$attack_resists{$3}++;
	} elsif (m/] (.*?) tries to (.*?) YOU with (.*?), but YOU resist./) {
		
	} elsif (m/\((.*?)\)\[(.*?)\] You start fighting./) {
		$nowfighting = 1;
		$numbattles++;
		$battlestart = $1;
	} elsif (/\((.*?)\)\[(.*?)\] You stop fighting./) {
		$nowfighting = 0;
		$battlestop = $1;
		$totalbattlelength += ($battlestop - $battlestart);
	}
}

close LOGFILE;

while ( my ($targets, $hits) = each(%mobs) ) {
	print "You damaged $targets $hits times; total: $mobs_damage{$targets}, avg: ". int($mobs_damage{$targets}/$hits) .".\n";
}

print "\n";
while ( my ($attack, $uses) = each(%attacks) ) {
	print "Your $attack hit $uses times; total: $attacks_damage{$attack}, avg: ".int($attacks_damage{$attack}/$uses).".\n";
}
print "\n";
while ( my ($type, $blasts) = each(%damagetype) ) {
	print "You used $type damage $blasts times; total: $damagetype_damage{$type}, avg: ".int($damagetype_damage{$type}/$blasts).".\n";
}
print"\n";
while (my($killed, $killcount) = each(%kills)) {
	print "You dealt the deathblow $killcount times on $killed.\n";
}
print "$deathblows deathblows total.\n";

if (%species_resists) {  # this stuff will only show up for mages and maybe priests.
	print "\n";
	while (my($species, $resists) = each(%species_resists)) {
		print "$species resisted you $resists times.\n";
	}
}

if (%attack_resists) {
	print "\n";
	while (my($attack, $resists) = each(%attack_resists)) {
		print "your $attack was resisted $resists times.\n";
	}
}

print "\n";
print "you fought in $numbattles battles for a total of $totalbattlelength seconds, \n";
print "dealing $totaldamage damage in that time.\n\n";
print "your average DPS is: ". ($totaldamage / $totalbattlelength) . ".\n";
this is Perl...the website is
http://naikrovek.org/index.php?cat=3
Attached Files
File Type: xml mapper.xml (1.2 KB, 386 views)

Last edited by tonyis3l33t : 01-10-2005 at 04:58 PM.