responseOnNPCImage "response base on NPC Image" by abt123

Other plugins for extending OpenKore's functionality. This forum is only for posting new plugins and commenting on existing plugins. For support, use the Support forum.

Moderator: Moderators

Message
Author
User avatar
4epT
Developers
Developers
Posts: 617
Joined: 30 Apr 2008, 14:17
Noob?: No
Location: Moskow (Russia)
Contact:

Re: responseOnNPCImage "response base on NPC Image" by abt123

#101 Post by 4epT »

well ahm i make that change following guides ( i think so ) but i dont know for example when bot killer ask me
"botchecking" image 8 etc i have to respond " talk text "image 8", so what i got to do to this ting respond in automatic way..
secondly
see this:
http://forums.openkore.com/viewtopic.ph ... 29#p265129
All my posts are made by machine translator!
¤ Manual ¤ Anti BotKiller ¤ Packet Extractor v3 ¤
Image
Image

bingbing14
Noob
Noob
Posts: 2
Joined: 11 Dec 2014, 17:49
Noob?: Yes

Re: responseOnNPCImage "response base on NPC Image" by abt123

#102 Post by bingbing14 »

Hi I'm having problems lately with the reactonNPC.pl and responseOnNPCImage.pl
Kore doesnt respond on botcheck I tried fixing it for 16 hours (LOLOLOLOL) but no there are no good results. :|
The server is forsakenRO

