ZoneManager.java 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  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 com.l2jserver.gameserver.instancemanager;
  16. import java.io.File;
  17. import java.lang.reflect.Constructor;
  18. import java.util.Collection;
  19. import java.util.Iterator;
  20. import java.util.List;
  21. import java.util.Map;
  22. import java.util.logging.Level;
  23. import java.util.logging.Logger;
  24. import javax.xml.parsers.DocumentBuilderFactory;
  25. import javolution.util.FastList;
  26. import javolution.util.FastMap;
  27. import org.w3c.dom.Document;
  28. import org.w3c.dom.NamedNodeMap;
  29. import org.w3c.dom.Node;
  30. import com.l2jserver.Config;
  31. import com.l2jserver.gameserver.model.L2ItemInstance;
  32. import com.l2jserver.gameserver.model.L2Object;
  33. import com.l2jserver.gameserver.model.L2World;
  34. import com.l2jserver.gameserver.model.L2WorldRegion;
  35. import com.l2jserver.gameserver.model.actor.L2Character;
  36. import com.l2jserver.gameserver.model.zone.L2ZoneRespawn;
  37. import com.l2jserver.gameserver.model.zone.L2ZoneType;
  38. import com.l2jserver.gameserver.model.zone.form.ZoneCuboid;
  39. import com.l2jserver.gameserver.model.zone.form.ZoneCylinder;
  40. import com.l2jserver.gameserver.model.zone.form.ZoneNPoly;
  41. import com.l2jserver.gameserver.model.zone.type.L2ArenaZone;
  42. import com.l2jserver.gameserver.model.zone.type.L2OlympiadStadiumZone;
  43. import com.l2jserver.gameserver.model.zone.type.L2RespawnZone;
  44. /**
  45. * This class manages the zones
  46. *
  47. * @author durgus
  48. */
  49. public class ZoneManager
  50. {
  51. private static final Logger _log = Logger.getLogger(ZoneManager.class.getName());
  52. //private final FastMap<Integer, L2ZoneType> _zones = new FastMap<Integer, L2ZoneType>();
  53. private final Map<Class<? extends L2ZoneType>, Map<Integer, ? extends L2ZoneType>> _classZones = new FastMap<Class<? extends L2ZoneType>, Map<Integer, ? extends L2ZoneType>>();
  54. private int _lastDynamicId = 300000;
  55. private List<L2ItemInstance> _debugItems;
  56. public static final ZoneManager getInstance()
  57. {
  58. return SingletonHolder._instance;
  59. }
  60. // =========================================================
  61. // Data Field
  62. // =========================================================
  63. // Constructor
  64. private ZoneManager()
  65. {
  66. load();
  67. }
  68. @SuppressWarnings("deprecation")
  69. public void reload()
  70. {
  71. // int zoneCount = 0;
  72. // Get the world regions
  73. int count = 0;
  74. L2WorldRegion[][] worldRegions = L2World.getInstance().getAllWorldRegions();
  75. for (int x = 0; x < worldRegions.length; x++)
  76. {
  77. for (int y = 0; y < worldRegions[x].length; y++)
  78. {
  79. worldRegions[x][y].getZones().clear();
  80. count++;
  81. }
  82. }
  83. GrandBossManager.getInstance().getZones().clear();
  84. _log.info("Removed zones in " + count + " regions.");
  85. // Load the zones
  86. load();
  87. for (L2Object o : L2World.getInstance().getAllVisibleObjects().values())
  88. {
  89. if (o instanceof L2Character)
  90. ((L2Character) o).revalidateZone(true);
  91. }
  92. }
  93. // =========================================================
  94. // Method - Private
  95. private final void load()
  96. {
  97. _log.info("Loading zones...");
  98. _classZones.clear();
  99. // Get the world regions
  100. L2WorldRegion[][] worldRegions = L2World.getInstance().getAllWorldRegions();
  101. // Load the zone xml
  102. try
  103. {
  104. DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  105. factory.setValidating(false);
  106. factory.setIgnoringComments(true);
  107. final File dir = new File(Config.DATAPACK_ROOT, "data/zones");
  108. if (!dir.exists())
  109. {
  110. _log.config("Dir " + dir.getAbsolutePath() + " not exists");
  111. return;
  112. }
  113. File[] files = dir.listFiles();
  114. FastList<File> hash = new FastList<File>(files.length);
  115. for (File f : files)
  116. {
  117. // default file first
  118. if ("zone.xml".equalsIgnoreCase(f.getName()))
  119. hash.addFirst(f);
  120. else if (f.getName().endsWith(".xml"))
  121. hash.add(f);
  122. }
  123. Document doc;
  124. NamedNodeMap attrs;
  125. Node attribute;
  126. String zoneName;
  127. int[][] coords;
  128. int zoneId, minZ, maxZ;
  129. String zoneType, zoneShape;
  130. for (File f : hash)
  131. {
  132. doc = factory.newDocumentBuilder().parse(f);
  133. for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
  134. {
  135. if ("list".equalsIgnoreCase(n.getNodeName()))
  136. {
  137. attrs = n.getAttributes();
  138. attribute = attrs.getNamedItem("enabled");
  139. if (attribute != null && !Boolean.parseBoolean(attribute.getNodeValue()))
  140. continue;
  141. for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
  142. {
  143. if ("zone".equalsIgnoreCase(d.getNodeName()))
  144. {
  145. attrs = d.getAttributes();
  146. attribute = attrs.getNamedItem("id");
  147. if (attribute != null)
  148. zoneId = Integer.parseInt(attribute.getNodeValue());
  149. else
  150. zoneId = _lastDynamicId++;
  151. attribute = attrs.getNamedItem("name");
  152. if (attribute != null)
  153. zoneName = attribute.getNodeValue();
  154. else
  155. zoneName = null;
  156. attribute = attrs.getNamedItem("minZ");
  157. if (attribute != null)
  158. minZ = Integer.parseInt(attribute.getNodeValue());
  159. else
  160. {
  161. _log.warning("ZoneData: Missing minZ for zone: " + zoneId + " in file: " + f.getName());
  162. continue;
  163. }
  164. attribute = attrs.getNamedItem("maxZ");
  165. if (attribute != null)
  166. maxZ = Integer.parseInt(attribute.getNodeValue());
  167. else
  168. {
  169. _log.warning("ZoneData: Missing maxZ for zone: " + zoneId + " in file: " + f.getName());
  170. continue;
  171. }
  172. attribute = attrs.getNamedItem("type");
  173. if (attribute != null)
  174. zoneType = attribute.getNodeValue();
  175. else
  176. {
  177. _log.warning("ZoneData: Missing type for zone: " + zoneId + " in file: " + f.getName());
  178. continue;
  179. }
  180. attribute = attrs.getNamedItem("shape");
  181. if (attribute != null)
  182. zoneShape = attribute.getNodeValue();
  183. else
  184. {
  185. _log.warning("ZoneData: Missing shape for zone: " + zoneId + " in file: " + f.getName());
  186. continue;
  187. }
  188. // Create the zone
  189. Class<?> newZone;
  190. try
  191. {
  192. newZone = Class.forName("com.l2jserver.gameserver.model.zone.type.L2" + zoneType);
  193. }
  194. catch (ClassNotFoundException e)
  195. {
  196. _log.warning("ZoneData: No such zone type: " + zoneType + " in file: " + f.getName());
  197. continue;
  198. }
  199. Constructor<?> zoneConstructor = newZone.getConstructor(int.class);
  200. L2ZoneType temp = (L2ZoneType) zoneConstructor.newInstance(zoneId);
  201. // Get the zone shape from sql
  202. try
  203. {
  204. coords = null;
  205. int[] point;
  206. FastList<int[]> rs = FastList.newInstance();
  207. try
  208. {
  209. // loading from XML first
  210. for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
  211. {
  212. if ("node".equalsIgnoreCase(cd.getNodeName()))
  213. {
  214. attrs = cd.getAttributes();
  215. point = new int[2];
  216. point[0] = Integer.parseInt(attrs.getNamedItem("X").getNodeValue());
  217. point[1] = Integer.parseInt(attrs.getNamedItem("Y").getNodeValue());
  218. rs.add(point);
  219. }
  220. }
  221. coords = rs.toArray(new int[rs.size()][]);
  222. }
  223. finally
  224. {
  225. FastList.recycle(rs);
  226. }
  227. if (coords == null || coords.length == 0)
  228. {
  229. _log.warning("ZoneData: missing data for zone: " + zoneId +" in both XML and SQL, file: " + f.getName());
  230. continue;
  231. }
  232. // Create this zone. Parsing for cuboids is a
  233. // bit different than for other polygons
  234. // cuboids need exactly 2 points to be defined.
  235. // Other polygons need at least 3 (one per
  236. // vertex)
  237. if (zoneShape.equalsIgnoreCase("Cuboid"))
  238. {
  239. if (coords.length == 2)
  240. temp.setZone(new ZoneCuboid(coords[0][0], coords[1][0], coords[0][1], coords[1][1], minZ, maxZ));
  241. else
  242. {
  243. _log.warning("ZoneData: Missing cuboid vertex in sql data for zone: " + zoneId + " in file: " + f.getName());
  244. continue;
  245. }
  246. }
  247. else if (zoneShape.equalsIgnoreCase("NPoly"))
  248. {
  249. // nPoly needs to have at least 3 vertices
  250. if (coords.length > 2)
  251. {
  252. final int[] aX = new int[coords.length];
  253. final int[] aY = new int[coords.length];
  254. for (int i = 0; i < coords.length; i++)
  255. {
  256. aX[i] = coords[i][0];
  257. aY[i] = coords[i][1];
  258. }
  259. temp.setZone(new ZoneNPoly(aX, aY, minZ, maxZ));
  260. }
  261. else
  262. {
  263. _log.warning("ZoneData: Bad data for zone: " + zoneId + " in file: " + f.getName());
  264. continue;
  265. }
  266. }
  267. else if (zoneShape.equalsIgnoreCase("Cylinder"))
  268. {
  269. // A Cylinder zone requires a center point
  270. // at x,y and a radius
  271. attrs = d.getAttributes();
  272. final int zoneRad = Integer.parseInt(attrs.getNamedItem("rad").getNodeValue());
  273. if (coords.length == 1 && zoneRad > 0)
  274. temp.setZone(new ZoneCylinder(coords[0][0], coords[0][1], minZ, maxZ, zoneRad));
  275. else
  276. {
  277. _log.warning("ZoneData: Bad data for zone: " + zoneId + " in file: " + f.getName());
  278. continue;
  279. }
  280. }
  281. else
  282. {
  283. _log.warning("ZoneData: Unknown shape: " + zoneShape + " in file: " + f.getName());
  284. continue;
  285. }
  286. }
  287. catch (Exception e)
  288. {
  289. _log.log(Level.WARNING, "ZoneData: Failed to load zone " + zoneId + " coordinates: " + e.getMessage(), e);
  290. }
  291. // Check for additional parameters
  292. for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
  293. {
  294. if ("stat".equalsIgnoreCase(cd.getNodeName()))
  295. {
  296. attrs = cd.getAttributes();
  297. String name = attrs.getNamedItem("name").getNodeValue();
  298. String val = attrs.getNamedItem("val").getNodeValue();
  299. temp.setParameter(name, val);
  300. }
  301. else if ("spawn".equalsIgnoreCase(cd.getNodeName()) && temp instanceof L2ZoneRespawn)
  302. {
  303. attrs = cd.getAttributes();
  304. int spawnX = Integer.parseInt(attrs.getNamedItem("X").getNodeValue());
  305. int spawnY = Integer.parseInt(attrs.getNamedItem("Y").getNodeValue());
  306. int spawnZ = Integer.parseInt(attrs.getNamedItem("Z").getNodeValue());
  307. Node val = attrs.getNamedItem("isOther");
  308. boolean other = val != null && Boolean.parseBoolean(val.getNodeValue());
  309. val = attrs.getNamedItem("isChaotic");
  310. boolean chaotic = val != null && Boolean.parseBoolean(val.getNodeValue());
  311. val = attrs.getNamedItem("isBanish");
  312. boolean banish = val != null && Boolean.parseBoolean(val.getNodeValue());
  313. if (other)
  314. ((L2ZoneRespawn) temp).addOtherSpawn(spawnX, spawnY, spawnZ);
  315. else if (chaotic)
  316. ((L2ZoneRespawn) temp).addChaoticSpawn(spawnX, spawnY, spawnZ);
  317. else if (banish)
  318. ((L2ZoneRespawn) temp).addBanishSpawn(spawnX, spawnY, spawnZ);
  319. else
  320. ((L2ZoneRespawn) temp).addSpawn(spawnX, spawnY, spawnZ);
  321. }
  322. else if ("race".equalsIgnoreCase(cd.getNodeName()) && temp instanceof L2RespawnZone)
  323. {
  324. attrs = cd.getAttributes();
  325. String race = attrs.getNamedItem("name").getNodeValue();
  326. String point = attrs.getNamedItem("point").getNodeValue();
  327. ((L2RespawnZone) temp).addRaceRespawnPoint(race, point);
  328. }
  329. }
  330. if (checkId(zoneId))
  331. _log.config("Caution: Zone (" + zoneId + ") from file: " + f.getName() + " overrides previos definition.");
  332. if (zoneName != null && !zoneName.isEmpty())
  333. temp.setName(zoneName);
  334. addZone(zoneId, temp);
  335. // Register the zone into any world region it
  336. // intersects with...
  337. // currently 11136 test for each zone :>
  338. int ax, ay, bx, by;
  339. for (int x = 0; x < worldRegions.length; x++)
  340. {
  341. for (int y = 0; y < worldRegions[x].length; y++)
  342. {
  343. ax = (x - L2World.OFFSET_X) << L2World.SHIFT_BY;
  344. bx = ((x + 1) - L2World.OFFSET_X) << L2World.SHIFT_BY;
  345. ay = (y - L2World.OFFSET_Y) << L2World.SHIFT_BY;
  346. by = ((y + 1) - L2World.OFFSET_Y) << L2World.SHIFT_BY;
  347. if (temp.getZone().intersectsRectangle(ax, bx, ay, by))
  348. {
  349. if (Config.DEBUG)
  350. {
  351. _log.info("Zone (" + zoneId + ") added to: " + x + " " + y);
  352. }
  353. worldRegions[x][y].addZone(temp);
  354. }
  355. }
  356. }
  357. }
  358. }
  359. }
  360. }
  361. }
  362. }
  363. catch (Exception e)
  364. {
  365. _log.log(Level.SEVERE, "Error while loading zones.", e);
  366. return;
  367. }
  368. _log.info("Done: loaded " + _classZones.size() + " zone classes and "+getSize()+" zones.");
  369. }
  370. public int getSize()
  371. {
  372. int i = 0;
  373. for (Map<Integer, ? extends L2ZoneType> map : _classZones.values())
  374. {
  375. i += map.size();
  376. }
  377. return i;
  378. }
  379. public boolean checkId(int id)
  380. {
  381. for (Map<Integer, ? extends L2ZoneType> map : _classZones.values())
  382. {
  383. if (map.containsKey(id))
  384. return true;
  385. }
  386. return false;
  387. }
  388. /**
  389. * Add new zone
  390. *
  391. * @param zone
  392. */
  393. @SuppressWarnings("unchecked")
  394. public <T extends L2ZoneType> void addZone(Integer id, T zone)
  395. {
  396. //_zones.put(id, zone);
  397. Map<Integer, T> map = (Map<Integer, T>) _classZones.get(zone.getClass());
  398. if (map == null)
  399. {
  400. map = new FastMap<Integer, T>();
  401. map.put(id, zone);
  402. _classZones.put(zone.getClass(), map);
  403. }
  404. else
  405. map.put(id, zone);
  406. }
  407. /**
  408. * Returns all zones registered with the ZoneManager.
  409. * To minimise iteration processing retrieve zones from L2WorldRegion for a specific location instead.
  410. * @return zones
  411. * @see #getAllZones(Class)
  412. */
  413. @Deprecated
  414. public Collection<L2ZoneType> getAllZones()
  415. {
  416. FastList<L2ZoneType> zones = new FastList<L2ZoneType>();
  417. for (Map<Integer, ? extends L2ZoneType> map : _classZones.values())
  418. {
  419. zones.addAll(map.values());
  420. }
  421. return zones;
  422. }
  423. /**
  424. * Return all zones by class type
  425. * @param <T>
  426. * @param zoneType Zone class
  427. * @return Collection of zones
  428. */
  429. @SuppressWarnings("unchecked")
  430. public <T extends L2ZoneType> Collection<T> getAllZones(Class<T> zoneType)
  431. {
  432. return (Collection<T>) _classZones.get(zoneType).values();
  433. }
  434. /**
  435. * Get zone by ID
  436. * @param id
  437. * @return
  438. * @see #getZoneById(int, Class)
  439. */
  440. public L2ZoneType getZoneById(int id)
  441. {
  442. for (Map<Integer, ? extends L2ZoneType> map : _classZones.values())
  443. {
  444. if (map.containsKey(id))
  445. return map.get(id);
  446. }
  447. return null;
  448. }
  449. /**
  450. * Get zone by ID and zone class
  451. * @param id
  452. * @param zoneType
  453. * @return zone
  454. */
  455. @SuppressWarnings("unchecked")
  456. public <T extends L2ZoneType> T getZoneById(int id, Class<T> zoneType)
  457. {
  458. return (T) _classZones.get(zoneType).get(id);
  459. }
  460. /**
  461. * Returns all zones from where the object is located
  462. *
  463. * @param object
  464. * @return zones
  465. */
  466. public FastList<L2ZoneType> getZones(L2Object object)
  467. {
  468. return getZones(object.getX(), object.getY(), object.getZ());
  469. }
  470. /**
  471. * Returns zone from where the object is located by type
  472. *
  473. * @param object
  474. * @param type
  475. * @return zone
  476. */
  477. public <T extends L2ZoneType> T getZone(L2Object object, Class<T> type)
  478. {
  479. if (object == null)
  480. return null;
  481. return getZone(object.getX(), object.getY(), object.getZ(), type);
  482. }
  483. /**
  484. * Returns all zones from given coordinates (plane)
  485. *
  486. * @param x
  487. * @param y
  488. * @return zones
  489. */
  490. public FastList<L2ZoneType> getZones(int x, int y)
  491. {
  492. L2WorldRegion region = L2World.getInstance().getRegion(x, y);
  493. FastList<L2ZoneType> temp = new FastList<L2ZoneType>();
  494. for (L2ZoneType zone : region.getZones())
  495. {
  496. if (zone.isInsideZone(x, y))
  497. temp.add(zone);
  498. }
  499. return temp;
  500. }
  501. /**
  502. * Returns all zones from given coordinates
  503. *
  504. * @param x
  505. * @param y
  506. * @param z
  507. * @return zones
  508. */
  509. public FastList<L2ZoneType> getZones(int x, int y, int z)
  510. {
  511. L2WorldRegion region = L2World.getInstance().getRegion(x, y);
  512. FastList<L2ZoneType> temp = new FastList<L2ZoneType>();
  513. for (L2ZoneType zone : region.getZones())
  514. {
  515. if (zone.isInsideZone(x, y, z))
  516. temp.add(zone);
  517. }
  518. return temp;
  519. }
  520. /**
  521. * Returns zone from given coordinates
  522. *
  523. * @param x
  524. * @param y
  525. * @param z
  526. * @param type
  527. * @return zone
  528. */
  529. @SuppressWarnings("unchecked")
  530. public <T extends L2ZoneType> T getZone(int x, int y, int z, Class<T> type)
  531. {
  532. L2WorldRegion region = L2World.getInstance().getRegion(x, y);
  533. for (L2ZoneType zone : region.getZones())
  534. {
  535. if (zone.isInsideZone(x, y, z) && type.isInstance(zone))
  536. return (T) zone;
  537. }
  538. return null;
  539. }
  540. public final L2ArenaZone getArena(L2Character character)
  541. {
  542. if (character == null)
  543. return null;
  544. for (L2ZoneType temp : ZoneManager.getInstance().getZones(character.getX(), character.getY(), character.getZ()))
  545. {
  546. if (temp instanceof L2ArenaZone && temp.isCharacterInZone(character))
  547. return ((L2ArenaZone) temp);
  548. }
  549. return null;
  550. }
  551. public final L2OlympiadStadiumZone getOlympiadStadium(L2Character character)
  552. {
  553. if (character == null)
  554. return null;
  555. for (L2ZoneType temp : ZoneManager.getInstance().getZones(character.getX(), character.getY(), character.getZ()))
  556. {
  557. if (temp instanceof L2OlympiadStadiumZone && temp.isCharacterInZone(character))
  558. return ((L2OlympiadStadiumZone) temp);
  559. }
  560. return null;
  561. }
  562. /**
  563. * For testing purposes only
  564. * @param <T>
  565. * @param obj
  566. * @param type
  567. * @return
  568. */
  569. @SuppressWarnings("unchecked")
  570. public <T extends L2ZoneType> T getClosestZone(L2Object obj, Class<T> type)
  571. {
  572. T zone = getZone(obj, type);
  573. if (zone == null)
  574. {
  575. double closestdis = Double.MAX_VALUE;
  576. for (T temp : (Collection<T>) _classZones.get(type).values())
  577. {
  578. double distance = temp.getDistanceToZone(obj);
  579. if (distance < closestdis)
  580. {
  581. closestdis = distance;
  582. zone = temp;
  583. }
  584. }
  585. return zone;
  586. }
  587. else
  588. return zone;
  589. }
  590. /**
  591. * General storage for debug items used for visualizing zones.
  592. * @return list of items
  593. */
  594. public List<L2ItemInstance> getDebugItems()
  595. {
  596. if (_debugItems == null)
  597. _debugItems = new FastList<L2ItemInstance>();
  598. return _debugItems;
  599. }
  600. /**
  601. * Remove all debug items from l2world
  602. */
  603. public void clearDebugItems()
  604. {
  605. if (_debugItems != null)
  606. {
  607. Iterator<L2ItemInstance> it = _debugItems.iterator();
  608. while (it.hasNext())
  609. {
  610. L2ItemInstance item = it.next();
  611. if (item != null)
  612. item.decayMe();
  613. it.remove();
  614. }
  615. }
  616. }
  617. @SuppressWarnings("synthetic-access")
  618. private static class SingletonHolder
  619. {
  620. protected static final ZoneManager _instance = new ZoneManager();
  621. }
  622. }