Skip to content

Commit 0895a10

Browse files
authored
Add skilling tests and fixes (#945)
* Add smithing tests * Add bone burying tests * Add herblore tests * Add more prayer tests, fix bone offering * Spawn brother when opening not searching barrows chest * Fix resetting barrows * Fix despawning barrows brothers * Fix npc defs not loading clones which haven't been defined yet * Add crafting tests and a few npc dialogues * Fix music tracks not changing between areas closes #936 * Formatting * Add all looms closes #875
1 parent 201eb44 commit 0895a10

File tree

28 files changed

+627
-54
lines changed

28 files changed

+627
-54
lines changed

data/area/misthalin/barbarian_village/barbarian_village.npc-spawns.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spawns = [
1010
{ id = "chieftain_gunthor", x = 3078, y = 3444 },
1111
{ id = "haakon_the_champion", x = 3081, y = 3444 },
1212
{ id = "kjell", x = 3079, y = 3414, direction = "NORTH_EAST" },
13-
{ id = "tassie_slipcast_barbarian_village", x = 3084, y = 3408, members = true },
13+
{ id = "tassie_slipcast", x = 3084, y = 3408, members = true },
1414
{ id = "barbarian_barbarian_outpost", x = 3079, y = 3444 },
1515
{ id = "barbarian_barbarian_outpost_2", x = 3079, y = 3409 },
1616
{ id = "barbarian_barbarian_outpost_3", x = 3079, y = 3437 },

data/area/misthalin/barbarian_village/barbarian_village.npcs.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ examine = "A mighty warrior, Haakon is powerfully concerned for his tribe."
8787
id = 3329
8888
examine = "His furs look very damp."
8989

90-
[tassie_slipcast_barbarian_village]
90+
[tassie_slipcast]
9191
id = 1793
9292
examine = "A hard-working potter."
9393

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[loom_iorwerth_camp]
2+
id = 787

data/skill/crafting/weaving.tables.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,33 @@ row_id = "item"
33
level = "int"
44
xp = "int"
55
amount = "int"
6+
amount_default = 1
67
product = "item"
78
plural = "string"
89

910
[.ball_of_wool]
1011
level = 10
1112
xp = 120
13+
amount = 4
1214
product = "strip_of_cloth"
1315
plural = "balls of wool"
1416

1517
[.flax]
1618
level = 52
19+
amount = 5
1720
product = "unfinished_net"
1821
plural = "flax"
1922

2023
[.jute_fibre]
2124
level = 21
2225
xp = 380
26+
amount = 4
2327
product = "empty_sack"
2428
plural = "jute fibres"
2529

2630
[.willow_branch]
2731
level = 36
2832
xp = 560
33+
amount = 6
2934
product = "basket"
3035
plural = "willow branches"

data/skill/herblore/potion.recipes.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ level = 12
3434
xp = 50.0
3535
ticks = 2
3636
remove = ["harralander_potion_unf", "red_spiders_eggs"]
37-
add = ["strength_potion_3"]
37+
add = ["restore_potion_3"]
3838
animation = "mixing_potion"
3939
message = "You mix the limpwurt root into your potion."
4040

@@ -98,7 +98,7 @@ add = ["agility_potion_3"]
9898
animation = "mixing_potion"
9999
message = "You mix the toads legs into your potion."
100100

101-
[combat_potion_finished_finished]
101+
[combat_potion_finished]
102102
skill = "herblore"
103103
level = 36
104104
xp = 84.0
@@ -218,7 +218,7 @@ add = ["magic_essence_3"]
218218
animation = "mixing_potion"
219219
message = "You mix the gorak claw powder into your potion."
220220

221-
[fletching_potion_finished_finished]
221+
[fletching_potion_finished]
222222
skill = "herblore"
223223
level = 58
224224
xp = 132.0
@@ -383,7 +383,7 @@ skill = "herblore"
383383
level = 84
384384
xp = 200.0
385385
ticks = 2
386-
remove = ["cw_super_energy_potion_3", "papaya_fruit"]
386+
remove = ["super_energy_3", "papaya_fruit"]
387387
add = ["recover_special_3"]
388388
animation = "mixing_potion"
389389
message = "You mix the papaya fruit into your potion"

engine/src/main/kotlin/world/gregs/voidps/engine/client/ui/Interfaces.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,5 @@ fun Player.playTrack(trackIndex: Int) {
290290
playMusicTrack(EnumDefinitions.get("music_tracks").int(trackIndex))
291291
val name = EnumDefinitions.get("music_track_names").string(trackIndex)
292292
interfaces.sendText("music_player", "currently_playing", name)
293-
this["playing_song"] = true
294293
this["current_track"] = trackIndex
295294
}

engine/src/main/kotlin/world/gregs/voidps/engine/data/definition/NPCDefinitions.kt

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package world.gregs.voidps.engine.data.definition
33
import it.unimi.dsi.fastutil.Hash
44
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
55
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap
6+
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap
67
import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet
78
import org.jetbrains.annotations.TestOnly
89
import world.gregs.config.Config
@@ -46,6 +47,7 @@ object NPCDefinitions : DefinitionsDecoder<NPCDefinition> {
4647
dropTables: DropTables? = null,
4748
): NPCDefinitions {
4849
timedLoad("npc config") {
50+
val clones = Object2ObjectOpenHashMap<String, String>(100)
4951
val ids = Object2IntOpenHashMap<String>()
5052
val refs = Object2IntOpenHashMap<String>()
5153
ids.defaultReturnValue(-1)
@@ -60,10 +62,13 @@ object NPCDefinitions : DefinitionsDecoder<NPCDefinition> {
6062
when (val key = key()) {
6163
"clone" -> {
6264
val name = string()
63-
val npc = refs.getInt(name)
64-
require(npc >= 0) { "Cannot find npc to clone with id '$name' in ${path}. Make sure it's in the same file." }
65-
val definition = definitions[npc]
66-
params.putAll(definition.params ?: continue)
65+
val npcId = ids.getInt(name)
66+
if (npcId == -1) {
67+
clones[stringId] = name
68+
} else {
69+
val definition = definitions[npcId]
70+
params.putAll(definition.params ?: continue)
71+
}
6772
}
6873
"id" -> id = int()
6974
"categories" -> {
@@ -94,6 +99,25 @@ object NPCDefinitions : DefinitionsDecoder<NPCDefinition> {
9499
}
95100
}
96101
}
102+
103+
for ((item, clone) in clones) {
104+
val cloneId = ids.getInt(clone)
105+
require(cloneId != -1) { "Unable to find npc id to clone '$clone'" }
106+
val definition = definitions[cloneId]
107+
val id = ids.getInt(item)
108+
require(id != -1) { "Unable to find npc id '$item'" }
109+
val params = definitions[id].params as? MutableMap<Int, Any>
110+
if (params != null) {
111+
for (param in definition.params ?: continue) {
112+
if (param.key == Params.AKA) {
113+
continue
114+
}
115+
if (!params.containsKey(param.key)) {
116+
params[param.key] = param.value
117+
}
118+
}
119+
}
120+
}
97121
}
98122
this.ids = ids
99123
ids.size
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package content.area.asgarnia.falador.farm
2+
3+
import content.entity.player.dialogue.Happy
4+
import content.entity.player.dialogue.Neutral
5+
import content.entity.player.dialogue.Quiz
6+
import content.entity.player.dialogue.type.choice
7+
import content.entity.player.dialogue.type.npc
8+
import content.entity.player.dialogue.type.player
9+
import content.entity.player.dialogue.type.statement
10+
import world.gregs.voidps.engine.Script
11+
import world.gregs.voidps.engine.client.message
12+
import world.gregs.voidps.engine.inv.inventory
13+
import world.gregs.voidps.engine.inv.remove
14+
15+
class Sarah : Script {
16+
init {
17+
npcOperate("Talk-to", "sarah") {
18+
npc<Neutral>("Hello. How can I help you?")
19+
choice {
20+
option<Quiz>("What are you selling?")
21+
option<Quiz>("Can you give me any Farming advice?") {
22+
npc<Neutral>("Yes - ask a gardener.")
23+
}
24+
option<Quiz>("Can you tell me how to use the loom?") {
25+
npc<Neutral>("Well, it's actually my loom, but I don't mind you using it, if you like. You can use it to weave sacks and baskets in which you can put vegetables and fruit.")
26+
choice {
27+
option<Quiz>("What do I need to weave sacks?") {
28+
npc<Neutral>("Well, the best sacks are made with jute fibres; you can grow jute yourself in a hops patch. I'd say about 4 jute fibres should be enough to weave a sack.")
29+
player<Happy>("Thank you, that's very kind.")
30+
}
31+
option<Quiz>("What do I need to weave baskets?") {
32+
npc<Neutral>("Well, the best baskets are made with young branches cut from a willow tree. You'll need a very young willow tree; otherwise, the branches will have grown too thick to be able to weave. I suggest growing your own.")
33+
npc<Neutral>("You can cut the branches with a standard pair of secateurs. You will probably need about 6 willow branches to weave a complete basket.")
34+
player<Happy>("Thank you, that's very kind.")
35+
}
36+
option<Happy>("Thank you, that's very kind.")
37+
}
38+
}
39+
option<Neutral>("I'm okay, thank you.")
40+
}
41+
}
42+
43+
itemOnNPCOperate("*", "sheepdog") { (target, item) ->
44+
anim("climb_down")
45+
when (item.id) {
46+
"bones" -> {
47+
inventory.remove(item.id)
48+
target.say("Woof woof!")
49+
statement("You give the dog some nice bones.<br>It happily gnaws on them.")
50+
}
51+
"cooked_meat", "cooked_chicken" -> {
52+
inventory.remove(item.id)
53+
target.say("Woof woof!")
54+
statement("You give the dog a nice piece of meat.<br>It gobbles it up.")
55+
}
56+
else -> {
57+
target.say("Grrrr!")
58+
message("The dog doesn't seem interested in that.")
59+
}
60+
}
61+
}
62+
}
63+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package content.area.misthalin.barbarian_village
2+
3+
import content.entity.player.dialogue.Angry
4+
import content.entity.player.dialogue.Quiz
5+
import content.entity.player.dialogue.type.npc
6+
import world.gregs.voidps.engine.Script
7+
import world.gregs.voidps.type.random
8+
9+
class Barbarian : Script {
10+
init {
11+
npcOperate("Talk-to", "barbarian_barbarian_village*") {
12+
when (random.nextInt(5)) {
13+
0 -> npc<Quiz>("Wanna fight?")
14+
1 -> npc<Quiz>("Ah, you come for fight, ja?")
15+
2 -> npc<Angry>("You look funny.")
16+
3 -> npc<Angry>("Grrr!")
17+
4 -> npc<Quiz>("What you want?")
18+
else -> npc<Angry>("Go Away!")
19+
}
20+
}
21+
}
22+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package content.area.misthalin.barbarian_village
2+
3+
import content.entity.player.dialogue.Happy
4+
import content.entity.player.dialogue.type.npc
5+
import world.gregs.voidps.engine.Script
6+
7+
class TassieSlipcast : Script {
8+
init {
9+
npcOperate("Talk-to", "tassie_slipcast") {
10+
npc<Happy>("Please feel free to use the pottery wheel, I won't be using it all the time. Put your pots in the kiln when you've made one.")
11+
npc<Happy>("And make sure you tidy up after yourself!")
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)