These are the things i did:
1. i put responseOnNPCImage.pl and reactonNPC.pl in the folder 'plugins' (i didn't put the other macros files since i dont know how that works)
2. i added the this code in my config.txt

Code: Select all

reactOnNPC talkImage text {
	type text
	delay 10
	msg_0 [Bot Check]
	msg_1 Please type in the security/word in the picture!
}
This is my config.txt

Code: Select all

# Please Read the Users Manual
# The Manual is located at http://openkore.sourceforge.net/manual/
######## Login options and server-specific options ########

master ForsakenRO
server 0
username
password
loginPinCode
char 1
sex

bindIp
# For an overview of all servertypes please go to the following URL:
# http://www.openkore.com/wiki/index.php/ServerType#English
serverType 8_4

# 1 = hook into RO client, 2 = Act as stand-alone proxy, proxy = act as true proxy
XKore 0
XKore_silent 1
XKore_bypassBotDetection 0
XKore_exeName fkenro.exe

# XKore 2 / Proxy configuration
XKore_listenIp 127.0.0.1
XKore_listenPort 6901
XKore_publicIp 127.0.0.1

# It is not advised to set secureAdminPassword if you're using Xkore 2
secureAdminPassword 1
adminPassword youwitub
callSign
commandPrefix ;

pauseCharServer 0
pauseMapServer 0
ignoreInvalidLogin 0
secureLogin_requestCode

message_length_max 80

######## Main configuration ########

alias_heal sp 28

allowedMaps
allowedMaps_reaction 1

attackAuto 2
attackAuto_party 1
attackAuto_onlyWhenSafe 0
attackAuto_followTarget 1
attackAuto_inLockOnly 1
attackDistance 1.5
attackDistanceAuto 0
attackMaxDistance 2.5
attackMaxRouteDistance 100
attackMaxRouteTime 4
attackMinPlayerDistance 2
attackMinPortalDistance 4
attackUseWeapon 1
attackNoGiveup 0
attackCanSnipe 0
attackCheckLOS 0
attackLooters 0
attackChangeTarget 1
aggressiveAntiKS 0

autoMoveOnDeath 0
autoMoveOnDeath_x
autoMoveOnDeath_y
autoMoveOnDeath_map

attackEquip_topHead
attackEquip_midHead
attackEquip_lowHead
attackEquip_leftHand
attackEquip_rightHand
attackEquip_leftAccessory
attackEquip_rightAccessory
attackEquip_robe
attackEquip_armor
attackEquip_shoes
attackEquip_arrow

autoBreakTime {
	startTime
	stopTime
}

autoConfChange {
	minTime
	varTime
	lvl
	joblvl
}

autoMakeArrows 0

autoRestart 0

autoRestartMin 10800
autoRestartSeed 3600

autoRestartSleep 1
autoSleepMin 900
autoSleepSeed 900

autoResponse 0

autoSpell

avoidGM_near 0
avoidGM_near_inTown 0
avoidGM_talk 0
avoidGM_reconnect 1800
avoidGM_ignoreList

avoidList 1
avoidList_inLockOnly 0
avoidList_reconnect 1800

cachePlayerNames 1
cachePlayerNames_duration 900
cachePlayerNames_maxSize 100

clientSight 20

dcOnDeath 0
dcOnDualLogin 0
dcOnDisconnect 0
dcOnEmptyArrow 0
dcOnMaxReconnections 0
dcOnMute 0
dcOnPM 0
dcOnZeny 0
dcOnStorageFull 1
dcOnPlayer 0

follow 0
followTarget
followEmotion 1
followEmotion_distance 4
followFaceDirection 0
followDistanceMax 6
followDistanceMin 3
followLostStep 12
followSitAuto 0
followBot 0

itemsTakeAuto 2
itemsTakeAuto_party 0
itemsGatherAuto 2
itemsMaxWeight 89
itemsMaxWeight_sellOrStore 48
itemsMaxNum_sellOrStore 99
cartMaxWeight 7900
itemsTakeAuto_new 0
    

lockMap moc_fild18
lockMap_x
lockMap_y
lockMap_randX
lockMap_randY

route_escape_reachedNoPortal 1
route_escape_randomWalk 1
route_escape_shout
route_avoidWalls 1
route_randomWalk 1
route_randomWalk_inTown 0
route_randomWalk_maxRouteTime 75
route_maxWarpFee
route_maxNpcTries 5
route_teleport 0
route_teleport_minDistance 150
route_teleport_maxTries 8
route_teleport_notInMaps
route_step 15

runFromTarget 0
runFromTarget_dist 6

saveMap
saveMap_warpToBuyOrSell 1
saveMap_warpChatCommand

shopAuto_open 0
shop_random 0

sitAuto_hp_lower 40
sitAuto_hp_upper 100
sitAuto_sp_lower 0
sitAuto_sp_upper 0
sitAuto_over_50 0
sitAuto_idle 1
sitAuto_look
sitAuto_look_from_wall


statsAddAuto 0
statsAddAuto_list
statsAddAuto_dontUseBonus 0
statsAdd_over_99 0

skillsAddAuto 0
skillsAddAuto_list

tankMode 0
tankModeTarget

teleportAuto_hp 10
teleportAuto_sp 0
teleportAuto_idle 0
teleportAuto_portal 0
teleportAuto_search 0
teleportAuto_minAggressives 0
teleportAuto_minAggressivesInLock 0
teleportAuto_onlyWhenSafe 0
teleportAuto_maxDmg 500
teleportAuto_maxDmgInLock 0
teleportAuto_deadly 1
teleportAuto_useSkill 3
teleportAuto_useChatCommand
teleportAuto_allPlayers 0
teleportAuto_atkCount 0
teleportAuto_atkMiss 10
teleportAuto_unstuck 0
teleportAuto_lostTarget 0
teleportAuto_dropTarget 0
teleportAuto_dropTargetKS 0
teleportAuto_attackedWhenSitting 0
teleportAuto_totalDmg 0
teleportAuto_totalDmgInLock 0
teleportAuto_equip_leftAccessory
teleportAuto_equip_rightAccessory
teleportAuto_lostHomunculus
teleportAuto_useItemForRespawn

dealAuto 1
dealAuto_names
partyAuto 1
partyAutoShare 0
guildAutoDeny 1

verbose 1
showDomain 0
squelchDomains
verboseDomains
beepDomains
beepDomains_notInTown

logChat 0
logPrivateChat 1
logPartyChat 1
logGuildChat 1
logSystemChat 1
logEmoticons
logConsole 0
logAppendUsername 1

chatTitleOversize 0
shopTitleOversize 0

sleepTime 10000

ignoreAll 0
itemHistory 0
autoTalkCont 1
noAutoSkill 0
portalRecord 2
missDamage 0

tankersList

repairAuto 0
repairAuto_list

removeActorWithDistance

######## Mercenary Support ########

mercenary_attackAuto 2
mercenary_attackAuto_party 1
mercenary_attackAuto_notInTown 1
mercenary_attackAuto_onlyWhenSafe 0
mercenary_attackDistance 1.5
mercenary_attackMaxDistance 2.5
mercenary_attackMaxRouteTime 4
mercenary_attackCanSnipe 0
mercenary_attackCheckLOS 0
mercenary_attackNoGiveup 0
mercenary_attackChangeTarget 1

mercenary_followDistanceMax 10
mercenary_followDistanceMin 3

mercenary_route_step 15

mercenary_tankMode 0
mercenary_tankModeTarget

mercenary_teleportAuto_hp 10
mercenary_teleportAuto_maxDmg 500
mercenary_teleportAuto_maxDmgInLock 0
mercenary_teleportAuto_deadly 1
mercenary_teleportAuto_unstuck 0
mercenary_teleportAuto_dropTarget 0
mercenary_teleportAuto_dropTargetKS 0
mercenary_teleportAuto_totalDmg 0
mercenary_teleportAuto_totalDmgInLock 0

######## Homunculus Support ########

homunculus_attackAuto 2
homunculus_attackAuto_party 1
homunculus_attackAuto_notInTown 1
homunculus_attackAuto_onlyWhenSafe 0
homunculus_attackDistance 1.5
homunculus_attackMaxDistance 2.5
homunculus_attackMaxRouteTime 4
homunculus_attackCanSnipe 0
homunculus_attackCheckLOS 0
homunculus_attackNoGiveup 0
homunculus_attackChangeTarget 1

homunculus_followDistanceMax 10
homunculus_followDistanceMin 3

homunculus_route_step 15

homunculus_tankMode 0
homunculus_tankModeTarget

homunculus_teleportAuto_hp 10
homunculus_teleportAuto_maxDmg 500
homunculus_teleportAuto_maxDmgInLock 0
homunculus_teleportAuto_deadly 1
homunculus_teleportAuto_unstuck 0
homunculus_teleportAuto_dropTarget 0
homunculus_teleportAuto_dropTargetKS 0
homunculus_teleportAuto_totalDmg 0
homunculus_teleportAuto_totalDmgInLock 0

# intimacyMax / Min sets a threshhold of when not to feed your homunculus
# If intimacy is HIGHER than the minimum or LOWER/EQUAL to the max, we wont feed.
homunculus_intimacyMax 999
homunculus_intimacyMin 911

# How long should we wait between feeding? default: random between 10 and 60 seconds
homunculus_hungerTimeoutMax 60
homunculus_hungerTimeoutMin 10

# Turn on/off homunculus autofeeding
homunculus_autoFeed 1
# In Wich maps should we allow feeding? (leave empty for any map)
homunculus_autoFeedAllowedMaps

# Feed homunculus between MIN and MAX value (example: between 11 and 25)
homunculus_hungerMin 11
homunculus_hungerMax 24

######## Block options ########
# You can copy & paste any block multiple times. So if you want to
# configure two attack skills, just duplicate the attackSkillSlot block.

attackSkillSlot {
	lvl 10
	dist 1.5
	maxCastTime 0
	minCastTime 0
	hp
	sp > 10
	homunculus_hp
	homunculus_sp
	homunculus_dead
	onAction
	whenStatusActive
	whenStatusInactive
	whenFollowing
	spirit
	aggressives
	previousDamage
	stopWhenHit 0
	inLockOnly 0
	notInTown 0
	timeout 0
	disabled 0
	monsters
	notMonsters
	maxAttempts 0
	maxUses 0
	target_whenStatusActive
	target_whenStatusInactive
	target_deltaHp
	inInventory
	isSelfSkill 0
	equip_topHead
	equip_midHead
	equip_lowHead
	equip_leftHand
	equip_rightHand
	equip_leftAccessory
	equip_rightAccessory
	equip_robe
	equip_armor
	equip_shoes
	equip_arrow
	manualAI 0
}

attackComboSlot {
	afterSkill
	waitBeforeUse
	dist 1.5
	isSelfSkill 1
	target_deltaHp
}

doCommand {
	hp
	sp
	homunculus_hp
	homunculus_sp
	homunculus_dead
	onAction
	whenStatusActive
	whenStatusInactive
	whenFollowing
	spirit
	aggressives
	monsters
	notMonsters
	stopWhenHit 0
	inLockOnly 0
	notWhileSitting 0
	notInTown 0
	timeout
	disabled 0
	inInventory
	inCart
	inMap
	manualAI 0
}


useSelf_skill {
	lvl 10
	maxCastTime 0
	minCastTime 0
	hp
	sp
	homunculus_hp
	homunculus_sp
	homunculus_dead
	onAction
	whenStatusActive
	whenStatusInactive
	whenFollowing
	spirit
	aggressives
	monsters
	notMonsters
	stopWhenHit 0
	inLockOnly 0
	notWhileSitting 0
	notInTown 0
	timeout 0
	disabled 0
	inInventory
	manualAI 0
}

useSelf_skill_smartHeal 1


partySkill {
	lvl 10
	maxCastTime 0
	minCastTime 0
	hp
	sp
	homunculus_hp
	homunculus_sp
	homunculus_dead
	onAction
	whenStatusActive
	whenStatusInactive
	whenFollowing
	spirit
	aggressives
	monsters
	notMonsters
	stopWhenHit 0
	inLockOnly 0
	notWhileSitting 0
	notInTown 0
	timeout 0
	disabled 0
	manualAI 0
	target
	target_hp
	target_isJob
	target_isNotJob
	target_whenStatusActive
	target_whenStatusInactive
	target_aggressives
	target_monsters
	target_timeout 0
	target_deltaHp
	target_dead 0
	inInventory
	isSelfSkill 0
}


autoSwitch_default_rightHand
autoSwitch_default_leftHand
autoSwitch_default_arrow

# NOTE: In the case of two handed weapons, or no Shield,
#       duplicate the weapon name for 'rightHand'
# To attack with bare hands, specify "[NONE]" (without the quotes) for rightHand

autoSwitch {
	rightHand
	leftHand
	arrow
	distance
	useWeapon
}

equipAuto {
	topHead
	midHead
	lowHead
	leftHand
	rightHand
	leftAccessory
	rightAccessory
	robe
	armor
	shoes
	arrow
	monsters
	weight 0
	whileSitting 0
	hp
	sp
	homunculus_hp
	homunculus_sp
	homunculus_dead
	onAction
	whenStatusActive
	whenStatusInactive
	whenFollowing
	spirit
	aggressives
	stopWhenHit 0
	inLockOnly 0
	notWhileSitting 0
	notInTown 0
	timeout 0
	disabled 0
	inInventory
	manualAI 0
}

useSelf_item {
	hp
	sp
	homunculus_hp
	homunculus_sp
	homunculus_dead
	onAction
	whenStatusActive
	whenStatusInactive
	whenFollowing
	spirit
	aggressives
	monsters
	notMonsters
	stopWhenHit 0
	inLockOnly 0
	notWhileSitting 0
	notInTown 0
	timeout
	disabled 0
	inInventory
	manualAI 0
}

######## Autostorage/autosell ########

buyAuto {
	npc
	standpoint
	distance 5
	price
	minAmount 2
	maxAmount 3
}

sellAuto 0
sellAuto_npc
sellAuto_standpoint
sellAuto_distance 5

storageAuto 0
storageAuto_npc
storageAuto_distance 5
storageAuto_npc_type 1
storageAuto_npc_steps
storageAuto_password
storageAuto_keepOpen 0
storageAuto_useChatCommand
relogAfterStorage 1
minStorageZeny 50

npcTimeResponse

getAuto {
	minAmount
	maxAmount
	passive
}

######## Debugging options; only useful for developers ########

debug 0
debugPacket_unparsed 0
debugPacket_received 0
debugPacket_ro_sent 0
debugPacket_sent 0
debugPacket_exclude
debugPacket_include
debugPacket_include_dumpMethod
debugDomains
charBlockSize 108
serverEncoding Western

responseOnNPCImage_equal <num | text | resp | or leave blank for disable>

reactOnNPC talkImage text {
	type text
	delay 10
	msg_0 [Bot Check]
	msg_1 Please type in the security/word in the picture!
}


#########################################################################
# This software is open source, licensed under the GNU General Public
# License, version 2.
# Basically, this means that you're allowed to modify and distribute
# this software. However, if you distribute modified versions, you MUST
# also distribute the source code.
# See http://www.gnu.org/licenses/gpl.html for the full license.
#########################################################################
#
# responseOnNPCImage v2
#
# Copyright 2007 by abt123 [mod ya4ept]
#
# NOTE: This plugin meant to be use with hakore's reactOnNPC
# http://forums.openkore.com/viewtopic.php?f=34&t=1071
# http://forums.openkore.com/viewtopic.php?f=34&t=198
#
# Example (put in config.txt):
# Some server use image name as a response.
# responseOnNPCImage_equal <num | text | resp | or leave blank for disable>
# reactOnNPC talkImage text {
#	type text
#	msg_0 [Bot Check]
#	msg_1 /.*/
# }
#########################################################################

package reactOnNPC;

use Utils qw (timeOut);
use Utils qw (timeOut);
use Utils qw (timeOut);
use Utils qw (timeOut);
use Utils qw (timeOut);
use Utils qw (timeOut);

Plugins::register('responseOnNPCImage', 'respose base on NPC Image', \&onUnload, \&onUnload);

my $ok = 1;
my $ok = 1;
['packet/npc_image', \&onNPCImage],
['packet_pre/npc_talk_number', \&onNPCTalkInput],
['packet_pre/npc_talk_text', \&onNPCTalkInput],
['packet/npc_talk_responses', \&onNPCAction, undef],
);
my $ok = 1;
my $ok = 1;

