Support for ExMagicSkillUseGround packet.

This commit is contained in:
MobiusDevelopment 2022-12-22 22:05:24 +00:00
parent 775999d45e
commit 9f7a2effb2
27 changed files with 651 additions and 183 deletions

View File

@ -8707,6 +8707,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;
}

View File

@ -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;
}

View File

@ -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());
}
}

View File

@ -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
}
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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());
}
}

View File

@ -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
}
}
}

View File

@ -8801,6 +8801,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;
}

View File

@ -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;
}

View File

@ -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());
}
}

View File

@ -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
}
}
}

View File

@ -10,17 +10,18 @@
<affectRange>250</affectRange>
<fanRange>0;0;250;60</fanRange>
<effectRange>1100</effectRange>
<nextAction>ATTACK</nextAction>
<magicLevel>80</magicLevel>
<isMagic>6</isMagic>
<isMagic>0</isMagic>
<mpConsume>500</mpConsume>
<hitTime>1000</hitTime>
<operateType>A1</operateType>
<reuseDelay>60000</reuseDelay>
<staticReuse>true</staticReuse>
<magicCriticalRate>5</magicCriticalRate>
<targetType>ENEMY</targetType>
<affectScope>SINGLE</affectScope>
<targetType>GROUND</targetType>
<affectScope>FAN_PB</affectScope>
<affectObject>NOT_FRIEND</affectObject>
<fanRange>0;0;900;20</fanRange>
<conditions>
<condition name="EquipWeapon">
<weaponType>
@ -29,6 +30,10 @@
</condition>
</conditions>
<effects>
<effect name="PhysicalAttack">
<power>8000</power>
<pDefMod>0.5</pDefMod>
</effect>
<effect name="CallSkill">
<skillId>47020</skillId> <!-- Goring Charge -->
<skillLevel>1</skillLevel>
@ -1112,20 +1117,29 @@
<activateRate>100</activateRate>
<magicLevel>80</magicLevel>
<isDebuff>true</isDebuff>
<trait>SHOCK</trait>
<targetType>ENEMY</targetType>
<affectScope>SQUARE</affectScope>
<targetType>GROUND</targetType>
<fanRange>0;0;600;60</fanRange>
<affectScope>FAN</affectScope>
<affectObject>NOT_FRIEND</affectObject>
<conditions>
<condition name="EquipWeapon">
<weaponType>
<item>PISTOLS</item>
</weaponType>
</condition>
</conditions>
<effects>
<effect name="PhysicalAttack">
<power>8000</power>
<pDefMod>0.5</pDefMod>
</effect>
<effect name="KnockBack">
<distance>50</distance>
<speed>400</speed>
<knockDown>true</knockDown>
</effect>
<effect name="DefenceTrait">
<DERANGEMENT>100</DERANGEMENT>
<SLEEP>100</SLEEP>
<HOLD>100</HOLD>
<SHOCK>100</SHOCK>
</effect>
<effect name="BlockActions">
<allowedSkills>10279;10517;10025;10776;11770;1904;11264;11093;13314;1912;7002;18721;18722;28203;30516;35190</allowedSkills>
</effect>

View File

@ -8658,6 +8658,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;
}

View File

@ -73,6 +73,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;
@ -345,6 +346,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;
}

View File

@ -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());
}
}

View File

@ -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
}
}
}

View File

