Support for ExMagicSkillUseGround packet.
This commit is contained in:
@@ -8766,6 +8766,17 @@ public class Player extends Playable
|
||||
final Location worldPosition = _currentSkillWorldPosition;
|
||||
if ((usedSkill.getTargetType() == TargetType.GROUND) && (worldPosition == null))
|
||||
{
|
||||
if (getCurrentMp() >= usedSkill.getMpConsume())
|
||||
{
|
||||
if (usedSkill.checkCondition(this, target, true))
|
||||
{
|
||||
sendPacket(new MagicSkillUse(this, this, usedSkill.getDisplayId(), usedSkill.getDisplayLevel(), 0, 0, usedSkill.getReuseDelayGroup(), -1, SkillCastingType.NORMAL, true));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sendPacket(SystemMessageId.NOT_ENOUGH_MP);
|
||||
}
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return false;
|
||||
}
|
||||
|
@@ -72,6 +72,7 @@ import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExMagicSkillUseGround;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExRotation;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.FlyToLocation;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillCanceld;
|
||||
@@ -349,6 +350,16 @@ public class SkillCaster implements Runnable
|
||||
if (!_skill.isNotBroadcastable())
|
||||
{
|
||||
caster.broadcastPacket(new MagicSkillUse(caster, target, _skill.getDisplayId(), _skill.getDisplayLevel(), displayedCastTime, reuseDelay, _skill.getReuseDelayGroup(), actionId, _castingType));
|
||||
if ((_skill.getTargetType() == TargetType.GROUND) && caster.isPlayer())
|
||||
{
|
||||
final Player player = caster.getActingPlayer();
|
||||
final Location worldPosition = player.getCurrentSkillWorldPosition();
|
||||
if (worldPosition != null)
|
||||
{
|
||||
final Location location = new Location(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ(), worldPosition.getHeading());
|
||||
ThreadPool.schedule(() -> player.broadcastPacket(new ExMagicSkillUseGround(player.getObjectId(), _skill.getId(), location)), 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (caster.isPlayer() && !instantCast)
|
||||
@@ -575,6 +586,12 @@ public class SkillCaster implements Runnable
|
||||
// On each repeat recharge shots before cast.
|
||||
caster.rechargeShots(_skill.useSoulShot(), _skill.useSpiritShot(), false);
|
||||
|
||||
// Reset current skill world position.
|
||||
if (caster.isPlayer())
|
||||
{
|
||||
caster.getActingPlayer().setCurrentSkillWorldPosition(null);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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 org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ExMagicSkillUseGround extends ServerPacket
|
||||
{
|
||||
private final int _playerObjectId;
|
||||
private final int _skillId;
|
||||
private final Location _location;
|
||||
|
||||
public ExMagicSkillUseGround(int playerObjectId, int skillId, Location location)
|
||||
{
|
||||
_playerObjectId = playerObjectId;
|
||||
_skillId = skillId;
|
||||
_location = location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write()
|
||||
{
|
||||
ServerPackets.EX_MAGIC_SKILL_USE_GROUND.writeId(this);
|
||||
writeInt(_playerObjectId);
|
||||
writeInt(_skillId);
|
||||
writeInt(_location.getX());
|
||||
writeInt(_location.getY());
|
||||
writeInt(_location.getZ());
|
||||
}
|
||||
}
|
@@ -23,14 +23,12 @@ import java.util.List;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.interfaces.IPositionable;
|
||||
import org.l2jmobius.gameserver.model.skill.SkillCastingType;
|
||||
import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
|
||||
/**
|
||||
* MagicSkillUse server packet implementation.
|
||||
* @author UnAfraid, NosBit
|
||||
* @author UnAfraid, NosBit, Mobius
|
||||
*/
|
||||
public class MagicSkillUse extends ServerPacket
|
||||
{
|
||||
@@ -43,12 +41,12 @@ public class MagicSkillUse extends ServerPacket
|
||||
private final SkillCastingType _castingType; // Defines which client bar is going to use.
|
||||
private final Creature _creature;
|
||||
private final WorldObject _target;
|
||||
private final List<Integer> _unknown = Collections.emptyList();
|
||||
private final boolean _isGroundTargetSkill;
|
||||
private final List<Location> _groundLocations;
|
||||
|
||||
public MagicSkillUse(Creature creature, WorldObject target, int skillId, int skillLevel, int hitTime, int reuseDelay, int reuseGroup, int actionId, SkillCastingType castingType)
|
||||
public MagicSkillUse(Creature creature, WorldObject target, int skillId, int skillLevel, int hitTime, int reuseDelay, int reuseGroup, int actionId, SkillCastingType castingType, boolean isGroundTargetSkill)
|
||||
{
|
||||
super(75);
|
||||
super(84);
|
||||
_creature = creature;
|
||||
_target = target;
|
||||
_skillId = skillId;
|
||||
@@ -58,18 +56,16 @@ public class MagicSkillUse extends ServerPacket
|
||||
_reuseDelay = reuseDelay;
|
||||
_actionId = actionId;
|
||||
_castingType = castingType;
|
||||
Location skillWorldPos = null;
|
||||
if (creature.isPlayer())
|
||||
{
|
||||
final Player player = creature.getActingPlayer();
|
||||
if (player.getCurrentSkillWorldPosition() != null)
|
||||
{
|
||||
skillWorldPos = player.getCurrentSkillWorldPosition();
|
||||
}
|
||||
}
|
||||
_isGroundTargetSkill = isGroundTargetSkill;
|
||||
final Location skillWorldPos = creature.isPlayer() ? creature.getActingPlayer().getCurrentSkillWorldPosition() : null;
|
||||
_groundLocations = skillWorldPos != null ? Arrays.asList(skillWorldPos) : Collections.emptyList();
|
||||
}
|
||||
|
||||
public MagicSkillUse(Creature creature, WorldObject target, int skillId, int skillLevel, int hitTime, int reuseDelay, int reuseGroup, int actionId, SkillCastingType castingType)
|
||||
{
|
||||
this(creature, target, skillId, skillLevel, hitTime, reuseDelay, reuseGroup, actionId, castingType, false);
|
||||
}
|
||||
|
||||
public MagicSkillUse(Creature creature, WorldObject target, int skillId, int skillLevel, int hitTime, int reuseDelay)
|
||||
{
|
||||
this(creature, target, skillId, skillLevel, hitTime, reuseDelay, -1, -1, SkillCastingType.NORMAL);
|
||||
@@ -95,23 +91,22 @@ public class MagicSkillUse extends ServerPacket
|
||||
writeInt(_creature.getX());
|
||||
writeInt(_creature.getY());
|
||||
writeInt(_creature.getZ());
|
||||
writeShort(_unknown.size()); // TODO: Implement me!
|
||||
for (int unknown : _unknown)
|
||||
{
|
||||
writeShort(unknown);
|
||||
}
|
||||
writeShort(_isGroundTargetSkill ? 64 : 0);
|
||||
writeShort(_groundLocations.size());
|
||||
for (IPositionable target : _groundLocations)
|
||||
for (Location location : _groundLocations)
|
||||
{
|
||||
writeInt(target.getX());
|
||||
writeInt(target.getY());
|
||||
writeInt(target.getZ());
|
||||
writeInt(location.getX());
|
||||
writeInt(location.getY());
|
||||
writeInt(location.getZ());
|
||||
}
|
||||
writeInt(_target.getX());
|
||||
writeInt(_target.getY());
|
||||
writeInt(_target.getZ());
|
||||
writeInt(_actionId >= 0); // 1 when ID from RequestActionUse is used
|
||||
writeInt(_actionId >= 0 ? _actionId : 0); // ID from RequestActionUse. Used to set cooldown on summon skills.
|
||||
writeInt(-1); // 306
|
||||
if (_groundLocations.isEmpty())
|
||||
{
|
||||
writeInt(-1); // 306
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user