Merge branch 'mime-random-event' into 'master'

Draft: Initial Mime Random

See merge request 2009scape/2009scape!1917
This commit is contained in:
Oven Bread 2025-11-30 15:42:25 +00:00
commit 5f07dd85c0

View file

@ -0,0 +1,80 @@
package content.global.ame.events.mime
import content.global.ame.RandomEventNPC
import core.api.*
import core.api.utils.WeightBasedTable
import core.game.interaction.QueueStrength
import core.game.node.entity.npc.NPC
import core.game.system.timer.impl.AntiMacro
import core.game.world.map.Location
import core.game.world.update.flag.context.Graphics
import org.rs09.consts.NPCs
import org.rs09.consts.Sounds
/**
*
* https://www.youtube.com/watch?v=lFKRYDij-hg (Aha, you are required)
*
* Note: 2 players can be in the same random which can get fucky.
* (proof) - https://www.youtube.com/watch?v=KgbYtytpX5M
* https://www.youtube.com/watch?v=QHYZeyx5p3I
*
* IFACE 188
* 2 - THINK -- 857 - Thinking
* 3 - CRY -- 860 - Cry
* 4 - Laugh -- 861 - Laugh
* 5 - Dance -- 866 - Dance
* 6 - Climb Rope -- 1130 - CLIMB ROPE
* 7 - Leamn on air -- 1129 - LEAN
* 8 - Glass Box -- 1131 - GLASS BOX
* 9 - Glass Wall -- 1128 - GLASS WALL
*
* Mime Spotlight - 2010, 4761, 0
* Your Spotlight - 2007, 4761, 0
* Turnoff Spotlight - 1135
* Turnon Spotlight - 1136
*
*/
class MimeNPC(var type: String = "", override var loot: WeightBasedTable? = null) : RandomEventNPC(NPCs.MYSTERIOUS_OLD_MAN_410) {
override fun init() {
super.init()
sendChat("Hey ${player.username}! It's your lucky day!")
queueScript(player, 4, QueueStrength.SOFT) { stage: Int ->
when (stage) {
0 -> {
lock(player, 6)
sendGraphics(Graphics(1576, 0, 0), player.location)
animate(player,8939)
playAudio(player, Sounds.TELEPORT_ALL_200)
return@queueScript delayScript(player, 3)
}
1 -> {
if (getAttribute<Location?>(player, QuizMasterDialogueFile.QUIZMASTER_ATTRIBUTE_RETURN_LOC, null) == null) {
setAttribute(player, QuizMasterDialogueFile.QUIZMASTER_ATTRIBUTE_RETURN_LOC, player.location)
}
setAttribute(player, QuizMasterDialogueFile.QUIZMASTER_ATTRIBUTE_QUESTIONS_CORRECT, 0)
//MazeInterface.initMaze(player)
teleport(player, Location(1952, 4764, 1))
AntiMacro.terminateEventNpc(player)
sendGraphics(Graphics(1577, 0, 0), player.location)
animate(player,8941)
sendMessage(player, "Answer four questions correctly in a row to be teleported back where you came from.")
sendMessage(player, "You will need to relog in if you lose the quiz dialog.")
return@queueScript delayScript(player, 6)
}
2 -> {
face(player, Location(1952, 4768, 1))
animate(player,2378)
openDialogue(player, QuizMasterDialogueFile(), this.asNpc())
return@queueScript stopExecuting(player)
}
else -> return@queueScript stopExecuting(player)
}
}
}
override fun talkTo(npc: NPC) {
openDialogue(player, QuizMasterDialogueFile(), this.asNpc())
}
}