# Syntax:
# '<image name>' => '<response>',
# <image name> - if you got following message 
#	[responseOnNPCImage] Image name >> "????"
# then the ???? is a <image name>.
#
# <response> - Any text that contained in NPC response choice(s) or number.
my $ok = 1;
'cbot_1' => 'poring',
'cbot_2' => 'lunatic',
'cbot_3' => 'fabre',
'cbot_4' => 'drops',

'29028246' => '1',
'29029000' => '2',
'29029754' => '3',
'29030508' => '4',
'29031262' => '5',
'29032016' => '6',

'one' => '1',
'two' => '2',
'three' => '3',
'four' => '4',

'botcheck1' => '234',
'botcheck2' => '786',
'botcheck3' => '568',
'botcheck4' => '311',
'botcheck5' => '682',
'botcheck6' => '166',
'botcheck7' => 'PORING',
'botcheck8' => 'RODA',
'botcheck9' => 'ALICE',
'botcheck10' => 'ACIDUS',
'botcheck11' => 'HARPY',
'botcheck12' => 'HEATER',
'botcheck13' => 'KIEL',
'botcheck14' => 'ORC',
'botcheck15' => 'PRIEST',
'botcheck16' => 'PALADIN',
);

sub onUnload {
	Plugins::delHooks($hooks);
	Commands::unregister($cmd);
	undef @NPCresponses;
	undef @NPCresponses;
	undef @NPCresponses;
	message "responseOnNPCImage plugin unloading or reloading\n", 'success';
}

sub onNPCImage {
	my (undef, $args) = @_;
	$imageName = bytesToString($args->{npc_image});
	return unless $imageName;
	message "[responseOnNPCImage] Image name >> \"$imageName\"\n", "info";
}

sub onNPCTalkInput {
	my (undef, $args) = @_;
	$talk{ID} = $args->{ID};
}

sub onNPCResponses {
	my @preTalkResponses = split /:/, $msg;
	my @preTalkResponses = split /:/, $msg;
	@NPCresponses = ();
	my @preTalkResponses = split /:/, $msg;
	foreach my $response (@preTalkResponses) {
	$response =~ s/\^[a-fA-F0-9]{6}//g;
	push @NPCresponses, $response if ($response ne '');
}
}

sub cmdTalkImage {
	my $cmd = '';
	my $cmd = '';

	if ($args !~ /resp|num|text/) {
	error "Syntax Error in function 'talkImage' (Talk to NPC base on NPC image)\n" .
	"Usage: talkImage <resp | num | text>\n";
	return;
}
if ($imageName eq '') {
	error "[responseOnNPCImage] Doesn't seen any image yet!\n";
	return;
}
if (defined $imageTable{$imageName} && $imageTable{$imageName} ne '') {
	if ($args eq 'num') {
	$cmd = "talk text $imageTable{$imageName}";
	} elsif ($args eq 'resp') {
	$cmd = "talk text $imageTable{$imageName}";
	} elsif ($args eq 'resp') {
	message "[responseOnNPCImage] Match \"$imageTable{$imageName}\" to response list.\n", "info";
	my $i = 0;
	foreach (@NPCresponses) {
	last if ($_ =~ /$imageTable{$imageName}/i);
	$i++;
}
if ($i < (scalar @NPCresponses)) {
	$cmd = "talk resp $i";
	} else {
	error "[responseOnNPCImage] Can not match \"$imageTable{$imageName}\" to response list.\n";
	message "[responseOnNPCImage] You must response by yourself now!\n", "info";
}
}
} else {
	if ($config{"responseOnNPCImage_equal"} eq 'num') {
	if ($config{"responseOnNPCImage_equal"} eq 'num') {
	$cmd = "talk num $imageName";
	} else {
	error "[responseOnNPCImage] Image name not equal to number.\n";
	message "[responseOnNPCImage] You must response by yourself now!\n", "info";
}
} elsif ($args eq 'text') {
	if ($config{"responseOnNPCImage_equal"} eq 'text') {
	$cmd = "talk text $imageName";
	} else {
	error "[responseOnNPCImage] Image name not equal to text.\n";
	message "[responseOnNPCImage] You must response by yourself now!\n", "info";
}
} elsif ($args eq 'resp') {
	if ($config{"responseOnNPCImage_equal"} eq 'resp') {
	message "[responseOnNPCImage] Match \"$imageName\" to response list.\n", "info";
	my $i = 0;
	foreach (@NPCresponses) {
	next unless $_;
	last if ($_ =~ /$imageName/i);
	$i++;
}
if ($i < (scalar @NPCresponses)) {
	$cmd = "talk resp $i";
	} else {
	error "[responseOnNPCImage] Can not match \"$imageName\" to response list.\n";
	message "[responseOnNPCImage] You must response by yourself now!\n", "info";
}
} else {
	error "[responseOnNPCImage] Image name not equal to response choice.\n";
	message "[responseOnNPCImage] You must response by yourself now!\n", "info";
}
}
}

if ($cmd ne '') {
	message "[responseOnNPCImage] Executing command \"$cmd\".\n", "success";
	Commands::run($cmd);
	$imageName = '';
}
}

