SVN r8570 identifies monster NPC as real monsters.

Forum closed. All further discussion to be discussed at https://github.com/OpenKore/

Moderators: Moderators, Developers

Message
Author
iMikeLance
Moderators
Moderators
Posts: 208
Joined: 01 Feb 2010, 17:37
Noob?: No
Location: Brazil - MG
Contact:

About actor types in actor_display

#1 Post 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.

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

Re: About actor types in actor_display

#2 Post 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') {
		# ...

Dark Airnel
Been there done that!
Been there done that!
Posts: 133
Joined: 09 Oct 2009, 01:43
Noob?: No

SVN r8570 identifies monster NPC as real monsters.

#3 Post 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?

Raider
The Kore Devil
The Kore Devil
Posts: 672
Joined: 22 Feb 2013, 03:40
Noob?: No
Location: The Netherlands

Re: SVN r8570 identifies monster NPC as real monsters.

#4 Post by Raider »

Interesting, what server settings do you use?
The modifications in receive.pm got my attention.

Dark Airnel
Been there done that!
Been there done that!
Posts: 133
Joined: 09 Oct 2009, 01:43
Noob?: No

Re: SVN r8570 identifies monster NPC as real monsters.

#5 Post 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.

iMikeLance
Moderators
Moderators
Posts: 208
Joined: 01 Feb 2010, 17:37
Noob?: No
Location: Brazil - MG
Contact:

Re: SVN r8570 identifies monster NPC as real monsters.

#6 Post 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

Locked