Edgeville Dungeon Gate

This commit is contained in:
downthecrop 2021-10-21 20:55:48 +00:00 committed by Ceikry
parent a2c1953010
commit 1e35173fcc
2 changed files with 36 additions and 5 deletions

View file

@ -2,7 +2,9 @@ package core.game.interaction.city;
import api.ContentAPI;
import core.cache.def.impl.SceneryDefinition;
import core.game.component.Component;
import core.game.content.global.action.ClimbActionHandler;
import core.game.content.global.action.DoorActionHandler;
import core.game.interaction.OptionHandler;
import core.game.node.Node;
import core.game.node.entity.player.Player;
@ -29,8 +31,12 @@ public final class EdgevilleNodePlugin extends OptionHandler {
SceneryDefinition.forId(30806).getHandlers().put("option:take-seed", this);
SceneryDefinition.forId(12265).getHandlers().put("option:climb", this);
SceneryDefinition.forId(12266).getHandlers().put("option:open", this);
//Dungeon Wilderness gates
SceneryDefinition.forId(29319).getHandlers().put("option:open", this);
SceneryDefinition.forId(29320).getHandlers().put("option:open", this);
SceneryDefinition.forId(12266).getHandlers().put("option:open", this);
SceneryDefinition.forId(26933).getHandlers().put("option:open", this);
SceneryDefinition.forId(26934).getHandlers().put("option:close", this);
SceneryDefinition.forId(26934).getHandlers().put("option:climb-down", this);
@ -72,6 +78,19 @@ public final class EdgevilleNodePlugin extends OptionHandler {
ContentAPI.sendMessage(player, "You climb down through the trapdoor...");
ClimbActionHandler.climbLadder(player, (Scenery) node, option);
}
break;
case 29319:
case 29320: // Edgeville Dungeon wilderness entrance
if (option.equalsIgnoreCase("open") && player.getLocation().getY() < 9918) {
Location endLocation = new Location(player.getLocation().getX(),player.getLocation().getY()+1);
player.getInterfaceManager().open(new Component(382));
player.setAttribute("wildy_gate", node);
player.setAttribute("wildy_gate_loc",endLocation);
}
else{ // Leaving the wilderness
Location endLocation = new Location(player.getLocation().getX(),player.getLocation().getY()-1);
DoorActionHandler.handleAutowalkDoor(player, (Scenery) node,endLocation);
}
}
return true;
}

View file

@ -3,6 +3,7 @@ package core.game.interaction.object.wildyditch;
import core.game.component.Component;
import core.game.component.ComponentDefinition;
import core.game.component.ComponentPlugin;
import core.game.content.global.action.DoorActionHandler;
import core.game.node.entity.impl.ForceMovement;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.audio.Audio;
@ -35,7 +36,10 @@ public final class WildernessInterfacePlugin extends ComponentPlugin {
if (button != 18) {
return true;
}
handleDitch(player);
if (player.getAttribute("wildy_ditch") != null)
handleDitch(player);
else if(player.getAttribute("wildy_gate") != null)
handleGate(player);
return true;
}
@ -45,9 +49,6 @@ public final class WildernessInterfacePlugin extends ComponentPlugin {
*/
public static void handleDitch(final Player player) {
Scenery ditch = player.getAttribute("wildy_ditch");
if (ditch == null) {
return;
}
player.removeAttribute("wildy_ditch");
Location l = ditch.getLocation();
int x = player.getLocation().getX();
@ -71,4 +72,15 @@ public final class WildernessInterfacePlugin extends ComponentPlugin {
ActivityManager.register(new BountyHunterActivity(CraterType.HIGH_LEVEL));
}*/
}
public static void handleGate(final Player player){
Scenery gate = player.getAttribute("wildy_gate");
Location endLocation = player.getAttribute("wildy_gate_loc");
// Cleanup
player.removeAttribute("wildy_gate");
player.removeAttribute("wildy_gate_loc");
// Move player through gate/door
DoorActionHandler.handleAutowalkDoor(player,gate,endLocation);
}
}