Skip to content

Commit 6be7903

Browse files
author
Cadyyan
committed
Add behavior for Antique Lamp from Gunnars Ground
Currently if you complete the quest you're awarded the lamp but rubbing it does nothing and you can't bank the item. The only option is to destroy it. The wiki says that the expected behavior is to be able to select a skill of at least level 5 and you'll be granted 200 experience.
1 parent 6e92b62 commit 6be7903

File tree

2 files changed

+113
-0
lines changed

2 files changed

+113
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package content.quest.free.gunnars_ground
2+
3+
import content.entity.player.dialogue.type.skillLamp
4+
import content.entity.player.dialogue.type.statement
5+
import world.gregs.voidps.engine.Script
6+
import world.gregs.voidps.engine.entity.character.player.skill.exp.exp
7+
import world.gregs.voidps.engine.inv.inventory
8+
import world.gregs.voidps.engine.inv.remove
9+
10+
class AntiqueLamp : Script {
11+
12+
init {
13+
itemOption("Rub", "antique_lamp_gunnars_ground") { (item, slot) ->
14+
val skill = skillLamp()
15+
16+
if (this.levels.get(skill) < 5) {
17+
statement("<red>This skill is not high enough to gain experience from this lamp.")
18+
19+
return@itemOption
20+
}
21+
22+
if (inventory.remove(slot, item.id)) {
23+
exp(skill, 200.0)
24+
statement("<blue>Your wish has been granted!<br><black>You have been awarded 200 ${skill.name} experience!")
25+
}
26+
}
27+
}
28+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
package content.quest.free.gunnars_ground
2+
3+
import WorldTest
4+
import interfaceOption
5+
import itemOption
6+
import org.junit.jupiter.api.Assertions.assertEquals
7+
import org.junit.jupiter.api.Test
8+
import world.gregs.voidps.engine.entity.character.player.skill.Skill
9+
import world.gregs.voidps.engine.inv.add
10+
import world.gregs.voidps.engine.inv.inventory
11+
12+
class AntiqueLampTest : WorldTest() {
13+
14+
@Test
15+
fun `rub antique lamp with skill over level 5`() {
16+
val player = createPlayer()
17+
val lampId = "antique_lamp_gunnars_ground"
18+
19+
player.inventory.add(lampId)
20+
player.levels.set(Skill.Attack, 5)
21+
player.levels.set(Skill.Defence, 4)
22+
player.levels.set(Skill.Magic, 6)
23+
val initialExperience = player.experience.get(Skill.Magic)
24+
25+
player.itemOption("Rub", lampId)
26+
player.interfaceOption(
27+
"skill_stat_advance",
28+
"magic",
29+
"Select",
30+
optionIndex = 0,
31+
)
32+
player.interfaceOption("skill_stat_advance", "confirm", "Confirm")
33+
34+
assertEquals(0, player.inventory.count(lampId))
35+
assertEquals(initialExperience + 200.0, player.experience.get(Skill.Magic))
36+
}
37+
38+
@Test
39+
fun `rub antique lamp with skill at level 5`() {
40+
val player = createPlayer()
41+
val lampId = "antique_lamp_gunnars_ground"
42+
43+
player.inventory.add(lampId)
44+
player.levels.set(Skill.Attack, 5)
45+
player.levels.set(Skill.Defence, 4)
46+
player.levels.set(Skill.Magic, 6)
47+
val initialExperience = player.experience.get(Skill.Attack)
48+
49+
player.itemOption("Rub", lampId)
50+
player.interfaceOption(
51+
"skill_stat_advance",
52+
"attack",
53+
"Select",
54+
optionIndex = 0,
55+
)
56+
player.interfaceOption("skill_stat_advance", "confirm", "Confirm")
57+
58+
assertEquals(0, player.inventory.count(lampId))
59+
assertEquals(initialExperience + 200.0, player.experience.get(Skill.Attack))
60+
}
61+
62+
@Test
63+
fun `rub antique lamp with skill below level 5`() {
64+
val player = createPlayer()
65+
val lampId = "antique_lamp_gunnars_ground"
66+
67+
player.inventory.add(lampId)
68+
player.levels.set(Skill.Attack, 5)
69+
player.levels.set(Skill.Defence, 4)
70+
player.levels.set(Skill.Magic, 6)
71+
val initialExperience = player.experience.get(Skill.Defence)
72+
73+
player.itemOption("Rub", lampId)
74+
player.interfaceOption(
75+
"skill_stat_advance",
76+
"defence",
77+
"Select",
78+
optionIndex = 0,
79+
)
80+
player.interfaceOption("skill_stat_advance", "confirm", "Confirm")
81+
82+
assertEquals(1, player.inventory.count(lampId))
83+
assertEquals(initialExperience, player.experience.get(Skill.Defence))
84+
}
85+
}

0 commit comments

Comments
 (0)