java.lang.Object com.realtime.crossfire.jxclient.items.CfItem
public class CfItem
The representation of a Crossfire Item, client-side.
Field Summary | |
---|---|
private int |
anim
The animation. |
private int |
animSpeed
The animation speed. |
static int |
F_APPLIED
The flags mask for applied states. |
static int |
F_BLESSED
The flags value for blessed items. |
static int |
F_CURSED
The flags value for cursed items. |
static int |
F_DAMNED
The flags value for damned items. |
static int |
F_LOCKED
The flags value for locked items. |
static int |
F_MAGIC
The flags value for magical items. |
static int |
F_NOPICK
The flags value for non-pickable items. |
static int |
F_OPEN
The flags value for opened items. |
static int |
F_UNIDENTIFIED
The flags value for unidentified items. |
static int |
F_UNPAID
The flags value for unpaid items. |
private Face |
face
The face. |
private int |
flags
The flags. |
private javax.swing.event.EventListenerList |
listeners
The listeners to be notified. |
private int |
location
The location. |
private boolean |
modified
Set if any attribute has changed since the last time listeners were notified. |
private java.lang.String |
name
The singular name. |
private java.lang.String |
namePl
The plural name. |
private int |
nrof
The number of objects in the stack. |
private int |
tag
The tag. |
private int |
type
The type. |
private int |
weight
The weight. |
Constructor Summary | |
---|---|
CfItem(int location,
int tag,
int flags,
int weight,
Face face,
java.lang.String name,
java.lang.String namePl,
int anim,
int animSpeed,
int nrof,
int type)
Creates a new instance. |
Method Summary | |
---|---|
void |
addCfItemModifiedListener(CfItemListener listener)
Add a CfItemModifiedListener . |
private void |
appendFlag(java.lang.StringBuilder sb,
int flag,
java.lang.String ident)
Appends "(<ident>)" if this item has the flag flag
set. |
private void |
fireModified()
Notify all listener. |
Face |
getFace()
Returns the face. |
int |
getLocation()
Returns the location. |
java.lang.String |
getName()
Returns the name. |
int |
getNrOf()
Returns the number of objects in this item stack. |
int |
getTag()
Returns the tag. |
java.lang.String |
getTooltipText()
Returns a description suitable for a tooltip text. |
java.lang.String |
getTooltipText1()
Returns the first line of the tooltip text. |
java.lang.String |
getTooltipText2()
Returns the second line of the tooltip text. |
java.lang.String |
getTooltipText3()
Returns the third line of the tooltip text. |
int |
getType()
Returns the type. |
int |
getWeight()
Returns the weight. |
boolean |
isApplied()
Returns whether this item is applied. |
boolean |
isBlessed()
Returns whether this item is blessed. |
boolean |
isCursed()
Returns whether this item is cursed. |
boolean |
isDamned()
Returns whether this item is damned. |
boolean |
isItemGroupButton()
Returns whether this object is a fake object for selecting object groups in the ground view. |
boolean |
isLocked()
Returns whether this item is locked. |
boolean |
isMagic()
Returns whether this item is magical. |
boolean |
isNoPick()
Returns whether this item cannot be picked up. |
boolean |
isOpen()
Returns whether this item is an opened container. |
boolean |
isUnidentified()
Returns whether this item is unidentified. |
boolean |
isUnpaid()
Returns whether this item is unpaid. |
void |
removeCfItemModifiedListener(CfItemListener listener)
Remove a CfItemModifiedListener . |
private void |
setAnim(int anim)
Updates the animation. |
private void |
setAnimSpeed(int animSpeed)
Updates the animation speed. |
private void |
setFace(Face face)
Updates the face. |
private void |
setFlags(int flags)
Updates the flags. |
void |
setLocation(int location)
Updates the location. |
private void |
setName(java.lang.String name,
java.lang.String namePl)
Updates the name. |
private void |
setNrOf(int nrof)
Updates the number of objects in the stack. |
private void |
setWeight(int weight)
Updates the weight. |
void |
update(int updateFlags,
int flags,
int weight,
Face face,
java.lang.String name,
java.lang.String namePl,
int anim,
int animSpeed,
int nrof)
Processes an "upditem" command. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int anim
private int animSpeed
public static final int F_APPLIED
public static final int F_BLESSED
public static final int F_CURSED
public static final int F_DAMNED
public static final int F_LOCKED
public static final int F_MAGIC
public static final int F_NOPICK
public static final int F_OPEN
public static final int F_UNIDENTIFIED
public static final int F_UNPAID
@NotNull private Face face
private int flags
private final javax.swing.event.EventListenerList listeners
private int location
private boolean modified
@NotNull private java.lang.String name
@NotNull private java.lang.String namePl
private int nrof
private final int tag
private final int type
private int weight
Constructor Detail |
---|
public CfItem(int location, int tag, int flags, int weight, @NotNull Face face, @NotNull java.lang.String name, @NotNull java.lang.String namePl, int anim, int animSpeed, int nrof, int type)
location
- the locationtag
- the tagflags
- the flagsweight
- the weightface
- the facename
- the singular namenamePl
- the plural nameanim
- the animationanimSpeed
- the animation speednrof
- the number of objects in the stacktype
- the typeMethod Detail |
---|
public void addCfItemModifiedListener(@NotNull CfItemListener listener)
CfItemModifiedListener
. The listener will be notified
about attribute changes of this item.
listener
- the listener to removeprivate void appendFlag(@NotNull java.lang.StringBuilder sb, int flag, @NotNull java.lang.String ident)
flag
set.
sb
- the string builder to append toflag
- the flag to checkident
- the ident string to appendprivate void fireModified()
@NotNull public Face getFace()
public int getLocation()
@NotNull public java.lang.String getName()
public int getNrOf()
public int getTag()
@NotNull public java.lang.String getTooltipText()
@NotNull public java.lang.String getTooltipText1()
@NotNull public java.lang.String getTooltipText2()
@NotNull public java.lang.String getTooltipText3()
public int getType()
public int getWeight()
public boolean isApplied()
public boolean isBlessed()
public boolean isCursed()
public boolean isDamned()
public boolean isItemGroupButton()
public boolean isLocked()
public boolean isMagic()
public boolean isNoPick()
public boolean isOpen()
public boolean isUnidentified()
public boolean isUnpaid()
public void removeCfItemModifiedListener(@NotNull CfItemListener listener)
CfItemModifiedListener
.
listener
- the listener to removeprivate void setAnim(int anim)
anim
- the new animationprivate void setAnimSpeed(int animSpeed)
animSpeed
- the new animation speedprivate void setFace(@NotNull Face face)
face
- the new faceprivate void setFlags(int flags)
flags
- the new flagspublic void setLocation(int location)
location
- the new locationprivate void setName(@NotNull java.lang.String name, @NotNull java.lang.String namePl)
name
- the new singular namenamePl
- the new plural nameprivate void setNrOf(int nrof)
nrof
- the new number of objectsprivate void setWeight(int weight)
weight
- the new weightpublic void update(int updateFlags, int flags, int weight, @NotNull Face face, @NotNull java.lang.String name, @NotNull java.lang.String namePl, int anim, int animSpeed, int nrof)
updateFlags
- the changed valuesflags
- the new flagsweight
- the new weightface
- the new facename
- the new singular namenamePl
- the new plural nameanim
- the new animation IDanimSpeed
- the new animation speednrof
- the new number of items