Fixed skill attack for pets.

Thanks to Index.
This commit is contained in:
MobiusDevelopment 2022-04-23 21:19:27 +00:00
parent 96570970d4
commit 13ee16679b
20 changed files with 420 additions and 110 deletions

View File

@ -629,7 +629,7 @@ public abstract class Summon extends Playable
}
// Get the target for the skill
final WorldObject target;
WorldObject target;
if (skill.getTargetType() == TargetType.OWNER_PET)
{
target = _owner;
@ -656,8 +656,16 @@ public abstract class Summon extends Playable
// Check the validity of the target
if (target == null)
{
sendPacket(SystemMessageId.YOUR_TARGET_CANNOT_BE_FOUND);
return false;
if (!isMovementDisabled())
{
setTarget(_owner.getTarget());
target = skill.getTarget(this, forceUse, dontMove, false);
}
if (target == null)
{
sendPacket(SystemMessageId.YOUR_TARGET_CANNOT_BE_FOUND);
return false;
}
}
// Check if this skill is enabled (e.g. reuse time)

View File

@ -18,7 +18,9 @@ package org.l2jmobius.gameserver.network.clientpackets;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.SkillData;
import org.l2jmobius.gameserver.model.actor.Playable;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.Summon;
import org.l2jmobius.gameserver.model.skill.CommonSkill;
import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.GameClient;
@ -54,18 +56,40 @@ public class RequestMagicSkillUse implements IClientIncomingPacket
Skill skill = player.getKnownSkill(_magicId);
if (skill == null)
{
if ((_magicId == CommonSkill.HAIR_ACCESSORY_SET.getId()) //
|| ((_magicId > 1565) && (_magicId < 1570))) // subClass change SkillTree
if ((_magicId == CommonSkill.HAIR_ACCESSORY_SET.getId()) || ((_magicId > 1565) && (_magicId < 1570))) // subClass change SkillTree
{
skill = SkillData.getInstance().getSkill(_magicId, 1);
}
else
else // Check for known pet skill.
{
Playable pet = null;
if (player.hasServitors())
{
for (Summon summon : player.getServitors().values())
{
skill = summon.getKnownSkill(_magicId);
if (skill != null)
{
pet = summon;
break;
}
}
}
if ((skill == null) && player.hasPet())
{
pet = player.getPet();
skill = pet.getKnownSkill(_magicId);
}
if ((skill != null) && (pet != null))
{
player.onActionRequest();
pet.useMagic(skill, null, _ctrlPressed, false);
return;
}
}
if (skill == null)
{
player.sendPacket(ActionFailed.STATIC_PACKET);
// if (_magicId > 0)
// {
// PacketLogger.warning("Skill Id " + _magicId + " not found in player: " + player);
// }
return;
}
}
@ -86,7 +110,6 @@ public class RequestMagicSkillUse implements IClientIncomingPacket
}
player.onActionRequest();
player.useMagic(skill, null, _ctrlPressed, _shiftPressed);
}
}

View File

