CannotMoveAnymore.java 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 net.sf.l2j.gameserver.clientpackets;
  16. import java.util.logging.Logger;
  17. import net.sf.l2j.Config;
  18. import net.sf.l2j.gameserver.ai.CtrlEvent;
  19. import net.sf.l2j.gameserver.model.L2CharPosition;
  20. import net.sf.l2j.gameserver.model.L2Character;
  21. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  22. import net.sf.l2j.gameserver.serverpackets.PartyMemberPosition;
  23. /**
  24. * This class ...
  25. *
  26. * @version $Revision: 1.1.2.1.2.4 $ $Date: 2005/03/27 15:29:30 $
  27. */
  28. public final class CannotMoveAnymore extends L2GameClientPacket
  29. {
  30. private static final String _C__36_STOPMOVE = "[C] 36 CannotMoveAnymore";
  31. private static Logger _log = Logger.getLogger(CannotMoveAnymore.class.getName());
  32. private int _x;
  33. private int _y;
  34. private int _z;
  35. private int _heading;
  36. @Override
  37. protected void readImpl()
  38. {
  39. _x = readD();
  40. _y = readD();
  41. _z = readD();
  42. _heading = readD();
  43. }
  44. @Override
  45. protected void runImpl()
  46. {
  47. L2Character player = getClient().getActiveChar();
  48. if (player == null)
  49. return;
  50. if (Config.DEBUG)
  51. _log.fine("client: x:" + _x + " y:" + _y + " z:" + _z
  52. + " server x:" + player.getX() + " y:" + player.getY()
  53. + " z:" + player.getZ());
  54. if (player.getAI() != null)
  55. {
  56. player.getAI().notifyEvent(CtrlEvent.EVT_ARRIVED_BLOCKED,
  57. new L2CharPosition(_x, _y, _z, _heading));
  58. }
  59. if (player instanceof L2PcInstance
  60. && ((L2PcInstance) player).getParty() != null)
  61. ((L2PcInstance) player).getParty().broadcastToPartyMembers(
  62. ((L2PcInstance) player),
  63. new PartyMemberPosition((L2PcInstance) player));
  64. // player.stopMove();
  65. //
  66. // if (Config.DEBUG)
  67. // _log.fine("client: x:"+_x+" y:"+_y+" z:"+_z+
  68. // " server x:"+player.getX()+" y:"+player.getZ()+" z:"+player.getZ());
  69. // StopMove smwl = new StopMove(player);
  70. // getClient().getActiveChar().sendPacket(smwl);
  71. // getClient().getActiveChar().broadcastPacket(smwl);
  72. //
  73. // StopRotation sr = new StopRotation(getClient().getActiveChar(),
  74. // _heading);
  75. // getClient().getActiveChar().sendPacket(sr);
  76. // getClient().getActiveChar().broadcastPacket(sr);
  77. }
  78. /*
  79. * (non-Javadoc)
  80. *
  81. * @see net.sf.l2j.gameserver.clientpackets.ClientBasePacket#getType()
  82. */
  83. @Override
  84. public String getType()
  85. {
  86. return _C__36_STOPMOVE;
  87. }
  88. }