Openkore.com

OpenKore Forums
It is currently 21 Oct 2018, 00:02

All times are UTC - 5 hours [ DST ]





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: About actor types in actor_display
PostPosted: 12 May 2013, 00:45 
Offline
Moderators
Moderators
User avatar

Joined: 01 Feb 2010, 17:37
Posts: 211
Location: Brazil - MG
Quote:
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:
if ($args->{hair_style} == 0x64) {

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

Code:
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.

_________________
Brazilian Community: http://openkore-brasil.com
BetaKore: https://code.google.com/p/betakore/


Top
 Profile  
 
 Post subject: Re: About actor types in actor_display
PostPosted: 12 May 2013, 06:32 
Offline
Developers
Developers

Joined: 05 Dec 2008, 05:42
Posts: 1811
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:
   #### 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') {
      # ...


Top
 Profile  
 
 Post subject: SVN r8570 identifies monster NPC as real monsters.
PostPosted: 14 May 2013, 07:19 
Offline
Been there done that!
Been there done that!
User avatar

Joined: 09 Oct 2009, 01:43
Posts: 134
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?


Top
 Profile  
 
 Post subject: Re: SVN r8570 identifies monster NPC as real monsters.
PostPosted: 14 May 2013, 07:42 
Offline
The Kore Devil
The Kore Devil
User avatar

Joined: 22 Feb 2013, 03:40
Posts: 675
Location: The Netherlands
Interesting, what server settings do you use?
The modifications in receive.pm got my attention.


Top
 Profile  
 
 Post subject: Re: SVN r8570 identifies monster NPC as real monsters.
PostPosted: 15 May 2013, 01:06 
Offline
Been there done that!
Been there done that!
User avatar

Joined: 09 Oct 2009, 01:43
Posts: 134
Code:
[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.


Top
 Profile  
 
 Post subject: Re: SVN r8570 identifies monster NPC as real monsters.
PostPosted: 15 May 2013, 07:07 
Offline
Moderators
Moderators
User avatar

Joined: 01 Feb 2010, 17:37
Posts: 211
Location: Brazil - MG
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

_________________
Brazilian Community: http://openkore-brasil.com
BetaKore: https://code.google.com/p/betakore/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group