@ -629,7 +629,7 @@ public abstract class Summon extends Playable
}
// Get the target for the skill
final WorldObject target;
WorldObject target;
if (skill.getTargetType() == TargetType.OWNER_PET)
{
target = _owner;
@ -656,8 +656,16 @@ public abstract class Summon extends Playable
// Check the validity of the target
if (target == null)
{
sendPacket(SystemMessageId.YOUR_TARGET_CANNOT_BE_FOUND);
return false;
if (!isMovementDisabled())
{
setTarget(_owner.getTarget());
target = skill.getTarget(this, forceUse, dontMove, false);
}
if (target == null)
{
sendPacket(SystemMessageId.YOUR_TARGET_CANNOT_BE_FOUND);
return false;
}
}
// Check if this skill is enabled (e.g. reuse time)

View File

@ -18,7 +18,9 @@ package org.l2jmobius.gameserver.network.clientpackets;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.SkillData;
import org.l2jmobius.gameserver.model.actor.Playable;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.Summon;
import org.l2jmobius.gameserver.model.skill.CommonSkill;
import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.GameClient;
@ -54,18 +56,40 @@ public class RequestMagicSkillUse implements IClientIncomingPacket
Skill skill = player.getKnownSkill(_magicId);
if (skill == null)
{
if ((_magicId == CommonSkill.HAIR_ACCESSORY_SET.getId()) //
|| ((_magicId > 1565) && (_magicId < 1570))) // subClass change SkillTree
if ((_magicId == CommonSkill.HAIR_ACCESSORY_SET.getId()) || ((_magicId > 1565) && (_magicId < 1570))) // subClass change SkillTree
{
skill = SkillData.getInstance().getSkill(_magicId, 1);
}
else
else // Check for known pet skill.
{
Playable pet = null;
if (player.hasServitors())
{
for (Summon summon : player.getServitors().values())
{
skill = summon.getKnownSkill(_magicId);
if (skill != null)
{
pet = summon;
break;
}
}
}
if ((skill == null) && player.hasPet())
{
pet = player.getPet();
skill = pet.getKnownSkill(_magicId);
}
if ((skill != null) && (pet != null))
{
player.onActionRequest();
pet.useMagic(skill, null, _ctrlPressed, false);
return;
}
}
if (skill == null)
{
player.sendPacket(ActionFailed.STATIC_PACKET);
// if (_magicId > 0)
// {
// PacketLogger.warning("Skill Id " + _magicId + " not found in player: " + player);
// }
return;
}
}
@ -86,7 +110,6 @@ public class RequestMagicSkillUse implements IClientIncomingPacket
}
player.onActionRequest();
player.useMagic(skill, null, _ctrlPressed, _shiftPressed);
}
}

View File

@ -629,7 +629,7 @@ public abstract class Summon extends Playable
}
// Get the target for the skill
final WorldObject target;
WorldObject target;
if (skill.getTargetType() == TargetType.OWNER_PET)
{
target = _owner;
@ -656,8 +656,16 @@ public abstract class Summon extends Playable
// Check the validity of the target
if (target == null)
{
sendPacket(SystemMessageId.YOUR_TARGET_CANNOT_BE_FOUND);
return false;
if (!isMovementDisabled())
{
setTarget(_owner.getTarget());
target = skill.getTarget(this, forceUse, dontMove, false);
}
if (target == null)
{
sendPacket(SystemMessageId.YOUR_TARGET_CANNOT_BE_FOUND);
return false;
}
}
// Check if this skill is enabled (e.g. reuse time)

View File

@ -18,7 +18,9 @@ package org.l2jmobius.gameserver.network.clientpackets;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.SkillData;
import org.l2jmobius.gameserver.model.actor.Playable;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.Summon;
import org.l2jmobius.gameserver.model.skill.CommonSkill;
import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.GameClient;
@ -54,18 +56,40 @@ public class RequestMagicSkillUse implements IClientIncomingPacket
Skill skill = player.getKnownSkill(_magicId);
if (skill == null)
{
if ((_magicId == CommonSkill.HAIR_ACCESSORY_SET.getId()) //
|| ((_magicId > 1565) && (_magicId < 1570))) // subClass change SkillTree
if ((_magicId == CommonSkill.HAIR_ACCESSORY_SET.getId()) || ((_magicId > 1565) && (_magicId < 1570))) // subClass change SkillTree
{
skill = SkillData.getInstance().getSkill(_magicId, 1);
}
else
else // Check for known pet skill.
{
Playable pet = null;
if (player.hasServitors())
{
for (Summon summon : player.getServitors().values())
{
skill = summon.getKnownSkill(_magicId);
if (skill != null)
{
pet = summon;
break;
}
}
}
if ((skill == null) && player.hasPet())
{
pet = player.getPet();
skill = pet.getKnownSkill(_magicId);
}
if ((skill != null) && (pet != null))
{
player.onActionRequest();
pet.useMagic(skill, null, _ctrlPressed, false);
return;
}
}
if (skill == null)
{
player.sendPacket(ActionFailed.STATIC_PACKET);
// if (_magicId > 0)
// {
// PacketLogger.warning("Skill Id " + _magicId + " not found in player: " + player);
// }
return;
}
}
@ -86,7 +110,6 @@ public class RequestMagicSkillUse implements IClientIncomingPacket
}
player.onActionRequest();
player.useMagic(skill, null, _ctrlPressed, _shiftPressed);
}
}

