Class SpellsManager
- java.lang.Object
-
- com.realtime.crossfire.jxclient.spells.SpellsManager
-
-
Field Summary
Fields Modifier and Type Field Description static intUPD_SP_DAMAGEFlag for updspell command: damage is present.static intUPD_SP_GRACEFlag for updspell command: grace is present.static intUPD_SP_MANAFlag for updspell command: mana is present.
-
Constructor Summary
Constructors Constructor Description SpellsManager(@NotNull GuiStateManager guiStateManager, @NotNull SkillSet skillSet, @NotNull Stats stats)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCrossfireSpellChangedListener(@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 java.lang.String spellName, @NotNull java.lang.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.@Nullable SpellgetSpell(int index)Returns aSpellinstance by index.@NotNull SpellgetSpell(@NotNull java.lang.String spellName)Returns aSpellinstance by spell name.intgetSpells()Returns the number of known spells.@Nullable SkillgetSpellSkill(int index)Returns the specified spell skill.intgetSpellSkills()Returns the number of spell skills.@NotNull java.util.Iterator<Spell>iterator()voidremoveCrossfireSpellChangedListener(@NotNull SpellsManagerListener listener)Removes aSpellsManagerListenerto notify about changes.voidselectCharacter()An character name was sent to the server.voidupdateSpell(int flags, int tag, int mana, int grace, int damage)Updates spell information.
-
-
-
Field Detail
-
UPD_SP_MANA
public static final int UPD_SP_MANA
Flag for updspell command: mana is present.- See Also:
- Constant Field Values
-
UPD_SP_GRACE
public static final int UPD_SP_GRACE
Flag for updspell command: grace is present.- See Also:
- Constant Field Values
-
UPD_SP_DAMAGE
public static final int UPD_SP_DAMAGE
Flag for updspell command: damage is present.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
addCrossfireSpellChangedListener
public void addCrossfireSpellChangedListener(@NotNull @NotNull SpellsManagerListener listener)Adds aSpellsManagerListenerto notify about changes.- Parameters:
listener- the listener to add
-
removeCrossfireSpellChangedListener
public void removeCrossfireSpellChangedListener(@NotNull @NotNull SpellsManagerListener listener)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 java.lang.String spellName, @NotNull @NotNull java.lang.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
@NotNull public @NotNull Spell getSpell(@NotNull @NotNull java.lang.String spellName)
Returns aSpellinstance by spell name. Creates a new instance if the spell is unknown.- Parameters:
spellName- the spell name to find- Returns:
- the spell instance
-
iterator
@NotNull public @NotNull java.util.Iterator<Spell> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<Spell>
-
getSpells
public int getSpells()
Returns the number of known spells.- Returns:
- the number of spells
-
getSpell
@Nullable public @Nullable Spell getSpell(int index)
Returns aSpellinstance by index.- 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()
An 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
@Nullable public @Nullable Skill getSpellSkill(int index)
Returns the specified spell skill.- Parameters:
index- the skill index, from 0 to getSpellSkills()-1- Returns:
- the specified skill,
nullif index is invalid
-
-