Noticias:

No tienes permiso para ver los enlaces. Para poder verlos Registrate o Conectate.

Menú Principal

Movimiento Flash

Iniciado por Swarlog, Jul 25, 2025, 11:59 PM

Tema anterior - Siguiente tema

Swarlog

No tienes permiso para ver los enlaces. Para poder verlos Registrate o Conectate.

Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/TestFlash.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/TestFlash.java	(revision 0)
+++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/TestFlash.java	(revision 0)
@@ -0,0 +1,104 @@
+/*
+ * 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 net.sf.l2j.gameserver.handler.voicedcommandhandlers;
+
+import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.ai.CtrlIntention;
+import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
+import net.sf.l2j.gameserver.network.serverpackets.ValidateLocation;
+import net.sf.l2j.gameserver.skills.AbnormalEffect;
+
+/**
+ * @author Anarchy
+ *
+ */
+public class TestFlash implements IVoicedCommandHandler
+{
+	private static final String[] VOICED_COMMANDS = { "flash" };
+	
+	@Override
+	public boolean useVoicedCommand(String command, L2PcInstance activeChar)
+	{
+		if (command.equals("flash"))
+		{
+			if (activeChar.flashing)
+			{
+				activeChar.sendMessage("You have already requested for a flash on next click.");
+				return false;
+			}
+			activeChar.flashing = true;
+			activeChar.sendMessage("Your next click will flash you to your location.");
+		}
+		
+		return true;
+	}
+
+	@Override
+	public String[] getVoicedCommandList()
+	{
+		return VOICED_COMMANDS;
+	}
+	
+	public static void flash(L2PcInstance p, int x, int y, int z)
+	{
+		if (p.isInsideRadius(x, y, 350, false))
+		{
+			p.stopMove(null);
+			p.startAbnormalEffect(AbnormalEffect.MAGIC_CIRCLE);
+			p.flashing = false;
+			p.sendPacket(ActionFailed.STATIC_PACKET);
+			ThreadPoolManager.getInstance().scheduleGeneral(new DoIt(p, x, y, z), 3500);
+		}
+		else
+		{
+			p.sendMessage("Too far.");
+			p.sendPacket(ActionFailed.STATIC_PACKET);
+		}
+	}
+	
+	private static class DoIt implements Runnable
+	{
+		private L2PcInstance p = null;
+		private int x = 0, y = 0, z = 0;
+		
+		public DoIt(L2PcInstance p, int x, int y, int z)
+		{
+			this.p = p;
+			this.x = x;
+			this.y = y;
+			this.z = z;
+		}
+		
+		@Override
+		public void run()
+		{
+			p.abortAttack();
+			p.abortCast();
+			p.setIsTeleporting(true);
+			p.setTarget(null);
+			p.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
+			p.decayMe();
+			p.getPosition().setXYZ(x, y, z);
+			p.onTeleported();
+			p.broadcastUserInfo();
+			p.sendPacket(new ValidateLocation(p));
+			p.sendPacket(ActionFailed.STATIC_PACKET);
+			p.revalidateZone(true);
+			p.stopAbnormalEffect(AbnormalEffect.MAGIC_CIRCLE);
+		}
+	}
+}
Index: java/net/sf/l2j/gameserver/network/clientpackets/MoveBackwardToLocation.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/MoveBackwardToLocation.java	(revision 3)
+++ java/net/sf/l2j/gameserver/network/clientpackets/MoveBackwardToLocation.java	(working copy)
@@ -18,6 +18,7 @@
 
 import net.sf.l2j.Config;
 import net.sf.l2j.gameserver.ai.CtrlIntention;
+import net.sf.l2j.gameserver.handler.voicedcommandhandlers.TestFlash;
 import net.sf.l2j.gameserver.model.L2CharPosition;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
 import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
@@ -95,6 +96,12 @@
 			return;
 		}
 		
+		if (activeChar.flashing)
+		{
+			TestFlash.flash(activeChar, _targetX, _targetY, _targetZ);
+			return;
+		}
+		
 		if (_moveMovement == 0 && Config.GEODATA < 1) // cursor movement without geodata is disabled
 			activeChar.sendPacket(ActionFailed.STATIC_PACKET);
 		else
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(revision 20)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -234,6 +234,8 @@
  */
 public final class L2PcInstance extends L2Playable
 {
+	public boolean flashing = false;
+	
 	private boolean _isTopKiller = false;
 	
 	public boolean isTopKiller()
Index: java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java	(revision 14)
+++ java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java	(working copy)
@@ -22,6 +22,7 @@
 import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Kills;
 import net.sf.l2j.gameserver.handler.voicedcommandhandlers.KinoChoose;
 import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Leave;
+import net.sf.l2j.gameserver.handler.voicedcommandhandlers.TestFlash;
 
 public class VoicedCommandHandler
 {
@@ -43,6 +44,7 @@
 		{
 			registerVoicedCommandHandler(new KinoChoose());
 		}
+		registerVoicedCommandHandler(new TestFlash());
 	}
 	
 	public void registerVoicedCommandHandler(IVoicedCommandHandler handler)