View File

@ -629,7 +629,7 @@ public abstract class Summon extends Playable
}
// Get the target for the skill
final WorldObject target;
WorldObject target;
if (skill.getTargetType() == TargetType.OWNER_PET)
{
target = _owner;
@ -656,8 +656,16 @@ public abstract class Summon extends Playable
// Check the validity of the target
if (target == null)
{
sendPacket(SystemMessageId.YOUR_TARGET_CANNOT_BE_FOUND);
return false;
if (!isMovementDisabled())
{
setTarget(_owner.getTarget());
target = skill.getTarget(this, forceUse, dontMove, false);
}
if (target == null)
{
sendPacket(SystemMessageId.YOUR_TARGET_CANNOT_BE_FOUND);
return false;
}
}
// Check if this skill is enabled (e.g. reuse time)

View File

@ -18,7 +18,9 @@ package org.l2jmobius.gameserver.network.clientpackets;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.SkillData;
import org.l2jmobius.gameserver.model.actor.Playable;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.Summon;
import org.l2jmobius.gameserver.model.skill.CommonSkill;
import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.GameClient;
@ -54,18 +56,40 @@ public class RequestMagicSkillUse implements IClientIncomingPacket
Skill skill = player.getKnownSkill(_magicId);
if (skill == null)
{
if ((_magicId == CommonSkill.HAIR_ACCESSORY_SET.getId()) //
|| ((_magicId > 1565) && (_magicId < 1570))) // subClass change SkillTree
if ((_magicId == CommonSkill.HAIR_ACCESSORY_SET.getId()) || ((_magicId > 1565) && (_magicId < 1570))) // subClass change SkillTree
{
skill = SkillData.getInstance().getSkill(_magicId, 1);
}
else
else // Check for known pet skill.
{
Playable pet = null;
if (player.hasServitors())
{
for (Summon summon : player.getServitors().values())
{
skill = summon.getKnownSkill(_magicId);
if (skill != null)
{
pet = summon;
break;
}
}
}
if ((skill == null) && player.hasPet())
{
pet = player.getPet();
skill = pet.getKnownSkill(_magicId);
}
if ((skill != null) && (pet != null))
{
player.onActionRequest();
pet.useMagic(skill, null, _ctrlPressed, false);
return;
}
}
if (skill == null)
{
player.sendPacket(ActionFailed.STATIC_PACKET);
// if (_magicId > 0)
// {
// PacketLogger.warning("Skill Id " + _magicId + " not found in player: " + player);
// }
return;
}
}
@ -86,7 +110,6 @@ public class RequestMagicSkillUse implements IClientIncomingPacket
}
player.onActionRequest();
player.useMagic(skill, null, _ctrlPressed, _shiftPressed);
}
}

View File

