mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-09 16:45:44 -07:00
Compare commits
3 commits
8337670660
...
d826e4bcce
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d826e4bcce | ||
|
|
8e2d9d1727 | ||
|
|
31bd7af2b5 |
2 changed files with 17 additions and 8 deletions
|
|
@ -17,6 +17,7 @@ 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.*
|
||||
|
||||
|
|
@ -260,17 +261,24 @@ enum class EnchantedJewellery(
|
|||
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)
|
||||
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
|
||||
replaceSlot(player, item.slot, Item(Items.ENCHANTED_GEM_4155), item)
|
||||
return@queueScript stopExecuting(player)
|
||||
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
|
||||
removeItem(player, item, removeFrom)
|
||||
if (removeItem(player, item, removeFrom)) {
|
||||
return@queueScript stopExecuting(player)
|
||||
}
|
||||
log(this.javaClass, Log.ERR, "Error crumbling jewelry")
|
||||
}
|
||||
} else {
|
||||
replaceJewellery(player, item, nextJewellery, isEquipped)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue