Enable drop items while casting.

This commit is contained in:
MobiusDev 2018-09-11 02:24:00 +00:00
parent 727c95a665
commit 7abf95378f
9 changed files with 36 additions and 20 deletions

View File

@ -25,6 +25,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.items.type.ActionType;
import com.l2jmobius.gameserver.model.items.type.EtcItemType;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.network.L2GameClient;
@ -140,8 +141,8 @@ public final class RequestDropItem implements IClientIncomingPacket
return;
}
// Cannot discard item that the skill is consuming
if (activeChar.isCastingNow(s -> s.getSkill().getItemConsumeId() == item.getId()))
// Cannot discard item that the skill is consuming.
if (activeChar.isCastingNow(s -> (s.getSkill().getItemConsumeId() == item.getId()) && (item.getItem().getDefaultAction() == ActionType.SKILL_REDUCE_ON_SKILL_SUCCESS)))
{
activeChar.sendPacket(SystemMessageId.THIS_ITEM_CANNOT_BE_DESTROYED);
return;

View File

@ -25,6 +25,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.items.type.ActionType;
import com.l2jmobius.gameserver.model.items.type.EtcItemType;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.network.L2GameClient;
@ -140,8 +141,8 @@ public final class RequestDropItem implements IClientIncomingPacket
return;
}
// Cannot discard item that the skill is consuming
if (activeChar.isCastingNow(s -> s.getSkill().getItemConsumeId() == item.getId()))
// Cannot discard item that the skill is consuming.
if (activeChar.isCastingNow(s -> (s.getSkill().getItemConsumeId() == item.getId()) && (item.getItem().getDefaultAction() == ActionType.SKILL_REDUCE_ON_SKILL_SUCCESS)))
{
activeChar.sendPacket(SystemMessageId.THIS_ITEM_CANNOT_BE_DESTROYED);
return;

View File

@ -25,6 +25,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.items.type.ActionType;
import com.l2jmobius.gameserver.model.items.type.EtcItemType;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.network.L2GameClient;
@ -140,8 +141,8 @@ public final class RequestDropItem implements IClientIncomingPacket
return;
}
// Cannot discard item that the skill is consuming
if (activeChar.isCastingNow(s -> s.getSkill().getItemConsumeId() == item.getId()))
// Cannot discard item that the skill is consuming.
if (activeChar.isCastingNow(s -> (s.getSkill().getItemConsumeId() == item.getId()) && (item.getItem().getDefaultAction() == ActionType.SKILL_REDUCE_ON_SKILL_SUCCESS)))
{
activeChar.sendPacket(SystemMessageId.THIS_ITEM_CANNOT_BE_DESTROYED);
return;

View File

@ -25,6 +25,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.items.type.ActionType;
import com.l2jmobius.gameserver.model.items.type.EtcItemType;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.network.L2GameClient;
@ -140,8 +141,8 @@ public final class RequestDropItem implements IClientIncomingPacket
return;
}
// Cannot discard item that the skill is consuming
if (activeChar.isCastingNow(s -> s.getSkill().getItemConsumeId() == item.getId()))
// Cannot discard item that the skill is consuming.
if (activeChar.isCastingNow(s -> (s.getSkill().getItemConsumeId() == item.getId()) && (item.getItem().getDefaultAction() == ActionType.SKILL_REDUCE_ON_SKILL_SUCCESS)))
{
activeChar.sendPacket(SystemMessageId.THIS_ITEM_CANNOT_BE_DESTROYED);
return;

View File

@ -23,6 +23,7 @@ import com.l2jmobius.gameserver.datatables.GmListTable;
import com.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
import com.l2jmobius.gameserver.model.actor.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance.SkillDat;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
import com.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
@ -167,10 +168,12 @@ public final class RequestDropItem extends L2GameClientPacket
return;
}
// Cannot discard item that the skill is consumming
// Cannot discard item that the skill is consuming.
if (activeChar.isCastingNow())
{
if ((activeChar.getCurrentSkill() != null) && (activeChar.getCurrentSkill().getSkill().getItemConsumeId() == item.getItemId()))
final SkillDat skillDat = activeChar.getCurrentSkill();
if ((skillDat != null) && (skillDat.getSkill().getItemConsumeId() == item.getItemId()) //
&& ((activeChar.getInventory().getInventoryItemCount(item.getItemId(), -1) - skillDat.getSkill().getItemConsume()) < _count))
{
activeChar.sendPacket(SystemMessageId.CANNOT_DISCARD_THIS_ITEM);
return;

View File

@ -22,10 +22,12 @@ import com.l2jmobius.gameserver.data.xml.impl.AdminData;
import com.l2jmobius.gameserver.enums.PrivateStoreType;
import com.l2jmobius.gameserver.model.PcCondOverride;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.holders.SkillUseHolder;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.items.type.EtcItemType;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.SystemMessageId;
@ -136,20 +138,24 @@ public final class RequestDropItem implements IClientIncomingPacket
return;
}
// Cannot discard item that the skill is consuming
// Cannot discard item that the skill is consuming.
if (activeChar.isCastingNow())
{
if ((activeChar.getCurrentSkill() != null) && (activeChar.getCurrentSkill().getSkill().getItemConsumeId() == item.getId()))
final SkillUseHolder skill = activeChar.getCurrentSkill();
if ((skill != null) && (skill.getSkill().getItemConsumeId() == item.getId()) //
&& ((activeChar.getInventory().getInventoryItemCount(item.getId(), -1) - skill.getSkill().getItemConsumeCount()) < _count))
{
activeChar.sendPacket(SystemMessageId.THIS_ITEM_CANNOT_BE_DISCARDED);
return;
}
}
// Cannot discard item that the skill is consuming
// Cannot discard item that the skill is consuming.
if (activeChar.isCastingSimultaneouslyNow())
{
if ((activeChar.getLastSimultaneousSkillCast() != null) && (activeChar.getLastSimultaneousSkillCast().getItemConsumeId() == item.getId()))
final Skill skill = activeChar.getLastSimultaneousSkillCast();
if ((skill != null) && (skill.getItemConsumeId() == item.getId()) //
&& ((activeChar.getInventory().getInventoryItemCount(item.getId(), -1) - skill.getItemConsumeCount()) < _count))
{
activeChar.sendPacket(SystemMessageId.THIS_ITEM_CANNOT_BE_DISCARDED);
return;

View File

@ -25,6 +25,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.items.type.ActionType;
import com.l2jmobius.gameserver.model.items.type.EtcItemType;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.network.L2GameClient;
@ -140,8 +141,8 @@ public final class RequestDropItem implements IClientIncomingPacket
return;
}
// Cannot discard item that the skill is consuming
if (activeChar.isCastingNow(s -> s.getSkill().getItemConsumeId() == item.getId()))
// Cannot discard item that the skill is consuming.
if (activeChar.isCastingNow(s -> (s.getSkill().getItemConsumeId() == item.getId()) && (item.getItem().getDefaultAction() == ActionType.SKILL_REDUCE_ON_SKILL_SUCCESS)))
{
activeChar.sendPacket(SystemMessageId.THIS_ITEM_CANNOT_BE_DESTROYED);
return;

View File

@ -25,6 +25,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.items.type.ActionType;
import com.l2jmobius.gameserver.model.items.type.EtcItemType;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.network.L2GameClient;
@ -140,8 +141,8 @@ public final class RequestDropItem implements IClientIncomingPacket
return;
}
// Cannot discard item that the skill is consuming
if (activeChar.isCastingNow(s -> s.getSkill().getItemConsumeId() == item.getId()))
// Cannot discard item that the skill is consuming.
if (activeChar.isCastingNow(s -> (s.getSkill().getItemConsumeId() == item.getId()) && (item.getItem().getDefaultAction() == ActionType.SKILL_REDUCE_ON_SKILL_SUCCESS)))
{
activeChar.sendPacket(SystemMessageId.THIS_ITEM_CANNOT_BE_DESTROYED);
return;

View File

@ -25,6 +25,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.items.type.ActionType;
import com.l2jmobius.gameserver.model.items.type.EtcItemType;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.network.L2GameClient;
@ -140,8 +141,8 @@ public final class RequestDropItem implements IClientIncomingPacket
return;
}
// Cannot discard item that the skill is consuming
if (activeChar.isCastingNow(s -> s.getSkill().getItemConsumeId() == item.getId()))
// Cannot discard item that the skill is consuming.
if (activeChar.isCastingNow(s -> (s.getSkill().getItemConsumeId() == item.getId()) && (item.getItem().getDefaultAction() == ActionType.SKILL_REDUCE_ON_SKILL_SUCCESS)))
{
activeChar.sendPacket(SystemMessageId.THIS_ITEM_CANNOT_BE_DESTROYED);
return;