From 1d6360213c9ecb5225b9e90a72cc76ff494f5d7f Mon Sep 17 00:00:00 2001 From: Ceikry Date: Thu, 12 Mar 2020 10:50:10 -0500 Subject: [PATCH] Wall shortcut in sophanem now works --- .../city/sophanem/WallShortcut.java | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Server/src/plugin/interaction/city/sophanem/WallShortcut.java diff --git a/Server/src/plugin/interaction/city/sophanem/WallShortcut.java b/Server/src/plugin/interaction/city/sophanem/WallShortcut.java new file mode 100644 index 000000000..e7dcf7d88 --- /dev/null +++ b/Server/src/plugin/interaction/city/sophanem/WallShortcut.java @@ -0,0 +1,66 @@ +package plugin.interaction.city.sophanem; + +import org.crandor.cache.def.impl.ObjectDefinition; +import org.crandor.game.content.skill.Skills; +import org.crandor.game.interaction.OptionHandler; +import org.crandor.game.node.Node; +import org.crandor.game.node.entity.impl.ForceMovement; +import org.crandor.game.node.entity.player.Player; +import org.crandor.game.node.object.GameObject; +import org.crandor.game.system.task.Pulse; +import org.crandor.game.world.GameWorld; +import org.crandor.game.world.map.Location; +import org.crandor.game.world.update.flag.context.Animation; +import org.crandor.plugin.InitializablePlugin; +import org.crandor.plugin.Plugin; + +/** + * Handles the Sophanem wall shortcut + * @author ceik + */ +@InitializablePlugin +public final class WallShortcut extends OptionHandler { + + private static final Animation CLIMB_DOWN = Animation.create(2589); + + private static final Animation CRAWL_THROUGH = Animation.create(2590); + + private static final Animation CLIMB_UP = Animation.create(2591); + + @Override + public Plugin newInstance(Object arg) throws Throwable { + ObjectDefinition.forId(6620).getConfigurations().put("option:climb-through", this); + return null; + } + + @Override + public boolean handle(final Player player, Node node, String option) { + if (player.getSkills().getLevel(Skills.AGILITY) < 21) { + player.getDialogueInterpreter().sendDialogue("You need an Agility level of at least 21 to do this."); + return true; + } + player.lock(4); + final GameObject o = (GameObject) node; + if (o.getId() == 6620) { + ForceMovement.run(player, Location.create(3320, 2796, 0), o.getLocation(), CLIMB_DOWN); + GameWorld.submit(new Pulse(1, player) { + int count; + + @Override + public boolean pulse() { + switch (++count) { + case 2: + player.animate(CRAWL_THROUGH); + player.getProperties().setTeleportLocation(Location.create(3324, 2796, 0)); + break; + case 3: + ForceMovement.run(player, Location.create(3324, 2796, 0), Location.create(3324, 2796, 0), CLIMB_UP); + return true; + } + return false; + } + }); + } + return true; + } +}