1;

# =======================
# reactOnNPC v.2.0.2
# =======================
# This plugin is licensed under the GNU GPL
# Copyright 2006 by hakore [mod by windows98SE and ya4ept]
#
# http://forums.openkore.com/viewtopic.php?f=34&t=198
# http://sourceforge.net/p/openkore/code/HEAD/tree/plugins/reactOnNPC/trunk/
#
# Example (put in config.txt):
#
# reactOnNPC_debug 1
# reactOnNPC talk text @eval(my $color1 = '#1~1';my $color2 = '#3~1';if ($color1 eq $color2@) {return '#3~2'}) {
#	type text
#	useColors 1
#	respIgnoreColor 1
#	delay 2
#	msg_0 /Bot Checking.../
#	msg_1 /Enter the \^([0-9a-fA-F]{6})RED COLOR\^000000 Code./
#	msg_2 /^\s$/
#	msg_3 /\s+\^([0-9a-fA-F]{6})(\S+)\^[0-9a-fA-F]{6}\s+/
# Shared SelfCondition (see http://openkore.com/index.php/Category:Self_Condition):
#	disabled 0
#	whenStatusActive 
#	whenStatusInactive
#	onAction
#	notOnAction
#	inMap
#	notInMap
#	inLockOnly
#	notInTown
#	timeout
#	notWhileSitting
#	manualAI
#	whenIdle
#	hp
#	sp
#	weight
#	zeny
#	spirit
#	amuletType
#	homunculus
#	homunculus_hp
#	homunculus_sp
#	homunculus_dead
#	homunculus_resting
#	mercenary
#	mercenary_hp
#	mercenary_sp
#	mercenary_whenStatusActive
#	mercenary_whenStatusInactive
#	aggressives
#	partyAggressives
#	stopWhenHit
#	whenFollowing
#	monstersCount
#	monsters
#	notMonsters
#	defendMonsters
#	inInventory
#	inCart
#	whenGround
#	whenNotGround
#	whenPermitSkill
#	whenNotPermitSkill
#	onlyWhenSafe
#	whenEquipped
#	whenNotEquipped
#	whenWater
#	equip_leftAccessory
#	equip_rightAccessory
#	equip_leftHand
#	equip_rightHand
#	equip_robe
#	whenFlag
#	whenNotFlag
# }

