Config và automacro chính xác cho O.K mà các bạn tìm đêy

Status
Không mở trả lời sau này.

babycheats

Youtube Master Race
Tham gia ngày
14/12/08
Bài viết
1
Reaction score
0
Chắc hẳn đã nhìu bạn cày nát topic " các vấn đề về bot " của Sin bým.Nhưng các bạn đã kiếm đủ thông tin để làm cái config hoàn thiện chưa?
đây là config auto attack:
Mã:
# Shock
master Vietnam - ASro
server 0
username 
password 
char 
pin
bindIp
serverType 0

# 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 ragvn.exe

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

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

pauseMapServer 0
ignoreInvalidLogin 0
secureLogin_requestCode

message_length_max 80

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

alias_heal sp 28

attackUseWeapon 1
attackCanSnipe 0

allowedMaps
allowedMaps_reaction 1

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

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 1300
autoRestartSeed 300

autoRestartSleep 1
autoSleepMin 60
autoSleepSeed 60

autoResponse 0

autoSpell

avoidGM_near 0
avoidGM_near_inTown 0
avoidGM_talk 0
avoidGM_reconnect 1800
avoidGM_ignoreList

avoidList 0
avoidList_inLockOnly 0
avoidList_reconnect 1800

cachePlayerNames 1
cachePlayerNames_duration 900
cachePlayerNames_maxSize 100

clientSight 20

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

follow 0
followTarget[H]3
followEmotion 0
followEmotion_distance 4
followFaceDirection 0
followDistanceMax 10
followDistanceMin 3
followLostStep 12
followSitAuto 0
followBot 0

itemsTakeAuto 1
itemsTakeAuto_party 1
itemsGatherAuto 2
itemsMaxWeight 89
itemsMaxWeight_sellOrStore 89
itemsMaxNum_sellOrStore 99
cartMaxWeight 7900
itemsTakeAuto_new 0
    
#
lockMap
lockMap_x
lockMap_y
lockMap_randX
lockMap_randY

route_escape_unknownMap 1
route_escape_reachedNoPortal 1
route_escape_randomWalk 1
route_escape_shout
route_randomWalk 1
route_randomWalk_inTown 0
route_randomWalk_maxRouteTime 75
route_maxWarpFee
route_maxNpcTries 5
route_teleport 0
route_teleport_minDistance 200
route_teleport_maxTries 100
route_teleport_notInMaps
route_step 13

runFromTarget
runFromTarget_dist 6

saveMap
saveMap_warpToBuyOrSell 1
saveMap_warpChatCommand

shopAuto_open 0
shop_random 0

sitAuto_hp_lower
sitAuto_hp_upper
sitAuto_sp_lower
sitAuto_sp_upper
sitAuto_over_50 0
sitAuto_idle 0

statsAddAuto 0
statsAddAuto_list 90 dex, 90 agi
statsAddAuto_dontUseBonus 0
statsAdd_over_99 0

skillsAddAuto 0
skillsAddAuto_list

tankMode 0
tankModeTarget

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

dealAuto 0
dealAuto_names
partyAuto 0
partyAutoShare 1
guildAutoDeny 0

verbose 1
showDomain 0
squelchDomains attackedMiss, skill,
verboseDomains
beepDomains
beepDomains_notInTown

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

chatTitleOversize 0
shopTitleOversize 0

sleepTime 50000
intervalMapDrt 10000

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

tankersList

removeActorWithDistance



autoBreakTime {
	startTime
	stopTime
}

autoConfChange {
	minTime
	varTime
	lvl
	joblvl
}

autoMakeArrows 0

autoRestart 0

autoRestartMin 1300
autoRestartSeed 300

autoRestartSleep 1
autoSleepMin 60
autoSleepSeed 60

autoResponse 0

autoSpell

avoidGM_near 0
avoidGM_near_inTown 0
avoidGM_talk 0
avoidGM_reconnect 1800
avoidGM_ignoreList

avoidList 0
avoidList_inLockOnly 0
avoidList_reconnect 1800

alertSound 0

alertSound - {
	eventList public chat
	notInTown 1
	inLockOnly 0
	play C:\openkore\SVN-1.9.2\sounds\female\pub_chat_female.wav
}

alertSound - {
	eventList private chat
	notInTown 0
	inLockOnly 0
	play C:\openkore\SVN-1.9.2\sounds\female\priv_chat_female.wav
}

#alertSound - {
eventList map change
notInTown 1
inLockOnly 0
play C:\openkore\SVN-1.9.2\sounds\female\map_change_female.wav
}

