Animate travel interface

This commit is contained in:
downthecrop
2021-11-15 14:02:55 -08:00
parent d495f7042a
commit 96cacde574
3 changed files with 98 additions and 3 deletions
@@ -8,6 +8,7 @@ import core.game.node.entity.player.link.diary.DiaryType
import core.game.node.entity.skill.Skills import core.game.node.entity.skill.Skills
import core.game.node.entity.skill.gather.SkillingTool import core.game.node.entity.skill.gather.SkillingTool
import core.game.system.task.Pulse import core.game.system.task.Pulse
import core.game.world.update.flag.context.Animation
import core.net.packet.PacketRepository import core.net.packet.PacketRepository
import core.net.packet.context.MinimapStateContext import core.net.packet.context.MinimapStateContext
import core.net.packet.out.MinimapState import core.net.packet.out.MinimapState
@@ -88,6 +89,12 @@ class CanoeInterfaceListeners : InterfaceListener() {
val dest = CanoeUtils.getDestinationFromButtonID(buttonID) val dest = CanoeUtils.getDestinationFromButtonID(buttonID)
val destIndex = CanoeUtils.getStationIndex(dest) val destIndex = CanoeUtils.getStationIndex(dest)
val arrivalMessage = CanoeUtils.getNameByIndex(destIndex) val arrivalMessage = CanoeUtils.getNameByIndex(destIndex)
val stationIndex = CanoeUtils.getStationIndex(player.location)
val interfaceAnimationId = CanoeUtils.getTravelAnimation(stationIndex,destIndex)
var animDuration = 15
if (interfaceAnimationId != null) {
animDuration = Animation(interfaceAnimationId).duration
}
val varbit = player.getAttribute("canoe-varbit",VarbitDefinition.forObjectID(0)) val varbit = player.getAttribute("canoe-varbit",VarbitDefinition.forObjectID(0))
if (player.familiarManager.hasFamiliar()) { if (player.familiarManager.hasFamiliar()) {
player.sendMessage("You can't take a follower on a canoe.") player.sendMessage("You can't take a follower on a canoe.")
@@ -102,18 +109,21 @@ class CanoeInterfaceListeners : InterfaceListener() {
0 -> { 0 -> {
player.interfaceManager.openOverlay(Component(Components.FADE_TO_BLACK_120)) player.interfaceManager.openOverlay(Component(Components.FADE_TO_BLACK_120))
player.interfaceManager.open(Component(Components.CANOE_TRAVEL_758)) player.interfaceManager.open(Component(Components.CANOE_TRAVEL_758))
if (interfaceAnimationId != null) {
ContentAPI.animateInterface(player, Components.CANOE_TRAVEL_758, 3, interfaceAnimationId)
}
} }
2 -> { 2 -> {
PacketRepository.send(MinimapState::class.java, MinimapStateContext(player, 2)) PacketRepository.send(MinimapState::class.java, MinimapStateContext(player, 2))
player.interfaceManager.hideTabs(0, 1, 2, 3, 4, 5, 6, 11, 12) player.interfaceManager.hideTabs(0, 1, 2, 3, 4, 5, 6, 11, 12)
} }
15 -> player.properties.teleportLocation = dest animDuration -> player.properties.teleportLocation = dest
16 -> { animDuration+1 -> {
player.interfaceManager.close(Component(Components.CANOE_TRAVEL_758)) player.interfaceManager.close(Component(Components.CANOE_TRAVEL_758))
player.interfaceManager.closeOverlay() player.interfaceManager.closeOverlay()
player.interfaceManager.openOverlay(Component(Components.FADE_FROM_BLACK_170)) player.interfaceManager.openOverlay(Component(Components.FADE_FROM_BLACK_170))
} }
18 -> { animDuration+3 -> {
player.unlock() player.unlock()
player.interfaceManager.restoreTabs() player.interfaceManager.restoreTabs()
PacketRepository.send(MinimapState::class.java, MinimapStateContext(player, 0)) PacketRepository.send(MinimapState::class.java, MinimapStateContext(player, 0))
@@ -39,6 +39,58 @@ object CanoeUtils {
} }
} }
fun getTravelAnimation(stationId: Int, destId: Int): Int? {
val fromLumbridge = mapOf(
4 to 9887,
3 to 9888,
2 to 9889,
1 to 9890
)
val fromChampions = mapOf(
4 to 9891,
3 to 9892,
2 to 9893,
0 to 9906
)
val fromBarbarian = mapOf(
4 to 9894,
3 to 9895,
1 to 9905,
0 to 9906
)
val fromEdge = mapOf(
4 to 9896,
2 to 9903,
1 to 9902,
0 to 9901
)
val fromWilderness = mapOf(
3 to 9900,
2 to 9899,
1 to 9898,
0 to 9897
)
when(stationId){
0 -> {
return fromLumbridge[destId]
}
1 -> {
return fromChampions[destId]
}
2 -> {
return fromBarbarian[destId]
}
3 -> {
return fromEdge[destId]
}
4 -> {
return fromWilderness[destId]
}
}
return 0
}
fun getShapeAnimation(axe: SkillingTool): Animation{ fun getShapeAnimation(axe: SkillingTool): Animation{
when(axe){ when(axe){
SkillingTool.BRONZE_AXE -> return Animation(6744); SkillingTool.BRONZE_AXE -> return Animation(6744);
@@ -12,8 +12,10 @@ import core.game.node.scenery.Scenery
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.node.entity.player.info.Rights import core.game.node.entity.player.info.Rights
import core.game.node.entity.skill.Skills import core.game.node.entity.skill.Skills
import core.game.node.entity.skill.agility.AgilityHandler
import core.game.node.item.Item import core.game.node.item.Item
import core.game.system.communication.CommunicationInfo import core.game.system.communication.CommunicationInfo
import core.game.system.task.Pulse
import core.game.world.map.RegionManager import core.game.world.map.RegionManager
import core.game.world.map.build.DynamicRegion import core.game.world.map.build.DynamicRegion
import core.plugin.Initializable import core.plugin.Initializable
@@ -35,10 +37,12 @@ import java.awt.Toolkit
import java.awt.datatransfer.StringSelection import java.awt.datatransfer.StringSelection
import java.util.* import java.util.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
import kotlin.random.Random
@Initializable @Initializable
class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){
override fun defineCommands() { override fun defineCommands() {
var i = 6500;
/** /**
* Toggles debug mode * Toggles debug mode
@@ -131,6 +135,35 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){
player.interfaceManager.open(Component(Components.CREDIT_SHOP)) player.interfaceManager.open(Component(Components.CREDIT_SHOP))
} }
// Cropster Testing Interface Animations
// boat is 3??
// not 1-400
//600 ish is promissing
// 5100 is travel
define("cc", Command.Privilege.STANDARD) { player, args ->
if (args.size < 2){
ContentAPI.submitIndividualPulse(player, object : Pulse(2){
override fun pulse(): Boolean {
while (i < 100000){
player.interfaceManager.open(Component(Components.CANOE_TRAVEL_758))
ContentAPI.animateInterface(player, Components.CANOE_TRAVEL_758, 3, i)
player.sendMessage(i.toString())
i += 1
return false
}
return true
}
})
}
else{
i = args[1].toInt()
player.interfaceManager.open(Component(Components.CANOE_TRAVEL_758))
ContentAPI.animateInterface(player, Components.CANOE_TRAVEL_758, 3, args[1].toInt())
}
}
/** /**
* Shows the player a list of currently active GE sell offers * Shows the player a list of currently active GE sell offers
*/ */