Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.45 KB | None | 0 0
  1. package com.prime.api.game.hybrid.location;
  2.  
  3. import com.runemate.game.api.hybrid.Environment;
  4. import com.runemate.game.api.hybrid.entities.details.Locatable;
  5. import com.runemate.game.api.hybrid.location.Area;
  6. import com.runemate.game.api.hybrid.location.Coordinate;
  7. import com.runemate.game.api.hybrid.region.Players;
  8. import com.runemate.game.api.hybrid.util.calculations.Distance;
  9.  
  10. /**
  11. * BankLocation
  12. *
  13. * @author Torben Schmitz
  14. */
  15. public enum BankLocation implements Locatable {
  16. NONE("None", Type.NONE, null, null),
  17. AL_KHARID("Al Kharid", Type.FULL, new Coordinate(3270, 3168, 0), new Coordinate(3270, 3167, 0)),
  18. APE_ATOLL_SOUTH("Ape Atoll", Type.DEPOSIT, new Coordinate(3047, 3237, 0), new Coordinate(3047, 3237, 0)),
  19. ARDOUGNE_EAST("Ardougne East", Type.FULL, new Coordinate(2655, 3283, 0), new Coordinate(2655, 3283, 0)),
  20. BARBARIAN_OUTPOST("Barbarian outpost", Type.FULL, new Coordinate(2536, 3572, 0), new Coordinate(2536, 3572, 0)),
  21. BURGH_DE_ROTT("Burgh de Rott", Type.FULL, new Coordinate(3495, 3211, 0), new Coordinate(3495, 3211, 0)),
  22. BURTHORPE("Burthorpe", Type.FULL, new Coordinate(2888, 3536, 0), null),
  23. CATHERBY("Catherby", Type.FULL, new Coordinate(2795, 3440, 0), new Coordinate(2809, 3440, 0)),
  24. CASTLE_WARS("Castle Wars", Type.FULL, new Coordinate(2446, 3085, 0), new Coordinate(2442, 3085, 0)),
  25. CLAN_CAMP_FALADOR("Clan camp Falador", Type.FULL, new Coordinate(2956, 3297, 0), null),
  26. DRAYNOR_VILLAGE("Draynor Village", Type.FULL, new Coordinate(3092, 3244, 0), new Coordinate(3092, 3244, 0)),
  27. DUEL_ARENA("Duel Arena", Type.FULL, new Coordinate(3349, 3238, 0), new Coordinate(3349, 3238, 0)),
  28. EDGEVILLE("Edgeville", Type.FULL, new Coordinate(3094, 3493, 0), new Coordinate(3094, 3493, 0)),
  29. FALADOR_EAST("Falador East", Type.FULL, new Coordinate(3012, 3355, 0), new Coordinate(3012, 3355, 0)),
  30. FALADOR_WEST("Falador West", Type.FULL, new Coordinate(2946, 3368, 0), new Coordinate(2946, 3368, 0)),
  31. FISHING_GUILD("Fishing Guild", Type.FULL, new Coordinate(2585, 3422, 0), new Coordinate(2587, 3419, 0)),
  32. GRAND_EXCHANGE("Grand Exchange", Type.FULL, new Coordinate(3151, 3480, 0), new Coordinate(3151, 3480, 0)),
  33. HOSIDIUS_EAST("Hosidius East", Type.FULL, null, new Coordinate(1807, 3571, 0) ),
  34. HOSIDIUS_SOUTH("Hosidius South", Type.FULL, null, new Coordinate(1719, 3465, 0) ),
  35. KARAMJA("Stiles", Type.SPECIAL, new Coordinate(2851, 3143, 0), new Coordinate(3045, 3234, 0)),
  36. LANDS_END("Land's end", Type.FULL, null, new Coordinate(1512, 3421, 0)),
  37. LIVING_ROCK_CAVERNS("Living Rock Caverns", Type.SPECIAL, new Coordinate(3654, 5114, 0), null),
  38. LUMBRIDGE_CASTLE("Lumbridge Castle", Type.FULL, new Coordinate(3208, 3220, 2), new Coordinate(3208, 3220, 2)),
  39. LUMBRIDGE_COMBAT_ACADEMY("Lumbridge Combat Academy", Type.FULL, new Coordinate(3215, 3257, 0), null),
  40. MENAPHOS_PORT_DISTRICT("Menaphos - Port district", Type.DEPOSIT, new Coordinate(3217, 2622, 0), null),
  41. MENAPHOS_MERCHANT_DISTRICT("Menaphos - Merchant district", Type.FULL, new Coordinate(3236, 2759, 0), null),
  42. MOR_UL_REK("Mor Ul Rek", Type.FULL, null, new Coordinate(2542, 5140, 0)),
  43. PISCARILIUS("Piscarilius (Zeah)", Type.FULL, null, new Coordinate(1804, 3790, 0)),
  44. PISCATORIS("Piscatoris", Type.FULL, new Coordinate(2330, 3690, 0), new Coordinate(2330, 3690, 0)),
  45. PORT_PHASMATYS("Port Phasmatys", Type.FULL, null, new Coordinate(3690, 3466, 0)),
  46. PORT_SARIM("Port Sarim", Type.DEPOSIT, new Coordinate(3045, 3234, 0), new Coordinate(3045, 3234, 0)),
  47. PRIFDDINAS_WATERFALL("Prifddinas Waterfall", Type.FULL, new Coordinate(2293, 3404, 2), null),
  48. SEERS_VILLAGE("Seer's Village", Type.FULL, new Coordinate(2727, 3494, 0), new Coordinate(2725, 3492, 0)),
  49. SHILO_VILLAGE("Shilo Village", Type.FULL, new Coordinate(2853, 2955, 0), new Coordinate(2853, 2955, 0)),
  50. VARROCK_EAST("Varrock East", Type.FULL, null, new Coordinate(3253, 3420, 0)),
  51. VARROCK_WEST("Varrock West", Type.FULL, new Coordinate(3190, 3435, 0), new Coordinate(3183, 3439, 0)),
  52. WAIKO("Waiko (The Arc)", Type.FULL, new Coordinate(1831, 11613, 0), null),
  53. WHALES_MAW("Whale's Maw (The Arc)", Type.DEPOSIT, new Coordinate(2058, 11781, 0), null),
  54. WOODCUTTING_GUILD("Woodcutting Guild", Type.FULL, new Coordinate(1592, 3476, 0), new Coordinate(1592, 3476, 0)),
  55. YANILLE("Yanille", Type.FULL, new Coordinate(2612, 3093, 0), new Coordinate(2612, 3093, 0)),
  56. ZUL_ANDRA("Zul-Andra", Type.DEPOSIT, null, new Coordinate(2196, 3052, 0));
  57.  
  58. private final String name;
  59. private final Type type;
  60. private final Coordinate rs3Coordinate, osrsCoordinate;
  61.  
  62. BankLocation(String name, Type type, Coordinate rs3Coordinate, Coordinate osrsCoordinate) {
  63. this.name = name;
  64. this.type = type;
  65. this.rs3Coordinate = rs3Coordinate;
  66. this.osrsCoordinate = osrsCoordinate;
  67. }
  68.  
  69. public String getName() {
  70. return name;
  71. }
  72.  
  73. @Override
  74. public String toString() {
  75. return name;
  76. }
  77.  
  78. @Override
  79. public Coordinate getPosition() {
  80. return Environment.isOSRS() ? osrsCoordinate : rs3Coordinate;
  81. }
  82.  
  83. @Override
  84. public Area.Rectangular getArea() {
  85. return new Area.Rectangular(getPosition());
  86. }
  87.  
  88. @Override
  89. public Coordinate.HighPrecision getHighPrecisionPosition() {
  90. return getPosition().getHighPrecisionPosition();
  91. }
  92.  
  93. public static BankLocation getNearest() {
  94. return getNearest(false);
  95. }
  96.  
  97. public static BankLocation getNearest(boolean ignorePlane) {
  98. double distance = -1;
  99. BankLocation selected = null;
  100. Coordinate playerPosition = Players.getLocal().getPosition();
  101. for (BankLocation bankLocation : BankLocation.values()) {
  102. Coordinate bankPosition = bankLocation.getPosition();
  103. if (bankPosition != null) {
  104. if (bankPosition.getPlane() != playerPosition.getPlane()) {
  105. if (ignorePlane) {
  106. bankPosition = new Coordinate(bankPosition.getX(), bankPosition.getY(), playerPosition.getPlane());
  107. } else {
  108. continue;
  109. }
  110. }
  111. double to = Distance.between(playerPosition, bankPosition);
  112. if (distance == -1 || to < distance) {
  113. distance = to;
  114. selected = bankLocation;
  115. }
  116. }
  117. }
  118. return selected;
  119. }
  120.  
  121. public Type getType() {
  122. return type;
  123. }
  124.  
  125. public enum Type {
  126. NONE, DEPOSIT, FULL, SPECIAL
  127. }
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement