mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-09 16:45:44 -07:00
Compare commits
5 commits
8337670660
...
d826e4bcce
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d826e4bcce | ||
|
|
8e2d9d1727 | ||
|
|
31bd7af2b5 | ||
|
|
e4a465a082 | ||
|
|
ad5ad6333c |
5 changed files with 57 additions and 46 deletions
|
|
@ -11,11 +11,13 @@ import core.game.node.entity.player.Player
|
|||
import core.game.node.entity.player.link.TeleportManager
|
||||
import core.game.node.item.Item
|
||||
import core.game.system.task.Pulse
|
||||
import core.game.world.GameWorld
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.game.world.update.flag.context.Graphics
|
||||
import org.rs09.consts.Items
|
||||
import core.game.world.GameWorld.Pulser
|
||||
import core.tools.Log
|
||||
import org.rs09.consts.Sounds
|
||||
import java.util.*
|
||||
|
||||
|
|
@ -238,35 +240,57 @@ enum class EnchantedJewellery(
|
|||
if (!canTeleport(player, nextJewellery)) {
|
||||
return false
|
||||
}
|
||||
Pulser.submit(object : Pulse(0) {
|
||||
private var count = 0
|
||||
private var location = getLocation(buttonID)
|
||||
override fun pulse(): Boolean {
|
||||
when (count) {
|
||||
val location = getLocation(buttonID)
|
||||
player.scripts.delay = GameWorld.ticks + 4
|
||||
queueScript(player, 0, QueueStrength.SOFT) { stage ->
|
||||
when (stage) {
|
||||
0 -> {
|
||||
lock(player, 4)
|
||||
visualize(player, ANIMATION, GRAPHICS)
|
||||
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
|
||||
player.impactHandler.disabledTicks = 4
|
||||
closeInterface(player)
|
||||
return@queueScript delayScript(player, 3)
|
||||
}
|
||||
3 -> {
|
||||
1 -> {
|
||||
teleport(player, location)
|
||||
resetAnimator(player)
|
||||
unlock(player)
|
||||
player.dispatch(TeleportEvent(TeleportManager.TeleportType.NORMAL, TeleportMethod.JEWELRY, item, location))
|
||||
if (isLastItemIndex(itemIndex)) {
|
||||
if (isCrumble) crumbleJewellery(player, item, isEquipped)
|
||||
if (isSlayerRing(item)) {
|
||||
if (isEquipped) {
|
||||
// Remove it now, but only addItemOrDrop the gem after the teleport has procced
|
||||
if (removeItem(player, item, Container.EQUIPMENT)) {
|
||||
return@queueScript delayScript(player, 1)
|
||||
}
|
||||
log(this.javaClass, Log.ERR, "Error replacing slayer ring with enchanted gem (removeItem from equipment)")
|
||||
}
|
||||
// Not equipped -> can replace fluently
|
||||
if (replaceSlot(player, item.slot, Item(Items.ENCHANTED_GEM_4155), item) == item) {
|
||||
return@queueScript stopExecuting(player)
|
||||
}
|
||||
log(this.javaClass, Log.ERR, "Error replacing slayer ring with enchanted gem (replaceSlot)")
|
||||
}
|
||||
// Not slayer ring
|
||||
if (isCrumble) {
|
||||
val removeFrom = if (isEquipped) Container.EQUIPMENT else Container.INVENTORY
|
||||
if (removeItem(player, item, removeFrom)) {
|
||||
return@queueScript stopExecuting(player)
|
||||
}
|
||||
log(this.javaClass, Log.ERR, "Error crumbling jewelry")
|
||||
}
|
||||
} else {
|
||||
replaceJewellery(player, item, nextJewellery, isEquipped)
|
||||
}
|
||||
unlock(player)
|
||||
player.dispatch(TeleportEvent(TeleportManager.TeleportType.NORMAL, TeleportMethod.JEWELRY, item, location))
|
||||
return true
|
||||
}
|
||||
2 -> {
|
||||
addItemOrDrop(player, Items.ENCHANTED_GEM_4155)
|
||||
sendMessage(player, "Your Ring of Slaying reverts back into a regular enchanted gem.")
|
||||
}
|
||||
}
|
||||
count += 1
|
||||
return false
|
||||
return@queueScript stopExecuting(player)
|
||||
}
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
@ -278,21 +302,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 {
|
||||
return (item.id in RING_OF_SLAYING.ids)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class ShootingStar(var level: ShootingStarType = ShootingStarType.values().rando
|
|||
"South-west Varrock mine" to Location.create(3176, 3362, 0), // South-west Varrock mine / Champion's Guild mine
|
||||
"Varrock east bank" to Location.create(3259, 3407, 0), // Varrock east bank / Rune shop
|
||||
"Lumbridge Swamp south-east mine" to Location.create(3227, 3150, 0), // Lumbridge Swamp south-east mine
|
||||
//"Burgh de Rott bank" to Location.create(3500, 3219, 0), // Burgh de Rott bank (requires quest to enter)
|
||||
"Burgh de Rott bank" to Location.create(3500, 3219, 0), // Burgh de Rott bank (requires quest to enter)
|
||||
"Canifis Bank" to Location.create(3504, 3487, 0), // Canifis bank
|
||||
"Mos Le'Harmless bank" to Location.create(3687, 2969, 0), // Mos Le'Harmless bank (requires quest to enter but is currently accessible for Slayer)
|
||||
"Gnome stronghold Bank" to Location.create(2460, 3432, 0), // Gnome stronghold bank
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class ShootingStarPlugin : LoginListener, InteractionListener, TickListener, Com
|
|||
fun teleportToStar(player: Player) {
|
||||
val condition: (p: Player) -> Boolean = when (star.location.toLowerCase()) {
|
||||
"canifis bank" -> {p -> requireQuest(p, Quests.PRIEST_IN_PERIL, "to access this.")}
|
||||
//"burgh de rott bank" -> {p -> hasRequirement(p, Quests.IN_AID_OF_THE_MYREQUE)} //disabled: crash
|
||||
"burgh de rott bank" -> {p -> hasRequirement(p, Quests.IN_AID_OF_THE_MYREQUE)}
|
||||
"crafting guild" -> {p -> hasLevelStat(p, Skills.CRAFTING, 40)}
|
||||
"lletya bank" -> {p -> hasRequirement(p, Quests.MOURNINGS_END_PART_I)}
|
||||
"jatizso mine" -> {p -> hasRequirement(p, Quests.THE_FREMENNIK_ISLES)}
|
||||
|
|
@ -120,7 +120,7 @@ class ShootingStarPlugin : LoginListener, InteractionListener, TickListener, Com
|
|||
1 -> dialogue("WARNING: The star is located in the wilderness.").also { stage++ }
|
||||
2 -> player.dialogueInterpreter.sendOptions("Teleport to the star?", "Yes", "No").also { stage++ }
|
||||
3 -> when (buttonID) {
|
||||
1 -> end().also { teleportToStar(player) }
|
||||
1 -> teleportToStar(player)
|
||||
2 -> end()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -405,7 +405,7 @@ fun replaceSlot(player: Player, slot: Int, item: Item, currentItem: Item? = null
|
|||
}
|
||||
|
||||
if (cont.remove(currentItem, slot, true)) {
|
||||
return cont.replace(item, slot)
|
||||
return cont.replace(item, slot) ?: currentItem
|
||||
}
|
||||
|
||||
PlayerMonitor.log(player, LogType.DUPE_ALERT, "Potential slot-replacement-based dupe attempt, slot: $slot, item: $item")
|
||||
|
|
@ -413,8 +413,9 @@ fun replaceSlot(player: Player, slot: Int, item: Item, currentItem: Item? = null
|
|||
Container.INVENTORY -> Container.EQUIPMENT
|
||||
else -> Container.INVENTORY
|
||||
}
|
||||
if (removeItem(player, currentItem, other))
|
||||
return cont.replace(item, slot)
|
||||
if (removeItem(player, currentItem, other)) {
|
||||
return cont.replace(item, slot) ?: currentItem
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ public class TeleportManager {
|
|||
if (teleportType != -1) {
|
||||
if (entity instanceof Player) {
|
||||
Player p = (Player) entity;
|
||||
p.scripts.setDelay(GameWorld.getTicks() + 12);
|
||||
p.getDialogueInterpreter().close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue