Skip to content
Permalink
Browse files

kore:

* removed: a ton of redunant code from setStatus (please test)

kRO ST:
 * add: support for charblocksize: 128
 * change: extracted unpack information for _items_ (please test)
 * add: support for items_nonstackable inner structs with len 28
 * add: latest 00aa packet
  • Loading branch information...
technologyguild committed Jul 21, 2010
1 parent 0ac2625 commit daefa83c3f5ae35cebe978b96be4d031b388bd44
@@ -2271,41 +2271,43 @@ sub setStatus {
my $verbosity = $actor->{ID} eq $accountID ? 1 : 2;
my $changed = 0;

foreach (keys %stateHandle) {
if ($opt1 == $_) {
if (!$actor->{statuses}{$stateHandle{$_}}) {
$actor->{statuses}{$stateHandle{$_}} = 1;
message TF("%s %s in %s state.\n", $actor->nameString, $actor->verb('are', 'is'), $statusName{$stateHandle{$_}} || $stateHandle{$_}), "parseMsg_statuslook", $verbosity;
$changed = 1;
}
} elsif ($actor->{statuses}{$stateHandle{$_}}) {
delete $actor->{statuses}{$stateHandle{$_}};
message TF("%s %s out of %s state.\n", $actor->nameString, $actor->verb('are', 'is'), $statusName{$stateHandle{$_}} || $stateHandle{$_}), "parseMsg_statuslook", $verbosity;
$changed = 1;
}
}
my $match_id = sub {return ($_[0] == $_[1])};
my $match_bitflag = sub {return (($_[0] & $_[1]) == $_[1])};

=pod Replacement for two following for-s
for (
[$opt2, \%ailmentHandle],
[$option, \%lookHandle],
[$opt1, \%stateHandle, $match_id, 'handle'],
[$opt2, \%ailmentHandle, $match_bitflag, 'ailment'],
[$option, \%lookHandle, $match_bitflag, 'look'],
) {
my ($option, $handle) = @$_;
my ($option, $handle, $match, $name) = @$_;
for (keys %$handle) {
if ($option & $_) { # $_ == 0 isn't needed
if (&$match($option, $_)) {
unless ($actor->{statuses}{$handle->{$_}}) {
$actor->{statuses}{$handle->{$_}} = 1;
status_string($actor, $statusName{$handle->{$_}}, 'now');
status_string($actor, $statusName{$handle->{$_}}, 'now ' . $name);
$changed = 1;
}
} elsif ($actor->{statuses}{$handle->{$_}}) {
delete $actor->{statuses}{$handle->{$_}};
status_string($actor, $statusName{$handle->{$_}}, 'no longer');
status_string($actor, $statusName{$handle->{$_}}, 'no longer ' . $name);
$changed = 1;
}
}
}
=cut
=pod
foreach (keys %stateHandle) {
if ($opt1 == $_) {
if (!$actor->{statuses}{$stateHandle{$_}}) {
$actor->{statuses}{$stateHandle{$_}} = 1;
message TF("%s %s in %s state.\n", $actor, $actor->verb('are', 'is'), $statusName{$stateHandle{$_}} || $stateHandle{$_}), "parseMsg_statuslook", $verbosity;
$changed = 1;
}
} elsif ($actor->{statuses}{$stateHandle{$_}}) {
delete $actor->{statuses}{$stateHandle{$_}};
message TF("%s %s out of %s state.\n", $actor, $actor->verb('are', 'is'), $statusName{$stateHandle{$_}} || $stateHandle{$_}), "parseMsg_statuslook", $verbosity;
$changed = 1;
}
}
foreach (keys %ailmentHandle) {
if (($opt2 & $_) == $_) {
@@ -2320,11 +2322,7 @@ sub setStatus {
}
} elsif ($actor->{statuses}{$ailmentHandle{$_}}) {
delete $actor->{statuses}{$ailmentHandle{$_}};
if ($actor->isa('Actor::You')) {
message TF("%s are out of ailment: %s.\n", $actor->nameString(), $statusName{$ailmentHandle{$_}} || $ailmentHandle{$_}), "parseMsg_statuslook", $verbosity;
} else {
message TF("%s is out of ailment: %s.\n", $actor->nameString(), $statusName{$ailmentHandle{$_}} || $ailmentHandle{$_}), "parseMsg_statuslook", $verbosity;
}
message TF("%s %s out of %s ailment.\n", $actor, $actor->verb('are', 'is'), $statusName{$ailmentHandle{$_}} || $ailmentHandle{$_}), "parseMsg_statuslook", $verbosity;
$changed = 1;
}
}
@@ -2342,15 +2340,11 @@ sub setStatus {
}
} elsif ($actor->{statuses}{$lookHandle{$_}}) {
delete $actor->{statuses}{$lookHandle{$_}};
if ($actor->isa('Actor::You')) {
message TF("%s are out of look: %s.\n", $actor->nameString, $statusName{$lookHandle{$_}} || $lookHandle{$_}), "parseMsg_statuslook", $verbosity;
} else {
message TF("%s is out of look: %s.\n", $actor->nameString, $statusName{$lookHandle{$_}} || $lookHandle{$_}), "parseMsg_statuslook", $verbosity;
}
message TF("%s %s out of %s look.\n", $actor, $actor->verb('are', 'is'), $statusName{$lookHandle{$_}} || $lookHandle{$_}), "parseMsg_statuslook", $verbosity;
$changed = 1;
}
}

=cut
Plugins::callHook('changed_status',{actor => $actor, changed => $changed});

# Remove perfectly hidden objects
@@ -30,11 +30,19 @@ sub new {
my ($class) = @_;
my $self = $class->SUPER::new(@_);
my %packets = (
'00AA' => ['equip_item', 'v3 C', [qw(index type viewID success)]], # 9
);

foreach my $switch (keys %packets) {
$self->{packet_list}{$switch} = $packets{$switch};
}

# TODO: implement in the right ST
$self->{nested}{items_nonstackable}{type3} = {
len => 28,
types => 'v2 C2 v2 C2 a8 l v2',
keys => [qw(index nameID type identified type_equip equipped broken upgrade cards expire bindOnEquipType unknown)],
};

return $self;
}
@@ -43,4 +51,4 @@ sub new {
=cut

1;
1;
Oops, something went wrong.

0 comments on commit daefa83

Please sign in to comment.
You can’t perform that action at this time.