浏览代码

Remove obsolete packets + handle illegal action if someone use them.

JIV 15 年之前
父节点
当前提交
7fdb2f3126

+ 1 - 1
L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Attackable.java

@@ -2021,7 +2021,7 @@ public class L2Attackable extends L2Npc
 	private void levelSoulCrystals(L2Character attacker)
 	{
 		// Only L2PcInstance can absorb a soul
-		if (!(attacker instanceof L2PcInstance) && !(attacker instanceof L2Summon))
+		if (!(attacker instanceof L2Playable))
 		{
 			resetAbsorbList(); return;
 		}

+ 15 - 0
L2_GameServer/java/com/l2jserver/gameserver/network/L2GameClient.java

@@ -47,6 +47,7 @@ import com.l2jserver.gameserver.model.entity.L2Event;
 import com.l2jserver.gameserver.model.entity.TvTEvent;
 import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
 import com.l2jserver.gameserver.network.serverpackets.ServerClose;
+import com.l2jserver.gameserver.util.Util;
 import com.l2jserver.util.EventData;
 
 /**
@@ -751,4 +752,18 @@ public final class L2GameClient extends MMOClient<MMOConnection<L2GameClient>>
 	{
 		_protocol = b;
 	}
+	
+	public boolean handleCheat(String punishment)
+	{
+		if (_activeChar != null)
+		{
+			Util.handleIllegalPlayerAction(_activeChar, toString()+": "+punishment, Config.DEFAULT_PUNISH);
+			return true;
+		}
+		
+		Logger _logAudit = Logger.getLogger("audit");
+		_logAudit.log(Level.INFO, "AUDIT: Client "+toString()+" kicked for reason: "+punishment);
+		closeNow();
+		return false;
+	}
 }

+ 8 - 5
L2_GameServer/java/com/l2jserver/gameserver/network/L2GamePacketHandler.java

@@ -259,13 +259,16 @@ public final class L2GamePacketHandler implements IPacketHandler<L2GameClient>,
                     	// RequestTeleportPacket
                     	break;
 					case 0x34:
-						msg = new RequestSocialAction();
+						//msg = new RequestSocialAction();
+						client.handleCheat("Used obsolete RequestSocialAction packet");
 						break;
 					case 0x35:
-						msg = new ChangeMoveType2();
+						//msg = new ChangeMoveType2();
+						client.handleCheat("Used obsolete ChangeMoveType packet");
 						break;
 					case 0x36:
-						msg = new ChangeWaitType2();
+						//msg = new ChangeWaitType2();
+						client.handleCheat("Used obsolete ChangeWaitType packet");
 						break;
 					case 0x37:
 						msg = new RequestSellItem();
@@ -1085,7 +1088,7 @@ public final class L2GamePacketHandler implements IPacketHandler<L2GameClient>,
 			return;
 		
 		int size = buf.remaining();
-		_log.warning("Unknown Packet: "+Integer.toHexString(opcode)+" on State: "+state.name()+" Client: "+client.toString());
+		_log.warning("Unknown Packet: 0x"+Integer.toHexString(opcode)+" on State: "+state.name()+" Client: "+client.toString());
      	byte[] array = new byte[size];
      	buf.get(array);
      	_log.warning(Util.printData(array, size));
@@ -1096,7 +1099,7 @@ public final class L2GamePacketHandler implements IPacketHandler<L2GameClient>,
 		if (!Config.PACKET_HANDLER_DEBUG)
 			return;
 		int size = buf.remaining();
-		_log.warning("Unknown Packet: "+Integer.toHexString(opcode)+":" + Integer.toHexString(id2)+" on State: "+state.name()+" Client: "+client.toString());
+		_log.warning("Unknown Packet: 0x"+Integer.toHexString(opcode)+":0x" + Integer.toHexString(id2)+" on State: "+state.name()+" Client: "+client.toString());
      	byte[] array = new byte[size];
      	buf.get(array);
      	_log.warning(Util.printData(array, size));

+ 0 - 56
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/ChangeMoveType2.java

@@ -1,56 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- * 
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package com.l2jserver.gameserver.network.clientpackets;
-
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-
-/**
- * This class ...
- *
- * @version $Revision: 1.1.4.3 $ $Date: 2005/03/27 15:29:30 $
- */
-public final class ChangeMoveType2 extends L2GameClientPacket
-{
-	private static final String _C__1C_CHANGEMOVETYPE2 = "[C] 1C ChangeMoveType2";
-
-	private boolean _typeRun;
-
-	@Override
-	protected void readImpl()
-	{
-		_typeRun = readD() == 1;
-	}
-
-	@Override
-	protected void runImpl()
-	{
-		L2PcInstance player = getClient().getActiveChar();
-		if (player == null)
-		    return;
-		if (_typeRun)
-			player.setRunning();
-		else
-			player.setWalking();
-	}
-
-	/* (non-Javadoc)
-	 * @see com.l2jserver.gameserver.clientpackets.ClientBasePacket#getType()
-	 */
-	@Override
-	public String getType()
-	{
-		return _C__1C_CHANGEMOVETYPE2;
-	}
-}

+ 0 - 84
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/ChangeWaitType2.java

@@ -1,84 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- * 
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package com.l2jserver.gameserver.network.clientpackets;
-
-import com.l2jserver.gameserver.instancemanager.CastleManager;
-import com.l2jserver.gameserver.model.L2Object;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.model.actor.instance.L2StaticObjectInstance;
-import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
-import com.l2jserver.gameserver.network.serverpackets.ChairSit;
-
-/**
- * This class ...
- *
- * @version $Revision: 1.1.4.3 $ $Date: 2005/03/27 15:29:30 $
- */
-public final class ChangeWaitType2 extends L2GameClientPacket
-{
-	private static final String _C__1D_CHANGEWAITTYPE2 = "[C] 1D ChangeWaitType2";
-
-	private boolean _typeStand;
-
-	@Override
-	protected void readImpl()
-	{
-		_typeStand = (readD() == 1);
-	}
-
-	@Override
-	protected void runImpl()
-	{
-		L2PcInstance player = getClient().getActiveChar();
-		L2Object target = player.getTarget();
-		if(getClient() != null)
-		{
-			if (player.isOutOfControl())
-			{
-				player.sendPacket(ActionFailed.STATIC_PACKET);
-				return;
-			}
-
-			if (player.getMountType() != 0) //prevent sit/stand if you riding
-				return;
-			if (target != null
-					&& !player.isSitting()
-					&& target instanceof L2StaticObjectInstance
-					&& ((L2StaticObjectInstance)target).getType() == 1
-					&& CastleManager.getInstance().getCastle(target) != null
-					&& player.isInsideRadius(target, L2StaticObjectInstance.INTERACTION_DISTANCE, false, false)
-			)
-			{
-				ChairSit cs = new ChairSit(player,((L2StaticObjectInstance)target).getStaticObjectId());
-				player.sendPacket(cs);
-				player.sitDown();
-				player.broadcastPacket(cs);
-			}
-			if (_typeStand)
-				player.standUp();
-			else
-				player.sitDown();
-		}
-	}
-
-	/* (non-Javadoc)
-	 * @see com.l2jserver.gameserver.clientpackets.ClientBasePacket#getType()
-	 */
-	@Override
-	public String getType()
-	{
-		return _C__1D_CHANGEWAITTYPE2;
-	}
-}

+ 0 - 112
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/RequestSocialAction.java

@@ -1,112 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- * 
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package com.l2jserver.gameserver.network.clientpackets;
-
-import java.util.logging.Logger;
-
-import com.l2jserver.Config;
-import com.l2jserver.gameserver.ai.CtrlIntention;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.network.SystemMessageId;
-import com.l2jserver.gameserver.network.serverpackets.SocialAction;
-import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
-import com.l2jserver.gameserver.util.Util;
-
-
-/**
- * This class ...
- *
- * @version $Revision: 1.6.4.4 $ $Date: 2005/03/27 15:29:30 $
- */
-public class RequestSocialAction extends L2GameClientPacket
-{
-	private static final String _C__1B_REQUESTSOCIALACTION = "[C] 1B RequestSocialAction";
-	private static Logger _log = Logger.getLogger(RequestSocialAction.class.getName());
-
-	// format  cd
-	private int _actionId;
-
-
-	@Override
-	protected void readImpl()
-	{
-		_actionId  = readD();
-	}
-
-	@Override
-	protected void runImpl()
-	{
-		L2PcInstance activeChar = getClient().getActiveChar();
-		if (activeChar == null)
-		    return;
-
-        // You cannot do anything else while fishing
-        if (activeChar.isFishing())
-        {
-            SystemMessage sm = new SystemMessage(SystemMessageId.CANNOT_DO_WHILE_FISHING_3);
-            activeChar.sendPacket(sm);
-            sm = null;
-            return;
-        }
-
-        // check if its the actionId is allowed
-        if (_actionId < 2 || _actionId > 14)
-        {
-        	Util.handleIllegalPlayerAction(activeChar, "Warning!! Character "+activeChar.getName()+" of account "+activeChar.getAccountName()+" requested an internal Social Action.", Config.DEFAULT_PUNISH);
-        	return;
-        }
-
-		if (	activeChar.getPrivateStoreType()==0 &&
-				activeChar.getActiveRequester()==null &&
-				!activeChar.isAlikeDead() &&
-				(!activeChar.isAllSkillsDisabled() || activeChar.isInDuel()) &&
-				!activeChar.isCastingNow() && !activeChar.isCastingSimultaneouslyNow() && 
-				activeChar.getAI().getIntention()==CtrlIntention.AI_INTENTION_IDLE)
-		{
-			if (Config.DEBUG) _log.fine("Social Action:" + _actionId);
-
-			SocialAction atk = new SocialAction(activeChar.getObjectId(), _actionId);
-			activeChar.broadcastPacket(atk);
-			/*
-			// Schedule a social task to wait for the animation to finish
-			ThreadPoolManager.getInstance().scheduleGeneral(new SocialTask(this), 2600);
-			activeChar.setIsParalyzed(true);
-			*/
-		}
-	}
-	/*
-	class SocialTask implements Runnable
-	{
-		L2PcInstance _player;
-		SocialTask(RequestSocialAction action)
-		{
-			_player = getClient().getActiveChar();
-		}
-		public void run()
-		{
-			_player.setIsParalyzed(false);
-		}
-	}
-	*/
-
-	/* (non-Javadoc)
-	 * @see com.l2jserver.gameserver.clientpackets.ClientBasePacket#getType()
-	 */
-	@Override
-	public String getType()
-	{
-		return _C__1B_REQUESTSOCIALACTION;
-	}
-}