Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.efi.gameserver.network.la2.in;
- import org.efi.Config;
- import org.efi.gameserver.network.la2.L2GameClient;
- import org.efi.gameserver.network.la2.L2GameClientPacket;
- import org.efi.gameserver.network.la2.out.KeyPacket;
- import com.lameguard.LameGuard;
- import com.lameguard.exception.LameGuardException;
- import java.util.logging.Logger;
- public final class ProtocolVersion extends L2GameClientPacket
- {
- private static final String _C__00_PROTOCOLVERSION = "[C] 00 ProtocolVersion";
- static Logger _log _log = Logger.getLogger(ProtocolVersion.class.getName());
- private int _version;
- private byte[] __data;
- private int __version;
- private int __patch;
- private int __instances;
- public ProtocolVersion()
- {
- __data = null;
- __version = 0;
- __patch = 0;
- __instances = 0;
- }
- protected void runImplOld()
- {
- if (_version == -2)
- {
- if (Config.DEBUG)
- {
- _log.info("Ping received");
- }
- ((L2GameClient)getClient()).closeNow();
- }
- else if (_version < Config.MIN_PROTOCOL_REVISION || _version > Config.MAX_PROTOCOL_REVISION)
- {
- _log.info("Client: " + ((L2GameClient)getClient()).toString() + " -> Protocol Revision: " + _version + " is invalid. Minimum is " + Config.MIN_PROTOCOL_REVISION + " and Maximum is " + Config.MAX_PROTOCOL_REVISION + " are supported. Closing connection.");
- _log.warning("Wrong Protocol Version " + _version);
- ((L2GameClient)getClient()).closeNow();
- }
- else
- {
- if (Config.DEBUG)
- {
- _log.fine("Client Protocol Revision is ok: " + _version);
- }
- KeyPacket pk = new KeyPacket(((L2GameClient)getClient()).enableCrypt());
- ((L2GameClient)getClient()).sendPacket(pk);
- }
- }
- protected void readImpl()
- {
- __data = new byte[256];
- try
- {
- _version = readD();
- }
- catch (Exception localException1)
- {
- getClient().closeNow();
- return;
- }
- try
- {
- __version = readH();
- __patch = (readC() & 0xFF);
- __instances = (readC() & 0xFF);
- readB(__data);
- }
- catch (Exception localException2)
- {
- __data = null;
- return;
- }
- }
- protected void runImpl()
- {
- try
- {
- LameGuard.getInstance().onProtocolVersionPacket(getClient(), _version, __version, __patch, __instances, __data);
- runImplOld();
- }
- catch (LameGuardException localLameGuardException)
- {
- getClient().closeNow();
- return;
- }
- }
- public String getType()
- {
- return _C__00_PROTOCOLVERSION;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement