jingle and dialogue box added

This commit is contained in:
psyopcutie 2026-07-26 07:54:39 +02:00
parent 7f1b1ef685
commit c52948489f

View file

@ -16,9 +16,11 @@ import core.api.isQuestComplete
import core.api.lock
import core.api.openDialogue
import core.api.openInterface
import core.api.playJingle
import core.api.queueScript
import core.api.removeItem
import core.api.rewardXP
import core.api.sendDialogue
import core.api.sendMessage
import core.api.setAttribute
import core.api.setComponentVisibility
@ -27,6 +29,7 @@ import core.api.stopExecuting
import core.api.teleport
import core.api.unlock
import core.cache.def.impl.ItemDefinition
import core.game.dialogue.DialogueFile
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.interaction.InterfaceListener
@ -77,6 +80,7 @@ private val BALLOON_BASKET_LOCS = intArrayOf(19128, 19129)
class BalloonTravelInterface : InterfaceListener, InteractionListener {
companion object {
private const val JINGLE_A_HOT_AIR_JOURNEY_118 = 118
private const val BALLOON_MAP_INTERFACE_469 = 469
private const val BALLOON_MAP_MODEL_12 = 12
@ -160,6 +164,7 @@ class BalloonTravelInterface : InterfaceListener, InteractionListener {
val duration = animationDuration(Animation(animation))
lock(player, duration)
playJingle(player, JINGLE_A_HOT_AIR_JOURNEY_118)
setComponentVisibility(player, BALLOON_MAP_INTERFACE_469, start.mapComponent, true)
setComponentVisibility(player, BALLOON_MAP_INTERFACE_469, BALLOON_MAP_MODEL_12, false)
animateInterface(player, BALLOON_MAP_INTERFACE_469, BALLOON_MAP_MODEL_12, animation)
@ -182,9 +187,8 @@ class BalloonTravelInterface : InterfaceListener, InteractionListener {
}
private fun unlockRoute(player: Player, destination: BalloonTravelLocation) {
if (removeItem(player, Item(destination.log, destination.unlockLogAmount))) {
BalloonFlightInterface.startUnlockFlight(player, destination)
}
closeInterface(player)
openDialogue(player, BalloonBoardingDialogue(destination))
}
fun unlockDestination(player: Player, destination: BalloonTravelLocation) {
@ -396,4 +400,22 @@ enum class BalloonTravelLocation(
}
}
}
}
private class BalloonBoardingDialogue(private val destination: BalloonTravelLocation) : DialogueFile() {
override fun handle(componentID: Int, buttonID: Int) {
when (stage) {
0 -> sendDialogue(player!!, "You board the balloon.").also { stage++ }
1 -> {
if (removeItem(player!!, Item(destination.log, destination.unlockLogAmount))) {
end()
BalloonFlightInterface.startUnlockFlight(player!!, destination)
} else {
end()
sendMessage(player!!, "You need some logs to fuel the balloon.")
}
}
}
}
}