Class NewCharModel
- java.lang.Object
-
- com.realtime.crossfire.jxclient.gui.label.NewCharModel
-
public class NewCharModel extends java.lang.ObjectGeneral information for creating new characters.
-
-
Field Summary
Fields Modifier and Type Field Description static intPRIORITY_CHARACTER_NAMEA priority value forsetErrorText(int, String).static intPRIORITY_INVALID_STAT_CHAA priority value forsetErrorText(int, String).static intPRIORITY_INVALID_STAT_CONA priority value forsetErrorText(int, String).static intPRIORITY_INVALID_STAT_DEXA priority value forsetErrorText(int, String).static intPRIORITY_INVALID_STAT_INTA priority value forsetErrorText(int, String).static intPRIORITY_INVALID_STAT_POWA priority value forsetErrorText(int, String).static intPRIORITY_INVALID_STAT_STRA priority value forsetErrorText(int, String).static intPRIORITY_INVALID_STAT_WISA priority value forsetErrorText(int, String).static intPRIORITY_SERVER_FAILUREA priority value forsetErrorText(int, String).static intPRIORITY_UNUSED_POINTSA priority value forsetErrorText(int, String).
-
Constructor Summary
Constructors Constructor Description NewCharModel(@NotNull NewCharacterInformation newCharacterInformation)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(@NotNull NewCharModelListener listener)Adds a listener to notify of changes.@NotNull java.lang.StringgetClass_()Returns the selected class.intgetClassStatAdjustment(@NotNull NewcharStat stat)Returns the class points for a stat.@NotNull java.lang.StringgetErrorText()Returns the error text to show.@NotNull NewCharacterInformationgetNewCharacterInformation()Returns theNewCharacterInformationinstance received from the server.@Nullable ChoicegetOption()Returns the character options.intgetOptionIndex()Return the selected character option.@NotNull java.lang.StringgetRace()Returns the selected race.intgetRaceStatAdjustment(@NotNull NewcharStat stat)Returns the race points for a stat.@NotNull java.lang.StringgetStartingMap()Returns the selected starting map.intgetTotal(@NotNull NewcharStat stat)Returns the total points (sum of base, race, and class) for a stat.intgetUnusedPoints()Returns the number of unused attribute points.intgetValue(@NotNull NewcharStat stat)Returns the base points for a stat.booleanhasNonServerFailureErrorText()Returns the error text to show.voidremoveListener(@NotNull NewCharModelListener listener)Removes a listener to be notified of changes.voidsetClass(@NotNull java.lang.String class_)Sets the selected class.voidsetErrorText(int priority, @Nullable java.lang.String text)Sets an error text.voidsetOptionIndex(int optionIndex)Sets the selected character option.voidsetRace(@NotNull java.lang.String race)Sets the selected race.voidsetStartingMap(@NotNull java.lang.String startingMap)Sets the selected starting map.voidsetValue(@NotNull NewcharStat stat, int value)Sets the base points for a stat.
-
-
-
Field Detail
-
PRIORITY_INVALID_STAT_STR
public static final int PRIORITY_INVALID_STAT_STR
A priority value forsetErrorText(int, String).- See Also:
- Constant Field Values
-
PRIORITY_INVALID_STAT_DEX
public static final int PRIORITY_INVALID_STAT_DEX
A priority value forsetErrorText(int, String).- See Also:
- Constant Field Values
-
PRIORITY_INVALID_STAT_CON
public static final int PRIORITY_INVALID_STAT_CON
A priority value forsetErrorText(int, String).- See Also:
- Constant Field Values
-
PRIORITY_INVALID_STAT_INT
public static final int PRIORITY_INVALID_STAT_INT
A priority value forsetErrorText(int, String).- See Also:
- Constant Field Values
-
PRIORITY_INVALID_STAT_WIS
public static final int PRIORITY_INVALID_STAT_WIS
A priority value forsetErrorText(int, String).- See Also:
- Constant Field Values
-
PRIORITY_INVALID_STAT_POW
public static final int PRIORITY_INVALID_STAT_POW
A priority value forsetErrorText(int, String).- See Also:
- Constant Field Values
-
PRIORITY_INVALID_STAT_CHA
public static final int PRIORITY_INVALID_STAT_CHA
A priority value forsetErrorText(int, String).- See Also:
- Constant Field Values
-
PRIORITY_UNUSED_POINTS
public static final int PRIORITY_UNUSED_POINTS
A priority value forsetErrorText(int, String).- See Also:
- Constant Field Values
-
PRIORITY_CHARACTER_NAME
public static final int PRIORITY_CHARACTER_NAME
A priority value forsetErrorText(int, String).- See Also:
- Constant Field Values
-
PRIORITY_SERVER_FAILURE
public static final int PRIORITY_SERVER_FAILURE
A priority value forsetErrorText(int, String).- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NewCharModel
public NewCharModel(@NotNull @NotNull NewCharacterInformation newCharacterInformation)Creates a new instance.- Parameters:
newCharacterInformation- the new character information to use
-
-
Method Detail
-
addListener
public void addListener(@NotNull @NotNull NewCharModelListener listener)Adds a listener to notify of changes.- Parameters:
listener- the listener
-
removeListener
public void removeListener(@NotNull @NotNull NewCharModelListener listener)Removes a listener to be notified of changes.- Parameters:
listener- the listener
-
getNewCharacterInformation
@NotNull public @NotNull NewCharacterInformation getNewCharacterInformation()
Returns theNewCharacterInformationinstance received from the server.- Returns:
- the instance
-
getRace
@NotNull public @NotNull java.lang.String getRace()
Returns the selected race.- Returns:
- the race
-
setRace
public void setRace(@NotNull @NotNull java.lang.String race)Sets the selected race.- Parameters:
race- the selected race
-
getClass_
@NotNull public @NotNull java.lang.String getClass_()
Returns the selected class.- Returns:
- the class
-
setClass
public void setClass(@NotNull @NotNull java.lang.String class_)Sets the selected class.- Parameters:
class_- the class
-
getStartingMap
@NotNull public @NotNull java.lang.String getStartingMap()
Returns the selected starting map.- Returns:
- the starting map
-
setStartingMap
public void setStartingMap(@NotNull @NotNull java.lang.String startingMap)Sets the selected starting map.- Parameters:
startingMap- the starting map
-
getTotal
public int getTotal(@NotNull @NotNull NewcharStat stat)Returns the total points (sum of base, race, and class) for a stat.- Parameters:
stat- the stat- Returns:
- the points
-
setValue
public void setValue(@NotNull @NotNull NewcharStat stat, int value)Sets the base points for a stat.- Parameters:
stat- the statvalue- the points
-
getValue
public int getValue(@NotNull @NotNull NewcharStat stat)Returns the base points for a stat.- Parameters:
stat- the stat- Returns:
- the points
-
getRaceStatAdjustment
public int getRaceStatAdjustment(@NotNull @NotNull NewcharStat stat)Returns the race points for a stat.- Parameters:
stat- the stat- Returns:
- the points
-
getClassStatAdjustment
public int getClassStatAdjustment(@NotNull @NotNull NewcharStat stat)Returns the class points for a stat.- Parameters:
stat- the stat- Returns:
- the points
-
setErrorText
public void setErrorText(int priority, @Nullable @Nullable java.lang.String text)Sets an error text.- Parameters:
priority- the priority for deciding which error text to showtext- the error text ornullto remove the error
-
getErrorText
@NotNull public @NotNull java.lang.String getErrorText()
Returns the error text to show.- Returns:
- the error text or an empty string to show none
-
hasNonServerFailureErrorText
public boolean hasNonServerFailureErrorText()
Returns the error text to show.- Returns:
- the error text or an empty string to show none
-
getUnusedPoints
public int getUnusedPoints()
Returns the number of unused attribute points.- Returns:
- the number of unused attribute points
-
getOption
@Nullable public @Nullable Choice getOption()
Returns the character options.- Returns:
- the character options or
nullif no options are available
-
getOptionIndex
public int getOptionIndex()
Return the selected character option.- Returns:
- the option or
-1if no option is available
-
setOptionIndex
public void setOptionIndex(int optionIndex)
Sets the selected character option.- Parameters:
optionIndex- the option; invalid values are handled
-
-