Guest User

Untitled

a guest
Oct 12th, 2013
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  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 handlers.voicedcommandhandlers;
  16.  
  17. import com.l2jserver.gameserver.datatables.SkillTable;
  18. import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
  19. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  20. import com.l2jserver.gameserver.model.effects.L2Effect;
  21. import com.l2jserver.gameserver.model.skills.L2Skill;
  22.  
  23. public class Voiced_SpecialVoiced implements IVoicedCommandHandler
  24. {
  25. private static final String[] VOICED_COMMANDS =
  26. {
  27. "offensive",
  28. "defensive",
  29. "normal"
  30. };
  31.  
  32. @Override
  33. public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
  34. {
  35. if (command.equalsIgnoreCase("offensive"))
  36. {
  37. activeChar.stopSkillEffects(26074);
  38. L2Skill offensiveSkill = SkillTable.getInstance().getInfo(26074, 1);
  39. activeChar.doSimultaneousCast(offensiveSkill);
  40. activeChar.sendMessage("You are in offensive mode.");
  41. }
  42. else if (command.equalsIgnoreCase("defensive"))
  43. {
  44. activeChar.stopSkillEffects(26075);
  45. L2Skill deffensiveSkill = SkillTable.getInstance().getInfo(26075, 1);
  46. activeChar.doSimultaneousCast(deffensiveSkill);
  47. activeChar.sendMessage("You are in defensive mode.");
  48. }
  49. else if (command.equalsIgnoreCase("normal"))
  50. {
  51. if (activeChar != null)
  52. {
  53. L2Effect[] effects = activeChar.getAllEffects();
  54.  
  55. for (L2Effect e : effects)
  56. {
  57. if (((e != null) && (e.getSkill().getId() == 26074)) || (e.getSkill().getId() == 26075))
  58. {
  59. e.exit();
  60. }
  61. }
  62. activeChar.sendMessage("You are in normal mode.");
  63. }
  64. }
  65. return true;
  66. }
  67.  
  68. @Override
  69. public String[] getVoicedCommandList()
  70. {
  71. return VOICED_COMMANDS;
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment