Properly handled Rellekka's sailing map

This commit is contained in:
Ceikry
2021-07-09 23:12:56 +00:00
parent 0164ddae8a
commit 4d52be73fd
11 changed files with 204 additions and 53 deletions
@@ -4,6 +4,8 @@ import core.game.content.dialogue.DialoguePlugin;
import core.game.node.entity.npc.NPC;
import core.game.node.entity.player.Player;
import core.game.world.map.Location;
import rs09.game.util.region.rellekka.RellekkaDestination;
import rs09.game.util.region.rellekka.RellekkaUtils;
/**
* Handles the maria gunnars dialogue.
@@ -62,9 +64,9 @@ public class MariaGunnarsDialogue extends DialoguePlugin {
break;
case 3:
if (npc.getId() == 5508) {
RellekkaZone.sail(player, "Relleka", new Location(2310, 3782, 0));
RellekkaUtils.sail(player, RellekkaDestination.RELLEKKA_TO_NEITIZNOT);
} else {
RellekkaZone.sail(player, "Neitiznot", new Location(2644, 3710, 0));
RellekkaUtils.sail(player, RellekkaDestination.NEITIZNOT_TO_RELLEKKA);
}
end();
break;
@@ -49,13 +49,11 @@ public final class RellekkaZone extends MapZone implements Plugin<Object> {
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
NPCDefinition.forId(5507).getHandlers().put("option:ferry-rellekka", this);
return this;
}
@Override
public boolean handle(Player player, Node node, String option) {
sail(player, "Relleka", new Location(2644, 3710, 0));
return true;
}
@@ -107,11 +105,6 @@ public final class RellekkaZone extends MapZone implements Plugin<Object> {
return true;
}
break;
case 5508:
if (option.getName().equals("Ferry-Neitiznot")) {
sail(player, "Neitiznot", new Location(2310, 3782, 0));
}
return true;
}
}
return super.interact(e, target, option);
@@ -127,35 +120,6 @@ public final class RellekkaZone extends MapZone implements Plugin<Object> {
register(new ZoneBorders(2602, 3639, 2739, 3741));
}
/**
* Sails a player using the relleka ships.
* @param player the player.
* @param name the name.
* @param destination the destination.
*/
public static void sail(final Player player, final String name, final Location destination) {
player.lock();
player.getInterfaceManager().open(new Component(224));
player.addExtension(LogoutTask.class, new LocationLogoutTask(5, destination));
GameWorld.getPulser().submit(new Pulse(1, player) {
int count;
@Override
public boolean pulse() {
switch (++count) {
case 5:
player.unlock();
player.getInterfaceManager().close();
player.getProperties().setTeleportLocation(destination);
player.getDialogueInterpreter().sendDialogue("The ship arrives at " + name + ".");
return true;
}
return false;
}
});
}
/**
* Handles options related to relleka.
* @author Vexia
@@ -5,6 +5,8 @@ import core.game.node.entity.npc.NPC;
import core.game.node.entity.player.Player;
import core.game.world.map.Location;
import static rs09.tools.DialogueConstKt.END_DIALOGUE;
/**
* Handles the sailor dialogue.
* @author Vexia
@@ -40,7 +42,7 @@ public final class SailorDialogue extends DialoguePlugin {
public boolean open(Object... args) {
npc = (NPC) args[0];
rellekaNpc = npc.getId() == 1385;
player("Hello. Can I get a ride on your ship?");
player("Ship's closed due to stingrays?");
return true;
}
@@ -48,8 +50,10 @@ public final class SailorDialogue extends DialoguePlugin {
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
npc("Hello again, brother " + player.getUsername() + ". If you're ready to jump", "aboard, we're all ready to set sail with the tide!");
stage++;
npc("Yes.");
stage = END_DIALOGUE;
//npc("Hello again, brother " + player.getUsername() + ". If you're ready to jump", "aboard, we're all ready to set sail with the tide!");
//stage++;
break;
case 1:
player("Let's go!");
@@ -59,7 +63,7 @@ public final class SailorDialogue extends DialoguePlugin {
end();
player.lock();
player.sendMessage("You board the longship...");
RellekkaZone.sail(player, rellekaNpc ? "Miscellania" : "Rellekka", rellekaNpc ? Location.create(2581, 3845, 0) : Location.create(2629, 3693, 0));
//RellekkaZone.sail(player, rellekaNpc ? "Miscellania" : "Rellekka", rellekaNpc ? Location.create(2581, 3845, 0) : Location.create(2629, 3693, 0));
break;
}
return true;