How to identify a Monster NPC ?

This place is for Closed bug reports only. NOT for asking help!

Moderators: Moderators, Developers

Message
Author
sofax222
Developers
Developers
Posts: 214
Joined: 24 Nov 2010, 03:08
Noob?: Yes

Re: How to identify a Monster NPC ?

#11 Post by sofax222 »

kLabMouse wrote: That's not a solution. It's a hack!
There is a flag in packets, that indicate what type of Actor it is.
Is the flag what you say "type" ?
If it is "type".
The "type" of NPC is less than 1000 !
But, the "type" of Monster NPCs always is great than 1000 !

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: How to identify a Monster NPC ?

#12 Post by EternalHarvest »

object_type

We need something like that:

Code: Select all

+ use constant {
+ 	PC_TYPE => 0x0,
+ 	NPC_TYPE => 0x1,
+ 	ITEM_TYPE => 0x2,
+ 	SKILL_TYPE => 0x3,
+ 	UNKNOWN_TYPE => 0x4,
+ 	NPC_MOB_TYPE => 0x5,
+ 	NPC_EVT_TYPE => 0x6,
+ 	NPC_PET_TYPE => 0x7,
+ 	NPC_HO_TYPE => 0x8,
+ 	NPC_MERSOL_TYPE => 0x9,
+ 	NPC_ELEMENTAL_TYPE => 0xa,
+ };

- if ($jobs_lut{$args->{type}}) {
+ if (defined $args->{object_type} ? $args->{object_type} == PC_TYPE : $jobs_lut{$args->{type}}) {

# similar things for other checks in sub actor_display

sofax222
Developers
Developers
Posts: 214
Joined: 24 Nov 2010, 03:08
Noob?: Yes

Re: How to identify a Monster NPC ?

#13 Post by sofax222 »

Yes !
I add some code lines in src/Network/Receive/ServerType0.pm, such as:

Code: Select all

.....
	} elsif ($args->{type} >= 1000) { # FIXME: in rare cases RO uses a monster sprite for NPC's (JT_ZHERLTHSH = 0x4b0 = 1200) ==> use object_type ?
		my $obj_type = (defined $args->{object_type}) ? $args->{object_type} : -1;
		if ($obj_type == 6) {
		# Actor might be a monster NPC
			$actor = $npcsList->getByID($args->{ID});
			if (!defined $actor) {
				$actor = new Actor::NPC();
				$actor->{appear_time} = time;
				$mustAdd = 1;
			}
			$actor->{nameID} = $nameID;
		} else {
		# Actor might be a monster
		if ($args->{hair_style} == 0x64) {
.....
I has tested in the pay_dun03 and bra_fild01.
It seems to work !

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: How to identify a Monster NPC ?

#14 Post by kLabMouse »

sofax222 wrote:Yes !
I add some code lines in src/Network/Receive/ServerType0.pm, such as:

Code: Select all

.....
	} elsif ($args->{type} >= 1000) { # FIXME: in rare cases RO uses a monster sprite for NPC's (JT_ZHERLTHSH = 0x4b0 = 1200) ==> use object_type ?
		my $obj_type = (defined $args->{object_type}) ? $args->{object_type} : -1;
		if ($obj_type == 6) {
		# Actor might be a monster NPC
			$actor = $npcsList->getByID($args->{ID});
			if (!defined $actor) {
				$actor = new Actor::NPC();
				$actor->{appear_time} = time;
				$mustAdd = 1;
			}
			$actor->{nameID} = $nameID;
		} else {
		# Actor might be a monster
		if ($args->{hair_style} == 0x64) {
.....
I has tested in the pay_dun03 and bra_fild01.
It seems to work !
If it RLY works good, and all the existing Tricks are detected, then it's good to have it in SVN.
You have the right to commit =)

sofax222
Developers
Developers
Posts: 214
Joined: 24 Nov 2010, 03:08
Noob?: Yes

Re: How to identify a Monster NPC ?

#15 Post by sofax222 »

I already test OK in bra_fild01, pay_dun03 and hu_fild06

And, I has commited it !

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: How to identify a Monster NPC ?

#16 Post by kLabMouse »

OK. Moved to Fixed Bugs.

Post Reply