From c06cccd4ee7f1f18b0c477c183c79099d83757dc Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Mon, 23 Jul 2018 16:07:15 +0000 Subject: [PATCH] Red icons for unavailable inventory items. --- .../l2jmobius/gameserver/model/ItemInfo.java | 8 ++++++ .../gameserver/model/items/L2Item.java | 5 ++++ .../model/items/instance/L2ItemInstance.java | 28 +++++++++++++++++++ .../serverpackets/AbstractItemPacket.java | 2 +- .../l2jmobius/gameserver/model/ItemInfo.java | 8 ++++++ .../gameserver/model/items/L2Item.java | 5 ++++ .../model/items/instance/L2ItemInstance.java | 28 +++++++++++++++++++ .../serverpackets/AbstractItemPacket.java | 2 +- .../l2jmobius/gameserver/model/ItemInfo.java | 8 ++++++ .../gameserver/model/items/L2Item.java | 5 ++++ .../model/items/instance/L2ItemInstance.java | 28 +++++++++++++++++++ .../serverpackets/AbstractItemPacket.java | 2 +- .../l2jmobius/gameserver/model/ItemInfo.java | 8 ++++++ .../gameserver/model/items/L2Item.java | 5 ++++ .../model/items/instance/L2ItemInstance.java | 28 +++++++++++++++++++ .../serverpackets/AbstractItemPacket.java | 2 +- .../l2jmobius/gameserver/model/ItemInfo.java | 8 ++++++ .../gameserver/model/items/L2Item.java | 5 ++++ .../model/items/instance/L2ItemInstance.java | 28 +++++++++++++++++++ .../serverpackets/AbstractItemPacket.java | 2 +- .../l2jmobius/gameserver/model/ItemInfo.java | 8 ++++++ .../gameserver/model/items/L2Item.java | 5 ++++ .../model/items/instance/L2ItemInstance.java | 28 +++++++++++++++++++ .../serverpackets/AbstractItemPacket.java | 2 +- .../l2jmobius/gameserver/model/ItemInfo.java | 8 ++++++ .../gameserver/model/items/L2Item.java | 5 ++++ .../model/items/instance/L2ItemInstance.java | 28 +++++++++++++++++++ .../serverpackets/AbstractItemPacket.java | 2 +- 28 files changed, 294 insertions(+), 7 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/ItemInfo.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/ItemInfo.java index 5269808a46..0f4fd395d1 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/ItemInfo.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/ItemInfo.java @@ -61,6 +61,8 @@ public class ItemInfo private int _mana; private int _time; + private boolean _available = true; + private int _location; private byte _elemAtkType = -2; @@ -132,6 +134,7 @@ public class ItemInfo // Get shadow item mana _mana = item.getMana(); _time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -9999; + _available = item.isAvailable(); _location = item.getLocationSlot(); _elemAtkType = item.getAttackAttributeType().getClientId(); @@ -345,6 +348,11 @@ public class ItemInfo return _time > 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999; } + public boolean isAvailable() + { + return _available; + } + public int getLocation() { return _location; diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/L2Item.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/L2Item.java index 81e04748a4..22cef901f9 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/L2Item.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/L2Item.java @@ -705,6 +705,11 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable _preConditions.add(c); } + public List getConditions() + { + return _preConditions; + } + /** * Method to retrieve skills linked to this item armor and weapon: passive skills etcitem: skills used on item use <-- ??? * @return Skills linked to this item as SkillHolder[] diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index b7ce8f840f..fc871fca27 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -59,6 +59,7 @@ import com.l2jmobius.gameserver.model.VariationInstance; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.conditions.Condition; import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.events.EventDispatcher; import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerAugment; @@ -1764,6 +1765,33 @@ public final class L2ItemInstance extends L2Object return _protected; } + public boolean isAvailable() + { + if (!_item.isConditionAttached()) + { + return true; + } + final L2PcInstance owner = getActingPlayer(); + for (Condition condition : _item.getConditions()) + { + if (condition == null) + { + continue; + } + try + { + if (!condition.test(owner, owner, null, null)) + { + return false; + } + } + catch (Exception e) + { + } + } + return true; + } + public void setCountDecrease(boolean decrease) { _decrease = decrease; diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java index f9dee40d90..a144d008ef 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java @@ -78,7 +78,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999; } + public boolean isAvailable() + { + return _available; + } + public int getLocation() { return _location; diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/L2Item.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/L2Item.java index 81e04748a4..22cef901f9 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/L2Item.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/L2Item.java @@ -705,6 +705,11 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable _preConditions.add(c); } + public List getConditions() + { + return _preConditions; + } + /** * Method to retrieve skills linked to this item armor and weapon: passive skills etcitem: skills used on item use <-- ??? * @return Skills linked to this item as SkillHolder[] diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index 2052a72ab1..4e4aa1b790 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -62,6 +62,7 @@ import com.l2jmobius.gameserver.model.VariationInstance; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.conditions.Condition; import com.l2jmobius.gameserver.model.ensoul.EnsoulOption; import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.events.EventDispatcher; @@ -1775,6 +1776,33 @@ public final class L2ItemInstance extends L2Object return _protected; } + public boolean isAvailable() + { + if (!_item.isConditionAttached()) + { + return true; + } + final L2PcInstance owner = getActingPlayer(); + for (Condition condition : _item.getConditions()) + { + if (condition == null) + { + continue; + } + try + { + if (!condition.test(owner, owner, null, null)) + { + return false; + } + } + catch (Exception e) + { + } + } + return true; + } + public void setCountDecrease(boolean decrease) { _decrease = decrease; diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java index 19a51d6989..de9937b763 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java @@ -80,7 +80,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999; } + public boolean isAvailable() + { + return _available; + } + public int getLocation() { return _location; diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/L2Item.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/L2Item.java index 81e04748a4..22cef901f9 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/L2Item.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/L2Item.java @@ -705,6 +705,11 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable _preConditions.add(c); } + public List getConditions() + { + return _preConditions; + } + /** * Method to retrieve skills linked to this item armor and weapon: passive skills etcitem: skills used on item use <-- ??? * @return Skills linked to this item as SkillHolder[] diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index 2052a72ab1..4e4aa1b790 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -62,6 +62,7 @@ import com.l2jmobius.gameserver.model.VariationInstance; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.conditions.Condition; import com.l2jmobius.gameserver.model.ensoul.EnsoulOption; import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.events.EventDispatcher; @@ -1775,6 +1776,33 @@ public final class L2ItemInstance extends L2Object return _protected; } + public boolean isAvailable() + { + if (!_item.isConditionAttached()) + { + return true; + } + final L2PcInstance owner = getActingPlayer(); + for (Condition condition : _item.getConditions()) + { + if (condition == null) + { + continue; + } + try + { + if (!condition.test(owner, owner, null, null)) + { + return false; + } + } + catch (Exception e) + { + } + } + return true; + } + public void setCountDecrease(boolean decrease) { _decrease = decrease; diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java index 19a51d6989..de9937b763 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java @@ -80,7 +80,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999; } + public boolean isAvailable() + { + return _available; + } + public int getLocation() { return _location; diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/L2Item.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/L2Item.java index 914b15c55c..3c5379c669 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/L2Item.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/L2Item.java @@ -705,6 +705,11 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable _preConditions.add(c); } + public List getConditions() + { + return _preConditions; + } + /** * Method to retrieve skills linked to this item armor and weapon: passive skills etcitem: skills used on item use <-- ??? * @return Skills linked to this item as SkillHolder[] diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index 2052a72ab1..4e4aa1b790 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -62,6 +62,7 @@ import com.l2jmobius.gameserver.model.VariationInstance; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.conditions.Condition; import com.l2jmobius.gameserver.model.ensoul.EnsoulOption; import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.events.EventDispatcher; @@ -1775,6 +1776,33 @@ public final class L2ItemInstance extends L2Object return _protected; } + public boolean isAvailable() + { + if (!_item.isConditionAttached()) + { + return true; + } + final L2PcInstance owner = getActingPlayer(); + for (Condition condition : _item.getConditions()) + { + if (condition == null) + { + continue; + } + try + { + if (!condition.test(owner, owner, null, null)) + { + return false; + } + } + catch (Exception e) + { + } + } + return true; + } + public void setCountDecrease(boolean decrease) { _decrease = decrease; diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java index 19a51d6989..de9937b763 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java @@ -80,7 +80,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999; } + public boolean isAvailable() + { + return _available; + } + public int getLocation() { return _location; diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/L2Item.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/L2Item.java index 02fb35cdc6..2229a95622 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/L2Item.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/L2Item.java @@ -709,6 +709,11 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable _preConditions.add(c); } + public List getConditions() + { + return _preConditions; + } + /** * Method to retrieve skills linked to this item armor and weapon: passive skills etcitem: skills used on item use <-- ??? * @return Skills linked to this item as SkillHolder[] diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index 284b377d8d..47f3378ab9 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -62,6 +62,7 @@ import com.l2jmobius.gameserver.model.VariationInstance; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.conditions.Condition; import com.l2jmobius.gameserver.model.ensoul.EnsoulOption; import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.events.EventDispatcher; @@ -1775,6 +1776,33 @@ public final class L2ItemInstance extends L2Object return _protected; } + public boolean isAvailable() + { + if (!_item.isConditionAttached()) + { + return true; + } + final L2PcInstance owner = getActingPlayer(); + for (Condition condition : _item.getConditions()) + { + if (condition == null) + { + continue; + } + try + { + if (!condition.test(owner, owner, null, null)) + { + return false; + } + } + catch (Exception e) + { + } + } + return true; + } + public void setCountDecrease(boolean decrease) { _decrease = decrease; diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java index 19a51d6989..de9937b763 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java @@ -80,7 +80,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999; } + public boolean isAvailable() + { + return _available; + } + public int getLocation() { return _location; diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/items/L2Item.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/items/L2Item.java index 02fb35cdc6..2229a95622 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/items/L2Item.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/items/L2Item.java @@ -709,6 +709,11 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable _preConditions.add(c); } + public List getConditions() + { + return _preConditions; + } + /** * Method to retrieve skills linked to this item armor and weapon: passive skills etcitem: skills used on item use <-- ??? * @return Skills linked to this item as SkillHolder[] diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index 284b377d8d..47f3378ab9 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -62,6 +62,7 @@ import com.l2jmobius.gameserver.model.VariationInstance; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.conditions.Condition; import com.l2jmobius.gameserver.model.ensoul.EnsoulOption; import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.events.EventDispatcher; @@ -1775,6 +1776,33 @@ public final class L2ItemInstance extends L2Object return _protected; } + public boolean isAvailable() + { + if (!_item.isConditionAttached()) + { + return true; + } + final L2PcInstance owner = getActingPlayer(); + for (Condition condition : _item.getConditions()) + { + if (condition == null) + { + continue; + } + try + { + if (!condition.test(owner, owner, null, null)) + { + return false; + } + } + catch (Exception e) + { + } + } + return true; + } + public void setCountDecrease(boolean decrease) { _decrease = decrease; diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java index 19a51d6989..de9937b763 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java @@ -80,7 +80,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999; } + public boolean isAvailable() + { + return _available; + } + public int getLocation() { return _location; diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/L2Item.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/L2Item.java index 02fb35cdc6..2229a95622 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/L2Item.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/L2Item.java @@ -709,6 +709,11 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable _preConditions.add(c); } + public List getConditions() + { + return _preConditions; + } + /** * Method to retrieve skills linked to this item armor and weapon: passive skills etcitem: skills used on item use <-- ??? * @return Skills linked to this item as SkillHolder[] diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index 284b377d8d..47f3378ab9 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -62,6 +62,7 @@ import com.l2jmobius.gameserver.model.VariationInstance; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.conditions.Condition; import com.l2jmobius.gameserver.model.ensoul.EnsoulOption; import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.events.EventDispatcher; @@ -1775,6 +1776,33 @@ public final class L2ItemInstance extends L2Object return _protected; } + public boolean isAvailable() + { + if (!_item.isConditionAttached()) + { + return true; + } + final L2PcInstance owner = getActingPlayer(); + for (Condition condition : _item.getConditions()) + { + if (condition == null) + { + continue; + } + try + { + if (!condition.test(owner, owner, null, null)) + { + return false; + } + } + catch (Exception e) + { + } + } + return true; + } + public void setCountDecrease(boolean decrease) { _decrease = decrease; diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java index dabe6a62bc..e2e4db4e43 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java @@ -85,7 +85,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket