mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-21 09:02:07 -07:00
Merge branch 'roving-elves-traps' into 'master'
Implement Isafdar Traps + Agility obstacle fixes See merge request 2009scape/2009scape!340
This commit is contained in:
commit
5e405e829b
3 changed files with 255 additions and 31 deletions
|
|
@ -57,4 +57,6 @@
|
|||
- Fix how the attack skill cape perk is calculated. It should now have a much more noticeable effect
|
||||
- Properly track leaf-bladed sword drops in ::stats command
|
||||
- Make broad bolts tradeable and fix their ranged strength
|
||||
< ---- ABOVE Released NOVEMBER 22, 2021 https://gitlab.com/2009scape/2009scape/-/tags/Nov-22-2021 ---- >
|
||||
< ---- ABOVE Released NOVEMBER 22, 2021 https://gitlab.com/2009scape/2009scape/-/tags/Nov-22-2021 ---- >
|
||||
- Animations for passing through Isafdar Dense Forest added
|
||||
- Implement Wire Traps, Leaf Traps, and Stick Traps in Isafdar
|
||||
|
|
|
|||
|
|
@ -0,0 +1,82 @@
|
|||
package core.game.content.quest.members.rovingelves;
|
||||
|
||||
import api.ContentAPI;
|
||||
import core.game.node.entity.Entity;
|
||||
import core.game.node.entity.combat.ImpactHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.world.map.Location;
|
||||
import core.game.world.map.zone.MapZone;
|
||||
import core.game.world.map.zone.ZoneBorders;
|
||||
import core.game.world.map.zone.ZoneBuilder;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* locationUpdate hook for Isafdar traps
|
||||
* @authors downthecrop
|
||||
*/
|
||||
|
||||
@Initializable
|
||||
public final class IsafdarZone extends MapZone implements Plugin<Object> {
|
||||
|
||||
public IsafdarZone() { super("Isafdar", true); }
|
||||
|
||||
Location LEAF_TRAP_PIT = new Location(2336,9656,0);
|
||||
|
||||
private String STICK_FAIL_MSG = "You set off the trap as you pass.";
|
||||
private String WIRE_FAIL_MSG = "You snag the trip wire as you step over it.";
|
||||
private String LEAF_FAIL_MSG = "You fall through and onto some spikes.";
|
||||
|
||||
List<Location> WIRE_TRAPS = Arrays.asList(
|
||||
new Location(2215,3154,0),
|
||||
new Location(2220,3153,0),
|
||||
new Location(2285,3188,0)
|
||||
);
|
||||
|
||||
List<Location> LEAF_TRAPS = Arrays.asList(
|
||||
new Location(2274,3174,0)
|
||||
);
|
||||
|
||||
List<Location> STICK_TRAPS = Arrays.asList(
|
||||
new Location(2236,3181,0),
|
||||
new Location(2201,3169,0),
|
||||
new Location(2276,3163,0)
|
||||
);
|
||||
|
||||
@Override
|
||||
public void configure() {
|
||||
register(new ZoneBorders(2178, 3150, 2304, 3196));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void locationUpdate(Entity e, Location last) {
|
||||
if (e instanceof Player) {
|
||||
Player player = (Player) e;
|
||||
if(LEAF_TRAPS.contains(player.getLocation())){
|
||||
ContentAPI.sendMessage(player,LEAF_FAIL_MSG);
|
||||
ContentAPI.impact(player,1, ImpactHandler.HitsplatType.NORMAL);
|
||||
player.teleport(LEAF_TRAP_PIT);
|
||||
} else if(STICK_TRAPS.contains(player.getLocation())) {
|
||||
ContentAPI.sendMessage(player,STICK_FAIL_MSG);
|
||||
ContentAPI.impact(player,1, ImpactHandler.HitsplatType.NORMAL);
|
||||
} else if (WIRE_TRAPS.contains(player.getLocation())){
|
||||
ContentAPI.sendMessage(player,WIRE_FAIL_MSG);
|
||||
ContentAPI.impact(player,1, ImpactHandler.HitsplatType.NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ZoneBuilder.configure(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object fireEvent(String identifier, Object... args) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package core.game.content.quest.members.rovingelves;
|
||||
|
||||
import api.ContentAPI;
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.node.entity.skill.agility.AgilityHandler;
|
||||
import core.game.interaction.OptionHandler;
|
||||
|
|
@ -10,60 +11,199 @@ import core.game.world.map.Direction;
|
|||
import core.game.world.map.Location;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.plugin.Plugin;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Handles all the agility obstacles for Roving Elves.
|
||||
* @author Splinter
|
||||
* @authors Splinter & downthecrop
|
||||
*/
|
||||
public final class RovingElvesObstacles extends OptionHandler {
|
||||
|
||||
// TODO: TRIPWIRE
|
||||
//Messages
|
||||
private String LEAF_SUCCESS_MSG = "You safely jump across.";
|
||||
private String LEAF_LADDER_MSG = "You climb out of the pit.";
|
||||
private String STICK_SUCCESS_MSG = "You manage to skillfully pass the trap.";
|
||||
private String WIRE_SUCCESS_MSG = "You successfully step over the tripwire.";
|
||||
|
||||
private final Animation OVER = new Animation(839);
|
||||
private final Animation THROUGH = new Animation(1237);
|
||||
private final Animation STICK_TRAP = new Animation(819);
|
||||
private final Animation LEAF_TRAP = new Animation(1115);
|
||||
private final Animation WIRE_TRAP = new Animation(1236);
|
||||
|
||||
private final Location STICK_TRAP_NORTH = new Location(0,2,0);
|
||||
private final Location STICK_TRAP_SOUTH = new Location(0,-1,0);
|
||||
private final Location STICK_TRAP_EAST = new Location(2,0,0);
|
||||
private final Location STICK_TRAP_WEST = new Location(-1,0,0);
|
||||
|
||||
private final Location WIRE_TRAP_NORTH = new Location(0,2,0);
|
||||
private final Location WIRE_TRAP_SOUTH = new Location(0,-1,0);
|
||||
private final Location WIRE_TRAP_EAST = new Location(2,0,0);
|
||||
private final Location WIRE_TRAP_WEST = new Location(-1,0,0);
|
||||
|
||||
private final Location FOREST_NORTH = new Location(0,2,0);
|
||||
private final Location FOREST_SOUTH = new Location(0,-1,0);
|
||||
private final Location FOREST_EAST = new Location(2,0,0);
|
||||
private final Location FOREST_WEST = new Location(-1,0,0);
|
||||
|
||||
private final Location LEAF_TRAP_CLIMB = new Location(2274, 3172, 0);
|
||||
|
||||
private final List<Integer> illegalJumpsY = Arrays.asList(3174);
|
||||
|
||||
private Location nodeCenter(Node node){
|
||||
if(node.asScenery().getRotation() % 2 == 0)
|
||||
return node.getLocation().transform(1,0,0);
|
||||
return node.getLocation().transform(0,1,0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
SceneryDefinition.forId(3922).getHandlers().put("option:pass", this);
|
||||
SceneryDefinition.forId(3999).getHandlers().put("option:enter", this);
|
||||
SceneryDefinition.forId(3939).getHandlers().put("option:enter", this);
|
||||
SceneryDefinition.forId(3921).getHandlers().put("option:step-over", this);
|
||||
SceneryDefinition.forId(3998).getHandlers().put("option:enter", this);
|
||||
SceneryDefinition.forId(3938).getHandlers().put("option:enter", this);
|
||||
SceneryDefinition.forId(3937).getHandlers().put("option:enter", this);
|
||||
SceneryDefinition.forId(3924).getHandlers().put("option:jump", this);
|
||||
SceneryDefinition.forId(3925).getHandlers().put("option:jump", this);
|
||||
SceneryDefinition.forId(8742).getHandlers().put("option:pass", this);
|
||||
SceneryDefinition.forId(3927).getHandlers().put("option:climb",this);
|
||||
return this;
|
||||
}
|
||||
|
||||
final Animation OVER = new Animation(840);
|
||||
final Animation THROUGH = new Animation(749);
|
||||
final Animation JUMP = new Animation(3067);
|
||||
|
||||
@Override
|
||||
public boolean handle(final Player player, Node node, String option) {
|
||||
Direction NORTH_SOUTH = player.getLocation().getY() < node.getLocation().getY() ? Direction.NORTH : Direction.SOUTH;
|
||||
Direction EAST_WEST = player.getLocation().getX() > node.getLocation().getX() ? Direction.WEST : Direction.EAST;
|
||||
switch (node.getId()) {
|
||||
case 8742:
|
||||
player.teleport(player.getLocation().transform(EAST_WEST, 2));
|
||||
break;
|
||||
case 3999:
|
||||
AgilityHandler.forceWalk(player, -1, player.getLocation(), player.getLocation().transform(NORTH_SOUTH, 3), OVER, 25, 0, null);
|
||||
break;
|
||||
case 3939:
|
||||
case 3998:
|
||||
case 3938:
|
||||
if (node.getLocation().equals(new Location(2235, 3148)) || node.getLocation().equals(new Location(2238, 3148)) || node.getLocation().equals(new Location(2236, 3218)) || node.getLocation().equals(new Location(2230, 3218)) || node.getLocation().equals(new Location(2227, 3218))) {
|
||||
AgilityHandler.forceWalk(player, -1, player.getLocation(), player.getLocation().transform(EAST_WEST, 3), THROUGH, 25, 0, null);
|
||||
} else {
|
||||
AgilityHandler.forceWalk(player, -1, player.getLocation(), player.getLocation().transform(NORTH_SOUTH, 3), THROUGH, 25, 0, null);
|
||||
}
|
||||
break;
|
||||
case 3937:
|
||||
AgilityHandler.forceWalk(player, -1, player.getLocation(), player.getLocation().transform(EAST_WEST, 3), OVER, 25, 0, null);
|
||||
break;
|
||||
case 3924:
|
||||
case 3925:
|
||||
AgilityHandler.forceWalk(player, -1, player.getLocation(), player.getLocation().transform(NORTH_SOUTH, 4), JUMP, 25, 0, null);
|
||||
break;
|
||||
|
||||
player.lock(5);
|
||||
player.faceLocation(node.asScenery().getLocation());
|
||||
Boolean isNorthOrSouth = true;
|
||||
|
||||
if (node.getId() == 3922 && node.asScenery().getRotation() % 2 == 0){
|
||||
//Facing East or West Stick Trap
|
||||
isNorthOrSouth = false;
|
||||
} else if (node.asScenery().getRotation() % 2 != 0) {
|
||||
isNorthOrSouth = false;
|
||||
}
|
||||
|
||||
// Direction of the NODE in relation to the player
|
||||
Direction NORTH_SOUTH = player.getLocation().getY() <= node.getLocation().getY() ? Direction.NORTH : Direction.SOUTH;
|
||||
Direction EAST_WEST = player.getLocation().getX() <= node.getLocation().getX() ? Direction.EAST : Direction.WEST;
|
||||
|
||||
switch (node.getId()) {
|
||||
case 8742:
|
||||
player.teleport(player.getLocation().transform(EAST_WEST, 2));
|
||||
break;
|
||||
case 3999:
|
||||
AgilityHandler.forceWalk(player, -1, player.getLocation(),
|
||||
player.getLocation().transform(NORTH_SOUTH, 3), OVER, 25, 0, null);
|
||||
break;
|
||||
//Wire Trap
|
||||
case 3921:
|
||||
if (isNorthOrSouth) {
|
||||
if (NORTH_SOUTH == Direction.NORTH)
|
||||
AgilityHandler.forceWalk(player, -1, node.getLocation().transform(WIRE_TRAP_SOUTH),
|
||||
node.getLocation().transform(WIRE_TRAP_NORTH), WIRE_TRAP, 100, 0, WIRE_SUCCESS_MSG);
|
||||
else
|
||||
AgilityHandler.forceWalk(player, -1, node.getLocation().transform(WIRE_TRAP_NORTH),
|
||||
node.getLocation().transform(WIRE_TRAP_SOUTH), WIRE_TRAP, 100, 0, WIRE_SUCCESS_MSG);
|
||||
} else {
|
||||
if (EAST_WEST == Direction.EAST)
|
||||
AgilityHandler.forceWalk(player, -1, node.getLocation().transform(WIRE_TRAP_WEST),
|
||||
node.getLocation().transform(WIRE_TRAP_EAST), WIRE_TRAP, 100, 0, WIRE_SUCCESS_MSG);
|
||||
else
|
||||
AgilityHandler.forceWalk(player, -1, node.getLocation().transform(WIRE_TRAP_EAST),
|
||||
node.getLocation().transform(WIRE_TRAP_WEST), WIRE_TRAP, 100, 0, WIRE_SUCCESS_MSG);
|
||||
}
|
||||
break;
|
||||
//Stick Trap
|
||||
case 3922:
|
||||
if (isNorthOrSouth) {
|
||||
if (NORTH_SOUTH == Direction.NORTH)
|
||||
AgilityHandler.forceWalk(player, -1, node.getLocation(),
|
||||
node.getLocation().transform(STICK_TRAP_NORTH), STICK_TRAP, 25, 0, STICK_SUCCESS_MSG);
|
||||
else
|
||||
AgilityHandler.forceWalk(player, -1, node.getLocation(),
|
||||
node.getLocation().transform(STICK_TRAP_SOUTH), STICK_TRAP, 25, 0, STICK_SUCCESS_MSG);
|
||||
} else {
|
||||
if (EAST_WEST == Direction.EAST)
|
||||
AgilityHandler.forceWalk(player, -1, node.getLocation().transform(STICK_TRAP_WEST),
|
||||
node.getLocation().transform(STICK_TRAP_EAST), STICK_TRAP, 25, 0, STICK_SUCCESS_MSG);
|
||||
else
|
||||
AgilityHandler.forceWalk(player, -1, node.getLocation().transform(STICK_TRAP_EAST),
|
||||
node.getLocation().transform(STICK_TRAP_WEST), STICK_TRAP, 25, 0, STICK_SUCCESS_MSG);
|
||||
}
|
||||
break;
|
||||
// Dense Forest
|
||||
case 3998:
|
||||
case 3939:
|
||||
case 3938:
|
||||
if (isNorthOrSouth) {
|
||||
if (NORTH_SOUTH == Direction.NORTH)
|
||||
AgilityHandler.forceWalk(player, -1, nodeCenter(node).transform(FOREST_SOUTH),
|
||||
nodeCenter(node).transform(FOREST_NORTH), THROUGH, 25, 0, null);
|
||||
else
|
||||
AgilityHandler.forceWalk(player, -1, nodeCenter(node).transform(FOREST_NORTH),
|
||||
nodeCenter(node).transform(FOREST_SOUTH), THROUGH, 25, 0, null);
|
||||
} else {
|
||||
if (EAST_WEST == Direction.EAST)
|
||||
AgilityHandler.forceWalk(player, -1, nodeCenter(node).transform(FOREST_WEST),
|
||||
nodeCenter(node).transform(FOREST_EAST), THROUGH, 25, 0, null);
|
||||
else
|
||||
AgilityHandler.forceWalk(player, -1, nodeCenter(node).transform(FOREST_EAST),
|
||||
nodeCenter(node).transform(FOREST_WEST), THROUGH, 25, 0, null);
|
||||
}
|
||||
break;
|
||||
// Climb Over Dense Forest
|
||||
case 3937:
|
||||
if (isNorthOrSouth) {
|
||||
if (NORTH_SOUTH == Direction.NORTH)
|
||||
AgilityHandler.forceWalk(player, -1, nodeCenter(node).transform(FOREST_SOUTH),
|
||||
nodeCenter(node).transform(FOREST_NORTH), OVER, 25, 0, null);
|
||||
else
|
||||
AgilityHandler.forceWalk(player, -1, nodeCenter(node).transform(FOREST_NORTH),
|
||||
nodeCenter(node).transform(FOREST_SOUTH), OVER, 25, 0, null);
|
||||
} else {
|
||||
if (EAST_WEST == Direction.EAST)
|
||||
AgilityHandler.forceWalk(player, -1, nodeCenter(node).transform(FOREST_WEST),
|
||||
nodeCenter(node).transform(FOREST_EAST), OVER, 25, 0, null);
|
||||
else
|
||||
AgilityHandler.forceWalk(player, -1, nodeCenter(node).transform(FOREST_EAST),
|
||||
nodeCenter(node).transform(FOREST_WEST), OVER, 25, 0, null);
|
||||
}
|
||||
break;
|
||||
// Leaf Trap Center
|
||||
case 3924:
|
||||
if(!illegalJumpsY.contains(player.getLocation().getY())){
|
||||
if (isNorthOrSouth) {
|
||||
AgilityHandler.forceWalk(player, -1, node.getLocation().transform(NORTH_SOUTH,-1),
|
||||
node.getLocation().transform(NORTH_SOUTH, 2), LEAF_TRAP, 25, 0, LEAF_SUCCESS_MSG);
|
||||
} else {
|
||||
AgilityHandler.forceWalk(player, -1, node.getLocation().transform(EAST_WEST,-2),
|
||||
node.getLocation().transform(EAST_WEST, 2), LEAF_TRAP, 25, 0, LEAF_SUCCESS_MSG);
|
||||
}
|
||||
}
|
||||
break;
|
||||
// Leaf Trap Edges
|
||||
case 3925:
|
||||
if(!illegalJumpsY.contains(node.getLocation().getY())){
|
||||
if (!isNorthOrSouth) {
|
||||
AgilityHandler.forceWalk(player, -1, node.getLocation().transform(NORTH_SOUTH,-1),
|
||||
node.getLocation().transform(NORTH_SOUTH, 3), LEAF_TRAP, 25, 0, LEAF_SUCCESS_MSG);
|
||||
} else {
|
||||
AgilityHandler.forceWalk(player, -1, nodeCenter(node).transform(EAST_WEST,-1),
|
||||
node.getLocation().transform(EAST_WEST, 3), LEAF_TRAP, 25, 0, LEAF_SUCCESS_MSG);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3927:
|
||||
player.teleport(LEAF_TRAP_CLIMB);
|
||||
ContentAPI.sendMessage(player,LEAF_LADDER_MSG);
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue