add lava titan teleport to lava maze (near kbd lair)

This commit is contained in:
vk 2021-10-03 20:12:31 +00:00 committed by Ceikry
parent 9354ce886d
commit ae2b9240ea
2 changed files with 101 additions and 0 deletions

View file

@ -0,0 +1,73 @@
package core.game.content.dialogue;
import core.game.node.entity.npc.NPC;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.TeleportManager.TeleportType;
import core.game.node.entity.skill.summoning.familiar.Familiar;
import core.game.world.map.Location;
import core.game.world.map.zone.impl.WildernessZone;
import core.plugin.Initializable;
/**
* Represents the lava titan's dialogue
*/
@Initializable
public final class LavaTitanDialogue extends DialoguePlugin {
public LavaTitanDialogue() {
}
/**
* Constructs a new {@code LavaTitanDialogue} {@code Object}.
* @param player the player.
*/
public LavaTitanDialogue(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new LavaTitanDialogue(player);
}
@Override
public boolean open(Object... args) {
npc = (NPC) args[0];
if (!(npc instanceof Familiar)) {
return false;
}
final Familiar fam = (Familiar) npc;
if (fam.getOwner() != player) {
player.getPacketDispatch().sendMessage("This is not your familiar.");
return true;
} else {
interpreter.sendOptions("Select an Option", "Chat", "Teleport to Lava Maze");
}
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (buttonId) {
case 1:
player.sendMessage("The lava titan does not feel like talking now.");
end();
break;
case 2:
if (!WildernessZone.checkTeleport(player, 20)) {
player.sendMessage("You cannot teleport with the Lava Titan above level 20 wilderness.");
end();
} else {
player.getTeleporter().send(new Location(3048, 3820), TeleportType.NORMAL);
end();
}
break;
}
return true;
}
@Override
public int[] getIds() {
return new int[] { 8700 };
}
}

View file

@ -0,0 +1,28 @@
package core.game.interaction.npc;
import core.cache.def.impl.NPCDefinition;
import core.game.interaction.OptionHandler;
import core.game.node.Node;
import core.game.node.entity.player.Player;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the plugin used to handle the lava titan familiar
*/
@Initializable
public final class LavaTitanOptionPlugin extends OptionHandler {
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
NPCDefinition.forId(7341).getHandlers().put("option:interact", this);
return this;
}
@Override
public boolean handle(final Player player, Node node, String option) {
player.getDialogueInterpreter().open(8700, node.asNpc());
return true;
}
}