Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug fix for mon_control #3401

Merged
merged 1 commit into from
Apr 16, 2021
Merged
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
25 changes: 9 additions & 16 deletions src/Network/Receive.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1737,7 +1737,9 @@ sub actor_display {
#### Initialize ####

my $nameID = unpack("V", $args->{ID});

my $name = bytesToString($args->{name});
$name =~ s/^\s+|\s+$//g;

if ($args->{switch} eq "0086") {
# Message 0086 contains less information about the actor than other similar
# messages. So we use the existing actor information.
Expand Down Expand Up @@ -1845,11 +1847,7 @@ sub actor_display {
$actor = new Actor::Player();
$actor->{appear_time} = time;
# New actor_display packets include the player's name
if ($args->{switch} eq "0086") {
$actor->{name} = $args->{name};
} else {
$actor->{name} = bytesToString($args->{name}) if exists $args->{name};
}
$actor->{name} = $name if defined $name;
$mustAdd = 1;
}
$actor->{nameID} = $nameID;
Expand All @@ -1871,7 +1869,7 @@ sub actor_display {
}

$actor->{appear_time} = time;
$actor->{name_given} = bytesToString($args->{name}) if exists $args->{name};
$actor->{name_given} = $name if defined $name;
$actor->{jobID} = $args->{type} if exists $args->{type};
$mustAdd = 1;
}
Expand Down Expand Up @@ -1901,12 +1899,11 @@ sub actor_display {
if (!defined $actor) {
$actor = new Actor::Pet();
$actor->{appear_time} = time;
my $name = bytesToString($args->{name});
$actor->{name} = $name;
# if ($monsters_lut{$args->{type}}) {
# $actor->setName($monsters_lut{$args->{type}});
# }
$actor->{name_given} = exists $args->{name} ? $name : T("Unknown");
$actor->{name_given} = defined $name ? $name : T("Unknown");
$mustAdd = 1;

# Previously identified monsters could suddenly be identified as pets.
Expand All @@ -1927,11 +1924,7 @@ sub actor_display {
$actor->setName($monsters_lut{$args->{type}});
}
# New actor_display packets include the Monster name
if ($args->{switch} eq "0086") {
$actor->{name} = $args->{name};
} else {
$actor->{name} = bytesToString($args->{name}) if exists $args->{name};
}
$actor->{name} = $name if defined $name;
$actor->{name_given} = "Unknown";
$actor->{binType} = $args->{type};
$mustAdd = 1;
Expand All @@ -1945,7 +1938,7 @@ sub actor_display {
if (!defined $actor) {
$actor = new Actor::NPC();
$actor->{appear_time} = time;
$actor->{name} = bytesToString($args->{name}) if exists $args->{name};
$actor->{name} = $name if defined $name;
$mustAdd = 1;
}
$actor->{nameID} = $nameID;
Expand Down Expand Up @@ -2560,6 +2553,7 @@ sub actor_info {
my ($self, $args) = @_;
return unless changeToInGameState();
my $name = bytesToString($args->{name});
$name =~ s/^\s+|\s+$//g;
debug "Received object info: $name\n", "parseMsg_presence/name", 2;
my $player = $playersList->getByID($args->{ID});
if ($player) {
Expand All @@ -2582,7 +2576,6 @@ sub actor_info {

my $monster = $monstersList->getByID($args->{ID});
if ($monster) {
$name =~ s/^\s+|\s+$//g;
debug "Monster Info: $name ($monster->{binID})\n", "parseMsg", 2;
$monster->{name_given} = $name;
$monster->{info} = 1;
Expand Down