@ -629,7 +629,7 @@ public abstract class Summon extends Playable
}
// Get the target for the skill
final WorldObject target;
WorldObject target;
if (skill.getTargetType() == TargetType.OWNER_PET)
{
target = _owner;
@ -656,8 +656,16 @@ public abstract class Summon extends Playable
// Check the validity of the target
if (target == null)
{
sendPacket(SystemMessageId.YOUR_TARGET_CANNOT_BE_FOUND);
return false;
if (!isMovementDisabled())
{
setTarget(_owner.getTarget());
target = skill.getTarget(this, forceUse, dontMove, false);
}
if (target == null)
{
sendPacket(SystemMessageId.YOUR_TARGET_CANNOT_BE_FOUND);
return false;
}
}
// Check if this skill is enabled (e.g. reuse time)

View File

@ -18,7 +18,9 @@ package org.l2jmobius.gameserver.network.clientpackets;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.SkillData;
import org.l2jmobius.gameserver.model.actor.Playable;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.Summon;
import org.l2jmobius.gameserver.model.skill.CommonSkill;
import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.GameClient;
@ -54,18 +56,40 @@ public class RequestMagicSkillUse implements IClientIncomingPacket
Skill skill = player.getKnownSkill(_magicId);
if (skill == null)
{
if ((_magicId == CommonSkill.HAIR_ACCESSORY_SET.getId()) //
|| ((_magicId > 1565) && (_magicId < 1570))) // subClass change SkillTree
if ((_magicId == CommonSkill.HAIR_ACCESSORY_SET.getId()) || ((_magicId > 1565) && (_magicId < 1570))) // subClass change SkillTree
{
skill = SkillData.getInstance().getSkill(_magicId, 1);
}
else
else // Check for known pet skill.
{
Playable pet = null;
if (player.hasServitors())
{
for (Summon summon : player.getServitors().values())
{
skill = summon.getKnownSkill(_magicId);
if (skill != null)
{
pet = summon;
break;
}
}
}
if ((skill == null) && player.hasPet())
{
pet = player.getPet();
skill = pet.getKnownSkill(_magicId);
}
if ((skill != null) && (pet != null))
{
player.onActionRequest();
pet.useMagic(skill, null, _ctrlPressed, false);
return;
}
}
if (skill == null)
{
player.sendPacket(ActionFailed.STATIC_PACKET);
// if (_magicId > 0)
// {
// PacketLogger.warning("Skill Id " + _magicId + " not found in player: " + player);
// }
return;
}
}
@ -86,7 +110,6 @@ public class RequestMagicSkillUse implements IClientIncomingPacket
}
player.onActionRequest();
player.useMagic(skill, null, _ctrlPressed, _shiftPressed);
}
}

View File

@ -629,7 +629,7 @@ public abstract class Summon extends Playable
}
// Get the target for the skill
final WorldObject target;
WorldObject target;
if (skill.getTargetType() == TargetType.OWNER_PET)
{
target = _owner;
@ -656,8 +656,16 @@ public abstract class Summon extends Playable
// Check the validity of the target
if (target == null)
{
sendPacket(SystemMessageId.YOUR_TARGET_CANNOT_BE_FOUND);
return false;
if (!isMovementDisabled())
{
setTarget(_owner.getTarget());
target = skill.getTarget(this, forceUse, dontMove, false);
}
if (target == null)
{
sendPacket(SystemMessageId.YOUR_TARGET_CANNOT_BE_FOUND);
return false;
}
}
// Check if this skill is enabled (e.g. reuse time)

View File

@ -18,7 +18,9 @@ package org.l2jmobius.gameserver.network.clientpackets;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.SkillData;
import org.l2jmobius.gameserver.model.actor.Playable;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.Summon;
import org.l2jmobius.gameserver.model.skill.CommonSkill;
import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.GameClient;
@ -54,18 +56,40 @@ public class RequestMagicSkillUse implements IClientIncomingPacket
Skill skill = player.getKnownSkill(_magicId);
if (skill == null)
{
if ((_magicId == CommonSkill.HAIR_ACCESSORY_SET.getId()) //
|| ((_magicId > 1565) && (_magicId < 1570))) // subClass change SkillTree
if ((_magicId == CommonSkill.HAIR_ACCESSORY_SET.getId()) || ((_magicId > 1565) && (_magicId < 1570))) // subClass change SkillTree
{
skill = SkillData.getInstance().getSkill(_magicId, 1);
}
else
else // Check for known pet skill.
{
Playable pet = null;
if (player.hasServitors())
{
for (Summon summon : player.getServitors().values())
{
skill = summon.getKnownSkill(_magicId);
if (skill != null)
{
pet = summon;
break;
}
}
}
if ((skill == null) && player.hasPet())
{
pet = player.getPet();
skill = pet.getKnownSkill(_magicId);
}
if ((skill != null) && (pet != null))
{
player.onActionRequest();
pet.useMagic(skill, null, _ctrlPressed, false);
return;
}
}
if (skill == null)
{
player.sendPacket(ActionFailed.STATIC_PACKET);
// if (_magicId > 0)
// {
// PacketLogger.warning("Skill Id " + _magicId + " not found in player: " + player);
// }
return;
}
}
@ -86,7 +110,6 @@ public class RequestMagicSkillUse implements IClientIncomingPacket
}
player.onActionRequest();
player.useMagic(skill, null, _ctrlPressed, _shiftPressed);
}
}

