Openkore.com

OpenKore Forums
It is currently 20 Sep 2018, 22:05

All times are UTC - 5 hours [ DST ]





Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: [Suggestion] Add new hook in...
PostPosted: 01 Jul 2015, 01:03 
Offline
Noob
Noob

Joined: 05 May 2009, 21:02
Posts: 8
I'm programming a plugin, and create a new hook, surely it interesting for the community, and I would like to add it to SVN.

openkore\src\Network\Receive.pm

In sub 'actor_display'
Code:
if ($mustAdd) {
      if (UNIVERSAL::isa($actor, "Actor::Player")) {
         $playersList->add($actor);         
         Plugins::callHook('add_player_list', $actor);

      } elsif (UNIVERSAL::isa($actor, "Actor::Monster")) {
         $monstersList->add($actor);
         Plugins::callHook('add_monster_list', $actor);

      } elsif (UNIVERSAL::isa($actor, "Actor::Pet")) {
         $petsList->add($actor);
         Plugins::callHook('add_pet_list', $actor);

      } elsif (UNIVERSAL::isa($actor, "Actor::Portal")) {
         $portalsList->add($actor);
         Plugins::callHook('add_portal_list', $actor);

      } elsif (UNIVERSAL::isa($actor, "Actor::NPC")) {
         my $ID = $args->{ID};
         my $location = $field->baseName . " $actor->{pos}{x} $actor->{pos}{y}";
         if ($npcs_lut{$location}) {
            $actor->setName($npcs_lut{$location});
         }
         $npcsList->add($actor);
         Plugins::callHook('add_npc_list', $actor);

      } elsif (UNIVERSAL::isa($actor, "Actor::Slave")) {
         $slavesList->add($actor);
         Plugins::callHook('add_slave_list', $actor);
      }
   }


In sub 'actor_died_or_disappeared'
Code:
} elsif (defined $portalsList->getByID($ID)) {
      my $portal = $portalsList->getByID($ID);
      debug "Portal Disappeared: " . $portal->name . " ($portal->{binID})\n", "parseMsg";
      $portal->{disappeared} = 1;
      $portal->{gone_time} = time;
      $portals_old{$ID} = $portal->deepCopy();
      $portalsList->remove($portal);
      Plugins::callHook('portal_disappeared', $portal);

   } elsif (defined $npcsList->getByID($ID)) {
      my $npc = $npcsList->getByID($ID);
      debug "NPC Disappeared: " . $npc->name . " ($npc->{nameID})\n", "parseMsg";
      $npc->{disappeared} = 1;
      $npc->{gone_time} = time;
      $npcs_old{$ID} = $npc->deepCopy();
      $npcsList->remove($npc);
      Plugins::callHook('npc_disappeared', $npc);

   } elsif (defined $petsList->getByID($ID)) {
      my $pet = $petsList->getByID($ID);
      debug "Pet Disappeared: " . $pet->name . " ($pet->{binID})\n", "parseMsg";
      $pet->{disappeared} = 1;
      $pet->{gone_time} = time;
      $petsList->remove($pet);
      Plugins::callHook('pet_disappeared', $pet);


Top
 Profile  
 
 Post subject: Re: [Suggestion] Add new hook in...
PostPosted: 17 Feb 2016, 07:48 
Offline
Developers
Developers

Joined: 15 Mar 2011, 22:50
Posts: 11
Added on r9023.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group