forked from 2009Scape/Server
Enchanting spells repeat if there are more of the same item in the player inventory
This commit is contained in:
parent
7e8c2d8883
commit
52185005aa
1 changed files with 10 additions and 1 deletions
|
|
@ -14,6 +14,7 @@ import core.game.world.update.flag.context.Animation
|
|||
import core.game.world.update.flag.context.Graphics
|
||||
import core.plugin.Plugin
|
||||
import org.rs09.consts.Items
|
||||
import core.api.*
|
||||
|
||||
/**
|
||||
* Represents the enchant spells.
|
||||
|
|
@ -46,11 +47,12 @@ class EnchantSpell : MagicSpell {
|
|||
if (target !is Item || entity !is Player) {
|
||||
return false
|
||||
}
|
||||
entity.interfaceManager.setViewedTab(6)
|
||||
//entity.interfaceManager.setViewedTab(6)
|
||||
val enchanted = jewellery?.getOrDefault(target.id,null)
|
||||
|
||||
if (enchanted == null) {
|
||||
entity.packetDispatch.sendMessage("You can't use this spell on this item.")
|
||||
entity.interfaceManager.setViewedTab(6)
|
||||
return false
|
||||
}
|
||||
if (!meetsRequirements(entity, true, true)) {
|
||||
|
|
@ -89,6 +91,13 @@ class EnchantSpell : MagicSpell {
|
|||
content.minigame.mta.impl.EnchantingZone.ZONE.incrementPoints(entity, MTAType.ENCHANTERS.ordinal, pizazz)
|
||||
}
|
||||
}
|
||||
|
||||
// Snowscape: if there are more items to enchant, run the spell again
|
||||
if (entity.inventory.containsAtLeastOneItem(target)) {
|
||||
runTask(entity, 2){
|
||||
castSpell(entity as Player, super.book, super.spellId, target)
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue