Skip to content

Commit

Permalink
Fix eventmacro lvl hp sp conditions (#3937)
Browse files Browse the repository at this point in the history
  • Loading branch information
Henrybk authored Jan 10, 2025
1 parent cc06532 commit c2ebd57
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 26 deletions.
6 changes: 2 additions & 4 deletions plugins/eventMacro/eventMacro/Condition/BaseLevel.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use base 'eventMacro::Conditiontypes::NumericConditionState';
use Globals qw( $char );

sub _hooks {
[qw( packet/sendMapLoaded packet/stat_info )];
['base_level_changed','Network::Receive::map_changed','in_game','packet/stat_info'];
}

sub _get_val {
Expand All @@ -17,9 +17,7 @@ sub _get_val {
sub validate_condition {
my ( $self, $callback_type, $callback_name, $args ) = @_;

if ($callback_type eq 'hook') {
return $self->SUPER::validate_condition if $callback_name eq 'packet/stat_info' && $args && $args->{type} != 11;
} elsif ($callback_type eq 'variable') {
if ($callback_type eq 'variable') {
$self->update_validator_var($callback_name, $args);
}
return $self->SUPER::validate_condition( $self->validator_check );
Expand Down
7 changes: 2 additions & 5 deletions plugins/eventMacro/eventMacro/Condition/CurrentHP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use base 'eventMacro::Conditiontypes::NumericConditionState';
use Globals qw( $char );

sub _hooks {
[ 'packet/sendMapLoaded', 'packet/hp_sp_changed', 'packet/stat_info' ];
['Network::Receive::map_changed','in_game','packet/stat_info','packet/hp_sp_changed'];
}

sub _get_val {
Expand All @@ -21,10 +21,7 @@ sub _get_ref_val {
sub validate_condition {
my ( $self, $callback_type, $callback_name, $args ) = @_;

if ($callback_type eq 'hook') {
return $self->SUPER::validate_condition if $callback_name eq 'packet/stat_info' && $args && $args->{type} != 5;
return $self->SUPER::validate_condition if $callback_name eq 'packet/hp_sp_changed' && $args && $args->{type} != 5;
} elsif ($callback_type eq 'variable') {
if ($callback_type eq 'variable') {
$self->update_validator_var($callback_name, $args);
}
return $self->SUPER::validate_condition( $self->validator_check );
Expand Down
7 changes: 2 additions & 5 deletions plugins/eventMacro/eventMacro/Condition/CurrentSP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use base 'eventMacro::Conditiontypes::NumericConditionState';
use Globals qw( $char );

sub _hooks {
[ 'packet/sendMapLoaded', 'packet/hp_sp_changed', 'packet/stat_info' ];
['Network::Receive::map_changed','in_game','packet/stat_info','packet/hp_sp_changed'];
}

sub _get_val {
Expand All @@ -21,10 +21,7 @@ sub _get_ref_val {
sub validate_condition {
my ( $self, $callback_type, $callback_name, $args ) = @_;

if ($callback_type eq 'hook') {
return $self->SUPER::validate_condition if $callback_name eq 'packet/stat_info' && $args && $args->{type} != 7;
return $self->SUPER::validate_condition if $callback_name eq 'packet/hp_sp_changed' && $args && $args->{type} != 7;
} elsif ($callback_type eq 'variable') {
if ($callback_type eq 'variable') {
$self->update_validator_var($callback_name, $args);
}
return $self->SUPER::validate_condition( $self->validator_check );
Expand Down
7 changes: 3 additions & 4 deletions plugins/eventMacro/eventMacro/Condition/JobLevel.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use base 'eventMacro::Conditiontypes::NumericConditionState';
use Globals qw( $char );

sub _hooks {
[qw( packet/sendMapLoaded packet/stat_info )];
['job_level_changed','Network::Receive::map_changed','in_game','packet/stat_info'];
}

sub _get_val {
Expand All @@ -17,11 +17,10 @@ sub _get_val {
sub validate_condition {
my ( $self, $callback_type, $callback_name, $args ) = @_;

if ($callback_type eq 'hook') {
return $self->SUPER::validate_condition if $callback_name eq 'packet/stat_info' && $args && $args->{type} != 55;
} elsif ($callback_type eq 'variable') {
if ($callback_type eq 'variable') {
$self->update_validator_var($callback_name, $args);
}

return $self->SUPER::validate_condition( $self->validator_check );
}

Expand Down
6 changes: 2 additions & 4 deletions plugins/eventMacro/eventMacro/Condition/MaxHP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use base 'eventMacro::Conditiontypes::NumericConditionState';
use Globals qw( $char );

sub _hooks {
[ 'packet/sendMapLoaded', 'packet/stat_info' ];
['Network::Receive::map_changed','in_game','packet/stat_info','packet/hp_sp_changed'];
}

sub _get_val {
Expand All @@ -17,9 +17,7 @@ sub _get_val {
sub validate_condition {
my ( $self, $callback_type, $callback_name, $args ) = @_;

if ($callback_type eq 'hook') {
return $self->SUPER::validate_condition if $callback_name eq 'packet/stat_info' && $args && $args->{type} != 6;
} elsif ($callback_type eq 'variable') {
if ($callback_type eq 'variable') {
$self->update_validator_var($callback_name, $args);
}
return $self->SUPER::validate_condition( $self->validator_check );
Expand Down
6 changes: 2 additions & 4 deletions plugins/eventMacro/eventMacro/Condition/MaxSP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use base 'eventMacro::Conditiontypes::NumericConditionState';
use Globals qw( $char );

sub _hooks {
[ 'packet/sendMapLoaded', 'packet/stat_info' ];
['Network::Receive::map_changed','in_game','packet/stat_info','packet/hp_sp_changed'];
}

sub _get_val {
Expand All @@ -17,9 +17,7 @@ sub _get_val {
sub validate_condition {
my ( $self, $callback_type, $callback_name, $args ) = @_;

if ($callback_type eq 'hook') {
return $self->SUPER::validate_condition if $callback_name eq 'packet/stat_info' && $args && $args->{type} != 8;
} elsif ($callback_type eq 'variable') {
if ($callback_type eq 'variable') {
$self->update_validator_var($callback_name, $args);
}
return $self->SUPER::validate_condition( $self->validator_check );
Expand Down

0 comments on commit c2ebd57

Please sign in to comment.