SHOW:
|
|
- or go back to the newest paste.
| 1 | ### Eclipse Workspace Patch 1.0 | |
| 2 | #P 405 (1) | |
| 3 | diff --git aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java | |
| 4 | index 2d0b8e7..16a84e2 100644 | |
| 5 | --- aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java | |
| 6 | +++ aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java | |
| 7 | @@ -1,32 +1,31 @@ | |
| 8 | package net.sf.l2j.gameserver; | |
| 9 | ||
| 10 | import java.io.File; | |
| 11 | import java.io.FileInputStream; | |
| 12 | import java.io.InputStream; | |
| 13 | import java.net.InetAddress; | |
| 14 | import java.util.logging.LogManager; | |
| 15 | ||
| 16 | +import net.sf.l2j.Config; | |
| 17 | import net.sf.l2j.commons.lang.StringUtil; | |
| 18 | import net.sf.l2j.commons.logging.CLogger; | |
| 19 | import net.sf.l2j.commons.mmocore.SelectorConfig; | |
| 20 | import net.sf.l2j.commons.mmocore.SelectorThread; | |
| 21 | import net.sf.l2j.commons.pool.ConnectionPool; | |
| 22 | import net.sf.l2j.commons.pool.ThreadPool; | |
| 23 | import net.sf.l2j.commons.util.SysUtil; | |
| 24 | - | |
| 25 | -import net.sf.l2j.Config; | |
| 26 | import net.sf.l2j.gameserver.communitybbs.CommunityBoard; | |
| 27 | import net.sf.l2j.gameserver.data.SkillTable; | |
| 28 | import net.sf.l2j.gameserver.data.cache.CrestCache; | |
| 29 | import net.sf.l2j.gameserver.data.cache.HtmCache; | |
| 30 | import net.sf.l2j.gameserver.data.manager.BoatManager; | |
| 31 | import net.sf.l2j.gameserver.data.manager.BufferManager; | |
| 32 | import net.sf.l2j.gameserver.data.manager.BuyListManager; | |
| 33 | import net.sf.l2j.gameserver.data.manager.CastleManager; | |
| 34 | import net.sf.l2j.gameserver.data.manager.CastleManorManager; | |
| 35 | import net.sf.l2j.gameserver.data.manager.ClanHallManager; | |
| 36 | import net.sf.l2j.gameserver.data.manager.CoupleManager; | |
| 37 | import net.sf.l2j.gameserver.data.manager.CursedWeaponManager; | |
| 38 | import net.sf.l2j.gameserver.data.manager.DerbyTrackManager; | |
| 39 | import net.sf.l2j.gameserver.data.manager.DimensionalRiftManager; | |
| 40 | import net.sf.l2j.gameserver.data.manager.FestivalOfDarknessManager; | |
| 41 | @@ -66,30 +65,31 @@ | |
| 42 | import net.sf.l2j.gameserver.data.xml.ScriptData; | |
| 43 | import net.sf.l2j.gameserver.data.xml.SkillTreeData; | |
| 44 | import net.sf.l2j.gameserver.data.xml.SoulCrystalData; | |
| 45 | import net.sf.l2j.gameserver.data.xml.SpellbookData; | |
| 46 | import net.sf.l2j.gameserver.data.xml.StaticObjectData; | |
| 47 | import net.sf.l2j.gameserver.data.xml.SummonItemData; | |
| 48 | import net.sf.l2j.gameserver.data.xml.TeleportData; | |
| 49 | import net.sf.l2j.gameserver.data.xml.WalkerRouteData; | |
| 50 | import net.sf.l2j.gameserver.geoengine.GeoEngine; | |
| 51 | import net.sf.l2j.gameserver.handler.AdminCommandHandler; | |
| 52 | import net.sf.l2j.gameserver.handler.ChatHandler; | |
| 53 | import net.sf.l2j.gameserver.handler.ItemHandler; | |
| 54 | import net.sf.l2j.gameserver.handler.SkillHandler; | |
| 55 | import net.sf.l2j.gameserver.handler.TargetHandler; | |
| 56 | import net.sf.l2j.gameserver.handler.UserCommandHandler; | |
| 57 | +import net.sf.l2j.gameserver.handler.VoicedCommandHandler; | |
| 58 | import net.sf.l2j.gameserver.idfactory.IdFactory; | |
| 59 | import net.sf.l2j.gameserver.model.World; | |
| 60 | import net.sf.l2j.gameserver.model.boat.BoatGiranTalking; | |
| 61 | import net.sf.l2j.gameserver.model.boat.BoatGludinRune; | |
| 62 | import net.sf.l2j.gameserver.model.boat.BoatInnadrilTour; | |
| 63 | import net.sf.l2j.gameserver.model.boat.BoatRunePrimeval; | |
| 64 | import net.sf.l2j.gameserver.model.boat.BoatTalkingGludin; | |
| 65 | import net.sf.l2j.gameserver.model.olympiad.Olympiad; | |
| 66 | import net.sf.l2j.gameserver.model.olympiad.OlympiadGameManager; | |
| 67 | import net.sf.l2j.gameserver.network.GameClient; | |
| 68 | import net.sf.l2j.gameserver.network.GamePacketHandler; | |
| 69 | import net.sf.l2j.gameserver.taskmanager.AttackStanceTaskManager; | |
| 70 | import net.sf.l2j.gameserver.taskmanager.DecayTaskManager; | |
| 71 | import net.sf.l2j.gameserver.taskmanager.GameTimeTaskManager; | |
| 72 | import net.sf.l2j.gameserver.taskmanager.ItemsOnGroundTaskManager; | |
| 73 | @@ -257,30 +257,31 @@ | |
| 74 | CoupleManager.getInstance(); | |
| 75 | ||
| 76 | if (Config.ALLOW_FISH_CHAMPIONSHIP) | |
| 77 | FishingChampionshipManager.getInstance(); | |
| 78 | ||
| 79 | StringUtil.printSection("Spawns");
| |
| 80 | SpawnManager.getInstance().spawn(); | |
| 81 | ||
| 82 | StringUtil.printSection("Handlers");
| |
| 83 | LOGGER.info("Loaded {} admin command handlers.", AdminCommandHandler.getInstance().size());
| |
| 84 | LOGGER.info("Loaded {} chat handlers.", ChatHandler.getInstance().size());
| |
| 85 | LOGGER.info("Loaded {} item handlers.", ItemHandler.getInstance().size());
| |
| 86 | LOGGER.info("Loaded {} skill handlers.", SkillHandler.getInstance().size());
| |
| 87 | LOGGER.info("Loaded {} target handlers.", TargetHandler.getInstance().size());
| |
| 88 | LOGGER.info("Loaded {} user command handlers.", UserCommandHandler.getInstance().size());
| |
| 89 | + LOGGER.info("Loaded {} user VoicedCommandHandler handlers.", VoicedCommandHandler.getInstance().size());
| |
| 90 | ||
| 91 | StringUtil.printSection("System");
| |
| 92 | Runtime.getRuntime().addShutdownHook(Shutdown.getInstance()); | |
| 93 | ||
| 94 | if (Config.DEADLOCK_DETECTOR) | |
| 95 | {
| |
| 96 | LOGGER.info("Deadlock detector is enabled. Timer: {}s.", Config.DEADLOCK_CHECK_INTERVAL);
| |
| 97 | ||
| 98 | final DeadLockDetector deadDetectThread = new DeadLockDetector(); | |
| 99 | deadDetectThread.setDaemon(true); | |
| 100 | deadDetectThread.start(); | |
| 101 | } | |
| 102 | else | |
| 103 | LOGGER.info("Deadlock detector is disabled.");
| |
| 104 | ||
| 105 | diff --git aCis_gameserver/java/net/sf/l2j/gameserver/handler/IVoicedCommandHandler.java | |
| 106 | new file mode 100644 | |
| 107 | index 0000000..c7b29f5 | |
| 108 | --- /dev/null | |
| 109 | +++ aCis_gameserver/java/net/sf/l2j/gameserver/handler/IVoicedCommandHandler.java | |
| 110 | @@ -0,0 +1,10 @@ | |
| 111 | +package net.sf.l2j.gameserver.handler; | |
| 112 | + | |
| 113 | +import net.sf.l2j.gameserver.model.actor.Player; | |
| 114 | + | |
| 115 | +public interface IVoicedCommandHandler | |
| 116 | +{
| |
| 117 | + public boolean useVoicedCommand(String command, Player activeChar, String params); | |
| 118 | + | |
| 119 | + public String[] getVoicedCommandList(); | |
| 120 | +} | |
| 121 | diff --git aCis_gameserver/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java | |
| 122 | new file mode 100644 | |
| 123 | index 0000000..0c706a8 | |
| 124 | --- /dev/null | |
| 125 | +++ aCis_gameserver/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java | |
| 126 | @@ -0,0 +1,49 @@ | |
| 127 | +package net.sf.l2j.gameserver.handler; | |
| 128 | + | |
| 129 | +import java.util.HashMap; | |
| 130 | +import java.util.Map; | |
| 131 | + | |
| 132 | +public class VoicedCommandHandler | |
| 133 | +{
| |
| 134 | + private final Map<Integer, IVoicedCommandHandler> _datatable = new HashMap<>(); | |
| 135 | + | |
| 136 | + public static VoicedCommandHandler getInstance() | |
| 137 | + {
| |
| 138 | + return SingletonHolder._instance; | |
| 139 | + } | |
| 140 | + | |
| 141 | + protected VoicedCommandHandler() | |
| 142 | + {
| |
| 143 | + //Codigos para colocar aqui dentro | |
| 144 | + //Exemplo -> registerHandler(new ExemploMod()); | |
| 145 | + | |
| 146 | + } | |
| 147 | + | |
| 148 | + public void registerHandler(IVoicedCommandHandler handler) | |
| 149 | + {
| |
| 150 | + String[] ids = handler.getVoicedCommandList(); | |
| 151 | + | |
| 152 | + for (int i = 0; i < ids.length; i++) | |
| 153 | + _datatable.put(ids[i].hashCode(), handler); | |
| 154 | + } | |
| 155 | + | |
| 156 | + public IVoicedCommandHandler getHandler(String voicedCommand) | |
| 157 | + {
| |
| 158 | + String command = voicedCommand; | |
| 159 | + | |
| 160 | + if (voicedCommand.indexOf(" ") != -1)
| |
| 161 | + command = voicedCommand.substring(0, voicedCommand.indexOf(" "));
| |
| 162 | + | |
| 163 | + return _datatable.get(command.hashCode()); | |
| 164 | + } | |
| 165 | + | |
| 166 | + public int size() | |
| 167 | + {
| |
| 168 | + return _datatable.size(); | |
| 169 | + } | |
| 170 | + | |
| 171 | + private static class SingletonHolder | |
| 172 | + {
| |
| 173 | + protected static final VoicedCommandHandler _instance = new VoicedCommandHandler(); | |
| 174 | + } | |
| 175 | +} | |
| 176 | diff --git aCis_gameserver/java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java | |
| 177 | index ac326e9..1ab0de7 100644 | |
| 178 | --- aCis_gameserver/java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java | |
| 179 | +++ aCis_gameserver/java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java | |
| 180 | @@ -1,34 +1,65 @@ | |
| 181 | package net.sf.l2j.gameserver.handler.chathandlers; | |
| 182 | ||
| 183 | +import java.util.StringTokenizer; | |
| 184 | + | |
| 185 | import net.sf.l2j.gameserver.enums.FloodProtector; | |
| 186 | import net.sf.l2j.gameserver.enums.SayType; | |
| 187 | import net.sf.l2j.gameserver.handler.IChatHandler; | |
| 188 | +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler; | |
| 189 | +import net.sf.l2j.gameserver.handler.VoicedCommandHandler; | |
| 190 | import net.sf.l2j.gameserver.model.actor.Player; | |
| 191 | import net.sf.l2j.gameserver.network.serverpackets.CreatureSay; | |
| 192 | ||
| 193 | public class ChatAll implements IChatHandler | |
| 194 | {
| |
| 195 | private static final SayType[] COMMAND_IDS = | |
| 196 | {
| |
| 197 | SayType.ALL | |
| 198 | }; | |
| 199 | ||
| 200 | @Override | |
| 201 | public void handleChat(SayType type, Player player, String target, String text) | |
| 202 | {
| |
| 203 | if (!player.getClient().performAction(FloodProtector.GLOBAL_CHAT)) | |
| 204 | return; | |
| 205 | - | |
| 206 | - final CreatureSay cs = new CreatureSay(player, type, text); | |
| 207 | - for (Player knownPlayer : player.getKnownTypeInRadius(Player.class, 1250)) | |
| 208 | - knownPlayer.sendPacket(cs); | |
| 209 | - | |
| 210 | - player.sendPacket(cs); | |
| 211 | + boolean vcd_used = false; | |
| 212 | + if (text.startsWith("."))
| |
| 213 | + {
| |
| 214 | + StringTokenizer st = new StringTokenizer(text); | |
| 215 | + IVoicedCommandHandler vch; | |
| 216 | + String command = ""; | |
| 217 | + if (st.countTokens() > 1) | |
| 218 | + {
| |
| 219 | + command = st.nextToken().substring(1); | |
| 220 | + target = text.substring(command.length() + 2); | |
| 221 | + vch = VoicedCommandHandler.getInstance().getHandler(command); | |
| 222 | + } | |
| 223 | + else | |
| 224 | + {
| |
| 225 | + command = text.substring(1); | |
| 226 | + vch = VoicedCommandHandler.getInstance().getHandler(command); | |
| 227 | + } | |
| 228 | + | |
| 229 | + if (vch != null) | |
| 230 | + {
| |
| 231 | + vch.useVoicedCommand(command, player, text); | |
| 232 | + vcd_used = true; | |
| 233 | + | |
| 234 | + } | |
| 235 | + } | |
| 236 | + if (!vcd_used) | |
| 237 | + {
| |
| 238 | + final CreatureSay cs = new CreatureSay(player, type, text); | |
| 239 | + for (Player knownPlayer : player.getKnownTypeInRadius(Player.class, 1250)) | |
| 240 | + knownPlayer.sendPacket(cs); | |
| 241 | + | |
| 242 | + player.sendPacket(cs); | |
| 243 | + } | |
| 244 | } | |
| 245 | ||
| 246 | @Override | |
| 247 | public SayType[] getChatTypeList() | |
| 248 | {
| |
| 249 | return COMMAND_IDS; | |
| 250 | } | |
| 251 | } | |
| 252 | \ No newline at end of file | |
| 253 | diff --git aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java | |
| 254 | index 882ab73..b973fdd 100644 | |
| 255 | --- aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java | |
| 256 | +++ aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java | |
| 257 | @@ -1,27 +1,29 @@ | |
| 258 | package net.sf.l2j.gameserver.network.clientpackets; | |
| 259 | ||
| 260 | import java.util.StringTokenizer; | |
| 261 | import java.util.logging.Logger; | |
| 262 | ||
| 263 | import net.sf.l2j.Config; | |
| 264 | import net.sf.l2j.gameserver.communitybbs.CommunityBoard; | |
| 265 | import net.sf.l2j.gameserver.data.manager.HeroManager; | |
| 266 | import net.sf.l2j.gameserver.data.xml.AdminData; | |
| 267 | import net.sf.l2j.gameserver.enums.FloodProtector; | |
| 268 | import net.sf.l2j.gameserver.handler.AdminCommandHandler; | |
| 269 | import net.sf.l2j.gameserver.handler.IAdminCommandHandler; | |
| 270 | +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler; | |
| 271 | +import net.sf.l2j.gameserver.handler.VoicedCommandHandler; | |
| 272 | import net.sf.l2j.gameserver.model.World; | |
| 273 | import net.sf.l2j.gameserver.model.WorldObject; | |
| 274 | import net.sf.l2j.gameserver.model.actor.Npc; | |
| 275 | import net.sf.l2j.gameserver.model.actor.Player; | |
| 276 | import net.sf.l2j.gameserver.model.actor.instance.OlympiadManagerNpc; | |
| 277 | import net.sf.l2j.gameserver.model.olympiad.OlympiadManager; | |
| 278 | import net.sf.l2j.gameserver.network.SystemMessageId; | |
| 279 | import net.sf.l2j.gameserver.network.serverpackets.ActionFailed; | |
| 280 | import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; | |
| 281 | import net.sf.l2j.gameserver.scripting.QuestState; | |
| 282 | ||
| 283 | public final class RequestBypassToServer extends L2GameClientPacket | |
| 284 | {
| |
| 285 | private static final Logger GMAUDIT_LOG = Logger.getLogger("gmaudit");
| |
| 286 | ||
| 287 | @@ -86,30 +88,44 @@ | |
| 288 | if (cmd.length > 1) | |
| 289 | {
| |
| 290 | final int itemId = Integer.parseInt(cmd[1]); | |
| 291 | html.setItemId(itemId); | |
| 292 | ||
| 293 | if (itemId == 7064 && cmd[0].equalsIgnoreCase("lidias_diary/7064-16.htm"))
| |
| 294 | {
| |
| 295 | final QuestState qs = player.getQuestList().getQuestState("Q023_LidiasHeart");
| |
| 296 | if (qs != null && qs.getCond() == 5 && qs.getInteger("diary") == 0)
| |
| 297 | qs.set("diary", "1");
| |
| 298 | } | |
| 299 | } | |
| 300 | html.disableValidation(); | |
| 301 | player.sendPacket(html); | |
| 302 | } | |
| 303 | + else if (_command.startsWith("voiced_"))
| |
| 304 | + {
| |
| 305 | + String command = _command.split(" ")[0];
| |
| 306 | + | |
| 307 | + IVoicedCommandHandler ach = VoicedCommandHandler.getInstance().getHandler(_command.substring(7)); | |
| 308 | + | |
| 309 | + if (ach == null) | |
| 310 | + {
| |
| 311 | + player.sendMessage("The command " + command.substring(7) + " does not exist!");
| |
| 312 | + LOGGER.warn("No handler registered for command '" + _command + "'");
| |
| 313 | + return; | |
| 314 | + } | |
| 315 | + ach.useVoicedCommand(_command.substring(7), player, null); | |
| 316 | + } | |
| 317 | else if (_command.startsWith("npc_"))
| |
| 318 | {
| |
| 319 | if (!player.validateBypass(_command)) | |
| 320 | return; | |
| 321 | ||
| 322 | int endOfId = _command.indexOf('_', 5);
| |
| 323 | String id; | |
| 324 | if (endOfId > 0) | |
| 325 | id = _command.substring(4, endOfId); | |
| 326 | else | |
| 327 | id = _command.substring(4); | |
| 328 | ||
| 329 | try | |
| 330 | {
| |
| 331 | final WorldObject object = World.getInstance().getObject(Integer.parseInt(id)); | |
| 332 |