22 package com.realtime.crossfire.jxclient.skills;
28 import java.util.Arrays;
29 import java.util.HashMap;
31 import org.jetbrains.annotations.NotNull;
32 import org.jetbrains.annotations.Nullable;
51 private final Map<String, Skill>
namedSkills =
new HashMap<>();
58 @SuppressWarnings(
"FieldCanBeLocal")
67 public void metaserver() {
72 public void preConnecting(@NotNull
final String serverInfo) {
77 public void connecting(@NotNull
final String serverInfo) {
87 public void connected() {
92 public void connectFailed(@NotNull
final String reason) {
111 Arrays.fill(numberedSkills, null);
120 public void addSkill(
final int id, @NotNull
final String skillName,
final int face) {
122 final Skill oldSkill = numberedSkills[index];
124 if (oldSkill == newSkill) {
128 if (oldSkill != null) {
131 numberedSkills[index] = newSkill;
142 final Skill oldSkill = namedSkills.get(skillName);
143 if (oldSkill != null) {
150 namedSkills.put(skillName, newSkill);
158 for (
final Skill skill : numberedSkills) {
183 for (
int i = 0; i < numberedSkills.length; i++) {
184 if (numberedSkills[i] != null && numberedSkills[i].toString().equals(name)) {
Interface for listeners interested gui state changes.
Maintains the current GuiState.
Skill getNamedSkill(@NotNull final String skillName, final int face)
Returns the skill instance for a given skill name.
static final int CS_NUM_SKILLS
CS_NUM_SKILLS does not match how many skills there really are - instead, it is used as a range of val...
void clearSkills()
Clears all skills.
final Map< String, Skill > namedSkills
Maps skill name to skill instance.
void set(final int level, final long experience)
Updates the skill attributes.
SkillSet(@NotNull final GuiStateManager guiStateManager)
Creates a new instance.
One skill of the character.
int getSkillId(final String name)
Get a skill identifier from the skill name.
final Skill [] numberedSkills
Maps stat number to skill instance.
static final int CS_STAT_SKILLINFO
CS_STAT_SKILLINFO is used as the starting index point.
void addSkill(final int id, @NotNull final String skillName, final int face)
Adds a new skill to the list of known skills.
void setFace(final int face)
Defines the skill's face.
Skill getSkill(final int id)
Returns the given skill as a Skill object.
final GuiStateListener guiStateListener
The GuiStateListener for detecting established or dropped connections.
This is the representation of all the statistics of a player, like its speed or its experience...
void clearNumberedSkills()
Clears all stat info in numberedSkills.
Maintain the set of skills as sent by the server.
Connection progress states of the Crossfire server connection.