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
11 changes: 11 additions & 0 deletions data/area/kandarin/arandar/arandar.objs.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[arandar_heavy_gate]
id = 3944
examine = "A heavy wooden gate."

[arandar_heavy_gate_2]
id = 3945
examine = "A heavy wooden gate."

[arandar_log_balance]
id = 3933
examine = "A slippery looking log."
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[underground_pass_cave_entrance]
id = 36000
examine = "A dark cave entrance."
20 changes: 20 additions & 0 deletions data/area/tirannwn/isafdar/isafdar.anims.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[tripwire_step_over]
id = 1236

[sticks_trap_pass]
id = 819

[leaf_trap_jump]
id = 1115

[dense_forest_climb]
id = 839

[dense_forest_squeeze]
id = 1237

[elven_overpass_climb_up]
id = 2050

[elven_overpass_climb_down]
id = 2049
16 changes: 16 additions & 0 deletions data/area/tirannwn/isafdar/isafdar.areas.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,19 @@ y = [3243, 3249]
[isafdar_hunter_fishing_area]
x = [2264, 2274]
y = [3248, 3258]

[isafdar_leaf_trap_1]
x = [2209]
y = [3203]

[isafdar_leaf_trap_2]
x = [2267]
y = [3203]

[isafdar_leaf_trap_3]
x = [2274]
y = [3174]

[isafdar_leaf_trap_4]
x = [2277]
y = [3262]
69 changes: 69 additions & 0 deletions data/area/tirannwn/isafdar/isafdar.objs.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
[tripwire]
id = 3921
examine = "I wonder who set this here."

[isafdar_sticks_trap]
id = 3922
examine = "A suspicious looking bundle of sticks."

[isafdar_leaves]
id = 3923
examine = "Are those leaves hiding something?"

[isafdar_leaves_2]
id = 3924
examine = "Are those leaves hiding something?"

[isafdar_leaves_3]
id = 3925
examine = "Are those leaves hiding something?"

[isafdar_protruding_rocks]
id = 3927
examine = "Perhaps I could climb up these."

[isafdar_log_balance]
id = 3931
examine = "A slippery looking log."

[isafdar_log_balance_2]
id = 3932
examine = "A slippery looking log."

[dense_forest]
id = 3937
examine = "Very dense forest."

[dense_forest_2]
id = 3938
examine = "Very dense forest."

[dense_forest_3]
id = 3939
examine = "Very dense forest."

[dense_forest_hard]
id = 3998
level = 56
examine = "Very dense forest."

[dense_forest_hard_2]
id = 3999
level = 56
examine = "Very dense forest."

[lletya_tree_entrance]
id = 8742
examine = "An especially dense patch of trees."

[elven_overpass_rocks_up]
id = 9296
examine = "A rocky cliff face."

[elven_overpass_rocks_down]
id = 9297
examine = "A rocky cliff face."

[isafdar_cave_entrance]
id = 4006
examine = "A dark cave entrance."
3 changes: 3 additions & 0 deletions data/area/tirannwn/lletya/lletya.areas.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[lletya_teleport]
x = [2328, 2330]
y = [3171, 3173]
11 changes: 11 additions & 0 deletions data/area/tirannwn/lletya/lletya.vars.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[teleport_crystal_recharges]
format = "int"
default = 0
persist = true
transmit = false

[crystal_seed_attunements]
format = "int"
default = 0
persist = true
transmit = false
35 changes: 35 additions & 0 deletions data/area/tirannwn/poison_waste/poison_waste.objs.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[poison_waste_cave_entrance]
id = 26684
examine = "A murky cave entrance."

[poison_waste_cave_entrance_2]
id = 26685
examine = "A murky cave entrance."

[poison_waste_cave_entrance_3]
id = 26686
examine = "A murky cave entrance."

[poison_waste_cave_exit]
id = 26571
examine = "A way out of the cave."

[poison_waste_cave_exit_2]
id = 26572
examine = "A way out of the cave."

[poison_waste_cave_exit_3]
id = 26573
examine = "A way out of the cave."

[poison_waste_cave_exit_4]
id = 26574
examine = "A way out of the cave."

[poison_waste_sewer_ladder_up]
id = 26518
examine = "A ladder leading up."

