Red icons for unavailable inventory items.
This commit is contained in:
@ -64,6 +64,8 @@ public class ItemInfo
|
||||
private int _mana;
|
||||
private int _time;
|
||||
|
||||
private boolean _available = true;
|
||||
|
||||
private int _location;
|
||||
|
||||
private byte _elemAtkType = -2;
|
||||
@ -137,6 +139,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();
|
||||
@ -359,6 +362,11 @@ public class ItemInfo
|
||||
return _time > 0 ? _time : _visualExpiration > 0 ? (int) _visualExpiration : -9999;
|
||||
}
|
||||
|
||||
public boolean isAvailable()
|
||||
{
|
||||
return _available;
|
||||
}
|
||||
|
||||
public int getLocation()
|
||||
{
|
||||
return _location;
|
||||
|
@ -709,6 +709,11 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
|
||||
_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 <-- ???
|
||||
* @return Skills linked to this item as SkillHolder[]
|
||||
|
@ -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;
|
||||
|
@ -80,7 +80,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
|
||||
packet.writeC(0x01); // TODO : Find me
|
||||
packet.writeD(item.getMana());
|
||||
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))
|
||||
{
|
||||
writeItemAugment(packet, item);
|
||||
|
Reference in New Issue
Block a user