diff --git a/game/src/main/kotlin/content/area/karamja/shilo_village/Fernahei.kt b/game/src/main/kotlin/content/area/karamja/shilo_village/Fernahei.kt new file mode 100644 index 0000000000..41323b5864 --- /dev/null +++ b/game/src/main/kotlin/content/area/karamja/shilo_village/Fernahei.kt @@ -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("Welcome to Fernahei's Fishing Shop Bwana! Would you like to see my items?") + choice { + option("Yes please!") { + openShop("fernaheis_fishing_hut") + } + option("No, but thanks for the offer.") { + npc("That's fine and thanks for your interest.") + } + } + } + npcOperate("Trade", "fernahei_shilo_village") { + openShop("fernaheis_fishing_hut") + } + } +} diff --git a/game/src/main/kotlin/content/area/karamja/shilo_village/Obli.kt b/game/src/main/kotlin/content/area/karamja/shilo_village/Obli.kt new file mode 100644 index 0000000000..c68d22bbc7 --- /dev/null +++ b/game/src/main/kotlin/content/area/karamja/shilo_village/Obli.kt @@ -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("Welcome to Obli's General Store Bwana! Would you like to see my items?") + choice { + option("Yes please!") { + openShop("oblis_general_store") + } + option("No, but thanks for the offer.") { + npc("That's fine and thanks for your interest.") + } + } + } + npcOperate("Trade", "obli_shilo_village") { + openShop("oblis_general_store") + } + } +} diff --git a/game/src/main/kotlin/content/area/karamja/shilo_village/Vigroy.kt b/game/src/main/kotlin/content/area/karamja/shilo_village/Vigroy.kt new file mode 100644 index 0000000000..a87f68a9d9 --- /dev/null +++ b/game/src/main/kotlin/content/area/karamja/shilo_village/Vigroy.kt @@ -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("I am offering a cart ride to Brimhaven, if you're interested. It will cost $CART_FARE coins. Is that okay?") + choice { + option("Yes please, I'd like to go to Brimhaven.") { + attemptPayment() + } + option("No thanks.") { + npc("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("You hop into the cart and the driver urges the horses on.") + npc("You take a taxing journey through the jungle to Brimhaven.") + npc("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("Sorry, but it looks as if you don't have enough money. Come and see me when you have enough for the ride.") + } + } +} \ No newline at end of file diff --git a/game/src/main/kotlin/content/area/karamja/shilo_village/Yohnus.kt b/game/src/main/kotlin/content/area/karamja/shilo_village/Yohnus.kt new file mode 100644 index 0000000000..aa59f41257 --- /dev/null +++ b/game/src/main/kotlin/content/area/karamja/shilo_village/Yohnus.kt @@ -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("Sorry but the blacksmiths is closed. But I can let you use the furnace at the cost of 20 gold pieces.") + choice { + option("Use Furnace - 20 Gold") { + inventory.transaction { + remove("coins", 20) + } + when (inventory.transaction.error) { + TransactionError.None -> { + this["yohnus_paid"] = true + npc("Thanks Bwana! Enjoy the facilities!") + } + else -> npc("Sorry, you don't have enough coins.") + } + } + option("No thanks!") { + npc("Very well Bwana, have a nice day.") + } + } +}