View File

@ -646,7 +646,7 @@ public abstract class Summon extends Playable
}
// Get the target for the skill
final WorldObject target;
WorldObject target;
if (skill.getTargetType() == TargetType.OWNER_PET)
{
target = _owner;
@ -673,8 +673,16 @@ public abstract class Summon extends Playable
// Check the validity of the target
if (target == null)
{
sendPacket(SystemMessageId.YOUR_TARGET_CANNOT_BE_FOUND);
return false;
if (!isMovementDisabled())
{
setTarget(_owner.getTarget());
target = skill.getTarget(this, forceUse, dontMove, false);
}
if (target == null)
{
sendPacket(SystemMessageId.YOUR_TARGET_CANNOT_BE_FOUND);
return false;
}
}
// Check if this skill is enabled (e.g. reuse time)

View File

@ -18,7 +18,9 @@ package org.l2jmobius.gameserver.network.clientpackets;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.SkillData;
import org.l2jmobius.gameserver.model.actor.Playable;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.Summon;
import org.l2jmobius.gameserver.model.skill.CommonSkill;
import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.GameClient;
@ -54,18 +56,40 @@ public class RequestMagicSkillUse implements IClientIncomingPacket
Skill skill = player.getKnownSkill(_magicId);
if (skill == null)
{
if ((_magicId == CommonSkill.HAIR_ACCESSORY_SET.getId()) //
|| ((_magicId > 1565) && (_magicId < 1570))) // subClass change SkillTree
if ((_magicId == CommonSkill.HAIR_ACCESSORY_SET.getId()) || ((_magicId > 1565) && (_magicId < 1570))) // subClass change SkillTree
{
skill = SkillData.getInstance().getSkill(_magicId, 1);
}
else
else // Check for known pet skill.
{
Playable pet = null;
if (player.hasServitors())
{
for (Summon summon : player.getServitors().values())
{
skill = summon.getKnownSkill(_magicId);
if (skill != null)
{
pet = summon;
break;
}
}
}
if ((skill == null) && player.hasPet())
{
pet = player.getPet();
skill = pet.getKnownSkill(_magicId);
}
if ((skill != null) && (pet != null))
{
player.onActionRequest();
pet.useMagic(skill, null, _ctrlPressed, false);
return;
}
}
if (skill == null)
{
player.sendPacket(ActionFailed.STATIC_PACKET);
// if (_magicId > 0)
// {
// PacketLogger.warning("Skill Id " + _magicId + " not found in player: " + player);
// }
return;
}
}
@ -86,7 +110,6 @@ public class RequestMagicSkillUse implements IClientIncomingPacket
}
player.onActionRequest();
player.useMagic(skill, null, _ctrlPressed, _shiftPressed);
}
}

View File

