GeoNodeLoc.java 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * Copyright (C) 2004-2014 L2J Server
  3. *
  4. * This file is part of L2J Server.
  5. *
  6. * L2J Server is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J Server is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package com.l2jserver.gameserver.pathfinding.geonodes;
  20. import com.l2jserver.gameserver.model.L2World;
  21. import com.l2jserver.gameserver.pathfinding.AbstractNodeLoc;
  22. /**
  23. * @author -Nemesiss-
  24. */
  25. public class GeoNodeLoc extends AbstractNodeLoc
  26. {
  27. private final short _x;
  28. private final short _y;
  29. private final short _z;
  30. public GeoNodeLoc(short x, short y, short z)
  31. {
  32. _x = x;
  33. _y = y;
  34. _z = z;
  35. }
  36. @Override
  37. public int getX()
  38. {
  39. return L2World.MAP_MIN_X + (_x * 128) + 48;
  40. }
  41. @Override
  42. public int getY()
  43. {
  44. return L2World.MAP_MIN_Y + (_y * 128) + 48;
  45. }
  46. @Override
  47. public int getZ()
  48. {
  49. return _z;
  50. }
  51. @Override
  52. public void setZ(short z)
  53. {
  54. //
  55. }
  56. @Override
  57. public int getNodeX()
  58. {
  59. return _x;
  60. }
  61. @Override
  62. public int getNodeY()
  63. {
  64. return _y;
  65. }
  66. @Override
  67. public int hashCode()
  68. {
  69. final int prime = 31;
  70. int result = 1;
  71. result = (prime * result) + _x;
  72. result = (prime * result) + _y;
  73. result = (prime * result) + _z;
  74. return result;
  75. }
  76. @Override
  77. public boolean equals(Object obj)
  78. {
  79. if (this == obj)
  80. {
  81. return true;
  82. }
  83. if (obj == null)
  84. {
  85. return false;
  86. }
  87. if (!(obj instanceof GeoNodeLoc))
  88. {
  89. return false;
  90. }
  91. final GeoNodeLoc other = (GeoNodeLoc) obj;
  92. if (_x != other._x)
  93. {
  94. return false;
  95. }
  96. if (_y != other._y)
  97. {
  98. return false;
  99. }
  100. if (_z != other._z)
  101. {
  102. return false;
  103. }
  104. return true;
  105. }
  106. }