Page 1 of 1

Disguise event plugin

Posted: 29 Sep 2018, 12:41
by manticora
Here is plugin for rhe "Disguise event". The bot must be "manual AI" and "move prontera 162 155".

.\openkore\GGamerzRO\openkore\src\Network\Receive.pm
Please add the line: Plugins::callHook('disguise_event', {hh => $args->{type}});

Code: Select all

sub actor_display {
...
...
		# Actor Connected (new)

		if ($actor->isa('Actor::Player')) {
			my $domain = existsInList($config{friendlyAID}, unpack("V", $args->{ID})) ? 'parseMsg_presence' : 'parseMsg_presence/player';
			debug "Player Connected: ".$actor->name." ($actor->{binID}) Level $args->{lv} $sex_lut{$actor->{sex}} $jobs_lut{$actor->{jobID}} ($coordsTo{x}, $coordsTo{y})\n", $domain;

			Plugins::callHook('player', {player => $actor});  #backwards compatibailty

			Plugins::callHook('player_connected', {player => $actor});
		} else {
			debug "Unknown Connected: $args->{type} - \n", "parseMsg";
			# Manticora 16.09.2018. Next line is for the Disguise Event on ggamerz-ro.com
			Plugins::callHook('disguise_event', {hh => $args->{type}});
		}
.\openkore\plugins\DisguiseEventPlugin\DisguiseEventPlugin.pl

Code: Select all

package DisguiseEventPlugin;
use strict;
use Globals qw/$char $net $messageSender/;
use Log qw/message/;
use Misc qw/sendMessage/;

my $hooks = Plugins::addHooks(
	['disguise_event', \&disguise_event],
);

Plugins::register('DisguiseEventPlugin', 'Disguise Event', sub { Plugins::delHooks($hooks) }); #TODO: Description? Link to iRO-wiki?

sub disguise_event {
	my ($hookname, $args) = @_;
	my $monsterId = $args->{hh}; #TODO: Rename the argument

	if ($net && $net->getState != Network::NOT_CONNECTED) {
		#move prontera 162 155
		if ($char->{pos}{x} == 162 && $char->{pos}{y} == 155) { #TODO: check if Prontera
			if ($monsterId != 795) { #TODO:
				if (exists $::monsters_lut{$monsterId}) {
					message "The monster is: [$monsterId] $::monsters_lut{$monsterId}\n"; #TODO: Localization
					sendMessage($messageSender, "c", $::monsters_lut{$monsterId}, ""); #TODO: add a delay x*length. timeout?
					#TODO: the monster name is not correct --> error message?
				} else {
					message "There is no monster with id $monsterId. Please check your tables/monsters.txt\n"; #TODO: Localization
				}
			}
		}
	}
}

1;
.\openkore\tables\monsters.txt

Code: Select all

#A default english table has been provided
#Remove all lines below to have Kore auto-generate this table
1001 Scorpion
1002 Poring
1003 Test Egg
1004 Hornet
1005 Familiar
1006 Thief Bug's Larva
1007 Fabre
1008 Pupa
1009 Condor
1010 Willow
1011 Chonchon
1012 Roda frog
1013 Wolf
1014 Spore
1015 Zombie
1016 Skel Archer
1017 Female Thief Bug
1018 Creamy
1019 Pecopeco
1020 Mandragora
1021 Male Thief Bug
1022 Were Wolf
1023 Orc Warrior
1024 Worm Tail
...
.\openkore\GGamerzRO\openkore\control\sys.txt
Add the DisguiseEventPlugin to the loadPlugins_list:

Code: Select all

loadPlugins_list macro,profiles,breakTime,raiseStat,raiseSkill,map,reconnect,eventMacro,item_weight_recorder,xconf,DisguiseEventPlugin

Re: Disguise event plugin

Posted: 29 Sep 2018, 23:17
by fadreus
If it's working, why not make PR in git? :D
More power to you.

Re: Disguise event plugin

Posted: 02 Oct 2018, 21:40
by SkylorD
Awnt i love his nickname! Now i can understand about classes and this.

Oh man, then is it a monster and a npc at the same time ?
I would never think about this.
Why this man ?

#removed

Re: Disguise event plugin

Posted: 10 Oct 2018, 10:27
by angely
Nice job :D !