public class NewCharModel
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
PRIORITY_CHARACTER_NAME
A priority value for
setErrorText(int, String) . |
static int |
PRIORITY_INVALID_STAT_CHA
A priority value for
setErrorText(int, String) . |
static int |
PRIORITY_INVALID_STAT_CON
A priority value for
setErrorText(int, String) . |
static int |
PRIORITY_INVALID_STAT_DEX
A priority value for
setErrorText(int, String) . |
static int |
PRIORITY_INVALID_STAT_INT
A priority value for
setErrorText(int, String) . |
static int |
PRIORITY_INVALID_STAT_POW
A priority value for
setErrorText(int, String) . |
static int |
PRIORITY_INVALID_STAT_STR
A priority value for
setErrorText(int, String) . |
static int |
PRIORITY_INVALID_STAT_WIS
A priority value for
setErrorText(int, String) . |
static int |
PRIORITY_SERVER_FAILURE
A priority value for
setErrorText(int, String) . |
static int |
PRIORITY_UNUSED_POINTS
A priority value for
setErrorText(int, String) . |
Constructor and Description |
---|
NewCharModel(@NotNull NewCharacterInformation newCharacterInformation)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(@NotNull NewCharModelListener listener)
Adds a listener to notify of changes.
|
@NotNull java.lang.String |
getClass_()
Returns the selected class.
|
int |
getClassStatAdjustment(@NotNull NewcharStat stat)
Returns the class points for a stat.
|
@NotNull java.lang.String |
getErrorText()
Returns the error text to show.
|
@NotNull NewCharacterInformation |
getNewCharacterInformation()
Returns the
NewCharacterInformation instance received from the
server. |
@Nullable Choice |
getOption()
Returns the character options.
|
int |
getOptionIndex()
Return the selected character option.
|
@NotNull java.lang.String |
getRace()
Returns the selected race.
|
int |
getRaceStatAdjustment(@NotNull NewcharStat stat)
Returns the race points for a stat.
|
@NotNull java.lang.String |
getStartingMap()
Returns the selected starting map.
|
int |
getTotal(@NotNull NewcharStat stat)
Returns the total points (sum of base, race, and class) for a stat.
|
int |
getUnusedPoints()
Returns the number of unused attribute points.
|
int |
getValue(@NotNull NewcharStat stat)
Returns the base points for a stat.
|
boolean |
hasNonServerFailureErrorText()
Returns the error text to show.
|
void |
removeListener(@NotNull NewCharModelListener listener)
Removes a listener to be notified of changes.
|
void |
setClass(@NotNull java.lang.String class_)
Sets the selected class.
|
void |
setErrorText(int priority,
@Nullable java.lang.String text)
Sets an error text.
|
void |
setOptionIndex(int optionIndex)
Sets the selected character option.
|
void |
setRace(@NotNull java.lang.String race)
Sets the selected race.
|
void |
setStartingMap(@NotNull java.lang.String startingMap)
Sets the selected starting map.
|
void |
setValue(@NotNull NewcharStat stat,
int value)
Sets the base points for a stat.
|
public static final int PRIORITY_INVALID_STAT_STR
setErrorText(int, String)
.public static final int PRIORITY_INVALID_STAT_DEX
setErrorText(int, String)
.public static final int PRIORITY_INVALID_STAT_CON
setErrorText(int, String)
.public static final int PRIORITY_INVALID_STAT_INT
setErrorText(int, String)
.public static final int PRIORITY_INVALID_STAT_WIS
setErrorText(int, String)
.public static final int PRIORITY_INVALID_STAT_POW
setErrorText(int, String)
.public static final int PRIORITY_INVALID_STAT_CHA
setErrorText(int, String)
.public static final int PRIORITY_UNUSED_POINTS
setErrorText(int, String)
.public static final int PRIORITY_CHARACTER_NAME
setErrorText(int, String)
.public static final int PRIORITY_SERVER_FAILURE
setErrorText(int, String)
.public NewCharModel(@NotNull @NotNull NewCharacterInformation newCharacterInformation)
newCharacterInformation
- the new character information to usepublic void addListener(@NotNull @NotNull NewCharModelListener listener)
listener
- the listenerpublic void removeListener(@NotNull @NotNull NewCharModelListener listener)
listener
- the listener@NotNull public @NotNull NewCharacterInformation getNewCharacterInformation()
NewCharacterInformation
instance received from the
server.@NotNull public @NotNull java.lang.String getRace()
public void setRace(@NotNull @NotNull java.lang.String race)
race
- the selected race@NotNull public @NotNull java.lang.String getClass_()
public void setClass(@NotNull @NotNull java.lang.String class_)
class_
- the class@NotNull public @NotNull java.lang.String getStartingMap()
public void setStartingMap(@NotNull @NotNull java.lang.String startingMap)
startingMap
- the starting mappublic int getTotal(@NotNull @NotNull NewcharStat stat)
stat
- the statpublic void setValue(@NotNull @NotNull NewcharStat stat, int value)
stat
- the statvalue
- the pointspublic int getValue(@NotNull @NotNull NewcharStat stat)
stat
- the statpublic int getRaceStatAdjustment(@NotNull @NotNull NewcharStat stat)
stat
- the statpublic int getClassStatAdjustment(@NotNull @NotNull NewcharStat stat)
stat
- the statpublic void setErrorText(int priority, @Nullable @Nullable java.lang.String text)
priority
- the priority for deciding which error text to showtext
- the error text or null
to remove the error@NotNull public @NotNull java.lang.String getErrorText()
public boolean hasNonServerFailureErrorText()
public int getUnusedPoints()
@Nullable public @Nullable Choice getOption()
null
if no options are availablepublic int getOptionIndex()
-1
if no option is availablepublic void setOptionIndex(int optionIndex)
optionIndex
- the option; invalid values are handled