Page 1 of 1

About actor types in actor_display

Posted: 12 May 2013, 00:45
by iMikeLance
Revision: 8558
Author: marcelofoxes
Date: domingo, 12 de maio de 2013 02:13:27
Message:
* fixed a REALLY old bug where kore identifies pets as monsters. this caused a lot of bugs, including kore trying to attack pets and adding pet names to monsters.txt
----
Modified : /openkore/trunk/src/Network/Receive.pm

Revision: 8559
Author: marcelofoxes
Date: domingo, 12 de maio de 2013 02:28:58
Message:
* oops, wrong constant
----
Modified : /openkore/trunk/src/Network/Receive.pm
Is there any incompatibility with older servertypes in using object_type constants? Cause if not, we should really use them instead of the current actor detection method.
Like:

Code: Select all

if ($args->{hair_style} == 0x64) {
Wtf? Checking hair_style in order to diff between monster and pet actors?
Changed to this:

Code: Select all

if ($args->{hair_style} == 0x64 || $args->{object_type} == NPC_PET_TYPE) {

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
};
Just wanna know if there's any incompatibility with older servertypes. If not, I can implement this.

Re: About actor types in actor_display

Posted: 12 May 2013, 06:32
by EternalHarvest
iMikeLance wrote: Wtf? Checking hair_style in order to diff between monster and pet actors?
Ask Gravity developers.

Something like this will be good and work with every server old and new (but object_type part needs further testing and tweaking):

Code: Select all

	#### Step 0: determine object type ####
	my $object_class;
	if (defined $args->{object_type}) {
		if ($args->{type} == 45) { # portals use the same object_type as NPCs
			$object_class = 'Actor::Portal';
		} else {
			$object_class = {
				PC_TYPE => 'Actor::Player',
				# NPC_TYPE? # not encountered, NPCs are NPC_EVT_TYPE
				# SKILL_TYPE? # not encountered
				# UNKNOWN_TYPE? # not encountered
				NPC_MOB_TYPE => 'Actor::Monster',
				NPC_EVT_TYPE => 'Actor::NPC', # both NPCs and portals
				NPC_PET_TYPE => 'Actor::Pet',
				NPC_HO_TYPE => 'Actor::Slave',
				# NPC_MERSOL_TYPE => 'Actor::Slave', # not encountered
				# NPC_ELEMENTAL_TYPE => 'Actor::Slave', # not encountered
			}->{$args->{object_type}};
		}
	}
	unless (defined $object_class) {
		if ($jobs_lut{$args->{type}}) {
			unless ($args->{type} > 6000) {
				$object_class = 'Actor::Player';

			} else {
				$object_class = 'Actor::Slave';
			}

		} elsif ($args->{type} == 45) {
			$object_class = 'Actor::Portal';

		} elsif ($args->{type} >= 1000) {
			if ($args->{hair_style} == 0x64) {
				$object_class = 'Actor::Pet';

			} else {
				$object_class = 'Actor::Monster';
			}

		} else {	# ($args->{type} < 1000 && $args->{type} != 45 && !$jobs_lut{$args->{type}})
			$object_class = 'Actor::NPC';
		}
	}

	#### Step 1: create/get the correct actor object ####
	# TODO check $object_class instead of actor detection and object_type
	if ($object_class eq 'Actor::Player') {
		# ...
	} elsif ($object_class eq 'Actor::Slave') {
		# ...

SVN r8570 identifies monster NPC as real monsters.

Posted: 14 May 2013, 07:19
by Dark Airnel
I just downloaded r8570 and I noticed that it seems to identify NPC monsters as real monsters and it is actually trying to attack it. I also have the SVN r8512 and it identifies the same monster NPC with no problems. I have the same configuration and settings for both. Is this a bug?

Re: SVN r8570 identifies monster NPC as real monsters.

Posted: 14 May 2013, 07:42
by Raider
Interesting, what server settings do you use?
The modifications in receive.pm got my attention.

Re: SVN r8570 identifies monster NPC as real monsters.

Posted: 15 May 2013, 01:06
by Dark Airnel

Code: Select all

[XxxxxRO]
ip xxx.xxx.xxx.xxx
port 6900
private 1
master_version 14
version 26
serverType kRO_RagexeRE_2012_04_10a
serverEncoding Western
chatLangCode 0
charBlockSize 144
clientHash 1751ED975761D037E405B8ACC1205874
addTableFolders pserver/XxxxxRO;eA;kRO/RagexeRE_2012_04_10a;translated/kRO_english;kRO
@iMikeLance

Does that mean if I use any revision earlier than r8558 it is likely I will not be getting the same issue? I had to maintain what I am using currently which is r8512 because of that issue.

Re: SVN r8570 identifies monster NPC as real monsters.

Posted: 15 May 2013, 07:07
by iMikeLance
Revision: 8571
Author: marcelofoxes
Date: quarta-feira, 15 de maio de 2013 09:04:28
Message:
* fixed incorrect constants access, actors should be identified correctly now. thanks sofax222
----
Modified : /openkore/trunk/src/Network/Receive.pm