From a7e8991ef0e6a3d09a964d5a2884349ecb058b3b Mon Sep 17 00:00:00 2001 From: ya4ept Date: Mon, 12 Jul 2021 02:55:39 +0300 Subject: [PATCH 01/32] poseidon - fix `0B60` package - added new `twRO_2021-06-21` serverType in poseidon - added `0B60` support (account_server_info) --- src/Network/Receive.pm | 10 +++++----- src/Poseidon/RagnarokServer.pm | 19 +++++++++++++++++++ src/Poseidon/servertypes.txt | 5 +++++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/Network/Receive.pm b/src/Network/Receive.pm index 9a9bbb86c7..09c284dab7 100644 --- a/src/Network/Receive.pm +++ b/src/Network/Receive.pm @@ -985,11 +985,11 @@ sub parse_account_server_info { my ($self, $args) = @_; my $server_info; - if ($args->{switch} eq '0B60') { # tRO 2020 + if ($args->{switch} eq '0B60') { # tRO 2020, twRO 2021 $server_info = { len => 164, - types => 'a4 v Z20 v3 a132', - keys => [qw(ip port name state users property ip_port)], + types => 'a4 v Z20 v3 a128 V', + keys => [qw(ip port name state users property ip_port unknown)], }; } elsif ($args->{switch} eq '0AC4' || $args->{switch} eq '0B07') { # kRO Zero 2017, kRO ST 201703+, vRO 2021 @@ -1051,8 +1051,8 @@ sub reconstruct_account_server_info { if ($args->{switch} eq '0B60') { # tRO 2020 $serverInfo = { len => 164, - types => 'a4 v Z20 v3 a132', - keys => [qw(ip port name state users property ip_port)], + types => 'a4 v Z20 v3 a128 V', + keys => [qw(ip port name state users property ip_port unknown)], }; } elsif ($args->{switch} eq "0AC4" || $self->{packet_lut}{$args->{switch}} eq "0AC4" || $args->{switch} eq '0B07') { diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index 4e5fbe250e..a4d4a72e87 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -293,6 +293,25 @@ sub ParsePacket { pack("l", "0") . # login_type pack("Z20","S1000") . # flag pack("Z*", "OpenkoreClientToken"); # login_token + } elsif ($switch eq '0064') { # received twRO + $serverUsers = pack("v", @{$self->clients()} - 1); + $data = pack("v", 0x0B60) . # header + pack("v", 0xE4) . # length + $sessionID . # sessionid + $accountID . # accountid + $sessionID2 . # sessionid2 + pack("x4") . # lastloginip + pack("a26", time) . # lastLoginTime + pack("C", $sex) . # accountSex + pack("x17") . # unknown + pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . + $port . + $serverName . + pack("x2") . # state + $serverUsers. + pack("v", 0x6985) . # property + pack("x128").# ip_port + pack("x4"); # unknown } elsif ($switch eq '0825') { # received kRO Zero Token $data = pack("C*", 0xC4, 0x0A) . # header pack("C*", 0xE0, 0x00) . # length diff --git a/src/Poseidon/servertypes.txt b/src/Poseidon/servertypes.txt index d73ff75db1..aa5333192d 100644 --- a/src/Poseidon/servertypes.txt +++ b/src/Poseidon/servertypes.txt @@ -42,3 +42,8 @@ decrypt_mid_keys 0x07CB29CB 0x69CB69CB 0x69CB69CB charListPacket 0x99d maploginPacket 022D charBlockSize 155 + +[twRO_2021-06-21] +decrypt_mid 0 +charBlockSize 155 +charListPacket 0x82d \ No newline at end of file From 5e208a56e6c4acf2f456d443dd2d2b697c9fbc85 Mon Sep 17 00:00:00 2001 From: ya4ept Date: Mon, 12 Jul 2021 03:30:01 +0300 Subject: [PATCH 02/32] poseidon - fix `099d` (received_characters) --- src/Poseidon/RagnarokServer.pm | 5 +++-- src/Poseidon/servertypes.txt | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index a4d4a72e87..5986234e84 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -257,6 +257,7 @@ sub ParsePacket { $clientdata{$index}{secureLogin_requestCode} = getHex($code); } +# send account_server_info } elsif (($switch eq '01DD') || ($switch eq '01FA') || ($switch eq '0064') || ($switch eq '0060') || ($switch eq '0277') || ($switch eq '02B0') || ($switch eq '0AAC') || ($switch eq '0ACF') || ($switch eq '0825')) { # 0064 packet thanks to abt123 # my $data = pack("C*", 0xAD, 0x02, 0x00, 0x00, 0x1E, 0x0A, 0x00, 0x00); @@ -362,7 +363,7 @@ sub ParsePacket { # if other servers do use this packet too that will be a problem. $clientdata{$index}{kRO} = 1; } - +# send characters_info } elsif (($switch eq '0065') || ($switch eq '0275') || ($msg =~ /^$packed_switch$accountID$sessionID$sessionID2\x0\x0.$/)) { # client sends server choice packet if ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x99d') { my $data; @@ -918,7 +919,7 @@ sub SendCharacterList if ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x82d') { $data = $accountID . pack("v2 C5 a20", 0x82d, $len + 29,$totalchars,0,0,0,$totalchars,-0); # 29 = v2 C5 a20 size for bRO } elsif ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x99d') { - $data = pack("C*", 0x9D, 0x09) . + $data = pack("v", 0x099D) . pack("v", $len + 4); } else { $data = $accountID . pack("v v C3", 0x6b, $len + 7, $totalslots, -1, -1); diff --git a/src/Poseidon/servertypes.txt b/src/Poseidon/servertypes.txt index aa5333192d..d9d280ee84 100644 --- a/src/Poseidon/servertypes.txt +++ b/src/Poseidon/servertypes.txt @@ -46,4 +46,4 @@ charBlockSize 155 [twRO_2021-06-21] decrypt_mid 0 charBlockSize 155 -charListPacket 0x82d \ No newline at end of file +charListPacket 0x99d \ No newline at end of file From 9509bdfd97579f95713a3fded7e5fa375c139c1f Mon Sep 17 00:00:00 2001 From: ya4ept Date: Mon, 12 Jul 2021 04:08:40 +0300 Subject: [PATCH 03/32] poseidon code cleanup: replaced "0x00 0x69" with "0x0069" to make it easier to search for packages throughout the code --- src/Poseidon/RagnarokServer.pm | 241 ++++++++++++++++----------------- 1 file changed, 118 insertions(+), 123 deletions(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index 5986234e84..ff02dba0fd 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -1,9 +1,9 @@ ########################################################### # Poseidon server - Ragnarok Online server emulator # -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # Copyright (c) 2005-2006 OpenKore Development Team @@ -58,14 +58,14 @@ sub new { # Invariant: state ne '' $self->{state} = 'ready'; - + # added servertypes support if (-e 'servertypes.txt') { parseSectionedFile('servertypes.txt', \%{$self->{type}}); } else { parseSectionedFile('src/Poseidon/servertypes.txt', \%{$self->{type}}); } - + if (!$self->{type}->{$config{server_type}}) { die "Invalid serverType specified. Please check your poseidon config file.\n"; } else { @@ -82,7 +82,7 @@ sub new { # Ensure: $self->getState() eq 'requesting' # # Send a GameGuard query to the RO client. -sub query +sub query { my ($self, $packet) = @_; my $clients = $self->clients(); @@ -96,7 +96,7 @@ sub query } } } - + print "[RagnarokServer]-> Error: no Ragnarok Online client connected.\n"; } @@ -138,7 +138,7 @@ sub readResponse { ##################################################### -sub onClientNew +sub onClientNew { my ($self, $client, $index) = @_; @@ -149,18 +149,18 @@ sub onClientNew $enc_val2 = 0; $enc_val3 = 0; } else { $state = 0; } - + $self->{challengeNum} = 0; - - print "[RagnarokServer]-> Ragnarok Online client ($index) connected.\n"; + + print "[RagnarokServer]-> Ragnarok Online client ($index) connected.\n"; } -sub onClientExit +sub onClientExit { my ($self, $client, $index) = @_; - + $self->{challengeNum} = 0; - + print "[RagnarokServer]-> Ragnarok Online client ($index) disconnected.\n"; } @@ -178,27 +178,27 @@ my $npcID0 = pack("a4", "npc2"); my $monsterID = pack("a4", "mon1"); my $itemID = pack("a4", "itm1"); -sub DecryptMessageID +sub DecryptMessageID { my ($MID) = @_; - + # Checking if Decryption is Activated - if ($enc_val1 != 0 && $enc_val2 != 0 && $enc_val3 != 0) + if ($enc_val1 != 0 && $enc_val2 != 0 && $enc_val3 != 0) { # Saving Last Informations for Debug Log my $oldMID = $MID; my $oldKey = ($enc_val1 >> 16) & 0x7FFF; - + # Calculating the Next Decryption Key $enc_val1 = $enc_val1->bmul($enc_val3)->badd($enc_val2) & 0xFFFFFFFF; - + # Xoring the Message ID [657BE2h] [0x6E0A] $MID = ($MID ^ (($enc_val1 >> 16) & 0x7FFF)); # Debug Log printf("Decrypted MID : [%04X]->[%04X] / KEY : [0x%04X]->[0x%04X]\n", $oldMID, $MID, $oldKey, ($enc_val1 >> 16) & 0x7FFF) if ($config{debug}); } - + return $MID; } @@ -207,7 +207,7 @@ sub onClientData { my $packet_id = DecryptMessageID(unpack("v",$msg)); my $switch = sprintf("%04X", $packet_id); - + # Parsing Packet ParsePacket($self, $client, $msg, $index, $packet_id, $switch); } @@ -217,15 +217,15 @@ sub ParsePacket { #my $packed_switch = quotemeta substr($msg, 0, 2); my $packed_switch = $packet_id; - + ### These variables control the account information ### my $host = $self->getHost(); my $port = pack("v", $self->getPort()); $host = '127.0.0.1' if ($host eq 'localhost'); my @ipElements = split /\./, $host; - + visualDump($msg, "$switch") if ($config{debug}); - + # Note: # The switch packets are pRO specific and assumes the use of secureLogin 1. It may or may not work with other # countries' clients (except probably oRO). The best way to support other clients would be: use a barebones @@ -234,7 +234,7 @@ sub ParsePacket { if ($switch eq '01DB' || $switch eq '0204') { # client sends login packet 0204 packet thanks to elhazard # '01DC' => ['secure_login_key', 'x2 a*', [qw(secure_key)]], - my $data = pack("C*", 0xdc, 0x01, 0x14) . pack("x17"); + my $data = pack("v2", 0x01DC, 0x14) . pack("x17"); $client->send($data); # save servers.txt info @@ -268,17 +268,16 @@ sub ParsePacket { my $data; if ($switch eq '01FA') { - $data = pack("C*", 0x69, 0x00, 0x53, 0x00) . - $sessionID . $accountID . $sessionID2 . + $data = pack("v", 0x0069) . # header + pack("v", 0x53) . # length + $sessionID . $accountID . $sessionID2 . pack("x30") . pack("C1", $sex) . pack("x4") . pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . $port . $serverName . $serverUsers . pack("x2"); } elsif ($switch eq '0AAC') { - $data = pack("C*", 0xC9, 0x0A) . # header - pack("C*", 0xCF, 0x00) . # length - $sessionID . # sessionid - $accountID . # accountid - $sessionID2 . # sessionid2 + $data = pack("v", 0x0AC9) . # header + pack("v", 0xCF) . # length + $sessionID . $accountID . $sessionID2 . pack("x4") . # lastloginip pack("a26", time) . # lastLoginTime pack("C1", $sex) . # accountSex @@ -289,48 +288,45 @@ sub ParsePacket { pack("a*", $host.":".$self->getPort()) . # ip:port pack("x114"); # fill with 00 } elsif ($switch eq '0ACF') { #kRO Zero Token - $data = pack("C*", 0xE3, 0x0A) . # header - pack("C*", 0x2F, 0x00) . # length + $data = pack("v", 0x0AE3) . # header + pack("v", 0x2F) . # length pack("l", "0") . # login_type pack("Z20","S1000") . # flag - pack("Z*", "OpenkoreClientToken"); # login_token + pack("Z*", "OpenkoreClientToken"); # login_token } elsif ($switch eq '0064') { # received twRO $serverUsers = pack("v", @{$self->clients()} - 1); $data = pack("v", 0x0B60) . # header pack("v", 0xE4) . # length - $sessionID . # sessionid - $accountID . # accountid - $sessionID2 . # sessionid2 + $sessionID . $accountID . $sessionID2 . pack("x4") . # lastloginip pack("a26", time) . # lastLoginTime - pack("C", $sex) . # accountSex - pack("x17") . # unknown + pack("C", $sex) . # accountSex + pack("x17") . # unknown pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . - $port . - $serverName . + $port . + $serverName . pack("x2") . # state - $serverUsers. + $serverUsers. pack("v", 0x6985) . # property pack("x128").# ip_port pack("x4"); # unknown } elsif ($switch eq '0825') { # received kRO Zero Token - $data = pack("C*", 0xC4, 0x0A) . # header - pack("C*", 0xE0, 0x00) . # length - $sessionID . # sessionid - $accountID . # accountid - $sessionID2 . # sessionid2 + $data = pack("v", 0x0AC4) . # header + pack("v", 0xE0) . # length + $sessionID . $accountID . $sessionID2 . pack("x4") . # lastloginip pack("a26", time) . # lastLoginTime - pack("C1", $sex) . # accountSex - pack("x17") . # unknown + pack("C1", $sex) . # accountSex + pack("x17") . # unknown pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . - $port . - $serverName . - $serverUsers . - pack("x130"); + $port . + $serverName . + $serverUsers . + pack("x130"); } else { - $data = pack("C*", 0x69, 0x00, 0x4F, 0x00) . - $sessionID . $accountID . $sessionID2 . + $data = pack("v", 0x0069) . # header + pack("v", 0x4F) . # length + $sessionID . $accountID . $sessionID2 . pack("x30") . pack("C1", $sex) . pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . $port . $serverName . $serverUsers . pack("x2"); @@ -365,17 +361,16 @@ sub ParsePacket { } # send characters_info } elsif (($switch eq '0065') || ($switch eq '0275') || ($msg =~ /^$packed_switch$accountID$sessionID$sessionID2\x0\x0.$/)) { # client sends server choice packet - if ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x99d') { + if ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x99d') { my $data; $data = $accountID; $client->send($data); - - $data = pack("C*", 0x2D, 0x08, 0x1D, 0x00, 0x02, 0x00, 0x00, 0x02, 0x02) . + + $data = pack("v2 C5", 0x082D, 0x1D, 0x02, 0x00, 0x00, 0x02, 0x02) . pack("x20"); $client->send($data); - - $data = pack("C*", 0xA0, 0x09, 0x01) . - pack("x3"); + + $data = pack("v V", 0x09A0, 0x01) . $client->send($data); return; @@ -390,7 +385,7 @@ sub ParsePacket { undef $clientdata{$index}{gameLogin_packet}; } - } elsif ($switch eq '09A1') { + } elsif ($switch eq '09A1') { SendCharacterList($self, $client, $msg, $index); } elsif ($switch eq '0066') { # client sends character choice packet @@ -401,7 +396,7 @@ sub ParsePacket { my @enc_values = split(/\s+/, $self->{type}->{$config{server_type}}->{decrypt_mid_keys}); ($enc_val1, $enc_val2, $enc_val3) = (Math::BigInt->new(@enc_values[0]), Math::BigInt->new(@enc_values[1]), Math::BigInt->new(@enc_values[2])); } - + # State $state = 1; @@ -409,11 +404,11 @@ sub ParsePacket { # '0071' => ['received_character_ID_and_Map', 'a4 Z16 a4 v1', [qw(charID mapName mapIP mapPort)]], my $mapName = pack("a16", "moc_prydb1.gat"); - my $data = pack("C*", 0x71, 0x00) . $charID . $mapName . + my $data = pack("v", 0x0071) . $charID . $mapName . pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . $port; - + $client->send($data); - + } elsif ($switch eq $self->{type}->{$config{server_type}}->{maploginPacket} && (length($msg) == 19) && (substr($msg, 2, 4) eq $accountID) && @@ -587,15 +582,15 @@ sub ParsePacket { # Temporary Hack to Initialized Crypted Client if ( $self->{type}->{$config{server_type}}->{decrypt_mid_keys} ) { - for ( my $i = 0 ; $i < 64 ; $i++ ) + for ( my $i = 0 ; $i < 64 ; $i++ ) { $client->send(pack("C C", 0x70, 0x08)); - + # Forcedly Calculating the Next Decryption Key - $enc_val1 = $enc_val1->bmul($enc_val3)->badd($enc_val2) & 0xFFFFFFFF; + $enc_val1 = $enc_val1->bmul($enc_val3)->badd($enc_val2) & 0xFFFFFFFF; } - } - + } + PerformMapLoadedTasks($self, $client, $msg, $index); } elsif ( ( ( ($switch eq '007E') || ($switch eq '035F') ) && (($clientdata{$index}{serverType} == 0) || ($clientdata{$index}{serverType} == 1) || ($clientdata{$index}{serverType} == 2) || ($clientdata{$index}{serverType} == 6) || ($clientdata{$index}{serverType} == 7) || ($clientdata{$index}{serverType} == 10) || ($clientdata{$index}{serverType} == 11))) || @@ -614,19 +609,19 @@ sub ParsePacket { } } elsif ($switch eq '00B2') { # quit to character select screen - + SendGoToCharSelection($self, $client, $msg, $index); - + # Disable Decryption $enc_val1 = 0; $enc_val2 = 0; - $enc_val3 = 0; - + $enc_val3 = 0; + } elsif ($switch eq '0187') { # accountid sync (what does this do anyway?) $client->send($msg); } elsif ($switch eq '018A') { # client sends quit packet - + SendQuitGame($self, $client, $msg, $index); } elsif ($switch eq '09D0' || $switch eq '0228') { # client sends game guard sync # Queue the response @@ -638,7 +633,7 @@ sub ParsePacket { $self->{response} = pack("v", $packet_id); }; $self->{state} = 'requested'; - + } elsif ($switch eq '02A7') { # client sends hShield response # Queue the response $self->{response} = $msg; @@ -704,7 +699,7 @@ sub ParsePacket { SendNPCTalk($self, $client, $msg, $index, $npcID, "gameLogin_packet: $clientdata{$index}{gameLogin_packet}"); } SendNPCTalkContinue($self, $client, $msg, $index, $npcID); - + if (defined $clientdata{$index}{serverType}) { $clientdata{$index}{npc_talk_code} = 3; } else { @@ -769,7 +764,7 @@ sub ParsePacket { } SendNPCTalkContinue($self, $client, $msg, $index, $npcID); $clientdata{$index}{npc_talk_code} = 2; - + } elsif ($clientdata{$index}{npc_talk_code} == 2.5) { if (!defined $clientdata{$index}{serverType}) { SendNPCTalk($self, $client, $msg, $index, $npcID, "As you can see, I can't find a matching serverType for your server."); @@ -880,10 +875,10 @@ sub ParsePacket { sub SendCharacterList { my ($self, $client, $msg, $index) = @_; - + # Log print "Requested Char List (Standard)\n"; - + # Wanted Block Size my $blocksize = $self->{type}->{$config{server_type}}->{charBlockSize} || 116; #defaults to 116 @@ -891,7 +886,7 @@ sub SendCharacterList my $totalchars = 2; my $totalslots = 12; my $len = $blocksize * $totalchars; - + # Character Block Pack String my $packstring = ''; $packstring = 'a4 Z8 V Z8 V6 v V2 v4 V v9 Z24 C8 v a16 Z16 C' if $blocksize == 155; @@ -907,24 +902,24 @@ sub SendCharacterList $packstring = 'a4 V9 v V2 v14 Z24 C6 v2' if $blocksize == 112; $packstring = 'a4 V9 v17 Z24 C6 v2' if $blocksize == 108; $packstring = 'a4 V9 v17 Z24 C6 v' if $blocksize == 106; - + # Unknown CharBlockSize if ( length($packstring) == 0 ) { print "Unknown CharBlockSize : $blocksize\n"; return; } - + # Character Block Format my($cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairColor,$clothesColor,$name,$str,$agi,$vit,$int,$dex,$luk,$slot,$rename) = 0; # Preparing Begin of Character List Packet my $data; if ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x82d') { - $data = $accountID . pack("v2 C5 a20", 0x82d, $len + 29,$totalchars,0,0,0,$totalchars,-0); # 29 = v2 C5 a20 size for bRO - } elsif ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x99d') { + $data = $accountID . pack("v2 C5 a20", 0x082d, $len + 29,$totalchars,0,0,0,$totalchars,-0); # 29 = v2 C5 a20 size for bRO + } elsif ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x99d') { $data = pack("v", 0x099D) . pack("v", $len + 4); } else { - $data = $accountID . pack("v v C3", 0x6b, $len + 7, $totalslots, -1, -1); + $data = $accountID . pack("v v C3", 0x006b, $len + 7, $totalslots, -1, -1); } - + # Character Block my $block; @@ -941,7 +936,7 @@ sub SendCharacterList } else { $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairColor,$clothesColor,$name,$str,$agi,$vit,$int,$dex,$luk,$slot,$rename); } - + # Attaching Block $data .= $block; @@ -973,13 +968,13 @@ sub SendMapLogin { if ( $config{server_type} =~ /^kRO/ ) { # kRO Zero $data .= pack("C*", 0x83, 0x02) . $accountID; #accountID $client->send($data); - + $data = pack("C*", 0xDE, 0x0A, 0x46, 0x00, 0x00, 0x00); # idk '-' $client->send($data); - + $data = pack("C*", 0xEB, 0x02) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05, 0x00, 0x00); # map loaded $client->send($data); - + } else { if ( $config{server_type} !~ /^bRO/ ) { $data .= $accountID; } #<- This is Server Type Based !! $data = pack("C*", 0x73, 0x00) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05); @@ -997,42 +992,42 @@ sub SendMapLogin { pack("v2 x2 v3 a24 C1", 28, 16, 10, 40, 9, "AL_HEAL", 0); # target skill test $client->send($data); } - - $client->{connectedToMap} = 1; + + $client->{connectedToMap} = 1; } sub SendGoToCharSelection { my ($self, $client, $msg, $index) = @_; - - # Log - print "Requested Char Selection Screen\n"; - + + # Log + print "Requested Char Selection Screen\n"; + $client->send(pack("v v", 0xB3, 1)); } sub SendQuitGame { my ($self, $client, $msg, $index) = @_; - + # Log print "Requested Quit Game...\n"; - - $client->send(pack("v v", 0x18B, 0)); + + $client->send(pack("v v", 0x18B, 0)); } sub SendLookTo { my ($self, $client, $msg, $index, $ID, $to) = @_; - + # Make Poseidon look to front $client->send(pack('v1 a4 C1 x1 C1', 0x9C, $ID, 0, $to)); } -sub SendUnitInfo +sub SendUnitInfo { my ($self, $client, $msg, $index, $ID, $name) = @_; - + # Let's not wait for the client to ask for the unit info # '0095' => ['actor_info', 'a4 Z24', [qw(ID name)]], $client->send(pack("v1 a4 a24", 0x95, $ID, $name)); @@ -1041,7 +1036,7 @@ sub SendUnitInfo sub SendSystemChatMessage { my ($self, $client, $msg, $index, $message) = @_; - + # '009A' => ['system_chat', 'v Z*', [qw(len message)]], $client->send(pack("v2 a32", 0x9A, 36, $message)); } @@ -1049,7 +1044,7 @@ sub SendSystemChatMessage sub SendShowNPC { my ($self, $client, $msg, $index, $obj_type, $GID, $SpriteID, $X, $Y, $MobName) = @_; - + # Packet Structure my ($object_type,$NPCID,$walk_speed,$opt1,$opt2,$option,$type,$hair_style,$weapon,$lowhead,$shield,$tophead,$midhead,$hair_color,$clothes_color,$head_dir,$guildID,$emblemID,$manner,$opt3,$stance,$sex,$xSize,$ySize,$lv,$font,$name) = 0; @@ -1060,7 +1055,7 @@ sub SendShowNPC $type = $SpriteID; $lv = 1; $name = $MobName; - + # '0856' => ['actor_exists', 'v C a4 v3 V v11 a4 a2 v V C2 a3 C3 v2 Z*', [qw(len object_type ID walk_speed opt1 opt2 option type hair_style weapon shield lowhead tophead midhead hair_color clothes_color head_dir costume guildID emblemID manner opt3 stance sex coords xSize ySize lv font name)]], # -1 # spawning provided by try71023 my $dbuf; if ( $config{server_type} !~ /^bRO/ ) { $dbuf .= pack("C", $object_type); } #<- This is Server Type Based !! @@ -1076,15 +1071,15 @@ sub SendShowNPC sub SendShowItemOnGround { my ($self, $client, $msg, $index, $ID, $SpriteID, $X, $Y) = @_; - + # '009D' => ['item_exists', 'a4 v1 x1 v3', [qw(ID type x y amount)]] - $client->send(pack("v1 a4 v1 x1 v3 x2", 0x9D, $ID, $SpriteID, $posX + 1, $posY - 1, 1)); + $client->send(pack("v1 a4 v1 x1 v3 x2", 0x9D, $ID, $SpriteID, $posX + 1, $posY - 1, 1)); } sub SendNPCTalk { my ($self, $client, $msg, $index, $npcID, $message) = @_; - + # '00B4' => ['npc_talk', 'v a4 Z*', [qw(len ID msg)]] my $dbuf = pack("a" . length($message), $message); $client->send(pack("v2 a4", 0xB4, (length($dbuf) + 8), $npcID) . $dbuf); @@ -1093,7 +1088,7 @@ sub SendNPCTalk sub SendNPCTalkContinue { my ($self, $client, $msg, $index, $npcID) = @_; - + # '00B5' => ['npc_talk_continue', 'a4', [qw(ID)]] $client->send(pack("v a4", 0xB5, $npcID)); } @@ -1101,18 +1096,18 @@ sub SendNPCTalkContinue sub SendNpcTalkClose { my ($self, $client, $msg, $index, $npcID) = @_; - + # '00B6' => ['npc_talk_close', 'a4', [qw(ID)]] - $client->send(pack("v a4", 0xB6, $npcID)); + $client->send(pack("v a4", 0xB6, $npcID)); } sub SendNpcTalkResponses { my ($self, $client, $msg, $index, $npcID, $message) = @_; - + # '00B7' => ['npc_talk', 'v a4 Z*', [qw(len ID msg)]] my $dbuf = pack("a" . length($message), $message); - $client->send(pack("v2 a4", 0xB7, (length($dbuf) + 8), $npcID) . $dbuf); + $client->send(pack("v2 a4", 0xB7, (length($dbuf) + 8), $npcID) . $dbuf); } sub SendNpcImageShow @@ -1130,13 +1125,13 @@ sub SendNpcImageShow sub PerformMapLoadedTasks { my ($self, $client, $msg, $index) = @_; - + # Looking to Front SendLookTo($self, $client, $msg, $index, $accountID, 4); - + # Let's not wait for the client to ask for the unit info SendUnitInfo($self, $client, $msg, $index, $accountID, 'Poseidon' . (($clientdata{$index}{mode} ? ' Dev' : ''))); - + # Global Announce SendSystemChatMessage($self, $client, $msg, $index, "Welcome to the Poseidon Server !"); @@ -1146,18 +1141,18 @@ sub PerformMapLoadedTasks SendUnitInfo($self, $client, $msg, $index, $npcID0, "Server Details Guide"); # Dev Mode (Char Slot 1) - if ($clientdata{$index}{mode}) + if ($clientdata{$index}{mode}) { # Show an NPC (Kafra) SendShowNPC($self, $client, $msg, $index, 1, $npcID1, 114, $posX + 5, $posY + 3, "Kafra NPC"); SendLookTo($self, $client, $msg, $index, $npcID1, 4); - SendUnitInfo($self, $client, $msg, $index, $npcID1, "Kafra NPC"); - + SendUnitInfo($self, $client, $msg, $index, $npcID1, "Kafra NPC"); + # Show a monster SendShowNPC($self, $client, $msg, $index, 5, $monsterID, 1002, $posX - 2, $posY - 1, "Poring"); SendLookTo($self, $client, $msg, $index, $monsterID, 3); SendUnitInfo($self, $client, $msg, $index, $monsterID, "Poring"); - + # Show an item on ground SendShowItemOnGround($self, $client, $msg, $index, $itemID, 512, $posX + 1, $posY - 1); } From a87c284bfb6531e226583907574a3abd2e416936 Mon Sep 17 00:00:00 2001 From: ya4ept Date: Mon, 12 Jul 2021 04:47:22 +0300 Subject: [PATCH 04/32] poseidon add '0AC5' support (received_character_ID_and_Map) --- src/Poseidon/RagnarokServer.pm | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index ff02dba0fd..9d01baf0c1 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -367,10 +367,10 @@ sub ParsePacket { $client->send($data); $data = pack("v2 C5", 0x082D, 0x1D, 0x02, 0x00, 0x00, 0x02, 0x02) . - pack("x20"); + pack("x20"); $client->send($data); - $data = pack("v V", 0x09A0, 0x01) . + $data = pack("v V", 0x09A0, 0x01); $client->send($data); return; @@ -402,12 +402,21 @@ sub ParsePacket { $clientdata{$index}{mode} = unpack('C1', substr($msg, 2, 1)); - # '0071' => ['received_character_ID_and_Map', 'a4 Z16 a4 v1', [qw(charID mapName mapIP mapPort)]], - my $mapName = pack("a16", "moc_prydb1.gat"); - my $data = pack("v", 0x0071) . $charID . $mapName . - pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . $port; + if ($self->{type}->{$config{server_type}}->{character_ID_and_Map} eq '0x0AC5') { + # '0AC5' => ['received_character_ID_and_Map', 'a4 Z16 a4 v a128', [qw(charID mapName mapIP mapPort mapUrl)]], + my $mapName = pack("a16", "moc_prydb1.gat"); + my $data = pack("v", 0x0AC5) . $charID . $mapName . + pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . $port . + pack("x128"); # mapUrl + $client->send($data); - $client->send($data); + } else { + # '0071' => ['received_character_ID_and_Map', 'a4 Z16 a4 v1', [qw(charID mapName mapIP mapPort)]], + my $mapName = pack("a16", "moc_prydb1.gat"); + my $data = pack("v", 0x0071) . $charID . $mapName . + pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . $port; + $client->send($data); + } } elsif ($switch eq $self->{type}->{$config{server_type}}->{maploginPacket} && (length($msg) == 19) && From a59722805c445e1e5ee1f651371d51d0caf24665 Mon Sep 17 00:00:00 2001 From: ya4ept Date: Mon, 12 Jul 2021 05:01:34 +0300 Subject: [PATCH 05/32] poseidon add '0436' support (map_login) --- src/Poseidon/RagnarokServer.pm | 3 ++- src/Poseidon/servertypes.txt | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index 9d01baf0c1..740f6ade7f 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -424,6 +424,7 @@ sub ParsePacket { (substr($msg, 6, 4) eq $charID) && (substr($msg, 10, 4) eq $sessionID) ) { # client sends the maplogin packet + SendMapLogin($self, $client, $msg, $index); # save servers.txt info $clientdata{$index}{serverType} = 0; @@ -561,7 +562,7 @@ sub ParsePacket { $clientdata{$index}{serverType} = "1 or 2"; } elsif (($switch eq '0436' || $switch eq '022D' || $switch eq $self->{type}->{$config{server_type}}->{maploginPacket}) && - (length($msg) == 19) && + (length($msg) == 19 || length($msg) == 23) && (substr($msg, 2, 4) eq $accountID) && (substr($msg, 6, 4) eq $charID) && (substr($msg, 10, 4) eq $sessionID) diff --git a/src/Poseidon/servertypes.txt b/src/Poseidon/servertypes.txt index d9d280ee84..8659d28085 100644 --- a/src/Poseidon/servertypes.txt +++ b/src/Poseidon/servertypes.txt @@ -46,4 +46,6 @@ charBlockSize 155 [twRO_2021-06-21] decrypt_mid 0 charBlockSize 155 -charListPacket 0x99d \ No newline at end of file +charListPacket 0x99d +character_ID_and_Map 0x0AC5 +maploginPacket 0x436 \ No newline at end of file From 957b517d605847c2c630f94047fe0f690363c1e9 Mon Sep 17 00:00:00 2001 From: ya4ept Date: Thu, 15 Jul 2021 04:21:18 +0300 Subject: [PATCH 06/32] replaced timestamp with hh:mm:cc --- src/Poseidon/QueryServer.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Poseidon/QueryServer.pm b/src/Poseidon/QueryServer.pm index 9c7fdae153..d2efbe27ef 100644 --- a/src/Poseidon/QueryServer.pm +++ b/src/Poseidon/QueryServer.pm @@ -20,6 +20,7 @@ use Poseidon::Config; use base qw(Base::Server); use Plugins; use Misc; +use Utils qw (getFormattedDateShort); my $CLASS = "Poseidon::QueryServer"; @@ -141,7 +142,7 @@ sub iterate { shift @{$queue}; } elsif (@{$queue} > 0 && $server->getState() eq 'ready') { - print "[PoseidonServer]-> Querying Ragnarok Online client [" . time . "]...\n"; + print "[PoseidonServer]-> Querying Ragnarok Online client [" . getFormattedDateShort(time, 1) . "]...\n"; $server->query($queue->[0]{packet}); } } From 632ad0db0a0a308c16e37703af661ece3ddf2a8a Mon Sep 17 00:00:00 2001 From: Alison Date: Thu, 15 Jul 2021 11:24:39 -0300 Subject: [PATCH 07/32] [Poseidon] update --- control/poseidon.txt | 2 +- src/Poseidon/RagnarokServer.pm | 95 ++++++++++++++++++---------- src/Poseidon/servertypes.txt | 109 +++++++++++++++++++++------------ 3 files changed, 134 insertions(+), 72 deletions(-) diff --git a/control/poseidon.txt b/control/poseidon.txt index bd07adefa5..378513f2bd 100644 --- a/control/poseidon.txt +++ b/control/poseidon.txt @@ -15,7 +15,7 @@ queryserver_port=24390 # to the poseidon operate properly ! # The available server types for now are : Default, bRO_.* (check servertypes.txt) # You should modify this if you're having problems with char list. -server_type=bRO_2016-11-08a +server_type=Default # Char Block Size # Here you can specify the desired CharBlockSize your client requires diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index 740f6ade7f..57b3ddf1e6 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -231,7 +231,8 @@ sub ParsePacket { # countries' clients (except probably oRO). The best way to support other clients would be: use a barebones # eAthena or Freya as the emulator, or figure out the correct packet switches and include them in the # if..elsif..else blocks. - if ($switch eq '01DB' || $switch eq '0204') { # client sends login packet 0204 packet thanks to elhazard + # still used in idRO 2021-07-15 + if ($switch eq '01DB' || $switch eq '0204') { # Secure Login # '01DC' => ['secure_login_key', 'x2 a*', [qw(secure_key)]], my $data = pack("v2", 0x01DC, 0x14) . pack("x17"); @@ -257,24 +258,31 @@ sub ParsePacket { $clientdata{$index}{secureLogin_requestCode} = getHex($code); } -# send account_server_info - } elsif (($switch eq '01DD') || ($switch eq '01FA') || ($switch eq '0064') || ($switch eq '0060') || ($switch eq '0277') || ($switch eq '02B0') || ($switch eq '0AAC') || ($switch eq '0ACF') || ($switch eq '0825')) { # 0064 packet thanks to abt123 - -# my $data = pack("C*", 0xAD, 0x02, 0x00, 0x00, 0x1E, 0x0A, 0x00, 0x00); -# $client->send($data); + } elsif ($switch eq '0ACF') { # Token Request + my $data; + # send Token + $data = pack("C*", 0xE3, 0x0A) . # header + pack("C*", 0x2F, 0x00) . # length + pack("l", "0") . # login_type + pack("Z20","S1000") . # flag + pack("Z*", "OpenkoreClientToken"); # login_token + $client->send($data); + + } elsif (($switch eq '0064') || ($switch eq '01DD') || ($switch eq '01FA') || ($switch eq '0277') || ($switch eq '02B0') || ($switch eq '0825') || ($switch eq '0987') || ($switch eq '0A76') || ($switch eq '0AAC') || ($switch eq '0B04')) { # master_login + # send account_server_info my $sex = 1; my $serverName = pack("a20", "Poseidon server"); # server name should be less than or equal to 20 characters my $serverUsers = pack("V", @{$self->clients()} - 1); my $data; - if ($switch eq '01FA') { + if ($switch eq '01FA') { # Secure Master Login $data = pack("v", 0x0069) . # header pack("v", 0x53) . # length $sessionID . $accountID . $sessionID2 . pack("x30") . pack("C1", $sex) . pack("x4") . pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . $port . $serverName . $serverUsers . pack("x2"); - } elsif ($switch eq '0AAC') { + } elsif ($switch eq '0AAC' || $self->{type}->{$config{server_type}}->{serverListPacket} eq '0x0AC9') { $data = pack("v", 0x0AC9) . # header pack("v", 0xCF) . # length $sessionID . $accountID . $sessionID2 . @@ -287,13 +295,7 @@ sub ParsePacket { pack("C*", 0x80, 0x32) . # ?? pack("a*", $host.":".$self->getPort()) . # ip:port pack("x114"); # fill with 00 - } elsif ($switch eq '0ACF') { #kRO Zero Token - $data = pack("v", 0x0AE3) . # header - pack("v", 0x2F) . # length - pack("l", "0") . # login_type - pack("Z20","S1000") . # flag - pack("Z*", "OpenkoreClientToken"); # login_token - } elsif ($switch eq '0064') { # received twRO + } elsif ($self->{type}->{$config{server_type}}->{serverListPacket} eq '0x0B60') { # received twRO $serverUsers = pack("v", @{$self->clients()} - 1); $data = pack("v", 0x0B60) . # header pack("v", 0xE4) . # length @@ -310,7 +312,7 @@ sub ParsePacket { pack("v", 0x6985) . # property pack("x128").# ip_port pack("x4"); # unknown - } elsif ($switch eq '0825') { # received kRO Zero Token + } elsif ($switch eq '0825' || $self->{type}->{$config{server_type}}->{serverListPacket} eq '0x0AC4') { # received kRO Zero Token $data = pack("v", 0x0AC4) . # header pack("v", 0xE0) . # length $sessionID . $accountID . $sessionID2 . @@ -323,6 +325,9 @@ sub ParsePacket { $serverName . $serverUsers . pack("x130"); + } elsif($self->{type}->{$config{server_type}}->{serverListPacket} eq '0x0276') { # tRO + # TODO: + # '0276' => ['account_server_info', 'v a4 a4 a4 a4 Z26 C V a*', [qw(len sessionID accountID sessionID2 lastLoginIP lastLoginTime accountSex iAccountSID serverInfo)]], } else { $data = pack("v", 0x0069) . # header pack("v", 0x4F) . # length @@ -335,8 +340,39 @@ sub ParsePacket { $client->send($data); # save servers.txt info - $clientdata{$index}{version} = unpack("V", substr($msg, 2, 4)); - $clientdata{$index}{master_version} = unpack("C", substr($msg, length($msg) - 1, 1)); + $clientdata{$index}{masterLogin_packet} = $switch; + + if (($switch eq '0064') || ($switch eq '01DD') || ($switch eq '0987') || ($switch eq '0AAC')) { + # '0064' => ['master_login', 'V Z24 Z24 C', [qw(version username password master_version)]] + # '01DD' => ['master_login', 'V Z24 a16 C', [qw(version username password_salted_md5 master_version)]], + # '0987' => ['master_login', 'V Z24 a32 C', [qw(version username password_md5_hex master_version)]] + # '0AAC' => ['master_login', 'V Z30 a32 C', [qw(version username password_hex master_version)]] + $clientdata{$index}{version} = unpack("V", substr($msg, 2, 4)); + $clientdata{$index}{master_version} = unpack("C", substr($msg, length($msg) - 1, 1)); + } elsif ($switch eq '01FA') { + # '01FA' => ['master_login', 'V Z24 a16 C C', [qw(version username password_salted_md5 master_version clientInfo)]], + $clientdata{$index}{version} = unpack("V", substr($msg, 2, 4)); + $clientdata{$index}{master_version} = unpack("C", substr($msg, length($msg) - 2, 1)); + } elsif ($switch eq '0825') { + # '0825' => ['token_login', 'v v x v Z24 a27 Z17 Z15 a*', [qw(len version master_version username password_rijndael mac ip token)]] + $clientdata{$index}{version} = unpack("v", substr($msg, 4, 2)); + $clientdata{$index}{master_version} = unpack("v", substr($msg, 7, 2)); + } elsif ( ($switch eq '0A76') || ($switch eq '0B04') ) { + # '0A76' => ['master_login', 'V Z40 a32 v', [qw(version username password_rijndael master_version)]] + # '0B04' => ['master_login', 'V Z30 Z52 Z100 v', [qw(version username accessToken billingAccessToken master_version)]] + $clientdata{$index}{version} = unpack("V", substr($msg, 2, 4)); + $clientdata{$index}{master_version} = unpack("v", substr($msg, length($msg) - 2, 2)); + } elsif ($switch eq '02B0') { + # '02B0' => ['master_login', 'V Z24 a24 C Z16 Z14 C', [qw(version username password_rijndael master_version ip mac isGravityID)]], + $clientdata{$index}{version} = unpack("V", substr($msg, 2, 4)); + $clientdata{$index}{master_version} = unpack("C", substr($msg, 53, 1)); + } else { + # '0277' => ?? + # unknown packet, cant get version/master version, should we use defaults? + $clientdata{$index}{version} = 55; + $clientdata{$index}{master_version} = 1; + } + if ($switch eq '01DD') { $clientdata{$index}{secureLogin} = 1; undef $clientdata{$index}{secureLogin_account}; @@ -349,19 +385,10 @@ sub ParsePacket { undef $clientdata{$index}{secureLogin_account}; undef $clientdata{$index}{secureLogin_requestCode}; } - if (($switch ne '01DD') && ($switch ne '01FA') && ($switch ne '0064')) { - $clientdata{$index}{masterLogin_packet} = $switch; - } else { - undef $clientdata{$index}{masterLogin_packet}; - } - if($switch eq '02B0') { # kRO uses 02B2 as masterLogin packet when we have 0 in the clientinfo.xml - # if other servers do use this packet too that will be a problem. - $clientdata{$index}{kRO} = 1; - } -# send characters_info + # send characters_info } elsif (($switch eq '0065') || ($switch eq '0275') || ($msg =~ /^$packed_switch$accountID$sessionID$sessionID2\x0\x0.$/)) { # client sends server choice packet - if ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x99d') { + if ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x099D') { my $data; $data = $accountID; $client->send($data); @@ -613,7 +640,6 @@ sub ParsePacket { ### Check if packet 0228 got tangled up with the sync packet if (uc(unpack("H2", substr($msg, 7, 1))) . uc(unpack("H2", substr($msg, 6, 1))) eq '0228') { - # queue the response (thanks abt123) $self->{response} = pack("v", $packet_id) . substr($msg, 8, length($msg)-2); $self->{state} = 'requested'; } @@ -923,7 +949,7 @@ sub SendCharacterList my $data; if ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x82d') { $data = $accountID . pack("v2 C5 a20", 0x082d, $len + 29,$totalchars,0,0,0,$totalchars,-0); # 29 = v2 C5 a20 size for bRO - } elsif ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x99d') { + } elsif ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x099D') { $data = pack("v", 0x099D) . pack("v", $len + 4); } else { @@ -941,7 +967,7 @@ sub SendCharacterList $name = "Poseidon"; $str = 1; $agi = 1; $vit = 1; $int = 1; $dex = 1; $luk = 1; $exp = 1; $zeny = 1; $jobExp = 1; $jobLevel = 50; $slot = 0; $rename = 0; # Preparing Character 1 Block - if ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x99d') { + if ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x099D') { $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairColor,$clothesColor,stringToBytes($name),$str,$agi,$vit,$int,$dex,$luk,$slot,$rename, 0, $map, "", $sex); } else { $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairColor,$clothesColor,$name,$str,$agi,$vit,$int,$dex,$luk,$slot,$rename); @@ -955,7 +981,7 @@ sub SendCharacterList $name = "Poseidon Dev"; $str = 1; $agi = 1; $vit = 1; $int = 1; $dex = 1; $luk = 1; $exp = 1; $zeny = 1; $jobExp = 1; $jobLevel = 50; $slot = 1; $rename = 0; # Preparing Character 2 Block - if ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x99d') { + if ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x099D') { $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairColor,$clothesColor,stringToBytes($name),$str,$agi,$vit,$int,$dex,$luk,$slot,$rename, 0, $map, "", $sex); } else { $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairColor,$clothesColor,$name,$str,$agi,$vit,$int,$dex,$luk,$slot,$rename); @@ -1170,3 +1196,6 @@ sub PerformMapLoadedTasks 1; +# 0064 packet thanks to abt123 +# 0204 packet thanks to elhazard +# queue the response (thanks abt123) \ No newline at end of file diff --git a/src/Poseidon/servertypes.txt b/src/Poseidon/servertypes.txt index 8659d28085..8cc88a3968 100644 --- a/src/Poseidon/servertypes.txt +++ b/src/Poseidon/servertypes.txt @@ -1,51 +1,84 @@ [Default] decrypt_mid 0 -charBlockSize 116 -charListPacket 0x6b -maploginPacket 0000 - -[bRO_2016-11-01a] -decrypt_mid 1 -decrypt_mid_keys 0x6D9253BB 0x7DB60BB3 0x3AD51C28 -charBlockSize 124 -charListPacket 0x82d -maploginPacket 0870 +decrypt_mid_keys +serverListPacket +charListPacket 0x099D +charBlockSize 155 +charIDandMapPacket 0x0AC5 +maploginPacket 0x0436 +actorListPacket 0x09FF +inventoryPacket 0x0B08 +skillsListPacket 0x010F +itemExistsPacket 0x009D -[bRO_2016-11-08a] -decrypt_mid 1 -decrypt_mid_keys 0x17AC78C2 0x1ADE5C66 0x2A84793C -charBlockSize 124 -charListPacket 0x82d -maploginPacket 088E +[cRO_2021-07-xx] +decrypt_mid 0 +serverListPacket 0x0AC9 +charListPacket 0x099D +charBlockSize 155 +charIDandMapPacket 0x0AC5 +maploginPacket 0x0436 +actorListPacket 0x09FF +inventoryPacket 0x0B08 +skillsListPacket 0x010F +itemExistsPacket 0x0ADD -[tRO_2013-07-09a] -decrypt_mid 1 -decrypt_mid_keys 0x6441767a 0x71020102 0x48c21f02 -charBlockSize 144 +[vRO_2021-07-07] +decrypt_mid 0 +serverListPacket 0x0AC9 +charListPacket 0x099D +charBlockSize 155 +charIDandMapPacket 0x0AC5 +maploginPacket 0x0436 +actorListPacket 0x09FF +inventoryPacket 0x0B08 +skillsListPacket +itemExistsPacket -[cRO_2017-12-13a] -decrypt_mid 1 +[twRO_2021-06-21] +decrypt_mid 0 +serverListPacket 0x0B60 +charListPacket 0x099D charBlockSize 155 -charListPacket 0x99d -maploginPacket 0x436 +charIDandMapPacket 0x0AC5 +maploginPacket 0x0436 +actorListPacket 0x09FF +inventoryPacket 0x0B08 +skillsListPacket +itemExistsPacket -[kRO_2018-01-03a] -decrypt_mid 1 -decrypt_mid_keys 0x2A3D4E64 0x69FF066F 0x7008690C -charListPacket 0x99d -maploginPacket 0958 +[kRO_2021-07] +decrypt_mid 0 +serverListPacket 0x0AC4 +charListPacket 0x0B72 charBlockSize 155 +charIDandMapPacket 0x0AC5 +maploginPacket 0x0436 +actorListPacket 0x09FF +inventoryPacket +skillsListPacket 0x0B32 +itemExistsPacket -[kRO_2018-02-07a] -decrypt_mid 1 -decrypt_mid_keys 0x07CB29CB 0x69CB69CB 0x69CB69CB -charListPacket 0x99d -maploginPacket 022D +[kRO_Zero_2021-07] +decrypt_mid 0 +serverListPacket 0x0AC4 +charListPacket 0x099D charBlockSize 155 +charIDandMapPacket 0x0AC5 +maploginPacket 0x0436 +actorListPacket 0x09FF +inventoryPacket 0x0B08 +skillsListPacket 0x0B32 +itemExistsPacket -[twRO_2021-06-21] +[jRO_2021-07-xx] decrypt_mid 0 +serverListPacket +charListPacket 0x099D charBlockSize 155 -charListPacket 0x99d -character_ID_and_Map 0x0AC5 -maploginPacket 0x436 \ No newline at end of file +charIDandMapPacket 0x0AC5 +maploginPacket 0x0436 +actorListPacket +inventoryPacket +skillsListPacket +itemExistsPacket \ No newline at end of file From dd121403168cb3b9e3b608bb34426eb5b42b7544 Mon Sep 17 00:00:00 2001 From: Alison Date: Thu, 15 Jul 2021 12:18:05 -0300 Subject: [PATCH 08/32] update date of kRO ragexe in poseidon --- src/Poseidon/servertypes.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Poseidon/servertypes.txt b/src/Poseidon/servertypes.txt index 8cc88a3968..bb81b93c0c 100644 --- a/src/Poseidon/servertypes.txt +++ b/src/Poseidon/servertypes.txt @@ -47,7 +47,7 @@ inventoryPacket 0x0B08 skillsListPacket itemExistsPacket -[kRO_2021-07] +[kRO_2021-06-30] decrypt_mid 0 serverListPacket 0x0AC4 charListPacket 0x0B72 @@ -59,7 +59,7 @@ inventoryPacket skillsListPacket 0x0B32 itemExistsPacket -[kRO_Zero_2021-07] +[kRO_Zero_2021-06-30] decrypt_mid 0 serverListPacket 0x0AC4 charListPacket 0x099D From 7e1d117d8bdb6cab7f211546e81ef553e1292432 Mon Sep 17 00:00:00 2001 From: Alison Date: Thu, 15 Jul 2021 12:18:24 -0300 Subject: [PATCH 09/32] Add support to 0276 packet --- src/Poseidon/RagnarokServer.pm | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index 57b3ddf1e6..9102750b8f 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -325,9 +325,14 @@ sub ParsePacket { $serverName . $serverUsers . pack("x130"); - } elsif($self->{type}->{$config{server_type}}->{serverListPacket} eq '0x0276') { # tRO - # TODO: - # '0276' => ['account_server_info', 'v a4 a4 a4 a4 Z26 C V a*', [qw(len sessionID accountID sessionID2 lastLoginIP lastLoginTime accountSex iAccountSID serverInfo)]], + } elsif($switch eq '0A76' || $self->{type}->{$config{server_type}}->{serverListPacket} eq '0x0276') { # tRO + $data = pack("v", 0x0276) . # header + pack("v", 0x63) . # length + $sessionID . $accountID . $sessionID2 . + pack("x30") . pack("C1", $sex) . + pack("x4") . + pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . + $port . $serverName . pack("x2") . $serverUsers . pack("x6"); } else { $data = pack("v", 0x0069) . # header pack("v", 0x4F) . # length @@ -373,6 +378,8 @@ sub ParsePacket { $clientdata{$index}{master_version} = 1; } + $clientdata{$index}{masterLogin_packet} = $switch; + if ($switch eq '01DD') { $clientdata{$index}{secureLogin} = 1; undef $clientdata{$index}{secureLogin_account}; @@ -406,11 +413,7 @@ sub ParsePacket { SendCharacterList($self, $client, $msg, $index); # save servers.txt info - if ($switch ne '0065') { - $clientdata{$index}{gameLogin_packet} = $switch; - } else { - undef $clientdata{$index}{gameLogin_packet}; - } + $clientdata{$index}{gameLogin_packet} = $switch; } elsif ($switch eq '09A1') { SendCharacterList($self, $client, $msg, $index); From 5d33010df61f95f420be8771ce83efee0f0444ba Mon Sep 17 00:00:00 2001 From: ya4ept Date: Thu, 15 Jul 2021 20:11:48 +0300 Subject: [PATCH 10/32] fix header --- src/Poseidon/RagnarokServer.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index 9102750b8f..54bc695029 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -261,13 +261,13 @@ sub ParsePacket { } elsif ($switch eq '0ACF') { # Token Request my $data; # send Token - $data = pack("C*", 0xE3, 0x0A) . # header - pack("C*", 0x2F, 0x00) . # length + $data = pack("v", 0x0AE3) . # header + pack("v", 0x2F) . # length pack("l", "0") . # login_type pack("Z20","S1000") . # flag pack("Z*", "OpenkoreClientToken"); # login_token $client->send($data); - + } elsif (($switch eq '0064') || ($switch eq '01DD') || ($switch eq '01FA') || ($switch eq '0277') || ($switch eq '02B0') || ($switch eq '0825') || ($switch eq '0987') || ($switch eq '0A76') || ($switch eq '0AAC') || ($switch eq '0B04')) { # master_login # send account_server_info my $sex = 1; @@ -331,7 +331,7 @@ sub ParsePacket { $sessionID . $accountID . $sessionID2 . pack("x30") . pack("C1", $sex) . pack("x4") . - pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . + pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . $port . $serverName . pack("x2") . $serverUsers . pack("x6"); } else { $data = pack("v", 0x0069) . # header @@ -346,7 +346,7 @@ sub ParsePacket { # save servers.txt info $clientdata{$index}{masterLogin_packet} = $switch; - + if (($switch eq '0064') || ($switch eq '01DD') || ($switch eq '0987') || ($switch eq '0AAC')) { # '0064' => ['master_login', 'V Z24 Z24 C', [qw(version username password master_version)]] # '01DD' => ['master_login', 'V Z24 a16 C', [qw(version username password_salted_md5 master_version)]], @@ -1201,4 +1201,4 @@ sub PerformMapLoadedTasks # 0064 packet thanks to abt123 # 0204 packet thanks to elhazard -# queue the response (thanks abt123) \ No newline at end of file +# queue the response (thanks abt123) From 9158e69f40209fe4f5bfc88f52ff68d6ec3dddbd Mon Sep 17 00:00:00 2001 From: Alison Date: Thu, 15 Jul 2021 14:21:29 -0300 Subject: [PATCH 11/32] poseidon update map login packets add some more config to servertypes.txt --- src/Poseidon/RagnarokServer.pm | 39 ++++++++++++++++++---------------- src/Poseidon/servertypes.txt | 16 +++++++++++++- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index 54bc695029..4916ea2078 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -395,7 +395,7 @@ sub ParsePacket { # send characters_info } elsif (($switch eq '0065') || ($switch eq '0275') || ($msg =~ /^$packed_switch$accountID$sessionID$sessionID2\x0\x0.$/)) { # client sends server choice packet - if ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x099D') { + if ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x099D' || $self->{type}->{$config{server_type}}->{charListPacket} eq '0x0B72') { my $data; $data = $accountID; $client->send($data); @@ -597,10 +597,10 @@ sub ParsePacket { (substr($msg, 6, 4) eq $charID) && (substr($msg, 10, 4) eq $sessionID) ) { # client sends the maplogin packet + $clientdata{$index}{serverType} = 0; + + SendMapLogin($self, $client, $msg, $index); - $client->send(pack("v a4", 0x0283, $accountID)); - # mapLogin packet - $client->send(pack("v", 0x2EB) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05) . pack("C*", 0x05, 0x05)); $client->{connectedToMap} = 1; } elsif ($msg =~ /^$packed_switch/ @@ -955,6 +955,9 @@ sub SendCharacterList } elsif ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x099D') { $data = pack("v", 0x099D) . pack("v", $len + 4); + } elsif ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x0B72') { + $data = pack("v", 0x0B72) . + pack("v", $len + 4); } else { $data = $accountID . pack("v v C3", 0x006b, $len + 7, $totalslots, -1, -1); } @@ -1002,24 +1005,24 @@ sub SendCharacterList sub SendMapLogin { my ($self, $client, $msg, $index) = @_; - # '0073' => ['map_loaded','x4 a3',[qw(coords)]] - my $data; - if ( $config{server_type} =~ /^kRO/ ) { # kRO Zero - $data .= pack("C*", 0x83, 0x02) . $accountID; #accountID - $client->send($data); - - $data = pack("C*", 0xDE, 0x0A, 0x46, 0x00, 0x00, 0x00); # idk '-' - $client->send($data); - - $data = pack("C*", 0xEB, 0x02) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05, 0x00, 0x00); # map loaded - $client->send($data); + $client->send(pack("v a4", 0x0283, $accountID)); + # mapLogin packet + if ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x0A18') { + # '0A18' => ['map_loaded', 'V a3 C2 v C', [qw(syncMapSync coords xSize ySize font sex)]], # 14 + $client->send(pack("v", 0x02EB) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05) . pack("C*", 0x05, 0x05)); + } elsif ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x02EB') { + # '02EB' => ['map_loaded', 'V a3 a a v', [qw(syncMapSync coords xSize ySize font)]], # 13 + $client->send(pack("v", 0x02EB) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05) . pack("C*", 0x05, 0x05)); } else { - if ( $config{server_type} !~ /^bRO/ ) { $data .= $accountID; } #<- This is Server Type Based !! - $data = pack("C*", 0x73, 0x00) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05); - $client->send($data); + # '0073' => ['map_loaded','x4 a3',[qw(coords)]] + $client->send(pack("v", 0x0073) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05); } + if ( $config{server_type} =~ /^kRO/ ) { # kRO + $client->send(pack("C*", 0xDE, 0x0A, 0x46, 0x00, 0x00, 0x00)); # Overweight percent + } + if ($clientdata{$index}{mode}) { $data = pack("C2 v1", 0x0F, 0x01, 226) . # skillID targetType level sp range skillName diff --git a/src/Poseidon/servertypes.txt b/src/Poseidon/servertypes.txt index bb81b93c0c..05c0ee3bfd 100644 --- a/src/Poseidon/servertypes.txt +++ b/src/Poseidon/servertypes.txt @@ -10,6 +10,8 @@ actorListPacket 0x09FF inventoryPacket 0x0B08 skillsListPacket 0x010F itemExistsPacket 0x009D +expandedItemID 1 +mapLoadedPacket 0x02EB [cRO_2021-07-xx] decrypt_mid 0 @@ -22,6 +24,8 @@ actorListPacket 0x09FF inventoryPacket 0x0B08 skillsListPacket 0x010F itemExistsPacket 0x0ADD +expandedItemID 1 +mapLoadedPacket 0x02EB [vRO_2021-07-07] decrypt_mid 0 @@ -34,6 +38,8 @@ actorListPacket 0x09FF inventoryPacket 0x0B08 skillsListPacket itemExistsPacket +expandedItemID 1 +mapLoadedPacket 0x02EB [twRO_2021-06-21] decrypt_mid 0 @@ -46,6 +52,8 @@ actorListPacket 0x09FF inventoryPacket 0x0B08 skillsListPacket itemExistsPacket +expandedItemID 1 +mapLoadedPacket 0x02EB [kRO_2021-06-30] decrypt_mid 0 @@ -58,6 +66,8 @@ actorListPacket 0x09FF inventoryPacket skillsListPacket 0x0B32 itemExistsPacket +expandedItemID 1 +mapLoadedPacket 0x02EB [kRO_Zero_2021-06-30] decrypt_mid 0 @@ -70,6 +80,8 @@ actorListPacket 0x09FF inventoryPacket 0x0B08 skillsListPacket 0x0B32 itemExistsPacket +expandedItemID 1 +mapLoadedPacket 0x02EB [jRO_2021-07-xx] decrypt_mid 0 @@ -81,4 +93,6 @@ maploginPacket 0x0436 actorListPacket inventoryPacket skillsListPacket -itemExistsPacket \ No newline at end of file +itemExistsPacket +expandedItemID +mapLoadedPacket \ No newline at end of file From 12d73c6b61a5c6d5ced88cd1c56ff33def3e6201 Mon Sep 17 00:00:00 2001 From: Alison Date: Thu, 15 Jul 2021 14:43:50 -0300 Subject: [PATCH 12/32] poseidon use packet names --- src/Poseidon/RagnarokServer.pm | 36 ++++----- src/Poseidon/servertypes.txt | 142 ++++++++++++++++----------------- 2 files changed, 89 insertions(+), 89 deletions(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index 4916ea2078..9245c64276 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -282,7 +282,7 @@ sub ParsePacket { pack("x30") . pack("C1", $sex) . pack("x4") . pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . $port . $serverName . $serverUsers . pack("x2"); - } elsif ($switch eq '0AAC' || $self->{type}->{$config{server_type}}->{serverListPacket} eq '0x0AC9') { + } elsif ($switch eq '0AAC' || $self->{type}->{$config{server_type}}->{account_server_info} eq '0x0AC9') { $data = pack("v", 0x0AC9) . # header pack("v", 0xCF) . # length $sessionID . $accountID . $sessionID2 . @@ -295,7 +295,7 @@ sub ParsePacket { pack("C*", 0x80, 0x32) . # ?? pack("a*", $host.":".$self->getPort()) . # ip:port pack("x114"); # fill with 00 - } elsif ($self->{type}->{$config{server_type}}->{serverListPacket} eq '0x0B60') { # received twRO + } elsif ($self->{type}->{$config{server_type}}->{account_server_info} eq '0x0B60') { # received twRO $serverUsers = pack("v", @{$self->clients()} - 1); $data = pack("v", 0x0B60) . # header pack("v", 0xE4) . # length @@ -312,7 +312,7 @@ sub ParsePacket { pack("v", 0x6985) . # property pack("x128").# ip_port pack("x4"); # unknown - } elsif ($switch eq '0825' || $self->{type}->{$config{server_type}}->{serverListPacket} eq '0x0AC4') { # received kRO Zero Token + } elsif ($switch eq '0825' || $self->{type}->{$config{server_type}}->{account_server_info} eq '0x0AC4') { # received kRO Zero Token $data = pack("v", 0x0AC4) . # header pack("v", 0xE0) . # length $sessionID . $accountID . $sessionID2 . @@ -325,7 +325,7 @@ sub ParsePacket { $serverName . $serverUsers . pack("x130"); - } elsif($switch eq '0A76' || $self->{type}->{$config{server_type}}->{serverListPacket} eq '0x0276') { # tRO + } elsif($switch eq '0A76' || $self->{type}->{$config{server_type}}->{account_server_info} eq '0x0276') { # tRO $data = pack("v", 0x0276) . # header pack("v", 0x63) . # length $sessionID . $accountID . $sessionID2 . @@ -395,7 +395,7 @@ sub ParsePacket { # send characters_info } elsif (($switch eq '0065') || ($switch eq '0275') || ($msg =~ /^$packed_switch$accountID$sessionID$sessionID2\x0\x0.$/)) { # client sends server choice packet - if ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x099D' || $self->{type}->{$config{server_type}}->{charListPacket} eq '0x0B72') { + if ($self->{type}->{$config{server_type}}->{received_characters} eq '0x099D' || $self->{type}->{$config{server_type}}->{received_characters} eq '0x0B72') { my $data; $data = $accountID; $client->send($data); @@ -420,10 +420,10 @@ sub ParsePacket { } elsif ($switch eq '0066') { # client sends character choice packet # If Using Packet Encrypted Client - if ( $self->{type}->{$config{server_type}}->{decrypt_mid_keys} ) + if ( $self->{type}->{$config{server_type}}->{sendCryptKeys} ) { # Enable Decryption - my @enc_values = split(/\s+/, $self->{type}->{$config{server_type}}->{decrypt_mid_keys}); + my @enc_values = split(/\s+/, $self->{type}->{$config{server_type}}->{sendCryptKeys}); ($enc_val1, $enc_val2, $enc_val3) = (Math::BigInt->new(@enc_values[0]), Math::BigInt->new(@enc_values[1]), Math::BigInt->new(@enc_values[2])); } @@ -432,7 +432,7 @@ sub ParsePacket { $clientdata{$index}{mode} = unpack('C1', substr($msg, 2, 1)); - if ($self->{type}->{$config{server_type}}->{character_ID_and_Map} eq '0x0AC5') { + if ($self->{type}->{$config{server_type}}->{received_character_ID_and_Map} eq '0x0AC5') { # '0AC5' => ['received_character_ID_and_Map', 'a4 Z16 a4 v a128', [qw(charID mapName mapIP mapPort mapUrl)]], my $mapName = pack("a16", "moc_prydb1.gat"); my $data = pack("v", 0x0AC5) . $charID . $mapName . @@ -448,7 +448,7 @@ sub ParsePacket { $client->send($data); } - } elsif ($switch eq $self->{type}->{$config{server_type}}->{maploginPacket} && + } elsif ($switch eq $self->{type}->{$config{server_type}}->{map_login} && (length($msg) == 19) && (substr($msg, 2, 4) eq $accountID) && (substr($msg, 6, 4) eq $charID) && @@ -591,7 +591,7 @@ sub ParsePacket { # save servers.txt info $clientdata{$index}{serverType} = "1 or 2"; - } elsif (($switch eq '0436' || $switch eq '022D' || $switch eq $self->{type}->{$config{server_type}}->{maploginPacket}) && + } elsif (($switch eq '0436' || $switch eq '022D' || $switch eq $self->{type}->{$config{server_type}}->{map_login}) && (length($msg) == 19 || length($msg) == 23) && (substr($msg, 2, 4) eq $accountID) && (substr($msg, 6, 4) eq $charID) && @@ -620,7 +620,7 @@ sub ParsePacket { my $data; # Temporary Hack to Initialized Crypted Client - if ( $self->{type}->{$config{server_type}}->{decrypt_mid_keys} ) + if ( $self->{type}->{$config{server_type}}->{sendCryptKeys} ) { for ( my $i = 0 ; $i < 64 ; $i++ ) { @@ -950,12 +950,12 @@ sub SendCharacterList # Preparing Begin of Character List Packet my $data; - if ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x82d') { + if ($self->{type}->{$config{server_type}}->{received_characters} eq '0x82d') { $data = $accountID . pack("v2 C5 a20", 0x082d, $len + 29,$totalchars,0,0,0,$totalchars,-0); # 29 = v2 C5 a20 size for bRO - } elsif ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x099D') { + } elsif ($self->{type}->{$config{server_type}}->{received_characters} eq '0x099D') { $data = pack("v", 0x099D) . pack("v", $len + 4); - } elsif ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x0B72') { + } elsif ($self->{type}->{$config{server_type}}->{received_characters} eq '0x0B72') { $data = pack("v", 0x0B72) . pack("v", $len + 4); } else { @@ -973,7 +973,7 @@ sub SendCharacterList $name = "Poseidon"; $str = 1; $agi = 1; $vit = 1; $int = 1; $dex = 1; $luk = 1; $exp = 1; $zeny = 1; $jobExp = 1; $jobLevel = 50; $slot = 0; $rename = 0; # Preparing Character 1 Block - if ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x099D') { + if ($self->{type}->{$config{server_type}}->{received_characters} eq '0x099D') { $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairColor,$clothesColor,stringToBytes($name),$str,$agi,$vit,$int,$dex,$luk,$slot,$rename, 0, $map, "", $sex); } else { $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairColor,$clothesColor,$name,$str,$agi,$vit,$int,$dex,$luk,$slot,$rename); @@ -987,7 +987,7 @@ sub SendCharacterList $name = "Poseidon Dev"; $str = 1; $agi = 1; $vit = 1; $int = 1; $dex = 1; $luk = 1; $exp = 1; $zeny = 1; $jobExp = 1; $jobLevel = 50; $slot = 1; $rename = 0; # Preparing Character 2 Block - if ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x099D') { + if ($self->{type}->{$config{server_type}}->{received_characters} eq '0x099D') { $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairColor,$clothesColor,stringToBytes($name),$str,$agi,$vit,$int,$dex,$luk,$slot,$rename, 0, $map, "", $sex); } else { $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairColor,$clothesColor,$name,$str,$agi,$vit,$int,$dex,$luk,$slot,$rename); @@ -1008,10 +1008,10 @@ sub SendMapLogin { $client->send(pack("v a4", 0x0283, $accountID)); # mapLogin packet - if ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x0A18') { + if ($self->{type}->{$config{server_type}}->{map_loaded} eq '0x0A18') { # '0A18' => ['map_loaded', 'V a3 C2 v C', [qw(syncMapSync coords xSize ySize font sex)]], # 14 $client->send(pack("v", 0x02EB) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05) . pack("C*", 0x05, 0x05)); - } elsif ($self->{type}->{$config{server_type}}->{charListPacket} eq '0x02EB') { + } elsif ($self->{type}->{$config{server_type}}->{map_loaded} eq '0x02EB') { # '02EB' => ['map_loaded', 'V a3 a a v', [qw(syncMapSync coords xSize ySize font)]], # 13 $client->send(pack("v", 0x02EB) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05) . pack("C*", 0x05, 0x05)); } else { diff --git a/src/Poseidon/servertypes.txt b/src/Poseidon/servertypes.txt index 05c0ee3bfd..7568646f8c 100644 --- a/src/Poseidon/servertypes.txt +++ b/src/Poseidon/servertypes.txt @@ -1,98 +1,98 @@ [Default] -decrypt_mid 0 -decrypt_mid_keys -serverListPacket -charListPacket 0x099D +sendCrypt 0 +sendCryptKeys +account_server_info +received_characters 0x099D charBlockSize 155 -charIDandMapPacket 0x0AC5 -maploginPacket 0x0436 -actorListPacket 0x09FF -inventoryPacket 0x0B08 -skillsListPacket 0x010F -itemExistsPacket 0x009D +received_character_ID_and_Map 0x0AC5 +map_login 0x0436 +map_loaded 0x02EB +skills_list 0x010F +actor_exists 0x09FF +item_list_start 0x0B08 +item_exists 0x009D expandedItemID 1 -mapLoadedPacket 0x02EB [cRO_2021-07-xx] -decrypt_mid 0 -serverListPacket 0x0AC9 -charListPacket 0x099D +sendCrypt 0 +account_server_info 0x0AC9 +received_characters 0x099D charBlockSize 155 -charIDandMapPacket 0x0AC5 -maploginPacket 0x0436 -actorListPacket 0x09FF -inventoryPacket 0x0B08 -skillsListPacket 0x010F -itemExistsPacket 0x0ADD +received_character_ID_and_Map 0x0AC5 +map_login 0x0436 +map_loaded 0x02EB +skills_list 0x010F +actor_exists 0x09FF +item_list_start 0x0B08 +item_exists 0x0ADD expandedItemID 1 -mapLoadedPacket 0x02EB [vRO_2021-07-07] -decrypt_mid 0 -serverListPacket 0x0AC9 -charListPacket 0x099D +sendCrypt 0 +account_server_info 0x0AC9 +received_characters 0x099D charBlockSize 155 -charIDandMapPacket 0x0AC5 -maploginPacket 0x0436 -actorListPacket 0x09FF -inventoryPacket 0x0B08 -skillsListPacket -itemExistsPacket +received_character_ID_and_Map 0x0AC5 +map_login 0x0436 +map_loaded 0x02EB +skills_list +actor_exists 0x09FF +item_list_start 0x0B08 +item_exists expandedItemID 1 -mapLoadedPacket 0x02EB [twRO_2021-06-21] -decrypt_mid 0 -serverListPacket 0x0B60 -charListPacket 0x099D +sendCrypt 0 +account_server_info 0x0B60 +received_characters 0x099D charBlockSize 155 -charIDandMapPacket 0x0AC5 -maploginPacket 0x0436 -actorListPacket 0x09FF -inventoryPacket 0x0B08 -skillsListPacket -itemExistsPacket +received_character_ID_and_Map 0x0AC5 +map_login 0x0436 +map_loaded 0x02EB +skills_list +actor_exists 0x09FF +item_list_start 0x0B08 +item_exists expandedItemID 1 -mapLoadedPacket 0x02EB [kRO_2021-06-30] -decrypt_mid 0 -serverListPacket 0x0AC4 -charListPacket 0x0B72 +sendCrypt 0 +account_server_info 0x0AC4 +received_characters 0x0B72 charBlockSize 155 -charIDandMapPacket 0x0AC5 -maploginPacket 0x0436 -actorListPacket 0x09FF -inventoryPacket -skillsListPacket 0x0B32 -itemExistsPacket +received_character_ID_and_Map 0x0AC5 +map_login 0x0436 +map_loaded 0x02EB +skills_list 0x0B32 +actor_exists 0x09FF +item_list_start +item_exists expandedItemID 1 -mapLoadedPacket 0x02EB [kRO_Zero_2021-06-30] -decrypt_mid 0 -serverListPacket 0x0AC4 -charListPacket 0x099D +sendCrypt 0 +account_server_info 0x0AC4 +received_characters 0x099D charBlockSize 155 -charIDandMapPacket 0x0AC5 -maploginPacket 0x0436 -actorListPacket 0x09FF -inventoryPacket 0x0B08 -skillsListPacket 0x0B32 -itemExistsPacket +received_character_ID_and_Map 0x0AC5 +map_login 0x0436 +map_loaded 0x02EB +skills_list 0x0B32 +actor_exists 0x09FF +item_list_start 0x0B08 +item_exists expandedItemID 1 -mapLoadedPacket 0x02EB [jRO_2021-07-xx] -decrypt_mid 0 -serverListPacket -charListPacket 0x099D +sendCrypt 0 +account_server_info +received_characters 0x099D charBlockSize 155 -charIDandMapPacket 0x0AC5 -maploginPacket 0x0436 -actorListPacket -inventoryPacket -skillsListPacket -itemExistsPacket +received_character_ID_and_Map 0x0AC5 +map_login 0x0436 +map_loaded +actor_exists +skills_list +item_list_start +item_exists expandedItemID -mapLoadedPacket \ No newline at end of file From 96e2fb6443ccade23155da5d35ba5d1cfc421bbf Mon Sep 17 00:00:00 2001 From: Alison Date: Thu, 15 Jul 2021 14:55:11 -0300 Subject: [PATCH 13/32] poseidon replace 0x --- src/Poseidon/RagnarokServer.pm | 28 +++++----- src/Poseidon/servertypes.txt | 98 +++++++++++++++++----------------- 2 files changed, 63 insertions(+), 63 deletions(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index 9245c64276..75f9ed2194 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -282,7 +282,7 @@ sub ParsePacket { pack("x30") . pack("C1", $sex) . pack("x4") . pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . $port . $serverName . $serverUsers . pack("x2"); - } elsif ($switch eq '0AAC' || $self->{type}->{$config{server_type}}->{account_server_info} eq '0x0AC9') { + } elsif ($switch eq '0AAC' || $self->{type}->{$config{server_type}}->{account_server_info} eq '0AC9') { $data = pack("v", 0x0AC9) . # header pack("v", 0xCF) . # length $sessionID . $accountID . $sessionID2 . @@ -295,7 +295,7 @@ sub ParsePacket { pack("C*", 0x80, 0x32) . # ?? pack("a*", $host.":".$self->getPort()) . # ip:port pack("x114"); # fill with 00 - } elsif ($self->{type}->{$config{server_type}}->{account_server_info} eq '0x0B60') { # received twRO + } elsif ($self->{type}->{$config{server_type}}->{account_server_info} eq '0B60') { # received twRO $serverUsers = pack("v", @{$self->clients()} - 1); $data = pack("v", 0x0B60) . # header pack("v", 0xE4) . # length @@ -312,7 +312,7 @@ sub ParsePacket { pack("v", 0x6985) . # property pack("x128").# ip_port pack("x4"); # unknown - } elsif ($switch eq '0825' || $self->{type}->{$config{server_type}}->{account_server_info} eq '0x0AC4') { # received kRO Zero Token + } elsif ($switch eq '0825' || $self->{type}->{$config{server_type}}->{account_server_info} eq '0AC4') { # received kRO Zero Token $data = pack("v", 0x0AC4) . # header pack("v", 0xE0) . # length $sessionID . $accountID . $sessionID2 . @@ -325,7 +325,7 @@ sub ParsePacket { $serverName . $serverUsers . pack("x130"); - } elsif($switch eq '0A76' || $self->{type}->{$config{server_type}}->{account_server_info} eq '0x0276') { # tRO + } elsif($switch eq '0A76' || $self->{type}->{$config{server_type}}->{account_server_info} eq '0276') { # tRO $data = pack("v", 0x0276) . # header pack("v", 0x63) . # length $sessionID . $accountID . $sessionID2 . @@ -395,7 +395,7 @@ sub ParsePacket { # send characters_info } elsif (($switch eq '0065') || ($switch eq '0275') || ($msg =~ /^$packed_switch$accountID$sessionID$sessionID2\x0\x0.$/)) { # client sends server choice packet - if ($self->{type}->{$config{server_type}}->{received_characters} eq '0x099D' || $self->{type}->{$config{server_type}}->{received_characters} eq '0x0B72') { + if ($self->{type}->{$config{server_type}}->{received_characters} eq '099D' || $self->{type}->{$config{server_type}}->{received_characters} eq '0B72') { my $data; $data = $accountID; $client->send($data); @@ -432,7 +432,7 @@ sub ParsePacket { $clientdata{$index}{mode} = unpack('C1', substr($msg, 2, 1)); - if ($self->{type}->{$config{server_type}}->{received_character_ID_and_Map} eq '0x0AC5') { + if ($self->{type}->{$config{server_type}}->{received_character_ID_and_Map} eq '0AC5') { # '0AC5' => ['received_character_ID_and_Map', 'a4 Z16 a4 v a128', [qw(charID mapName mapIP mapPort mapUrl)]], my $mapName = pack("a16", "moc_prydb1.gat"); my $data = pack("v", 0x0AC5) . $charID . $mapName . @@ -950,12 +950,12 @@ sub SendCharacterList # Preparing Begin of Character List Packet my $data; - if ($self->{type}->{$config{server_type}}->{received_characters} eq '0x82d') { + if ($self->{type}->{$config{server_type}}->{received_characters} eq '082D') { $data = $accountID . pack("v2 C5 a20", 0x082d, $len + 29,$totalchars,0,0,0,$totalchars,-0); # 29 = v2 C5 a20 size for bRO - } elsif ($self->{type}->{$config{server_type}}->{received_characters} eq '0x099D') { + } elsif ($self->{type}->{$config{server_type}}->{received_characters} eq '099D') { $data = pack("v", 0x099D) . pack("v", $len + 4); - } elsif ($self->{type}->{$config{server_type}}->{received_characters} eq '0x0B72') { + } elsif ($self->{type}->{$config{server_type}}->{received_characters} eq '0B72') { $data = pack("v", 0x0B72) . pack("v", $len + 4); } else { @@ -973,7 +973,7 @@ sub SendCharacterList $name = "Poseidon"; $str = 1; $agi = 1; $vit = 1; $int = 1; $dex = 1; $luk = 1; $exp = 1; $zeny = 1; $jobExp = 1; $jobLevel = 50; $slot = 0; $rename = 0; # Preparing Character 1 Block - if ($self->{type}->{$config{server_type}}->{received_characters} eq '0x099D') { + if ($self->{type}->{$config{server_type}}->{received_characters} eq '099D') { $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairColor,$clothesColor,stringToBytes($name),$str,$agi,$vit,$int,$dex,$luk,$slot,$rename, 0, $map, "", $sex); } else { $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairColor,$clothesColor,$name,$str,$agi,$vit,$int,$dex,$luk,$slot,$rename); @@ -987,7 +987,7 @@ sub SendCharacterList $name = "Poseidon Dev"; $str = 1; $agi = 1; $vit = 1; $int = 1; $dex = 1; $luk = 1; $exp = 1; $zeny = 1; $jobExp = 1; $jobLevel = 50; $slot = 1; $rename = 0; # Preparing Character 2 Block - if ($self->{type}->{$config{server_type}}->{received_characters} eq '0x099D') { + if ($self->{type}->{$config{server_type}}->{received_characters} eq '099D') { $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairColor,$clothesColor,stringToBytes($name),$str,$agi,$vit,$int,$dex,$luk,$slot,$rename, 0, $map, "", $sex); } else { $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairColor,$clothesColor,$name,$str,$agi,$vit,$int,$dex,$luk,$slot,$rename); @@ -1008,10 +1008,10 @@ sub SendMapLogin { $client->send(pack("v a4", 0x0283, $accountID)); # mapLogin packet - if ($self->{type}->{$config{server_type}}->{map_loaded} eq '0x0A18') { + if ($self->{type}->{$config{server_type}}->{map_loaded} eq '0A18') { # '0A18' => ['map_loaded', 'V a3 C2 v C', [qw(syncMapSync coords xSize ySize font sex)]], # 14 $client->send(pack("v", 0x02EB) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05) . pack("C*", 0x05, 0x05)); - } elsif ($self->{type}->{$config{server_type}}->{map_loaded} eq '0x02EB') { + } elsif ($self->{type}->{$config{server_type}}->{map_loaded} eq '02EB') { # '02EB' => ['map_loaded', 'V a3 a a v', [qw(syncMapSync coords xSize ySize font)]], # 13 $client->send(pack("v", 0x02EB) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05) . pack("C*", 0x05, 0x05)); } else { @@ -1020,7 +1020,7 @@ sub SendMapLogin { } if ( $config{server_type} =~ /^kRO/ ) { # kRO - $client->send(pack("C*", 0xDE, 0x0A, 0x46, 0x00, 0x00, 0x00)); # Overweight percent + $client->send(pack("v", 0x0ADE) . pack("V", 0x00); } if ($clientdata{$index}{mode}) { diff --git a/src/Poseidon/servertypes.txt b/src/Poseidon/servertypes.txt index 7568646f8c..0409817942 100644 --- a/src/Poseidon/servertypes.txt +++ b/src/Poseidon/servertypes.txt @@ -2,94 +2,94 @@ sendCrypt 0 sendCryptKeys account_server_info -received_characters 0x099D +received_characters 099D charBlockSize 155 -received_character_ID_and_Map 0x0AC5 -map_login 0x0436 -map_loaded 0x02EB -skills_list 0x010F -actor_exists 0x09FF -item_list_start 0x0B08 -item_exists 0x009D +received_character_ID_and_Map 0AC5 +map_login 0436 +map_loaded 02EB +skills_list 010F +actor_exists 09FF +item_list_start 0B08 +item_exists 009D expandedItemID 1 [cRO_2021-07-xx] sendCrypt 0 -account_server_info 0x0AC9 -received_characters 0x099D +account_server_info 0AC9 +received_characters 099D charBlockSize 155 -received_character_ID_and_Map 0x0AC5 -map_login 0x0436 -map_loaded 0x02EB -skills_list 0x010F -actor_exists 0x09FF -item_list_start 0x0B08 -item_exists 0x0ADD +received_character_ID_and_Map 0AC5 +map_login 0436 +map_loaded 02EB +skills_list 010F +actor_exists 09FF +item_list_start 0B08 +item_exists 0ADD expandedItemID 1 [vRO_2021-07-07] sendCrypt 0 -account_server_info 0x0AC9 -received_characters 0x099D +account_server_info 0AC9 +received_characters 099D charBlockSize 155 -received_character_ID_and_Map 0x0AC5 -map_login 0x0436 -map_loaded 0x02EB +received_character_ID_and_Map 0AC5 +map_login 0436 +map_loaded 02EB skills_list -actor_exists 0x09FF -item_list_start 0x0B08 +actor_exists 09FF +item_list_start 0B08 item_exists expandedItemID 1 [twRO_2021-06-21] sendCrypt 0 -account_server_info 0x0B60 -received_characters 0x099D +account_server_info 0B60 +received_characters 099D charBlockSize 155 -received_character_ID_and_Map 0x0AC5 -map_login 0x0436 -map_loaded 0x02EB +received_character_ID_and_Map 0AC5 +map_login 0436 +map_loaded 02EB skills_list -actor_exists 0x09FF -item_list_start 0x0B08 +actor_exists 09FF +item_list_start 0B08 item_exists expandedItemID 1 [kRO_2021-06-30] sendCrypt 0 -account_server_info 0x0AC4 -received_characters 0x0B72 +account_server_info 0AC4 +received_characters 0B72 charBlockSize 155 -received_character_ID_and_Map 0x0AC5 -map_login 0x0436 -map_loaded 0x02EB -skills_list 0x0B32 -actor_exists 0x09FF +received_character_ID_and_Map 0AC5 +map_login 0436 +map_loaded 02EB +skills_list 0B32 +actor_exists 09FF item_list_start item_exists expandedItemID 1 [kRO_Zero_2021-06-30] sendCrypt 0 -account_server_info 0x0AC4 -received_characters 0x099D +account_server_info 0AC4 +received_characters 099D charBlockSize 155 -received_character_ID_and_Map 0x0AC5 -map_login 0x0436 -map_loaded 0x02EB -skills_list 0x0B32 -actor_exists 0x09FF -item_list_start 0x0B08 +received_character_ID_and_Map 0AC5 +map_login 0436 +map_loaded 02EB +skills_list 0B32 +actor_exists 09FF +item_list_start 0B08 item_exists expandedItemID 1 [jRO_2021-07-xx] sendCrypt 0 account_server_info -received_characters 0x099D +received_characters 099D charBlockSize 155 -received_character_ID_and_Map 0x0AC5 -map_login 0x0436 +received_character_ID_and_Map 0AC5 +map_login 0436 map_loaded actor_exists skills_list From cafcb725082e59399f1be7c12d8d56db3a8f651b Mon Sep 17 00:00:00 2001 From: ya4ept Date: Thu, 15 Jul 2021 21:07:55 +0300 Subject: [PATCH 14/32] fix "0ADE" package (overweight_percent) --- src/Network/Receive.pm | 1 + src/Network/Receive/ServerType0.pm | 2 +- src/Network/Receive/kRO/Sakexe_0.pm | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Network/Receive.pm b/src/Network/Receive.pm index 09c284dab7..d8f42c6094 100644 --- a/src/Network/Receive.pm +++ b/src/Network/Receive.pm @@ -9031,6 +9031,7 @@ sub skill_update { #TODO ! sub overweight_percent { my ($self, $args) = @_; + debug "Received overweight percent: $args->{percent}\n"; } sub partylv_info { diff --git a/src/Network/Receive/ServerType0.pm b/src/Network/Receive/ServerType0.pm index a2182391ed..1a4bc44239 100644 --- a/src/Network/Receive/ServerType0.pm +++ b/src/Network/Receive/ServerType0.pm @@ -698,7 +698,7 @@ sub new { '0ACD' => ['login_error', 'C Z20', [qw(type date)]], '0ADA' => ['refine_status', 'Z24 V C C', [qw(name itemID refine_level status)]], '0ADC' => ['misc_config', 'C4', [qw(show_eq_flag call_flag pet_autofeed_flag homunculus_autofeed_flag)]], - '0ADE' => ['overweight_percent', 'v V', [qw(len percent)]],#TODO + '0ADE' => ['overweight_percent', 'V', [qw(percent)]],# 6 TODO '0ADF' => ['actor_info', 'a4 a4 Z24 Z24', [qw(ID charID name prefix_name)]], '0ADD' => ['item_appeared', 'a4 v2 C v2 C2 v C v', [qw(ID nameID type identified x y subx suby amount show_effect effect_type )]], '0AE0' => ['login_error', 'V V Z20', [qw(type error date)]], diff --git a/src/Network/Receive/kRO/Sakexe_0.pm b/src/Network/Receive/kRO/Sakexe_0.pm index 96a39220a8..d806118f1c 100644 --- a/src/Network/Receive/kRO/Sakexe_0.pm +++ b/src/Network/Receive/kRO/Sakexe_0.pm @@ -684,7 +684,7 @@ sub new { '0ADA' => ['refine_status', 'Z24 V C C', [qw(name itemID refine_level status)]], '0ADC' => ['misc_config', 'C4', [qw(show_eq_flag call_flag pet_autofeed_flag homunculus_autofeed_flag)]], '0ADD' => ['item_appeared', 'a4 v2 C v2 C2 v C v', [qw(ID nameID type identified x y subx suby amount show_effect effect_type )]], - '0ADE' => ['overweight_percent', 'v V', [qw(len percent)]],#TODO + '0ADE' => ['overweight_percent', 'V', [qw(percent)]],# 6 TODO '0ADF' => ['actor_info', 'a4 a4 Z24 Z24', [qw(ID charID name prefix_name)]], '0AE0' => ['login_error', 'V V Z20', [qw(type error date)]], '0AE2' => ['open_ui', 'C V', [qw(type data)]], From eeff28966edad985ae8de0b17331ce70746967f7 Mon Sep 17 00:00:00 2001 From: Alison Date: Thu, 15 Jul 2021 15:19:47 -0300 Subject: [PATCH 15/32] fix typo --- src/Poseidon/RagnarokServer.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index 75f9ed2194..b61087355e 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -1016,13 +1016,14 @@ sub SendMapLogin { $client->send(pack("v", 0x02EB) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05) . pack("C*", 0x05, 0x05)); } else { # '0073' => ['map_loaded','x4 a3',[qw(coords)]] - $client->send(pack("v", 0x0073) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05); + $client->send(pack("v", 0x0073) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05)); } if ( $config{server_type} =~ /^kRO/ ) { # kRO - $client->send(pack("v", 0x0ADE) . pack("V", 0x00); - } - + $client->send(pack("v", 0x0ADE) . pack("V", 0x00)); + } + + my $data; if ($clientdata{$index}{mode}) { $data = pack("C2 v1", 0x0F, 0x01, 226) . # skillID targetType level sp range skillName From d44c6426cea7877079e78bf9d30eca1a8ba61f32 Mon Sep 17 00:00:00 2001 From: Alison Date: Thu, 15 Jul 2021 16:39:52 -0300 Subject: [PATCH 16/32] poseidon fix charblocksize --- src/Poseidon/RagnarokServer.pm | 35 ++++++++++++++++++++-------------- src/Poseidon/servertypes.txt | 2 +- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index b61087355e..0343fbdc03 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -928,12 +928,14 @@ sub SendCharacterList # Character Block Pack String my $packstring = ''; - $packstring = 'a4 Z8 V Z8 V6 v V2 v4 V v9 Z24 C8 v a16 Z16 C' if $blocksize == 155; - $packstring = 'a4 V9 v V2 v4 V v9 Z24 C8 v a16 Z16 C' if $blocksize == 147; - $packstring = 'a4 V9 v V2 v14 Z24 C8 v Z16 V x4 x4 x4 C' if $blocksize == 145; - $packstring = 'a4 V9 v V2 v14 Z24 C8 v Z16 V x4 x4 x4' if $blocksize == 144; - $packstring = 'a4 V9 v V2 v14 Z24 C8 v Z16 V x4 x4' if $blocksize == 140; - $packstring = 'a4 V9 v V2 v14 Z24 C8 v Z16 V x4' if $blocksize == 136; + $packstring = 'a4 V2 V V2 V6 v V2 V2 V2 V2 v2 V v9 Z24 C8 v Z16 V4 C' if $blocksize == 175; + $packstring = 'a4 Z8 V Z8 V6 v V2 v4 V v9 Z24 C8 v Z16 V4 C' if $blocksize == 155; + $packstring = 'a4 V9 v V2 v4 V v9 Z24 C8 v Z16 V4 C' if $blocksize == 147; + $packstring = 'a4 V9 v V2 v4 V v9 Z24 C8 v Z16 V4' if $blocksize == 146; + $packstring = 'a4 V9 v V2 v14 Z24 C8 v Z16 V4 C' if $blocksize == 145; + $packstring = 'a4 V9 v V2 v14 Z24 C8 v Z16 V4' if $blocksize == 144; + $packstring = 'a4 V9 v V2 v14 Z24 C8 v Z16 V3' if $blocksize == 140; + $packstring = 'a4 V9 v V2 v14 Z24 C8 v Z16 V2' if $blocksize == 136; $packstring = 'a4 V9 v V2 v14 Z24 C8 v Z16 V' if $blocksize == 132; $packstring = 'a4 V9 v V2 v14 Z24 C8 v Z16' if $blocksize == 128; $packstring = 'a4 V9 v V2 v14 Z24 C8 v Z12' if $blocksize == 124; @@ -946,7 +948,7 @@ sub SendCharacterList if ( length($packstring) == 0 ) { print "Unknown CharBlockSize : $blocksize\n"; return; } # Character Block Format - my($cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairColor,$clothesColor,$name,$str,$agi,$vit,$int,$dex,$luk,$slot,$rename) = 0; + my($cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairPallete,$hairColor,$clothesColor,$name,$str,$agi,$vit,$int,$dex,$luk,$slot,$rename,$robe,$slotAddon,$renameAddon) = 0; # Preparing Begin of Character List Packet my $data; @@ -969,14 +971,16 @@ sub SendCharacterList my $map = "moc_prydb1.gat"; # Filling Character 1 Block - $cID = $charID; $hp = 10000; $maxHp = 10000; $sp = 10000; $maxSp = 10000; $hairstyle = 1; $level = 99; $headTop = 0; $hairColor = 6; + $cID = $charID; $hp = 10000; $maxHp = 10000; $sp = 10000; $maxSp = 10000; $hairstyle = 1; $level = 99; $headTop = 0; $hairColor = 6; $hairPallete = 0; $name = "Poseidon"; $str = 1; $agi = 1; $vit = 1; $int = 1; $dex = 1; $luk = 1; $exp = 1; $zeny = 1; $jobExp = 1; $jobLevel = 50; $slot = 0; $rename = 0; # Preparing Character 1 Block - if ($self->{type}->{$config{server_type}}->{received_characters} eq '099D') { - $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairColor,$clothesColor,stringToBytes($name),$str,$agi,$vit,$int,$dex,$luk,$slot,$rename, 0, $map, "", $sex); + if ($self->{type}->{$config{server_type}}->{received_characters} eq '0B72') { + $block = pack($packstring,$cID,$exp,0,$zeny,$jobExp,0,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,0,$maxHp,0,$sp,0,$maxSp,0,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairPallete,$clothesColor,stringToBytes($name),$str,$agi,$vit,$int,$dex,$luk,$slot,$hairColor,$rename,$map,"",$robe,$slotAddon,$renameAddon,$sex); + } elsif ($self->{type}->{$config{server_type}}->{received_characters} eq '099D') { + $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairPallete,$clothesColor,stringToBytes($name),$str,$agi,$vit,$int,$dex,$luk,$slot,$hairColor,$rename,$map,"",$robe,$slotAddon,$renameAddon,$sex); } else { - $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairColor,$clothesColor,$name,$str,$agi,$vit,$int,$dex,$luk,$slot,$rename); + $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairPallete,$clothesColor,$name,$str,$agi,$vit,$int,$dex,$luk,$slot,$hairColor,$rename); } # Attaching Block @@ -987,10 +991,12 @@ sub SendCharacterList $name = "Poseidon Dev"; $str = 1; $agi = 1; $vit = 1; $int = 1; $dex = 1; $luk = 1; $exp = 1; $zeny = 1; $jobExp = 1; $jobLevel = 50; $slot = 1; $rename = 0; # Preparing Character 2 Block - if ($self->{type}->{$config{server_type}}->{received_characters} eq '099D') { - $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairColor,$clothesColor,stringToBytes($name),$str,$agi,$vit,$int,$dex,$luk,$slot,$rename, 0, $map, "", $sex); + if ($self->{type}->{$config{server_type}}->{received_characters} eq '0B72') { + $block = pack($packstring,$cID,$exp,0,$zeny,$jobExp,0,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,0,$maxHp,0,$sp,0,$maxSp,0,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairPallete,$clothesColor,stringToBytes($name),$str,$agi,$vit,$int,$dex,$luk,$slot,$hairColor,$rename,$map,"",$robe,$slotAddon,$renameAddon,$sex); + } elsif ($self->{type}->{$config{server_type}}->{received_characters} eq '099D') { + $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairPallete,$clothesColor,stringToBytes($name),$str,$agi,$vit,$int,$dex,$luk,$slot,$hairColor,$rename,$map,"",$robe,$slotAddon,$renameAddon,$sex); } else { - $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairColor,$clothesColor,$name,$str,$agi,$vit,$int,$dex,$luk,$slot,$rename); + $block = pack($packstring,$cID,$exp,$zeny,$jobExp,$jobLevel,$opt1,$opt2,$option,$stance,$manner,$statpt,$hp,$maxHp,$sp,$maxSp,$walkspeed,$jobId,$hairstyle,$weapon,$level,$skillpt,$headLow,$shield,$headTop,$headMid,$hairPallete,$clothesColor,$name,$str,$agi,$vit,$int,$dex,$luk,$slot,$hairColor,$rename); } # Attaching Block @@ -998,6 +1004,7 @@ sub SendCharacterList # Measuring Size of Block print "Wanted CharBlockSize : $blocksize\n"; + print "Packstring size: ".length(pack($packstring))."\n"; print "Built CharBlockSize : " . length($block) . "\n"; $client->send($data); } diff --git a/src/Poseidon/servertypes.txt b/src/Poseidon/servertypes.txt index 0409817942..805a9d0afc 100644 --- a/src/Poseidon/servertypes.txt +++ b/src/Poseidon/servertypes.txt @@ -59,7 +59,7 @@ expandedItemID 1 sendCrypt 0 account_server_info 0AC4 received_characters 0B72 -charBlockSize 155 +charBlockSize 175 received_character_ID_and_Map 0AC5 map_login 0436 map_loaded 02EB From 626d272a8e8d419a28055a3c270c91920252c69b Mon Sep 17 00:00:00 2001 From: Alison Date: Thu, 15 Jul 2021 17:32:10 -0300 Subject: [PATCH 17/32] change initial map 53 111 is the novice ground start, somewhere in the time someone changed the map --- src/Poseidon/RagnarokServer.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index 0343fbdc03..fada8d35c7 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -434,7 +434,7 @@ sub ParsePacket { if ($self->{type}->{$config{server_type}}->{received_character_ID_and_Map} eq '0AC5') { # '0AC5' => ['received_character_ID_and_Map', 'a4 Z16 a4 v a128', [qw(charID mapName mapIP mapPort mapUrl)]], - my $mapName = pack("a16", "moc_prydb1.gat"); + my $mapName = pack("a16", "new_1-1.gat"); my $data = pack("v", 0x0AC5) . $charID . $mapName . pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . $port . pack("x128"); # mapUrl @@ -442,7 +442,7 @@ sub ParsePacket { } else { # '0071' => ['received_character_ID_and_Map', 'a4 Z16 a4 v1', [qw(charID mapName mapIP mapPort)]], - my $mapName = pack("a16", "moc_prydb1.gat"); + my $mapName = pack("a16", "new_1-1.gat"); my $data = pack("v", 0x0071) . $charID . $mapName . pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . $port; $client->send($data); @@ -968,7 +968,7 @@ sub SendCharacterList my $block; my $sex = 1; - my $map = "moc_prydb1.gat"; + my $map = "new_1-1.gat"; # Filling Character 1 Block $cID = $charID; $hp = 10000; $maxHp = 10000; $sp = 10000; $maxSp = 10000; $hairstyle = 1; $level = 99; $headTop = 0; $hairColor = 6; $hairPallete = 0; From e926dc0057a6fddf853ef449a31d121fa4c4ddb5 Mon Sep 17 00:00:00 2001 From: Alison Date: Fri, 16 Jul 2021 02:57:55 -0300 Subject: [PATCH 18/32] poseidon update and fix debug packets --- src/Poseidon/RagnarokServer.pm | 147 ++++++++++++++++++++++++--------- src/Poseidon/servertypes.txt | 20 ++--- 2 files changed, 112 insertions(+), 55 deletions(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index fada8d35c7..2f96d419c5 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -636,7 +636,8 @@ sub ParsePacket { ( ( ($switch eq '007E') || ($switch eq '035F') ) && (($clientdata{$index}{serverType} == 0) || ($clientdata{$index}{serverType} == 1) || ($clientdata{$index}{serverType} == 2) || ($clientdata{$index}{serverType} == 6) || ($clientdata{$index}{serverType} == 7) || ($clientdata{$index}{serverType} == 10) || ($clientdata{$index}{serverType} == 11))) || (($switch eq '0089') && (($clientdata{$index}{serverType} == 3) || ($clientdata{$index}{serverType} == 5) || ($clientdata{$index}{serverType} == 8) || ($clientdata{$index}{serverType} == 9))) || (($switch eq '0116') && ($clientdata{$index}{serverType} == 4)) || - (($switch eq '00A7') && ($clientdata{$index}{serverType} == 12)) + (($switch eq '00A7') && ($clientdata{$index}{serverType} == 12)) || + ($switch eq '0360') ) { # client sends sync packet my $data = pack("C*", 0x7F, 0x00) . pack("V", getTickCount); $client->send($data); @@ -857,6 +858,10 @@ sub ParsePacket { SendNpcImageShow($self, $client, $msg, $index, "kafra_04.bmp", 0xFF); } + } elsif ($switch eq '0B1C') { # pong packet (keep-alive) + $client->send(pack("v", 0x0B1D)); + } elsif ($switch eq '01C0') { # Remaining time?? + # $client->send(pack("v V3", 0x01C0, 0xFF, 0xFF, 0xFF)); } elsif ($clientdata{$index}{mode}) { if (($switch eq '00F7' || $switch eq '0193') && (length($msg) == 2)) { # storage close @@ -1014,10 +1019,14 @@ sub SendMapLogin { $client->send(pack("v a4", 0x0283, $accountID)); + if ( $config{server_type} =~ /^kRO/ ) { # kRO + $client->send(pack("v", 0x0ADE) . pack("V", 0x00)); + } + # mapLogin packet if ($self->{type}->{$config{server_type}}->{map_loaded} eq '0A18') { # '0A18' => ['map_loaded', 'V a3 C2 v C', [qw(syncMapSync coords xSize ySize font sex)]], # 14 - $client->send(pack("v", 0x02EB) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05) . pack("C*", 0x05, 0x05)); + $client->send(pack("v", 0x0A18) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05) . pack("C*", 0x05, 0x05, 0x01)); } elsif ($self->{type}->{$config{server_type}}->{map_loaded} eq '02EB') { # '02EB' => ['map_loaded', 'V a3 a a v', [qw(syncMapSync coords xSize ySize font)]], # 13 $client->send(pack("v", 0x02EB) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05) . pack("C*", 0x05, 0x05)); @@ -1026,21 +1035,40 @@ sub SendMapLogin { $client->send(pack("v", 0x0073) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05)); } - if ( $config{server_type} =~ /^kRO/ ) { # kRO - $client->send(pack("v", 0x0ADE) . pack("V", 0x00)); - } - my $data; if ($clientdata{$index}{mode}) { - $data = pack("C2 v1", 0x0F, 0x01, 226) . - # skillID targetType level sp range skillName - pack("v2 x2 v3 a24 C1", 1, 0, 9, 0, 1, "NV_BASIC" . chr(0) . "GetMapInfo" . chr(0x0A), 0) . - pack("v2 x2 v3 a24 C1", 24, 4, 1, 10, 10, "AL_RUWACH", 0) . # self skill test - pack("v2 x2 v3 a24 C1", 25, 2, 1, 10, 9, "AL_PNEUMA", 0) . # location skill test - pack("v2 x2 v3 a24 C1", 26, 4, 2, 9, 1, "AL_TELEPORT", 0) . # self skill test - pack("v2 x2 v3 a24 C1", 27, 2, 4, 26, 9, "AL_WARP", 0) . # location skill test - pack("v2 x2 v3 a24 C1", 28, 16, 10, 40, 9, "AL_HEAL", 0); # target skill test - $client->send($data); + if ($self->{type}->{$config{server_type}}->{map_loaded} eq '0B32') { + $data = pack("v", 0x0B32). + pack("v", 94) . + # skillID targetType level sp range up lvl2 + pack("v V v3 C v", 1, 0, 9, 0, 1, 0, 0) . + pack("v V v3 C v", 24, 4, 1, 10, 10, 0, 0) . # self skill test + pack("v V v3 C v", 25, 2, 1, 10, 9, 0, 0) . # location skill test + pack("v V v3 C v", 26, 4, 2, 9, 1, 0, 0) . # self skill test + pack("v V v3 C v", 27, 2, 4, 26, 9, 0, 0) . # location skill test + pack("v V v3 C v", 28, 16, 10, 40, 9, 0, 0); # target skill test + $client->send($data); + } else { + $data = pack("C2 v1", 0x0F, 0x01, 226) . + # skillID targetType level sp range skillName + pack("v2 x2 v3 a24 C1", 1, 0, 9, 0, 1, "NV_BASIC" . chr(0) . "GetMapInfo" . chr(0x0A), 0) . + pack("v2 x2 v3 a24 C1", 24, 4, 1, 10, 10, "AL_RUWACH", 0) . # self skill test + pack("v2 x2 v3 a24 C1", 25, 2, 1, 10, 9, "AL_PNEUMA", 0) . # location skill test + pack("v2 x2 v3 a24 C1", 26, 4, 2, 9, 1, "AL_TELEPORT", 0) . # self skill test + pack("v2 x2 v3 a24 C1", 27, 2, 4, 26, 9, "AL_WARP", 0) . # location skill test + pack("v2 x2 v3 a24 C1", 28, 16, 10, 40, 9, "AL_HEAL", 0); # target skill test + $client->send($data); + } + } + + # '013A' => ['attack_range', 'v', [qw(type)]], + $client->send(pack("v2", , 0x013A, 1)); + + # '00BD' => ['stats_info', 'v C12 v14', [qw(points_free str points_str agi points_agi vit points_vit int points_int dex points_dex luk points_luk attack attack_bonus attack_magic_min attack_magic_max def def_bonus def_magic def_magic_bonus hit flee flee_bonus critical stance manner)]], # (stance manner) actually are (ASPD plusASPD) + $client->send(pack("v2 C12 v14", 0x00BD, 100, 99, 11, 99, 11, 99, 11, 99, 11, 99, 11, 99, 11, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 100, 190, 3)); + + if ( $config{server_type} =~ /^kRO/ ) { # kRO + $client->send(pack("v", 0x0B1B)); # load_confirm (unlock keyboard) } $client->{connectedToMap} = 1; @@ -1053,7 +1081,7 @@ sub SendGoToCharSelection # Log print "Requested Char Selection Screen\n"; - $client->send(pack("v v", 0xB3, 1)); + $client->send(pack("v v", 0x00B3, 1)); } sub SendQuitGame @@ -1063,7 +1091,7 @@ sub SendQuitGame # Log print "Requested Quit Game...\n"; - $client->send(pack("v v", 0x18B, 0)); + $client->send(pack("v v", 0x018B, 0)); } sub SendLookTo @@ -1071,16 +1099,34 @@ sub SendLookTo my ($self, $client, $msg, $index, $ID, $to) = @_; # Make Poseidon look to front - $client->send(pack('v1 a4 C1 x1 C1', 0x9C, $ID, 0, $to)); + $client->send(pack('v1 a4 C1 x1 C1', 0x009C, $ID, 0, $to)); } sub SendUnitInfo { - my ($self, $client, $msg, $index, $ID, $name) = @_; + my ($self, $client, $msg, $index, $ID, $name, $partyName, $guildName, $guildTitle, $titleID) = @_; # Let's not wait for the client to ask for the unit info - # '0095' => ['actor_info', 'a4 Z24', [qw(ID name)]], - $client->send(pack("v1 a4 a24", 0x95, $ID, $name)); + if ($self->{type}->{$config{server_type}}->{actor_info} eq '0B32') { + # '0A30' => ['actor_info', 'a4 Z24 Z24 Z24 Z24 V', [qw(ID name partyName guildName guildTitle titleID)]], + $client->send(pack("v a4 Z24 Z24 Z24 Z24 V", 0x0A30, $ID, $name, $partyName, $guildName, $guildTitle, $titleID)); + } else { + # '0195' => ['actor_info', 'a4 Z24 Z24 Z24 Z24', [qw(ID name partyName guildName guildTitle)]], + $client->send(pack("v1 a4 Z24 Z24 Z24 Z24", 0x0195, $ID, $name, $partyName, $guildName, $guildTitle)); + } +} + +sub SendUnitName +{ + my ($self, $client, $msg, $index, $ID, $name, $charID, $prefix_name) = @_; + + if ($self->{type}->{$config{server_type}}->{actor_name} eq '0ADF') { + # '0ADF' => ['actor_info', 'a4 a4 Z24 Z24', [qw(ID charID name prefix_name)]], + $client->send(pack("v1 a4 a24", 0x0ADF, $ID, $charID, $name, $prefix_name)); + } else { + # '0095' => ['actor_info', 'a4 Z24', [qw(ID name)]], + $client->send(pack("v1 a4 a24", 0x0095, $ID, $name)); + } } sub SendSystemChatMessage @@ -1088,7 +1134,7 @@ sub SendSystemChatMessage my ($self, $client, $msg, $index, $message) = @_; # '009A' => ['system_chat', 'v Z*', [qw(len message)]], - $client->send(pack("v2 a32", 0x9A, 36, $message)); + $client->send(pack("v2 a32", 0x009A, 36, $message)); } sub SendShowNPC @@ -1096,34 +1142,53 @@ sub SendShowNPC my ($self, $client, $msg, $index, $obj_type, $GID, $SpriteID, $X, $Y, $MobName) = @_; # Packet Structure - my ($object_type,$NPCID,$walk_speed,$opt1,$opt2,$option,$type,$hair_style,$weapon,$lowhead,$shield,$tophead,$midhead,$hair_color,$clothes_color,$head_dir,$guildID,$emblemID,$manner,$opt3,$stance,$sex,$xSize,$ySize,$lv,$font,$name) = 0; + my ($object_type,$NPCID,$AID,$walk_speed,$opt1,$opt2,$option,$type,$hair_style,$weapon,$lowhead,$shield,$tophead,$midhead,$hair_color,$clothes_color,$head_dir,$guildID,$emblemID,$manner,$opt3,$stance,$sex,$xSize,$ySize,$lv,$font,$name,$costume,$opt4,$state) = 0; # Building NPC Data $object_type = $obj_type; - $NPCID = $GID; + $NPCID = $AID = $GID; $walk_speed = 0x1BD; $type = $SpriteID; $lv = 1; $name = $MobName; + my $data; + if ($self->{type}->{$config{server_type}}->{actor_exists} eq '0078') { + $data = pack("v a4 v14 a4 a2 v2 C2 a3 C3 v", 0x0078, $NPCID, $walk_speed, $opt1, $opt2, $option, $type, $hair_style, $weapon, $shield, $lowhead, $tophead, $midhead, $hair_color, $clothes_color, $head_dir, $guildID, $emblemID, $manner, $opt3, $stance, $sex, getCoordString($X, $Y, 1), $xSize, $ySize, $state, $lv); + } elsif ($self->{type}->{$config{server_type}}->{actor_exists} eq '01D8') { + $data = pack("v a4 v14 a4 a2 v2 C2 a3 C3 v", 0x01D8, $NPCID, $walk_speed, $opt1, $opt2, $option, $type, $hair_style, $weapon, $shield, $lowhead, $tophead, $midhead, $hair_color, $clothes_color, $head_dir, $guildID, $emblemID, $manner, $opt3, $stance, $sex, getCoordString($X, $Y, 1), $xSize, $ySize, $state, $lv); + } elsif ($self->{type}->{$config{server_type}}->{actor_exists} eq '022A') { + $data = pack("v a4 v3 V v10 a4 a2 v V C2 a3 C3 v", 0x022A, $NPCID, $walk_speed, $opt1, $opt2, $option, $type, $hair_style, $weapon, $shield, $lowhead, $tophead, $midhead, $hair_color, $clothes_color, $head_dir, $guildID, $emblemID, $manner, $opt3, $stance, $sex, getCoordString($X, $Y, 1), $xSize, $ySize, $state, $lv); + } elsif ($self->{type}->{$config{server_type}}->{actor_exists} eq '02EE') { + $data = pack("v a4 v3 V v10 a4 a2 v V C2 a3 C3 v2", 0x02EE, $NPCID, $walk_speed, $opt1, $opt2, $option, $type, $hair_style, $weapon, $shield, $lowhead, $tophead, $midhead, $hair_color, $clothes_color, $head_dir, $guildID, $emblemID, $manner, $opt3, $stance, $sex, getCoordString($X, $Y, 1), $xSize, $ySize, $state, $lv, $font); + } elsif ($self->{type}->{$config{server_type}}->{actor_exists} eq '07F9') { + my $len = length(pack("v2 C a4 v3 V v10 a4 a2 v V C2 a3 C3 v2")) + length(stringToBytes($name)); + $data = pack("v2 C a4 v3 V v10 a4 a2 v V C2 a3 C3 v2 a*", 0x07F9, $len, $object_type, $NPCID, $walk_speed, $opt1, $opt2, $option, $type, $hair_style, $weapon, $shield, $lowhead, $tophead, $midhead, $hair_color, $clothes_color, $head_dir, $guildID, $emblemID, $manner, $opt3, $stance, $sex, getCoordString($X, $Y, 1), $xSize, $ySize, $state, $lv, $font, stringToBytes($name)); + } elsif ($self->{type}->{$config{server_type}}->{actor_exists} eq '0857') { + my $len = length(pack("v2 C a4 v3 V v2 V2 v7 a4 a2 v V C2 a3 C3 v2")) + length(stringToBytes($name)); + $data = pack("v2 C a4 v3 V v2 V2 v7 a4 a2 v V C2 a3 C3 v2 a*", 0x0857, $len, $object_type, $NPCID, $walk_speed, $opt1, $opt2, $option, $type, $hair_style, $weapon, $shield, $lowhead, $tophead, $midhead, $hair_color, $clothes_color, $head_dir, $costume, $guildID, $emblemID, $manner, $opt3, $stance, $sex, getCoordString($X, $Y, 1), $xSize, $ySize, $state, $lv, $font, stringToBytes($name)); + } elsif ($self->{type}->{$config{server_type}}->{actor_exists} eq '0915') { + my $len = length(pack("v2 C a4 v3 V v2 V2 v7 a4 a2 v V C2 a3 C3 v2 V2 C")) + length(stringToBytes($name)); + $data = pack("v2 C a4 v3 V v2 V2 v7 a4 a2 v V C2 a3 C3 v2 V2 C a*", 0x0915, $len, $object_type, $NPCID, $walk_speed, $opt1, $opt2, $option, $type, $hair_style, $weapon, $shield, $lowhead, $tophead, $midhead, $hair_color, $clothes_color, $head_dir, $costume, $guildID, $emblemID, $manner, $opt3, $stance, $sex, getCoordString($X, $Y, 1), $xSize, $ySize, $state, $lv, $font, 0xFFFFFFFF, 0xFFFFFFFF, 0, stringToBytes($name)); + } elsif ($self->{type}->{$config{server_type}}->{actor_exists} eq '09DD') { + my $len = length(pack("v2 C a4 a4 v3 V v2 V2 v7 a4 a2 v V C2 a3 C3 v2 V2 C")) + length(stringToBytes($name)); + $data = pack("v2 C a4 a4 v3 V v2 V2 v7 a4 a2 v V C2 a3 C3 v2 V2 C a*", 0x09DD, $len, $object_type, $NPCID, $AID, $walk_speed, $opt1, $opt2, $option, $type, $hair_style, $weapon, $shield, $lowhead, $tophead, $midhead, $hair_color, $clothes_color, $head_dir, $costume, $guildID, $emblemID, $manner, $opt3, $stance, $sex, getCoordString($X, $Y, 1), $xSize, $ySize, $state, $lv, $font, 0xFFFFFFFF, 0xFFFFFFFF, 0, stringToBytes($name)); + } else { + my $len = length(pack("v2 C a4 a4 v3 V v2 V2 v7 a4 a2 v V C2 a3 C3 v2 V2 C v")) + length(stringToBytes($name)); + $data = pack("v2 C a4 a4 v3 V v2 V2 v7 a4 a2 v V C2 a3 C3 v2 V2 C v a*", 0x09FF, $len, $object_type, $NPCID, $AID, $walk_speed, $opt1, $opt2, $option, $type, $hair_style, $weapon, $shield, $lowhead, $tophead, $midhead, $hair_color, $clothes_color, $head_dir, $costume, $guildID, $emblemID, $manner, $opt3, $stance, $sex, getCoordString($X, $Y, 1), $xSize, $ySize, $state, $lv, $font, 0xFFFFFFFF, 0xFFFFFFFF, 0, $opt4, stringToBytes($name)); + } - # '0856' => ['actor_exists', 'v C a4 v3 V v11 a4 a2 v V C2 a3 C3 v2 Z*', [qw(len object_type ID walk_speed opt1 opt2 option type hair_style weapon shield lowhead tophead midhead hair_color clothes_color head_dir costume guildID emblemID manner opt3 stance sex coords xSize ySize lv font name)]], # -1 # spawning provided by try71023 - my $dbuf; - if ( $config{server_type} !~ /^bRO/ ) { $dbuf .= pack("C", $object_type); } #<- This is Server Type Based !! - $dbuf .= pack("a4 v3 V v11 a4 a2 v V C2",$NPCID,$walk_speed,$opt1,$opt2,$option,$type,$hair_style,$weapon,$lowhead,$shield,$tophead,$midhead,$hair_color,$clothes_color,$head_dir,$guildID,$emblemID,$manner,$opt3,$stance,$sex); - $dbuf .= getCoordString($X, $Y, 1); - $dbuf .= pack("C2 v2",$xSize,$ySize,$lv,$font); - $dbuf .= pack("Z" . length($name),$name); - my $opcode; - if ( $config{server_type} !~ /^bRO/ ) { $opcode = 0x858; } #<- This is Server Type Based !! - $client->send(pack("v v",$opcode,length($dbuf) + 4) . $dbuf); + $client->send($data); } sub SendShowItemOnGround { my ($self, $client, $msg, $index, $ID, $SpriteID, $X, $Y) = @_; - # '009D' => ['item_exists', 'a4 v1 x1 v3', [qw(ID type x y amount)]] - $client->send(pack("v1 a4 v1 x1 v3 x2", 0x9D, $ID, $SpriteID, $posX + 1, $posY - 1, 1)); + if ($self->{type}->{$config{server_type}}->{expandedItemID} eq '1') { + $client->send(pack("v a4 V C v3 C2", 0x009D, $ID, $SpriteID, 1, $posX + 1, $posY - 1, 1, 0, 0)); + } else { + $client->send(pack("v a4 v C v3 C2", 0x009D, $ID, $SpriteID, 1, $posX + 1, $posY - 1, 1, 0, 0)); + } } sub SendNPCTalk @@ -1132,7 +1197,7 @@ sub SendNPCTalk # '00B4' => ['npc_talk', 'v a4 Z*', [qw(len ID msg)]] my $dbuf = pack("a" . length($message), $message); - $client->send(pack("v2 a4", 0xB4, (length($dbuf) + 8), $npcID) . $dbuf); + $client->send(pack("v2 a4", 0x00B4, (length($dbuf) + 8), $npcID) . $dbuf); } sub SendNPCTalkContinue @@ -1140,7 +1205,7 @@ sub SendNPCTalkContinue my ($self, $client, $msg, $index, $npcID) = @_; # '00B5' => ['npc_talk_continue', 'a4', [qw(ID)]] - $client->send(pack("v a4", 0xB5, $npcID)); + $client->send(pack("v a4", 0x00B5, $npcID)); } sub SendNpcTalkClose @@ -1148,7 +1213,7 @@ sub SendNpcTalkClose my ($self, $client, $msg, $index, $npcID) = @_; # '00B6' => ['npc_talk_close', 'a4', [qw(ID)]] - $client->send(pack("v a4", 0xB6, $npcID)); + $client->send(pack("v a4", 0x00B6, $npcID)); } sub SendNpcTalkResponses @@ -1157,7 +1222,7 @@ sub SendNpcTalkResponses # '00B7' => ['npc_talk', 'v a4 Z*', [qw(len ID msg)]] my $dbuf = pack("a" . length($message), $message); - $client->send(pack("v2 a4", 0xB7, (length($dbuf) + 8), $npcID) . $dbuf); + $client->send(pack("v2 a4", 0x00B7, (length($dbuf) + 8), $npcID) . $dbuf); } sub SendNpcImageShow @@ -1167,7 +1232,7 @@ sub SendNpcImageShow # Type = 0xFF = Hide Image # Type = 0x02 = Show Image # '01B3' => ['npc_image', 'Z64 C', [qw(npc_image type)]] - $client->send(pack("v a64 C1", 0x1B3, $image, $type)); + $client->send(pack("v a64 C1", 0x01B3, $image, $type)); } # SERVER TASKS diff --git a/src/Poseidon/servertypes.txt b/src/Poseidon/servertypes.txt index 805a9d0afc..85401b1415 100644 --- a/src/Poseidon/servertypes.txt +++ b/src/Poseidon/servertypes.txt @@ -1,5 +1,4 @@ [Default] -sendCrypt 0 sendCryptKeys account_server_info received_characters 099D @@ -10,11 +9,11 @@ map_loaded 02EB skills_list 010F actor_exists 09FF item_list_start 0B08 -item_exists 009D expandedItemID 1 +actor_info 0A30 +actor_name 0095 [cRO_2021-07-xx] -sendCrypt 0 account_server_info 0AC9 received_characters 099D charBlockSize 155 @@ -24,11 +23,9 @@ map_loaded 02EB skills_list 010F actor_exists 09FF item_list_start 0B08 -item_exists 0ADD expandedItemID 1 [vRO_2021-07-07] -sendCrypt 0 account_server_info 0AC9 received_characters 099D charBlockSize 155 @@ -38,11 +35,9 @@ map_loaded 02EB skills_list actor_exists 09FF item_list_start 0B08 -item_exists expandedItemID 1 [twRO_2021-06-21] -sendCrypt 0 account_server_info 0B60 received_characters 099D charBlockSize 155 @@ -52,11 +47,9 @@ map_loaded 02EB skills_list actor_exists 09FF item_list_start 0B08 -item_exists expandedItemID 1 [kRO_2021-06-30] -sendCrypt 0 account_server_info 0AC4 received_characters 0B72 charBlockSize 175 @@ -66,11 +59,11 @@ map_loaded 02EB skills_list 0B32 actor_exists 09FF item_list_start -item_exists expandedItemID 1 +actor_info 0A30 +actor_name 0ADF [kRO_Zero_2021-06-30] -sendCrypt 0 account_server_info 0AC4 received_characters 099D charBlockSize 155 @@ -80,11 +73,11 @@ map_loaded 02EB skills_list 0B32 actor_exists 09FF item_list_start 0B08 -item_exists expandedItemID 1 +actor_info 0A30 +actor_name 0ADF [jRO_2021-07-xx] -sendCrypt 0 account_server_info received_characters 099D charBlockSize 155 @@ -94,5 +87,4 @@ map_loaded actor_exists skills_list item_list_start -item_exists expandedItemID From 685ab7b7476a967f061fef14a18c20889393c213 Mon Sep 17 00:00:00 2001 From: Alison Date: Fri, 16 Jul 2021 03:23:52 -0300 Subject: [PATCH 19/32] Update servertypes.txt --- src/Poseidon/servertypes.txt | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/Poseidon/servertypes.txt b/src/Poseidon/servertypes.txt index 85401b1415..5eea083e11 100644 --- a/src/Poseidon/servertypes.txt +++ b/src/Poseidon/servertypes.txt @@ -24,6 +24,8 @@ skills_list 010F actor_exists 09FF item_list_start 0B08 expandedItemID 1 +actor_info 0A30 +actor_name 0095 [vRO_2021-07-07] account_server_info 0AC9 @@ -32,10 +34,12 @@ charBlockSize 155 received_character_ID_and_Map 0AC5 map_login 0436 map_loaded 02EB -skills_list +skills_list 0B32 actor_exists 09FF item_list_start 0B08 expandedItemID 1 +actor_info 0A30 +actor_name 0095 [twRO_2021-06-21] account_server_info 0B60 @@ -44,10 +48,12 @@ charBlockSize 155 received_character_ID_and_Map 0AC5 map_login 0436 map_loaded 02EB -skills_list +skills_list 010F actor_exists 09FF item_list_start 0B08 expandedItemID 1 +actor_info 0A30 +actor_name 0095 [kRO_2021-06-30] account_server_info 0AC4 @@ -83,8 +89,10 @@ received_characters 099D charBlockSize 155 received_character_ID_and_Map 0AC5 map_login 0436 -map_loaded -actor_exists -skills_list -item_list_start -expandedItemID +map_loaded 02EB +actor_exists 09FF +skills_list 0B32 +item_list_start 0B08 +expandedItemID 1 +actor_info 0A30 +actor_name 0ADF From 8b056b89b8e962d7c7c4bba7b1140705989af158 Mon Sep 17 00:00:00 2001 From: Alison Date: Fri, 16 Jul 2021 11:15:51 -0300 Subject: [PATCH 20/32] remove charblocksize from poseidon.txt --- control/poseidon.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/control/poseidon.txt b/control/poseidon.txt index 378513f2bd..47cbf562ba 100644 --- a/control/poseidon.txt +++ b/control/poseidon.txt @@ -17,9 +17,4 @@ queryserver_port=24390 # You should modify this if you're having problems with char list. server_type=Default -# Char Block Size -# Here you can specify the desired CharBlockSize your client requires -# The available block sizes are : 106, 108, 112, 116, 128, 132, 136, 140, 144, 145, 147 and 155 -CharBlockSize=116 - debug=0 \ No newline at end of file From 9aa43828fa4650bc2f4b6b74a6b35858387ca422 Mon Sep 17 00:00:00 2001 From: Alison Date: Fri, 16 Jul 2021 11:25:27 -0300 Subject: [PATCH 21/32] replace Globals IDs value with real IDs --- src/Poseidon/RagnarokServer.pm | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index 2f96d419c5..c419980ceb 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -165,18 +165,18 @@ sub onClientExit } ## constants -my $accountID = pack("a4", "acct"); +my $accountID = pack("V", "2000001"); my $posX = 53; my $posY = 113; ## Globals -my $charID = pack("a4", "char"); -my $sessionID = pack("a4", "sess"); -my $sessionID2 = pack("C4", 0xff); -my $npcID1 = pack("a4", "npc1"); -my $npcID0 = pack("a4", "npc2"); -my $monsterID = pack("a4", "mon1"); -my $itemID = pack("a4", "itm1"); +my $charID = pack("V", "100001"); +my $sessionID = pack("V", "3000000000"); +my $sessionID2 = pack("V", 0xFF); +my $npcID1 = pack("V", "110000001"); +my $npcID0 = pack("V", "110000002"); +my $monsterID = pack("V", "110000003"); +my $itemID = pack("V", "50001"); sub DecryptMessageID { @@ -1026,13 +1026,13 @@ sub SendMapLogin { # mapLogin packet if ($self->{type}->{$config{server_type}}->{map_loaded} eq '0A18') { # '0A18' => ['map_loaded', 'V a3 C2 v C', [qw(syncMapSync coords xSize ySize font sex)]], # 14 - $client->send(pack("v", 0x0A18) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05) . pack("C*", 0x05, 0x05, 0x01)); + $client->send(pack("v", 0x0A18) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x00, 0x00) . pack("C*", 0x00, 0x00, 0x01)); } elsif ($self->{type}->{$config{server_type}}->{map_loaded} eq '02EB') { # '02EB' => ['map_loaded', 'V a3 a a v', [qw(syncMapSync coords xSize ySize font)]], # 13 - $client->send(pack("v", 0x02EB) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05) . pack("C*", 0x05, 0x05)); + $client->send(pack("v", 0x02EB) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x00, 0x00) . pack("C*", 0x00, 0x00)); } else { # '0073' => ['map_loaded','x4 a3',[qw(coords)]] - $client->send(pack("v", 0x0073) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x05, 0x05)); + $client->send(pack("v", 0x0073) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x00, 0x00)); } my $data; From 56861345c10811b08d72f391733b3fb8f57193f1 Mon Sep 17 00:00:00 2001 From: Alison Date: Fri, 16 Jul 2021 13:56:56 -0300 Subject: [PATCH 22/32] poseidon --- src/Poseidon/RagnarokServer.pm | 5 +++-- src/Poseidon/servertypes.txt | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index c419980ceb..7f0bd89560 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -630,8 +630,6 @@ sub ParsePacket { $enc_val1 = $enc_val1->bmul($enc_val3)->badd($enc_val2) & 0xFFFFFFFF; } } - - PerformMapLoadedTasks($self, $client, $msg, $index); } elsif ( ( ( ($switch eq '007E') || ($switch eq '035F') ) && (($clientdata{$index}{serverType} == 0) || ($clientdata{$index}{serverType} == 1) || ($clientdata{$index}{serverType} == 2) || ($clientdata{$index}{serverType} == 6) || ($clientdata{$index}{serverType} == 7) || ($clientdata{$index}{serverType} == 10) || ($clientdata{$index}{serverType} == 11))) || (($switch eq '0089') && (($clientdata{$index}{serverType} == 3) || ($clientdata{$index}{serverType} == 5) || ($clientdata{$index}{serverType} == 8) || ($clientdata{$index}{serverType} == 9))) || @@ -1072,6 +1070,9 @@ sub SendMapLogin { } $client->{connectedToMap} = 1; + + # TODO: fixme, this should be made only after 007D, but for some reason some clients are not sending this packet + PerformMapLoadedTasks($self, $client, $msg, $index); } sub SendGoToCharSelection diff --git a/src/Poseidon/servertypes.txt b/src/Poseidon/servertypes.txt index 5eea083e11..a5e3f54572 100644 --- a/src/Poseidon/servertypes.txt +++ b/src/Poseidon/servertypes.txt @@ -13,7 +13,7 @@ expandedItemID 1 actor_info 0A30 actor_name 0095 -[cRO_2021-07-xx] +[cRO_2021-06-25] account_server_info 0AC9 received_characters 099D charBlockSize 155 From 95c8dc93c29acc7bcc31889634a5b4bca2c4ac90 Mon Sep 17 00:00:00 2001 From: Alison Date: Fri, 16 Jul 2021 14:19:05 -0300 Subject: [PATCH 23/32] poseidon update --- src/Poseidon/RagnarokServer.pm | 2 +- src/Poseidon/servertypes.txt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index 7f0bd89560..a32d42e754 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -1065,7 +1065,7 @@ sub SendMapLogin { # '00BD' => ['stats_info', 'v C12 v14', [qw(points_free str points_str agi points_agi vit points_vit int points_int dex points_dex luk points_luk attack attack_bonus attack_magic_min attack_magic_max def def_bonus def_magic def_magic_bonus hit flee flee_bonus critical stance manner)]], # (stance manner) actually are (ASPD plusASPD) $client->send(pack("v2 C12 v14", 0x00BD, 100, 99, 11, 99, 11, 99, 11, 99, 11, 99, 11, 99, 11, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 100, 190, 3)); - if ( $config{server_type} =~ /^kRO/ ) { # kRO + if ($self->{type}->{$config{server_type}}->{confirm_load} eq '0B1B') { $client->send(pack("v", 0x0B1B)); # load_confirm (unlock keyboard) } diff --git a/src/Poseidon/servertypes.txt b/src/Poseidon/servertypes.txt index a5e3f54572..bbde2473d4 100644 --- a/src/Poseidon/servertypes.txt +++ b/src/Poseidon/servertypes.txt @@ -26,6 +26,7 @@ item_list_start 0B08 expandedItemID 1 actor_info 0A30 actor_name 0095 +confirm_load 0B1B [vRO_2021-07-07] account_server_info 0AC9 @@ -68,6 +69,7 @@ item_list_start expandedItemID 1 actor_info 0A30 actor_name 0ADF +confirm_load 0B1B [kRO_Zero_2021-06-30] account_server_info 0AC4 @@ -82,6 +84,7 @@ item_list_start 0B08 expandedItemID 1 actor_info 0A30 actor_name 0ADF +confirm_load 0B1B [jRO_2021-07-xx] account_server_info From dc062bbb65ccfa2dc4b5eaa976600daaebedd7c8 Mon Sep 17 00:00:00 2001 From: Alison Date: Fri, 16 Jul 2021 22:02:10 -0300 Subject: [PATCH 24/32] poseidon add 0B04 reply --- src/Poseidon/RagnarokServer.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index a32d42e754..216dc162a9 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -282,7 +282,7 @@ sub ParsePacket { pack("x30") . pack("C1", $sex) . pack("x4") . pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . $port . $serverName . $serverUsers . pack("x2"); - } elsif ($switch eq '0AAC' || $self->{type}->{$config{server_type}}->{account_server_info} eq '0AC9') { + } elsif ($switch eq '0AAC' || $switch eq '0B04' || $self->{type}->{$config{server_type}}->{account_server_info} eq '0AC9') { $data = pack("v", 0x0AC9) . # header pack("v", 0xCF) . # length $sessionID . $accountID . $sessionID2 . From e21624fe459345d32b4d4bf8cd42dd0e4379f132 Mon Sep 17 00:00:00 2001 From: Alison Date: Fri, 16 Jul 2021 22:27:03 -0300 Subject: [PATCH 25/32] poseidon add 0b07 packet --- src/Poseidon/RagnarokServer.pm | 14 +++++++++++++- src/Poseidon/servertypes.txt | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index 216dc162a9..aa5cf2144b 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -282,7 +282,7 @@ sub ParsePacket { pack("x30") . pack("C1", $sex) . pack("x4") . pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . $port . $serverName . $serverUsers . pack("x2"); - } elsif ($switch eq '0AAC' || $switch eq '0B04' || $self->{type}->{$config{server_type}}->{account_server_info} eq '0AC9') { + } elsif ($switch eq '0AAC' || $self->{type}->{$config{server_type}}->{account_server_info} eq '0AC9') { $data = pack("v", 0x0AC9) . # header pack("v", 0xCF) . # length $sessionID . $accountID . $sessionID2 . @@ -295,6 +295,18 @@ sub ParsePacket { pack("C*", 0x80, 0x32) . # ?? pack("a*", $host.":".$self->getPort()) . # ip:port pack("x114"); # fill with 00 + } elsif($switch eq '0B04' || $self->{type}->{$config{server_type}}->{account_server_info} eq '0B07') { + $data = pack("v", 0x0B07) . # header + pack("v", 0xCF) . # length + $sessionID . $accountID . $sessionID2 . + pack("x4") . # lastloginip + pack("a26", time) . # lastLoginTime + pack("C", $sex) . # accountSex + pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . + $port . + $serverName . + $serverUsers . + pack("x130"); } elsif ($self->{type}->{$config{server_type}}->{account_server_info} eq '0B60') { # received twRO $serverUsers = pack("v", @{$self->clients()} - 1); $data = pack("v", 0x0B60) . # header diff --git a/src/Poseidon/servertypes.txt b/src/Poseidon/servertypes.txt index bbde2473d4..920633dd3f 100644 --- a/src/Poseidon/servertypes.txt +++ b/src/Poseidon/servertypes.txt @@ -29,7 +29,7 @@ actor_name 0095 confirm_load 0B1B [vRO_2021-07-07] -account_server_info 0AC9 +account_server_info 0B07 received_characters 099D charBlockSize 155 received_character_ID_and_Map 0AC5 From f915fdd751a6a6b08adb832334ba01aa63be5c5c Mon Sep 17 00:00:00 2001 From: Alison Date: Sat, 17 Jul 2021 13:01:45 -0300 Subject: [PATCH 26/32] poseidon fix duplicated dumps when debug is enabled --- src/Poseidon/RagnarokServer.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index aa5cf2144b..3dcd87cc62 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -621,7 +621,7 @@ sub ParsePacket { && $msg =~ /$sessionID/) { # client sends the maplogin packet (unknown) print "Received unsupported map login packet $switch.\n"; - visualDump($msg, "$switch"); + visualDump($msg, "$switch") unless $config{debug}; SendMapLogin($self, $client, $msg, $index); # save servers.txt info @@ -886,7 +886,7 @@ sub ParsePacket { } else { print "\nReceived packet $switch:\n"; - visualDump($msg, "$switch"); + visualDump($msg, "$switch") unless $config{debug}; # Just provide feedback in the RO Client about the unhandled packet # '008E' => ['self_chat', 'x2 Z*', [qw(message)]], From 8e6d88cd6ba4c7863733874e41519f79fee3f250 Mon Sep 17 00:00:00 2001 From: ya4ept Date: Sat, 17 Jul 2021 19:25:44 +0300 Subject: [PATCH 27/32] translation --- src/Poseidon/RagnarokServer.pm | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index 3dcd87cc62..43516da605 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -796,12 +796,12 @@ sub ParsePacket { SendNPCTalk($self, $client, $msg, $index, $npcID, "[Hakore]"); if (!$clientdata{$index}{npc_talk_code}) { if (!defined $clientdata{$index}{serverType}) { - SendNPCTalk($self, $client, $msg, $index, $npcID, "However, I regret that Openkore may not currently support your server."); + SendNPCTalk($self, $client, $msg, $index, $npcID, "However, I regret that OpenKore may not currently support your server."); } elsif ($clientdata{$index}{serverType} == 7 || $clientdata{$index}{serverType} == 12) { - SendNPCTalk($self, $client, $msg, $index, $npcID, "However, I regret that Openkore does not yet fully support your server this time."); + SendNPCTalk($self, $client, $msg, $index, $npcID, "However, I regret that OpenKore does not yet fully support your server this time."); } else { - SendNPCTalk($self, $client, $msg, $index, $npcID, "Based on my examination, I think Openkore supports your server."); - SendNPCTalk($self, $client, $msg, $index, $npcID, "I can tell you the possible server details you can use to make Openkore to connect to your server."); + SendNPCTalk($self, $client, $msg, $index, $npcID, "Based on my examination, I think OpenKore supports your server."); + SendNPCTalk($self, $client, $msg, $index, $npcID, "I can tell you the possible server details you can use to make OpenKore to connect to your server."); } SendNPCTalkContinue($self, $client, $msg, $index, $npcID); $clientdata{$index}{npc_talk_code} = 1; @@ -820,7 +820,7 @@ sub ParsePacket { SendNPCTalk($self, $client, $msg, $index, $npcID, "As you can see, I can't find a matching serverType for your server."); SendNPCTalk($self, $client, $msg, $index, $npcID, "Please make a trial-and-error using all available serverTypes, one of them might be able to work."); } elsif ($clientdata{$index}{serverType} == 7 || $clientdata{$index}{serverType} == 12) { - SendNPCTalk($self, $client, $msg, $index, $npcID, "Like I said, your server is not yet fully supported by Openkore."); + SendNPCTalk($self, $client, $msg, $index, $npcID, "Like I said, your server is not yet fully supported by OpenKore."); SendNPCTalk($self, $client, $msg, $index, $npcID, "You can login to the server and do most basic tasks, but you cannot attack, sit or stand, or use skills."); } SendNPCTalkContinue($self, $client, $msg, $index, $npcID); @@ -833,8 +833,8 @@ sub ParsePacket { } elsif ($clientdata{$index}{npc_talk_code} == 4) { if (!defined $clientdata{$index}{serverType}) { - SendNPCTalk($self, $client, $msg, $index, $npcID, "If none of the serverTypes work, please inform the developers about this so we can support your server in future releases of Openkore."); - SendNPCTalk($self, $client, $msg, $index, $npcID, "Please visit ^2222DDhttp://forums.openkore.com/^000000"); + SendNPCTalk($self, $client, $msg, $index, $npcID, "If none of the serverTypes work, please inform the developers about this so we can support your server in future releases of OpenKore."); + SendNPCTalk($self, $client, $msg, $index, $npcID, "Please visit ^2222DDhttps://forums.openkore.com/^000000"); SendNPCTalk($self, $client, $msg, $index, $npcID, "Thank you."); } else { if (($clientdata{$index}{serverType} == 7) @@ -846,11 +846,11 @@ sub ParsePacket { || ($clientdata{$index}{masterLogin_packet}) || ($clientdata{$index}{gameLogin_packet}) ) { - SendNPCTalk($self, $client, $msg, $index, $npcID, "Please note that you can only connect to your server using Openkore SVN."); + SendNPCTalk($self, $client, $msg, $index, $npcID, "Please note that you can only connect to your server using OpenKore GIT."); } else { - SendNPCTalk($self, $client, $msg, $index, $npcID, "Openkore v.1.6.6 or later will work on your server."); + SendNPCTalk($self, $client, $msg, $index, $npcID, "OpenKore v.1.6.6 or later will work on your server."); } - SendNPCTalk($self, $client, $msg, $index, $npcID, "For more info, please visit ^2222DDhttp://www.openkore.com/^000000"); + SendNPCTalk($self, $client, $msg, $index, $npcID, "For more info, please visit ^2222DDhttps://openkore.com/^000000"); SendNPCTalk($self, $client, $msg, $index, $npcID, "Good luck!"); } SendNpcTalkClose($self, $client, $msg, $index, $npcID); @@ -1030,7 +1030,7 @@ sub SendMapLogin { $client->send(pack("v a4", 0x0283, $accountID)); if ( $config{server_type} =~ /^kRO/ ) { # kRO - $client->send(pack("v", 0x0ADE) . pack("V", 0x00)); + $client->send(pack("v", 0x0ADE) . pack("V", 0x00)); } # mapLogin packet @@ -1078,7 +1078,7 @@ sub SendMapLogin { $client->send(pack("v2 C12 v14", 0x00BD, 100, 99, 11, 99, 11, 99, 11, 99, 11, 99, 11, 99, 11, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 100, 190, 3)); if ($self->{type}->{$config{server_type}}->{confirm_load} eq '0B1B') { - $client->send(pack("v", 0x0B1B)); # load_confirm (unlock keyboard) + $client->send(pack("v", 0x0B1B)); # load_confirm (unlock keyboard) } $client->{connectedToMap} = 1; @@ -1201,7 +1201,7 @@ sub SendShowItemOnGround $client->send(pack("v a4 V C v3 C2", 0x009D, $ID, $SpriteID, 1, $posX + 1, $posY - 1, 1, 0, 0)); } else { $client->send(pack("v a4 v C v3 C2", 0x009D, $ID, $SpriteID, 1, $posX + 1, $posY - 1, 1, 0, 0)); - } + } } sub SendNPCTalk From 02e05799aa7803702ea33d1848bae1dfb96aaf3d Mon Sep 17 00:00:00 2001 From: Alison Date: Sun, 18 Jul 2021 01:18:01 -0300 Subject: [PATCH 28/32] fix wrong check --- src/Poseidon/RagnarokServer.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index 43516da605..b61fca7fdf 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -1120,7 +1120,7 @@ sub SendUnitInfo my ($self, $client, $msg, $index, $ID, $name, $partyName, $guildName, $guildTitle, $titleID) = @_; # Let's not wait for the client to ask for the unit info - if ($self->{type}->{$config{server_type}}->{actor_info} eq '0B32') { + if ($self->{type}->{$config{server_type}}->{actor_info} eq '0A30') { # '0A30' => ['actor_info', 'a4 Z24 Z24 Z24 Z24 V', [qw(ID name partyName guildName guildTitle titleID)]], $client->send(pack("v a4 Z24 Z24 Z24 Z24 V", 0x0A30, $ID, $name, $partyName, $guildName, $guildTitle, $titleID)); } else { From ab3ef740f41f94f9eb062cc7a9f23a46a2dd25b6 Mon Sep 17 00:00:00 2001 From: Alison Date: Sun, 18 Jul 2021 01:40:17 -0300 Subject: [PATCH 29/32] Update servertypes.txt --- src/Poseidon/servertypes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Poseidon/servertypes.txt b/src/Poseidon/servertypes.txt index 920633dd3f..a93f37f135 100644 --- a/src/Poseidon/servertypes.txt +++ b/src/Poseidon/servertypes.txt @@ -40,7 +40,7 @@ actor_exists 09FF item_list_start 0B08 expandedItemID 1 actor_info 0A30 -actor_name 0095 +actor_name 0ADF [twRO_2021-06-21] account_server_info 0B60 From aff3ff2557b3ccc2bd6ec370e3482f9c264621b8 Mon Sep 17 00:00:00 2001 From: Alison Date: Wed, 28 Jul 2021 13:23:30 -0300 Subject: [PATCH 30/32] add debug in sent packets --- src/Poseidon/RagnarokServer.pm | 111 +++++++++++++++++++-------------- 1 file changed, 64 insertions(+), 47 deletions(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index b61fca7fdf..77a75c7133 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -212,6 +212,19 @@ sub onClientData { ParsePacket($self, $client, $msg, $index, $packet_id, $switch); } +sub SendData { + my ($client, $data) = @_; + + if($config{debug}) { + my $packet_id = unpack("v", $data); + my $switch = sprintf("%04X", $packet_id); + print "\nSent packet $switch:\n"; + visualDump($data, "$switch"); + } + + $client->send($data); +} + sub ParsePacket { my ($self, $client, $msg, $index, $packet_id, $switch) = @_; @@ -223,7 +236,7 @@ sub ParsePacket { my $port = pack("v", $self->getPort()); $host = '127.0.0.1' if ($host eq 'localhost'); my @ipElements = split /\./, $host; - + print "\nReceived packet $switch:\n" if ($config{debug}); visualDump($msg, "$switch") if ($config{debug}); # Note: @@ -236,7 +249,7 @@ sub ParsePacket { # '01DC' => ['secure_login_key', 'x2 a*', [qw(secure_key)]], my $data = pack("v2", 0x01DC, 0x14) . pack("x17"); - $client->send($data); + SendData($client, $data); # save servers.txt info my $code = substr($msg, 2); @@ -266,7 +279,7 @@ sub ParsePacket { pack("l", "0") . # login_type pack("Z20","S1000") . # flag pack("Z*", "OpenkoreClientToken"); # login_token - $client->send($data); + SendData($client, $data); } elsif (($switch eq '0064') || ($switch eq '01DD') || ($switch eq '01FA') || ($switch eq '0277') || ($switch eq '02B0') || ($switch eq '0825') || ($switch eq '0987') || ($switch eq '0A76') || ($switch eq '0AAC') || ($switch eq '0B04')) { # master_login # send account_server_info @@ -354,7 +367,7 @@ sub ParsePacket { $port . $serverName . $serverUsers . pack("x2"); } - $client->send($data); + SendData($client, $data); # save servers.txt info $clientdata{$index}{masterLogin_packet} = $switch; @@ -410,14 +423,14 @@ sub ParsePacket { if ($self->{type}->{$config{server_type}}->{received_characters} eq '099D' || $self->{type}->{$config{server_type}}->{received_characters} eq '0B72') { my $data; $data = $accountID; - $client->send($data); + SendData($client, $data); $data = pack("v2 C5", 0x082D, 0x1D, 0x02, 0x00, 0x00, 0x02, 0x02) . pack("x20"); - $client->send($data); + SendData($client, $data); $data = pack("v V", 0x09A0, 0x01); - $client->send($data); + SendData($client, $data); return; } @@ -450,14 +463,14 @@ sub ParsePacket { my $data = pack("v", 0x0AC5) . $charID . $mapName . pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . $port . pack("x128"); # mapUrl - $client->send($data); + SendData($client, $data); } else { # '0071' => ['received_character_ID_and_Map', 'a4 Z16 a4 v1', [qw(charID mapName mapIP mapPort)]], my $mapName = pack("a16", "new_1-1.gat"); my $data = pack("v", 0x0071) . $charID . $mapName . pack("C*", $ipElements[0], $ipElements[1], $ipElements[2], $ipElements[3]) . $port; - $client->send($data); + SendData($client, $data); } } elsif ($switch eq $self->{type}->{$config{server_type}}->{map_login} && @@ -636,7 +649,8 @@ sub ParsePacket { { for ( my $i = 0 ; $i < 64 ; $i++ ) { - $client->send(pack("C C", 0x70, 0x08)); + $data = pack("C C", 0x70, 0x08); + SendData($client, $data); # Forcedly Calculating the Next Decryption Key $enc_val1 = $enc_val1->bmul($enc_val3)->badd($enc_val2) & 0xFFFFFFFF; @@ -650,7 +664,7 @@ sub ParsePacket { ($switch eq '0360') ) { # client sends sync packet my $data = pack("C*", 0x7F, 0x00) . pack("V", getTickCount); - $client->send($data); + SendData($client, $data); ### Check if packet 0228 got tangled up with the sync packet if (uc(unpack("H2", substr($msg, 7, 1))) . uc(unpack("H2", substr($msg, 6, 1))) eq '0228') { @@ -668,7 +682,7 @@ sub ParsePacket { $enc_val3 = 0; } elsif ($switch eq '0187') { # accountid sync (what does this do anyway?) - $client->send($msg); + SendData($client, $msg); } elsif ($switch eq '018A') { # client sends quit packet @@ -695,12 +709,15 @@ sub ParsePacket { # proper 0228 response. Only after that will the server send 0259 to allow the # client to continue the login sequence. Since this is just a fake server, # there is no need to go through all that and we can do a shortcut. + my $data; if ($self->{challengeNum} == 0) { print "Received GameGuard sync request. Client allowed to login account server.\n"; - $client->send(pack("C*", 0x59, 0x02, 0x01)); + $data = pack("C*", 0x59, 0x02, 0x01); + SendData($client, $data); } else { print "Received GameGuard sync request. Client allowed to login char/map server.\n"; - $client->send(pack("C*", 0x59, 0x02, 0x02)); + $data = pack("C*", 0x59, 0x02, 0x02); + SendData($client, $data); } $self->{challengeNum}++; } else { @@ -773,7 +790,7 @@ sub ParsePacket { $data .= pack("v3", 0xF2, 2, 300); SendNpcImageShow($self, $client, $msg, $index, "kafra_04.bmp", 0xFF); SendNpcTalkClose($self, $client, $msg, $index, $npcID); - $client->send($data); + SendData($client, $data); } elsif ($response == 2) { # Use storage @@ -869,20 +886,20 @@ sub ParsePacket { } } elsif ($switch eq '0B1C') { # pong packet (keep-alive) - $client->send(pack("v", 0x0B1D)); + SendData($client, pack("v", 0x0B1D)); } elsif ($switch eq '01C0') { # Remaining time?? - # $client->send(pack("v V3", 0x01C0, 0xFF, 0xFF, 0xFF)); + # SendData($client, pack("v V3", 0x01C0, 0xFF, 0xFF, 0xFF)); } elsif ($clientdata{$index}{mode}) { if (($switch eq '00F7' || $switch eq '0193') && (length($msg) == 2)) { # storage close my $data = pack("v1", 0xF8); - $client->send($data); + SendData($client, $data); } elsif ($switch eq '00BF') { # emoticon my ($client, $code) = @_; my $data = pack("v1 a4", 0xC0, $accountID) . substr($msg, 2, 1); $clientdata{$index}{emoticonTime} = time; - $client->send($data); + SendData($client, $data); } else { print "\nReceived packet $switch:\n"; @@ -918,7 +935,7 @@ sub ParsePacket { $data .= pack("v1 a4 a24", 0x95, $npcID1, "Kafra"); } - $client->send($data); + SendData($client, $data); } } } @@ -1021,28 +1038,28 @@ sub SendCharacterList print "Wanted CharBlockSize : $blocksize\n"; print "Packstring size: ".length(pack($packstring))."\n"; print "Built CharBlockSize : " . length($block) . "\n"; - $client->send($data); + SendData($client, $data); } sub SendMapLogin { my ($self, $client, $msg, $index) = @_; - $client->send(pack("v a4", 0x0283, $accountID)); + SendData($client, pack("v a4", 0x0283, $accountID)); if ( $config{server_type} =~ /^kRO/ ) { # kRO - $client->send(pack("v", 0x0ADE) . pack("V", 0x00)); + SendData($client, pack("v", 0x0ADE) . pack("V", 0x00)); } # mapLogin packet if ($self->{type}->{$config{server_type}}->{map_loaded} eq '0A18') { # '0A18' => ['map_loaded', 'V a3 C2 v C', [qw(syncMapSync coords xSize ySize font sex)]], # 14 - $client->send(pack("v", 0x0A18) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x00, 0x00) . pack("C*", 0x00, 0x00, 0x01)); + SendData($client, pack("v", 0x0A18) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x00, 0x00) . pack("C*", 0x00, 0x00, 0x01)); } elsif ($self->{type}->{$config{server_type}}->{map_loaded} eq '02EB') { # '02EB' => ['map_loaded', 'V a3 a a v', [qw(syncMapSync coords xSize ySize font)]], # 13 - $client->send(pack("v", 0x02EB) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x00, 0x00) . pack("C*", 0x00, 0x00)); + SendData($client, pack("v", 0x02EB) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x00, 0x00) . pack("C*", 0x00, 0x00)); } else { # '0073' => ['map_loaded','x4 a3',[qw(coords)]] - $client->send(pack("v", 0x0073) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x00, 0x00)); + SendData($client, pack("v", 0x0073) . pack("V", getTickCount) . getCoordString($posX, $posY, 1) . pack("C*", 0x00, 0x00)); } my $data; @@ -1057,7 +1074,7 @@ sub SendMapLogin { pack("v V v3 C v", 26, 4, 2, 9, 1, 0, 0) . # self skill test pack("v V v3 C v", 27, 2, 4, 26, 9, 0, 0) . # location skill test pack("v V v3 C v", 28, 16, 10, 40, 9, 0, 0); # target skill test - $client->send($data); + SendData($client, $data); } else { $data = pack("C2 v1", 0x0F, 0x01, 226) . # skillID targetType level sp range skillName @@ -1067,18 +1084,18 @@ sub SendMapLogin { pack("v2 x2 v3 a24 C1", 26, 4, 2, 9, 1, "AL_TELEPORT", 0) . # self skill test pack("v2 x2 v3 a24 C1", 27, 2, 4, 26, 9, "AL_WARP", 0) . # location skill test pack("v2 x2 v3 a24 C1", 28, 16, 10, 40, 9, "AL_HEAL", 0); # target skill test - $client->send($data); + SendData($client, $data); } } # '013A' => ['attack_range', 'v', [qw(type)]], - $client->send(pack("v2", , 0x013A, 1)); + SendData($client, pack("v2", , 0x013A, 1)); # '00BD' => ['stats_info', 'v C12 v14', [qw(points_free str points_str agi points_agi vit points_vit int points_int dex points_dex luk points_luk attack attack_bonus attack_magic_min attack_magic_max def def_bonus def_magic def_magic_bonus hit flee flee_bonus critical stance manner)]], # (stance manner) actually are (ASPD plusASPD) - $client->send(pack("v2 C12 v14", 0x00BD, 100, 99, 11, 99, 11, 99, 11, 99, 11, 99, 11, 99, 11, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 100, 190, 3)); + SendData($client, pack("v2 C12 v14", 0x00BD, 100, 99, 11, 99, 11, 99, 11, 99, 11, 99, 11, 99, 11, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 100, 190, 3)); if ($self->{type}->{$config{server_type}}->{confirm_load} eq '0B1B') { - $client->send(pack("v", 0x0B1B)); # load_confirm (unlock keyboard) + SendData($client, pack("v", 0x0B1B)); # load_confirm (unlock keyboard) } $client->{connectedToMap} = 1; @@ -1094,7 +1111,7 @@ sub SendGoToCharSelection # Log print "Requested Char Selection Screen\n"; - $client->send(pack("v v", 0x00B3, 1)); + SendData($client, pack("v v", 0x00B3, 1)); } sub SendQuitGame @@ -1104,7 +1121,7 @@ sub SendQuitGame # Log print "Requested Quit Game...\n"; - $client->send(pack("v v", 0x018B, 0)); + SendData($client, pack("v v", 0x018B, 0)); } sub SendLookTo @@ -1112,7 +1129,7 @@ sub SendLookTo my ($self, $client, $msg, $index, $ID, $to) = @_; # Make Poseidon look to front - $client->send(pack('v1 a4 C1 x1 C1', 0x009C, $ID, 0, $to)); + SendData($client, pack('v1 a4 C1 x1 C1', 0x009C, $ID, 0, $to)); } sub SendUnitInfo @@ -1122,10 +1139,10 @@ sub SendUnitInfo # Let's not wait for the client to ask for the unit info if ($self->{type}->{$config{server_type}}->{actor_info} eq '0A30') { # '0A30' => ['actor_info', 'a4 Z24 Z24 Z24 Z24 V', [qw(ID name partyName guildName guildTitle titleID)]], - $client->send(pack("v a4 Z24 Z24 Z24 Z24 V", 0x0A30, $ID, $name, $partyName, $guildName, $guildTitle, $titleID)); + SendData($client, pack("v a4 Z24 Z24 Z24 Z24 V", 0x0A30, $ID, $name, $partyName, $guildName, $guildTitle, $titleID)); } else { # '0195' => ['actor_info', 'a4 Z24 Z24 Z24 Z24', [qw(ID name partyName guildName guildTitle)]], - $client->send(pack("v1 a4 Z24 Z24 Z24 Z24", 0x0195, $ID, $name, $partyName, $guildName, $guildTitle)); + SendData($client, pack("v1 a4 Z24 Z24 Z24 Z24", 0x0195, $ID, $name, $partyName, $guildName, $guildTitle)); } } @@ -1135,10 +1152,10 @@ sub SendUnitName if ($self->{type}->{$config{server_type}}->{actor_name} eq '0ADF') { # '0ADF' => ['actor_info', 'a4 a4 Z24 Z24', [qw(ID charID name prefix_name)]], - $client->send(pack("v1 a4 a24", 0x0ADF, $ID, $charID, $name, $prefix_name)); + SendData($client, pack("v1 a4 a24", 0x0ADF, $ID, $charID, $name, $prefix_name)); } else { # '0095' => ['actor_info', 'a4 Z24', [qw(ID name)]], - $client->send(pack("v1 a4 a24", 0x0095, $ID, $name)); + SendData($client, pack("v1 a4 a24", 0x0095, $ID, $name)); } } @@ -1147,7 +1164,7 @@ sub SendSystemChatMessage my ($self, $client, $msg, $index, $message) = @_; # '009A' => ['system_chat', 'v Z*', [qw(len message)]], - $client->send(pack("v2 a32", 0x009A, 36, $message)); + SendData($client, pack("v2 a32", 0x009A, 36, $message)); } sub SendShowNPC @@ -1190,7 +1207,7 @@ sub SendShowNPC $data = pack("v2 C a4 a4 v3 V v2 V2 v7 a4 a2 v V C2 a3 C3 v2 V2 C v a*", 0x09FF, $len, $object_type, $NPCID, $AID, $walk_speed, $opt1, $opt2, $option, $type, $hair_style, $weapon, $shield, $lowhead, $tophead, $midhead, $hair_color, $clothes_color, $head_dir, $costume, $guildID, $emblemID, $manner, $opt3, $stance, $sex, getCoordString($X, $Y, 1), $xSize, $ySize, $state, $lv, $font, 0xFFFFFFFF, 0xFFFFFFFF, 0, $opt4, stringToBytes($name)); } - $client->send($data); + SendData($client, $data); } sub SendShowItemOnGround @@ -1198,9 +1215,9 @@ sub SendShowItemOnGround my ($self, $client, $msg, $index, $ID, $SpriteID, $X, $Y) = @_; if ($self->{type}->{$config{server_type}}->{expandedItemID} eq '1') { - $client->send(pack("v a4 V C v3 C2", 0x009D, $ID, $SpriteID, 1, $posX + 1, $posY - 1, 1, 0, 0)); + SendData($client, pack("v a4 V C v3 C2", 0x009D, $ID, $SpriteID, 1, $posX + 1, $posY - 1, 1, 0, 0)); } else { - $client->send(pack("v a4 v C v3 C2", 0x009D, $ID, $SpriteID, 1, $posX + 1, $posY - 1, 1, 0, 0)); + SendData($client, pack("v a4 v C v3 C2", 0x009D, $ID, $SpriteID, 1, $posX + 1, $posY - 1, 1, 0, 0)); } } @@ -1210,7 +1227,7 @@ sub SendNPCTalk # '00B4' => ['npc_talk', 'v a4 Z*', [qw(len ID msg)]] my $dbuf = pack("a" . length($message), $message); - $client->send(pack("v2 a4", 0x00B4, (length($dbuf) + 8), $npcID) . $dbuf); + SendData($client, pack("v2 a4", 0x00B4, (length($dbuf) + 8), $npcID) . $dbuf); } sub SendNPCTalkContinue @@ -1218,7 +1235,7 @@ sub SendNPCTalkContinue my ($self, $client, $msg, $index, $npcID) = @_; # '00B5' => ['npc_talk_continue', 'a4', [qw(ID)]] - $client->send(pack("v a4", 0x00B5, $npcID)); + SendData($client, pack("v a4", 0x00B5, $npcID)); } sub SendNpcTalkClose @@ -1226,7 +1243,7 @@ sub SendNpcTalkClose my ($self, $client, $msg, $index, $npcID) = @_; # '00B6' => ['npc_talk_close', 'a4', [qw(ID)]] - $client->send(pack("v a4", 0x00B6, $npcID)); + SendData($client, pack("v a4", 0x00B6, $npcID)); } sub SendNpcTalkResponses @@ -1235,7 +1252,7 @@ sub SendNpcTalkResponses # '00B7' => ['npc_talk', 'v a4 Z*', [qw(len ID msg)]] my $dbuf = pack("a" . length($message), $message); - $client->send(pack("v2 a4", 0x00B7, (length($dbuf) + 8), $npcID) . $dbuf); + SendData($client, pack("v2 a4", 0x00B7, (length($dbuf) + 8), $npcID) . $dbuf); } sub SendNpcImageShow @@ -1245,7 +1262,7 @@ sub SendNpcImageShow # Type = 0xFF = Hide Image # Type = 0x02 = Show Image # '01B3' => ['npc_image', 'Z64 C', [qw(npc_image type)]] - $client->send(pack("v a64 C1", 0x01B3, $image, $type)); + SendData($client, pack("v a64 C1", 0x01B3, $image, $type)); } # SERVER TASKS From 6f16fd9c713d7c1803d0a08741068db9b12a9c08 Mon Sep 17 00:00:00 2001 From: ya4ept Date: Fri, 30 Jul 2021 04:56:05 +0300 Subject: [PATCH 31/32] added jRO support --- src/Poseidon/RagnarokServer.pm | 2 +- src/Poseidon/servertypes.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Poseidon/RagnarokServer.pm b/src/Poseidon/RagnarokServer.pm index 77a75c7133..a7c1fff5ce 100644 --- a/src/Poseidon/RagnarokServer.pm +++ b/src/Poseidon/RagnarokServer.pm @@ -281,7 +281,7 @@ sub ParsePacket { pack("Z*", "OpenkoreClientToken"); # login_token SendData($client, $data); - } elsif (($switch eq '0064') || ($switch eq '01DD') || ($switch eq '01FA') || ($switch eq '0277') || ($switch eq '02B0') || ($switch eq '0825') || ($switch eq '0987') || ($switch eq '0A76') || ($switch eq '0AAC') || ($switch eq '0B04')) { # master_login + } elsif (($switch eq '0064') || ($switch eq '01DD') || ($switch eq '01FA') || ($switch eq '0277') || ($switch eq '027C') || ($switch eq '02B0') || ($switch eq '0825') || ($switch eq '0987') || ($switch eq '0A76') || ($switch eq '0AAC') || ($switch eq '0B04')) { # master_login # send account_server_info my $sex = 1; my $serverName = pack("a20", "Poseidon server"); # server name should be less than or equal to 20 characters diff --git a/src/Poseidon/servertypes.txt b/src/Poseidon/servertypes.txt index a93f37f135..a1343d94a4 100644 --- a/src/Poseidon/servertypes.txt +++ b/src/Poseidon/servertypes.txt @@ -86,11 +86,11 @@ actor_info 0A30 actor_name 0ADF confirm_load 0B1B -[jRO_2021-07-xx] +[jRO_2021-04-21] account_server_info received_characters 099D charBlockSize 155 -received_character_ID_and_Map 0AC5 +received_character_ID_and_Map 0071 map_login 0436 map_loaded 02EB actor_exists 09FF From 44d67477c62e6878c7dbd8804f5eb9e7602a8330 Mon Sep 17 00:00:00 2001 From: ya4ept Date: Mon, 2 Aug 2021 03:01:43 +0300 Subject: [PATCH 32/32] updated major version of poseidon --- src/Poseidon/poseidon.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Poseidon/poseidon.pl b/src/Poseidon/poseidon.pl index bedac9f929..995b73d269 100755 --- a/src/Poseidon/poseidon.pl +++ b/src/Poseidon/poseidon.pl @@ -7,7 +7,7 @@ # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # -# Copyright (c) 2005-2006 OpenKore Development Team +# Copyright (c) 2021 OpenKore Development Team # # Credits: # isieo - schematic of XKore 2 and other interesting ideas @@ -39,7 +39,8 @@ sub initialize { # Starting Poseidon - print ">>> Starting Poseidon 2.1 <<<\n"; + my $version = "3.0"; + print ">>> Starting Poseidon $version <<<\n"; print "Loading configuration...\n"; # Loading Configuration @@ -55,7 +56,7 @@ sub initialize { $queryServer = new Poseidon::QueryServer($config{queryserver_port}, $config{queryserver_ip}, $roServer); print "Query Server Ready At : " . $queryServer->getHost() . ":" . $queryServer->getPort() . "\n"; - print ">>> Poseidon 2.1 initialized (Debug : ". (($config{debug}) ? "On" : "Off") . ") <<<\n\n"; + print ">>> Poseidon $version initialized (Debug : ". (($config{debug}) ? "On" : "Off") . ") <<<\n\n"; print "Please read " . POSEIDON_SUPPORT_URL . " for further instructions.\n"; }