alertSound - {
	eventList gm near, public gm chat, private gm chat
	notInTown 0
	inLockOnly 0
	play C:\openkore\SVN-1.9.2\sounds\female\gm_female.wav
}

chatBot Kadiliman {
	scriptfile lines.txt
	replyRate 80
	onPublicChat 0
	onPrivateMessage 0
	onSystemChat 0
	onGuildChat 0
	onPartyChat 0
	wpm 65
	smileys ^_^, :D, :), >:(, XD, >.<, >"<
	smileyRate 20
	learn 1
}

cachePlayerNames 1
cachePlayerNames_duration 900
cachePlayerNames_maxSize 100

clientSight 20

dcOnDeath 0
dcOnDualLogin 0
dcOnDisconnect 0
dcOnEmptyArrow 0
dcOnMute 1
dcOnPM 0
dcOnZeny 10
dcOnStorageFull 0
# Kyrie Eleison 4, Magnificat 3, Gloria 1, Status Recovery 1, Increase SP Recovery 4, Resurrection 1, Lex Divina 3, Turn Undead 10, Kyrie Eleison 10

tankMode 0
tankModeTarget

dealAuto 0
partyAuto 0
partyAutoShare 1
guildAutoDeny 0

verbose 1
showDomain 0
squelchDomains attackedMiss, skill,
verboseDomains
beepDomains
beepDomains_notInTown

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

chatTitleOversize 0
shopTitleOversize 0

sleepTime 50000
intervalMapDrt 10000

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

tankersList

secureAdminPassword 0
adminPassword
callSign

removeActorWithDistance

####### BLOCK #######
attackSkillSlot Fire Bolt {
	lvl 4
	dist 8
	sp > 10%
	stopWhenHit 1
	inLockOnly 1
	notInTown 1
	monsters Orc Archer
	maxUses 0
	target_whenStatusActive Frozen
}

attackSkillSlot {
	lvl 10
	dist 15
	sp > 10
	inLockOnly 0
	notInTown 1
	monsters Evil Druid, Wraith, Ghoul, Wraith Dead, Skel Soldier, Skel Archer, Zombie, Bongun, Munak,Orc Skeleton, Zombie Prisoner, Skeleton Prisoner, Skel Worker, Khalitzburg
}

attackSkillSlot Double Strafe {
	lvl 10
	dist 14
	sp > 16
}
attackSkillSlot {
	lvl 10
	dist 13
	maxCastTime 0
	minCastTime 0
	hp
	sp > 36
	onAction
	whenStatusActive
	whenStatusInactive
	whenFollowing
	spirit
	aggressives
	previousDamage
	stopWhenHit 0
	inLockOnly 0
	notInTown 0
	timeout 0
	disabled 0
	monsters Metaling,Caramel,Holden
	notMonsters
	maxAttempts 0
	maxUses 1
	target_whenStatusActive
	target_whenStatusInactive Double Strafe
	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 Fire Arrow
}
useSelf_skill Improve Concentration {
	lvl 10
	sp > 100
	whenStatusInactive Improve Concentration
	timeout 100
}


#attackSkillSlot Heal {
lvl 10
dist 7
sp
inLockOnly 0
notInTown 1
monsters Evil Druid, Wraith, Ghoul, Wraith Dead, Skel Soldier, Skel Archer, Zombie, Bongun, Munak,Orc Skeleton, Zombie Prisoner, Skeleton Prisoner, Skel Worker
}

attackSkillSlot Heal {
	lvl 7
	dist 15
	sp > 10
	inLockOnly 0
	notInTown 1
	monsters Orc Zombie
}

useSelf_skill Heal {
	lvl 10
	hp < 50%
	sp > 19
}

useSelf_skill Magnificat {
	lvl 5
	sp
	whenStatusInactive Magnificat
	stopWhenHit 1
	inLockOnly 1
	notWhileSitting 1
	notInTown 1
	timeout 10
}
useSelf_skill Blessing {
	lvl 10
	whenStatusInactive Blessing
	sp > 10
	timeout 5
	notInTown 1
}
useSelf_skill Increase AGI {
	lvl 10
	whenStatusInactive Increase AGI
	sp > 10
	timeout 5
	notInTown 1
}



#useSelf_skill Gloria {
lvl 10
sp
onAction attack
whenStatusInactive Kyrie Eleison
stopWhenHit 1
inLockOnly 0
notWhileSitting 0
notInTown 1
timeout 10
}

#useSelf_skill Kyrie Eleison {
lvl 10
	#sp < 50%