@ -10,17 +10,18 @@
<affectRange>250</affectRange>
<fanRange>0;0;250;60</fanRange>
<effectRange>1100</effectRange>
<nextAction>ATTACK</nextAction>
<magicLevel>80</magicLevel>
<isMagic>6</isMagic>
<isMagic>0</isMagic>
<mpConsume>500</mpConsume>
<hitTime>1000</hitTime>
<operateType>A1</operateType>
<reuseDelay>60000</reuseDelay>
<staticReuse>true</staticReuse>
<magicCriticalRate>5</magicCriticalRate>
<targetType>ENEMY</targetType>
<affectScope>SINGLE</affectScope>
<targetType>GROUND</targetType>
<affectScope>FAN_PB</affectScope>
<affectObject>NOT_FRIEND</affectObject>
<fanRange>0;0;900;20</fanRange>
<conditions>
<condition name="EquipWeapon">
<weaponType>
@ -29,6 +30,10 @@
</condition>
</conditions>
<effects>
<effect name="PhysicalAttack">
<power>8000</power>
<pDefMod>0.5</pDefMod>
</effect>
<effect name="CallSkill">
<skillId>47020</skillId> <!-- Goring Charge -->
<skillLevel>1</skillLevel>
@ -1112,20 +1117,29 @@
<activateRate>100</activateRate>
<magicLevel>80</magicLevel>
<isDebuff>true</isDebuff>
<trait>SHOCK</trait>
<targetType>ENEMY</targetType>
<affectScope>SQUARE</affectScope>
<targetType>GROUND</targetType>
<fanRange>0;0;600;60</fanRange>
<affectScope>FAN</affectScope>
<affectObject>NOT_FRIEND</affectObject>
<conditions>
<condition name="EquipWeapon">
<weaponType>
<item>PISTOLS</item>
</weaponType>
</condition>
</conditions>
<effects>
<effect name="PhysicalAttack">
<power>8000</power>
<pDefMod>0.5</pDefMod>
</effect>
<effect name="KnockBack">
<distance>50</distance>
<speed>400</speed>
<knockDown>true</knockDown>
</effect>
<effect name="DefenceTrait">
<DERANGEMENT>100</DERANGEMENT>
<SLEEP>100</SLEEP>
<HOLD>100</HOLD>
<SHOCK>100</SHOCK>
</effect>
<effect name="BlockActions">
<allowedSkills>10279;10517;10025;10776;11770;1904;11264;11093;13314;1912;7002;18721;18722;28203;30516;35190</allowedSkills>
</effect>

View File

@ -8903,6 +8903,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;
}

View File

@ -73,6 +73,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;
@ -345,6 +346,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;
}

View File

@ -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());
}
}

View File

@ -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
}
}
}

View File

@ -10,17 +10,18 @@
<affectRange>250</affectRange>
<fanRange>0;0;250;60</fanRange>
<effectRange>1100</effectRange>
<nextAction>ATTACK</nextAction>
<magicLevel>80</magicLevel>
<isMagic>6</isMagic>
<isMagic>0</isMagic>
<mpConsume>500</mpConsume>
<hitTime>1000</hitTime>
<operateType>A1</operateType>
<reuseDelay>60000</reuseDelay>
<staticReuse>true</staticReuse>
<magicCriticalRate>5</magicCriticalRate>
<targetType>ENEMY</targetType>
<affectScope>SINGLE</affectScope>
<targetType>GROUND</targetType>
<affectScope>FAN_PB</affectScope>
<affectObject>NOT_FRIEND</affectObject>
<fanRange>0;0;900;20</fanRange>
<conditions>
<condition name="EquipWeapon">
<weaponType>
@ -29,6 +30,10 @@
</condition>
</conditions>
<effects>
<effect name="PhysicalAttack">
<power>8000</power>
<pDefMod>0.5</pDefMod>
</effect>
<effect name="CallSkill">
<skillId>47020</skillId> <!-- Goring Charge -->
<skillLevel>1</skillLevel>
@ -1621,20 +1626,29 @@
<activateRate>100</activateRate>
<magicLevel>80</magicLevel>
<isDebuff>true</isDebuff>
<trait>SHOCK</trait>
<targetType>ENEMY</targetType>
<affectScope>SQUARE</affectScope>
<targetType>GROUND</targetType>
<fanRange>0;0;600;60</fanRange>
<affectScope>FAN</affectScope>
<affectObject>NOT_FRIEND</affectObject>
<conditions>
<condition name="EquipWeapon">
<weaponType>
<item>PISTOLS</item>
</weaponType>
</condition>
</conditions>
<effects>
<effect name="PhysicalAttack">
<power>8000</power>
<pDefMod>0.5</pDefMod>
</effect>
<effect name="KnockBack">
<distance>50</distance>
<speed>400</speed>
<knockDown>true</knockDown>
</effect>
<effect name="DefenceTrait">
<DERANGEMENT>100</DERANGEMENT>
<SLEEP>100</SLEEP>
<HOLD>100</HOLD>
<SHOCK>100</SHOCK>
</effect>
<effect name="BlockActions">
<allowedSkills>10279;10517;10025;10776;11770;1904;11264;11093;13314;1912;7002;18721;18722;28203;30516;35190</allowedSkills>
</effect>

View File

@ -8903,6 +8903,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;
}

View File

@ -73,6 +73,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;
@ -345,6 +346,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;
}

View File

@ -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());
}
}

View File

@ -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
}
}
}