mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-10 10:20:41 -07:00
Jewelry fix
This commit is contained in:
parent
ad5ad6333c
commit
e4a465a082
1 changed files with 42 additions and 41 deletions
|
|
@ -11,6 +11,7 @@ import core.game.node.entity.player.Player
|
||||||
import core.game.node.entity.player.link.TeleportManager
|
import core.game.node.entity.player.link.TeleportManager
|
||||||
import core.game.node.item.Item
|
import core.game.node.item.Item
|
||||||
import core.game.system.task.Pulse
|
import core.game.system.task.Pulse
|
||||||
|
import core.game.world.GameWorld
|
||||||
import core.game.world.map.Location
|
import core.game.world.map.Location
|
||||||
import core.game.world.update.flag.context.Animation
|
import core.game.world.update.flag.context.Animation
|
||||||
import core.game.world.update.flag.context.Graphics
|
import core.game.world.update.flag.context.Graphics
|
||||||
|
|
@ -20,7 +21,7 @@ import org.rs09.consts.Sounds
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an enchanted jewellery.
|
* Represents a piece of enchanted jewellery.
|
||||||
* @author Vexia, downthecrop, Player Name
|
* @author Vexia, downthecrop, Player Name
|
||||||
*/
|
*/
|
||||||
enum class EnchantedJewellery(
|
enum class EnchantedJewellery(
|
||||||
|
|
@ -238,35 +239,50 @@ enum class EnchantedJewellery(
|
||||||
if (!canTeleport(player, nextJewellery)) {
|
if (!canTeleport(player, nextJewellery)) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
Pulser.submit(object : Pulse(0) {
|
val location = getLocation(buttonID)
|
||||||
private var count = 0
|
player.scripts.delay = GameWorld.ticks + 4
|
||||||
private var location = getLocation(buttonID)
|
queueScript(player, 0, QueueStrength.SOFT) { stage ->
|
||||||
override fun pulse(): Boolean {
|
when (stage) {
|
||||||
when (count) {
|
0 -> {
|
||||||
0 -> {
|
lock(player, 4)
|
||||||
lock(player,4)
|
visualize(player, ANIMATION, GRAPHICS)
|
||||||
visualize(player, ANIMATION, GRAPHICS)
|
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
|
||||||
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
|
player.impactHandler.disabledTicks = 4
|
||||||
player.impactHandler.disabledTicks = 4
|
closeInterface(player)
|
||||||
closeInterface(player)
|
return@queueScript delayScript(player, 3)
|
||||||
}
|
}
|
||||||
3 -> {
|
1 -> {
|
||||||
teleport(player,location)
|
teleport(player, location)
|
||||||
resetAnimator(player)
|
resetAnimator(player)
|
||||||
if (isLastItemIndex(itemIndex)) {
|
unlock(player)
|
||||||
if (isCrumble) crumbleJewellery(player, item, isEquipped)
|
player.dispatch(TeleportEvent(TeleportManager.TeleportType.NORMAL, TeleportMethod.JEWELRY, item, location))
|
||||||
} else {
|
if (isLastItemIndex(itemIndex)) {
|
||||||
replaceJewellery(player, item, nextJewellery, isEquipped)
|
if (isSlayerRing(item)) {
|
||||||
|
if (isEquipped) {
|
||||||
|
// Remove it now, but only addItemOrDrop the gem after the teleport has procced
|
||||||
|
removeItem(player, item, Container.INVENTORY)
|
||||||
|
return@queueScript delayScript(player, 1)
|
||||||
|
}
|
||||||
|
// Not equipped -> can replace fluently
|
||||||
|
replaceSlot(player, item.slot, Item(Items.ENCHANTED_GEM_4155), item)
|
||||||
|
return@queueScript stopExecuting(player)
|
||||||
}
|
}
|
||||||
unlock(player)
|
// Not slayer ring
|
||||||
player.dispatch(TeleportEvent(TeleportManager.TeleportType.NORMAL, TeleportMethod.JEWELRY, item, location))
|
if (isCrumble) {
|
||||||
return true
|
val removeFrom = if (isEquipped) Container.EQUIPMENT else Container.INVENTORY
|
||||||
|
removeItem(player, item, removeFrom)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
replaceJewellery(player, item, nextJewellery, isEquipped)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
count += 1
|
2 -> {
|
||||||
return false
|
addItemOrDrop(player, Items.ENCHANTED_GEM_4155)
|
||||||
|
sendMessage(player, "Your Ring of Slaying reverts back into a regular enchanted gem.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
return@queueScript stopExecuting(player)
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -278,21 +294,6 @@ enum class EnchantedJewellery(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun crumbleJewellery(player: Player, item: Item, isEquipped: Boolean) {
|
|
||||||
if (isEquipped) {
|
|
||||||
removeItem(player, item, Container.EQUIPMENT)
|
|
||||||
} else {
|
|
||||||
removeItem(player, item)
|
|
||||||
}
|
|
||||||
if (isSlayerRing(item)) {
|
|
||||||
queueScript(player, 1, QueueStrength.SOFT) {
|
|
||||||
addItemOrDrop(player, Items.ENCHANTED_GEM_4155)
|
|
||||||
sendMessage(player, "Your Ring of Slaying reverts back into a regular enchanted gem.")
|
|
||||||
return@queueScript stopExecuting(player)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun isSlayerRing(item: Item): Boolean {
|
private fun isSlayerRing(item: Item): Boolean {
|
||||||
return (item.id in RING_OF_SLAYING.ids)
|
return (item.id in RING_OF_SLAYING.ids)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue