Class CfItem

  • Direct Known Subclasses:
    CfPlayer

    public class CfItem
    extends java.lang.Object
    The representation of a Crossfire Item, client-side.
    Since:
    1.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      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.
    • Constructor Summary

      Constructors 
      Constructor Description
      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)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addCfItemModifiedListener​(@NotNull CfItemListener listener)
      Add a CfItemModifiedListener.
      int getAnim()
      Returns the animation.
      int getAnimSpeed()
      Returns the animation speed.
      @NotNull Face getFace()
      Returns the face.
      int getLocation()
      Returns the location.
      @NotNull java.lang.String getName()
      Returns the name.
      int getNrOf()
      Returns the number of objects in this item stack.
      int getTag()
      Returns the tag.
      @NotNull java.lang.String getTooltipText()
      Returns a description suitable for a tooltip text.
      @NotNull java.lang.String getTooltipText1()
      Returns the first line of the tooltip text.
      @NotNull java.lang.String getTooltipText2()
      Returns the second line of the tooltip text.
      @NotNull 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​(@NotNull CfItemListener listener)
      Remove a CfItemModifiedListener.
      void setLocation​(int location)
      Updates the location.
      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)
      Processes an "upditem" command.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • F_APPLIED

        public static final int F_APPLIED
        The flags mask for applied states.
        See Also:
        Constant Field Values
      • F_UNIDENTIFIED

        public static final int F_UNIDENTIFIED
        The flags value for unidentified items.
        See Also:
        Constant Field Values
      • F_BLESSED

        public static final int F_BLESSED
        The flags value for blessed items.
        See Also:
        Constant Field Values
      • F_UNPAID

        public static final int F_UNPAID
        The flags value for unpaid items.
        See Also:
        Constant Field Values
      • F_MAGIC

        public static final int F_MAGIC
        The flags value for magical items.
        See Also:
        Constant Field Values
      • F_CURSED

        public static final int F_CURSED
        The flags value for cursed items.
        See Also:
        Constant Field Values
      • F_DAMNED

        public static final int F_DAMNED
        The flags value for damned items.
        See Also:
        Constant Field Values
      • F_OPEN

        public static final int F_OPEN
        The flags value for opened items.
        See Also:
        Constant Field Values
      • F_NOPICK

        public static final int F_NOPICK
        The flags value for non-pickable items.
        See Also:
        Constant Field Values
      • F_LOCKED

        public static final int F_LOCKED
        The flags value for locked items.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CfItem

        public CfItem​(int location,
                      int tag,
                      int flags,
                      int weight,
                      @NotNull
                      @NotNull Face face,
                      @NotNull
                      @NotNull java.lang.String name,
                      @NotNull
                      @NotNull java.lang.String namePl,
                      int anim,
                      int animSpeed,
                      int nrof,
                      int type)
        Creates a new instance.
        Parameters:
        location - the location
        tag - the tag
        flags - the flags
        weight - the weight
        face - the face
        name - the singular name
        namePl - the plural name
        anim - the animation
        animSpeed - the animation speed
        nrof - the number of objects in the stack
        type - the type
    • Method Detail

      • setLocation

        public void setLocation​(int location)
        Updates the location.
        Parameters:
        location - the new location
      • getTag

        public int getTag()
        Returns the tag.
        Returns:
        the tag
      • getWeight

        public int getWeight()
        Returns the weight.
        Returns:
        the weight
      • getFace

        @NotNull
        public @NotNull Face getFace()
        Returns the face.
        Returns:
        the face
      • getName

        @NotNull
        public @NotNull java.lang.String getName()
        Returns the name.
        Returns:
        the name
      • getAnim

        public int getAnim()
        Returns the animation.
        Returns:
        the animation
      • getAnimSpeed

        public int getAnimSpeed()
        Returns the animation speed.
        Returns:
        the animation speed
      • getNrOf

        public int getNrOf()
        Returns the number of objects in this item stack.
        Returns:
        whether the number of objects
      • isApplied

        public boolean isApplied()
        Returns whether this item is applied.
        Returns:
        whether this item is applied
      • isUnidentified

        public boolean isUnidentified()
        Returns whether this item is unidentified.
        Returns:
        whether this item is unidentified
      • isBlessed

        public boolean isBlessed()
        Returns whether this item is blessed.
        Returns:
        whether this item is blessed
      • isUnpaid

        public boolean isUnpaid()
        Returns whether this item is unpaid.
        Returns:
        whether this item is unpaid
      • isMagic

        public boolean isMagic()
        Returns whether this item is magical.
        Returns:
        whether this item is magical
      • isCursed

        public boolean isCursed()
        Returns whether this item is cursed.
        Returns:
        whether this item is cursed
      • isDamned

        public boolean isDamned()
        Returns whether this item is damned.
        Returns:
        whether this item is damned
      • isOpen

        public boolean isOpen()
        Returns whether this item is an opened container.
        Returns:
        whether this item is an opened container
      • isNoPick

        public boolean isNoPick()
        Returns whether this item cannot be picked up.
        Returns:
        whether this item cannot be picked up
      • isLocked

        public boolean isLocked()
        Returns whether this item is locked.
        Returns:
        whether this item is locked
      • getLocation

        public int getLocation()
        Returns the location.
        Returns:
        the location
      • getType

        public int getType()
        Returns the type.
        Returns:
        the type
      • update

        public void update​(int updateFlags,
                           int flags,
                           int weight,
                           @NotNull
                           @NotNull Face face,
                           @NotNull
                           @NotNull java.lang.String name,
                           @NotNull
                           @NotNull java.lang.String namePl,
                           int anim,
                           int animSpeed,
                           int nrof)
        Processes an "upditem" command.
        Parameters:
        updateFlags - the changed values
        flags - the new flags
        weight - the new weight
        face - the new face
        name - the new singular name
        namePl - the new plural name
        anim - the new animation ID
        animSpeed - the new animation speed
        nrof - the new number of items
      • addCfItemModifiedListener

        public void addCfItemModifiedListener​(@NotNull
                                              @NotNull CfItemListener listener)
        Add a CfItemModifiedListener. The listener will be notified about attribute changes of this item.
        Parameters:
        listener - the listener to remove
      • removeCfItemModifiedListener

        public void removeCfItemModifiedListener​(@NotNull
                                                 @NotNull CfItemListener listener)
        Remove a CfItemModifiedListener.
        Parameters:
        listener - the listener to remove
      • getTooltipText

        @NotNull
        public @NotNull java.lang.String getTooltipText()
        Returns a description suitable for a tooltip text.
        Returns:
        the tooltip text
      • getTooltipText1

        @NotNull
        public @NotNull java.lang.String getTooltipText1()
        Returns the first line of the tooltip text.
        Returns:
        the tooltip text
      • getTooltipText2

        @NotNull
        public @NotNull java.lang.String getTooltipText2()
        Returns the second line of the tooltip text.
        Returns:
        the tooltip text
      • getTooltipText3

        @NotNull
        public @NotNull java.lang.String getTooltipText3()
        Returns the third line of the tooltip text.
        Returns:
        the tooltip text
      • isItemGroupButton

        public boolean isItemGroupButton()
        Returns whether this object is a fake object for selecting object groups in the ground view.
        Returns:
        whether this object is a group button