@ -646,7 +646,7 @@ public abstract class Summon extends Playable
}
// Get the target for the skill
final WorldObject target;
WorldObject target;
if (skill.getTargetType() == TargetType.OWNER_PET)
{
target = _owner;
@ -673,8 +673,16 @@ public abstract class Summon extends Playable
// Check the validity of the target
if (target == null)
{
sendPacket(SystemMessageId.YOUR_TARGET_CANNOT_BE_FOUND);
return false;
if (!isMovementDisabled())
{
setTarget(_owner.getTarget());
target = skill.getTarget(this, forceUse, dontMove, false);
}
if (target == null)
{
sendPacket(SystemMessageId.YOUR_TARGET_CANNOT_BE_FOUND);
return false;
}
}
// Check if this skill is enabled (e.g. reuse time)

View File

@ -18,7 +18,9 @@ package org.l2jmobius.gameserver.network.clientpackets;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.SkillData;
import org.l2jmobius.gameserver.model.actor.Playable;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.Summon;
import org.l2jmobius.gameserver.model.skill.CommonSkill;
import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.GameClient;
@ -54,18 +56,40 @@ public class RequestMagicSkillUse implements IClientIncomingPacket
Skill skill = player.getKnownSkill(_magicId);
if (skill == null)
{
if ((_magicId == CommonSkill.HAIR_ACCESSORY_SET.getId()) //
|| ((_magicId > 1565) && (_magicId < 1570))) // subClass change SkillTree
if ((_magicId == CommonSkill.HAIR_ACCESSORY_SET.getId()) || ((_magicId > 1565) && (_magicId < 1570))) // subClass change SkillTree
{
skill = SkillData.getInstance().getSkill(_magicId, 1);
}
else
else // Check for known pet skill.
{
Playable pet = null;
if (player.hasServitors())
{
for (Summon summon : player.getServitors().values())
{
skill = summon.getKnownSkill(_magicId);
if (skill != null)
{
pet = summon;
break;
}
}
}
if ((skill == null) && player.hasPet())
{
pet = player.getPet();
skill = pet.getKnownSkill(_magicId);
}
if ((skill != null) && (pet != null))
{
player.onActionRequest();
pet.useMagic(skill, null, _ctrlPressed, false);
return;
}
}
if (skill == null)
{
player.sendPacket(ActionFailed.STATIC_PACKET);
// if (_magicId > 0)
// {
// PacketLogger.warning("Skill Id " + _magicId + " not found in player: " + player);
// }
return;
}
}
@ -86,7 +110,6 @@ public class RequestMagicSkillUse implements IClientIncomingPacket
}
player.onActionRequest();
player.useMagic(skill, null, _ctrlPressed, _shiftPressed);
}
}

View File

@ -646,7 +646,7 @@ public abstract class Summon extends Playable
}
// Get the target for the skill
final WorldObject target;
WorldObject target;
if (skill.getTargetType() == TargetType.OWNER_PET)
{
target = _owner;
@ -673,8 +673,16 @@ public abstract class Summon extends Playable
// Check the validity of the target
if (target == null)
{
sendPacket(SystemMessageId.YOUR_TARGET_CANNOT_BE_FOUND);
return false;
if (!isMovementDisabled())
{
setTarget(_owner.getTarget());
target = skill.getTarget(this, forceUse, dontMove, false);
}
if (target == null)
{
sendPacket(SystemMessageId.YOUR_TARGET_CANNOT_BE_FOUND);
return false;
}
}
// Check if this skill is enabled (e.g. reuse time)

View File

@ -18,7 +18,9 @@ package org.l2jmobius.gameserver.network.clientpackets;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.SkillData;
import org.l2jmobius.gameserver.model.actor.Playable;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.Summon;
import org.l2jmobius.gameserver.model.skill.CommonSkill;
import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.GameClient;
@ -54,18 +56,40 @@ public class RequestMagicSkillUse implements IClientIncomingPacket
Skill skill = player.getKnownSkill(_magicId);
if (skill == null)
{
if ((_magicId == CommonSkill.HAIR_ACCESSORY_SET.getId()) //
|| ((_magicId > 1565) && (_magicId < 1570))) // subClass change SkillTree
if ((_magicId == CommonSkill.HAIR_ACCESSORY_SET.getId()) || ((_magicId > 1565) && (_magicId < 1570))) // subClass change SkillTree
{
skill = SkillData.getInstance().getSkill(_magicId, 1);
}
else
else // Check for known pet skill.
{
Playable pet = null;
if (player.hasServitors())
{
for (Summon summon : player.getServitors().values())
{
skill = summon.getKnownSkill(_magicId);
if (skill != null)
{
pet = summon;
break;
}
}
}
if ((skill == null) && player.hasPet())
{
pet = player.getPet();
skill = pet.getKnownSkill(_magicId);
}
if ((skill != null) && (pet != null))
{
player.onActionRequest();
pet.useMagic(skill, null, _ctrlPressed, false);
return;
}
}
if (skill == null)
{
player.sendPacket(ActionFailed.STATIC_PACKET);
// if (_magicId > 0)
// {
// PacketLogger.warning("Skill Id " + _magicId + " not found in player: " + player);
// }
return;
}
}
@ -86,7 +110,6 @@ public class RequestMagicSkillUse implements IClientIncomingPacket
}
player.onActionRequest();
player.useMagic(skill, null, _ctrlPressed, _shiftPressed);
}
}

