Class SpellsManager
java.lang.Object
com.realtime.crossfire.jxclient.spells.SpellsManager
Manages all known spells. Spells are filtered by skill through the function
filterSkill().
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intFlag for updspell command: damage is present.static final intFlag for updspell command: grace is present.static final intFlag for updspell command: mana is present. -
Constructor Summary
ConstructorsConstructorDescriptionSpellsManager(@NotNull GuiStateManager guiStateManager, @NotNull SkillSet skillSet, @NotNull Stats stats) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCrossfireSpellChangedListener(@NotNull SpellsManagerListener listener) Adds aSpellsManagerListenerto notify about changes.voidaddSpell(int tag, int level, int castingTime, int mana, int grace, int damage, int skill, int path, int faceNum, @NotNull String spellName, @NotNull String message) Adds a new spell.voiddeleteSpell(int tag) Deletes a spell.booleandisplaysFace(int faceNum) Returns whether any spell has the given face.voidfilterSkill(int index) Filters spells to display by the specified skill index.@NotNull Collection<Spell>Returns all known spells.@Nullable SpellgetFilteredSpell(int index) Returns aSpellinstance by index.@NotNull Collection<Spell>Returns all currently shown spells.intReturns the number of currently shown spells.@Nullable SpellReturns aSpellinstance by partial spell name.@Nullable SkillgetSpellSkill(int index) Returns the specified spell skill.intReturns the number of spell skills.voidremoveCrossfireSpellChangedListener(@NotNull SpellsManagerListener listener) Removes aSpellsManagerListenerto notify about changes.voidA character name was sent to the server.voidupdateSpell(int flags, int tag, int mana, int grace, int damage) Updates spell information.
-
Field Details
-
UPD_SP_MANA
public static final int UPD_SP_MANAFlag for updspell command: mana is present.- See Also:
-
UPD_SP_GRACE
public static final int UPD_SP_GRACEFlag for updspell command: grace is present.- See Also:
-
UPD_SP_DAMAGE
public static final int UPD_SP_DAMAGEFlag for updspell command: damage is present.- See Also:
-
-
Constructor Details
-
SpellsManager
public SpellsManager(@NotNull @NotNull GuiStateManager guiStateManager, @NotNull @NotNull SkillSet skillSet, @NotNull @NotNull Stats stats) Creates a new instance.- Parameters:
guiStateManager- the gui state manager to watchskillSet- skills the players knowsstats- the stats for the player
-
-
Method Details
-
addCrossfireSpellChangedListener
Adds aSpellsManagerListenerto notify about changes.- Parameters:
listener- the listener to add
-
removeCrossfireSpellChangedListener
Removes aSpellsManagerListenerto notify about changes.- Parameters:
listener- the listener to remove
-
addSpell
public void addSpell(int tag, int level, int castingTime, int mana, int grace, int damage, int skill, int path, int faceNum, @NotNull @NotNull String spellName, @NotNull @NotNull String message) Adds a new spell. Re-uses entries fromunknownSpellsif possible.- Parameters:
tag- the spell's taglevel- the spell's levelcastingTime- the spell's casting timemana- the spell's mana costgrace- the spell's grace costdamage- the spell's damageskill- the spell's skillpath- the spell's pathfaceNum- the spell's face numberspellName- the spell's namemessage- the spells' description
-
updateSpell
public void updateSpell(int flags, int tag, int mana, int grace, int damage) Updates spell information.- Parameters:
flags- specifies which fields to updatetag- the spell's tagmana- the spell's new mana costgrace- the spell's new grace costdamage- the spell's new damage
-
deleteSpell
public void deleteSpell(int tag) Deletes a spell.- Parameters:
tag- the spell's tag
-
getSpell
Returns aSpellinstance by partial spell name.- Parameters:
spellName- the spell name to find- Returns:
- the spell instance or
nullif the spell is unknown
-
getAllSpells
Returns all known spells.- Returns:
- the known spells
-
getFilteredSpells
Returns all currently shown spells.- Returns:
- all currently shown spells
-
getFilteredSpellsCount
public int getFilteredSpellsCount()Returns the number of currently shown spells.- Returns:
- the number of currently shown spells
-
getFilteredSpell
Returns aSpellinstance by index. Considers only currently shown spells.- Parameters:
index- the index- Returns:
- the spell or
nullif the index is invalid
-
displaysFace
public boolean displaysFace(int faceNum) Returns whether any spell has the given face.- Parameters:
faceNum- the face- Returns:
- whether the face was found
-
selectCharacter
public void selectCharacter()A character name was sent to the server. -
filterSkill
public void filterSkill(int index) Filters spells to display by the specified skill index.- Parameters:
index- the skill index, should be less than getSpellSkills()
-
getSpellSkills
public int getSpellSkills()Returns the number of spell skills.- Returns:
- the number of skills
-
getSpellSkill
Returns the specified spell skill.- Parameters:
index- the skill index, from 0 to getSpellSkills()-1- Returns:
- the specified skill,
nullif index is invalid
-