package reactOnNPC;

use Utils qw (timeOut);
use Utils qw (timeOut);
use Utils qw (timeOut);
use Utils qw (timeOut);
use Utils qw (timeOut);

Plugins::register('reactOnNPC', "react on NPC messages", \&Unload, \&Unload);

my $ok = 1;
Plugins::addHooks(
['packet/npc_talk', \&onNPCTalk, undef],
['packet/npc_talk_close', \&onNPCAction, undef],
['packet/npc_talk_continue', \&onNPCAction, undef],
['packet/npc_talk_number', \&onNPCAction, undef],
['packet/npc_talk_responses', \&onNPCAction, undef],
['packet/npc_talk_text', \&onNPCAction, undef],
['mainLoop_pre', \&onCheckCmd, undef]
)
);

my $ok = 1;
my $ok = 1;

sub Unload {
	Plugins::delHooks($hooks);
	undef %reactOnNPC if %reactOnNPC;
	undef %reactOnNPC if %reactOnNPC;
	message "reactOnNPC plugin unloading or reloading\n", 'success';
	};

	sub onNPCTalk {
	return if !$config{"reactOnNPC_0"};
	my $msg = unpack("Z*", substr($args->{RAW_MSG}, 8));
	my $msg = unpack("Z*", substr($args->{RAW_MSG}, 8));
	my $msg = unpack("Z*", substr($args->{RAW_MSG}, 8));

	$msg = I18N::bytesToString($msg);

	if (!%reactOnNPC || $reactOnNPC{action}) {
	undef %reactOnNPC if %reactOnNPC;
	$reactOnNPC{index} = 0;
	$reactOnNPC{ID} = $ID;
	$reactOnNPC{msg}[$reactOnNPC{index}] = $msg;
	} else {
	$reactOnNPC{index}++;
	$reactOnNPC{msg}[$reactOnNPC{index}] = $msg;
}
message "$head doesn't match.\n", "plugin" if $config{"reactOnNPC_debug"};
}