whenStatusInactive Kyrie Eleison
stopWhenHit 1
inLockOnly 0
notWhileSitting 0
notInTown 1
timeout 10
}

useSelf_skilll Status Recovery {
	lvl 1
	whenStatusActive Stunned, Petrified, Petrifying, Frozen
	notInTown 1
}

useSelf_skill Pneuma {
	defendMonsters Raydric Archer, Gargoyle, Skeleton Archer, Archer Skeleton, Enchanted Peach Tree, Cruiser, Goblin Archer, Kobold Archer
	lvl 1
	whenNotGround Pneuma
	timeout 1
	notInTown 1
}

useSelf_skill {
	lvl 10
	whenStatusInactive
	sp
	timeout 0
	notInTown 0
}

useSelf_skill_smartHeal 1


partySkill Blessing {
	lvl 10
	target_whenStatusInactive Blessing
	target_timeout 200
	sp > 10
	timeout 5
	notInTown 1
}


partySkill Increase AGI {
	lvl 10
	target_whenStatusInactive Increase AGI
	target_timeout 200
	sp > 10
	timeout 5
	notInTown 1
}

partySkill Heal {
	lvl 10
	target_hp < 50%
	sp > 10
	notInTown 1
}
partySkill Pneuma {
	lvl 1
	target_defendMonsters Cruiser, Goblin Archer, Kobold Archer
	target_timeout 1
	whenNotGround Pneuma
	sp > 10
	notInTown 1
}

partySkill Resurrection {
	lvl 4
	target_dead 1
}

partySkill Status Recovery {
	lvl 1
	target_whenStatusActive Stunned, Petrified, Petrifying, Frozen
	notInTown 1
}

partySkill Cure {
	lvl 1
	target_whenStatusActive Cursed, Silenced, Blinded, Chaos
	notInTown 1
}

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

monsterSkill Lex Aeterna {
	lvl 1
	aggressives
	target Alarm,Clock,Rideword,Mimic,Tower Keeper,Clock Tower Manager,Punk,Penomena,Cramp,Geographer
	target_dist
	target_whenStatusInactive Lex Aeterna
	maxUses 10
}

attackSkillSlot Double Strafe {
	lvl 10
	dist 15
	maxCastTime 0
	minCastTime 0
	hp
	sp > 15
	onAction
	whenStatusActive
	whenStatusInactive
	whenFollowing
	spirit
	aggressives
	previousDamage
	stopWhenHit 0
	inLockOnly 0
	notInTown 0
	timeout 0
	disabled 0
	monsters Geographer
	notMonsters
	maxAttempts 0
	maxUses 3
	target_whenStatusActive
	target_whenStatusInactive Double Strafe
	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 Fire Arrow
}


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
}


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 Novice Potion, Monster's Feed {
	hp < 70%
	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
}

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

buyAuto {
	npc
	standpoint
	distance 5
	minAmount 2
	maxAmount 3
}

sellAuto 0
sellAuto_npc
sellAuto_standpoint
sellAuto_distance 5

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

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
paddedPackets 1
paddedPackets_attackID 0x0190
paddedPackets_skillUseID 0x0085
serverType 0
char 0
followTarget -
## End
.
___________Auto Merge________________

.
còn đêy là macros.txt để spam nov pot
Mã:
## ß ##


automacro create {
hook charSelectScreen
timeout 3
run-once 1
exclusive 1
call {
$login = @eval($login + 1)
log Now its char select screen
$num = @rand(1, 1000)
$masterName = "BinhBoong"
$name = @eval("$masterName" . "$num")
do eval $::messageSender->sendCharCreate(0, '$name', 9, 9, 1, 1, 9, 1, 6, 15);$::timeout{'charlogin'}{'time'} = time;
pause 5
do conf char 0
do eval $::messageSender->sendCharLogin(0);$::timeout{'charlogin'}{'time' } = time;
pause 10
do eval $::timeout{'charlogin'}{'time'} = time;
pause 3
release New
do move 55 115
do ai auto
}
}

automacro New {
base == 1
run-once 1
priority 1
exclusive 1
call talkNPC
}

