Fixed Adventure bots to use new listen system for interactions.

This commit is contained in:
Badhad 2021-03-15 20:25:56 -04:00
parent 3ebd9c2614
commit 8dfa6a1188
2 changed files with 18 additions and 13 deletions

View file

@ -21,6 +21,7 @@ import core.game.world.update.flag.player.ChatFlag
import core.tools.RandomFunction import core.tools.RandomFunction
import rs09.game.ai.AIRepository import rs09.game.ai.AIRepository
import rs09.game.ai.pvmbots.CombatBotAssembler import rs09.game.ai.pvmbots.CombatBotAssembler
import rs09.game.interaction.InteractionListeners
import java.time.LocalDateTime import java.time.LocalDateTime
import java.time.format.DateTimeFormatter import java.time.format.DateTimeFormatter
import kotlin.random.Random import kotlin.random.Random
@ -816,9 +817,10 @@ class Adventurer(val style: CombatStyle): Script() {
"Maple tree","Yew","Magic tree", "Maple tree","Yew","Magic tree",
"Teak","Mahogany") "Teak","Mahogany")
val resource = scriptAPI.getNearestNodeFromList(resources,true) val resource = scriptAPI.getNearestNodeFromList(resources,true)
try { if(resource != null){
resource?.interaction?.handle(bot, resource.interaction[0]) if(resource.name.contains("ocks")) InteractionListeners.run(resource.id,1,"mine",bot,resource)
} catch (e: Exception){} else InteractionListeners.run(resource.id,1,"chop down",bot,resource)
}
} }
} }
return return
@ -917,15 +919,18 @@ class Adventurer(val style: CombatStyle): Script() {
} }
if (RandomFunction.random(1000) <= 50 && poi){ if (RandomFunction.random(1000) <= 50 && poi){
val roamDistancePoi = if(poiloc == teakfarm || poiloc == crawlinghands) 5 val roamDistancePoi = when(poiloc){
else if (poiloc == treegnome) 50 teakfarm,crawlinghands -> 5
else if (poiloc == isafdar) 40 treegnome -> 50
else if (poiloc == eaglespeek) 40 isafdar -> 40
else if (poiloc == keldagrimout) 40 eaglespeek -> 40
else if (poiloc == teak1) 30 keldagrimout -> 40
else if (poiloc == miningguild) 6 teak1 -> 30
else if (poiloc == magics || poiloc == coal) 8 miningguild -> 6
else if (poiloc == gemrocks || poiloc == chaosnpc) 1 else 60 magics,coal -> 8
gemrocks,chaosnpc -> 1
else -> 60
}
scriptAPI.randomWalkTo(poiloc,roamDistancePoi) scriptAPI.randomWalkTo(poiloc,roamDistancePoi)
return return
} }

View file

@ -16,7 +16,7 @@
"enable_bots": true, "enable_bots": true,
"autostock_ge": true, "autostock_ge": true,
"allow_token_purchase": true, "allow_token_purchase": true,
"max_adv_bots": "0", "max_adv_bots": "100",
"message_of_the_week_identifier": "0", "message_of_the_week_identifier": "0",
"message_of_the_week_text": "Welcome to 2009Scape! <br><col=11ff00>N</col><col=ecff00>o</col><col=ff8300>w</col <col=ff0000>i</col><col=ff00d4>n</col> <col=6100ff>T</col><col=000fff>e</col><col=00f0ff>c</col><col=00ff59>h</col><col=93ff00>n</col><col=ff9e00>i</col><col=ff0000>c</col><col=ff00d1>o</col><col=2700ff>l</col><col=00f7ff>o</col><col=00ff0c>r</col><col=ff0000>!</col>" "message_of_the_week_text": "Welcome to 2009Scape! <br><col=11ff00>N</col><col=ecff00>o</col><col=ff8300>w</col <col=ff0000>i</col><col=ff00d4>n</col> <col=6100ff>T</col><col=000fff>e</col><col=00f0ff>c</col><col=00ff59>h</col><col=93ff00>n</col><col=ff9e00>i</col><col=ff0000>c</col><col=ff00d1>o</col><col=2700ff>l</col><col=00f7ff>o</col><col=00ff0c>r</col><col=ff0000>!</col>"
}, },