mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-09 16:45:44 -07:00
Canoe interface animations
This commit is contained in:
parent
7d2548870a
commit
ca144daf69
3 changed files with 37 additions and 104 deletions
|
|
@ -15,6 +15,7 @@ import core.net.packet.out.MinimapState
|
||||||
import core.tools.RandomFunction
|
import core.tools.RandomFunction
|
||||||
import org.rs09.consts.Components
|
import org.rs09.consts.Components
|
||||||
import rs09.game.interaction.InterfaceListener
|
import rs09.game.interaction.InterfaceListener
|
||||||
|
import kotlin.math.abs
|
||||||
|
|
||||||
class CanoeInterfaceListeners : InterfaceListener() {
|
class CanoeInterfaceListeners : InterfaceListener() {
|
||||||
|
|
||||||
|
|
@ -76,7 +77,7 @@ class CanoeInterfaceListeners : InterfaceListener() {
|
||||||
player.packetDispatch.sendInterfaceConfig(DESTINATION_INTERFACE,49,true)
|
player.packetDispatch.sendInterfaceConfig(DESTINATION_INTERFACE,49,true)
|
||||||
for(i in 0..3){
|
for(i in 0..3){
|
||||||
if(i == stationIndex) continue
|
if(i == stationIndex) continue
|
||||||
if(Math.abs(i - stationIndex) > maxDistance){
|
if(abs(i - stationIndex) > maxDistance){
|
||||||
player.packetDispatch.sendInterfaceConfig(DESTINATION_INTERFACE,boatChilds[i],true)
|
player.packetDispatch.sendInterfaceConfig(DESTINATION_INTERFACE,boatChilds[i],true)
|
||||||
player.packetDispatch.sendInterfaceConfig(DESTINATION_INTERFACE,locationChilds[i],true)
|
player.packetDispatch.sendInterfaceConfig(DESTINATION_INTERFACE,locationChilds[i],true)
|
||||||
}
|
}
|
||||||
|
|
@ -91,15 +92,17 @@ class CanoeInterfaceListeners : InterfaceListener() {
|
||||||
val arrivalMessage = CanoeUtils.getNameByIndex(destIndex)
|
val arrivalMessage = CanoeUtils.getNameByIndex(destIndex)
|
||||||
val stationIndex = CanoeUtils.getStationIndex(player.location)
|
val stationIndex = CanoeUtils.getStationIndex(player.location)
|
||||||
val interfaceAnimationId = CanoeUtils.getTravelAnimation(stationIndex,destIndex)
|
val interfaceAnimationId = CanoeUtils.getTravelAnimation(stationIndex,destIndex)
|
||||||
var animDuration = 15
|
var travelAnimDur = 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.")
|
||||||
return@on true
|
return@on true
|
||||||
}
|
}
|
||||||
|
if (interfaceAnimationId != 0) {
|
||||||
|
travelAnimDur = Animation(interfaceAnimationId).duration
|
||||||
|
}
|
||||||
|
|
||||||
player.lock()
|
player.lock()
|
||||||
player.interfaceManager.close()
|
player.interfaceManager.close()
|
||||||
player.pulseManager.run(object : Pulse(){
|
player.pulseManager.run(object : Pulse(){
|
||||||
|
|
@ -109,21 +112,19 @@ 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)
|
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)
|
||||||
}
|
}
|
||||||
animDuration -> player.properties.teleportLocation = dest
|
travelAnimDur -> player.properties.teleportLocation = dest
|
||||||
animDuration+1 -> {
|
travelAnimDur+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))
|
||||||
}
|
}
|
||||||
animDuration+3 -> {
|
travelAnimDur+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))
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,13 @@ import core.game.world.update.flag.context.Animation
|
||||||
import org.rs09.consts.Components
|
import org.rs09.consts.Components
|
||||||
|
|
||||||
object CanoeUtils {
|
object CanoeUtils {
|
||||||
val SHAPE_INTERFACE = Components.CANOE_52
|
private const val SHAPE_INTERFACE = Components.CANOE_52
|
||||||
|
|
||||||
|
private val FROM_LUMBRIDGE = mapOf(4 to 9887, 3 to 9888, 2 to 9889, 1 to 9890)
|
||||||
|
private val FROM_CHAMPIONS = mapOf(4 to 9891, 3 to 9892, 2 to 9893, 0 to 9906)
|
||||||
|
private val FROM_BARBARIAN = mapOf(4 to 9894, 3 to 9895, 1 to 9905, 0 to 9906)
|
||||||
|
private val FROM_EDGE = mapOf(4 to 9896, 2 to 9903, 1 to 9902, 0 to 9901)
|
||||||
|
private val FROM_WILDERNESS = mapOf(3 to 9900, 2 to 9899, 1 to 9898, 0 to 9897)
|
||||||
|
|
||||||
fun checkCanoe(player: Player, canoe: Canoe){
|
fun checkCanoe(player: Player, canoe: Canoe){
|
||||||
if(player.skills.getLevel(Skills.WOODCUTTING) < canoe.requiredLevel) return
|
if(player.skills.getLevel(Skills.WOODCUTTING) < canoe.requiredLevel) return
|
||||||
|
|
@ -39,70 +45,29 @@ object CanoeUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getTravelAnimation(stationId: Int, destId: Int): Int? {
|
fun getTravelAnimation(stationId: Int, destId: Int): Int {
|
||||||
val fromLumbridge = mapOf(
|
return when(stationId){
|
||||||
4 to 9887,
|
0 -> FROM_LUMBRIDGE.getOrDefault(destId,0)
|
||||||
3 to 9888,
|
1 -> FROM_CHAMPIONS.getOrDefault(destId,0)
|
||||||
2 to 9889,
|
2 -> FROM_BARBARIAN.getOrDefault(destId,0)
|
||||||
1 to 9890
|
3 -> FROM_EDGE.getOrDefault(destId,0)
|
||||||
)
|
4 -> FROM_WILDERNESS.getOrDefault(destId,0)
|
||||||
val fromChampions = mapOf(
|
else -> 0;
|
||||||
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){
|
return when(axe){
|
||||||
SkillingTool.BRONZE_AXE -> return Animation(6744);
|
SkillingTool.BRONZE_AXE -> Animation(6744);
|
||||||
SkillingTool.IRON_AXE -> return Animation(6743);
|
SkillingTool.IRON_AXE -> Animation(6743);
|
||||||
SkillingTool.STEEL_AXE -> return Animation(6742);
|
SkillingTool.STEEL_AXE -> Animation(6742);
|
||||||
SkillingTool.BLACK_AXE -> return Animation(6741);
|
SkillingTool.BLACK_AXE -> Animation(6741);
|
||||||
SkillingTool.MITHRIL_AXE -> return Animation(6740);
|
SkillingTool.MITHRIL_AXE -> Animation(6740);
|
||||||
SkillingTool.ADAMANT_AXE -> return Animation(6739);
|
SkillingTool.ADAMANT_AXE -> Animation(6739);
|
||||||
SkillingTool.RUNE_AXE -> return Animation(6738);
|
SkillingTool.RUNE_AXE -> Animation(6738);
|
||||||
SkillingTool.DRAGON_AXE -> return Animation(6745);
|
SkillingTool.DRAGON_AXE -> Animation(6745);
|
||||||
|
else -> axe.animation;
|
||||||
}
|
}
|
||||||
return axe.animation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getDestinationFromButtonID(buttonID: Int): Location {
|
fun getDestinationFromButtonID(buttonID: Int): Location {
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,8 @@ 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
|
||||||
|
|
@ -37,12 +35,10 @@ 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
|
||||||
|
|
@ -135,35 +131,6 @@ 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
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue