Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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")
}
}
}
70 changes: 70 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,70 @@
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.Quiz
import content.entity.player.dialogue.type.choice
import content.entity.player.dialogue.type.npc
import content.entity.player.dialogue.type.player
import world.gregs.voidps.engine.Script
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

class Yohnus : Script {

init {
npcOperate("Talk-to", "yohnus_shilo_village") {
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!") {
player<Neutral>("No thanks!")
npc<Neutral>("Very well Bwana, have a nice day.")
}
}
}
objectOperate("Open", "blacksmiths_door_closed") { (target) ->
if (tile.y > target.tile.y) {
enterDoor(target)
return@objectOperate
}
if (!inventory.contains("coins", 20) && !this["yohnus_paid", false]) {
npc<Quiz>(
"yohnus_shilo_village",
"Sorry but the blacksmiths is closed. But I can let you use the furnace at the cost of 20 gold pieces."
)

@GregHib GregHib Jul 3, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably go to the choice dialogue here or the dialogue should be something different?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the (Continues above.) means it'll show the choice dialogue

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what needs to change and what needs to move then thanks ?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull out the other dialogue into a method:

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!") {
                    player<Neutral>("No thanks!")
                    npc<Neutral>("Very well Bwana, have a nice day.")
                }
            }
}

And call that here with

talkWith(NPCs.findBySpawn(Tile(2857, 2963), "yohnus_shilo_village")
furnace()

return@objectOperate
}
if (this["yohnus_paid", false]) {
clear("yohnus_paid")
enterDoor(target)
return@objectOperate
}
inventory.transaction {
remove("coins", 20)
}
when (inventory.transaction.error) {
TransactionError.None -> {
npc<Quiz>("yohnus_shilo_village", "Thanks Bwana! Enjoy the facilities!")
enterDoor(target)
}
else -> {
npc<Quiz>("yohnus_shilo_village", "Sorry, you don't have enough coins.")
}
}
}
}
}