Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2jFrozen_GameServer
- Index: head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/CastleManagersVCmd.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/CastleManagersVCmd.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/CastleManagersVCmd.java (working copy)
- @@ -0,0 +1,85 @@
- +package com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
- +
- +import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
- +import com.l2jfrozen.gameserver.managers.CastleManager;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jfrozen.gameserver.model.entity.siege.Castle;
- +import com.l2jfrozen.gameserver.network.SystemMessageId;
- +import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
- +import com.l2jfrozen.gameserver.network.serverpackets.SiegeInfo;
- +
- +/**
- + * @author -=DoctorNo=-
- + */
- +public class CastleManagersVCmd implements IVoicedCommandHandler
- +{
- + private static final String[] VOICED_COMMANDS =
- + {
- + "castlemanager",
- + "siege_gludio",
- + "siege_dion",
- + "siege_giran",
- + "siege_oren",
- + "siege_aden",
- + "siege_innadril",
- + "siege_goddard",
- + "siege_rune",
- + "siege_schuttgart"
- + };
- +
- + @Override
- + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
- + {
- + if (command.startsWith("castlemanager")) {
- + sendHtml(activeChar);
- + }
- +
- + if (command.startsWith("siege_")) {
- + if (activeChar.getClan() != null && !activeChar.isClanLeader()) {
- + activeChar.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
- + return false;
- + }
- +
- + int castleId = 0;
- +
- + if (command.startsWith("siege_gludio"))
- + castleId = 1;
- + else if (command.startsWith("siege_dion"))
- + castleId = 2;
- + else if (command.startsWith("siege_giran"))
- + castleId = 3;
- + else if (command.startsWith("siege_oren"))
- + castleId = 4;
- + else if (command.startsWith("siege_aden"))
- + castleId = 5;
- + else if (command.startsWith("siege_innadril"))
- + castleId = 6;
- + else if (command.startsWith("siege_goddard"))
- + castleId = 7;
- + else if (command.startsWith("siege_rune"))
- + castleId = 8;
- + else if (command.startsWith("siege_schuttgart"))
- + castleId = 9;
- +
- + Castle castle = CastleManager.getInstance().getCastleById(castleId);
- + if(castle != null && castleId != 0)
- + activeChar.sendPacket(new SiegeInfo(castle));
- + }
- + return true;
- + }
- +
- + private void sendHtml(L2PcInstance activeChar)
- + {
- + String htmFile = "data/html/mods/CastleManager.htm";
- +
- + NpcHtmlMessage msg = new NpcHtmlMessage(5);
- + msg.setFile(htmFile);
- + activeChar.sendPacket(msg);
- + }
- +
- + @Override
- + public String[] getVoicedCommandList()
- + {
- + return VOICED_COMMANDS;
- + }
- +}
- \ No newline at end of file
- Index: head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java (revision 964)
- +++ head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java (working copy)
- @@ -28,6 +28,7 @@
- import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.AwayCmd;
- import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.BankingCmd;
- import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.CTFCmd;
- +import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.CastleManagersVCmd;
- import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.DMCmd;
- import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.FarmPvpCmd;
- import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Online;
- @@ -66,6 +67,8 @@
- registerVoicedCommandHandler( new Voting());
- + registerVoicedCommandHandler( new CastleManagersVCmd());
- +
- if(Config.BANKING_SYSTEM_ENABLED)
- {
- registerVoicedCommandHandler(new BankingCmd());
- Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java (revision 964)
- +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java (working copy)
- @@ -27,6 +27,8 @@
- import com.l2jfrozen.gameserver.datatables.sql.AdminCommandAccessRights;
- import com.l2jfrozen.gameserver.handler.AdminCommandHandler;
- import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;
- +import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
- +import com.l2jfrozen.gameserver.handler.VoicedCommandHandler;
- import com.l2jfrozen.gameserver.handler.custom.CustomBypassHandler;
- import com.l2jfrozen.gameserver.model.L2Object;
- import com.l2jfrozen.gameserver.model.L2World;
- @@ -124,6 +126,30 @@
- {
- playerHelp(activeChar, _command.substring(12));
- }
- + else if (_command.startsWith("voice") && (_command.charAt(6) == '.') && (_command.length() > 7))
- + {
- + final String vc, vparams;
- + int endOfCommand = _command.indexOf(" ", 7);
- + if (endOfCommand > 0)
- + {
- + vc = _command.substring(7, endOfCommand).trim();
- + vparams = _command.substring(endOfCommand).trim();
- + }
- + else
- + {
- + vc = _command.substring(7).trim();
- + vparams = null;
- + }
- +
- + if (vc.length() > 0)
- + {
- + IVoicedCommandHandler vch = VoicedCommandHandler.getInstance().getVoicedCommandHandler(vc);
- + if (vch != null)
- + {
- + vch.useVoicedCommand(vc, activeChar, vparams);
- + }
- + }
- + }
- else if(_command.startsWith("npc_"))
- {
- if(!activeChar.validateBypass(_command))
Advertisement
Add Comment
Please, Sign In to add comment