Noticias:

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate

Menú Principal

Saltar (Modo Hulk)

Iniciado por Swarlog, Ago 12, 2022, 02:24 AM

Tema anterior - Siguiente tema

Swarlog


/*
 * 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.network.clientpackets;

import java.nio.BufferUnderflowException;

import net.sf.l2j.Config;
import net.sf.l2j.gameserver.GeoData;
import net.sf.l2j.gameserver.ai.CtrlIntention;
import net.sf.l2j.gameserver.model.L2CharPosition;
import net.sf.l2j.gameserver.model.Location;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
import net.sf.l2j.gameserver.network.serverpackets.FlyToLocation;
import net.sf.l2j.gameserver.network.serverpackets.StopMove;
import net.sf.l2j.gameserver.network.serverpackets.ValidateLocation;
import net.sf.l2j.gameserver.network.serverpackets.FlyToLocation.FlyType;
import net.sf.l2j.gameserver.util.Util;

public class MoveBackwardToLocation extends L2GameClientPacket
{
// cdddddd
private int _targetX;
private int _targetY;
private int _targetZ;
private int _originX;
private int _originY;
private int _originZ;
private int _moveMovement;

// For geodata
private int _curX;
private int _curY;
@SuppressWarnings("unused")
private int _curZ;

@Override
protected void readImpl()
{
_targetX = readD();
_targetY = readD();
_targetZ = readD();
_originX = readD();
_originY = readD();
_originZ = readD();

try
{
_moveMovement = readD(); // is 0 if cursor keys are used 1 if mouse is used
}
catch (BufferUnderflowException e)
{
if (Config.L2WALKER_PROTECTION)
{
L2PcInstance activeChar = getClient().getActiveChar();
Util.handleIllegalPlayerAction(activeChar, activeChar.getName() + " is trying to use L2Walker.", Config.DEFAULT_PUNISH);
}
}
}

@Override
protected void runImpl()
{
final L2PcInstance activeChar = getClient().getActiveChar();
if (activeChar == null)
return;

if (_targetX == _originX && _targetY == _originY && _targetZ == _originZ)
{
activeChar.sendPacket(new StopMove(activeChar));
return;
}

// Correcting targetZ from floor level to head level
_targetZ += activeChar.getTemplate().getCollisionHeight();

_curX = activeChar.getX();
_curY = activeChar.getY();
_curZ = activeChar.getZ();

if (activeChar.getTeleMode() > 0)
{
if (activeChar.getTeleMode() == 1)
activeChar.setTeleMode(0);

activeChar.sendPacket(ActionFailed.STATIC_PACKET);
activeChar.teleToLocation(_targetX, _targetY, _targetZ, false);
return;
}
if (_moveMovement == 0 && Config.GEODATA < 1) // cursor movement without geodata is disabled
activeChar.sendPacket(ActionFailed.STATIC_PACKET);

else
{
double dx = _targetX - _curX;
double dy = _targetY - _curY;

// Can't move if character is confused, or trying to move a huge distance
if (activeChar.isOutOfControl() || ((dx * dx + dy * dy) > 98010000)) // 9900*9900
{
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
+final boolean CanJump = Config.CAN_JUMP;

           + if(CanJump)
+Phda(activeChar,_targetX, _targetY, _targetZ);
+else
+activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(_targetX, _targetY, _targetZ, 0));
}
}

+ public void Phda(L2PcInstance activeChar,int x,int y, int z)
+ {
+ final boolean EnableGeodata = Config.GEODATA > 0;
+        Location l = new Location(x, y, z);
+
+ if (EnableGeodata)
+ l = GeoData.getInstance().moveCheck(activeChar.getX(), activeChar.getY(),  activeChar.getZ(), x, y, z);
+
+ activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+ activeChar.broadcastPacket(new FlyToLocation(activeChar, l.getX(), l.getY(), l.getZ(), FlyType.THROW_UP));
+ activeChar.abortAttack();
+ activeChar.abortCast();
+ activeChar.setXYZ(l.getX(), l.getY(), l.getZ());
+ activeChar.broadcastPacket(new ValidateLocation(activeChar));
+ }
}

Config.java

+public static boolean CAN_JUMP;
+CAN_JUMP = Boolean.parseBoolean(Anonymous.getProperty("CanJump", "True"));

config properties

#Custom jump By Mr.Anonymous
CanJump = False