RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
Waypoints.java
1package com.osroyale.content;
2
3import com.osroyale.game.world.entity.mob.player.Player;
4import com.osroyale.game.world.position.Area;
5import com.osroyale.net.packet.out.SendMessage;
6
28
29public class Waypoints {
30
31 public static void setWaypoint(Player player, String waypointName) {
32 if(Area.inRestrictedArea(player)) {
33 player.message("You cannot set a waypoint here");
34 return;
35 }
36 if (player.waypoints.size() >= getAllowedPoints(player)) {
37 player.message("You have reached the maximum amount of waypoints allowed for your rank.");
38 return;
39 }
40 if (player.waypoints.containsKey(waypointName)) {
41 player.message("You already have a waypoint with this name.");
42 return;
43 }
44 player.waypoints.put(waypointName, player.getPosition().copy());
45 player.dialogueFactory.sendStatement("You have set a waypoint named " + waypointName + " at your current location.").execute();
46 }
47
48 public static void removeWaypoint (Player player, String waypointName) {
49 player.waypoints.remove(waypointName);
50 player.dialogueFactory.sendStatement("You have removed " + waypointName + " from your waypoints.").execute();
51 }
52 public static void getWaypoints(Player player) {
53 if (player.waypoints.isEmpty()) {
54 player.message("You have no waypoints set.");
55 return;
56 }
57 player.message("Current waypoints:");
58 player.waypoints.forEach((k, v) -> player.message("@red@" +k));
59 }
60 private static int getAllowedPoints(Player player) {
61 return switch (player.right.getName()) {
62 case "King Donator" -> 10;
63 case "Elite Donator" -> 8;
64 case "Extreme Donator" -> 6;
65 case "Super Donator" -> 4;
66 case "Donator" -> 2;
67 default -> 5;
68 };
69 }
70
71}
final DialogueFactory sendStatement(String... lines)