Skip to content

Commit 572ed8e

Browse files
authored
Add multi target hunt modes, sheep shearing and berry bushes (#613)
* Add multi-target hunt modes closes #566 * Change transforms * Add sheep shearing * Add berry bushes * Add script exception name
1 parent cb4c5f6 commit 572ed8e

File tree

19 files changed

+301
-65
lines changed

19 files changed

+301
-65
lines changed

data/definitions/animations.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,6 +1401,7 @@ giant_spider_defend: 5328
14011401
giant_spider_death: 5329
14021402
rat_attack: 2705
14031403
rat_defend: 2706
1404+
rat_death: 2707
14041405
giant_rat_attack: 14859
14051406
giant_rat_death: 14860
14061407
giant_rat_defend: 14861
@@ -1569,6 +1570,7 @@ traiborn_bone_spell: 4602
15691570
summon_demon: 4617
15701571
demon_attack: 64
15711572
demon_defend: 65
1573+
demon_death: 67
15721574
delrith_continue: 4620
15731575
delrith_appear: 4623
15741576
delrith_death: 4624
@@ -1871,3 +1873,5 @@ edgeville_to_barbarian_village: 9903
18711873
barbarian_village_to_lumbridge: 9904
18721874
barbarian_village_to_champions_guild: 9904
18731875
champions_guild_to_lumbridge: 9904
1876+
shear_sheep: 893
1877+
pick_plant: 2282

data/definitions/npcs.yml

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ sheep:
5757
wander_radius: 10
5858
race: sheep
5959
examine: "White and fluffy."
60+
sheep_shorn:
61+
<<: *sheep
62+
id: 42
63+
examine: "Freshly sheared."
6064
banker:
6165
id: 44
6266
interact_distance: 2
@@ -847,9 +851,17 @@ crow_2:
847851
crow_3:
848852
<<: *crow
849853
id: 1756
854+
sheep_black_feet_shorn:
855+
<<: *sheep
856+
id: 1762
857+
examine: "Freshly sheared."
850858
sheep_black_feet:
851859
<<: *sheep
852860
id: 1763
861+
sheep_2_shorn:
862+
<<: *sheep
863+
id: 1764
864+
examine: "Freshly sheared."
853865
sheep_2:
854866
<<: *sheep
855867
id: 1765
@@ -1380,15 +1392,64 @@ lil_lamb:
13801392
<<: *sheep
13811393
id: 5146
13821394
examine: "How cute!"
1383-
sheep_light:
1395+
sheep_light_1_shorn:
1396+
<<: *sheep
1397+
id: 5148
1398+
examine: "Freshly sheared."
1399+
sheep_light_1:
1400+
<<: *sheep
1401+
id: 5156
1402+
sheep_light_2_shorn:
1403+
<<: *sheep
1404+
id: 5149
1405+
examine: "Freshly sheared."
1406+
sheep_light_2:
13841407
<<: *sheep
13851408
id: 5157
1386-
sheep_grey:
1409+
sheep_light_3_shorn:
1410+
<<: *sheep
1411+
id: 5150
1412+
examine: "Freshly sheared."
1413+
sheep_light_3:
1414+
<<: *sheep
1415+
id: 5158
1416+
sheep_light_4_shorn:
1417+
<<: *sheep
1418+
id: 5151
1419+
examine: "Freshly sheared."
1420+
sheep_light_4:
1421+
<<: *sheep
1422+
id: 5159
1423+
sheep_light_5_shorn:
1424+
<<: *sheep
1425+
id: 5152
1426+
examine: "Freshly sheared."
1427+
sheep_light_5:
13871428
<<: *sheep
13881429
id: 5160
1389-
sheep_light_2:
1430+
sheep_light_6_shorn:
1431+
<<: *sheep
1432+
id: 5153
1433+
examine: "Freshly sheared."
1434+
sheep_light_6:
13901435
<<: *sheep
13911436
id: 5161
1437+
sheep_light_monastery_1_shorn:
1438+
<<: *sheep
1439+
id: 5154
1440+
examine: "White and shaggy."
1441+
sheep_light_monastery_1:
1442+
<<: *sheep
1443+
id: 5162
1444+
examine: "White and shaggy."
1445+
sheep_light_monastery_2_shorn:
1446+
<<: *sheep
1447+
id: 5155
1448+
examine: "White and shaggy."
1449+
sheep_light_monastery_2:
1450+
<<: *sheep
1451+
id: 5163
1452+
examine: "White and shaggy."
13921453
banker_sophanem_dungeon:
13931454
id: 5258
13941455
interact_distance: 2
@@ -1927,6 +1988,10 @@ sheep_black:
19271988
<<: *sheep
19281989
id: 8876
19291990
examine: "It's sporting the height of wool-based fashion."
1991+
sheep_black_shorn:
1992+
<<: *sheep
1993+
id: 8877
1994+
examine: "Freshly sheared."
19301995
iconis:
19311996
id: 8879
19321997
race: human

data/definitions/objects.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12055,3 +12055,24 @@ a_sinking_canoe_stable_dugout:
1205512055
a_sinking_canoe_waka:
1205612056
id: 12162
1205712057
examine: "Glug, glug, glug."
12058+
nettles:
12059+
id: 1181
12060+
examine: "I'd better not get stung."
12061+
cadava_bush_full:
12062+
id: 23625
12063+
examine: "Wild cadava berries are growing here."
12064+
cadava_bush_half:
12065+
id: 23626
12066+
examine: "Wild cadava berries are growing here."
12067+
cadava_bush_empty:
12068+
id: 23627
12069+
examine: "Wild cadava berries grow here."
12070+
redberry_bush_full:
12071+
id: 23628
12072+
examine: "Wild redberries are growing here."
12073+
redberry_bush_half:
12074+
id: 23629
12075+
examine: "Wild redberries are growing here."
12076+
redberry_bush_empty:
12077+
id: 23630
12078+
examine: "Wild redberries grow here."

data/spawns/npc-spawns.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,8 +1086,8 @@
10861086
- { id: sheep, x: 2659, y: 4707, members: true }
10871087
- { id: sheep_black_feet, x: 2653, y: 4713, members: true }
10881088
- { id: sheep_2, x: 2659, y: 4714, members: true }
1089-
- { id: sheep_grey, x: 2656, y: 4714, members: true }
1090-
- { id: sheep_light_2, x: 2653, y: 4706, members: true }
1089+
- { id: sheep_light_5, x: 2656, y: 4714, members: true }
1090+
- { id: sheep_light_6, x: 2653, y: 4706, members: true }
10911091
- { id: duck_swim, x: 2662, y: 4686, members: true }
10921092
- { id: duck_swim, x: 2666, y: 4687, members: true }
10931093
- { id: duck_swim, x: 2668, y: 4688, members: true }
@@ -1310,8 +1310,8 @@
13101310
- { id: sheep, x: 2921, y: 3319 }
13111311
- { id: sheep_2, x: 2920, y: 3320 }
13121312
- { id: sheep_2, x: 2922, y: 3320 }
1313-
- { id: sheep_light_2, x: 2925, y: 3324 }
1314-
- { id: sheep_light_2, x: 2920, y: 3318 }
1313+
- { id: sheep_light_6, x: 2925, y: 3324 }
1314+
- { id: sheep_light_6, x: 2920, y: 3318 }
13151315
- { id: cow, x: 2917, y: 3289 }
13161316
- { id: cow, x: 2925, y: 3282 }
13171317
- { id: cow, x: 2926, y: 3271 }
@@ -1796,7 +1796,7 @@
17961796
- { id: butterfly_1, x: 3179, y: 3226 }
17971797
- { id: sheep, x: 3197, y: 3261 }
17981798
- { id: sheep_2, x: 3193, y: 3262 }
1799-
- { id: sheep_grey, x: 3197, y: 3263 }
1799+
- { id: sheep_light_5, x: 3197, y: 3263 }
18001800
- { id: sheep_black, x: 3195, y: 3263 }
18011801
- { id: hank, x: 3195, y: 3254 }
18021802
- { id: giant_spider, x: 3165, y: 3249 }
@@ -1839,8 +1839,8 @@
18391839
- { id: sheep, x: 3197, y: 3265 }
18401840
- { id: sheep_2, x: 3197, y: 3269 }
18411841
- { id: sheep_penguin, x: 3199, y: 3267 }
1842-
- { id: sheep_grey, x: 3195, y: 3272 }
1843-
- { id: sheep_light_2, x: 3194, y: 3267 }
1842+
- { id: sheep_light_5, x: 3195, y: 3272 }
1843+
- { id: sheep_light_6, x: 3194, y: 3267 }
18441844
- { id: sheep_black, x: 3195, y: 3275 }
18451845
- { id: cow_calf_2, x: 3166, y: 3321 }
18461846
- { id: cow_calf_3, x: 3181, y: 3315 }
@@ -2190,9 +2190,9 @@
21902190
- { id: chicken, x: 3230, y: 3298 }
21912191
- { id: chicken, x: 3235, y: 3298 }
21922192
- { id: chicken, x: 3237, y: 3323 }
2193-
- { id: sheep_grey, x: 3202, y: 3271 }
2194-
- { id: sheep_light_2, x: 3210, y: 3274 }
2195-
- { id: sheep_light, x: 3205, y: 3266 }
2193+
- { id: sheep_light_5, x: 3202, y: 3271 }
2194+
- { id: sheep_light_6, x: 3210, y: 3274 }
2195+
- { id: sheep_light_2, x: 3205, y: 3266 }
21962196
- { id: sheep_black, x: 3208, y: 3272 }
21972197
- { id: sheep_black, x: 3208, y: 3267 }
21982198
- { id: sheep_black, x: 3201, y: 3271 }
@@ -2206,9 +2206,9 @@
22062206
- { id: gillie_groats, x: 3254, y: 3274 }
22072207
# 12852
22082208
- { id: sheep, x: 3238, y: 3349 }
2209-
- { id: sheep_grey, x: 3246, y: 3344 }
2210-
- { id: sheep_light_2, x: 3246, y: 3350 }
2211-
- { id: sheep_light_2, x: 3233, y: 3343 }
2209+
- { id: sheep_light_5, x: 3246, y: 3344 }
2210+
- { id: sheep_light_6, x: 3246, y: 3350 }
2211+
- { id: sheep_light_6, x: 3233, y: 3343 }
22122212
- { id: dark_wizard_water, x: 3225, y: 3374 }
22132213
- { id: dark_wizard_water, x: 3232, y: 3367 }
22142214
- { id: dark_wizard_water, x: 3225, y: 3365 }

engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/HuntFloorItem.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import world.gregs.voidps.engine.event.Events
88

99
data class HuntFloorItem(
1010
val mode: String,
11-
val target: FloorItem
11+
val targets: List<FloorItem>,
12+
val target: FloorItem = targets.random()
1213
) : Event {
1314

1415
override val size = 4

engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/HuntNPC.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import world.gregs.voidps.engine.event.Events
77

88
data class HuntNPC(
99
val mode: String,
10-
val target: NPC
10+
val targets: List<NPC>,
11+
val target: NPC = targets.random()
1112
) : Event {
1213

1314
override val size = 4

engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/HuntObject.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import world.gregs.voidps.engine.event.Events
88

99
data class HuntObject(
1010
val mode: String,
11-
val target: GameObject
11+
val targets: List<GameObject>,
12+
val target: GameObject = targets.random()
1213
) : Event {
1314

1415
override val size = 4

engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/HuntPlayer.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import world.gregs.voidps.engine.event.Events
88

99
data class HuntPlayer(
1010
val mode: String,
11-
val target: Player
11+
val targets: List<Player>,
12+
val target: Player = targets.random()
1213
) : Event {
1314

1415
override val size = 3

engine/src/main/kotlin/world/gregs/voidps/engine/entity/character/npc/hunt/Hunting.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,22 @@ class Hunting(
5858
"player" -> {
5959
val targets = getCharacters(npc, players, range, definition)
6060
val target = targets.randomOrNull(seed) ?: continue
61-
npc.emit(HuntPlayer(mode, target))
61+
npc.emit(HuntPlayer(mode, targets, target))
6262
}
6363
"npc" -> {
6464
val targets = getCharacters(npc, npcs, range, definition)
6565
val target = targets.randomOrNull(seed) ?: continue
66-
npc.emit(HuntNPC(mode, target))
66+
npc.emit(HuntNPC(mode, targets, target))
6767
}
6868
"object" -> {
6969
val targets = getObjects(npc, definition)
7070
val target = targets.randomOrNull(seed) ?: continue
71-
npc.emit(HuntObject(mode, target))
71+
npc.emit(HuntObject(mode, targets, target))
7272
}
7373
"floor_item" -> {
7474
val targets = getItems(npc, range, definition)
7575
val target = targets.randomOrNull(seed) ?: continue
76-
npc.emit(HuntFloorItem(mode, target))
76+
npc.emit(HuntFloorItem(mode, targets, target))
7777
}
7878
}
7979
}

game/src/main/kotlin/ContentLoader.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,17 @@ object ContentLoader {
2323
scriptCount++
2424
}
2525
} else {
26+
var script = ""
2627
try {
2728
while (scripts.ready()) {
28-
loadScript(scripts.readLine())
29+
script = scripts.readLine()
30+
loadScript(script)
2931
scriptCount++
3032
}
3133
scripts.close()
32-
} catch (e: ClassNotFoundException) {
34+
} catch (e: Exception) {
3335
scripts.close()
34-
logger.error(e) { "Failed to load script: ${e.message}" }
36+
logger.error(e) { "Failed to load script: $script" }
3537
logger.error { "Make sure the scripts package is correct." }
3638
exitProcess(1)
3739
}

0 commit comments

Comments
 (0)