Compare commits
No commits in common. "make-quizmaster-optional" and "main" have entirely different histories.
make-quizm
...
main
@ -1,42 +0,0 @@
|
|||||||
package content.global.ame.events.quizmaster
|
|
||||||
|
|
||||||
import core.game.dialogue.DialogueFile
|
|
||||||
import core.game.dialogue.FacialExpression
|
|
||||||
import core.game.system.timer.impl.AntiMacro
|
|
||||||
|
|
||||||
class QuizMasterChoiceDialogue : DialogueFile() {
|
|
||||||
|
|
||||||
val CHOICE_STAGE = 50000
|
|
||||||
|
|
||||||
override fun handle(componentID: Int, buttonID: Int) {
|
|
||||||
if (stage < CHOICE_STAGE) {
|
|
||||||
npc(FacialExpression.FRIENDLY, "Hey ${player?.username}! It's your lucky day!", "Would you like to take part in my quiz show?")
|
|
||||||
stage = CHOICE_STAGE
|
|
||||||
} else if (stage >= CHOICE_STAGE) {
|
|
||||||
when (stage) {
|
|
||||||
CHOICE_STAGE -> options("Yes, I'd love to!", "No, thanks.").also { stage++ }
|
|
||||||
CHOICE_STAGE + 1 -> when (buttonID) {
|
|
||||||
1 -> {
|
|
||||||
end()
|
|
||||||
// Start the quiz by calling the original kidnapping logic
|
|
||||||
startQuiz(player!!)
|
|
||||||
}
|
|
||||||
2 -> {
|
|
||||||
end()
|
|
||||||
// Player declined, terminate the random event
|
|
||||||
AntiMacro.terminateEventNpc(player!!)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun startQuiz(player: core.game.node.entity.player.Player) {
|
|
||||||
// This will trigger the original kidnapping and quiz logic
|
|
||||||
// We need to call the QuizMasterNPC's kidnapping method
|
|
||||||
val quizMaster = player.getAttribute("current-random-event-npc", null) as? QuizMasterNPC
|
|
||||||
quizMaster?.startQuiz()
|
|
||||||
// Clean up the attribute
|
|
||||||
player.removeAttribute("current-random-event-npc")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -26,14 +26,7 @@ import org.rs09.consts.Sounds
|
|||||||
class QuizMasterNPC(var type: String = "", override var loot: WeightBasedTable? = null) : RandomEventNPC(NPCs.QUIZ_MASTER_2477) {
|
class QuizMasterNPC(var type: String = "", override var loot: WeightBasedTable? = null) : RandomEventNPC(NPCs.QUIZ_MASTER_2477) {
|
||||||
override fun init() {
|
override fun init() {
|
||||||
super.init()
|
super.init()
|
||||||
// Store reference to this NPC for the dialogue to access
|
sendChat("Hey ${player.username}! It's your lucky day!")
|
||||||
setAttribute(player, "current-random-event-npc", this)
|
|
||||||
// Open the choice dialogue instead of immediately kidnapping
|
|
||||||
openDialogue(player, QuizMasterChoiceDialogue(), this.asNpc())
|
|
||||||
}
|
|
||||||
|
|
||||||
fun startQuiz() {
|
|
||||||
sendChat("Excellent! Let's begin!")
|
|
||||||
queueScript(player, 4, QueueStrength.SOFT) { stage: Int ->
|
queueScript(player, 4, QueueStrength.SOFT) { stage: Int ->
|
||||||
when (stage) {
|
when (stage) {
|
||||||
0 -> {
|
0 -> {
|
||||||
@ -67,6 +60,6 @@ class QuizMasterNPC(var type: String = "", override var loot: WeightBasedTable?
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun talkTo(npc: NPC) {
|
override fun talkTo(npc: NPC) {
|
||||||
openDialogue(player, QuizMasterChoiceDialogue(), this.asNpc())
|
openDialogue(player, QuizMasterDialogueFile(), this.asNpc())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user