Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ git clone https://github.com/OpenKore/openkore.git
| [jRO](https://ragnarokonline.gungho.jp/) | Japan RO | nProtect | Not working | N/A |
| [kRO](http://ro.gnjoy.com/) | Korea RO | nProtect | Not working | N/A |
| [kRO Zero](http://roz.gnjoy.com/) | Korea RO | nProtect | Not working | N/A |
| [laRO](https://rola.maxion.gg/) | Latam (Landverse America) | Custom | Not working | N/A |
| [ROla](https://www.gnjoylatam.com/) | Latam RO | nProtect | Not working | N/A |
| [ruRO Prime](https://ru.4game.com/roprime/) | Russia RO | Frost Security | Not Working | ya4ept |
| [tRO Chaos/Thor](https://ro.gnjoy.in.th/) | Thailand RO (Online) | nProtect | Not Working | N/A |
Expand Down
36 changes: 36 additions & 0 deletions src/Commands.pm
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,10 @@
], \&cmdNPCCreateRequest],
['nl', T("List NPCs that are on screen."), \&cmdNPCList],
['openbuyershop', undef, \&cmdOpenBuyerShop],
['openpackage', [
T("Use package item with selection."),
[T("<item name> <boxIndex>"), T("use package item selecting option")]
], \&cmdOpenPackage],
['openshop', T("Open your vending shop."), \&cmdOpenShop],
['p', [
T("Chat in the party chat."),
Expand Down Expand Up @@ -3572,7 +3576,7 @@
my $player = Match::player($arg2);
if (!$player) {
error TF("Player %s does not exist.\n", $arg2);
} elsif (!$char->{name} eq $guild{master}) {

Check failure on line 3579 in src/Commands.pm

View workflow job for this annotation

GitHub Actions / test ubuntu-latest (perl latest) x64

Possible precedence problem between ! and string eq

Check failure on line 3579 in src/Commands.pm

View workflow job for this annotation

GitHub Actions / test ubuntu-latest (perl latest) x64

Possible precedence problem between ! and string eq
error T("You must be guildmaster to set an alliance\n");
return;
} else {
Expand Down Expand Up @@ -4229,6 +4233,38 @@
message $msg, "list";
}

sub cmdOpenPackage {
my (undef, $args) = @_;

unless ($args) {
error "Usage: openpackage <item name> <boxIndex>\n";
return;
}

my @parts = split(/\s+/, $args);
my $boxIndex = pop @parts;
my $itemName = join(' ', @parts);

my $item = $char->inventory->getByName($itemName);

unless ($item) {
error "Item '$itemName' not found in inventory.\n";
return;
}

my $realIndex = unpack("v", $item->{ID});
my $nameID = $item->{nameID};
$boxIndex = int($boxIndex);

message "Using package item: $item->{name} (slot $realIndex / binID $item->{binID}) option $boxIndex\n";

$messageSender->sendUsePackageItem(
$realIndex,
$nameID,
$boxIndex
);
}

sub cmdOpenShop {
if (!$net || $net->getState() != Network::IN_GAME) {
error TF("You must be logged in the game to use this command '%s'\n", shift);
Expand Down
6 changes: 6 additions & 0 deletions src/Network/MessageTokenizer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use Modules 'register';
use bytes;
no encoding 'utf8';
use enum qw(KNOWN_MESSAGE UNKNOWN_MESSAGE ACCOUNT_ID);
use Globals qw($masterServer);

##
# Network::MessageTokenizer->new(Hash* rpackets)
Expand Down Expand Up @@ -131,6 +132,11 @@ sub readNext {
if (length($$buffer) >= 4) {

$result = substr($$buffer, 0, 4);

if ($masterServer->{accountIdFromBuffer}) {
$Globals::accountID = $result if $masterServer->{accountIdFromBuffer};
}

if (unpack("V1",$result) == unpack("V1",$Globals::accountID)) {
substr($$buffer, 0, 4, '');
$$type = ACCOUNT_ID;
Expand Down
7 changes: 6 additions & 1 deletion src/Network/Receive.pm
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,12 @@ sub received_characters_blockSize {
sub received_characters_unpackString {
my $char_info;
for ($masterServer && $masterServer->{charBlockSize}) {
if ($_ == 175) { # PACKETVER >= 20201007 [hp, hp_max, sp and sp_max are now uint64]
if ($_ == 247) { # PACKETVER >= 20211103? [extended char block: character name increased to 96 bytes]
$char_info = {
types => 'a4 V2 V V2 V6 v V2 V2 V2 V2 v2 V v9 Z96 C8 v Z16 V4 C',
keys => [qw(charID exp exp_2 zeny exp_job exp_job_2 lv_job body_state health_state effect_state stance manner status_point hp hp_2 hp_max hp_max_2 sp sp_2 sp_max sp_max_2 walkspeed jobID hair_style weapon lv skill_point head_bottom shield head_top head_mid hair_pallete clothes_color name str agi vit int dex luk slot hair_color is_renamed last_map delete_date robe slot_addon rename_addon sex)],
};
} elsif ($_ == 175) { # PACKETVER >= 20201007 [hp, hp_max, sp and sp_max are now uint64]
$char_info = {
types => 'a4 V2 V V2 V6 v V2 V2 V2 V2 v2 V v9 Z24 C8 v Z16 V4 C',
keys => [qw(charID exp exp_2 zeny exp_job exp_job_2 lv_job body_state health_state effect_state stance manner status_point hp hp_2 hp_max hp_max_2 sp sp_2 sp_max sp_max_2 walkspeed jobID hair_style weapon lv skill_point head_bottom shield head_top head_mid hair_pallete clothes_color name str agi vit int dex luk slot hair_color is_renamed last_map delete_date robe slot_addon rename_addon sex)],
Expand Down
20 changes: 20 additions & 0 deletions src/Network/Receive/laRO.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package Network::Receive::laRO;
use strict;
use base qw(Network::Receive::kRO::RagexeRE_2021_11_03);

sub new {
my ($class) = @_;
my $self = $class->SUPER::new(@_);

my %packets = ();

$self->{packet_list}{$_} = $packets{$_} for keys %packets;

my %handlers = qw();

$self->{packet_lut}{$_} = $handlers{$_} for keys %handlers;

return $self;
}

1;
54 changes: 54 additions & 0 deletions src/Network/Send/laRO.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package Network::Send::laRO;
use strict;
use base qw(Network::Send::kRO::RagexeRE_2021_11_03);
use Globals qw($accountID);

sub new {
my ( $class ) = @_;
my $self = $class->SUPER::new( @_ );

my %packets = (
'0064' => ['master_login', 'V Z24 Z24 C', [qw(version username password master_version)]],
'0BAF' => ['use_packageitem', 'v V V V', [qw(index accountID itemID boxIndex)]],
);

$self->{packet_list}{$_} = $packets{$_} for keys %packets;

my %handlers = qw(
master_login 0064
use_packageitem 0BAF
);

$self->{packet_lut}{$_} = $handlers{$_} for keys %handlers;

return $self;
}

sub sendUsePackageItem {
my ($self, $index, $itemID, $boxIndex) = @_;

my $acc = $accountID;
if (defined $acc && length($acc) == 4 && $acc !~ /^\d+$/) {
$acc = unpack('V', $acc);
}
$acc = 0 unless defined $acc;

$self->sendToServer($self->reconstruct({
switch => 'use_packageitem',
index => int($index),
accountID => int($acc),
itemID => int($itemID),
boxIndex => int($boxIndex),
}));
}

sub sendMasterLogin {
my ($self, $username, $password, $master_version, $version) = @_;
$self->sendToServer(pack('v a16', 0x0204,
pack('H*', 'a81b5c0b40ce1c6a0beebc2aed11742f')
));

$self->SUPER::sendMasterLogin($username, $password, $master_version, $version);
}

1;
Loading
Loading