Skip to content

Commit

Permalink
Fix skill failed packet (#3918)
Browse files Browse the repository at this point in the history
* Fix skill failed packet

* corrected the translation line

---------

Co-authored-by: ya4ept <ya4ept@ya.ru>
  • Loading branch information
Henrybk and ya4ept authored Dec 26, 2024
1 parent b10b2f2 commit f50bb7a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
26 changes: 13 additions & 13 deletions src/Network/Receive.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11686,12 +11686,6 @@ sub isvr_disconnect {
sub skill_use_failed {
my ($self, $args) = @_;

# skill fail/delay
my $skillID = $args->{skillID};
my $btype = $args->{btype};
my $fail = $args->{fail};
my $type = $args->{type};

my %basefailtype = (
0 => $msgTable[160],#"skill failed"
1 => $msgTable[161],#"no emotions"
Expand Down Expand Up @@ -11740,25 +11734,31 @@ sub skill_use_failed {
);

my $errorMessage;
if ($skillID == 1 && $type == 0 && exists $basefailtype{$btype}) {
$errorMessage = $basefailtype{$btype};
} elsif (exists $failtype{$type}) {
$errorMessage = $failtype{$type};
if ($args->{skillID} == 1 && $args->{cause} == 0 && exists $basefailtype{$args->{btype}}) {
$errorMessage = $basefailtype{$args->{btype}};
} elsif (exists $failtype{$args->{cause}}) {
$errorMessage = $failtype{$args->{cause}};
if ($args->{cause} == 71) {
$errorMessage .= T(' - item ').$args->{itemId};
}
} else {
$errorMessage = T('Unknown error');
}

delete $char->{casting};

my %hookArgs;
$hookArgs{skillID} = $skillID;
$hookArgs{failType} = $type;
$hookArgs{skillID} = $args->{skillID};
$hookArgs{btype} = $args->{btype};
$hookArgs{itemId} = $args->{itemId};
$hookArgs{flag} = $args->{flag};
$hookArgs{cause} = $args->{cause};
$hookArgs{failMessage} = $errorMessage;
$hookArgs{warn} = 1;

Plugins::callHook('packet_skillfail', \%hookArgs);

warning(TF("Skill %s failed: %s (error number %s)\n", Skill->new(idn => $skillID)->getName(), $errorMessage, $type), "skill") if ($hookArgs{warn});
warning(TF("Skill %s failed: %s (error number %s)\n", Skill->new(idn => $args->{skillID})->getName(), $errorMessage, $args->{cause}), "skill") if ($hookArgs{warn});
}

sub open_store_status {
Expand Down
5 changes: 4 additions & 1 deletion src/Network/Receive/ServerType0.pm
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ sub new {
'010C' => ['mvp_other', 'a4', [qw(ID)]],
'010E' => ['skill_update', 'v4 C', [qw(skillID lv sp range up)]], # range = skill range, up = this skill can be leveled up further
'010F' => ['skills_list'],
'0110' => ['skill_use_failed', 'v V C2', [qw(skillID btype fail type)]],
'0110' => ($rpackets{'0110'}{length} == 14) # or 10
? ['skill_use_failed', 'v V2 C2', [qw(skillID btype itemId flag cause)]]
: ['skill_use_failed', 'v v2 C2', [qw(skillID btype itemId flag cause)]]
,
'0111' => ['skill_add', 'v V v3 Z24 C', [qw(skillID target lv sp range name upgradable)]],
'0114' => ['skill_use', 'v a4 a4 V3 v3 C', [qw(skillID sourceID targetID tick src_speed dst_speed damage level option type)]],
'0117' => ['skill_use_location', 'v a4 v3 V', [qw(skillID sourceID lv x y tick)]],
Expand Down
5 changes: 4 additions & 1 deletion src/Network/Receive/kRO/Sakexe_0.pm
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,10 @@ sub new {
'010D' => ['mvp_item_trow'], # 2
'010E' => ['skill_update', 'v4 C', [qw(skillID lv sp range up)]], # 11 # range = skill range, up = this skill can be leveled up further
'010F' => ['skills_list'], # -1
'0110' => ['skill_use_failed', 'v V C2', [qw(skillID btype fail type)]], # 10
'0110' => ($rpackets{'0110'}{length} == 14) # or 10
? ['skill_use_failed', 'v V2 C2', [qw(skillID btype itemId flag cause)]]
: ['skill_use_failed', 'v v2 C2', [qw(skillID btype itemId flag cause)]]
,
'0111' => ['skill_add', 'v V v3 Z24 C', [qw(skillID target lv sp range name upgradable)]], # 39
'0114' => ['skill_use', 'v a4 a4 V3 v3 C', [qw(skillID sourceID targetID tick src_speed dst_speed damage level option type)]], # 31
'0115' => ['skill_use_position', 'v a4 a4 V3 v5 C', [qw(skillID sourceID targetID tick src_speed dst_speed x y damage level option type)]], # 35
Expand Down

0 comments on commit f50bb7a

Please sign in to comment.