public class SpellsManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
UPD_SP_DAMAGE
Flag for updspell command: damage is present.
|
static int |
UPD_SP_GRACE
Flag for updspell command: grace is present.
|
static int |
UPD_SP_MANA
Flag for updspell command: mana is present.
|
Constructor and Description |
---|
SpellsManager(@NotNull GuiStateManager guiStateManager,
@NotNull SkillSet skillSet,
@NotNull Stats stats)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addCrossfireSpellChangedListener(@NotNull SpellsManagerListener listener)
Adds a
SpellsManagerListener to notify about changes. |
void |
addSpell(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.
|
void |
deleteSpell(int tag)
Deletes a spell.
|
boolean |
displaysFace(int faceNum)
Returns whether any spell has the given face.
|
void |
filterSkill(int index)
Filters spells to display by the specified skill index.
|
@NotNull java.util.Collection<Spell> |
getAllSpells()
Returns all known spells.
|
@Nullable Spell |
getFilteredSpell(int index)
Returns a
Spell instance by index. |
@NotNull java.util.Collection<Spell> |
getFilteredSpells()
Returns all currently shown spells.
|
int |
getFilteredSpellsCount()
Returns the number of currently shown spells.
|
@Nullable Spell |
getSpell(@NotNull java.lang.String spellName)
Returns a
Spell instance by partial spell name. |
@Nullable Skill |
getSpellSkill(int index)
Returns the specified spell skill.
|
int |
getSpellSkills()
Returns the number of spell skills.
|
void |
removeCrossfireSpellChangedListener(@NotNull SpellsManagerListener listener)
Removes a
SpellsManagerListener to notify about changes. |
void |
selectCharacter()
A character name was sent to the server.
|
void |
updateSpell(int flags,
int tag,
int mana,
int grace,
int damage)
Updates spell information.
|
public static final int UPD_SP_MANA
public static final int UPD_SP_GRACE
public static final int UPD_SP_DAMAGE
public SpellsManager(@NotNull @NotNull GuiStateManager guiStateManager, @NotNull @NotNull SkillSet skillSet, @NotNull @NotNull Stats stats)
guiStateManager
- the gui state manager to watchskillSet
- skills the players knowsstats
- the stats for the playerpublic void addCrossfireSpellChangedListener(@NotNull @NotNull SpellsManagerListener listener)
SpellsManagerListener
to notify about changes.listener
- the listener to addpublic void removeCrossfireSpellChangedListener(@NotNull @NotNull SpellsManagerListener listener)
SpellsManagerListener
to notify about changes.listener
- the listener to removepublic 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)
unknownSpells
if
possible.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' descriptionpublic void updateSpell(int flags, int tag, int mana, int grace, int damage)
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 damagepublic void deleteSpell(int tag)
tag
- the spell's tag@Nullable public @Nullable Spell getSpell(@NotNull @NotNull java.lang.String spellName)
Spell
instance by partial spell name.spellName
- the spell name to findnull
if the spell is unknown@NotNull public @NotNull java.util.Collection<Spell> getAllSpells()
@NotNull public @NotNull java.util.Collection<Spell> getFilteredSpells()
public int getFilteredSpellsCount()
@Nullable public @Nullable Spell getFilteredSpell(int index)
Spell
instance by index. Considers only currently shown
spells.index
- the indexnull
if the index is invalidpublic boolean displaysFace(int faceNum)
faceNum
- the facepublic void selectCharacter()
public void filterSkill(int index)
index
- the skill index, should be less than getSpellSkills()public int getSpellSkills()
@Nullable public @Nullable Skill getSpellSkill(int index)
index
- the skill index, from 0 to getSpellSkills()-1null
if index is invalid