Autopsy plugin integration.

Wrote new code? Fixed a bug? Want to discuss technical stuff? Feel free to post it here.

Moderator: Moderators

Kissa2k
Human
Human
Posts: 46
Joined: 27 Apr 2008, 12:52
Noob?: No
Location: Russia

Autopsy plugin integration.

#1 Post by Kissa2k »

Autopsy integration into openkore.

Code: Select all

Index: src/Log.pm
===================================================================
--- src/Log.pm	(revision 6344)
+++ src/Log.pm	(working copy)
@@ -112,9 +112,9 @@
 use base qw(Exporter);
 
 use Modules 'register';
-use Globals qw(%config $interface %consoleColors %field %cities_lut);
+use Globals qw(%config $interface %consoleColors %field %cities_lut %maps_lut $char);
 use Utils::DataStructures qw(binAdd existsInList);
-use Utils qw(binAdd existsInList getFormattedDate);
+use Utils qw(binAdd existsInList getFormattedDate calcPosition);
 
 our @EXPORT_OK = qw(message warning error debug);
 
@@ -131,6 +131,7 @@
 # If you set the current verbosity higher, you will see more messages.
 our $warningVerbosity;
 our $errorVerbosity;
+our @messages=();
 
 # Enable/disable printing certain domains to console.
 # Usage: $messageConsole{$domain} = $enabled
@@ -237,6 +238,36 @@
 			}
 		}
 	}
+	
+		if($config{logDeath}) {
+		if ($level <= $currentVerbosity) {
+			my (undef, $microseconds) = Time::HiRes::gettimeofday;
+			$microseconds = substr($microseconds, 0, 2);
+			my $message2 = "[".getFormattedDate(int(time)).".$microseconds] ".$message;
+			my $logfile;
+		    push(@messages, $message2);
+		    if ($#messages == $config{'logDeathSize'} + 1) {
+				shift(@messages);
+			}
+			if ($config{logAppendUsername}) {
+				$logfile = "$Settings::logs_folder/deathlog_$config{username}_$config{char}.txt";
+			} else {
+				$logfile = "$Settings::logs_folder/deathlog.txt";
+			}
+			my $deathmsg = $config{'deathMessage'};
+			if ($message =~ /$deathmsg/) {
+				my $pos = calcPosition($char);
+				my $location = "\nYou died at $maps_lut{$field{name}.'.rsw'} ($field{name}) : $pos->{x}, $pos->{y}\n";
+				use encoding 'utf8';
+				open(DFILE, ">>:utf8", "$logfile");
+				print DFILE "\n*** Start of console death log ***\n\n";
+				print DFILE @messages;
+				print DFILE $location;
+				print DFILE "\n*** End of console death log ***\n\n";
+				close(DFILE);
+			}
+		}
+	}
 
 	# Print to files
 	foreach my $file (@{$files->{$domain}}) {
Cadeath
Plain Yogurt
Plain Yogurt
Posts: 59
Joined: 05 Apr 2008, 05:14

Re: Autopsy plugin integration.

#2 Post by Cadeath »

what does it do?
Kissa2k
Human
Human
Posts: 46
Joined: 27 Apr 2008, 12:52
Noob?: No
Location: Russia

Re: Autopsy plugin integration.

#3 Post by Kissa2k »

Just do same as Autopsy do lol :)
Last edited by Kissa2k on 18 Nov 2008, 07:56, edited 1 time in total.
Cadeath
Plain Yogurt
Plain Yogurt
Posts: 59
Joined: 05 Apr 2008, 05:14

Re: Autopsy plugin integration.

#4 Post by Cadeath »

oh.. is that so...
fco2783
Plain Yogurt
Plain Yogurt
Posts: 95
Joined: 05 Apr 2008, 05:15
Noob?: Yes
Location: in place where you cant go

Re: Autopsy plugin integration.

#5 Post by fco2783 »

is this mean that we gonna have this as default on the next SVN???
Kissa2k
Human
Human
Posts: 46
Joined: 27 Apr 2008, 12:52
Noob?: No
Location: Russia

Re: Autopsy plugin integration.

#6 Post by Kissa2k »

Yeah, I've posted it because isieo requested it
midnytblu
Developers
Developers
Posts: 90
Joined: 14 Apr 2008, 09:37
Noob?: No
Location: prt_fild08 134 362

Re: Autopsy plugin integration.

#7 Post by midnytblu »

a little bump.

was this really integrated? i just checked Log.pm on SVN and the codes are not there.
User avatar
help_us
Testers Team
Testers Team
Posts: 106
Joined: 04 Apr 2008, 21:53
Noob?: No
Location: Asia

Re: Autopsy plugin integration.

#8 Post by help_us »

use tortoiseSVN commit that patch manually
Image
Image
kali
OpenKore Monk
OpenKore Monk
Posts: 457
Joined: 04 Apr 2008, 10:10

Re: Autopsy plugin integration.

#9 Post by kali »

I don't think this has been committed yet.
Got your topic trashed by a mod?

Trashing topics is one click, and moving a topic to its proper forum is a lot harder. You expend the least effort in deciding where to post, mods expend the least effort by trashing.

Have a nice day.
midnytblu
Developers
Developers
Posts: 90
Joined: 14 Apr 2008, 09:37
Noob?: No
Location: prt_fild08 134 362

Re: Autopsy plugin integration.

#10 Post by midnytblu »

@help_us
yes, i'm using tortoiseSVN.

@kali
thanks for confirming.