[poison_waste_sewer_ladder_down]
id = 26519
examine = "A ladder leading down."
1 change: 1 addition & 0 deletions data/entity/npc/humanoid/musicians.npcs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,6 @@ examine = "He looks lovelorn."
[musician_isafdar]
id = 8723
song = 704
interacts = false
categories = ["elf"]
examine = "She's beautiful."
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ interface Approachable {
}
}

fun objectApproach(option: String, obj: String = "*", handler: suspend Player.(PlayerOnObjectInteract) -> Unit) {
fun objectApproach(option: String, obj: String = "*", arrive: Boolean = true, handler: suspend Player.(PlayerOnObjectInteract) -> Unit) {
Script.checkLoading()
Wildcards.find(obj, Wildcard.Object) { id ->
if (!arrive) {
noDelays.add("$option:$id")
}
playerObject.getOrPut("$option:$id") { mutableListOf() }.add(handler)
}
}
Expand Down Expand Up @@ -143,6 +146,7 @@ interface Approachable {
}

companion object : AutoCloseable {
val noDelays = mutableSetOf<String>()
val playerPlayer = Object2ObjectOpenHashMap<String, MutableList<suspend Player.(PlayerOnPlayerInteract) -> Unit>>(2)
val onPlayer = Object2ObjectOpenHashMap<String, MutableList<suspend Player.(ItemOnPlayerInteract) -> Unit>>(10)

Expand All @@ -166,6 +170,7 @@ interface Approachable {
var npcMark: (Player.(NPC) -> Unit)? = null

override fun close() {
noDelays.clear()
playerPlayer.clear()
onPlayer.clear()
playerNpc.clear()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ data class PlayerOnObjectInteract(
}

override fun approach() {
invoke(emptySet(), Approachable.playerObject)
invoke(Approachable.noDelays, Approachable.playerObject)
}

private fun invoke(noDelays: Set<String>, map: Map<String, List<suspend Player.(PlayerOnObjectInteract) -> Unit>>) {
Expand Down
16 changes: 16 additions & 0 deletions game/src/main/kotlin/content/area/kandarin/arandar/ArandarGate.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package content.area.kandarin.arandar

import world.gregs.voidps.engine.Script
import world.gregs.voidps.engine.entity.character.move.tele
import world.gregs.voidps.type.Tile

class ArandarGate : Script {

init {
objectOperate("Enter", "arandar_heavy_gate,arandar_heavy_gate_2") { (target) ->
val dest = Tile(target.tile.x, if (tile.y > target.tile.y) target.tile.y - 1 else target.tile.y + 1, tile.level)
delay()
tele(dest)
}
}
}
46 changes: 46 additions & 0 deletions game/src/main/kotlin/content/area/tirannwn/isafdar/DenseForest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package content.area.tirannwn.isafdar

import world.gregs.voidps.engine.Script
import world.gregs.voidps.engine.entity.character.player.chat.obstacle
import world.gregs.voidps.engine.entity.character.player.skill.Skill
import world.gregs.voidps.engine.entity.character.player.skill.level.Level.has
import world.gregs.voidps.type.Direction
import world.gregs.voidps.type.Tile

class DenseForest : Script {

init {
objectOperate("Enter", "dense_forest,dense_forest_2,dense_forest_3,dense_forest_hard,dense_forest_hard_2") { (target) ->
val level = target.def["level", 0]
if (level > 0 && !has(Skill.Agility, level)) {
obstacle(level)
return@objectOperate
}
// Rotation determines the passage's axis; squeeze through to the far side
val sideways = target.rotation == 1 || target.rotation == 3
val direction = if (sideways) {
if (tile.x < target.tile.x) Direction.EAST else Direction.WEST
} else {
if (tile.y < target.tile.y) Direction.NORTH else Direction.SOUTH
}
if (target.id == "dense_forest" || target.id == "dense_forest_2") {
// Line up on the tile just before the passage's footprint before squeezing through
val start = if (sideways) {
val x = if (direction == Direction.EAST) target.tile.x - 1 else target.tile.x + target.width
val centre = tile.y.coerceIn(target.tile.y + (target.height - 1) / 2, target.tile.y + target.height / 2)
Tile(x, centre, tile.level)
} else {
val y = if (direction == Direction.NORTH) target.tile.y - 1 else target.tile.y + target.height
val centre = tile.x.coerceIn(target.tile.x + (target.width - 1) / 2, target.tile.x + target.width / 2)
Tile(centre, y, tile.level)
}
walkOverDelay(start)
}
val dest = tile.add(direction.delta.x * 3, direction.delta.y * 3)
face(direction)
delay()
anim(if (target.id == "dense_forest") "dense_forest_climb" else "dense_forest_squeeze")
exactMoveDelay(dest, delay = 90, direction = direction)
}
}
}
54 changes: 54 additions & 0 deletions game/src/main/kotlin/content/area/tirannwn/isafdar/Eluned.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package content.area.tirannwn.isafdar

import content.entity.player.dialogue.Happy
import content.entity.player.dialogue.Neutral
import content.entity.player.dialogue.Sad
import content.entity.player.dialogue.type.choice
import content.entity.player.dialogue.type.npc
import content.entity.player.dialogue.type.player
import content.entity.player.dialogue.type.statement
import world.gregs.voidps.engine.Script
import world.gregs.voidps.engine.entity.character.player.Player
import world.gregs.voidps.engine.inv.add
import world.gregs.voidps.engine.inv.inventory
import world.gregs.voidps.engine.inv.remove

class Eluned : Script {

init {
npcOperate("Talk-to", "eluned,eluned_2,eluned_3,eluned_lletya") {
npc<Happy>("Hello there, it's a lovely day for a walk in the woods. So what can I help you with?")
if (!inventory.contains("crystal_teleport_seed_uncharged")) {
player<Neutral>("I'm just looking around.")
return@npcOperate
}
player<Neutral>("I am looking to recharge teleportation crystals.")
recharge()
}

itemOnNPCOperate("crystal_teleport_seed_uncharged", "eluned,eluned_2,eluned_3,eluned_lletya") {
recharge()
}
}

suspend fun Player.recharge() {
val price = rechargePrice()
npc<Happy>("Very well. I'll recharge your teleportation crystal for $price gold. What do you say?")
choice {
option<Neutral>("Recharge a crystal.") {
if (!inventory.contains("coins", price)) {
player<Sad>("Actually, I don't have enough coins.")
return@option
}
if (inventory.remove("coins", price) && inventory.remove("crystal_teleport_seed_uncharged")) {
inventory.add("crystal_teleport_seed_4")
inc("teleport_crystal_recharges")
statement("Eluned recharges your elven teleportation crystal for $price gold.")
}
}
option<Neutral>("Nevermind, I really must be going.")
}
}

fun Player.rechargePrice(): Int = (750 - 150 * get("teleport_crystal_recharges", 0)).coerceAtLeast(150)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package content.area.tirannwn.isafdar

import world.gregs.voidps.engine.Script
import world.gregs.voidps.engine.entity.character.player.chat.noInterest
import world.gregs.voidps.engine.entity.character.player.chat.obstacle
import world.gregs.voidps.engine.entity.character.player.skill.Skill
import world.gregs.voidps.engine.entity.character.player.skill.level.Level.has
import world.gregs.voidps.type.Tile

class ElvenOverpass : Script {

init {
objectOperate("Climb", "elven_overpass_rocks_up,elven_overpass_rocks_down") { (target) ->
val up = target.id == "elven_overpass_rocks_up"
val (level, dest) = when (target.tile) {
Tile(2333, 3252) -> 85 to Tile(2338, 3253)
Tile(2338, 3282) -> 68 to Tile(2338, 3286)
Tile(2346, 3299) -> 59 to Tile(2344, 3294)
Tile(2337, 3253) -> 85 to Tile(2332, 3252)
Tile(2338, 3285) -> 68 to Tile(2338, 3281)
Tile(2344, 3295) -> 59 to Tile(2346, 3300)
else -> return@objectOperate noInterest()
}
if (!has(Skill.Agility, level)) {
obstacle(level)
return@objectOperate
}
anim(if (up) "elven_overpass_climb_up" else "elven_overpass_climb_down")
exactMoveDelay(dest, delay = 90)
}
}
}
Loading