Добавлено: Вт дек 18, 2007 12:12 am
Модифицировал плагин. Теперь выводимая в лог строка имеет вид:
playerRecord.pl:
Пример:<id аккаунта> <имя персонажа> <уровень> <профессия> <гильдия> <время> <дата> <локация>
Код: Выделить всё
2000004 Tester1 lvl: 21 class: Novice guild: 19:18:40 18-11-2007 new_zone01
2000005 Tester2 lvl: 1 class: Novice guild: testers 19:19:12 18-11-2007 new_zone01
Код: Выделить всё
###################################################### # This plugin is licensed under the GNU GPL # # Copyright 2005 by isieo. Modifyed by _vit # # contact : - isieo <AT> *NOSPAM* G*MAIL <DOT> COM # # -------------------------------------------------- # # -------------------------------------------------- # # playerRecord.pl # # Records Player's name together with AIDs # # Usefull for players to findout other players' other# # characters... # # # ###################################################### package playerRecord; use strict; use Plugins; use Log qw(message); use Globals; use Settings; Plugins::register("prec", "playerRecord", \&on_unload, \&on_reload); my $hooks = Plugins::addHooks( ['charNameUpdate', \&write_player], ); my $datadir = $Plugins::current_plugin_folder; sub on_unload { # This plugin is about to be unloaded; remove hooks Plugins::delHook("charNameUpdate", $hooks); } sub on_reload { } sub write_player { my $hookname = shift; my $args = shift; my $targetId = unpack("V1",$args->{ID}); my $targetName = $args->{name}; my $targetGuild = $args->{guild}{name}; my $maploc = $field{name}; my $targetLvl = $args->{lv}; my $targetJob = $args->job; my $file = "$datadir/../logs/players.txt"; my ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime(); my $year = 1900 + $yearOffset; my $timestamp = sprintf("%02d:%02d:%02d %02d-%02d-%4d", $hour, $minute, $second, $dayOfMonth, $month, $year); message "Player logged: ".$targetName."\n"; if ($Settings::VERSION cmp '1.9.1' >= 0) { open FILE, ">>:utf8", $file; } else { open FILE, ">> $file"; } print FILE sprintf("%d %-20s\tlvl: %2d\t class: %-18s\tguild: %-20s\t%s\t%s\n", $targetId, $targetName, $targetLvl, $targetJob, $targetGuild, $timestamp, $maploc) if ($targetName) ; close FILE; } 1;