L2WalkRoute.java 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright (C) 2004-2013 L2J Server
  3. *
  4. * This file is part of L2J Server.
  5. *
  6. * L2J Server is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J Server is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package com.l2jserver.gameserver.model;
  20. import java.util.List;
  21. /**
  22. * @author GKR
  23. */
  24. public class L2WalkRoute
  25. {
  26. private final String _name;
  27. private final List<L2NpcWalkerNode> _nodeList; // List of nodes
  28. private final boolean _repeatWalk; // Does repeat walk, after arriving into last point in list, or not
  29. private boolean _stopAfterCycle; // Make only one cycle or endlessly
  30. 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
  31. public L2WalkRoute(String name, List<L2NpcWalkerNode> route, boolean repeat, boolean once, byte repeatType)
  32. {
  33. _name = name;
  34. _nodeList = route;
  35. _repeatType = repeatType;
  36. _repeatWalk = ((_repeatType >= 0) && (_repeatType <= 2)) ? repeat : false;
  37. }
  38. public String getName()
  39. {
  40. return _name;
  41. }
  42. public List<L2NpcWalkerNode> getNodeList()
  43. {
  44. return _nodeList;
  45. }
  46. public L2NpcWalkerNode getLastNode()
  47. {
  48. return _nodeList.get(_nodeList.size() - 1);
  49. }
  50. public boolean repeatWalk()
  51. {
  52. return _repeatWalk;
  53. }
  54. public boolean doOnce()
  55. {
  56. return _stopAfterCycle;
  57. }
  58. public byte getRepeatType()
  59. {
  60. return _repeatType;
  61. }
  62. public int getNodesCount()
  63. {
  64. return _nodeList.size();
  65. }
  66. }