Added cooldown to ring

This commit is contained in:
ceikry
2021-07-14 17:52:16 -05:00
parent e315bf8b83
commit 11760a6889
@@ -11,6 +11,7 @@ import rs09.game.content.global.worldevents.WorldEvents
import rs09.game.content.global.worldevents.shootingstar.ShootingStar import rs09.game.content.global.worldevents.shootingstar.ShootingStar
import rs09.game.content.global.worldevents.shootingstar.ShootingStarEvent import rs09.game.content.global.worldevents.shootingstar.ShootingStarEvent
import rs09.game.interaction.InteractionListener import rs09.game.interaction.InteractionListener
import java.util.concurrent.TimeUnit
class StarRingListener : InteractionListener(){ class StarRingListener : InteractionListener(){
@@ -22,6 +23,11 @@ class StarRingListener : InteractionListener(){
if(star == null) ContentAPI.sendDialogue(player, "There is currently no active star.").also { return@on true } if(star == null) ContentAPI.sendDialogue(player, "There is currently no active star.").also { return@on true }
if(ContentAPI.getAttribute(player, "ring-next-tele", 0L) > System.currentTimeMillis()){
ContentAPI.sendDialogue(player, "The ring is still recharging.")
return@on true
}
val condition: (Player) -> Boolean = when(star?.star!!.location.toLowerCase()){ val condition: (Player) -> Boolean = when(star?.star!!.location.toLowerCase()){
"canifis bank" -> { p -> p.questRepository.isComplete("Priest in Peril")} "canifis bank" -> { p -> p.questRepository.isComplete("Priest in Peril")}
"crafting guild" -> {p -> ContentAPI.hasLevelStat(p, Skills.CRAFTING, 40) } "crafting guild" -> {p -> ContentAPI.hasLevelStat(p, Skills.CRAFTING, 40) }
@@ -73,6 +79,7 @@ class StarRingListener : InteractionListener(){
fun teleport(player: Player, star: ShootingStar){ fun teleport(player: Player, star: ShootingStar){
ContentAPI.teleport(player, star.crash_locations[star.location]!!.transform(0, -1, 0), TeleportManager.TeleportType.MINIGAME) ContentAPI.teleport(player, star.crash_locations[star.location]!!.transform(0, -1, 0), TeleportManager.TeleportType.MINIGAME)
ContentAPI.setAttribute(player, "/save:ring-next-tele", System.currentTimeMillis() + TimeUnit.DAYS.toMillis(1))
} }
} }
} }