Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package content.area.karamja.shilo_village

import content.entity.npc.shop.openShop
import content.entity.player.dialogue.Happy
import content.entity.player.dialogue.Neutral
import content.entity.player.dialogue.type.choice
import content.entity.player.dialogue.type.npc
import world.gregs.voidps.engine.Script

class Fernahei : Script {
init {
npcOperate("Talk-to", "fernahei_shilo_village") {
npc<Happy>("Welcome to Fernahei's Fishing Shop Bwana! Would you like to see my items?")
choice {
option<Neutral>("Yes please!") {
openShop("fernaheis_fishing_hut")
}
option<Neutral>("No, but thanks for the offer.") {
npc<Happy>("That's fine and thanks for your interest.")
}
}
}
npcOperate("Trade", "fernahei_shilo_village") {
openShop("fernaheis_fishing_hut")
}
}
}
27 changes: 27 additions & 0 deletions game/src/main/kotlin/content/area/karamja/shilo_village/Obli.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package content.area.karamja.shilo_village

import content.entity.npc.shop.openShop
import content.entity.player.dialogue.Happy
import content.entity.player.dialogue.Neutral
import content.entity.player.dialogue.type.choice
import content.entity.player.dialogue.type.npc
import world.gregs.voidps.engine.Script

class Obli : Script {
init {
npcOperate("Talk-to", "obli_shilo_village") {
npc<Happy>("Welcome to Obli's General Store Bwana! Would you like to see my items?")
choice {
option<Neutral>("Yes please!") {
openShop("oblis_general_store")
}
option<Neutral>("No, but thanks for the offer.") {
npc<Happy>("That's fine and thanks for your interest.")
}
}
}
npcOperate("Trade", "obli_shilo_village") {
openShop("oblis_general_store")
}
}
}
85 changes: 85 additions & 0 deletions game/src/main/kotlin/content/area/karamja/shilo_village/Vigroy.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package content.area.karamja.shilo_village

import content.entity.player.dialogue.Neutral
import content.entity.player.dialogue.type.choice
import content.entity.player.dialogue.type.npc
import world.gregs.voidps.engine.Script
import world.gregs.voidps.engine.client.ui.dialogue.talkWith
import world.gregs.voidps.engine.client.ui.open
import world.gregs.voidps.engine.entity.character.move.tele
import world.gregs.voidps.engine.entity.character.npc.NPCs
import world.gregs.voidps.engine.entity.character.player.Player
import world.gregs.voidps.engine.inv.inventory
import world.gregs.voidps.engine.inv.transact.TransactionError
import world.gregs.voidps.engine.inv.transact.operation.RemoveItem.remove
import world.gregs.voidps.type.Tile

class Vigroy : Script {
init {
npcOperate("Talk-to", "hajedy_shilo_village") {
offerCartRide()
}

npcOperate("Pay-fare", "hajedy_shilo_village") {
payFare()
}

objectOperate("Board", "travel_cart_shilo_village") {
talkWith(NPCs.findBySpawn(HAJEDY_SPAWN, "hajedy_shilo_village"))
offerCartRide()
}

objectOperate("Pay-fare", "travel_cart_shilo_village") {
talkWith(NPCs.findBySpawn(HAJEDY_SPAWN, "hajedy_shilo_village"))
payFare()
}
}
}

private val HAJEDY_SPAWN = Tile(2812, 3095) // placeholder, swap for Hajedy's actual spawn tile
private const val CART_FARE = 30 // adjust to actual RS cart fare
private const val ARRIVAL_X = 2762 // placeholder Brimhaven coords, swap for actual arrival tile
private const val ARRIVAL_Z = 3187

/**
* Talk-to/Board: full dialogue asking whether the player wants to travel.
*/
private suspend fun Player.offerCartRide() {
npc<Neutral>("I am offering a cart ride to Brimhaven, if you're interested. It will cost $CART_FARE coins. Is that okay?")
choice {
option<Neutral>("Yes please, I'd like to go to Brimhaven.") {
attemptPayment()
}
option<Neutral>("No thanks.") {
npc<Neutral>("Okay, Bwana, let me know if you change your mind.")
}
}
}

/**
* Pay-fare: skips the dialogue and attempts payment immediately.
*/
private suspend fun Player.payFare() {
attemptPayment()
}

private suspend fun Player.attemptPayment() {
inventory.transaction {
remove("coins", CART_FARE)
}
when (inventory.transaction.error) {
TransactionError.None -> {
npc<Neutral>("You hop into the cart and the driver urges the horses on.")
npc<Neutral>("You take a taxing journey through the jungle to Brimhaven.")
npc<Neutral>("You feel tired from the journey, but at least you didn't have to walk all that distance.")

open("fade_out")
delay(3)
tele(ARRIVAL_X, ARRIVAL_Z)
open("fade_in")
}
else -> {
npc<Neutral>("Sorry, but it looks as if you don't have enough money. Come and see me when you have enough for the ride.")
}
}
}
62 changes: 62 additions & 0 deletions game/src/main/kotlin/content/area/karamja/shilo_village/Yohnus.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package content.area.karamja.shilo_village

import content.entity.obj.door.enterDoor
import content.entity.player.dialogue.Happy
import content.entity.player.dialogue.Neutral
import content.entity.player.dialogue.type.choice
import content.entity.player.dialogue.type.npc
import world.gregs.voidps.engine.Script
import world.gregs.voidps.engine.client.ui.dialogue.talkWith
import world.gregs.voidps.engine.entity.character.npc.NPCs
import world.gregs.voidps.engine.entity.character.player.Player
import world.gregs.voidps.engine.inv.inventory
import world.gregs.voidps.engine.inv.transact.TransactionError
import world.gregs.voidps.engine.inv.transact.operation.RemoveItem.remove
import world.gregs.voidps.type.Tile

class Yohnus : Script {

init {
npcOperate("Talk-to", "yohnus_shilo_village") {
furnace()
}
objectOperate("Open", "blacksmiths_door_closed") { (target) ->
if (tile.y > target.tile.y) {
enterDoor(target)
return@objectOperate
}
if (this["yohnus_paid", false]) {
clear("yohnus_paid")
enterDoor(target)
return@objectOperate
}
talkWith(NPCs.findBySpawn(Tile(2857, 2963), "yohnus_shilo_village"))
furnace()
if (this["yohnus_paid", false]) {
clear("yohnus_paid")
enterDoor(target)
}
}
}
}

private suspend fun Player.furnace() {
npc<Neutral>("Sorry but the blacksmiths is closed. But I can let you use the furnace at the cost of 20 gold pieces.")
choice {
option<Neutral>("Use Furnace - 20 Gold") {
inventory.transaction {
remove("coins", 20)
}
when (inventory.transaction.error) {
TransactionError.None -> {
this["yohnus_paid"] = true
npc<Happy>("Thanks Bwana! Enjoy the facilities!")
}
else -> npc<Neutral>("Sorry, you don't have enough coins.")
}
}
option<Neutral>("No thanks!") {
npc<Neutral>("Very well Bwana, have a nice day.")
}
}
}