From 8dfa6a11881740016f893b261517a03f94b09aac Mon Sep 17 00:00:00 2001 From: Badhad <46411657+BadHad@users.noreply.github.com> Date: Mon, 15 Mar 2021 20:25:56 -0400 Subject: [PATCH] Fixed Adventure bots to use new listen system for interactions. --- .../ai/general/scriptrepository/Adventurer.kt | 29 +++++++++++-------- Server/worldprops/default.json | 2 +- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/Adventurer.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/Adventurer.kt index 467571249..344386c7d 100644 --- a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/Adventurer.kt +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/Adventurer.kt @@ -21,6 +21,7 @@ import core.game.world.update.flag.player.ChatFlag import core.tools.RandomFunction import rs09.game.ai.AIRepository import rs09.game.ai.pvmbots.CombatBotAssembler +import rs09.game.interaction.InteractionListeners import java.time.LocalDateTime import java.time.format.DateTimeFormatter import kotlin.random.Random @@ -816,9 +817,10 @@ class Adventurer(val style: CombatStyle): Script() { "Maple tree","Yew","Magic tree", "Teak","Mahogany") val resource = scriptAPI.getNearestNodeFromList(resources,true) - try { - resource?.interaction?.handle(bot, resource.interaction[0]) - } catch (e: Exception){} + if(resource != null){ + if(resource.name.contains("ocks")) InteractionListeners.run(resource.id,1,"mine",bot,resource) + else InteractionListeners.run(resource.id,1,"chop down",bot,resource) + } } } return @@ -917,15 +919,18 @@ class Adventurer(val style: CombatStyle): Script() { } if (RandomFunction.random(1000) <= 50 && poi){ - val roamDistancePoi = if(poiloc == teakfarm || poiloc == crawlinghands) 5 - else if (poiloc == treegnome) 50 - else if (poiloc == isafdar) 40 - else if (poiloc == eaglespeek) 40 - else if (poiloc == keldagrimout) 40 - else if (poiloc == teak1) 30 - else if (poiloc == miningguild) 6 - else if (poiloc == magics || poiloc == coal) 8 - else if (poiloc == gemrocks || poiloc == chaosnpc) 1 else 60 + val roamDistancePoi = when(poiloc){ + teakfarm,crawlinghands -> 5 + treegnome -> 50 + isafdar -> 40 + eaglespeek -> 40 + keldagrimout -> 40 + teak1 -> 30 + miningguild -> 6 + magics,coal -> 8 + gemrocks,chaosnpc -> 1 + else -> 60 + } scriptAPI.randomWalkTo(poiloc,roamDistancePoi) return } diff --git a/Server/worldprops/default.json b/Server/worldprops/default.json index 8c0da7e38..e5d642d8a 100644 --- a/Server/worldprops/default.json +++ b/Server/worldprops/default.json @@ -16,7 +16,7 @@ "enable_bots": true, "autostock_ge": true, "allow_token_purchase": true, - "max_adv_bots": "0", + "max_adv_bots": "100", "message_of_the_week_identifier": "0", "message_of_the_week_text": "Welcome to 2009Scape!
Nowin Technicolor!" },