SHOW:
|
|
- or go back to the newest paste.
1 | diff --git a/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java b/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java | |
2 | index a1b430a..9692d25 100644 | |
3 | --- a/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java | |
4 | +++ b/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java | |
5 | @@ -17,6 +17,8 @@ | |
6 | import java.util.HashMap; | |
7 | import java.util.Map; | |
8 | ||
9 | +import net.sf.l2j.gameserver.handler.voicedcommandhandlers.CastleManagersVCmd; | |
10 | + | |
11 | public class VoicedCommandHandler | |
12 | { | |
13 | private final Map<Integer, IVoicedCommandHandler> _datatable = new HashMap<>(); | |
14 | @@ -28,7 +30,7 @@ | |
15 | ||
16 | protected VoicedCommandHandler() | |
17 | { | |
18 | - | |
19 | + registerHandler(new CastleManagersVCmd()); | |
20 | } | |
21 | public void registerHandler(IVoicedCommandHandler handler) | |
22 | { | |
23 | diff --git a/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/CastleManagersVCmd.java b/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/CastleManagersVCmd.java | |
24 | new file mode 100644 | |
25 | index 0000000..8b355ce | |
26 | --- /dev/null | |
27 | +++ b/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/CastleManagersVCmd.java | |
28 | @@ -0,0 +1,73 @@ | |
29 | +package net.sf.l2j.gameserver.handler.voicedcommandhandlers; | |
30 | + | |
31 | +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler; | |
32 | +import net.sf.l2j.gameserver.instancemanager.CastleManager; | |
33 | +import net.sf.l2j.gameserver.model.actor.instance.Player; | |
34 | +import net.sf.l2j.gameserver.model.entity.Castle; | |
35 | +import net.sf.l2j.gameserver.network.SystemMessageId; | |
36 | +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; | |
37 | +import net.sf.l2j.gameserver.network.serverpackets.SiegeInfo; | |
38 | + | |
39 | +public class CastleManagersVCmd implements IVoicedCommandHandler | |
40 | +{ | |
41 | + private static final String[] _voicedCommands = {"castlemanager","siege_gludio","siege_dion","siege_giran","siege_oren","siege_aden","siege_innadril","siege_goddard","siege_rune","siege_schuttgart"}; | |
42 | + | |
43 | + @Override | |
44 | + public boolean useVoicedCommand(String command, Player activeChar, String target) | |
45 | + { | |
46 | + if (command.startsWith("castlemanager")) | |
47 | + { | |
48 | + sendHtml(activeChar); | |
49 | + } | |
50 | + | |
51 | + if (command.startsWith("siege_")) | |
52 | + { | |
53 | + if (activeChar.getClan() != null && !activeChar.isClanLeader()) | |
54 | + { | |
55 | + activeChar.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT); | |
56 | + return false; | |
57 | + } | |
58 | + | |
59 | + int castleId = 0; | |
60 | + | |
61 | + if (command.startsWith("siege_gludio")) | |
62 | + castleId = 1; | |
63 | + else if (command.startsWith("siege_dion")) | |
64 | + castleId = 2; | |
65 | + else if (command.startsWith("siege_giran")) | |
66 | + castleId = 3; | |
67 | + else if (command.startsWith("siege_oren")) | |
68 | + castleId = 4; | |
69 | + else if (command.startsWith("siege_aden")) | |
70 | + castleId = 5; | |
71 | + else if (command.startsWith("siege_innadril")) | |
72 | + castleId = 6; | |
73 | + else if (command.startsWith("siege_goddard")) | |
74 | + castleId = 7; | |
75 | + else if (command.startsWith("siege_rune")) | |
76 | + castleId = 8; | |
77 | + else if (command.startsWith("siege_schuttgart")) | |
78 | + castleId = 9; | |
79 | + | |
80 | + Castle castle = CastleManager.getInstance().getCastleById(castleId); | |
81 | + if(castle != null && castleId != 0) | |
82 | + activeChar.sendPacket(new SiegeInfo(castle)); | |
83 | + } | |
84 | + return true; | |
85 | + } | |
86 | + | |
87 | + private static void sendHtml(Player activeChar) | |
88 | + { | |
89 | + String htmFile = "data/html/mods/CastleManager.htm"; | |
90 | + | |
91 | + NpcHtmlMessage msg = new NpcHtmlMessage(5); | |
92 | + msg.setFile(htmFile); | |
93 | + activeChar.sendPacket(msg); | |
94 | + } | |
95 | + | |
96 | + @Override | |
97 | + public String[] getVoicedCommandList() | |
98 | + { | |
99 | + return _voicedCommands; | |
100 | + } | |
101 | +} | |
102 | \ No newline at end of file | |
103 | - | |
103 | + | |
104 | =================================================================== | |
105 | --- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java (revision 964) | |
106 | +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java (working copy) | |
107 | @@ -27,6 +27,8 @@ | |
108 | import com.l2jfrozen.gameserver.datatables.sql.AdminCommandAccessRights; | |
109 | import com.l2jfrozen.gameserver.handler.AdminCommandHandler; | |
110 | import com.l2jfrozen.gameserver.handler.IAdminCommandHandler; | |
111 | +import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler; | |
112 | +import com.l2jfrozen.gameserver.handler.VoicedCommandHandler; | |
113 | import com.l2jfrozen.gameserver.handler.custom.CustomBypassHandler; | |
114 | import com.l2jfrozen.gameserver.model.L2Object; | |
115 | import com.l2jfrozen.gameserver.model.L2World; | |
116 | @@ -124,6 +126,30 @@ | |
117 | { | |
118 | playerHelp(activeChar, _command.substring(12)); | |
119 | } | |
120 | + else if (_command.startsWith("voice") && (_command.charAt(6) == '.') && (_command.length() > 7)) | |
121 | + { | |
122 | + final String vc, vparams; | |
123 | + int endOfCommand = _command.indexOf(" ", 7); | |
124 | + if (endOfCommand > 0) | |
125 | + { | |
126 | + vc = _command.substring(7, endOfCommand).trim(); | |
127 | + vparams = _command.substring(endOfCommand).trim(); | |
128 | + } | |
129 | + else | |
130 | + { | |
131 | + vc = _command.substring(7).trim(); | |
132 | + vparams = null; | |
133 | + } | |
134 | + | |
135 | + if (vc.length() > 0) | |
136 | + { | |
137 | + IVoicedCommandHandler vch = VoicedCommandHandler.getInstance().getVoicedCommandHandler(vc); | |
138 | + if (vch != null) | |
139 | + { | |
140 | + vch.useVoicedCommand(vc, activeChar, vparams); | |
141 | + } | |
142 | + } | |
143 | + } | |
144 | else if(_command.startsWith("npc_")) | |
145 | { | |
146 | if(!activeChar.validateBypass(_command)) | |
147 | ||
148 | ||
149 | ========================================================================================================================================== | |
150 | <html><title>Castle Manager</title> | |
151 | <body> | |
152 | <center> | |
153 | <table> | |
154 | <tr><td align=center><font color="LEVEL">Choose The Castle Manager.</font></td></tr> | |
155 | <tr><td height=10></td></tr> | |
156 | <tr><td align=center><button action="bypass -h voice .siege_giran" value="Giran Castle" width=200 height=27 back="L2UI_CT1.OlympiadWnd_DF_HeroConfirm_Down" fore="L2UI_CT1.OlympiadWnd_DF_HeroConfirm"></td></tr> | |
157 | <tr><td align=center><button action="bypass -h voice .siege_aden" value="Aden Castle" width=200 height=27 back="L2UI_CT1.OlympiadWnd_DF_HeroConfirm_Down" fore="L2UI_CT1.OlympiadWnd_DF_HeroConfirm"></td></tr> | |
158 | <tr><td align=center><button action="bypass -h voice .siege_rune" value="Rune Castle" width=200 height=27 back="L2UI_CT1.OlympiadWnd_DF_HeroConfirm_Down" fore="L2UI_CT1.OlympiadWnd_DF_HeroConfirm"></td></tr> | |
159 | <tr><td align=center><button action="bypass -h voice .siege_oren" value="Oren Castle" width=200 height=27 back="L2UI_CT1.OlympiadWnd_DF_HeroConfirm_Down" fore="L2UI_CT1.OlympiadWnd_DF_HeroConfirm"></td></tr> | |
160 | <tr><td align=center><button action="bypass -h voice .siege_dion" value="Dion Castle" width=200 height=27 back="L2UI_CT1.OlympiadWnd_DF_HeroConfirm_Down" fore="L2UI_CT1.OlympiadWnd_DF_HeroConfirm"></td></tr> | |
161 | <tr><td align=center><button action="bypass -h voice .siege_gludio" value="Gludio Castle" width=200 height=27 back="L2UI_CT1.OlympiadWnd_DF_HeroConfirm_Down" fore="L2UI_CT1.OlympiadWnd_DF_HeroConfirm"></td></tr> | |
162 | <tr><td align=center><button action="bypass -h voice .siege_goddard" value="Goddard Castle" width=200 height=27 back="L2UI_CT1.OlympiadWnd_DF_HeroConfirm_Down" fore="L2UI_CT1.OlympiadWnd_DF_HeroConfirm"></td></tr> | |
163 | <tr><td align=center><button action="bypass -h voice .siege_schuttgart" value="Schuttgart Castle" width=200 height=27 back="L2UI_CT1.OlympiadWnd_DF_HeroConfirm_Down" fore="L2UI_CT1.OlympiadWnd_DF_HeroConfirm"></td></tr> | |
164 | <tr><td align=center><button action="bypass -h voice .siege_innadril" value="Innadril Castle" width=200 height=27 back="L2UI_CT1.OlympiadWnd_DF_HeroConfirm_Down" fore="L2UI_CT1.OlympiadWnd_DF_HeroConfirm"></td></tr> | |
165 | </table> | |
166 | <br><br> | |
167 | <font color=3293F3>L2Total Team</font><br> | |
168 | <img src="L2UI.SquareWhite" width=258 height=1> | |
169 | </body> | |
170 | </center></html> |