From 12d4182e34d24106585c40356053cddedb254967 Mon Sep 17 00:00:00 2001 From: Kermit Frog Date: Tue, 18 Jan 2022 14:07:15 +0000 Subject: [PATCH] feat(adventure-bots) Fixed issues with Adventure bot assembly and initial spawning into the game world. --- CHANGELOG | 1 + .../kotlin/rs09/game/world/ImmerseWorld.kt | 26 +++++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 9e3c027ef..e3b3ae305 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -116,3 +116,4 @@ - Increase drop rate of Sinister Key to 1/12 - aweinstock - Strike spells now always max on Salarin, convert Yanille Agility Dungeon to kotlin + listener - aweinstock - Refactor NPCDropTable, WeightBasedTable and fixed bug where special items weren't processed in some cases - ryannathans +- Fixed issues with Adventure bot assembly and initial spawning into game world - Sir Kermit \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/world/ImmerseWorld.kt b/Server/src/main/kotlin/rs09/game/world/ImmerseWorld.kt index 4d5af3e6a..4793e9f70 100644 --- a/Server/src/main/kotlin/rs09/game/world/ImmerseWorld.kt +++ b/Server/src/main/kotlin/rs09/game/world/ImmerseWorld.kt @@ -7,7 +7,9 @@ import rs09.game.ai.general.GeneralBotCreator import rs09.game.ai.general.scriptrepository.* import rs09.game.ai.pvmbots.CombatBotAssembler import rs09.game.ai.skillingbot.SkillingBotAssembler +import java.util.Timer import java.util.concurrent.Executors +import kotlin.concurrent.schedule object ImmerseWorld { var assembler = CombatBotAssembler() @@ -25,15 +27,29 @@ object ImmerseWorld { // immerseSlayer() } } + fun immerseAdventurer(){ - val lumbridge = Location.create(3221, 3219, 0) - for(i in (0..(GameWorld.settings?.max_adv_bots ?: 50))){ - GeneralBotCreator(Adventurer(CombatStyle.MELEE), assembler.MeleeAdventurer(CombatBotAssembler.Tier.LOW,lumbridge)) - GeneralBotCreator(Adventurer(CombatStyle.MELEE), assembler.MeleeAdventurer(CombatBotAssembler.Tier.MED,lumbridge)) - GeneralBotCreator(Adventurer(CombatStyle.RANGE), assembler.RangeAdventurer(CombatBotAssembler.Tier.MED,lumbridge)) + for (i in 0..(GameWorld.settings?.max_adv_bots ?: 50)){ + var random: Long = (10000..300000).random().toLong() + Timer().schedule(random){ + spawn_adventurers() + } } } + fun spawn_adventurers(){ + val lumbridge = Location.create(3221, 3219, 0) + val tiers = listOf(CombatBotAssembler.Tier.LOW,CombatBotAssembler.Tier.MED) + GeneralBotCreator( + Adventurer(CombatStyle.MELEE), + assembler.MeleeAdventurer(tiers.random(), lumbridge) + ) + GeneralBotCreator( + Adventurer(CombatStyle.RANGE), + assembler.RangeAdventurer(tiers.random(), lumbridge) + ) + } + fun immerseFishingGuild(){ val fishingGuild = Location.create(2604, 3421, 0) for (i in (0..4)) {