mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-10 10:20:41 -07:00
Added the correct animation/graphics for emptying the ectophial
Rewrote ectophial
This commit is contained in:
parent
9445a2bae5
commit
4942ae0079
4 changed files with 73 additions and 90 deletions
|
|
@ -0,0 +1,73 @@
|
||||||
|
package content.global.handlers.item
|
||||||
|
|
||||||
|
import core.api.*
|
||||||
|
import core.game.interaction.IntType
|
||||||
|
import core.game.interaction.InteractionListener
|
||||||
|
import core.game.interaction.QueueStrength
|
||||||
|
import core.game.node.entity.player.Player
|
||||||
|
import core.game.node.entity.player.link.TeleportManager.TeleportType
|
||||||
|
import core.game.node.item.Item
|
||||||
|
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 org.rs09.consts.Scenery
|
||||||
|
import org.rs09.consts.Sounds
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
|
class EctophialListener : InteractionListener {
|
||||||
|
private val fillAnimation = Animation(832)
|
||||||
|
private val emptyAnimation = Animation(9609)
|
||||||
|
private val emptyGraphics = Graphics(1688)
|
||||||
|
|
||||||
|
private fun refillEctophial(player: Player) {
|
||||||
|
delayEntity(player, fillAnimation.duration)
|
||||||
|
animate(player, fillAnimation)
|
||||||
|
playAudio(player, Sounds.FILL_ECTOPLASM_1132)
|
||||||
|
if (removeItem(player, Items.ECTOPHIAL_4252)) {
|
||||||
|
addItem(player, Items.ECTOPHIAL_4251)
|
||||||
|
sendMessage(player, "You refill the ectophial from the Ectofuntus.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun defineListeners() {
|
||||||
|
onUseWith(IntType.SCENERY, Items.ECTOPHIAL_4252, Scenery.ECTOFUNTUS_5282) { player, _, _ ->
|
||||||
|
refillEctophial(player)
|
||||||
|
return@onUseWith true
|
||||||
|
}
|
||||||
|
|
||||||
|
on(Items.ECTOPHIAL_4251, IntType.ITEM, "empty") { player, node ->
|
||||||
|
if (!hasRequirement(player, "Ghosts Ahoy"))
|
||||||
|
return@on true
|
||||||
|
|
||||||
|
if (player.isTeleBlocked) {
|
||||||
|
sendMessage(player, "A magical force has stopped you from teleporting.")
|
||||||
|
return@on true
|
||||||
|
}
|
||||||
|
delayEntity(player, 10)
|
||||||
|
queueScript(player, 0, QueueStrength.SOFT) { stage: Int ->
|
||||||
|
when (stage) {
|
||||||
|
0 -> {
|
||||||
|
sendMessage(player, "You empty the ectoplasm onto the ground around your feet...")
|
||||||
|
playAudio(player, 4580)
|
||||||
|
visualize(player, emptyAnimation, emptyGraphics)
|
||||||
|
replaceSlot(player, node.asItem().slot, Item(Items.ECTOPHIAL_4252), Item(Items.ECTOPHIAL_4251))
|
||||||
|
return@queueScript delayScript(player, emptyAnimation.duration)
|
||||||
|
}
|
||||||
|
1 -> {
|
||||||
|
teleport(player, Location.create(3658, 3517, 0), TeleportType.ECTOPHIAL)
|
||||||
|
sendMessage(player, "...and the world changes around you.")
|
||||||
|
return@queueScript delayScript(player, 9)
|
||||||
|
}
|
||||||
|
2 -> {
|
||||||
|
face(player, Location(3659, 3519, 0))
|
||||||
|
refillEctophial(player)
|
||||||
|
return@queueScript stopExecuting(player)
|
||||||
|
}
|
||||||
|
else -> return@queueScript stopExecuting(player)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return@on true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
package content.global.handlers.item.withobject
|
|
||||||
|
|
||||||
import core.api.*
|
|
||||||
import core.game.system.task.Pulse
|
|
||||||
import core.game.world.update.flag.context.Animation
|
|
||||||
import org.rs09.consts.Items
|
|
||||||
import org.rs09.consts.Scenery
|
|
||||||
import core.game.interaction.IntType
|
|
||||||
import core.game.interaction.InteractionListener
|
|
||||||
import org.rs09.consts.Sounds
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Listener for filling empty ectophial
|
|
||||||
* @author Byte
|
|
||||||
*/
|
|
||||||
@Suppress("unused")
|
|
||||||
class EctophialFillListener : InteractionListener {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val ANIMATION = Animation(1652)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun defineListeners() {
|
|
||||||
onUseWith(IntType.SCENERY, Items.ECTOPHIAL_4252, Scenery.ECTOFUNTUS_5282) { player, used, _ ->
|
|
||||||
lock(player, 5)
|
|
||||||
animate(player, ANIMATION)
|
|
||||||
playAudio(player, Sounds.FILL_ECTOPLASM_1132)
|
|
||||||
|
|
||||||
submitIndividualPulse(player, object: Pulse(3) {
|
|
||||||
override fun pulse(): Boolean {
|
|
||||||
if (removeItem(player, used)) {
|
|
||||||
addItem(player, Items.ECTOPHIAL_4251)
|
|
||||||
sendMessage(player, "You refill the ectophial from the Ectofuntus.")
|
|
||||||
unlock(player)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return@onUseWith true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -77,17 +77,6 @@ public final class AnimalMagnetismPlugin extends OptionHandler {
|
||||||
case 10500:
|
case 10500:
|
||||||
player.getPacketDispatch().sendMessage("Perhaps you should wait a few hundred years or so?");
|
player.getPacketDispatch().sendMessage("Perhaps you should wait a few hundred years or so?");
|
||||||
break;
|
break;
|
||||||
case 4251:
|
|
||||||
case 4252:
|
|
||||||
if (!hasRequirement(player, "Ghosts Ahoy"))
|
|
||||||
return true;
|
|
||||||
if (option.equalsIgnoreCase("empty")) {
|
|
||||||
handleEctophial(player, (Item) node);
|
|
||||||
} else {
|
|
||||||
player.getInventory().remove(node.asItem());
|
|
||||||
player.sendMessage("The ectophial disappears as it hits the ground...");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 10492:
|
case 10492:
|
||||||
open(player);
|
open(player);
|
||||||
break;
|
break;
|
||||||
|
|
@ -123,34 +112,6 @@ public final class AnimalMagnetismPlugin extends OptionHandler {
|
||||||
player.getPacketDispatch().sendMessage("You fiddle with the notes.");
|
player.getPacketDispatch().sendMessage("You fiddle with the notes.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles the ectophial emptying.
|
|
||||||
* @param player the player.
|
|
||||||
* @param item the item.
|
|
||||||
*/
|
|
||||||
private void handleEctophial(final Player player, final Item item) {
|
|
||||||
if(teleport(player,Location.create(3658, 3517, 0), TeleportType.ECTOPHIAL)) {
|
|
||||||
player.getInventory().replace(new Item(4252), item.getSlot());
|
|
||||||
player.sendMessage("...and the world changes around you.", 4);
|
|
||||||
playAudio(player, 4580);
|
|
||||||
player.sendMessage("You empty the ectoplasm onto the ground around your feet...");
|
|
||||||
player.getPulseManager().run(new Pulse(9, player) {
|
|
||||||
@Override
|
|
||||||
public boolean pulse() {
|
|
||||||
player.faceLocation(new Location(3659, 3519, 0));
|
|
||||||
if (player.getInventory().containsItem(new Item(4252))) {
|
|
||||||
player.animate(Animation.create(1652));
|
|
||||||
playAudio(player, Sounds.FILL_ECTOPLASM_1132);
|
|
||||||
player.getInventory().remove(new Item(4252));
|
|
||||||
player.getInventory().add(item);
|
|
||||||
player.sendMessage("You refill the ectophial from the Ectofuntus.");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the hammering of a magnet.
|
* Handles the hammering of a magnet.
|
||||||
* @author Vexia
|
* @author Vexia
|
||||||
|
|
|
||||||
|
|
@ -506,13 +506,6 @@ public class TeleportManager {
|
||||||
delay++;
|
delay++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void stop() {
|
|
||||||
super.stop();
|
|
||||||
entity.unlock();
|
|
||||||
entity.lock(4);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue