Page 1 of 1

forwardPM - forwards PMs received by Openkore to master(s)

Posted: 07 Apr 2008, 16:26
by fallen
What this plugin does is forward PMs to a list of nicknames defined as "masters".

Like this:
[Apr 7 17:19:29 2008] (From: Evil_Bot_Hunter) : You are a bot!
[Apr 7 17:19:30 2008] (To Master) : PM: "Evil_Bot_Hunter" : You are a bot!
[Apr 7 17:19:30 2008] (To Sub Master) : PM: "Evil_Bot_Hunter" : You are a bot!

Just load the plugin and set forwardPM_masterList with a comma-separated list of Masters. Using the above example, your forwardPM_masterList would be like this:

forwardPM_masterList Master,Sub Master

Please note that master names wich include commas are not supported so far, like "Blabla, the Great"

Original idea by klas

Code: Select all

############################
# forwardPms plugin for OpenKore by thefallen
#
# This software is open source, licensed under the GNU General Public
# License, version 2.
#
# Configuration:
# Place on your config.txt:
# 
# forwardPM_masterList My Character,My Other Character,Someone Else
#
# Whenever the bot recives a PM, it will forward to all masters listed
# Do not place too many masters, or you might be disconnected for too
# many packets or get muted :P
#
# Use at your own risk.
#
# This plugin should be in a subfolder of plugins like 'plugins/forwardPms.pl'.
#
############################

package itemLog;

use strict;
use Plugins;
use Globals qw(%config %npcs @npcsID %field $char %cart $shopstarted @articles $net);
use Commands;

Plugins::register('forwardPms', 'Forwards PMs received to master(s).', \&onUnload);

my $hooks = Plugins::addHooks(
        ['packet_privMsg', \&receivedPM, undef]
);

sub onUnload {
    Plugins::delHooks($hooks);
}

sub receivedPM {
        my ($self, $args) = @_;
        return if (!$config{forwardPM_masterList});
        my @masters=split(/ *, */, $config{forwardPM_masterList});
        foreach (@masters) {
                Commands::run("pm \"$_\" PM: \"".$args->{privMsgUser}."\" : ".$args->{privMsg});
        }
        return;
}

1;

Re: forwardPM - forwards PMs received by Openkore to master(s)

Posted: 07 Apr 2008, 22:20
by kali
You might want to put a small timeout between PMing each master for cases where there are a lot of masters to PM - the server might drop some of the messages or you might get caught spamming the server.

One can use this plugin for commanding an army of bots for example: each bot has the rest of the army as its master, and if one bot gets caught it PMs the rest to quit or disconnect.

Re: forwardPM - forwards PMs received by Openkore to master(s)

Posted: 08 Apr 2008, 02:49
by Krai
i'm going to have to give this a shot when i am botting and playing at the same time. i dont get too many pms that aren't already taken care of by macros. nice plugin though

Re: forwardPM - forwards PMs received by Openkore to master(s)

Posted: 08 Apr 2008, 05:18
by iamanoob
:D

u may use this

sendMessage($messageSender, "pm", $msg, $to);

just change $msg to <your message>
change $to to <recipient>


for commanding bots from master
u may use that ditto.pl

just an idea...

Re: forwardPM - forwards PMs received by Openkore to master(s)

Posted: 08 Apr 2008, 22:51
by acemg
i say its a great plugin, i tried and tested works very good since my creator who fcp me receives a lot of pm's, lol i just rcv a pm wait...