Crossfire JXClient, Trunk
R20561
|
Manages all known spells. More...
Public Member Functions | |
void | addCrossfireSpellChangedListener (@NotNull final SpellsManagerListener listener) |
Adds a SpellsManagerListener to notify about changes. More... | |
void | addSpell (final int tag, final int level, final int castingTime, final int mana, final int grace, final int damage, final int skill, final int path, final int faceNum, @NotNull final String spellName, @NotNull final String message) |
Adds a new spell. More... | |
void | deleteSpell (final int tag) |
Deletes a spell. More... | |
boolean | displaysFace (final int faceNum) |
Returns whether any spell has the given face. More... | |
void | filterSkill (final int index) |
Filters spells to display by the specified skill index. More... | |
Spell | getSpell (@NotNull final String spellName) |
Returns a Spell instance by spell name. More... | |
Spell | getSpell (final int index) |
Returns a Spell instance by index. More... | |
int | getSpells () |
Returns the number of known spells. More... | |
Skill | getSpellSkill (final int index) |
Returns the specified spell skill. More... | |
int | getSpellSkills () |
Returns the number of spell skills. More... | |
Iterator< Spell > | iterator () |
void | removeCrossfireSpellChangedListener (@NotNull final SpellsManagerListener listener) |
Removes a SpellsManagerListener to notify about changes. More... | |
void | selectCharacter () |
An character name was sent to the server. More... | |
SpellsManager (@NotNull final GuiStateManager guiStateManager, @NotNull final SkillSet skillSet, @NotNull final Stats stats) | |
Creates a new instance. More... | |
void | updateSpell (final int flags, final int tag, final int mana, final int grace, final int damage) |
Updates spell information. More... | |
Static Public Attributes | |
static final int | UPD_SP_DAMAGE = 4 |
Flag for updspell command: damage is present. More... | |
static final int | UPD_SP_GRACE = 2 |
Flag for updspell command: grace is present. More... | |
static final int | UPD_SP_MANA = 1 |
Flag for updspell command: mana is present. More... | |
Private Member Functions | |
void | deleteSpellByIndex (final int index) |
Deletes a spell by index into spells. More... | |
void | filterSpells () |
Rebuilds the list of spells to display. More... | |
void | rebuildSkills () |
Rebuilds the list of skills from the spells. More... | |
Private Attributes | |
final List< Spell > | filteredSpells = new CopyOnWriteArrayList<>() |
Spells currently exposed, based on the filter. More... | |
final GuiStateListener | guiStateListener |
The GuiStateListener for detecting established or dropped connections. More... | |
final EventListenerList2< SpellsManagerListener > | listeners = new EventListenerList2<>() |
The SpellsManagerListeners to notify about changes. More... | |
final Skill | skillAll = new Skill("All skills") |
Dummy skill for "all skills". More... | |
int | skillFilter = -1 |
Skill to filter spells by, as a skill id in SkillSet. More... | |
final SkillSet | skillSet |
The SkillSet containing skills from the server. More... | |
final Comparator< Spell > | spellNameComparator = new SpellComparator() |
A Comparator to compare Spell instances by spell path and name. More... | |
final List< Spell > | spells = new CopyOnWriteArrayList<>() |
All known spells. More... | |
final List< Skill > | spellSkills = new ArrayList<>() |
Skills used by the spell, including the "all" skill. More... | |
final Stats | stats |
The Stats for the player. More... | |
final Map< String, Spell > | unknownSpells = new HashMap<>() |
All unknown spells that have been referenced before. More... | |
Static Private Attributes | |
static final Comparator< Skill > | SKILL_COMPARATOR = (o1, o2) -> o1.toString().compareTo(o2.toString()) |
Compare 2 skills. More... | |
Manages all known spells.
Spells are filtered by skill through the function filterSkill().
Definition at line 49 of file SpellsManager.java.
com.realtime.crossfire.jxclient.spells.SpellsManager.SpellsManager | ( | @NotNull final GuiStateManager | guiStateManager, |
@NotNull final SkillSet | skillSet, | ||
@NotNull final Stats | stats | ||
) |
Creates a new instance.
guiStateManager | the gui state manager to watch |
skillSet | skills the players knows |
stats | the stats for the player |
Definition at line 183 of file SpellsManager.java.
References com.realtime.crossfire.jxclient.spells.SpellsManager.guiStateListener, com.realtime.crossfire.jxclient.spells.SpellsManager.skillSet, and com.realtime.crossfire.jxclient.spells.SpellsManager.stats.
void com.realtime.crossfire.jxclient.spells.SpellsManager.addCrossfireSpellChangedListener | ( | @NotNull final SpellsManagerListener | listener | ) |
Adds a SpellsManagerListener to notify about changes.
listener | the listener to add |
Definition at line 193 of file SpellsManager.java.
References com.realtime.crossfire.jxclient.util.EventListenerList2< T extends EventListener >.add().
void com.realtime.crossfire.jxclient.spells.SpellsManager.addSpell | ( | final int | tag, |
final int | level, | ||
final int | castingTime, | ||
final int | mana, | ||
final int | grace, | ||
final int | damage, | ||
final int | skill, | ||
final int | path, | ||
final int | faceNum, | ||
@NotNull final String | spellName, | ||
@NotNull final String | message | ||
) |
Adds a new spell.
Re-uses entries from unknownSpells if possible.
tag | the spell's tag |
level | the spell's level |
castingTime | the spell's casting time |
mana | the spell's mana cost |
grace | the spell's grace cost |
damage | the spell's damage |
skill | the spell's skill |
path | the spell's path |
faceNum | the spell's face number |
spellName | the spell's name |
message | the spells' description |
Definition at line 220 of file SpellsManager.java.
References com.realtime.crossfire.jxclient.spells.SpellsManager.filterSpells(), com.realtime.crossfire.jxclient.spells.SpellsManager.rebuildSkills(), com.realtime.crossfire.jxclient.spells.Spell.setParameters(), and com.realtime.crossfire.jxclient.spells.SpellsManager.unknownSpells.
Referenced by com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.processAddSpell().
void com.realtime.crossfire.jxclient.spells.SpellsManager.deleteSpell | ( | final int | tag | ) |
Deletes a spell.
tag | the spell's tag |
Definition at line 273 of file SpellsManager.java.
References com.realtime.crossfire.jxclient.spells.SpellsManager.deleteSpellByIndex(), com.realtime.crossfire.jxclient.spells.SpellsManager.filterSpells(), and com.realtime.crossfire.jxclient.spells.SpellsManager.rebuildSkills().
Referenced by com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.processDelSpell().
|
private |
Deletes a spell by index into spells.
index | the index to delete |
Definition at line 290 of file SpellsManager.java.
References com.realtime.crossfire.jxclient.spells.Spell.getName(), com.realtime.crossfire.jxclient.spells.SpellsManager.rebuildSkills(), com.realtime.crossfire.jxclient.spells.Spell.setUnknown(), and com.realtime.crossfire.jxclient.spells.SpellsManager.unknownSpells.
Referenced by com.realtime.crossfire.jxclient.spells.SpellsManager.deleteSpell().
boolean com.realtime.crossfire.jxclient.spells.SpellsManager.displaysFace | ( | final int | faceNum | ) |
Returns whether any spell has the given face.
faceNum | the face |
Definition at line 363 of file SpellsManager.java.
void com.realtime.crossfire.jxclient.spells.SpellsManager.filterSkill | ( | final int | index | ) |
Filters spells to display by the specified skill index.
index | the skill index, should be less than getSpellSkills() |
Definition at line 385 of file SpellsManager.java.
References com.realtime.crossfire.jxclient.spells.SpellsManager.filterSpells(), and com.realtime.crossfire.jxclient.skills.SkillSet.getSkillId().
Referenced by com.realtime.crossfire.jxclient.gui.list.GUISpellSkillList.selectionChanged().
|
private |
Rebuilds the list of spells to display.
Definition at line 407 of file SpellsManager.java.
References com.realtime.crossfire.jxclient.spells.SpellsManager.skillFilter.
Referenced by com.realtime.crossfire.jxclient.spells.SpellsManager.addSpell(), com.realtime.crossfire.jxclient.spells.SpellsManager.deleteSpell(), and com.realtime.crossfire.jxclient.spells.SpellsManager.filterSkill().
Spell com.realtime.crossfire.jxclient.spells.SpellsManager.getSpell | ( | @NotNull final String | spellName | ) |
Returns a Spell instance by spell name.
Creates a new instance if the spell is unknown.
spellName | the spell name to find |
Definition at line 312 of file SpellsManager.java.
References com.realtime.crossfire.jxclient.spells.Spell.getName(), com.realtime.crossfire.jxclient.spells.Spell.setUnknown(), and com.realtime.crossfire.jxclient.spells.SpellsManager.unknownSpells.
Referenced by com.realtime.crossfire.jxclient.items.SpellsView.getItem(), com.realtime.crossfire.jxclient.gui.item.GUIItemSpell.setSpell(), com.realtime.crossfire.jxclient.shortcuts.Shortcuts.setSpellShortcut(), and com.realtime.crossfire.jxclient.gui.list.GUISpellList.updateTooltip().
Spell com.realtime.crossfire.jxclient.spells.SpellsManager.getSpell | ( | final int | index | ) |
Returns a Spell instance by index.
index | the index |
Definition at line 350 of file SpellsManager.java.
int com.realtime.crossfire.jxclient.spells.SpellsManager.getSpells | ( | ) |
Returns the number of known spells.
Definition at line 340 of file SpellsManager.java.
Referenced by com.realtime.crossfire.jxclient.gui.item.GUIItemSpellSkill.canScroll(), com.realtime.crossfire.jxclient.gui.item.GUIItemSpell.canScroll(), and com.realtime.crossfire.jxclient.items.SpellsView.getSize().
Skill com.realtime.crossfire.jxclient.spells.SpellsManager.getSpellSkill | ( | final int | index | ) |
Returns the specified spell skill.
index | the skill index, from 0 to getSpellSkills()-1 |
Definition at line 441 of file SpellsManager.java.
Referenced by com.realtime.crossfire.jxclient.items.SpellSkillView.getItem(), com.realtime.crossfire.jxclient.gui.item.GUIItemSpellSkill.setSkill(), and com.realtime.crossfire.jxclient.gui.list.GUISpellSkillList.updateTooltip().
int com.realtime.crossfire.jxclient.spells.SpellsManager.getSpellSkills | ( | ) |
Returns the number of spell skills.
Definition at line 431 of file SpellsManager.java.
Referenced by com.realtime.crossfire.jxclient.items.SpellSkillView.getSize().
Iterator<Spell> com.realtime.crossfire.jxclient.spells.SpellsManager.iterator | ( | ) |
Definition at line 332 of file SpellsManager.java.
|
private |
Rebuilds the list of skills from the spells.
Definition at line 415 of file SpellsManager.java.
References com.realtime.crossfire.jxclient.skills.SkillSet.getSkill().
Referenced by com.realtime.crossfire.jxclient.spells.SpellsManager.addSpell(), com.realtime.crossfire.jxclient.spells.SpellsManager.deleteSpell(), and com.realtime.crossfire.jxclient.spells.SpellsManager.deleteSpellByIndex().
void com.realtime.crossfire.jxclient.spells.SpellsManager.removeCrossfireSpellChangedListener | ( | @NotNull final SpellsManagerListener | listener | ) |
Removes a SpellsManagerListener to notify about changes.
listener | the listener to remove |
Definition at line 201 of file SpellsManager.java.
References com.realtime.crossfire.jxclient.util.EventListenerList2< T extends EventListener >.remove().
Referenced by com.realtime.crossfire.jxclient.gui.item.GUIItemSpellSkill.dispose(), and com.realtime.crossfire.jxclient.gui.item.GUIItemSpell.dispose().
void com.realtime.crossfire.jxclient.spells.SpellsManager.selectCharacter | ( | ) |
An character name was sent to the server.
Definition at line 376 of file SpellsManager.java.
Referenced by com.realtime.crossfire.jxclient.server.crossfire.AbstractCrossfireServerConnection.fireSelectCharacter().
void com.realtime.crossfire.jxclient.spells.SpellsManager.updateSpell | ( | final int | flags, |
final int | tag, | ||
final int | mana, | ||
final int | grace, | ||
final int | damage | ||
) |
Updates spell information.
flags | specifies which fields to update |
tag | the spell's tag |
mana | the spell's new mana cost |
grace | the spell's new grace cost |
damage | the spell's new damage |
Definition at line 260 of file SpellsManager.java.
Referenced by com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.processUpdSpell().
|
private |
Spells currently exposed, based on the filter.
Definition at line 76 of file SpellsManager.java.
|
private |
The GuiStateListener for detecting established or dropped connections.
Definition at line 111 of file SpellsManager.java.
Referenced by com.realtime.crossfire.jxclient.spells.SpellsManager.SpellsManager().
|
private |
The SpellsManagerListeners to notify about changes.
Definition at line 96 of file SpellsManager.java.
|
staticprivate |
Compare 2 skills.
Definition at line 175 of file SpellsManager.java.
|
private |
Dummy skill for "all skills".
Definition at line 165 of file SpellsManager.java.
|
private |
Skill to filter spells by, as a skill id in SkillSet.
-1 means to not filter.
Definition at line 82 of file SpellsManager.java.
Referenced by com.realtime.crossfire.jxclient.spells.SpellsManager.filterSpells().
|
private |
The SkillSet containing skills from the server.
Definition at line 155 of file SpellsManager.java.
Referenced by com.realtime.crossfire.jxclient.spells.SpellsManager.SpellsManager().
|
private |
A Comparator to compare Spell instances by spell path and name.
Definition at line 103 of file SpellsManager.java.
|
private |
All known spells.
Definition at line 70 of file SpellsManager.java.
|
private |
Skills used by the spell, including the "all" skill.
Definition at line 170 of file SpellsManager.java.
|
private |
The Stats for the player.
Definition at line 160 of file SpellsManager.java.
Referenced by com.realtime.crossfire.jxclient.spells.SpellsManager.SpellsManager().
|
private |
All unknown spells that have been referenced before.
Maps spell name to Spell instance. Accesses are synchronized on this instance.
Definition at line 89 of file SpellsManager.java.
Referenced by com.realtime.crossfire.jxclient.spells.SpellsManager.addSpell(), com.realtime.crossfire.jxclient.spells.SpellsManager.deleteSpellByIndex(), and com.realtime.crossfire.jxclient.spells.SpellsManager.getSpell().
|
static |
Flag for updspell command: damage is present.
Definition at line 64 of file SpellsManager.java.
Referenced by com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.processUpdSpell().
|
static |
Flag for updspell command: grace is present.
Definition at line 59 of file SpellsManager.java.
Referenced by com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.processUpdSpell().
|
static |
Flag for updspell command: mana is present.
Definition at line 54 of file SpellsManager.java.
Referenced by com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.processUpdSpell().