L2WalkRoute.java 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. public L2WalkRoute(int id, List<L2NpcWalkerNode> route, boolean repeat, boolean once, byte repeatType)
  28. {
  29. _id = id;
  30. _nodeList = route;
  31. _repeatType = repeatType;
  32. _repeatWalk = ((_repeatType >= 0) && (_repeatType <= 2)) ? repeat : false;
  33. }
  34. public int getId()
  35. {
  36. return _id;
  37. }
  38. public List<L2NpcWalkerNode> getNodeList()
  39. {
  40. return _nodeList;
  41. }
  42. public L2NpcWalkerNode getLastNode()
  43. {
  44. return _nodeList.get(_nodeList.size() - 1);
  45. }
  46. public boolean repeatWalk()
  47. {
  48. return _repeatWalk;
  49. }
  50. public boolean doOnce()
  51. {
  52. return _stopAfterCycle;
  53. }
  54. public byte getRepeatType()
  55. {
  56. return _repeatType;
  57. }
  58. public int getNodesCount()
  59. {
  60. return _nodeList.size();
  61. }
  62. }