outside a chatroom wrote:iamanoob : hahahah
they are just the same, and we might say something in public if we are not aware if we are in a chatroom or notinside a chatroom wrote:iamanoob : hahahah
(i.e. iamanoob : my momma for your zenny here)
src/Globals.pm
Code: Select all
interface => [qw($interface)],
- misc => [qw($quit $reconnectCount @lastpm %lastpm @privMsgUsers %timeout_ex $shopstarted $dmgpsec $totalelasped $elasped $totaldmg %overallAuth %responseVars %talk $startTime_EXP $startingZenny @monsters_Killed $bExpSwitch $jExpSwitch $totalBaseExp $totalJobExp $shopEarned %itemChange $XKore_dontRedirect $monkilltime $monstarttime $startedattack $firstLoginMap $sentWelcomeMessage $versionSearch $monsterBaseExp $monsterJobExp %descriptions %flags %damageTaken $logAppend @sellList $userSeed $taskManager)],
+ misc => [qw($quit $reconnectCount @lastpm %lastpm @privMsgUsers %timeout_ex $shopstarted $dmgpsec $totalelasped $elasped $totaldmg %overallAuth %responseVars %talk $startTime_EXP $startingZenny @monsters_Killed $bExpSwitch $jExpSwitch $totalBaseExp $totalJobExp $shopEarned %itemChange $XKore_dontRedirect $monkilltime $monstarttime $startedattack $firstLoginMap $sentWelcomeMessage $versionSearch $monsterBaseExp $monsterJobExp %descriptions %flags %damageTaken $logAppend @sellList $userSeed $taskManager $pub)],
Code: Select all
our $taskManager;
+ our $pub;
Code: Select all
sub chat_created {
my ($self, $args) = @_;
$currentChatRoom = $accountID;
$chatRooms{$accountID} = {%createdChatRoom};
binAdd(\@chatRoomsID, $accountID);
binAdd(\@currentChatRoomUsers, $char->{name});
message T("Chat Room Created\n");
+ $pub = 1;
}
Code: Select all
sub chat_newowner {
my ($self, $args) = @_;
my $user = bytesToString($args->{user});
if ($args->{type} == 0) {
if ($user eq $char->{name}) {
$chatRooms{$currentChatRoom}{ownerID} = $accountID;
} else {
my $players = $playersList->getItems();
my $player;
foreach my $p (@{$players}) {
if ($p->{name} eq $user) {
$player = $p;
last;
}
}
if ($player) {
my $key = $player->{ID};
$chatRooms{$currentChatRoom}{ownerID} = $key;
}
}
$chatRooms{$currentChatRoom}{users}{$user} = 2;
} else {
$chatRooms{$currentChatRoom}{users}{$user} = 1;
}
- message T("Chat Room Properties Modified\n");
+ message T("Chat Room Properties Modified [new owner]\n");
}
Code: Select all
sub chat_user_leave {
my ($self, $args) = @_;
my $user = bytesToString($args->{user});
delete $chatRooms{$currentChatRoom}{users}{$user};
binRemove(\@currentChatRoomUsers, $user);
$chatRooms{$currentChatRoom}{num_users} = $args->{num_users};
if ($user eq $char->{name}) {
binRemove(\@chatRoomsID, $currentChatRoom);
delete $chatRooms{$currentChatRoom};
undef @currentChatRoomUsers;
$currentChatRoom = "";
message T("You left the Chat Room\n");
+ $pub = 0;
} else {
message TF("%s has left the Chat Room\n", $user);
}
}
Code: Select all
sub chat_users {
my ($self, $args) = @_;
my $newmsg;
$self->decrypt(\$newmsg, substr($args->{RAW_MSG}, 8));
my $msg = substr($args->{RAW_MSG}, 0, 8).$newmsg;
my $ID = substr($args->{RAW_MSG},4,4);
$currentChatRoom = $ID;
my $chat = $chatRooms{$currentChatRoom} ||= {};
$chat->{num_users} = 0;
for (my $i = 8; $i < $args->{RAW_MSG_SIZE}; $i += 28) {
my $type = unpack("C1",substr($msg,$i,1));
my ($chatUser) = unpack("Z*", substr($msg,$i + 4,24));
$chatUser = bytesToString($chatUser);
if ($chat->{users}{$chatUser} eq "") {
binAdd(\@currentChatRoomUsers, $chatUser);
if ($type == 0) {
$chat->{users}{$chatUser} = 2;
} else {
$chat->{users}{$chatUser} = 1;
}
$chat->{num_users}++;
}
}
message TF("You have joined the Chat Room %s\n", $chat->{title});
+ $pub = 1;
}
Code: Select all
sub public_chat {
my ($self, $args) = @_;
# Type: String
my $message = bytesToString($args->{message});
my ($chatMsgUser, $chatMsg); # Type: String
my ($actor, $dist);
if ($message =~ /:/) {
($chatMsgUser, $chatMsg) = split /:/, $message, 2;
$chatMsgUser =~ s/ $//;
$chatMsg =~ s/^ //;
stripLanguageCode(\$chatMsg);
$actor = Actor::get($args->{ID});
$dist = "unknown";
if (!$actor->isa('Actor::Unknown')) {
$dist = distance($char->{pos_to}, $actor->{pos_to});
$dist = sprintf("%.1f", $dist) if ($dist =~ /\./);
}
$message = "$chatMsgUser ($actor->{binID}): $chatMsg";
} else {
$chatMsg = $message;
}
my $position = sprintf("[%s %d, %d]",
$field ? $field->name() : T("Unknown field,"),
$char->{pos_to}{x}, $char->{pos_to}{y});
my $distInfo;
if ($actor) {
$position .= sprintf(" [%d, %d] [dist=%s] (%d)",
$actor->{pos_to}{x}, $actor->{pos_to}{y},
$dist, $actor->{nameID});
$distInfo = "[dist=$dist] ";
}
# this code autovivifies $actor->{pos_to} but it doesnt matter
chatLog("c", "$position $message\n") if ($config{logChat});
- message TF("%s%s\n", $distInfo, $message), "publicchat";
+ message TF("%s%s\n", $pub ? '[Pub] ' : $distInfo, $message), "publicchat";
Code: Select all
sub self_chat {
my ($self, $args) = @_;
my ($message, $chatMsgUser, $chatMsg); # Type: String
$message = bytesToString($args->{message});
($chatMsgUser, $chatMsg) = $message =~ /([\s\S]*?) : ([\s\S]*)/;
# Note: $chatMsgUser/Msg may be undefined. This is the case on
# eAthena servers: it uses this packet for non-chat server messages.
if (defined $chatMsgUser) {
stripLanguageCode(\$chatMsg);
} else {
Plugins::callHook('packet_sysChat', {
msg => $message
});
$message = $message;
}
chatLog("c", "$message\n") if ($config{'logChat'});
- message "$message\n", "selfchat";
+ message TF("%s$message\n",$pub ? '[Pub] ' : ''), "selfchat";
Plugins::callHook('packet_selfChat', {
user => $chatMsgUser,
msg => $chatMsg
});
}
Code: Select all
sub map_loaded {
# Note: ServerType0 overrides this function
my ($self, $args) = @_;
+ $pub = 0;
undef $conState_tries;
$char = $chars[$config{char}];
$syncMapSync = pack('V1', $args->{syncMapSync});
so it would be....
outside a chatroom wrote:iamanoob : S> AW 5b
inside a chatroom wrote:[Pub] iamanoob : S> AW 5m