Item use improvements.

This commit is contained in:
MobiusDev
2017-12-08 03:09:12 +00:00
parent 1c002703c7
commit dd255a3e3c
15 changed files with 75 additions and 20 deletions
@@ -79,7 +79,6 @@ public class ItemSkillsTemplate implements IItemHandler
if (itemSkill != null) if (itemSkill != null)
{ {
if (itemSkill.hasEffectType(L2EffectType.EXTRACT_ITEM) && (playable.getActingPlayer() != null) && !playable.getActingPlayer().isInventoryUnder80(false)) if (itemSkill.hasEffectType(L2EffectType.EXTRACT_ITEM) && (playable.getActingPlayer() != null) && !playable.getActingPlayer().isInventoryUnder80(false))
{ {
playable.getActingPlayer().sendPacket(SystemMessageId.YOU_VE_EXCEEDED_THE_LIMIT_AND_CANNOT_RETRIEVE_THE_ITEM_PLEASE_CHECK_YOUR_LIMIT_IN_THE_INVENTORY); playable.getActingPlayer().sendPacket(SystemMessageId.YOU_VE_EXCEEDED_THE_LIMIT_AND_CANNOT_RETRIEVE_THE_ITEM_PLEASE_CHECK_YOUR_LIMIT_IN_THE_INVENTORY);
@@ -8470,8 +8470,12 @@ public final class L2PcInstance extends L2Playable
// In case of double casting, check if both slots are occupied, then queue skill. // In case of double casting, check if both slots are occupied, then queue skill.
if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND)))
{ {
// Create a new SkillDat object and queue it in the player _queuedSkill // Do not queue skill if called by an item.
setQueuedSkill(skill, item, forceUse, dontMove); if (item == null)
{
// Create a new SkillDat object and queue it in the player _queuedSkill
setQueuedSkill(skill, item, forceUse, dontMove);
}
sendPacket(ActionFailed.STATIC_PACKET); sendPacket(ActionFailed.STATIC_PACKET);
return false; return false;
} }
@@ -38,6 +38,7 @@ import com.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import com.l2jmobius.gameserver.model.items.L2EtcItem; import com.l2jmobius.gameserver.model.items.L2EtcItem;
import com.l2jmobius.gameserver.model.items.L2Item; import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.items.type.ActionType;
import com.l2jmobius.gameserver.network.L2GameClient; import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed; import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
@@ -100,7 +101,7 @@ public final class UseItem implements IClientIncomingPacket
return; return;
} }
if (item.getItem().getType2() == L2Item.TYPE2_QUEST) if (item.isQuestItem() && (item.getItem().getDefaultAction() != ActionType.NONE))
{ {
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_QUEST_ITEMS); activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_QUEST_ITEMS);
return; return;
@@ -166,6 +167,13 @@ public final class UseItem implements IClientIncomingPacket
} }
} }
// If item's default action is to show html, show item's main html.
if (item.getItem().getDefaultAction() == ActionType.SHOW_HTML)
{
item.onBypassFeedback(activeChar, null);
return;
}
if (item.isEquipable()) if (item.isEquipable())
{ {
// Don't allow to put formal wear while a cursed weapon is equipped. // Don't allow to put formal wear while a cursed weapon is equipped.
@@ -79,7 +79,6 @@ public class ItemSkillsTemplate implements IItemHandler
if (itemSkill != null) if (itemSkill != null)
{ {
if (itemSkill.hasEffectType(L2EffectType.EXTRACT_ITEM) && (playable.getActingPlayer() != null) && !playable.getActingPlayer().isInventoryUnder80(false)) if (itemSkill.hasEffectType(L2EffectType.EXTRACT_ITEM) && (playable.getActingPlayer() != null) && !playable.getActingPlayer().isInventoryUnder80(false))
{ {
playable.getActingPlayer().sendPacket(SystemMessageId.YOU_VE_EXCEEDED_THE_LIMIT_AND_CANNOT_RETRIEVE_THE_ITEM_PLEASE_CHECK_YOUR_LIMIT_IN_THE_INVENTORY); playable.getActingPlayer().sendPacket(SystemMessageId.YOU_VE_EXCEEDED_THE_LIMIT_AND_CANNOT_RETRIEVE_THE_ITEM_PLEASE_CHECK_YOUR_LIMIT_IN_THE_INVENTORY);
@@ -8471,8 +8471,12 @@ public final class L2PcInstance extends L2Playable
// In case of double casting, check if both slots are occupied, then queue skill. // In case of double casting, check if both slots are occupied, then queue skill.
if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND)))
{ {
// Create a new SkillDat object and queue it in the player _queuedSkill // Do not queue skill if called by an item.
setQueuedSkill(skill, item, forceUse, dontMove); if (item == null)
{
// Create a new SkillDat object and queue it in the player _queuedSkill
setQueuedSkill(skill, item, forceUse, dontMove);
}
sendPacket(ActionFailed.STATIC_PACKET); sendPacket(ActionFailed.STATIC_PACKET);
return false; return false;
} }
@@ -38,6 +38,7 @@ import com.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import com.l2jmobius.gameserver.model.items.L2EtcItem; import com.l2jmobius.gameserver.model.items.L2EtcItem;
import com.l2jmobius.gameserver.model.items.L2Item; import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.items.type.ActionType;
import com.l2jmobius.gameserver.network.L2GameClient; import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed; import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
@@ -100,7 +101,7 @@ public final class UseItem implements IClientIncomingPacket
return; return;
} }
if (item.getItem().getType2() == L2Item.TYPE2_QUEST) if (item.isQuestItem() && (item.getItem().getDefaultAction() != ActionType.NONE))
{ {
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_QUEST_ITEMS); activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_QUEST_ITEMS);
return; return;
@@ -166,6 +167,13 @@ public final class UseItem implements IClientIncomingPacket
} }
} }
// If item's default action is to show html, show item's main html.
if (item.getItem().getDefaultAction() == ActionType.SHOW_HTML)
{
item.onBypassFeedback(activeChar, null);
return;
}
if (item.isEquipable()) if (item.isEquipable())
{ {
// Don't allow to put formal wear while a cursed weapon is equipped. // Don't allow to put formal wear while a cursed weapon is equipped.
@@ -79,7 +79,6 @@ public class ItemSkillsTemplate implements IItemHandler
if (itemSkill != null) if (itemSkill != null)
{ {
if (itemSkill.hasEffectType(L2EffectType.EXTRACT_ITEM) && (playable.getActingPlayer() != null) && !playable.getActingPlayer().isInventoryUnder80(false)) if (itemSkill.hasEffectType(L2EffectType.EXTRACT_ITEM) && (playable.getActingPlayer() != null) && !playable.getActingPlayer().isInventoryUnder80(false))
{ {
playable.getActingPlayer().sendPacket(SystemMessageId.YOU_VE_EXCEEDED_THE_LIMIT_AND_CANNOT_RETRIEVE_THE_ITEM_PLEASE_CHECK_YOUR_LIMIT_IN_THE_INVENTORY); playable.getActingPlayer().sendPacket(SystemMessageId.YOU_VE_EXCEEDED_THE_LIMIT_AND_CANNOT_RETRIEVE_THE_ITEM_PLEASE_CHECK_YOUR_LIMIT_IN_THE_INVENTORY);
@@ -8473,8 +8473,12 @@ public final class L2PcInstance extends L2Playable
// In case of double casting, check if both slots are occupied, then queue skill. // In case of double casting, check if both slots are occupied, then queue skill.
if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND)))
{ {
// Create a new SkillDat object and queue it in the player _queuedSkill // Do not queue skill if called by an item.
setQueuedSkill(skill, item, forceUse, dontMove); if (item == null)
{
// Create a new SkillDat object and queue it in the player _queuedSkill
setQueuedSkill(skill, item, forceUse, dontMove);
}
sendPacket(ActionFailed.STATIC_PACKET); sendPacket(ActionFailed.STATIC_PACKET);
return false; return false;
} }
@@ -38,6 +38,7 @@ import com.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import com.l2jmobius.gameserver.model.items.L2EtcItem; import com.l2jmobius.gameserver.model.items.L2EtcItem;
import com.l2jmobius.gameserver.model.items.L2Item; import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.items.type.ActionType;
import com.l2jmobius.gameserver.network.L2GameClient; import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed; import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
@@ -100,7 +101,7 @@ public final class UseItem implements IClientIncomingPacket
return; return;
} }
if (item.getItem().getType2() == L2Item.TYPE2_QUEST) if (item.isQuestItem() && (item.getItem().getDefaultAction() != ActionType.NONE))
{ {
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_QUEST_ITEMS); activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_QUEST_ITEMS);
return; return;
@@ -166,6 +167,13 @@ public final class UseItem implements IClientIncomingPacket
} }
} }
// If item's default action is to show html, show item's main html.
if (item.getItem().getDefaultAction() == ActionType.SHOW_HTML)
{
item.onBypassFeedback(activeChar, null);
return;
}
if (item.isEquipable()) if (item.isEquipable())
{ {
// Don't allow to put formal wear while a cursed weapon is equipped. // Don't allow to put formal wear while a cursed weapon is equipped.
@@ -79,7 +79,6 @@ public class ItemSkillsTemplate implements IItemHandler
if (itemSkill != null) if (itemSkill != null)
{ {
if (itemSkill.hasEffectType(L2EffectType.EXTRACT_ITEM) && (playable.getActingPlayer() != null) && !playable.getActingPlayer().isInventoryUnder80(false)) if (itemSkill.hasEffectType(L2EffectType.EXTRACT_ITEM) && (playable.getActingPlayer() != null) && !playable.getActingPlayer().isInventoryUnder80(false))
{ {
playable.getActingPlayer().sendPacket(SystemMessageId.YOU_VE_EXCEEDED_THE_LIMIT_AND_CANNOT_RETRIEVE_THE_ITEM_PLEASE_CHECK_YOUR_LIMIT_IN_THE_INVENTORY); playable.getActingPlayer().sendPacket(SystemMessageId.YOU_VE_EXCEEDED_THE_LIMIT_AND_CANNOT_RETRIEVE_THE_ITEM_PLEASE_CHECK_YOUR_LIMIT_IN_THE_INVENTORY);
@@ -8470,8 +8470,12 @@ public final class L2PcInstance extends L2Playable
// In case of double casting, check if both slots are occupied, then queue skill. // In case of double casting, check if both slots are occupied, then queue skill.
if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND)))
{ {
// Create a new SkillDat object and queue it in the player _queuedSkill // Do not queue skill if called by an item.
setQueuedSkill(skill, item, forceUse, dontMove); if (item == null)
{
// Create a new SkillDat object and queue it in the player _queuedSkill
setQueuedSkill(skill, item, forceUse, dontMove);
}
sendPacket(ActionFailed.STATIC_PACKET); sendPacket(ActionFailed.STATIC_PACKET);
return false; return false;
} }
@@ -38,6 +38,7 @@ import com.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import com.l2jmobius.gameserver.model.items.L2EtcItem; import com.l2jmobius.gameserver.model.items.L2EtcItem;
import com.l2jmobius.gameserver.model.items.L2Item; import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.items.type.ActionType;
import com.l2jmobius.gameserver.network.L2GameClient; import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed; import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
@@ -100,7 +101,7 @@ public final class UseItem implements IClientIncomingPacket
return; return;
} }
if (item.getItem().getType2() == L2Item.TYPE2_QUEST) if (item.isQuestItem() && (item.getItem().getDefaultAction() != ActionType.NONE))
{ {
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_QUEST_ITEMS); activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_QUEST_ITEMS);
return; return;
@@ -166,6 +167,13 @@ public final class UseItem implements IClientIncomingPacket
} }
} }
// If item's default action is to show html, show item's main html.
if (item.getItem().getDefaultAction() == ActionType.SHOW_HTML)
{
item.onBypassFeedback(activeChar, null);
return;
}
if (item.isEquipable()) if (item.isEquipable())
{ {
// Don't allow to put formal wear while a cursed weapon is equipped. // Don't allow to put formal wear while a cursed weapon is equipped.
@@ -79,7 +79,6 @@ public class ItemSkillsTemplate implements IItemHandler
if (itemSkill != null) if (itemSkill != null)
{ {
if (itemSkill.hasEffectType(L2EffectType.EXTRACT_ITEM) && (playable.getActingPlayer() != null) && !playable.getActingPlayer().isInventoryUnder80(false)) if (itemSkill.hasEffectType(L2EffectType.EXTRACT_ITEM) && (playable.getActingPlayer() != null) && !playable.getActingPlayer().isInventoryUnder80(false))
{ {
playable.getActingPlayer().sendPacket(SystemMessageId.YOU_VE_EXCEEDED_THE_LIMIT_AND_CANNOT_RETRIEVE_THE_ITEM_PLEASE_CHECK_YOUR_LIMIT_IN_THE_INVENTORY); playable.getActingPlayer().sendPacket(SystemMessageId.YOU_VE_EXCEEDED_THE_LIMIT_AND_CANNOT_RETRIEVE_THE_ITEM_PLEASE_CHECK_YOUR_LIMIT_IN_THE_INVENTORY);
@@ -8414,8 +8414,12 @@ public final class L2PcInstance extends L2Playable
// In case of double casting, check if both slots are occupied, then queue skill. // In case of double casting, check if both slots are occupied, then queue skill.
if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND)))
{ {
// Create a new SkillDat object and queue it in the player _queuedSkill // Do not queue skill if called by an item.
setQueuedSkill(skill, item, forceUse, dontMove); if (item == null)
{
// Create a new SkillDat object and queue it in the player _queuedSkill
setQueuedSkill(skill, item, forceUse, dontMove);
}
sendPacket(ActionFailed.STATIC_PACKET); sendPacket(ActionFailed.STATIC_PACKET);
return false; return false;
} }
@@ -38,6 +38,7 @@ import com.l2jmobius.gameserver.model.holders.ItemSkillHolder;
import com.l2jmobius.gameserver.model.items.L2EtcItem; import com.l2jmobius.gameserver.model.items.L2EtcItem;
import com.l2jmobius.gameserver.model.items.L2Item; import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.items.type.ActionType;
import com.l2jmobius.gameserver.network.L2GameClient; import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed; import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
@@ -100,7 +101,7 @@ public final class UseItem implements IClientIncomingPacket
return; return;
} }
if (item.getItem().getType2() == L2Item.TYPE2_QUEST) if (item.isQuestItem() && (item.getItem().getDefaultAction() != ActionType.NONE))
{ {
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_QUEST_ITEMS); activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_QUEST_ITEMS);
return; return;
@@ -166,6 +167,13 @@ public final class UseItem implements IClientIncomingPacket
} }
} }
// If item's default action is to show html, show item's main html.
if (item.getItem().getDefaultAction() == ActionType.SHOW_HTML)
{
item.onBypassFeedback(activeChar, null);
return;
}
if (item.isEquipable()) if (item.isEquipable())
{ {
// Don't allow to put formal wear while a cursed weapon is equipped. // Don't allow to put formal wear while a cursed weapon is equipped.