Class Outfit

java.lang.Object
games.stendhal.server.entity.Outfit

public class Outfit extends Object
A data structure that represents the outfit of an RPEntity. This RPEntity can either be an NPC which uses the outfit sprite system, or of a player. You can use this data structure so that you don't have to deal with the way outfits are stored internally. An outfit can contain up to nine parts: body, dress, head, mouth, eyes, mask, hair, hat, & detail. Note, however, that you can create outfit objects that consist of less than nine parts by setting the other parts to null. For example, you can create a dress outfit that you can combine with the player's current so that the player gets the dress, but keeps his hair, head, and body. To denote that a layer should not be drawn, its value can be set to -1. Not all outfits can be chosen by players.
Author:
daniel
  • Constructor Details

    • Outfit

      public Outfit(Integer... layers)
      Creates a new outfit. Set some of the parameters to null if you want an entity that put on this outfit to keep on the corresponding parts of its current outfit. Currently supported layers should be in this order: body, dress, head, mouth, eyes, mask, hair, hat, detail
      Parameters:
      layers - Integer indexes of each outfit layer or null.
    • Outfit

      public Outfit(String strcode)
      Construct an outfit using a string.
      Parameters:
      strcode - Can be a comma separated key=value list or a 10-digit integer for backward compatibility.
    • Outfit

      @Deprecated public Outfit(Integer detail, Integer hair, Integer head, Integer dress, Integer body)
      Deprecated.
      This method is added for backwards compatibility. Anything using this should be updated for new method. Creates a new outfit. Set some of the parameters to null if you want an entity that put on this outfit to keep on the corresponding parts of its current outfit.
      Parameters:
      detail - The index of the detail style, or null
      hair - The index of the hair style, or null
      head - The index of the head style, or null
      dress - The index of the dress style, or null
      body - The index of the body style, or null
  • Method Details

    • getLayer

      public Integer getLayer(String layerName)
    • setLayer

      public void setLayer(String layerName, Integer code)
    • getCode

      public int getCode()
      Represents this outfit in a numeric code. This is for backward-compatibility with old outfit system.
      Returns:
      A 10-digit decimal number where the first pair of digits stand for detail, the second pair for hair, the third pair for head, the fourth pair for dress, and the fifth pair for body
    • putOver

      public Outfit putOver(Outfit old)
      Gets the result that you get when you wear this outfit over another outfit. Note that this new outfit can contain parts that are marked as NONE; in this case, the parts from the other outfit will be used. FIXME: the Java client cannot render outfit correctly when this is called using an outfit created with Outfit(String) constructor. Not sure if problem is in server or client. (AntumDeluge)
      Parameters:
      other - the outfit that should be worn 'under' the current one
      Returns:
      the combined outfit
    • removeOutfit

      public Outfit removeOutfit(Outfit other)
      Gets the result that you get when you remove (parts of) an outfit. Removes the parts in the parameter, from the current outfit. NOTE: If a part does not match, the current outfit part will remain the same.
      Parameters:
      other - the outfit that should be removed from the current one
      Returns:
      the new outfit, with the parameter-outfit removed
    • removeOutfit

      public Outfit removeOutfit(Integer... layers)
      Gets the result that you get when you remove (parts of) an outfit. Removes the parts in the parameter, from the current outfit. NOTE: If a part does not match, the current outfit part will remain the same. Currently supported layers should be in this order: body, dress, head, mouth, eyes, mask, hair, hat, detail
      Parameters:
      layers - Integer indexes of each outfit layer that should be removed.
      Returns:
      the new outfit, with the layers removed.
    • removeDetail

      public void removeDetail()
      removes the details
    • isPartOf

      public boolean isPartOf(Outfit other)
      Checks whether this outfit is equal to or part of another outfit.
      Parameters:
      other - Another outfit.
      Returns:
      true iff this outfit is part of the given outfit.
    • isPartOf

      public boolean isPartOf(String layer, Integer index)
      Checks a single layer of the outfit.
      Parameters:
      layer -
      index -
      Returns:
    • isChoosableByPlayers

      public boolean isChoosableByPlayers()
      Checks whether this outfit may be selected by a normal player as normal outfit. It returns false for special event and GM outfits.
      Returns:
      true if it is a normal outfit
    • isNaked

      public boolean isNaked()
      Is outfit missing a dress?
      Returns:
      true if naked, false if dressed
    • getRandomOutfit

      public static Outfit getRandomOutfit()
      Create a random unisex outfit, with a 'normal' face and unisex body
      • hair number (1 to 26) selection of hairs which look ok with both goblin face and cute face (later hairs only look right with cute face)
      • head numbers (1 to 15) to avoid the cut eye, pink eyes, weird green eyeshadow etc
      • dress numbers (1 to 16) from the early outfits before lady player base got introduced i.e. they are all unisex
      • base numbers ( 1 to 15), these are the early bodies which were unisex
      Returns:
      the new random outfit
    • isCompatibleWithClothes

      public boolean isCompatibleWithClothes()
      Can this outfit be worn with normal clothes
      Returns:
      true if the outfit is compatible with clothes, false otherwise
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getData

      public String getData(Map<String,​String> colors)
    • toString

      public String toString()
      Overrides:
      toString in class Object