Package games.stendhal.server.entity
Class Outfit
java.lang.Object
games.stendhal.server.entity.Outfit
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
int
getCode()
Represents this outfit in a numeric code.static Outfit
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.int
hashCode()
boolean
Checks whether this outfit may be selected by a normal player as normal outfit.boolean
Can this outfit be worn with normal clothesboolean
isNaked()
Is outfit missing a dress?boolean
Checks whether this outfit is equal to or part of another outfit.boolean
Checks a single layer of the outfit.Gets the result that you get when you wear this outfit over another outfit.void
removes the detailsremoveOutfit(Outfit other)
Gets the result that you get when you remove (parts of) an outfit.removeOutfit(Integer... layers)
Gets the result that you get when you remove (parts of) an outfit.void
toString()
-
Constructor Details
-
Outfit
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
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.UseOutfit(String)
orOutfit(Integer...)
.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 nullhair
- The index of the hair style, or nullhead
- The index of the head style, or nulldress
- The index of the dress style, or nullbody
- The index of the body style, or null
-
-
Method Details
-
getLayer
-
setLayer
-
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
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
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
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
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
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
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
-
hashCode
public int hashCode() -
getData
-
toString
-
Outfit(String)
orOutfit(Integer...)
.