sub onNPCAction {
	return if !$config{"reactOnNPC_0"};
	my @responses = split /:/, $msg;
	$reactOnNPC{action} = $type;
	message "[reactOnNPC] onNPCAction type is: $type.\n", "plugin" if $config{"reactOnNPC_debug"};

	if ($type eq 'responses') {
	my @responses = split /:/, $msg;
	my @responses = split /:/, $msg;
	$msg = I18N::bytesToString($msg);
	undef @{$reactOnNPC{responses}};
	my @responses = split /:/, $msg;
	foreach (@responses) {
	push @{$reactOnNPC{responses}}, $_ if $_ ne "";
}
}

my $ok = 1;
while (exists $config{"reactOnNPC_$i"}) {
	if ($config{"reactOnNPC_${i}_type"} && $config{"reactOnNPC_${i}_type"} ne $type) {
			# Report if type not met
	message "[reactOnNPC] Conditions for reactOnNPC_$i 'checkSelfCondition' not met.\n", "plugin" if $config{"reactOnNPC_debug"};
	$i++;
	next;
	} elsif (!main::checkSelfCondition("reactOnNPC_$i")) {
			# Report if checkSelfCondition not met
	message "[reactOnNPC] Conditions for reactOnNPC_$i 'checkSelfCondition' not met.\n", "plugin" if $config{"reactOnNPC_debug"};
	$i++;
	next;
}
		# Report if  checkSelfCondition and type met <Yee ha!!>
message "$head doesn't match.\n", "plugin" if $config{"reactOnNPC_debug"};
my $ok = 1;
my $ok = 1;
while (exists $config{"reactOnNPC_${i}_msg_$j"}) {
	my $msg;
	if (exists $reactOnNPC{msg}[$j]) {
	$msg =~ s/\^[a-fA-F0-9]{6}//g unless ($config{"reactOnNPC_${i}_useColors"});
				# Remove RO color codes
	$msg =~ s/\^[a-fA-F0-9]{6}//g unless ($config{"reactOnNPC_${i}_useColors"});
}
if (!defined $msg || !match("msg", $j, $msg, $config{"reactOnNPC_${i}_msg_$j"})) {
	message "[reactOnNPC] One or more lines doesn't match for \"reactOnNPC_$i\" ($j).\n", "plugin" if $config{"reactOnNPC_debug"};
	$ok = 0;
	last;
}
$j++;
}

if ($ok) {
	my $k = 0;
	$cmd =~ s/#(\d+)~(\d+)/$reactOnNPC{match}[$1][$2]/g;
	my $k = 0;
	while (my ($kw, $expr) = $cmd =~ /\@($kws)\(((?:(?!(?<!\@)\@$kws\().)+?)(?<!\@)\)/) {
	my $k = 0;
	my $k = 0;
	$eval_expr =~ s/\@(?=[\@)])//g;
	if (match("response", $k, $rIC, $eval_expr)) {
	$eval = eval $eval_expr;
	} elsif ($kw eq 'resp') {
	my $k = 0;
	foreach my $rIC (@{$reactOnNPC{responses}}){
						# Remove RO color codes <npc response>
	$rIC =~ s/\^[a-fA-F0-9]{6}//g if($config{"reactOnNPC_${i}_respIgnoreColor"});
	if (match("response", $k, $rIC, $eval_expr)) {
	last;
}
$k++;
}
$eval = $k;
}
$expr = quotemeta $expr;
$cmd =~ s/\@$kw\($expr\)/$eval/g;
}
if (my $delay = $config{"reactOnNPC_${i}_delay"}) {
	my $params = {
	cmd => $cmd,
	time => time,
	timeout => $delay
	};
	message "[reactOnNPC] Reacting to NPC. Executing command \"$cmd\".\n", "success";
	push @reactOnNPC, $params;
	undef %reactOnNPC;
	} else {
	message "[reactOnNPC] Reacting to NPC. Executing command \"$cmd\".\n", "success";
	undef %reactOnNPC;
	Commands::run($cmd);
}
last;
}
$i++;
}
undef %reactOnNPC if $type eq 'close';
}

sub onCheckCmd {
	for (my $i = 0; $i < @reactOnNPC; $i++) {
	my $args = $reactOnNPC[$i];
	if (timeOut($args->{time}, $args->{timeout})) {
	message "[reactOnNPC] Reacting to NPC. Executing command \"".$args->{cmd}."\".\n", "success";
	Commands::run($args->{cmd});
	undef @reactOnNPC;
}
}
}

sub match {
	my $head = "[reactOnNPC] Matching [$type ($line)] \"$subject\" to \"$pattern\" ...";
	# $head for report matching in one line ^^"
	my $head = "[reactOnNPC] Matching [$type ($line)] \"$subject\" to \"$pattern\" ...";
	if (defined $line) {
	if (defined $line) {
	if (defined $line) {
	no strict;
	foreach my $index (1..$#-) {
	$reactOnNPC{match}[$line][$index] = ${$index};
}
}
message "$head doesn't match.\n", "plugin" if $config{"reactOnNPC_debug"};
return 1;
}
} elsif ($subject eq $pattern) {
	message "$head ok.\n", "plugin" if $config{"reactOnNPC_debug"};
	return 1;
}
message "$head doesn't match.\n", "plugin" if $config{"reactOnNPC_debug"};

}

1;
for much clearer info on how i placed responseOnNPCImage.pl and reactonNPC.pl here are some images:
notice the locations i think there is something wrong with it.
plugins
Image
plugins\macro
Image
plugins\macro\Macro
Image

this is the result:
Image

THANKS TO @4ept and @Mucilon for guiding us! :)
I HOPE SOMEONE WILL REPLY CUZ GUYS I REALLY NEED YOUR HELP. :cry:

User avatar
4epT
Developers
Developers
Posts: 617
Joined: 30 Apr 2008, 14:17
Noob?: No
Location: Moskow (Russia)
Contact:

Re: responseOnNPCImage "response base on NPC Image" by abt123

#103 Post by 4epT »

Why have you joined config.txt and responseOnNPCImage.pl? where you read about it? :o
Go read the first message!

and use search
All my posts are made by machine translator!
¤ Manual ¤ Anti BotKiller ¤ Packet Extractor v3 ¤
Image
Image

bingbing14
Noob
Noob
Posts: 2
Joined: 11 Dec 2014, 17:49
Noob?: Yes

Re: responseOnNPCImage "response base on NPC Image" by abt123

#104 Post by bingbing14 »

I just followed this..

v.2 by ya4epT (26/06/2014)
- delete file respImageTable.txt
- settings from the file "respImageTable.txt" transferred to "config.txt" and "responseOnNPCImage.pl"

Or maybe im confused..

my openkore doesnt wear any macro stuff exept for plugins folder..

What I'm wondering..
I think somethings wrong with my text reactOnNPC.pl and responseOnNPCImage.pl

I cant also make openkore respond automatically i tried everything.. I also analyzed

@4epT thanks for the reply.

User avatar
4epT
Developers
Developers
Posts: 617
Joined: 30 Apr 2008, 14:17
Noob?: No
Location: Moskow (Russia)
Contact:

Re: responseOnNPCImage "response base on NPC Image" by abt123

#105 Post by 4epT »

its release notes, not instal guide! :lol:
v.2 by ya4epT (26/06/2014)
- delete file respImageTable.txt
- settings from the file "respImageTable.txt" transferred to "config.txt" and "responseOnNPCImage.pl"
read first message
All my posts are made by machine translator!
¤ Manual ¤ Anti BotKiller ¤ Packet Extractor v3 ¤
Image
Image

djevol
Noob
Noob
Posts: 1
Joined: 30 Jan 2015, 11:41
Noob?: No

Re: responseOnNPCImage "response base on NPC Image" by abt123

#106 Post by djevol »

For forsakenRO, there seems to be some images that have been changed/replaced. The NPC replier cannot reply correctly to some of them, I almost got jailed :D

http://imgur.com/HWmf5Wn - in case the image doesn't upload.
Image

L4M3573R
Human
Human
Posts: 37
Joined: 24 Apr 2008, 16:15

Re: responseOnNPCImage "response base on NPC Image" by abt123

#107 Post by L4M3573R »

When use teleport search, and the bot check freezes me and what not, it doesn't answer the question, it just teleports...I'm on ForsakenRO

Post Reply