Guest User

Untitled

a guest
Dec 24th, 2012
1,027
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.72 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P L2jFrozen_GameServer
  3. Index: head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/CastleManagersVCmd.java
  4. ===================================================================
  5. --- head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/CastleManagersVCmd.java (revision 0)
  6. +++ head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/CastleManagersVCmd.java (working copy)
  7. @@ -0,0 +1,85 @@
  8. +package com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
  9. +
  10. +import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
  11. +import com.l2jfrozen.gameserver.managers.CastleManager;
  12. +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  13. +import com.l2jfrozen.gameserver.model.entity.siege.Castle;
  14. +import com.l2jfrozen.gameserver.network.SystemMessageId;
  15. +import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
  16. +import com.l2jfrozen.gameserver.network.serverpackets.SiegeInfo;
  17. +
  18. +/**
  19. + * @author -=DoctorNo=-
  20. + */
  21. +public class CastleManagersVCmd implements IVoicedCommandHandler
  22. +{
  23. + private static final String[] VOICED_COMMANDS =
  24. + {
  25. + "castlemanager",
  26. + "siege_gludio",
  27. + "siege_dion",
  28. + "siege_giran",
  29. + "siege_oren",
  30. + "siege_aden",
  31. + "siege_innadril",
  32. + "siege_goddard",
  33. + "siege_rune",
  34. + "siege_schuttgart"
  35. + };
  36. +
  37. + @Override
  38. + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
  39. + {
  40. + if (command.startsWith("castlemanager")) {
  41. + sendHtml(activeChar);
  42. + }
  43. +
  44. + if (command.startsWith("siege_")) {
  45. + if (activeChar.getClan() != null && !activeChar.isClanLeader()) {
  46. + activeChar.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
  47. + return false;
  48. + }
  49. +
  50. + int castleId = 0;
  51. +
  52. + if (command.startsWith("siege_gludio"))
  53. + castleId = 1;
  54. + else if (command.startsWith("siege_dion"))
  55. + castleId = 2;
  56. + else if (command.startsWith("siege_giran"))
  57. + castleId = 3;
  58. + else if (command.startsWith("siege_oren"))
  59. + castleId = 4;
  60. + else if (command.startsWith("siege_aden"))
  61. + castleId = 5;
  62. + else if (command.startsWith("siege_innadril"))
  63. + castleId = 6;
  64. + else if (command.startsWith("siege_goddard"))
  65. + castleId = 7;
  66. + else if (command.startsWith("siege_rune"))
  67. + castleId = 8;
  68. + else if (command.startsWith("siege_schuttgart"))
  69. + castleId = 9;
  70. +
  71. + Castle castle = CastleManager.getInstance().getCastleById(castleId);
  72. + if(castle != null && castleId != 0)
  73. + activeChar.sendPacket(new SiegeInfo(castle));
  74. + }
  75. + return true;
  76. + }
  77. +
  78. + private void sendHtml(L2PcInstance activeChar)
  79. + {
  80. + String htmFile = "data/html/mods/CastleManager.htm";
  81. +
  82. + NpcHtmlMessage msg = new NpcHtmlMessage(5);
  83. + msg.setFile(htmFile);
  84. + activeChar.sendPacket(msg);
  85. + }
  86. +
  87. + @Override
  88. + public String[] getVoicedCommandList()
  89. + {
  90. + return VOICED_COMMANDS;
  91. + }
  92. +}
  93. \ No newline at end of file
  94. Index: head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java
  95. ===================================================================
  96. --- head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java (revision 964)
  97. +++ head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java (working copy)
  98. @@ -28,6 +28,7 @@
  99. import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.AwayCmd;
  100. import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.BankingCmd;
  101. import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.CTFCmd;
  102. +import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.CastleManagersVCmd;
  103. import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.DMCmd;
  104. import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.FarmPvpCmd;
  105. import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Online;
  106. @@ -66,6 +67,8 @@
  107.  
  108. registerVoicedCommandHandler( new Voting());
  109.  
  110. + registerVoicedCommandHandler( new CastleManagersVCmd());
  111. +
  112. if(Config.BANKING_SYSTEM_ENABLED)
  113. {
  114. registerVoicedCommandHandler(new BankingCmd());
  115. Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java
  116. ===================================================================
  117. --- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java (revision 964)
  118. +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java (working copy)
  119. @@ -27,6 +27,8 @@
  120. import com.l2jfrozen.gameserver.datatables.sql.AdminCommandAccessRights;
  121. import com.l2jfrozen.gameserver.handler.AdminCommandHandler;
  122. import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;
  123. +import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
  124. +import com.l2jfrozen.gameserver.handler.VoicedCommandHandler;
  125. import com.l2jfrozen.gameserver.handler.custom.CustomBypassHandler;
  126. import com.l2jfrozen.gameserver.model.L2Object;
  127. import com.l2jfrozen.gameserver.model.L2World;
  128. @@ -124,6 +126,30 @@
  129. {
  130. playerHelp(activeChar, _command.substring(12));
  131. }
  132. + else if (_command.startsWith("voice") && (_command.charAt(6) == '.') && (_command.length() > 7))
  133. + {
  134. + final String vc, vparams;
  135. + int endOfCommand = _command.indexOf(" ", 7);
  136. + if (endOfCommand > 0)
  137. + {
  138. + vc = _command.substring(7, endOfCommand).trim();
  139. + vparams = _command.substring(endOfCommand).trim();
  140. + }
  141. + else
  142. + {
  143. + vc = _command.substring(7).trim();
  144. + vparams = null;
  145. + }
  146. +
  147. + if (vc.length() > 0)
  148. + {
  149. + IVoicedCommandHandler vch = VoicedCommandHandler.getInstance().getVoicedCommandHandler(vc);
  150. + if (vch != null)
  151. + {
  152. + vch.useVoicedCommand(vc, activeChar, vparams);
  153. + }
  154. + }
  155. + }
  156. else if(_command.startsWith("npc_"))
  157. {
  158. if(!activeChar.validateBypass(_command))
Advertisement
Add Comment
Please, Sign In to add comment