GeoData.java 3.7 KB

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