macro talkNPC {
pause 1
do move 146 112
# Tiep tan
pause 6
do move 100 25
do ai manual
do talknpc 100 29 c r0 c c
pause 2
do move 99 99
# Giao dien
do talknpc 99 105 c c r0 c c c c c c c c e
pause 1
do move 86 108
# Ky nang
pause 2
do talknpc 83 111 c r0 c c c c c c c c c c c c r2 e
pause 1
do move 114 106
# Vat dung
do talknpc 115 111 c r0 c c c c c c c c c c r2 c e
pause 2
# Kafra
do talknpc 118 108 c c c r1 c r1 c c c c c r4 e
pause 2
do talknpc 118 108 c c c r0 r0 c
pause 2
# Helper 1
log "Talking to Helper 1\n"
do talknpc 17 182 c c c r0 c c c c c c c c c r3 e
# Helper 2
pause 2
do talknpc 38 182 c c c c r0 c
# Change map
pause 5
log "Map Changed\n"
do move 96 172
# Kiem tra
do talknpc 96 174 c r0 c
# HD tap su
pause 2
do move 99 19
do talknpc 91 22 c c c c r0 c c c c c c c r7 e
pause 3
# Final
do talknpc 100 29 c c c c c c r0 c c c c r0 r0 r0 r0 r0 r0 c c r0 c r0 c r0 c r0 c c r0 c r0 c r0 c r0 c c r2 c r1 c r0 c r0 c r2 c r0 c r1 c r2 c c c c c c c c c c c r0 c c c c c c c c
# Mer - Alberta
do move 78 44
pause 2
do move 105 60
pause 2

# Add Skill
do skills add 1
do skills add 1
do skills add 1
do skills add 1
do skills add 1
do skills add 1
pause 2
# Kafra
do talknpc 113 60 c r1
pause 2
do storage add @inventory (Novice Potion)
pause 1
do storage add @inventory (Red Potion)
pause 1
do storage add @inventory (Green Potion)
pause 1
do storage add @inventory (Yellow Potion)
pause 1
do storage add @inventory (Phracon)
pause 1
do storage add @inventory (Butterfly Wing)
pause 1
do storage add @inventory (Fly Wing)
pause 1
do storage add @inventory (Free Ticket for the Cart Service)
pause 1
do storage add @inventory (Free Ticket for Kafra Storage)
pause 1
do storage add @inventory (Free Ticket for Kafra Transportation)
pause 1
do storage add @inventory (Magnifier)
pause 1
do storage add @inventory (Battle Axe [3])
pause 1
do storage add @inventory (Powder of Butterfly)
pause 1
do storage close
pause 10
release delete
do relog
}

automacro delete {
hook charSelectScreen
exclusive 1
run-once 1
var login < 2
timeout 3
call {
$email = 050293
$login = 0
do eval $::messageSender->sendCharDelete($::chars[0]{charID}, '$email');$::AI::temp::delIndex = 0;$::timeout{'charlogin'}{'time'} = time;
pause 10
do eval $::timeout{'charlogin'}{'time'} = time;
pause 10
release create
do relog
}
}
Còn đêy là Automacro.pm
Mã:
# $Id: Automacro.pm 5939 2007-08-29 12:09:28Z arachnophobia $
package Macro::Automacro;

use strict;

require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(releaseAM lockAM automacroCheck consoleCheckWrapper);
our @EXPORT = qw(checkVar checkVarVar checkLoc checkLevel checkLevel checkClass
	checkPercent checkStatus checkItem checkPerson checkCond checkCast
	checkEquip checkMsg checkMonster checkAggressives checkConsole checkMapChange
	checkNotMonster);

use Utils;
use Globals;
use Skill;
use AI;
use Log qw(message error warning);
use Macro::Data;
use Macro::Utilities qw(between cmpr match getArgs refreshGlobal
	getPlayerID getSoldOut getInventoryAmount getCartAmount getShopAmount
	getStorageAmount callMacro);

our ($rev) = q$Revision: 5939 $ =~ /(\d+)/;

# check for variable #######################################
sub checkVar {
	my ($var, $cond, $val) = getArgs($_[0]);

	$var = "#$var" if $_[1] eq 'varvar';

	if ($cond eq "unset") {return exists $varStack{$var}?0:1}

	refreshGlobal($var);

	if (exists $varStack{$var}) {
		return cmpr($varStack{$var}, $cond, $val)
	} else {
		return $cond eq "!="
	}
}

# checks for location ######################################
# parameter: map [x1 y1 [x2 y2]]
# note: when looking in the default direction (north)
# x1 < x2 and y1 > y2 where (x1|y1)=(upper left) and
#                           (x2|y2)=(lower right)
# uses: calcPosition (Utils?)
sub checkLoc {
	my $arg = $_[0];
	if ($arg =~ /,/) {
		my @locs = split(/\s*,\s*/, $arg);
		foreach my $l (@locs) {return 1 if checkLoc($l)}
		return 0
	}
	my $not = ($arg =~ s/^not +//)?1:0;
	my ($map, $x1, $y1, $x2, $y2) = split(/ /, $arg);
	if ($map eq $field->name) {
		if ($x1 && $y1) {
			my $pos = calcPosition($char);
			return 0 unless defined $pos->{x} && defined $pos->{y};
			if ($x2 && $y2) {
				if (between($x1, $pos->{x}, $x2) && between($y2, $pos->{y}, $y1)) {
					return $not?0:1
				}
				return $not?1:0
			}
			if ($x1 == $pos->{x} && $y1 == $pos->{y}) {
				return $not?0:1
			}
			return $not?1:0
		}
		return $not?0:1
	}
	return $not?1:0
}

# checks for base/job level ################################
# uses cmpr (Macro::Utils)
sub checkLevel {
	my ($cond, $level) = $_[0] =~ /([<>=!]+)\s*(\d+)/;
	return cmpr($char->{$_[1]}, $cond, $level)
}

# checks for player's jobclass #############################
sub checkClass {
	return 0 unless defined $char->{jobID};
	return lc($_[0]) eq lc($::jobs_lut{$char->{jobID}})?1:0
}

# checks for HP/SP/Weight ##################################
# uses cmpr (Macro::Utils)
sub checkPercent {
	my ($arg, $what) = @_;
	my ($cond, $amount) = $arg =~ /([<>=!]+)\s*(\d+%?)/;
	if ($what =~ /^(?:hp|sp|weight)$/) {
		return 0 unless (defined $char->{$what} && defined $char->{$what."_max"});
		if ($amount =~ /\d+%$/ && $char->{$what."_max"}) {
			$amount =~ s/%$//;
			return cmpr(($char->{$what} / $char->{$what."_max"} * 100), $cond, $amount)
		} else {
			return cmpr($char->{$what}, $cond, $amount)
		}
	} elsif ($what eq 'cweight') {
		return 0 unless (defined $cart{weight} && defined $cart{weight_max});
		if ($amount =~ /\d+%$/ && $cart{weight_max}) {
			$amount =~ s/%$//;
			return cmpr(($cart{weight} / $cart{weight_max} * 100), $cond, $amount)
		} else {
			return cmpr($cart{weight}, $cond, $amount)
		}
	}
	return 0
}

# checks for status #######################################
sub checkStatus {
	if ($_[0] =~ /,/) {
		my @statuses = split(/\s*,\s*/, $_[0]);
		foreach my $s (@statuses) {return 1 if checkStatus($s)}
		return 0
	}

	my $status = lc($_[0]);
	my $not = ($status =~ s/^not +//)?1:0;

	foreach (split(',', $varStack{".status"})) {
		if (lc($_) eq $status) {return $not?0:1}
	}
	return $not?1:0
}


# checks for item conditions ##############################
# uses: getInventoryAmount, getCartAmount, getShopAmount,
#       getStorageAmount (Macro::Utils?)
sub checkItem {
	my ($where, $check) = @_;
	if ($check =~ /,/) {
		my @checks = split(/\s*,\s*/, $check);
		foreach my $c (@checks) {return 1 if checkItem($where, $c)}
		return 0
	}
	my ($item, $cond, $amount) = getArgs($check);
	my $what;
	if ($where eq 'inv')  {$what = getInventoryAmount($item)}
	if ($where eq 'cart') {$what = getCartAmount($item)}
	if ($where eq 'shop') {
		return 0 unless $shopstarted;
		$what = getShopAmount($item)
	}
	if ($where eq 'stor') {
		return 0 unless $::storage{opened};
		$what = getStorageAmount($item)
	}
	return cmpr($what, $cond, $amount)?1:0
}

# checks for near person ##################################
sub checkPerson {
	my ($who, $dist) = $_[0] =~ /^(["\/].*?["\/]\w*)\s*,?\s*(.*)/;

	foreach my $player (@{$playersList->getItems()}) {
		next unless match($player->name, $who);
		if ($dist > 0) {
			return (distance($char->{pos_to}, $player->{pos_to}) <= $dist)?1:0
		}
		return 1
	}
	return 0
}

# checks arg1 for condition in arg3 #######################
# uses: cmpr (Macro::Utils)
sub checkCond {
	my ($cond, $amount) = $_[1] =~ /([<>=!]+)\s*(\d+)/;
	return cmpr($_[0], $cond, $amount)?1:0
}

# checks for equipment ####################################
# equipped <item>, <item2>, ... # equipped item or item2 or ..
# equipped rightHand <item>, rightAccessory <item2>, ... # equipped <item> on righthand etc.
# equipped leftHand none, .. # equipped nothing on lefthand etc.
# see @Item::slots
sub checkEquip {
	if ($_[0] =~ /,/) {
		my @equip = split(/\s*,\s*/, $_[0]);
		foreach my $e (@equip) {return 1 if checkEquip($e)}
		return 0
	}

	my $arg = $_[0];

	if ($arg =~ m/^((?:top|mid|low)Head|(?:left|right)Hand|robe|armor|shoes|(?:left|right)Accessory|arrow)\s+(.*)/i) {
		if (my $item = $char->{equipment}{$1}) {
			return lc($2) eq lc($item->name)?1:0
		}
		return lc($2) eq 'none'?1:0
	}

	$arg = lc($arg);
	foreach my $s (keys %{$char->{equipment}}) {
		next unless lc($char->{equipment}{$s}->name) eq $arg;
		return 1
	}
	return 0
}

# checks for a spell casted on us #########################
# uses: distance, judgeSkillArea (Utils?)
sub checkCast {
	my ($cast, $args) = @_;
	$cast = lc($cast);
	my $pos = calcPosition($char);
	return 0 if $args->{sourceID} eq $accountID;
	my $target = (defined $args->{targetID})?$args->{targetID}:0;
	if (($target eq $accountID ||
		($pos->{x} == $args->{x} && $pos->{y} == $args->{y}) ||
		distance($pos, $args) <= judgeSkillArea($args->{skillID})) &&
		existsInList($cast, lc(Skill->new(idn => $args->{skillID})->getName()))) {return 1}
	return 0
}

# checks for public, private, party or guild message ######
# uses calcPosition, distance (Utils?)
sub checkMsg {
	my ($var, $tmp, $arg) = @_;
	my $msg;
	if ($var eq '.lastpub') {
		($msg, my $distance) = $tmp =~ /^([\/"].*?[\/"]\w*)\s*,?\s*(\d*)/;
		if ($distance ne '') {
			my $mypos = calcPosition($char);
			my $pos = calcPosition($::players{$arg->{pubID}});
			return 0 unless distance($mypos, $pos) <= $distance
		}
	} elsif ($var eq '.lastpm') {
		($msg, my $allowed) = $tmp =~ /^([\/"].*?[\/"]\w*)\s*,?\s*(.*)/;
		my $auth;
		if (!$allowed) {
			$auth = 1
		} else {
			my @tfld = split(/,/, $allowed);
			for (my $i = 0; $i < @tfld; $i++) {
				next unless defined $tfld[$i];
				$tfld[$i] =~ s/(?:^ +| +$)//g;
				if ($arg->{privMsgUser} eq $tfld[$i]) {$auth = 1; last}
			}
		}
		return 0 unless $auth
	} else {
		$msg = $tmp
	}

	$arg->{Msg} =~ s/[\r\n]*$//g;
	if (match($arg->{Msg},$msg)){
		$varStack{$var} = $arg->{MsgUser};
		$varStack{$var."Msg"} = $arg->{Msg};
		return 1
	}
	return 0
}

# checks for monster, credits to illusionist
sub checkMonster {
	my $monsterList = $_[0];
	foreach (@monstersID) {
		next unless defined $_;
		if (existsInList($monsterList, $monsters{$_}->{name})) {
			my $pos = calcPosition($monsters{$_});
			my $val = sprintf("%d %d %s", $pos->{x}, $pos->{y}, $field->name);
			$varStack{".lastMonster"} = $monsters{$_}->{name};
			$varStack{".lastMonsterPos"} = $val;
			return 1
		}
	}
	return 0
}

# checks for forbidden monster
# quick hack, maybe combine it with checkMonster later
sub checkNotMonster {
	my $monsterList = $_[0];
	foreach (@monstersID) {
		next unless defined $_;
		next if existsInList($monsterList, $monsters{$_}->{name});
		return 1
	}
	return 0
}

# checks for aggressives
sub checkAggressives {
	my ($cond, $amount) = $_[0] =~ /([<>=!]+)\s*(\d+)/;
	return cmpr(scalar ai_getAggressives, $cond, $amount)
}

# checks for console message
sub checkConsole {
	my ($msg, $arg) = @_;
	$$arg[4] =~ s/[\r\n]*$//;
	if (match($$arg[4],$msg)){
		$varStack{".lastLogMsg"} = $$arg[4];
		return 1
	}
	return 0
}

sub consoleCheckWrapper {
	return unless defined $conState;
	# skip "macro" and "cvsdebug" domains to avoid loops
	return if $_[1] =~ /^(?:macro|cvsdebug)$/;
	# skip debug messages unless macro_allowDebug is set
	return if ($_[0] eq 'debug' && !$::config{macro_allowDebug});
	my @args = @_;
	automacroCheck("log", \@args)
}

# checks for map change
sub checkMapChange {
	return ($_[0] eq '*' || existsInList($_[0], $field->name))?1:0
}

# releases a locked automacro ##################
sub releaseAM {
	if ($_[0] eq 'all') {
		foreach (keys %automacro) {
			undef $automacro{$_}->{disabled}
		}
		return 1
	}
	if (defined $automacro{$_[0]}) {
		undef $automacro{$_[0]}->{disabled};
		return 1
	}
	return 0
}

# locks an automacro ##################
sub lockAM {
	if (defined $automacro{$_[0]}) {
		$automacro{$_[0]}->{disabled} = 1;
		return 1
	}
	return 0
}

# parses automacros and checks conditions #################
sub automacroCheck {
my ($trigger, $args) = @_;
return unless $conState == 5 || $trigger =~ /^(?:charSelectScreen|Network)/;
if ($trigger =~ /^(?:charSelectScreen|Network)/) {
my (undef, $args) = @_;
$timeout{'charlogin'}{'time'} = time;
$args->{return} = 2;
}
return if (defined $queue && !$queue->interruptible); ;

	refreshGlobal();

	CHKAM:
	foreach my $am (sort {
		($automacro{$a}->{priority} or 0) <=> ($automacro{$b}->{priority} or 0)
	} keys %automacro) {
		next CHKAM if $automacro{$am}->{disabled};

		if (defined $automacro{$am}->{call} && !defined $macro{$automacro{$am}->{call}}) {
			error "automacro $am: macro ".$automacro{$am}->{call}." not found.\n";
			$automacro{$am}->{disabled} = 1; return
		}

		if (defined $automacro{$am}->{timeout}) {
			$automacro{$am}->{time} = 0 unless $automacro{$am}->{time};
			my %tmptimer = (timeout => $automacro{$am}->{timeout}, time => $automacro{$am}->{time});
			next CHKAM unless timeOut(\%tmptimer)
		}

		if (defined $automacro{$am}->{hook}) {
			next CHKAM unless $trigger eq $automacro{$am}->{hook};
			# save arguments
			my $s = 0;
			foreach my $save (@{$automacro{$am}->{save}}) {
				if (defined $args->{$save}) {
					if (ref($args->{$save}) eq 'SCALAR') {
						$varStack{".hooksave$s"} = ${$args->{$save}}
					} else {
						if (!$::config{macro_nowarn} && ref($args->{$save}) ne '') {
							warning "[macro] \$.hooksave$s is of type ".ref($args->{$save}).". Take care!\n"
						}
						$varStack{".hooksave$s"} = $args->{$save}
					}
				} else {
					error "[macro] \$args->{$save} does not exist\n"
				}
				$s++
			}
		} elsif (defined $automacro{$am}->{console}) {
			if ($trigger eq 'log') {
				next CHKAM unless checkConsole($automacro{$am}->{console}, $args)
			} else {next CHKAM}
		} elsif (defined $automacro{$am}->{spell}) {
			if ($trigger =~ /^(?:is_casting|packet_skilluse)$/) {
			next CHKAM unless checkCast($automacro{$am}->{spell}, $args)
			} else {next CHKAM}
		} elsif (defined $automacro{$am}->{pm}) {
			if ($trigger eq 'packet_privMsg') {
			next CHKAM unless checkMsg(".lastpm", $automacro{$am}->{pm}, $args)
			} else {next CHKAM}
		} elsif (defined $automacro{$am}->{pubm}) {
			if ($trigger eq 'packet_pubMsg') {
			next CHKAM unless checkMsg(".lastpub", $automacro{$am}->{pubm}, $args)
			} else {next CHKAM}
		} elsif (defined $automacro{$am}->{party}) {
			if ($trigger eq 'packet_partyMsg') {
			next CHKAM unless checkMsg(".lastparty", $automacro{$am}->{party}, $args)
			} else {next CHKAM}
		} elsif (defined $automacro{$am}->{guild}) {
			if ($trigger eq 'packet_guildMsg') {
			next CHKAM unless checkMsg(".lastguild", $automacro{$am}->{guild}, $args)
			} else {next CHKAM}
		} elsif (defined $automacro{$am}->{mapchange}) {
			if ($trigger eq 'packet_mapChange') {
			next CHKAM unless checkMapChange($automacro{$am}->{mapchange})
			} else {next CHKAM}
		}

		next CHKAM if (defined $automacro{$am}->{map}    && $automacro{$am}->{map} ne $field->name);
		next CHKAM if (defined $automacro{$am}->{class}  && !checkClass($automacro{$am}->{class}));
		next CHKAM if (defined $automacro{$am}->{notMonster} && !checkNotMonster($automacro{$am}->{notMonster}));
		foreach my $i (@{$automacro{$am}->{monster}})    {next CHKAM unless checkMonster($i)}
		foreach my $i (@{$automacro{$am}->{aggressives}}){next CHKAM unless checkAggressives($i)}
		foreach my $i (@{$automacro{$am}->{location}})   {next CHKAM unless checkLoc($i)}
		foreach my $i (@{$automacro{$am}->{var}})        {next CHKAM unless checkVar($i, "")}
		foreach my $i (@{$automacro{$am}->{varvar}})     {next CHKAM unless checkVar($i, "varvar")}
		foreach my $i (@{$automacro{$am}->{base}})       {next CHKAM unless checkLevel($i, "lv")}
		foreach my $i (@{$automacro{$am}->{job}})        {next CHKAM unless checkLevel($i, "lv_job")}
		foreach my $i (@{$automacro{$am}->{hp}})         {next CHKAM unless checkPercent($i, "hp")}
		foreach my $i (@{$automacro{$am}->{sp}})         {next CHKAM unless checkPercent($i, "sp")}
		foreach my $i (@{$automacro{$am}->{spirit}})     {next CHKAM unless checkCond($char->{spirits} or 0, $i)}
		foreach my $i (@{$automacro{$am}->{weight}})     {next CHKAM unless checkPercent($i, "weight")}
		foreach my $i (@{$automacro{$am}->{cartweight}}) {next CHKAM unless checkPercent($i, "cweight")}
		foreach my $i (@{$automacro{$am}->{soldout}})    {next CHKAM unless checkCond(getSoldOut(), $i)}
		foreach my $i (@{$automacro{$am}->{zeny}})       {next CHKAM unless checkCond($char->{zenny}, $i)}
		foreach my $i (@{$automacro{$am}->{player}})     {next CHKAM unless checkPerson($i)}
		foreach my $i (@{$automacro{$am}->{equipped}})   {next CHKAM unless checkEquip($i)}
		foreach my $i (@{$automacro{$am}->{status}})     {next CHKAM unless checkStatus($i)}
		foreach my $i (@{$automacro{$am}->{inventory}})  {next CHKAM unless checkItem("inv", $i)}
		foreach my $i (@{$automacro{$am}->{storage}})    {next CHKAM unless checkItem("stor", $i)}
		foreach my $i (@{$automacro{$am}->{shop}})       {next CHKAM unless checkItem("shop", $i)}
		foreach my $i (@{$automacro{$am}->{cart}})       {next CHKAM unless checkItem("cart", $i)}

		message "[macro] automacro $am triggered.\n", "macro";

		unless (defined $automacro{$am}->{call} || $::config{macro_nowarn}) {
			warning "[macro] automacro $am: call not defined.\n", "macro"
		}

		$automacro{$am}->{time} = time  if $automacro{$am}->{timeout};
		$automacro{$am}->{disabled} = 1 if $automacro{$am}->{'run-once'};

		foreach my $i (@{$automacro{$am}->{set}}) {
			my ($var, $val) = $i =~ /^(.*?)\s+(.*)/;
			$varStack{$var} = $val
		}

		if (defined $automacro{$am}->{call}) {
			undef $queue if defined $queue;
			$queue = new Macro::Script($automacro{$am}->{call});
			if (defined $queue) {
				$queue->overrideAI(1) if $automacro{$am}->{overrideAI};
				$queue->interruptible(0) if $automacro{$am}->{exclusive};
				$queue->orphan($automacro{$am}->{orphan}) if defined $automacro{$am}->{orphan};
				$queue->timeout($automacro{$am}->{delay}) if $automacro{$am}->{delay};
				$queue->setMacro_delay($automacro{$am}->{macro_delay}) if $automacro{$am}->{macro_delay};
				$varStack{".caller"} = $am;
				$onHold = 0;
				callMacro
			} else {
				error "unable to create macro queue.\n"
			}
		}

		return # don't execute multiple macros at once
	}
}

1;
 
cái này move lên trên kia được rồi.
đã có quy định về vấn đề post vài BOT rồi mà :|
 
mình bị vậy có ai biết tại sao ko, hỏi trên kia ko ai trả lời,

Clip_4-1.jpg
 
Status
Không mở trả lời sau này.
Back
Top