Red icons for unavailable inventory items.

This commit is contained in:
MobiusDev 2018-07-23 16:07:15 +00:00
parent 3c67b04817
commit c06cccd4ee
28 changed files with 294 additions and 7 deletions

View File

@ -61,6 +61,8 @@ public class ItemInfo
private int _mana; private int _mana;
private int _time; private int _time;
private boolean _available = true;
private int _location; private int _location;
private byte _elemAtkType = -2; private byte _elemAtkType = -2;
@ -132,6 +134,7 @@ public class ItemInfo
// Get shadow item mana // Get shadow item mana
_mana = item.getMana(); _mana = item.getMana();
_time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -9999; _time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -9999;
_available = item.isAvailable();
_location = item.getLocationSlot(); _location = item.getLocationSlot();
_elemAtkType = item.getAttackAttributeType().getClientId(); _elemAtkType = item.getAttackAttributeType().getClientId();
@ -345,6 +348,11 @@ public class ItemInfo
return _time > 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999; return _time > 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999;
} }
public boolean isAvailable()
{
return _available;
}
public int getLocation() public int getLocation()
{ {
return _location; return _location;

View File

@ -705,6 +705,11 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
_preConditions.add(c); _preConditions.add(c);
} }
public List<Condition> getConditions()
{
return _preConditions;
}
/** /**
* Method to retrieve skills linked to this item armor and weapon: passive skills etcitem: skills used on item use <-- ??? * 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[] * @return Skills linked to this item as SkillHolder[]

View File

@ -59,6 +59,7 @@ import com.l2jmobius.gameserver.model.VariationInstance;
import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; 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.entity.Castle;
import com.l2jmobius.gameserver.model.events.EventDispatcher; import com.l2jmobius.gameserver.model.events.EventDispatcher;
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerAugment; import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerAugment;
@ -1764,6 +1765,33 @@ public final class L2ItemInstance extends L2Object
return _protected; 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) public void setCountDecrease(boolean decrease)
{ {
_decrease = decrease; _decrease = decrease;

View File

@ -78,7 +78,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
packet.writeH(item.getEnchantLevel()); // Enchant level (pet level shown in control item) packet.writeH(item.getEnchantLevel()); // Enchant level (pet level shown in control item)
packet.writeD(item.getMana()); packet.writeD(item.getMana());
packet.writeD(item.getTime()); packet.writeD(item.getTime());
packet.writeC(0x01); // GOD Item enabled = 1 disabled (red) = 0 packet.writeC(item.isAvailable() ? 1 : 0); // GOD Item enabled = 1 disabled (red) = 0
if (containsMask(mask, ItemListType.AUGMENT_BONUS)) if (containsMask(mask, ItemListType.AUGMENT_BONUS))
{ {
writeItemAugment(packet, item); writeItemAugment(packet, item);

View File

@ -64,6 +64,8 @@ public class ItemInfo
private int _mana; private int _mana;
private int _time; private int _time;
private boolean _available = true;
private int _location; private int _location;
private byte _elemAtkType = -2; private byte _elemAtkType = -2;
@ -137,6 +139,7 @@ public class ItemInfo
// Get shadow item mana // Get shadow item mana
_mana = item.getMana(); _mana = item.getMana();
_time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -9999; _time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -9999;
_available = item.isAvailable();
_location = item.getLocationSlot(); _location = item.getLocationSlot();
_elemAtkType = item.getAttackAttributeType().getClientId(); _elemAtkType = item.getAttackAttributeType().getClientId();
@ -359,6 +362,11 @@ public class ItemInfo
return _time > 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999; return _time > 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999;
} }
public boolean isAvailable()
{
return _available;
}
public int getLocation() public int getLocation()
{ {
return _location; return _location;

View File

@ -705,6 +705,11 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
_preConditions.add(c); _preConditions.add(c);
} }
public List<Condition> getConditions()
{
return _preConditions;
}
/** /**
* Method to retrieve skills linked to this item armor and weapon: passive skills etcitem: skills used on item use <-- ??? * 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[] * @return Skills linked to this item as SkillHolder[]

View File

@ -62,6 +62,7 @@ import com.l2jmobius.gameserver.model.VariationInstance;
import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; 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.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.entity.Castle;
import com.l2jmobius.gameserver.model.events.EventDispatcher; import com.l2jmobius.gameserver.model.events.EventDispatcher;
@ -1775,6 +1776,33 @@ public final class L2ItemInstance extends L2Object
return _protected; 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) public void setCountDecrease(boolean decrease)
{ {
_decrease = decrease; _decrease = decrease;

View File

@ -80,7 +80,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
packet.writeC(0x01); // TODO : Find me packet.writeC(0x01); // TODO : Find me
packet.writeD(item.getMana()); packet.writeD(item.getMana());
packet.writeD(item.getTime()); packet.writeD(item.getTime());
packet.writeC(0x01); // GOD Item enabled = 1 disabled (red) = 0 packet.writeC(item.isAvailable() ? 1 : 0); // GOD Item enabled = 1 disabled (red) = 0
if (containsMask(mask, ItemListType.AUGMENT_BONUS)) if (containsMask(mask, ItemListType.AUGMENT_BONUS))
{ {
writeItemAugment(packet, item); writeItemAugment(packet, item);

View File

@ -64,6 +64,8 @@ public class ItemInfo
private int _mana; private int _mana;
private int _time; private int _time;
private boolean _available = true;
private int _location; private int _location;
private byte _elemAtkType = -2; private byte _elemAtkType = -2;
@ -137,6 +139,7 @@ public class ItemInfo
// Get shadow item mana // Get shadow item mana
_mana = item.getMana(); _mana = item.getMana();
_time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -9999; _time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -9999;
_available = item.isAvailable();
_location = item.getLocationSlot(); _location = item.getLocationSlot();
_elemAtkType = item.getAttackAttributeType().getClientId(); _elemAtkType = item.getAttackAttributeType().getClientId();
@ -359,6 +362,11 @@ public class ItemInfo
return _time > 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999; return _time > 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999;
} }
public boolean isAvailable()
{
return _available;
}
public int getLocation() public int getLocation()
{ {
return _location; return _location;

View File

@ -705,6 +705,11 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
_preConditions.add(c); _preConditions.add(c);
} }
public List<Condition> getConditions()
{
return _preConditions;
}
/** /**
* Method to retrieve skills linked to this item armor and weapon: passive skills etcitem: skills used on item use <-- ??? * 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[] * @return Skills linked to this item as SkillHolder[]

View File

@ -62,6 +62,7 @@ import com.l2jmobius.gameserver.model.VariationInstance;
import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; 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.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.entity.Castle;
import com.l2jmobius.gameserver.model.events.EventDispatcher; import com.l2jmobius.gameserver.model.events.EventDispatcher;
@ -1775,6 +1776,33 @@ public final class L2ItemInstance extends L2Object
return _protected; 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) public void setCountDecrease(boolean decrease)
{ {
_decrease = decrease; _decrease = decrease;

View File

@ -80,7 +80,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
packet.writeC(0x01); // TODO : Find me packet.writeC(0x01); // TODO : Find me
packet.writeD(item.getMana()); packet.writeD(item.getMana());
packet.writeD(item.getTime()); packet.writeD(item.getTime());
packet.writeC(0x01); // GOD Item enabled = 1 disabled (red) = 0 packet.writeC(item.isAvailable() ? 1 : 0); // GOD Item enabled = 1 disabled (red) = 0
if (containsMask(mask, ItemListType.AUGMENT_BONUS)) if (containsMask(mask, ItemListType.AUGMENT_BONUS))
{ {
writeItemAugment(packet, item); writeItemAugment(packet, item);

View File

@ -64,6 +64,8 @@ public class ItemInfo
private int _mana; private int _mana;
private int _time; private int _time;
private boolean _available = true;
private int _location; private int _location;
private byte _elemAtkType = -2; private byte _elemAtkType = -2;
@ -137,6 +139,7 @@ public class ItemInfo
// Get shadow item mana // Get shadow item mana
_mana = item.getMana(); _mana = item.getMana();
_time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -9999; _time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -9999;
_available = item.isAvailable();
_location = item.getLocationSlot(); _location = item.getLocationSlot();
_elemAtkType = item.getAttackAttributeType().getClientId(); _elemAtkType = item.getAttackAttributeType().getClientId();
@ -359,6 +362,11 @@ public class ItemInfo
return _time > 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999; return _time > 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999;
} }
public boolean isAvailable()
{
return _available;
}
public int getLocation() public int getLocation()
{ {
return _location; return _location;

View File

@ -705,6 +705,11 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
_preConditions.add(c); _preConditions.add(c);
} }
public List<Condition> getConditions()
{
return _preConditions;
}
/** /**
* Method to retrieve skills linked to this item armor and weapon: passive skills etcitem: skills used on item use <-- ??? * 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[] * @return Skills linked to this item as SkillHolder[]

View File

@ -62,6 +62,7 @@ import com.l2jmobius.gameserver.model.VariationInstance;
import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; 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.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.entity.Castle;
import com.l2jmobius.gameserver.model.events.EventDispatcher; import com.l2jmobius.gameserver.model.events.EventDispatcher;
@ -1775,6 +1776,33 @@ public final class L2ItemInstance extends L2Object
return _protected; 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) public void setCountDecrease(boolean decrease)
{ {
_decrease = decrease; _decrease = decrease;

View File

@ -80,7 +80,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
packet.writeC(0x01); // TODO : Find me packet.writeC(0x01); // TODO : Find me
packet.writeD(item.getMana()); packet.writeD(item.getMana());
packet.writeD(item.getTime()); packet.writeD(item.getTime());
packet.writeC(0x01); // GOD Item enabled = 1 disabled (red) = 0 packet.writeC(item.isAvailable() ? 1 : 0); // GOD Item enabled = 1 disabled (red) = 0
if (containsMask(mask, ItemListType.AUGMENT_BONUS)) if (containsMask(mask, ItemListType.AUGMENT_BONUS))
{ {
writeItemAugment(packet, item); writeItemAugment(packet, item);

View File

@ -64,6 +64,8 @@ public class ItemInfo
private int _mana; private int _mana;
private int _time; private int _time;
private boolean _available = true;
private int _location; private int _location;
private byte _elemAtkType = -2; private byte _elemAtkType = -2;
@ -137,6 +139,7 @@ public class ItemInfo
// Get shadow item mana // Get shadow item mana
_mana = item.getMana(); _mana = item.getMana();
_time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -9999; _time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -9999;
_available = item.isAvailable();
_location = item.getLocationSlot(); _location = item.getLocationSlot();
_elemAtkType = item.getAttackAttributeType().getClientId(); _elemAtkType = item.getAttackAttributeType().getClientId();
@ -359,6 +362,11 @@ public class ItemInfo
return _time > 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999; return _time > 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999;
} }
public boolean isAvailable()
{
return _available;
}
public int getLocation() public int getLocation()
{ {
return _location; return _location;

View File

@ -709,6 +709,11 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
_preConditions.add(c); _preConditions.add(c);
} }
public List<Condition> getConditions()
{
return _preConditions;
}
/** /**
* Method to retrieve skills linked to this item armor and weapon: passive skills etcitem: skills used on item use <-- ??? * 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[] * @return Skills linked to this item as SkillHolder[]

View File

@ -62,6 +62,7 @@ import com.l2jmobius.gameserver.model.VariationInstance;
import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; 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.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.entity.Castle;
import com.l2jmobius.gameserver.model.events.EventDispatcher; import com.l2jmobius.gameserver.model.events.EventDispatcher;
@ -1775,6 +1776,33 @@ public final class L2ItemInstance extends L2Object
return _protected; 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) public void setCountDecrease(boolean decrease)
{ {
_decrease = decrease; _decrease = decrease;

View File

@ -80,7 +80,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
packet.writeC(0x01); // TODO : Find me packet.writeC(0x01); // TODO : Find me
packet.writeD(item.getMana()); packet.writeD(item.getMana());
packet.writeD(item.getTime()); packet.writeD(item.getTime());
packet.writeC(0x01); // GOD Item enabled = 1 disabled (red) = 0 packet.writeC(item.isAvailable() ? 1 : 0); // GOD Item enabled = 1 disabled (red) = 0
if (containsMask(mask, ItemListType.AUGMENT_BONUS)) if (containsMask(mask, ItemListType.AUGMENT_BONUS))
{ {
writeItemAugment(packet, item); writeItemAugment(packet, item);

View File

@ -64,6 +64,8 @@ public class ItemInfo
private int _mana; private int _mana;
private int _time; private int _time;
private boolean _available = true;
private int _location; private int _location;
private byte _elemAtkType = -2; private byte _elemAtkType = -2;
@ -137,6 +139,7 @@ public class ItemInfo
// Get shadow item mana // Get shadow item mana
_mana = item.getMana(); _mana = item.getMana();
_time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -9999; _time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -9999;
_available = item.isAvailable();
_location = item.getLocationSlot(); _location = item.getLocationSlot();
_elemAtkType = item.getAttackAttributeType().getClientId(); _elemAtkType = item.getAttackAttributeType().getClientId();
@ -359,6 +362,11 @@ public class ItemInfo
return _time > 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999; return _time > 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999;
} }
public boolean isAvailable()
{
return _available;
}
public int getLocation() public int getLocation()
{ {
return _location; return _location;

View File

@ -709,6 +709,11 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
_preConditions.add(c); _preConditions.add(c);
} }
public List<Condition> getConditions()
{
return _preConditions;
}
/** /**
* Method to retrieve skills linked to this item armor and weapon: passive skills etcitem: skills used on item use <-- ??? * 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[] * @return Skills linked to this item as SkillHolder[]

View File

@ -62,6 +62,7 @@ import com.l2jmobius.gameserver.model.VariationInstance;
import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; 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.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.entity.Castle;
import com.l2jmobius.gameserver.model.events.EventDispatcher; import com.l2jmobius.gameserver.model.events.EventDispatcher;
@ -1775,6 +1776,33 @@ public final class L2ItemInstance extends L2Object
return _protected; 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) public void setCountDecrease(boolean decrease)
{ {
_decrease = decrease; _decrease = decrease;

View File

@ -80,7 +80,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
packet.writeC(0x01); // TODO : Find me packet.writeC(0x01); // TODO : Find me
packet.writeD(item.getMana()); packet.writeD(item.getMana());
packet.writeD(item.getTime()); packet.writeD(item.getTime());
packet.writeC(0x01); // GOD Item enabled = 1 disabled (red) = 0 packet.writeC(item.isAvailable() ? 1 : 0); // GOD Item enabled = 1 disabled (red) = 0
if (containsMask(mask, ItemListType.AUGMENT_BONUS)) if (containsMask(mask, ItemListType.AUGMENT_BONUS))
{ {
writeItemAugment(packet, item); writeItemAugment(packet, item);

View File

@ -64,6 +64,8 @@ public class ItemInfo
private int _mana; private int _mana;
private int _time; private int _time;
private boolean _available = true;
private int _location; private int _location;
private byte _elemAtkType = -2; private byte _elemAtkType = -2;
@ -137,6 +139,7 @@ public class ItemInfo
// Get shadow item mana // Get shadow item mana
_mana = item.getMana(); _mana = item.getMana();
_time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -9999; _time = item.isTimeLimitedItem() ? (int) (item.getRemainingTime() / 1000) : -9999;
_available = item.isAvailable();
_location = item.getLocationSlot(); _location = item.getLocationSlot();
_elemAtkType = item.getAttackAttributeType().getClientId(); _elemAtkType = item.getAttackAttributeType().getClientId();
@ -359,6 +362,11 @@ public class ItemInfo
return _time > 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999; return _time > 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999;
} }
public boolean isAvailable()
{
return _available;
}
public int getLocation() public int getLocation()
{ {
return _location; return _location;

View File

@ -709,6 +709,11 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
_preConditions.add(c); _preConditions.add(c);
} }
public List<Condition> getConditions()
{
return _preConditions;
}
/** /**
* Method to retrieve skills linked to this item armor and weapon: passive skills etcitem: skills used on item use <-- ??? * 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[] * @return Skills linked to this item as SkillHolder[]

View File

@ -62,6 +62,7 @@ import com.l2jmobius.gameserver.model.VariationInstance;
import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; 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.ensoul.EnsoulOption;
import com.l2jmobius.gameserver.model.entity.Castle; import com.l2jmobius.gameserver.model.entity.Castle;
import com.l2jmobius.gameserver.model.events.EventDispatcher; import com.l2jmobius.gameserver.model.events.EventDispatcher;
@ -1775,6 +1776,33 @@ public final class L2ItemInstance extends L2Object
return _protected; 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) public void setCountDecrease(boolean decrease)
{ {
_decrease = decrease; _decrease = decrease;

View File

@ -85,7 +85,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
packet.writeC(0x01); // TODO : Find me packet.writeC(0x01); // TODO : Find me
packet.writeD(item.getMana()); packet.writeD(item.getMana());
packet.writeD(item.getTime()); packet.writeD(item.getTime());
packet.writeC(0x01); // GOD Item enabled = 1 disabled (red) = 0 packet.writeC(item.isAvailable() ? 1 : 0); // GOD Item enabled = 1 disabled (red) = 0
packet.writeC(0x00); // 140 protocol packet.writeC(0x00); // 140 protocol
packet.writeC(0x00); // 140 protocol packet.writeC(0x00); // 140 protocol
if (containsMask(mask, ItemListType.AUGMENT_BONUS)) if (containsMask(mask, ItemListType.AUGMENT_BONUS))