L2WalkRoute.java 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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.model;
  16. import java.util.List;
  17. /**
  18. * @author GKR
  19. */
  20. public class L2WalkRoute
  21. {
  22. private final int _id;
  23. private final List<L2NpcWalkerNode> _nodeList; // List of nodes
  24. private final boolean _repeatWalk; // Does repeat walk, after arriving into last point in list, or not
  25. private boolean _stopAfterCycle; // Make only one cycle or endlessly
  26. private final byte _repeatType; // Repeat style: 0 - go back, 1 - go to first point (circle style), 2 - teleport to first point (conveyor style), 3 - random walking between points
  27. private boolean _debug;
  28. public L2WalkRoute(int id, List<L2NpcWalkerNode> route, boolean repeat, boolean once, byte repeatType)
  29. {
  30. _id = id;
  31. _nodeList = route;
  32. _repeatType = repeatType;
  33. _repeatWalk = ((_repeatType >= 0) && (_repeatType <= 2)) ? repeat : false;
  34. _debug = false;
  35. }
  36. public int getId()
  37. {
  38. return _id;
  39. }
  40. public List<L2NpcWalkerNode> getNodeList()
  41. {
  42. return _nodeList;
  43. }
  44. public L2NpcWalkerNode getLastNode()
  45. {
  46. return _nodeList.get(_nodeList.size() - 1);
  47. }
  48. public boolean repeatWalk()
  49. {
  50. return _repeatWalk;
  51. }
  52. public boolean doOnce()
  53. {
  54. return _stopAfterCycle;
  55. }
  56. public byte getRepeatType()
  57. {
  58. return _repeatType;
  59. }
  60. public int getNodesCount()
  61. {
  62. return _nodeList.size();
  63. }
  64. public void setDebug(boolean val)
  65. {
  66. _debug = val;
  67. }
  68. public boolean debug()
  69. {
  70. return _debug;
  71. }
  72. }