View File

@ -646,7 +646,7 @@ public abstract class Summon extends Playable
}
// Get the target for the skill
final WorldObject target;
WorldObject target;
if (skill.getTargetType() == TargetType.OWNER_PET)
{
target = _owner;
@ -673,8 +673,16 @@ public abstract class Summon extends Playable
// Check the validity of the target
if (target == null)
{
sendPacket(SystemMessageId.YOUR_TARGET_CANNOT_BE_FOUND);
return false;
if (!isMovementDisabled())
{
setTarget(_owner.getTarget());
target = skill.getTarget(this, forceUse, dontMove, false);
}
if (target == null)
{
sendPacket(SystemMessageId.YOUR_TARGET_CANNOT_BE_FOUND);
return false;
}
}
// Check if this skill is enabled (e.g. reuse time)

View File

@ -18,7 +18,9 @@ package org.l2jmobius.gameserver.network.clientpackets;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.SkillData;
import org.l2jmobius.gameserver.model.actor.Playable;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.Summon;
import org.l2jmobius.gameserver.model.skill.CommonSkill;
import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.GameClient;
@ -54,18 +56,40 @@ public class RequestMagicSkillUse implements IClientIncomingPacket
Skill skill = player.getKnownSkill(_magicId);
if (skill == null)
{
if ((_magicId == CommonSkill.HAIR_ACCESSORY_SET.getId()) //
|| ((_magicId > 1565) && (_magicId < 1570))) // subClass change SkillTree
if ((_magicId == CommonSkill.HAIR_ACCESSORY_SET.getId()) || ((_magicId > 1565) && (_magicId < 1570))) // subClass change SkillTree
{
skill = SkillData.getInstance().getSkill(_magicId, 1);
}
else
else // Check for known pet skill.
{
Playable pet = null;
if (player.hasServitors())
{
for (Summon summon : player.getServitors().values())
{
skill = summon.getKnownSkill(_magicId);
if (skill != null)
{
pet = summon;
break;
}
}
}
if ((skill == null) && player.hasPet())
{
pet = player.getPet();
skill = pet.getKnownSkill(_magicId);
}
if ((skill != null) && (pet != null))
{
player.onActionRequest();
pet.useMagic(skill, null, _ctrlPressed, false);
return;
}
}
if (skill == null)
{
player.sendPacket(ActionFailed.STATIC_PACKET);
// if (_magicId > 0)
// {
// PacketLogger.warning("Skill Id " + _magicId + " not found in player: " + player);
// }
return;
}
}
@ -86,7 +110,6 @@ public class RequestMagicSkillUse implements IClientIncomingPacket
}
player.onActionRequest();
player.useMagic(skill, null, _ctrlPressed, _shiftPressed);
}
}