GeoData.java 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package net.sf.l2j.gameserver;
  16. import java.util.logging.Logger;
  17. import net.sf.l2j.Config;
  18. import net.sf.l2j.gameserver.model.L2Object;
  19. import net.sf.l2j.gameserver.model.Location;
  20. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  21. /**
  22. *
  23. * @author -Nemesiss-
  24. */
  25. public class GeoData
  26. {
  27. private static Logger _log = Logger.getLogger(GeoData.class.getName());
  28. private static GeoData _instance;
  29. public static GeoData getInstance()
  30. {
  31. if(_instance == null)
  32. {
  33. if (Config.GEODATA > 0)
  34. _instance = GeoEngine.getInstance();
  35. else
  36. {
  37. _instance = new GeoData();
  38. _log.info("Geodata Engine: Disabled.");
  39. }
  40. }
  41. return _instance;
  42. }
  43. // Public Methods
  44. /**
  45. * @param x
  46. * @param y
  47. * @return Geo Block Type
  48. */
  49. public short getType (int x, int y)
  50. {
  51. return 0;
  52. }
  53. /**
  54. * @param x
  55. * @param y
  56. * @param z
  57. * @return Nearles Z
  58. */
  59. public short getHeight(int x, int y, int z)
  60. {
  61. return (short)z;
  62. }
  63. /**
  64. * @param x
  65. * @param y
  66. * @param zmin
  67. * @param zmax
  68. * @param spawnid
  69. * @return
  70. */
  71. public short getSpawnHeight(int x, int y, int zmin, int zmax, int spawnid)
  72. {
  73. return (short)zmin;
  74. }
  75. /**
  76. * @param x
  77. * @param y
  78. * @return
  79. */
  80. public String geoPosition(int x, int y)
  81. {
  82. return "";
  83. }
  84. /**
  85. * @param cha
  86. * @param target
  87. * @return True if cha can see target (LOS)
  88. */
  89. public boolean canSeeTarget(L2Object cha, L2Object target)
  90. {
  91. //If geo is off do simple check :]
  92. //Don't allow casting on players on different dungeon lvls etc
  93. return (Math.abs(target.getZ() - cha.getZ()) < 1000);
  94. }
  95. /**
  96. * @param cha
  97. * @param target
  98. * @return True if cha can see target (LOS) and send usful info to PC
  99. */
  100. public boolean canSeeTargetDebug(L2PcInstance gm, L2Object target)
  101. {
  102. return true;
  103. }
  104. /**
  105. * @param x
  106. * @param y
  107. * @param z
  108. * @return Geo NSWE (0-15)
  109. */
  110. public short getNSWE(int x, int y, int z)
  111. {
  112. return 15;
  113. }
  114. /**
  115. * @param x
  116. * @param y
  117. * @param z
  118. * @param tx
  119. * @param ty
  120. * @param tz
  121. * @return Last Location (x,y,z) where player can walk - just befor wall
  122. */
  123. public Location moveCheck(int x, int y, int z, int tx, int ty, int tz)
  124. {
  125. return new Location(tx,ty,tz);
  126. }
  127. /**
  128. * @param gm
  129. * @param comment
  130. */
  131. public void addGeoDataBug(L2PcInstance gm, String comment)
  132. {
  133. //Do Nothing
  134. }
  135. public static void unloadGeodata(byte rx, byte ry)
  136. {
  137. }
  138. @Deprecated //TODO: cleanup?
  139. public static boolean loadGeodataFile(byte rx, byte ry)
  140. {
  141. return false;
  142. }
  143. }