AdminCamera.java 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Copyright (C) 2004-2015 L2J DataPack
  3. *
  4. * This file is part of L2J DataPack.
  5. *
  6. * L2J DataPack 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 DataPack 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 handlers.admincommandhandlers;
  20. import com.l2jserver.gameserver.handler.IAdminCommandHandler;
  21. import com.l2jserver.gameserver.model.actor.L2Character;
  22. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  23. import com.l2jserver.gameserver.model.events.AbstractScript;
  24. import com.l2jserver.gameserver.network.SystemMessageId;
  25. /**
  26. * Camera commands.
  27. * @author Zoey76
  28. */
  29. public class AdminCamera implements IAdminCommandHandler
  30. {
  31. private static final String[] ADMIN_COMMANDS =
  32. {
  33. "admin_cam",
  34. "admin_camex",
  35. "admin_cam3"
  36. };
  37. @Override
  38. public boolean useAdminCommand(String command, L2PcInstance activeChar)
  39. {
  40. if ((activeChar.getTarget() == null) || !activeChar.getTarget().isCharacter())
  41. {
  42. activeChar.sendPacket(SystemMessageId.TARGET_CANT_FOUND);
  43. return false;
  44. }
  45. final L2Character target = (L2Character) activeChar.getTarget();
  46. final String[] com = command.split(" ");
  47. switch (com[0])
  48. {
  49. case "admin_cam":
  50. {
  51. if (com.length != 12)
  52. {
  53. activeChar.sendMessage("Usage: //cam force angle1 angle2 time range duration relYaw relPitch isWide relAngle");
  54. return false;
  55. }
  56. AbstractScript.specialCamera(activeChar, target, Integer.parseInt(com[1]), Integer.parseInt(com[2]), Integer.parseInt(com[3]), Integer.parseInt(com[4]), Integer.parseInt(com[5]), Integer.parseInt(com[6]), Integer.parseInt(com[7]), Integer.parseInt(com[8]), Integer.parseInt(com[9]), Integer.parseInt(com[10]));
  57. break;
  58. }
  59. case "admin_camex":
  60. {
  61. if (com.length != 10)
  62. {
  63. activeChar.sendMessage("Usage: //camex force angle1 angle2 time duration relYaw relPitch isWide relAngle");
  64. return false;
  65. }
  66. AbstractScript.specialCameraEx(activeChar, target, Integer.parseInt(com[1]), Integer.parseInt(com[2]), Integer.parseInt(com[3]), Integer.parseInt(com[4]), Integer.parseInt(com[5]), Integer.parseInt(com[6]), Integer.parseInt(com[7]), Integer.parseInt(com[8]), Integer.parseInt(com[9]));
  67. break;
  68. }
  69. case "admin_cam3":
  70. {
  71. if (com.length != 12)
  72. {
  73. activeChar.sendMessage("Usage: //cam3 force angle1 angle2 time range duration relYaw relPitch isWide relAngle unk");
  74. return false;
  75. }
  76. AbstractScript.specialCamera3(activeChar, target, Integer.parseInt(com[1]), Integer.parseInt(com[2]), Integer.parseInt(com[3]), Integer.parseInt(com[4]), Integer.parseInt(com[5]), Integer.parseInt(com[6]), Integer.parseInt(com[7]), Integer.parseInt(com[8]), Integer.parseInt(com[9]), Integer.parseInt(com[10]), Integer.parseInt(com[11]));
  77. break;
  78. }
  79. }
  80. return true;
  81. }
  82. @Override
  83. public String[] getAdminCommandList()
  84. {
  85. return ADMIN_COMMANDS;
  86. }
  87. }