Just a follow-up, I just realized the modified plugin may screw up after a while when you are in a guild since it will simply record ALL guild chats. It will consume large chunks of memory if you left it for days.
The following modified code for sub onGuildChat will prevent this by limiting the number of guild chats messages recorded (200 is a safe limit since the chat window cannot display more than 200 lines):
Code: Select all
sub onGuildChat
{
my (undef, $args) = @_;
my ($chatMsgUser, $chatMsg); # Type: String
my $msg; # Type: String
$msg = I18N::bytesToString($args->{message});
if (($chatMsgUser, $chatMsg) = $msg =~ /(.*?) : (.*)/) {
$chatMsgUser =~ s/ $//;
stripLanguageCode(\$chatMsg);
$msg = "$chatMsgUser : $chatMsg";
}
if (!defined %reactOnGuildChat || $reactOnGuildChat{action})
{
undef %reactOnGuildChat if defined %reactOnGuildChat;
$reactOnGuildChat{index} = 0;
$reactOnGuildChat{msg}[$reactOnGuildChat{index}] = $msg;
}
else
{
if ($reactOnGuildChat{index} < 200)
{
$reactOnGuildChat{index}++;
$reactOnGuildChat{msg}[$reactOnGuildChat{index}] = $msg;
}
else
{
shift @{$reactOnGuildChat{msg}};
push @{$reactOnGuildChat{msg}}, $msg;
debug "[reactOnNPC] Guild message limit reached. Messages shifted up.\n", "reactOnNPC";
return;
}
}
debug "[reactOnNPC] Guild message saved ($reactOnGuildChat{index}): \"$msg\".\n", "reactOnNPC";
}