Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package handlers.voicedcommandhandlers;
- import com.l2jserver.gameserver.datatables.SkillTable;
- import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
- import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jserver.gameserver.model.effects.L2Effect;
- import com.l2jserver.gameserver.model.skills.L2Skill;
- public class Voiced_SpecialVoiced implements IVoicedCommandHandler
- {
- private static final String[] VOICED_COMMANDS =
- {
- "offensive",
- "defensive",
- "normal"
- };
- @Override
- public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
- {
- if (command.equalsIgnoreCase("offensive"))
- {
- activeChar.stopSkillEffects(26074);
- L2Skill offensiveSkill = SkillTable.getInstance().getInfo(26074, 1);
- activeChar.doSimultaneousCast(offensiveSkill);
- activeChar.sendMessage("You are in offensive mode.");
- }
- else if (command.equalsIgnoreCase("defensive"))
- {
- activeChar.stopSkillEffects(26075);
- L2Skill deffensiveSkill = SkillTable.getInstance().getInfo(26075, 1);
- activeChar.doSimultaneousCast(deffensiveSkill);
- activeChar.sendMessage("You are in defensive mode.");
- }
- else if (command.equalsIgnoreCase("normal"))
- {
- if (activeChar != null)
- {
- L2Effect[] effects = activeChar.getAllEffects();
- for (L2Effect e : effects)
- {
- if (((e != null) && (e.getSkill().getId() == 26074)) || (e.getSkill().getId() == 26075))
- {
- e.exit();
- }
- }
- activeChar.sendMessage("You are in normal mode.");
- }
- }
- return true;
- }
- @Override
- public String[] getVoicedCommandList()
- {
- return VOICED_COMMANDS;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment