Page 1 of 1

few question about reactOnNPC plugins

Posted: 26 Apr 2017, 21:59
by a1628625669
hey guys,it's been few day i work on reactOnNPC plugin to try to pass the antibot,
I already have a clue how to do it ,but met some trouble.

Code: Select all

antibot1:[Antibot system]
antibot1:五
antibot1:*
antibot1:⑧
antibot1:do the math
i did some change in reactOnNPC.pl
add a hash to convert chineseword to number,
for example:

Code: Select all

my %convnum = (
'五' => '5',
'⑧' => '8'
);
i can run this in perl ,and success return the answer,but in OP,it seens like it doesen't match the chinese...

Re: few question about reactOnNPC plugins

Posted: 26 Apr 2017, 23:27
by a1628625669
sub onNPCTalk {
return if !$config{"reactOnNPC_0"};
my (undef, $args) = @_;
my $ID = unpack("V", substr($args->{RAW_MSG}, 4, 4));
my $msg = unpack("Z*", substr($args->{RAW_MSG}, 8));

$msg = I18N::bytesToString($msg);
my $lenstr = length($msg);
if (!%reactOnNPC || $reactOnNPC{action}) {
undef %reactOnNPC if %reactOnNPC;
$reactOnNPC{index} = 0;
$reactOnNPC{ID} = $ID;
$reactOnNPC{msg}[$reactOnNPC{index}] = $msg;
} else {
$reactOnNPC{index}++;
if($lenstr >10){
$msg =~ s/五/5/g;
$reactOnNPC{msg}[$reactOnNPC{index}] = $msg;
}else{
$reactOnNPC{msg}[$reactOnNPC{index}] = $msg;

}
}
message "[reactOnNPC] NPC message saved ($reactOnNPC{index}): \"$reactOnNPC{msg}[$reactOnNPC{index}]\" lenstr = $lenstr.\n", "plugin" if $config{"reactOnNPC_debug"};
}

the red code is the changes i make,when $msg =~ s/五/5/g; ,it doesn't work ,so the problem is the chinese number ?

Re: few question about reactOnNPC plugins

Posted: 27 Apr 2017, 00:18
by a1628625669
well........
I know what's wrong....
add

Code: Select all

use uft8;
:oops: :oops: