Other plugins for extending OpenKore's functionality. This forum is only for posting new plugins and commenting on existing plugins. For support, use the Support forum.
######################################################
# This plugin is licensed under the GNU GPL #
# Copyright 2005 by isieo #
# contact : - isieo <AT> *NOSPAM* G*MAIL <DOT> COM #
# -------------------------------------------------- #
# -------------------------------------------------- #
# playerrecorder.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 $file = "$datadir/players.txt";
my ($uId, $name);
my $exist=0;
my $line;
if ($Settings::VERSION cmp '1.9.1' >= 0) {
open FILE, "<:utf8", $file;
} else {
open FILE, "< $file";
}
foreach (<FILE>){
next if (/^#/);
s/[\r\n]//g;
s/\s+$//g;
$line = $_;
($uId, $name ) = $line =~ /^(\d+) (.*)$/;
if ($uId eq $targetId && $name eq $targetName){
$exist=1;
}
}
close FILE;
if (!$exist) {
message $name.$targetName."\n";
if ($Settings::VERSION cmp '1.9.1' >= 0) {
open FILE, ">>:utf8", $file;
} else {
open FILE, ">> $file";
}
print FILE "$targetId $targetName\n" if ($targetName) ;
close FILE;
}
}
1;
######################################################
# This plugin is licensed under the GNU GPL #
# Copyright 2005 by isieo #
# contact : - isieo <AT> *NOSPAM* G*MAIL <DOT> COM #
# -------------------------------------------------- #
# -------------------------------------------------- #
# playerrecorder.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;
use Actor;
use Actor::You;
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 $aYou = Actor::get($accountID);
my $selfName = $aYou->{name};
my $file = "$datadir/players_$selfName.txt";
my ($uId, $name);
my $exist=0;
my $line;
message $name.$targetName."\n";
if ($Settings::VERSION cmp '1.9.1' >= 0) {
open FILE, ">>:utf8", $file;
} else {
open FILE, ">> $file";
}
my $time=localtime time;
print FILE "[$time] $field{name} - $targetId $targetName\n";
close FILE;
}
1;
Writes to the log dir, now. Also fixed a possible bug and cleaned stuff up a bit and made it speak a little more standardized of a dialect (so to speak). Log file format was changed slightly as well to the following:
########################################################
# This plugin is licensed under the GNU GPL #
# Copyright 2005 by isieo #
# contact : - isieo <AT> *NOSPAM* G*MAIL <DOT> COM #
# #
# Modified by sli (signedlongint@gmail.com) #
# ---------------------------------------------------- #
# ---------------------------------------------------- #
# playerrecorder.pl #
# Records Player's name together with AIDs #
# Usefull for players to find out other players' other #
# characters... #
########################################################
package playerRecord;
use strict;
use Plugins;
use Log qw(message);
use Globals;
use Settings;
use Actor;
Plugins::register("prec", "playerRecord", \&on_unload, \&on_reload);
my $hook = Plugins::addHook('charNameUpdate', \&write_player, undef);
sub on_unload {
Plugins::delHook("charNameUpdate", $hook);
}
sub write_player {
my $hookname = shift;
my $args = shift;
my $targetId = unpack("V1",$args->{ID});
my $targetName = $args->{name};
my $aYou = Actor::get($accountID);
my $selfName = $char->name();
my $file = "$Settings::logs_folder/players_$selfName.txt";
my ($uId, $name);
my $exist=0;
my $line;
message "Player Exists: $targetName ($targetId)\n";
open FILE, ">>:utf8", $file;
my $time=localtime time;
print FILE "[$time] $field{name}\t$targetId $targetName\n";
close FILE;
}
1;
Bibian wrote:my recorder uses MySQL o.o
also saves a lot more information, like class, level, coords, timestamp seen, guild and party
You do know there are much, much better, faster and more reliable alternativesto MySQL that were made for things like this, don't you? Just thought I'd ask.
"If I giv u a bot I'll feed u a day, but if I teach u to bot I'll feed u for life time" --wise i3h4m
"R you stupid or playin' stupid" - extracted from Forrest Gump film Download Complete Set Up BOT from me
Trunk for enhanced features
Branch for unstable features or those that are major deviations from the trunk (e.g. one that will make data non-backwards compatible)
After all, the reason why we use a versioning system (SVN) is to keep track of changes.
I have also added sli's change above.
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.