From 23689316664040e503ade268c4b2603f93484dc1 Mon Sep 17 00:00:00 2001 From: ceikry Date: Sun, 27 Jun 2021 09:09:29 -0500 Subject: [PATCH 01/10] Revert "Remove player bot scripts" This reverts commit 292dd00b --- .../general/scriptrepository/ChickenKiller.kt | 78 +++++++ .../ai/general/scriptrepository/CoalMiner.kt | 160 ++++++++++++++ .../scriptrepository/DraynorWillows.kt | 93 +++++++++ .../scriptrepository/LobsterCatcher.kt | 197 ++++++++++++++++++ .../general/scriptrepository/PlayerScripts.kt | 19 ++ .../scriptrepository/SeersMagicTrees.kt | 117 +++++++++++ .../system/command/oldsys/AIPCommandPlugin.kt | 3 + .../system/command/sets/BottingCommandSet.kt | 71 +++++++ .../main/kotlin/rs09/game/world/GameWorld.kt | 2 + .../kotlin/rs09/game/world/ImmerseWorld.kt | 9 + 10 files changed, 749 insertions(+) create mode 100644 Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/ChickenKiller.kt create mode 100644 Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/CoalMiner.kt create mode 100644 Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/DraynorWillows.kt create mode 100644 Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/LobsterCatcher.kt create mode 100644 Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/PlayerScripts.kt create mode 100644 Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/SeersMagicTrees.kt create mode 100644 Server/src/main/kotlin/rs09/game/system/command/sets/BottingCommandSet.kt diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/ChickenKiller.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/ChickenKiller.kt new file mode 100644 index 000000000..4bb569afc --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/ChickenKiller.kt @@ -0,0 +1,78 @@ +package rs09.game.ai.general.scriptrepository + +import core.game.world.map.Location +import org.rs09.consts.Items +import rs09.game.ai.general.ScriptAPI + +@PlayerCompatible +@ScriptName("Chicken Killer") +@ScriptDescription("Kills chickens and loots feathers. Start in any chicken area.") +@ScriptIdentifier("chicken_killer") +class ChickenKiller : Script(){ + var state = State.INIT + var chickenCounter = 0 + var overlay: ScriptAPI.BottingOverlay?= null + var startLocation = Location(0,0,0) + var timer = 3 + var lootFeathers = false + + override fun tick() { + when(state){ + + State.INIT -> { + overlay = scriptAPI.getOverlay() + overlay!!.init() + overlay!!.setTitle("Chickens") + overlay!!.setTaskLabel("Chickens KO'd:") + overlay!!.setAmount(0) + state = State.CONFIG + bot.dialogueInterpreter.sendOptions("Loot Feathers?","Yes","No") + bot.dialogueInterpreter.addAction{player,button -> + lootFeathers = button == 2 + state = State.KILLING + } + startLocation = bot.location + } + + State.KILLING -> { + val chicken = scriptAPI.getNearestNode("Chicken") + if(chicken == null){ + scriptAPI.randomWalkTo(startLocation,3) + } else { + scriptAPI.attackNpcInRadius(bot,"Chicken",10) + if(lootFeathers) { + state = State.IDLE + timer = 4 + } + chickenCounter++ + overlay!!.setAmount(chickenCounter) + } + } + + State.IDLE -> { + if(timer-- <= 0){ + state = State.LOOTING + } + } + + State.LOOTING -> { + scriptAPI.takeNearestGroundItem(Items.FEATHER_314) + state = State.KILLING + } + + } + } + + override fun newInstance(): Script { + return this + } + + enum class State { + IDLE, + INIT, + KILLING, + LOOTING, + RETURN, + CONFIG + } +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/CoalMiner.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/CoalMiner.kt new file mode 100644 index 000000000..9fc4b307b --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/CoalMiner.kt @@ -0,0 +1,160 @@ +package rs09.game.ai.general.scriptrepository + +import core.game.interaction.DestinationFlag +import core.game.interaction.MovementPulse +import core.game.node.Node +import core.game.node.entity.skill.Skills +import core.game.node.item.Item +import core.game.world.map.zone.ZoneBorders +import org.rs09.consts.Items +import rs09.game.ai.general.ScriptAPI +import rs09.game.ai.skillingbot.SkillingBotAssembler +import rs09.game.interaction.InteractionListener +import rs09.game.interaction.InteractionListeners + +@PlayerCompatible +@ScriptName("Falador Coal Miner") +@ScriptDescription("Start in Falador East Bank with a pick equipped","or in your inventory.") +@ScriptIdentifier("fally_coal") +class CoalMiner() : Script() { + var state = State.INIT + var ladderSwitch = false + + val bottomLadder = ZoneBorders(3016,9736,3024,9742) + val topLadder = ZoneBorders(3016,3336,3022,3342) + val mine = ZoneBorders(3027,9733,3054,9743) + val bank = ZoneBorders(3009,3355,3018,3358) + var overlay: ScriptAPI.BottingOverlay? = null + var coalAmount = 0 + + override fun tick() { + when(state){ + + State.INIT -> { + overlay = scriptAPI.getOverlay() + ladderSwitch = true + overlay!!.init() + overlay!!.setTitle("Mining") + overlay!!.setTaskLabel("Coal Mined:") + overlay!!.setAmount(0) + + if (mine.insideBorder(bot)){ + ladderSwitch = false + state = State.MINING + } else { + state = State.TO_MINE + } + } + + State.MINING -> { + if(bot.inventory.freeSlots() == 0){ + state = State.TO_BANK + } + if(!mine.insideBorder(bot)){ + scriptAPI.walkTo(mine.randomLoc) + } else { + val rock = scriptAPI.getNearestNode("rocks",true) + rock?.let { InteractionListeners.run(rock.id, InteractionListener.OBJECT,"mine",bot,rock) } + } + overlay!!.setAmount(bot.inventory.getAmount(Items.COAL_453) + coalAmount) + } + + State.TO_BANK -> { + if(bank.insideBorder(bot)){ + val bank = scriptAPI.getNearestNode("bank booth",true) + if(bank != null) { + bot.pulseManager.run(object : BankingPulse(this, bank){ + override fun pulse(): Boolean { + state = State.BANKING + return super.pulse() + } + }) + } + + } else { + if(!ladderSwitch) { + val ladder = scriptAPI.getNearestNode(30941, true) + ladder ?: scriptAPI.walkTo(bottomLadder.randomLoc).also { return } + ladder?.interaction?.handle(bot, ladder.interaction[0]).also { ladderSwitch = true } + } else { + if (!bank.insideBorder(bot)) scriptAPI.walkTo(bank.randomLoc).also { return } + } + } + } + + State.BANKING -> { + coalAmount += bot.inventory.getAmount(Items.COAL_453) + scriptAPI.bankItem(Items.COAL_453) + state = State.TO_MINE + } + + State.TO_MINE -> { + if(ladderSwitch){ + if(!topLadder.insideBorder(bot.location)){ + scriptAPI.walkTo(topLadder.randomLoc) + } else { + val ladder = scriptAPI.getNearestNode("Ladder",true) + if(ladder != null){ + ladder.interaction.handle(bot,ladder.interaction[0]) + ladderSwitch = false + } else { + scriptAPI.walkTo(topLadder.randomLoc) + } + } + } else { + if(!mine.insideBorder(bot)){ + scriptAPI.walkTo(mine.randomLoc) + } else { + state = State.MINING + } + } + } + + State.TO_GE -> { + scriptAPI.teleportToGE() + state = State.SELLING + } + + State.SELLING -> { + scriptAPI.sellOnGE(Items.COAL_453) + state = State.GO_BACK + } + + State.GO_BACK -> { + scriptAPI.teleport(bank.randomLoc) + state = State.TO_MINE + } + + } + } + + open class BankingPulse(val script: Script, val bank: Node) : MovementPulse(script.bot,bank, DestinationFlag.OBJECT){ + override fun pulse(): Boolean { + script.bot.faceLocation(bank.location) + return true + } + } + + override fun newInstance(): Script { + val script = CoalMiner() + script.bot = SkillingBotAssembler().produce(SkillingBotAssembler.Wealth.POOR,bot.startLocation) + return script + } + + enum class State { + MINING, + TO_MINE, + TO_BANK, + BANKING, + TO_GE, + SELLING, + GO_BACK, + INIT + } + + init { + equipment.add(Item(Items.IRON_PICKAXE_1267)) + skills.put(Skills.MINING,75) + } + +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/DraynorWillows.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/DraynorWillows.kt new file mode 100644 index 000000000..b9195bb2e --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/DraynorWillows.kt @@ -0,0 +1,93 @@ +package rs09.game.ai.general.scriptrepository + +import core.game.component.Component +import core.game.interaction.DestinationFlag +import core.game.interaction.MovementPulse +import core.game.node.entity.skill.Skills +import core.game.node.item.Item +import core.game.world.map.zone.ZoneBorders +import org.rs09.consts.Items +import rs09.game.interaction.InteractionListener +import rs09.game.interaction.InteractionListeners +import rs09.tools.stringtools.colorize + +@PlayerCompatible +@ScriptName("Draynor Willows") +@ScriptDescription("Start in Draynor with an axe equipped or in inventory.") +@ScriptIdentifier("draynor_trees") +class DraynorWillows : Script(){ + val willowZone = ZoneBorders(3084, 3225,3091, 3239) + + + val bankZone = ZoneBorders(3092, 3240,3094, 3246) + var state = State.INIT + var logCount = 0 + + override fun tick() { + when(state){ + State.INIT -> { + if(true){ + bot.interfaceManager.openOverlay(Component(195)) + bot.packetDispatch.sendString("Woodcutting",195,7) + bot.packetDispatch.sendString(colorize("%BLogs Chopped:"),195,8) + bot.packetDispatch.sendString(colorize("%B0"),195,9) + bot.packetDispatch.sendInterfaceConfig(195,5,true) + } + state = State.CHOPPING + } + + State.CHOPPING -> { + if (!willowZone.insideBorder(bot)) + scriptAPI.walkTo(willowZone.randomLoc) + else { + val willowtree = scriptAPI.getNearestNode("willow", true) + willowtree?.let { InteractionListeners.run(willowtree.id, + InteractionListener.OBJECT,"chop",bot,willowtree) } + if (bot.inventory.isFull) + state = State.BANKING + } + + bot.packetDispatch.sendString(colorize("%B${logCount + bot.inventory.getAmount(Items.WILLOW_LOGS_1519)}"), 195, 9) + } + + State.BANKING -> { + if(!bankZone.insideBorder(bot)) + scriptAPI.walkTo(bankZone.randomLoc) + else{ + val bank = scriptAPI.getNearestNode("Bank Booth",true) + if(bank != null){ + bot.pulseManager.run(object : MovementPulse(bot,bank, DestinationFlag.OBJECT){ + override fun pulse(): Boolean { + val logs = bot.inventory.getAmount(Item(Items.WILLOW_LOGS_1519)) + logCount += logs + bot.inventory.remove(Item(Items.WILLOW_LOGS_1519,logs)) + bot.bank.add(Item(Items.WILLOW_LOGS_1519,logs)) + state = State.CHOPPING + return true + } + }) + } + } + } + + + + } + } + + init { + inventory.add(Item(Items.ADAMANT_AXE_1357)) + skills[Skills.WOODCUTTING] = 35 + } + + override fun newInstance(): Script { + val script = DraynorWillows() + return script + } + + enum class State { + CHOPPING, + BANKING, + INIT + } +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/LobsterCatcher.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/LobsterCatcher.kt new file mode 100644 index 000000000..6863f20dd --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/LobsterCatcher.kt @@ -0,0 +1,197 @@ +package rs09.game.ai.general.scriptrepository + +import core.game.interaction.DestinationFlag +import core.game.interaction.MovementPulse +import core.game.node.entity.skill.Skills +import core.game.node.item.Item +import core.game.system.task.Pulse +import core.game.world.map.Location +import core.game.world.map.path.Pathfinder +import core.game.world.update.flag.context.Animation +import core.game.world.update.flag.context.Graphics +import core.tools.RandomFunction +import org.rs09.consts.Items +import rs09.game.ai.AIPlayer +import rs09.game.ai.general.ScriptAPI +import rs09.game.interaction.InteractionListener +import rs09.game.interaction.InteractionListeners +import rs09.game.world.GameWorld +import kotlin.random.Random + +@PlayerCompatible +@ScriptName("Catherby Lobs") +@ScriptDescription("Start in Catherby bank with a lobster pot in your inventory.") +@ScriptIdentifier("cath_lobs") +class LobsterCatcher : Script() { + private val ANIMATION = Animation(714) + val offers = HashMap() + val limit = 2000 + var myCounter = 0 + /** + * Represents the graphics to use. + */ + private val GRAPHICS = Graphics(308, 100, 50) + internal enum class Sets(val equipment: List) { + SET_1(listOf(Item(2643), Item(9470), Item(10756), Item(10394), Item(88), Item(9793))), + SET_2(listOf(Item(2643), Item(6585), Item(10750), Item(10394), Item(88), Item(9793))), + SET_3(listOf(Item(9472), Item(9470), Item(10750), Item(10394), Item(88), Item(9786))), + SET_4(listOf(Item(2639), Item(6585), Item(10752), Item(10394), Item(88), Item(9786))), + SET_5(listOf(Item(2639), Item(9470), Item(10750), Item(10394), Item(88), Item(9784))), + SET_6(listOf(Item(2639), Item(6585), Item(10750), Item(10394), Item(88), Item(9784))); + + } + + private var bots = 0 + private var lobstopper = false + var overlay: ScriptAPI.BottingOverlay?= null + var fishCounter = 0 + + private var state = State.INIT + private var tick = 0 + override fun tick() { + when(state){ + + State.INIT -> { + overlay = scriptAPI.getOverlay() + overlay!!.init() + overlay!!.setTitle("Fishing") + overlay!!.setTaskLabel("Lobs Caught:") + overlay!!.setAmount(0) + state = State.FIND_SPOT + } + + + State.BANKING -> { + fishCounter += bot.inventory.getAmount(Items.RAW_LOBSTER_377) + scriptAPI.bankItem(Items.RAW_LOBSTER_377) + state = State.IDLE + } + + + State.FISHING -> { + val spot = scriptAPI.getNearestNode(333, false) + if(spot == null){ + state = State.IDLE + } else { + InteractionListeners.run(spot.id,InteractionListener.NPC,"cage",bot,spot) + } + if(bot.inventory.isFull){ + state = State.FIND_BANK + } + overlay!!.setAmount(fishCounter + bot.inventory.getAmount(Items.RAW_LOBSTER_377)) + } + + State.IDLE -> { + if (Random.nextBoolean()){ + state = State.FIND_SPOT + } + else if(myCounter++ >= RandomFunction.random(1,25)){ + state = State.FIND_SPOT + } + } + + State.FIND_SPOT -> { + val spot = scriptAPI.getNearestNode(333, false) + if (spot != null) { + bot.walkingQueue.reset() + state = State.FISHING + } else { + if (bot.location.x < 2837) { + Pathfinder.find(bot, Location.create(2837, 3435, 0)).walk(bot) + } else { + Pathfinder.find(bot, Location.create(2854, 3427, 0)).walk(bot) + } + } + } + + + State.FIND_BANK -> { + val bank = scriptAPI.getNearestGameObject(bot.location, 2213) + class BankingPulse : MovementPulse(bot, bank, DestinationFlag.OBJECT) { + override fun pulse(): Boolean { + bot.faceLocation(bank!!.location) + state = State.BANKING + return true + } + } + if(bank != null){ + bot.pulseManager.run(BankingPulse()) + } else { + if (bot.location.x > 2837) { + Pathfinder.find(bot, Location.create(2837, 3435, 0)).walk(bot) + } else if (bot.location.x > 2821) { + Pathfinder.find(bot, Location.create(2821, 3435, 0)).walk(bot) + } else if (bot.location.x > 2809){ + Pathfinder.find(bot,Location.create(2809, 3436, 0)).walk(bot) + } + } + } + + + State.TELEPORT_GE -> { + scriptAPI.teleportToGE() + state = State.SELL_GE + } + + + State.SELL_GE -> { + scriptAPI.sellOnGE(Items.RAW_LOBSTER_377) + state = State.TELE_CATH + } + + State.TELE_CATH -> { + if(tick++ == 10) { + bot.lock() + bot.visualize(ANIMATION, GRAPHICS) + bot.impactHandler.disabledTicks = 4 + val location = Location.create(2819, 3437, 0) + GameWorld.Pulser.submit(object : Pulse(4, bot) { + override fun pulse(): Boolean { + bot.unlock() + bot.properties.teleportLocation = location + bot.animator.reset() + state = State.IDLE + return true + } + }) + } + } + + + } + } + + + init { + val setUp = RandomFunction.random(Sets.values().size) + equipment.addAll(Sets.values()[setUp].equipment) + inventory.add(Item(301)) + skills[Skills.FISHING] = 40 + } + + enum class State{ + FISHING, + BANKING, + FIND_BANK, + FIND_SPOT, + TELEPORT_GE, + SELL_GE, + TELE_CATH, + IDLE, + INIT + } + + override fun newInstance(): Script { + if (!lobstopper && bots <= 0) { + val script = LobsterCatcher() + script.bot = AIPlayer(bot.startLocation) + script.state = State.FIND_SPOT + bots = 1 + return script + }else if (tick++ == 6000 && lobstopper) { + tick = 0 + lobstopper = false + } + return newInstance() + } +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/PlayerScripts.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/PlayerScripts.kt new file mode 100644 index 000000000..1aaba11e6 --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/PlayerScripts.kt @@ -0,0 +1,19 @@ +package rs09.game.ai.general.scriptrepository + +import io.github.classgraph.ClassGraph + +object PlayerScripts { + class PlayerScript(val identifier: String, val description: Array, val name: String, val clazz: Class<*>) + val identifierMap = HashMap() + + + fun init(){ + val result = ClassGraph().enableAnnotationInfo().acceptPackages("rs09.game.ai.general.scriptrepository").scan() + result.getClassesWithAnnotation("rs09.game.ai.general.scriptrepository.PlayerCompatible").forEach { res -> + val description = res.getAnnotationInfo("rs09.game.ai.general.scriptrepository.ScriptDescription").parameterValues[0].value as Array + val identifier = res.getAnnotationInfo("rs09.game.ai.general.scriptrepository.ScriptIdentifier").parameterValues[0].value.toString() + val name = res.getAnnotationInfo("rs09.game.ai.general.scriptrepository.ScriptName").parameterValues[0].value.toString() + identifierMap[identifier] = PlayerScript(identifier,description,name,res.loadClass()) + } + } +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/SeersMagicTrees.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/SeersMagicTrees.kt new file mode 100644 index 000000000..48b7b45c3 --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/SeersMagicTrees.kt @@ -0,0 +1,117 @@ +package rs09.game.ai.general.scriptrepository + +import core.game.interaction.DestinationFlag +import core.game.interaction.MovementPulse +import core.game.node.entity.skill.Skills +import core.game.node.item.Item +import core.game.world.map.Location +import core.game.world.map.zone.ZoneBorders +import core.tools.RandomFunction +import org.rs09.consts.Items +import rs09.game.ai.general.ScriptAPI +import rs09.game.ai.skillingbot.SkillingBotAssembler +import rs09.game.interaction.InteractionListener +import rs09.game.interaction.InteractionListeners + +@PlayerCompatible +@ScriptName("Seers Magics") +@ScriptDescription("Start in Seers Bank with an axe equipped or in your inventory.") +@ScriptIdentifier("seers_magics") +class SeersMagicTrees : Script(){ + var state = State.INIT + var stage = 0 + val bankZone = ZoneBorders(2722,3490,2727,3493) + val magicsZone = ZoneBorders(2700, 3396,2704, 3399) + var overlay: ScriptAPI.BottingOverlay? = null + var logCounter = 0 + + override fun tick() { + when(state){ + + State.INIT -> { + overlay = scriptAPI.getOverlay() + overlay!!.init() + overlay!!.setTitle("Woodcutting") + overlay!!.setTaskLabel("Logs cut:") + overlay!!.setAmount(0) + state = State.RETURN_TO_TREES + } + + State.CHOPPING -> { + val tree = scriptAPI.getNearestNode(1306,true) + tree?.let { InteractionListeners.run(tree.id, InteractionListener.OBJECT,"chop",bot,tree) } + if(bot.inventory.isFull){ + state = State.FIND_BANK + } + overlay!!.setAmount(logCounter + bot.inventory.getAmount(Items.MAGIC_LOGS_1513)) + } + + State.FIND_BANK -> { + if(!bankZone.insideBorder(bot)){ + scriptAPI.walkTo(bankZone.randomLoc) + } else { + state = State.BANKING + } + } + + State.BANKING -> { + val bank = scriptAPI.getNearestNode(25808,true) + if(bank != null) + bot.pulseManager.run(object: MovementPulse(bot,bank, DestinationFlag.OBJECT){ + override fun pulse(): Boolean { + bot.faceLocation(bank.location) + logCounter += bot.inventory.getAmount(Items.MAGIC_LOGS_1513) + scriptAPI.bankItem(Items.MAGIC_LOGS_1513) + state = State.RETURN_TO_TREES + return true + } + }) + } + + State.RETURN_TO_TREES -> { + if(!magicsZone.insideBorder(bot)){ + scriptAPI.walkTo(magicsZone.randomLoc) + } else { + state = State.CHOPPING + } + } + + State.TELE_GE -> { + state = State.SELL_GE + scriptAPI.teleportToGE() + } + + State.SELL_GE -> { + state = State.TELE_SEERS + scriptAPI.sellOnGE(Items.MAGIC_LOGS_1513) + } + + State.TELE_SEERS -> { + state = State.RETURN_TO_TREES + scriptAPI.teleport(Location.create(2756, 3478, 0)) + } + } + } + + init { + inventory.add(Item(Items.RUNE_AXE_1359)) + skills[Skills.WOODCUTTING] = RandomFunction.random(75,99) + } + + enum class State { + CHOPPING, + FIND_BANK, + BANKING, + RETURN_TO_TREES, + TELE_GE, + SELL_GE, + TELE_SEERS, + INIT + } + + override fun newInstance(): Script { + val script = SeersMagicTrees() + script.bot = SkillingBotAssembler().produce(SkillingBotAssembler.Wealth.AVERAGE,bot.startLocation) + return script + } +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/system/command/oldsys/AIPCommandPlugin.kt b/Server/src/main/kotlin/rs09/game/system/command/oldsys/AIPCommandPlugin.kt index 29c5513c7..71c61da18 100644 --- a/Server/src/main/kotlin/rs09/game/system/command/oldsys/AIPCommandPlugin.kt +++ b/Server/src/main/kotlin/rs09/game/system/command/oldsys/AIPCommandPlugin.kt @@ -20,6 +20,8 @@ import core.plugin.Plugin import core.tools.RandomFunction import rs09.game.ai.AIPBuilder import rs09.game.ai.AIPlayer +import rs09.game.ai.general.GeneralBotCreator +import rs09.game.ai.general.scriptrepository.LobsterCatcher import rs09.game.ai.pvmbots.PvMBotsBuilder import rs09.game.ai.pvp.PVPAIPActions import rs09.game.ai.pvp.PVPAIPBuilderUtils @@ -307,6 +309,7 @@ class AIPCommandPlugin : CommandPlugin() { return true } //"manthiev" -> GeneralBotCreator(player.location, ManThiever()) + "fish" -> GeneralBotCreator(Location.create(2805, 3435, 0), LobsterCatcher()) } return false } diff --git a/Server/src/main/kotlin/rs09/game/system/command/sets/BottingCommandSet.kt b/Server/src/main/kotlin/rs09/game/system/command/sets/BottingCommandSet.kt new file mode 100644 index 000000000..8131ecb3a --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/system/command/sets/BottingCommandSet.kt @@ -0,0 +1,71 @@ +package rs09.game.system.command.sets + +import core.game.component.Component +import core.plugin.Initializable +import org.rs09.consts.Components +import rs09.game.ai.general.GeneralBotCreator +import rs09.game.ai.general.scriptrepository.PlayerScripts +import rs09.game.ai.general.scriptrepository.Script +import rs09.game.system.command.Command +import rs09.game.world.GameWorld +import rs09.tools.stringtools.colorize + +@Initializable +class BottingCommandSet : CommandSet(Command.Privilege.STANDARD) { + override fun defineCommands() { + define("scripts"){player, _ -> + if(GameWorld.settings?.enabled_botting != true){ + player.sendChat("I just tried to do something silly!") + return@define + } + if(!player.getAttribute("botting:warning_shown",false)){ + player.dialogueInterpreter.sendDialogue(colorize("%RWARNING: Running a bot script will permanently remove you"),colorize("%Rfrom the highscores.")) + player.dialogueInterpreter.addAction { player, buttonId -> player.setAttribute("/save:botting:warning_shown",true) } + return@define + } + for (i in 0..310) { + player.packetDispatch.sendString("", 275, i) + } + var lineid = 11 + player.packetDispatch.sendString("Bot Scripts",275,2) + for(script in PlayerScripts.identifierMap.values) { + player.packetDispatch.sendString("${script.name}", 275, lineid++) + script.description.forEach { line -> + player.packetDispatch.sendString(line,275,lineid++) + } + player.packetDispatch.sendString(" ::script ${script.identifier}",275,lineid++) + player.packetDispatch.sendString(" ",275,lineid++) + } + player.interfaceManager.open(Component(Components.QUESTJOURNAL_SCROLL_275)) + } + define("script"){player,args -> + if(GameWorld.settings?.enabled_botting != true){ + player.sendChat("I just tried to do something very silly!") + return@define + } + if(!player.getAttribute("botting:warning_shown",false)){ + player.dialogueInterpreter.sendDialogue(colorize("%RWARNING: Running a bot script will permanently remove you from the highscores.")) + player.dialogueInterpreter.addAction { player, buttonId -> player.setAttribute("/save:botting:warning_shown",true) } + return@define + } + if(args.size < 2){ + reject(player,"Usage: ::script identifier") + } + val identifier = args[1] + val script = PlayerScripts.identifierMap[identifier] + if(script == null){ + reject(player,"Invalid script identifier") + } + player.interfaceManager.close() + GeneralBotCreator(script!!.clazz.newInstance() as Script,player,true) + player.sendMessage(colorize("%RStarting script...")) + player.sendMessage(colorize("%RTo stop the script, do ::stopscript or log out.")) + + } + define("stopscript"){player,args -> + val pulse: GeneralBotCreator.BotScriptPulse? = player.getAttribute("botting:script",null) + pulse?.stop() + player.interfaceManager.closeOverlay() + } + } +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/world/GameWorld.kt b/Server/src/main/kotlin/rs09/game/world/GameWorld.kt index f4a75ec0c..7bd821755 100644 --- a/Server/src/main/kotlin/rs09/game/world/GameWorld.kt +++ b/Server/src/main/kotlin/rs09/game/world/GameWorld.kt @@ -15,6 +15,7 @@ import core.game.world.map.RegionManager import core.plugin.CorePluginTypes.StartupPlugin import core.tools.RandomFunction import core.tools.mysql.DatabaseManager +import rs09.game.ai.general.scriptrepository.PlayerScripts import rs09.ServerConstants import rs09.game.node.entity.state.newsys.StateRepository import rs09.game.system.SystemLogger @@ -151,6 +152,7 @@ object GameWorld { } ObjectDefinition.getDefinitions().values.forEach(Consumer { obj: ObjectDefinition -> obj.examine }) System.gc() + PlayerScripts.init() StateRepository.init() SystemLogger.initTradeLogger() } diff --git a/Server/src/main/kotlin/rs09/game/world/ImmerseWorld.kt b/Server/src/main/kotlin/rs09/game/world/ImmerseWorld.kt index 7fe7cde07..cdfc035bb 100644 --- a/Server/src/main/kotlin/rs09/game/world/ImmerseWorld.kt +++ b/Server/src/main/kotlin/rs09/game/world/ImmerseWorld.kt @@ -41,9 +41,11 @@ object ImmerseWorld { } fun immerseSeersAndCatherby(){ + GeneralBotCreator(SeersMagicTrees(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.AVERAGE, Location.create(2702, 3397, 0))) GeneralBotCreator(SeersFlax(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR, Location.create(2738, 3444, 0))) GeneralBotCreator(FletchingBankstander(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.AVERAGE, Location.create(2722, 3493, 0))) GeneralBotCreator(GlassBlowingBankstander(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.AVERAGE, Location.create(2807, 3441, 0))) + GeneralBotCreator(Location.create(2805, 3435, 0), LobsterCatcher()) } fun immerseLumbridgeDraynor(){ @@ -53,6 +55,9 @@ object ImmerseWorld { GeneralBotCreator(ManThiever(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR,Location.create(3235, 3213, 0))) GeneralBotCreator(FarmerThiever(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR,Location.create(3094,3243,0))) GeneralBotCreator(FarmerThiever(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR,Location.create(3094,3243,0))) + GeneralBotCreator(DraynorWillows(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.values().random(),Location.create(3094, 3245, 0))) + GeneralBotCreator(DraynorWillows(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.values().random(),Location.create(3094, 3245, 0))) + GeneralBotCreator(DraynorWillows(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.values().random(),Location.create(3094, 3245, 0))) GeneralBotCreator(DraynorFisher(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR,Location.create(3095, 3246, 0))) GeneralBotCreator(DraynorFisher(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR,Location.create(3095, 3246, 0))) GeneralBotCreator(DraynorFisher(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR,Location.create(3095, 3246, 0))) @@ -78,6 +83,10 @@ object ImmerseWorld { } } + fun immerseFalador(){ + GeneralBotCreator(CoalMiner(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR,Location.create(3037, 9737, 0))) + } + fun immerseSlayer(){ GeneralBotCreator(GenericSlayerBot(), assembler.produce(CombatBotAssembler.Type.MELEE,CombatBotAssembler.Tier.HIGH,Location.create(2673, 3635, 0))) } From 516727ec515f39b7af17667bafa9d5ca9aee88a8 Mon Sep 17 00:00:00 2001 From: skelsoft <9147770-skelsoft@users.noreply.gitlab.com> Date: Sun, 27 Jun 2021 14:14:49 +0000 Subject: [PATCH 02/10] Add: Witchaven, Witchaven Dungeon Update --- Server/data/configs/npc_configs.json | 222 ++++++++++++++++++++++++--- Server/data/configs/npc_spawns.json | 60 +++++++- Server/data/configs/shops.json | 11 +- 3 files changed, 261 insertions(+), 32 deletions(-) diff --git a/Server/data/configs/npc_configs.json b/Server/data/configs/npc_configs.json index 89103b050..6157f9c10 100644 --- a/Server/data/configs/npc_configs.json +++ b/Server/data/configs/npc_configs.json @@ -2255,25 +2255,25 @@ "attack_level": "27" }, { - "examine": "Big, ugly, and smelly.", + "examine": "A large dim looking humanoid.", "melee_animation": "359", "range_animation": "359", "attack_speed": "6", - "magic_level": "27", + "magic_level": "1", "respawn_delay": "25", "defence_animation": "360", "magic_animation": "359", "death_animation": "361", "name": "Ogre", - "defence_level": "27", + "defence_level": "43", "safespot": null, "lifepoints": "60", - "strength_level": "27", + "strength_level": "43", "id": "115", "aggressive": "true", - "bonuses": "15,15,10,20,40,15,50,50,50,20,50,58,0,0,0", - "range_level": "27", - "attack_level": "27" + "bonuses": "22,22,22,0,0,0,0,0,0,0,0,20,0,0,0", + "range_level": "1", + "attack_level": "43" }, { "examine": "Big, ugly, and smelly.", @@ -64634,14 +64634,14 @@ "magic_animation": "164", "death_animation": "167", "name": "Hobgoblin", - "defence_level": "1", + "defence_level": "24", "safespot": null, "lifepoints": "29", - "strength_level": "10", + "strength_level": "24", "id": "2685", "aggressive": "true", - "range_level": "20", - "attack_level": "20" + "range_level": "1", + "attack_level": "22" }, { "examine": "An ugly smelly creature.", @@ -64653,14 +64653,14 @@ "magic_animation": "164", "death_animation": "167", "name": "Hobgoblin", - "defence_level": "1", + "defence_level": "24", "safespot": null, "lifepoints": "29", - "strength_level": "10", + "strength_level": "24", "id": "2686", "aggressive": "true", - "range_level": "20", - "attack_level": "20" + "range_level": "1", + "attack_level": "22" }, { "examine": "An ugly smelly creature.", @@ -64672,14 +64672,14 @@ "magic_animation": "164", "death_animation": "167", "name": "Hobgoblin", - "defence_level": "1", + "defence_level": "24", "safespot": null, "lifepoints": "29", - "strength_level": "10", + "strength_level": "24", "id": "2687", "aggressive": "true", - "range_level": "20", - "attack_level": "20" + "range_level": "1", + "attack_level": "22" }, { "examine": "An ugly smelly creature, with a spear.", @@ -64691,14 +64691,14 @@ "magic_animation": "163", "death_animation": "167", "name": "Hobgoblin", - "defence_level": "1", + "defence_level": "24", "safespot": null, "lifepoints": "29", - "strength_level": "10", + "strength_level": "24", "id": "2688", "aggressive": "true", - "range_level": "20", - "attack_level": "20" + "range_level": "1", + "attack_level": "22" }, { "examine": "Didn't the mage say this procedure was totally safe?", @@ -73078,6 +73078,182 @@ "name": "Druid", "id": "14" }, + { + "examine": "She looks very worried about something.", + "melee_animation": "0", + "range_animation": "0", + "defence_animation": "0", + "magic_animation": "0", + "death_animation": "0", + "name": "Caroline", + "defence_level": "1", + "safespot": null, + "lifepoints": "10", + "strength_level": "1", + "id": "696", + "range_level": "1", + "attack_level": "1" + }, + { + "examine": "A very good sailor.", + "melee_animation": "0", + "range_animation": "0", + "defence_animation": "0", + "magic_animation": "0", + "death_animation": "0", + "name": "Holgart", + "defence_level": "1", + "safespot": null, + "lifepoints": "10", + "strength_level": "1", + "id": "698", + "range_level": "1", + "attack_level": "1" + }, + { + "examine": "Smells a bit fishy.", + "melee_animation": "0", + "range_animation": "0", + "defence_animation": "0", + "magic_animation": "0", + "death_animation": "0", + "name": "Ezekial Lovecraft", + "defence_level": "1", + "safespot": null, + "lifepoints": "10", + "strength_level": "1", + "id": "4856", + "range_level": "1", + "attack_level": "1" + }, + { + "examine": "A (semi) retired member of the Temple Knights.", + "melee_animation": "0", + "range_animation": "0", + "defence_animation": "0", + "magic_animation": "0", + "death_animation": "0", + "name": "Col. O'Niall", + "defence_level": "1", + "safespot": null, + "lifepoints": "10", + "strength_level": "1", + "id": "4872", + "range_level": "1", + "attack_level": "1" + }, + { + "examine": "There's something fishy about him.", + "melee_animation": "0", + "range_animation": "0", + "defence_animation": "0", + "magic_animation": "0", + "death_animation": "0", + "name": "Mayor Hobb", + "defence_level": "1", + "safespot": null, + "lifepoints": "10", + "strength_level": "1", + "id": "4874", + "range_level": "1", + "attack_level": "1" + }, + { + "examine": "A fresh-faced and innocent priest.", + "melee_animation": "0", + "range_animation": "0", + "defence_animation": "0", + "magic_animation": "0", + "death_animation": "0", + "name": "Brother Maledict", + "defence_level": "1", + "safespot": null, + "lifepoints": "10", + "strength_level": "1", + "id": "4878", + "range_level": "1", + "attack_level": "1" + }, + { + "examine": "A down on his luck fisherman.", + "melee_animation": "0", + "range_animation": "0", + "defence_animation": "0", + "magic_animation": "0", + "death_animation": "0", + "name": "Witchaven villager", + "defence_level": "1", + "safespot": null, + "lifepoints": "10", + "strength_level": "1", + "id": "4883", + "range_level": "1", + "attack_level": "1" + }, + { + "examine": "A down on her luck fisherman.", + "melee_animation": "0", + "range_animation": "0", + "defence_animation": "0", + "magic_animation": "0", + "death_animation": "0", + "name": "Witchaven villager", + "defence_level": "1", + "safespot": null, + "lifepoints": "10", + "strength_level": "1", + "id": "4885", + "range_level": "1", + "attack_level": "1" + }, + { + "examine": "A down on his luck fisherman.", + "melee_animation": "0", + "range_animation": "0", + "defence_animation": "0", + "magic_animation": "0", + "death_animation": "0", + "name": "Witchaven villager", + "defence_level": "1", + "safespot": null, + "lifepoints": "10", + "strength_level": "1", + "id": "4887", + "range_level": "1", + "attack_level": "1" + }, + { + "examine": "A villager named Jeb.", + "melee_animation": "0", + "range_animation": "0", + "defence_animation": "0", + "magic_animation": "0", + "death_animation": "0", + "name": "Jeb", + "defence_level": "1", + "safespot": null, + "lifepoints": "10", + "strength_level": "1", + "id": "4895", + "range_level": "1", + "attack_level": "1" + }, + { + "examine": "A little girl. She looks terrified.", + "melee_animation": "0", + "range_animation": "0", + "defence_animation": "0", + "magic_animation": "0", + "death_animation": "0", + "name": "Kimberly", + "defence_level": "1", + "safespot": null, + "lifepoints": "10", + "strength_level": "1", + "id": "7168", + "range_level": "1", + "attack_level": "1" + }, { "examine": "Stinky! Poor guy.", "name": "Yeti", diff --git a/Server/data/configs/npc_spawns.json b/Server/data/configs/npc_spawns.json index 3de29bbcd..d2eb8b520 100644 --- a/Server/data/configs/npc_spawns.json +++ b/Server/data/configs/npc_spawns.json @@ -125,7 +125,7 @@ }, { "npc_id": "41", - "loc_data": "{3197,3356,0,1,4}-{3234,3297,0,1,3}-{3230,3296,0,1,5}-{3236,3288,0,1,6}-{3236,3300,0,1,2}-{3231,3308,0,1,3}-{2965,3336,0,1,4}-{3110,9573,0,1,6}-{2655,3441,0,1,6}-{2649,3438,0,1,7}-{2649,3446,0,1,6}-{2653,3444,0,1,6}-{2647,3441,0,1,1}-{2784,3062,0,1,4}-{2789,3063,0,1,4}-{3160,3082,0,1,3}-{3140,3096,0,1,3}-{3140,3093,0,1,0}-{3138,3094,0,1,1}-{3140,3093,0,1,3}-{3138,3093,0,1,1}-{3138,3094,0,1,0}-{3189,3278,0,1,3}-{3187,3276,0,1,5}-{3188,3278,0,1,4}-{2851,3370,0,1,3}-{2846,3374,0,1,3}-{2853,3372,0,1,3}-{2847,3373,0,1,3}-{2850,3371,0,1,1}-{2851,3373,0,1,4}-{2852,3370,0,1,4}-{3234,3293,0,1,4}-{3229,3298,0,1,1}-{3228,3296,0,1,4}-{2815,3560,0,1,7}-{2819,3561,0,1,4}-{2818,3559,0,1,6}-{3140,3093,0,1,1}-{2674,3652,0,1,3}-{2672,3655,0,1,6}-{2677,3655,0,1,6}" + "loc_data": "{3197,3356,0,1,4}-{3234,3297,0,1,3}-{3230,3296,0,1,5}-{3236,3288,0,1,6}-{3236,3300,0,1,2}-{3231,3308,0,1,3}-{2965,3336,0,1,4}-{3110,9573,0,1,6}-{2655,3441,0,1,6}-{2649,3438,0,1,7}-{2649,3446,0,1,6}-{2653,3444,0,1,6}-{2647,3441,0,1,1}-{2784,3062,0,1,4}-{2789,3063,0,1,4}-{3160,3082,0,1,3}-{3140,3096,0,1,3}-{3140,3093,0,1,0}-{3138,3094,0,1,1}-{3140,3093,0,1,3}-{3138,3093,0,1,1}-{3138,3094,0,1,0}-{3189,3278,0,1,3}-{3187,3276,0,1,5}-{3188,3278,0,1,4}-{2851,3370,0,1,3}-{2846,3374,0,1,3}-{2853,3372,0,1,3}-{2847,3373,0,1,3}-{2850,3371,0,1,1}-{2851,3373,0,1,4}-{2852,3370,0,1,4}-{3234,3293,0,1,4}-{3229,3298,0,1,1}-{3228,3296,0,1,4}-{2815,3560,0,1,7}-{2819,3561,0,1,4}-{2818,3559,0,1,6}-{3140,3093,0,1,1}-{2674,3652,0,1,3}-{2672,3655,0,1,6}-{2677,3655,0,1,6}-{2694,3274,0,1,6}-{2695,3275,0,1,3}" }, { "npc_id": "42", @@ -157,7 +157,7 @@ }, { "npc_id": "49", - "loc_data": "{2861,9838,0,1,3}-{2858,9842,0,1,4}-{2854,9847,0,1,5}-{2857,9850,0,1,7}-{2865,9849,0,1,6}-{2869,9838,0,1,6}-{3104,3680,0,1,3}-{3114,3688,0,1,1}-{3121,3675,0,1,1}-{3127,3695,0,1,3}-{3129,3678,0,1,2}-{3130,3689,0,1,2}-{3128,3665,0,1,3}-{3135,3701,0,1,6}-{3085,10134,0,1,0}-{3090,10123,0,1,0}-{3094,10133,0,1,0}-{3095,10120,0,1,0}-{3095,10128,0,1,0}-{3098,10122,0,1,0}-{3104,10127,0,1,0}-{3105,10125,0,1,0}-{3177,3905,0,1,4}-{3180,3908,0,1,2}-{3189,3914,0,1,6}-{3193,3906,0,1,2}-{2402,9785,0,1,1}-{2403,9782,0,1,1}-{2408,9782,0,1,1}-{2408,9785,0,1,1}-{2413,9776,0,1,1}-{2417,9777,0,1,1}-{2412,9773,0,1,1}-{2416,9773,0,1,1}" + "loc_data": "{2861,9838,0,1,3}-{2858,9842,0,1,4}-{2854,9847,0,1,5}-{2857,9850,0,1,7}-{2865,9849,0,1,6}-{2869,9838,0,1,6}-{3104,3680,0,1,3}-{3114,3688,0,1,1}-{3121,3675,0,1,1}-{3127,3695,0,1,3}-{3129,3678,0,1,2}-{3130,3689,0,1,2}-{3128,3665,0,1,3}-{3135,3701,0,1,6}-{3085,10134,0,1,0}-{3090,10123,0,1,0}-{3094,10133,0,1,0}-{3095,10120,0,1,0}-{3095,10128,0,1,0}-{3098,10122,0,1,0}-{3104,10127,0,1,0}-{3105,10125,0,1,0}-{3177,3905,0,1,4}-{3180,3908,0,1,2}-{3189,3914,0,1,6}-{3193,3906,0,1,2}-{2402,9785,0,1,1}-{2403,9782,0,1,1}-{2408,9782,0,1,1}-{2408,9785,0,1,1}-{2413,9776,0,1,1}-{2417,9777,0,1,1}-{2412,9773,0,1,1}-{2416,9773,0,1,1}-{2735,9692,0,1,1}-{2732,9687,0,1,1}-{2733,9688,0,1,1}-{2734,9690,0,1,1}-{2733,9686,0,1,1}-{2732,9692,0,1,1}-{2736,9685,0,1,1}-{2730,9691,0,1,1}" }, { "npc_id": "50", @@ -373,7 +373,7 @@ }, { "npc_id": "115", - "loc_data": "{2572,3028,0,1,2}-{2550,3046,0,1,4}-{2572,3034,0,1,3}-{2576,3026,0,1,4}-{2534,2975,0,1,1}-{2518,2974,0,1,1}-{2573,2987,0,1,1}-{2592,2967,0,1,3}-{2589,2961,0,0,2}-{2575,2989,0,1,0}-{2574,2992,0,1,4}-{2521,2974,0,1,4}-{2500,3092,0,1,6}-{2524,3375,0,1,3}-{2524,3374,0,1,3}-{2529,3374,0,1,3}-{2532,3375,0,1,1}-{2532,3373,0,1,1}-{2527,3376,0,1,6}-{2525,3373,0,1,7}-{2525,3373,0,1,5}-{2511,3086,0,1,1}-{2511,3084,0,1,3}-{2503,3114,0,1,6}-{2509,3120,0,1,4}-{2506,3107,0,1,4}-{2500,3112,0,1,4}-{2521,3045,0,1,6}-{2517,3043,0,1,5}-{2500,3095,0,1,3}-{2497,3090,0,1,4}-{2502,3099,0,1,4}-{2504,3097,0,1,4}-{2503,3134,0,1,3}-{2554,3196,0,1,7}-{2519,3039,0,1,4}" + "loc_data": "{2572,3028,0,1,2}-{2550,3046,0,1,4}-{2572,3034,0,1,3}-{2576,3026,0,1,4}-{2534,2975,0,1,1}-{2518,2974,0,1,1}-{2573,2987,0,1,1}-{2592,2967,0,1,3}-{2589,2961,0,0,2}-{2575,2989,0,1,0}-{2574,2992,0,1,4}-{2521,2974,0,1,4}-{2500,3092,0,1,6}-{2524,3375,0,1,3}-{2524,3374,0,1,3}-{2529,3374,0,1,3}-{2532,3375,0,1,1}-{2532,3373,0,1,1}-{2527,3376,0,1,6}-{2525,3373,0,1,7}-{2525,3373,0,1,5}-{2511,3086,0,1,1}-{2511,3084,0,1,3}-{2503,3114,0,1,6}-{2509,3120,0,1,4}-{2506,3107,0,1,4}-{2500,3112,0,1,4}-{2521,3045,0,1,6}-{2517,3043,0,1,5}-{2500,3095,0,1,3}-{2497,3090,0,1,4}-{2502,3099,0,1,4}-{2504,3097,0,1,4}-{2503,3134,0,1,3}-{2554,3196,0,1,7}-{2519,3039,0,1,4}-{2722,9701,0,1,1}-{2720,9715,0,1,1}-{2721,9669,0,1,1}-{2722,9707,0,1,1}-{2723,9716,0,1,1}-{2717,9669,0,1,1}" }, { "npc_id": "116", @@ -2389,7 +2389,7 @@ }, { "npc_id": "1017", - "loc_data": "{3198,3359,0,1,0}-{3231,3296,0,1,6}-{3233,3300,0,1,4}-{3235,3293,0,1,3}-{3232,3288,0,1,0}-{3234,3298,0,1,6}-{2785,3069,0,1,4}-{2800,3072,0,1,6}-{3234,3297,0,1,3}-{3234,3292,0,1,4}-{3235,3289,0,1,1}-{2677,3656,0,1,2}-{2672,3654,0,1,2}-{2676,3652,0,1,4}-{2681,3652,0,1,4}-{2675,3652,0,1,3}" + "loc_data": "{3198,3359,0,1,0}-{3231,3296,0,1,6}-{3233,3300,0,1,4}-{3235,3293,0,1,3}-{3232,3288,0,1,0}-{3234,3298,0,1,6}-{2785,3069,0,1,4}-{2800,3072,0,1,6}-{3234,3297,0,1,3}-{3234,3292,0,1,4}-{3235,3289,0,1,1}-{2677,3656,0,1,2}-{2672,3654,0,1,2}-{2676,3652,0,1,4}-{2681,3652,0,1,4}-{2675,3652,0,1,3}-{2693,3271,0,1,3}-{2692,3272,0,1,3}" }, { "npc_id": "1019", @@ -4897,19 +4897,19 @@ }, { "npc_id": "2685", - "loc_data": "{3124,9873,0,1,3}-{2911,3285,0,1,1}" + "loc_data": "{3124,9873,0,1,3}-{2911,3285,0,1,1}-{2696,9689,0,1,1}" }, { "npc_id": "2686", - "loc_data": "{2907,3293,0,1,4}" + "loc_data": "{2907,3293,0,1,4}-{2700,9696,0,1,1}" }, { "npc_id": "2687", - "loc_data": "{2907,3293,0,1,6}-{2908,3290,0,1,3}" + "loc_data": "{2907,3293,0,1,6}-{2908,3290,0,1,3}-{2703,9698,0,1,1}" }, { "npc_id": "2688", - "loc_data": "{3127,9874,0,1,4}-{2906,3288,0,1,1}-{2910,3293,0,1,4}" + "loc_data": "{3127,9874,0,1,4}-{2906,3288,0,1,1}-{2910,3293,0,1,4}-{2699,9690,0,1,1}" }, { "npc_id": "2689", @@ -9719,6 +9719,10 @@ "npc_id": "7162", "loc_data": "{3144,4229,2,1,1}-{3143,4236,2,1,1}-{3145,4235,2,1,1}-{3148,4244,2,1,6}" }, + { + "npc_id": "7168", + "loc_data": "{2714,3309,0,1,1}" + }, { "npc_id": "7228", "loc_data": "{2862,3101,0,0,0}-{2879,3109,0,0,0}-{2882,3104,0,0,0}-{2874,3098,0,0,0}-{2882,3098,0,0,0}" @@ -10599,6 +10603,46 @@ "npc_id": "2356", "loc_data": "{2323,3163,0,1,0}" }, + { + "npc_id": "4874", + "loc_data": "{2709,3291,0,0,0}" + }, + { + "npc_id": "4856", + "loc_data": "{2732,3292,0,1,1}" + }, + { + "npc_id": "4872", + "loc_data": "{2740,3310,0,0,0}" + }, + { + "npc_id": "4878", + "loc_data": "{2726,3283,0,1,1}" + }, + { + "npc_id": "4883", + "loc_data": "{2713,3278,0,1,1}" + }, + { + "npc_id": "4885", + "loc_data": "{2705,3287,0,1,1}-{2716,3287,0,1,1}-{2732,3282,0,1,1}" + }, + { + "npc_id": "4887", + "loc_data": "{2738,3303,0,1,1}-{2723,3274,0,1,1}" + }, + { + "npc_id": "4895", + "loc_data": "{2718,3302,0,1,1}" + }, + { + "npc_id": "696", + "loc_data": "{2716,3303,0,1,1}" + }, + { + "npc_id": "698", + "loc_data": "{2716,3303,0,1,1}" + }, { "npc_id": "2352", "loc_data": "{2334,3183,0,1,0}" diff --git a/Server/data/configs/shops.json b/Server/data/configs/shops.json index 1db143528..7c00ee1f6 100644 --- a/Server/data/configs/shops.json +++ b/Server/data/configs/shops.json @@ -2086,5 +2086,14 @@ "id": "235", "title": "Gnomic Supplies", "stock": "{1931,inf}-{1929,inf}-{1937,inf}-{2313,inf}-{1887,inf}-{590,inf}-{1735,inf}-{1951,inf}-{1969,inf}-{1949,inf}" - } + }, + { + "npcs": "4856", + "high_alch": "1", + "currency": "995", + "general_store": "false", + "id": "236", + "title": "Lovecraft's Tackle", + "stock": "{303,10}-{307,10}-{309,10}-{311,1000}-{301,10}-{313,1000}-{314,1000}-{317,0}-{327,10}-{345,0}-{321,0}-{335,0}-{349,0}-{331,0}-{359,0}-{377,0}-{371,0}" + } ] \ No newline at end of file From 70f7ba96c28916155eb875af897f4c149952b8c2 Mon Sep 17 00:00:00 2001 From: phil lips Date: Sun, 27 Jun 2021 15:21:47 +0000 Subject: [PATCH 03/10] Player script fixes, and bankAll scriptAPI function added --- .../kotlin/rs09/game/ai/general/ScriptAPI.kt | 20 +++++++++++++++++++ .../ai/general/scriptrepository/CoalMiner.kt | 20 +++++++++++-------- .../scriptrepository/DraynorWillows.kt | 3 ++- .../scriptrepository/LobsterCatcher.kt | 9 +++++---- .../scriptrepository/SeersMagicTrees.kt | 4 +++- .../general/scriptrepository/SharkCatcher.kt | 1 + .../scriptrepository/VarrockEssenceMiner.kt | 1 + 7 files changed, 44 insertions(+), 14 deletions(-) diff --git a/Server/src/main/kotlin/rs09/game/ai/general/ScriptAPI.kt b/Server/src/main/kotlin/rs09/game/ai/general/ScriptAPI.kt index 567aca3b3..18226073b 100644 --- a/Server/src/main/kotlin/rs09/game/ai/general/ScriptAPI.kt +++ b/Server/src/main/kotlin/rs09/game/ai/general/ScriptAPI.kt @@ -550,6 +550,26 @@ class ScriptAPI(private val bot: Player) { bot.pulseManager.run(BankingPulse()) } + /** + * Takes every item out of the bots inventory and places it into the bank. + * @param none + * @author cfunnyman joe + */ + fun bankAll(){ + class BankingPulse() : Pulse(20){ + override fun pulse(): Boolean { + for(item in bot.inventory.toArray()){ + var itemAmount = bot.inventory.getAmount(item) + + bot.inventory.remove(item) + bot.bank.add(item) + } + return true + } + } + bot.pulseManager.run(BankingPulse()) + } + /** * Function that makes the bot eat the food item in their inventory if their HP is below 2/3. * @author Ceikry diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/CoalMiner.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/CoalMiner.kt index 9fc4b307b..1d3a533ed 100644 --- a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/CoalMiner.kt +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/CoalMiner.kt @@ -1,5 +1,6 @@ package rs09.game.ai.general.scriptrepository + import core.game.interaction.DestinationFlag import core.game.interaction.MovementPulse import core.game.node.Node @@ -11,21 +12,24 @@ import rs09.game.ai.general.ScriptAPI import rs09.game.ai.skillingbot.SkillingBotAssembler import rs09.game.interaction.InteractionListener import rs09.game.interaction.InteractionListeners +import api.ContentAPI +import kotlinx.coroutines.delay +import kotlinx.coroutines.runBlocking +import java.util.logging.Handler @PlayerCompatible @ScriptName("Falador Coal Miner") @ScriptDescription("Start in Falador East Bank with a pick equipped","or in your inventory.") @ScriptIdentifier("fally_coal") -class CoalMiner() : Script() { +class CoalMiner : Script() { var state = State.INIT var ladderSwitch = false - val bottomLadder = ZoneBorders(3016,9736,3024,9742) val topLadder = ZoneBorders(3016,3336,3022,3342) val mine = ZoneBorders(3027,9733,3054,9743) val bank = ZoneBorders(3009,3355,3018,3358) var overlay: ScriptAPI.BottingOverlay? = null - var coalAmount = 0 + var coalAmount = 0 override fun tick() { when(state){ @@ -47,6 +51,7 @@ class CoalMiner() : Script() { } State.MINING -> { + bot.interfaceManager.close() if(bot.inventory.freeSlots() == 0){ state = State.TO_BANK } @@ -56,7 +61,7 @@ class CoalMiner() : Script() { val rock = scriptAPI.getNearestNode("rocks",true) rock?.let { InteractionListeners.run(rock.id, InteractionListener.OBJECT,"mine",bot,rock) } } - overlay!!.setAmount(bot.inventory.getAmount(Items.COAL_453) + coalAmount) + overlay!!.setAmount(ContentAPI.amountInInventory(bot, Items.COAL_453) + coalAmount) } State.TO_BANK -> { @@ -83,13 +88,14 @@ class CoalMiner() : Script() { } State.BANKING -> { - coalAmount += bot.inventory.getAmount(Items.COAL_453) - scriptAPI.bankItem(Items.COAL_453) + coalAmount += bot.inventory.getAmount(Items.COAL_453) + scriptAPI.bankAll() state = State.TO_MINE } State.TO_MINE -> { if(ladderSwitch){ + bot.interfaceManager.close() if(!topLadder.insideBorder(bot.location)){ scriptAPI.walkTo(topLadder.randomLoc) } else { @@ -124,7 +130,6 @@ class CoalMiner() : Script() { scriptAPI.teleport(bank.randomLoc) state = State.TO_MINE } - } } @@ -156,5 +161,4 @@ class CoalMiner() : Script() { equipment.add(Item(Items.IRON_PICKAXE_1267)) skills.put(Skills.MINING,75) } - } \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/DraynorWillows.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/DraynorWillows.kt index b9195bb2e..c7051f8e3 100644 --- a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/DraynorWillows.kt +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/DraynorWillows.kt @@ -41,8 +41,9 @@ class DraynorWillows : Script(){ scriptAPI.walkTo(willowZone.randomLoc) else { val willowtree = scriptAPI.getNearestNode("willow", true) + bot.interfaceManager.close() willowtree?.let { InteractionListeners.run(willowtree.id, - InteractionListener.OBJECT,"chop",bot,willowtree) } + InteractionListener.OBJECT,"Chop down",bot,willowtree) } if (bot.inventory.isFull) state = State.BANKING } diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/LobsterCatcher.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/LobsterCatcher.kt index 6863f20dd..d8364100c 100644 --- a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/LobsterCatcher.kt +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/LobsterCatcher.kt @@ -69,6 +69,7 @@ class LobsterCatcher : Script() { State.FISHING -> { + bot.interfaceManager.close() val spot = scriptAPI.getNearestNode(333, false) if(spot == null){ state = State.IDLE @@ -163,10 +164,10 @@ class LobsterCatcher : Script() { init { - val setUp = RandomFunction.random(Sets.values().size) - equipment.addAll(Sets.values()[setUp].equipment) - inventory.add(Item(301)) - skills[Skills.FISHING] = 40 + val setUp = RandomFunction.random(Sets.values().size) + equipment.addAll(Sets.values()[setUp].equipment) + inventory.add(Item(301)) + skills[Skills.FISHING] = 40 } enum class State{ diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/SeersMagicTrees.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/SeersMagicTrees.kt index 48b7b45c3..313ad1561 100644 --- a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/SeersMagicTrees.kt +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/SeersMagicTrees.kt @@ -39,7 +39,8 @@ class SeersMagicTrees : Script(){ State.CHOPPING -> { val tree = scriptAPI.getNearestNode(1306,true) - tree?.let { InteractionListeners.run(tree.id, InteractionListener.OBJECT,"chop",bot,tree) } + bot.interfaceManager.close() + tree?.let { InteractionListeners.run(tree.id, InteractionListener.OBJECT,"Chop down",bot,tree) } if(bot.inventory.isFull){ state = State.FIND_BANK } @@ -69,6 +70,7 @@ class SeersMagicTrees : Script(){ } State.RETURN_TO_TREES -> { + bot.interfaceManager.close() if(!magicsZone.insideBorder(bot)){ scriptAPI.walkTo(magicsZone.randomLoc) } else { diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/SharkCatcher.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/SharkCatcher.kt index 2d78e48a0..f1a909d53 100644 --- a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/SharkCatcher.kt +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/SharkCatcher.kt @@ -114,6 +114,7 @@ class SharkCatcher : Script() { } State.FISHING -> { + bot.interfaceManager.close() if (Random.nextBoolean()) { tick = 0 val spot = scriptAPI.getNearestNode(334, false) diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/VarrockEssenceMiner.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/VarrockEssenceMiner.kt index d429713c4..5054b98e0 100644 --- a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/VarrockEssenceMiner.kt +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/VarrockEssenceMiner.kt @@ -22,6 +22,7 @@ class VarrockEssenceMiner : Script(){ when(state){ State.TO_ESSENCE -> { + bot.interfaceManager.close() if(!auburyZone.insideBorder(bot)) scriptAPI.walkTo(auburyZone.randomLoc) else { From 0dcddf2f65a80cb3cc552756f48f9b406da292d6 Mon Sep 17 00:00:00 2001 From: Von Hresvelg Date: Sun, 27 Jun 2021 11:49:05 -0400 Subject: [PATCH 04/10] Update TzHaar-Ket DT (Revision) --- Server/data/configs/drop_tables.json | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Server/data/configs/drop_tables.json b/Server/data/configs/drop_tables.json index cbfc65315..21432fcef 100644 --- a/Server/data/configs/drop_tables.json +++ b/Server/data/configs/drop_tables.json @@ -33874,28 +33874,22 @@ "main": [ { "minAmount": "1", - "weight": "0.685", + "weight": "0.675", "id": "6528", "maxAmount": "1" }, { "minAmount": "1", - "weight": "0.685", + "weight": "0.675", "id": "6524", "maxAmount": "1" }, { "minAmount": "1", - "weight": "0.685", + "weight": "0.675", "id": "6568", "maxAmount": "1" }, - { - "minAmount": "1", - "weight": "5.0", - "id": "1393", - "maxAmount": "1" - }, { "minAmount": "12", "weight": "5.0", From 90aa55bb8978f5a5c8a3fa5b4b644b739e64c53e Mon Sep 17 00:00:00 2001 From: Von Hresvelg Date: Sun, 27 Jun 2021 21:02:07 +0000 Subject: [PATCH 05/10] Updated Tormented Demon DT (Authentic) --- Server/data/configs/drop_tables.json | 438 ++++++++++++++------------- 1 file changed, 228 insertions(+), 210 deletions(-) diff --git a/Server/data/configs/drop_tables.json b/Server/data/configs/drop_tables.json index 21432fcef..7f5fb5166 100644 --- a/Server/data/configs/drop_tables.json +++ b/Server/data/configs/drop_tables.json @@ -10178,26 +10178,14 @@ }, { "minAmount": "1", - "weight": "40.0", - "id": "2677", - "maxAmount": "1" - }, - { - "minAmount": "5", "weight": "50.0", - "id": "386", - "maxAmount": "15" - }, - { - "minAmount": "1", - "weight": "50.0", - "id": "1373", + "id": "1289", "maxAmount": "1" }, { "minAmount": "1", "weight": "50.0", - "id": "1201", + "id": "1303", "maxAmount": "1" }, { @@ -10209,7 +10197,13 @@ { "minAmount": "1", "weight": "50.0", - "id": "1289", + "id": "1113", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "50.0", + "id": "1147", "maxAmount": "1" }, { @@ -10219,112 +10213,10 @@ "maxAmount": "1" }, { - "minAmount": "1", + "minAmount": "20", "weight": "50.0", - "id": "5298", - "maxAmount": "2" - }, - { - "minAmount": "1", - "weight": "50.0", - "id": "5281", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "50.0", - "id": "5294", - "maxAmount": "2" - }, - { - "minAmount": "1", - "weight": "50.0", - "id": "5104", - "maxAmount": "3" - }, - { - "minAmount": "1", - "weight": "50.0", - "id": "5292", - "maxAmount": "2" - }, - { - "minAmount": "3", - "weight": "50.0", - "id": "5311", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "50.0", - "id": "5299", - "maxAmount": "2" - }, - { - "minAmount": "1", - "weight": "50.0", - "id": "200", - "maxAmount": "11" - }, - { - "minAmount": "1", - "weight": "50.0", - "id": "202", - "maxAmount": "11" - }, - { - "minAmount": "1", - "weight": "50.0", - "id": "204", - "maxAmount": "11" - }, - { - "minAmount": "1", - "weight": "50.0", - "id": "206", - "maxAmount": "11" - }, - { - "minAmount": "1", - "weight": "50.0", - "id": "210", - "maxAmount": "11" - }, - { - "minAmount": "1", - "weight": "50.0", - "id": "212", - "maxAmount": "11" - }, - { - "minAmount": "1", - "weight": "50.0", - "id": "214", - "maxAmount": "11" - }, - { - "minAmount": "1", - "weight": "50.0", - "id": "216", - "maxAmount": "11" - }, - { - "minAmount": "1", - "weight": "50.0", - "id": "2486", - "maxAmount": "11" - }, - { - "minAmount": "3", - "weight": "50.0", - "id": "1602", - "maxAmount": "5" - }, - { - "minAmount": "3", - "weight": "50.0", - "id": "2362", - "maxAmount": "7" + "id": "4699", + "maxAmount": "40" }, { "minAmount": "20", @@ -10333,146 +10225,272 @@ "maxAmount": "40" }, { - "minAmount": "20", + "minAmount": "10", "weight": "50.0", + "id": "565", + "maxAmount": "20" + }, + { + "minAmount": "20", + "weight": "25.0", "id": "563", - "maxAmount": "45" + "maxAmount": "40" + }, + { + "minAmount": "8", + "weight": "25.0", + "id": "200", + "maxAmount": "10" + }, + { + "minAmount": "8", + "weight": "25.0", + "id": "202", + "maxAmount": "10" + }, + { + "minAmount": "8", + "weight": "25.0", + "id": "204", + "maxAmount": "10" + }, + { + "minAmount": "8", + "weight": "25.0", + "id": "206", + "maxAmount": "10" + }, + { + "minAmount": "8", + "weight": "25.0", + "id": "208", + "maxAmount": "10" + }, + { + "minAmount": "8", + "weight": "25.0", + "id": "210", + "maxAmount": "10" + }, + { + "minAmount": "8", + "weight": "25.0", + "id": "212", + "maxAmount": "10" + }, + { + "minAmount": "8", + "weight": "25.0", + "id": "214", + "maxAmount": "10" + }, + { + "minAmount": "8", + "weight": "25.0", + "id": "216", + "maxAmount": "10" + }, + { + "minAmount": "8", + "weight": "25.0", + "id": "2486", + "maxAmount": "10" }, { "minAmount": "4", - "weight": "50.0", - "id": "1443", - "maxAmount": "4" - }, - { - "minAmount": "3000", - "weight": "75.0", - "id": "995", - "maxAmount": "15000" - }, - { - "minAmount": "1", - "weight": "25.0", - "id": "5302", - "maxAmount": "2" - }, - { - "minAmount": "1", - "weight": "10.0", - "id": "1149", - "maxAmount": "2" - }, - { - "minAmount": "1", - "weight": "25.0", - "id": "5303", - "maxAmount": "2" - }, - { - "minAmount": "1", - "weight": "25.0", - "id": "5105", - "maxAmount": "3" - }, - { - "minAmount": "1", - "weight": "25.0", - "id": "5296", - "maxAmount": "2" - }, - { - "minAmount": "1", "weight": "25.0", "id": "5323", - "maxAmount": "4" + "maxAmount": "10" }, { - "minAmount": "1", + "minAmount": "4", "weight": "25.0", - "id": "12176", - "maxAmount": "2" + "id": "5321", + "maxAmount": "10" }, { - "minAmount": "1", + "minAmount": "4", + "weight": "25.0", + "id": "5292", + "maxAmount": "10" + }, + { + "minAmount": "4", + "weight": "25.0", + "id": "5294", + "maxAmount": "10" + }, + { + "minAmount": "4", "weight": "25.0", "id": "5295", - "maxAmount": "3" + "maxAmount": "10" }, { - "minAmount": "1", + "minAmount": "4", + "weight": "25.0", + "id": "12176", + "maxAmount": "10" + }, + { + "minAmount": "4", + "weight": "25.0", + "id": "5296", + "maxAmount": "10" + }, + { + "minAmount": "4", + "weight": "25.0", + "id": "5298", + "maxAmount": "10" + }, + { + "minAmount": "4", + "weight": "25.0", + "id": "5299", + "maxAmount": "10" + }, + { + "minAmount": "4", + "weight": "25.0", + "id": "5300", + "maxAmount": "10" + }, + { + "minAmount": "4", + "weight": "25.0", + "id": "5301", + "maxAmount": "10" + }, + { + "minAmount": "4", + "weight": "25.0", + "id": "5302", + "maxAmount": "10" + }, + { + "minAmount": "4", + "weight": "25.0", + "id": "5304", + "maxAmount": "10" + }, + { + "minAmount": "4", "weight": "25.0", "id": "5100", - "maxAmount": "2" + "maxAmount": "10" + }, + { + "minAmount": "4", + "weight": "25.0", + "id": "5104", + "maxAmount": "10" + }, + { + "minAmount": "4", + "weight": "25.0", + "id": "5105", + "maxAmount": "10" + }, + { + "minAmount": "4", + "weight": "25.0", + "id": "5311", + "maxAmount": "10" }, { "minAmount": "4", "weight": "25.0", "id": "5280", - "maxAmount": "1" + "maxAmount": "10" + }, + { + "minAmount": "4", + "weight": "25.0", + "id": "5281", + "maxAmount": "10" + }, + { + "minAmount": "4", + "weight": "25.0", + "id": "5282", + "maxAmount": "10" + }, + { + "minAmount": "5", + "weight": "50.0", + "id": "385", + "maxAmount": "15" }, { "minAmount": "1", "weight": "25.0", - "id": "1163", - "maxAmount": "1" + "id": "163", + "maxAmount": "6" }, { "minAmount": "1", "weight": "25.0", - "id": "1113", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "25.0", - "id": "208", - "maxAmount": "11" - }, - { - "minAmount": "1", - "weight": "25.0", - "id": "5301", + "id": "139", "maxAmount": "3" }, { - "minAmount": "1", - "weight": "25.0", - "id": "218", - "maxAmount": "11" + "minAmount": "3", + "weight": "50.0", + "id": "2362", + "maxAmount": "5" }, { - "minAmount": "10", + "minAmount": "3", + "weight": "50.0", + "id": "1602", + "maxAmount": "5" + }, + { + "minAmount": "2", "weight": "25.0", - "id": "565", - "maxAmount": "20" + "id": "1443", + "maxAmount": "5" + }, + { + "minAmount": "3000", + "weight": "100.0", + "id": "995", + "maxAmount": "13000" }, { "minAmount": "1", - "weight": "1.0", + "weight": "3.42", "id": "14484", "maxAmount": "1" }, { "minAmount": "1", - "weight": "1.0", - "id": "14474", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "1.0", - "id": "14476", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "1.0", + "weight": "1.71", "id": "14472", "maxAmount": "1" }, { "minAmount": "1", - "weight": "5.0", + "weight": "1.71", + "id": "14474", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "1.71", + "id": "14476", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "50.0", + "id": "2677", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "50.0", "id": "31", "maxAmount": "1" } From 2f029c1eaa0b642dc24ab1f81ec186bf80625d9e Mon Sep 17 00:00:00 2001 From: ceikry Date: Sun, 27 Jun 2021 16:30:26 -0500 Subject: [PATCH 06/10] Added option for 1x xp rate --- .../java/core/game/content/dialogue/HansDialoguePlugin.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Server/src/main/java/core/game/content/dialogue/HansDialoguePlugin.java b/Server/src/main/java/core/game/content/dialogue/HansDialoguePlugin.java index 0f65246e6..2639d98a0 100644 --- a/Server/src/main/java/core/game/content/dialogue/HansDialoguePlugin.java +++ b/Server/src/main/java/core/game/content/dialogue/HansDialoguePlugin.java @@ -137,7 +137,7 @@ public final class HansDialoguePlugin extends DialoguePlugin { case 12: switch(buttonId){ case 1: - options("2.5x","5x","10x","20x"); + options("1.0x","2.5x","10x","20x"); stage++; break; case 2: @@ -150,7 +150,7 @@ public final class HansDialoguePlugin extends DialoguePlugin { switch(buttonId){ case 1: if(player.newPlayer) { - player.getSkills().experienceMutiplier = 2.5; + player.getSkills().experienceMutiplier = 1.0; stage = 14; } else { stage = 15; @@ -159,7 +159,7 @@ public final class HansDialoguePlugin extends DialoguePlugin { break; case 2: if(player.newPlayer){ - player.getSkills().experienceMutiplier = 5.0; + player.getSkills().experienceMutiplier = 2.5; stage = 14; } else { stage = 15; From 0a1918d9e4fb24a725d9eba6e14ac574c600397a Mon Sep 17 00:00:00 2001 From: Ceikry Date: Sun, 27 Jun 2021 21:50:07 +0000 Subject: [PATCH 07/10] Added NPC who sells fighter torso for 7.5M - Captain Cain --- .gitlab-ci.yml | 35 ++++++++++ .../game/content/dialogue/DialoguePlugin.java | 18 +++++ Server/src/main/kotlin/api/DialUtils.kt | 1 + .../content/dialogue/CaptainCainDialogue.kt | 67 +++++++++++++++++++ 4 files changed, 121 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 Server/src/main/kotlin/rs09/game/content/dialogue/CaptainCainDialogue.kt diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..64251f0b3 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,35 @@ +# This file is a template, and might need editing before it works on your project. +# This is the Gradle build system for JVM applications +# https://gradle.org/ +# https://github.com/gradle/gradle +image: gradle:alpine + +# Disable the Gradle daemon for Continuous Integration servers as correctness +# is usually a priority over speed in CI environments. Using a fresh +# runtime for each build is more reliable since the runtime is completely +# isolated from any previous builds. +variables: + GRADLE_OPTS: "-Dorg.gradle.daemon=false" + +before_script: + - export GRADLE_USER_HOME=`pwd`/.gradle + +build: + stage: build + script: gradle --build-cache assemble + cache: + key: "$CI_COMMIT_REF_NAME" + policy: push + paths: + - build + - .gradle + +test: + stage: test + script: gradle check + cache: + key: "$CI_COMMIT_REF_NAME" + policy: pull + paths: + - build + - .gradle diff --git a/Server/src/main/java/core/game/content/dialogue/DialoguePlugin.java b/Server/src/main/java/core/game/content/dialogue/DialoguePlugin.java index 119bf38b9..962164acf 100644 --- a/Server/src/main/java/core/game/content/dialogue/DialoguePlugin.java +++ b/Server/src/main/java/core/game/content/dialogue/DialoguePlugin.java @@ -311,4 +311,22 @@ public abstract class DialoguePlugin implements Plugin { } } + /** + * Use the automatic linesplitting feature in DialUtils to produce npc dialogues + * @param expr the FacialExpression to use, located in the FacialExpression enum. + * @param msg the message for the NPC to say + */ + public Component npcl(FacialExpression expr, String msg){ + return npc(expr, api.DialUtils.splitLines(msg)); + } + + /** + * Use the automatic linesplitting feature in DialUtils to produce player dialogues + * @param expr the FacialExpression to use, located in the FacialExpression enum. + * @param msg the message for the player to say + */ + public Component playerl(FacialExpression expr, String msg){ + return player(expr, api.DialUtils.splitLines(msg)); + } + } \ No newline at end of file diff --git a/Server/src/main/kotlin/api/DialUtils.kt b/Server/src/main/kotlin/api/DialUtils.kt index 37f89c69e..a0db709e3 100644 --- a/Server/src/main/kotlin/api/DialUtils.kt +++ b/Server/src/main/kotlin/api/DialUtils.kt @@ -1,3 +1,4 @@ +package api import rs09.game.system.SystemLogger import java.util.* import kotlin.system.exitProcess diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/CaptainCainDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/CaptainCainDialogue.kt new file mode 100644 index 000000000..f5de9b1fd --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/CaptainCainDialogue.kt @@ -0,0 +1,67 @@ +package rs09.game.content.dialogue + +import api.ContentAPI +import core.game.content.dialogue.DialoguePlugin +import core.game.content.dialogue.FacialExpression +import core.game.node.entity.player.Player +import core.game.node.item.Item +import core.plugin.Initializable +import org.rs09.consts.Items +import org.rs09.consts.NPCs +import rs09.tools.END_DIALOGUE +import java.text.SimpleDateFormat +import java.time.temporal.ChronoUnit +import java.util.* + +@Initializable +class CaptainCainDialogue(player: Player? = null) : DialoguePlugin(player) { + val sdf = SimpleDateFormat("ddMMyyyy") + override fun newInstance(player: Player?): DialoguePlugin { + return CaptainCainDialogue(player) + } + + override fun open(vararg args: Any?): Boolean { + npcl(FacialExpression.FRIENDLY, "Hello, there, adventurer. Say, you wouldn't happen to be interested in purchasing a Fighter Torso would you?") + stage = 0 + return true + } + + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + val start = sdf.parse("27112020").toInstant() + val now = Date().toInstant() + val days = ChronoUnit.DAYS.between(start,now) + when(stage){ + 0 -> npcl(FacialExpression.ANNOYED,"I'm having to offer this service because it's been $days days since Ryan promised to give us barbarian assault.").also { stage++ } + 1 -> options("Yes, please.","No, thanks.").also { stage++ } + 2 -> when(buttonId){ + 1 -> playerl(FacialExpression.FRIENDLY, "Yes, please.").also { stage = 10 } + 2 -> playerl(FacialExpression.HALF_THINKING, "No, thanks.").also { stage = END_DIALOGUE } + } + + 10 -> npcl(FacialExpression.FRIENDLY, "Alright, then, that'll be 7,500,000 gold please.").also { stage++ } + 11 -> options("Here you go!","Nevermind.").also { stage++ } + 12 -> when(buttonId){ + 1 -> if(ContentAPI.inInventory(player, 995, 7500000)) + playerl(FacialExpression.FRIENDLY, "Here you go!").also { stage = 20 } + else + playerl(FacialExpression.HALF_GUILTY, "Actually, I don't have that much.").also { stage = END_DIALOGUE } + + 2 -> playerl(FacialExpression.FRIENDLY, "On second thought, nevermind.").also { stage = END_DIALOGUE } + } + + 20 -> { + npcl(FacialExpression.FRIENDLY, "Thank you much, kind sir. And here's your torso.") + if(ContentAPI.removeItem(player, Item(995,7500000), api.Container.INVENTORY)) { + ContentAPI.addItem(player, Items.FIGHTER_TORSO_10551, 1) + } + stage = END_DIALOGUE + } + } + return true + } + + override fun getIds(): IntArray { + return intArrayOf(NPCs.CAPTAIN_CAIN_5030) + } + +} \ No newline at end of file From 0e7f43fc8ee6c555ba2056056d3c6124e8822987 Mon Sep 17 00:00:00 2001 From: Von Hresvelg Date: Sun, 27 Jun 2021 21:50:28 +0000 Subject: [PATCH 08/10] Revised Abyssal Demon DT (Authentic) --- Server/data/configs/drop_tables.json | 38 ++++++++++++---------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/Server/data/configs/drop_tables.json b/Server/data/configs/drop_tables.json index 7f5fb5166..dc0d9663b 100644 --- a/Server/data/configs/drop_tables.json +++ b/Server/data/configs/drop_tables.json @@ -26376,6 +26376,12 @@ "ids": "1615,4230", "description": "", "main": [ + { + "minAmount": "1", + "weight": "50.0", + "id": "1365", + "maxAmount": "1" + }, { "minAmount": "1", "weight": "50.0", @@ -26388,18 +26394,6 @@ "id": "1361", "maxAmount": "1" }, - { - "minAmount": "1", - "weight": "50.0", - "id": "1365", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "2.4", - "id": "4151", - "maxAmount": "1" - }, { "minAmount": "1", "weight": "25.0", @@ -26509,8 +26503,8 @@ "maxAmount": "3" }, { - "minAmount": "9", - "weight": "50.0", + "minAmount": "30", + "weight": "100.0", "id": "995", "maxAmount": "3000" }, @@ -26532,12 +26526,6 @@ "id": "7937", "maxAmount": "60" }, - { - "minAmount": "1", - "weight": "25.0", - "id": "1440", - "maxAmount": "1" - }, { "minAmount": "1", "weight": "25.0", @@ -26558,13 +26546,19 @@ }, { "minAmount": "1", - "weight": "5.0", + "weight": "25.0", "id": "31", "maxAmount": "1" }, { "minAmount": "1", - "weight": "100.0", + "weight": "2.5", + "id": "4151", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "150.0", "id": "0", "maxAmount": "1" } From f239bcbf6aeef5bff8db45cf20ce009833bc25ea Mon Sep 17 00:00:00 2001 From: Ceikry Date: Sun, 27 Jun 2021 21:56:58 +0000 Subject: [PATCH 09/10] Delete .gitlab-ci.yml --- .gitlab-ci.yml | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 64251f0b3..000000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,35 +0,0 @@ -# This file is a template, and might need editing before it works on your project. -# This is the Gradle build system for JVM applications -# https://gradle.org/ -# https://github.com/gradle/gradle -image: gradle:alpine - -# Disable the Gradle daemon for Continuous Integration servers as correctness -# is usually a priority over speed in CI environments. Using a fresh -# runtime for each build is more reliable since the runtime is completely -# isolated from any previous builds. -variables: - GRADLE_OPTS: "-Dorg.gradle.daemon=false" - -before_script: - - export GRADLE_USER_HOME=`pwd`/.gradle - -build: - stage: build - script: gradle --build-cache assemble - cache: - key: "$CI_COMMIT_REF_NAME" - policy: push - paths: - - build - - .gradle - -test: - stage: test - script: gradle check - cache: - key: "$CI_COMMIT_REF_NAME" - policy: pull - paths: - - build - - .gradle From 39d4fb40075cede9e98d866729844f5165ec1fc7 Mon Sep 17 00:00:00 2001 From: Ceikry Date: Sun, 27 Jun 2021 22:02:23 +0000 Subject: [PATCH 10/10] Handle shop --- .../game/interaction/npc/NPCTradePlugin.java | 41 ------------------- .../game/interaction/npc/NPCTradePlugin.kt | 35 ++++++++++++++++ 2 files changed, 35 insertions(+), 41 deletions(-) delete mode 100644 Server/src/main/java/core/game/interaction/npc/NPCTradePlugin.java create mode 100644 Server/src/main/java/core/game/interaction/npc/NPCTradePlugin.kt diff --git a/Server/src/main/java/core/game/interaction/npc/NPCTradePlugin.java b/Server/src/main/java/core/game/interaction/npc/NPCTradePlugin.java deleted file mode 100644 index ab37bc5fa..000000000 --- a/Server/src/main/java/core/game/interaction/npc/NPCTradePlugin.java +++ /dev/null @@ -1,41 +0,0 @@ -package core.game.interaction.npc; - -import core.cache.def.impl.NPCDefinition; -import core.game.component.Component; -import core.game.interaction.OptionHandler; -import core.game.node.Node; -import core.game.node.entity.npc.NPC; -import core.game.node.entity.player.Player; -import core.plugin.Initializable; -import core.plugin.Plugin; -import core.game.node.entity.skill.crafting.TanningProduct; - -/** - * Represents the plugin used for an npc with the trade option. - * @author 'Vexia - * @version 1.0 - */ -@Initializable -public final class NPCTradePlugin extends OptionHandler { - - @Override - public Plugin newInstance(Object arg) throws Throwable { - NPCDefinition.setOptionHandler("trade", this); - return this; - } - - @Override - public boolean handle(Player player, Node node, String option) { - final NPC npc = (NPC) node; - if (npc.getId() == 2824) { - TanningProduct.open(player, 2824); - return true; - } - if(npc.getId() == 7601){ - player.getInterfaceManager().open(new Component(732)); - return true; - } - return node.asNpc().openShop(player); - } - -} diff --git a/Server/src/main/java/core/game/interaction/npc/NPCTradePlugin.kt b/Server/src/main/java/core/game/interaction/npc/NPCTradePlugin.kt new file mode 100644 index 000000000..f2f3bb769 --- /dev/null +++ b/Server/src/main/java/core/game/interaction/npc/NPCTradePlugin.kt @@ -0,0 +1,35 @@ +package core.game.interaction.npc + +import api.ContentAPI +import core.cache.def.impl.NPCDefinition +import core.game.component.Component +import core.plugin.Initializable +import core.game.interaction.OptionHandler +import core.game.node.Node +import core.game.node.entity.npc.NPC +import core.game.node.entity.player.Player +import core.plugin.Plugin +import core.game.node.entity.skill.crafting.TanningProduct +import rs09.game.interaction.InteractionListener + +/** + * Represents the plugin used for an npc with the trade option. + * @author Ceikry + * @version 1.0 + */ +class NPCTradePlugin : InteractionListener() { + override fun defineListeners() { + on(NPC, "trade", "shop"){player, node -> + val npc = node as NPC + if (npc.id == 2824) { + TanningProduct.open(player, 2824) + return@on true + } + if (npc.id == 7601) { + ContentAPI.openInterface(player, 732) + return@on true + } + return@on npc.openShop(player) + } + } +} \ No newline at end of file