Crossfire JXClient, Trunk
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
com.realtime.crossfire.jxclient.spells.SpellsManager Class Reference
Collaboration diagram for com.realtime.crossfire.jxclient.spells.SpellsManager:
Collaboration graph

Public Member Functions

void addCrossfireSpellChangedListener (@NotNull final SpellsManagerListener listener)
 
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)
 
void deleteSpell (final int tag)
 
boolean displaysFace (final int faceNum)
 
void filterSkill (final int index)
 
Collection< SpellgetAllSpells ()
 
Spell getFilteredSpell (final int index)
 
Collection< SpellgetFilteredSpells ()
 
int getFilteredSpellsCount ()
 
Spell getSpell (@NotNull final String spellName)
 
Skill getSpellSkill (final int index)
 
int getSpellSkills ()
 
void removeCrossfireSpellChangedListener (@NotNull final SpellsManagerListener listener)
 
void selectCharacter ()
 
 SpellsManager (@NotNull final GuiStateManager guiStateManager, @NotNull final SkillSet skillSet, @NotNull final Stats stats)
 
void updateSpell (final int flags, final int tag, final int mana, final int grace, final int damage)
 

Static Public Attributes

static final int UPD_SP_DAMAGE = 4
 
static final int UPD_SP_GRACE = 2
 
static final int UPD_SP_MANA = 1
 

Private Member Functions

void deleteSpellByIndex (final int index)
 
void filterSpells ()
 
void rebuildSkills ()
 

Private Attributes

final List< SpellfilteredSpells = new CopyOnWriteArrayList<>()
 
final GuiStateListener guiStateListener
 
final EventListenerList2< SpellsManagerListenerlisteners = new EventListenerList2<>()
 
final Skill skillAll = new Skill("All spell skills")
 
int skillFilter = -1
 
final SkillSet skillSet
 
final Comparator< SpellspellNameComparator = new SpellComparator()
 
final List< Spellspells = new CopyOnWriteArrayList<>()
 
final List< SkillspellSkills = new ArrayList<>()
 
final Stats stats
 
final Map< String, SpellunknownSpells = new HashMap<>()
 

Detailed Description

Manages all known spells. Spells are filtered by skill through the function filterSkill().

Author
Lauwenmark
Andreas Kirschbaum

Definition at line 50 of file SpellsManager.java.

Constructor & Destructor Documentation

◆ SpellsManager()

com.realtime.crossfire.jxclient.spells.SpellsManager.SpellsManager ( @NotNull final GuiStateManager  guiStateManager,
@NotNull final SkillSet  skillSet,
@NotNull final Stats  stats 
)

Creates a new instance.

Parameters
guiStateManagerthe gui state manager to watch
skillSetskills the players knows
statsthe stats for the player

Definition at line 179 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.

Member Function Documentation

◆ addCrossfireSpellChangedListener()

void com.realtime.crossfire.jxclient.spells.SpellsManager.addCrossfireSpellChangedListener ( @NotNull final SpellsManagerListener  listener)

Adds a SpellsManagerListener to notify about changes.

Parameters
listenerthe listener to add

Definition at line 189 of file SpellsManager.java.

References com.realtime.crossfire.jxclient.spells.SpellsManager.listeners.

Referenced by com.realtime.crossfire.jxclient.items.SpellSkillView.SpellSkillView(), and com.realtime.crossfire.jxclient.items.SpellsView.SpellsView().

Here is the caller graph for this function:

◆ addSpell()

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.

Parameters
tagthe spell's tag
levelthe spell's level
castingTimethe spell's casting time
manathe spell's mana cost
gracethe spell's grace cost
damagethe spell's damage
skillthe spell's skill
paththe spell's path
faceNumthe spell's face number
spellNamethe spell's name
messagethe spells' description

Definition at line 216 of file SpellsManager.java.

References com.realtime.crossfire.jxclient.spells.SpellsManager.filterSpells(), com.realtime.crossfire.jxclient.spells.SpellsManager.listeners, com.realtime.crossfire.jxclient.spells.SpellsManager.rebuildSkills(), com.realtime.crossfire.jxclient.spells.Spell.setParameters(), com.realtime.crossfire.jxclient.spells.SpellsManager.skillSet, com.realtime.crossfire.jxclient.spells.SpellsManager.spellNameComparator, com.realtime.crossfire.jxclient.spells.SpellsManager.spells, com.realtime.crossfire.jxclient.spells.SpellsManager.stats, and com.realtime.crossfire.jxclient.spells.SpellsManager.unknownSpells.

Referenced by com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.processAddSpell().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deleteSpell()

void com.realtime.crossfire.jxclient.spells.SpellsManager.deleteSpell ( final int  tag)

◆ deleteSpellByIndex()

void com.realtime.crossfire.jxclient.spells.SpellsManager.deleteSpellByIndex ( final int  index)
private

◆ displaysFace()

boolean com.realtime.crossfire.jxclient.spells.SpellsManager.displaysFace ( final int  faceNum)

Returns whether any spell has the given face.

Parameters
faceNumthe face
Returns
whether the face was found

Definition at line 375 of file SpellsManager.java.

References com.realtime.crossfire.jxclient.spells.SpellsManager.spells.

Referenced by com.realtime.crossfire.jxclient.items.SpellSkillView.SpellSkillView(), and com.realtime.crossfire.jxclient.items.SpellsView.SpellsView().

Here is the caller graph for this function:

◆ filterSkill()

void com.realtime.crossfire.jxclient.spells.SpellsManager.filterSkill ( final int  index)

◆ filterSpells()

void com.realtime.crossfire.jxclient.spells.SpellsManager.filterSpells ( )
private

◆ getAllSpells()

Collection<Spell> com.realtime.crossfire.jxclient.spells.SpellsManager.getAllSpells ( )

Returns all known spells.

Returns
the known spells

Definition at line 334 of file SpellsManager.java.

References com.realtime.crossfire.jxclient.spells.SpellsManager.filteredSpells.

Referenced by com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess.cmdRequest().

Here is the caller graph for this function:

◆ getFilteredSpell()

Spell com.realtime.crossfire.jxclient.spells.SpellsManager.getFilteredSpell ( final int  index)

Returns a Spell instance by index. Considers only currently shown spells.

Parameters
indexthe index
Returns
the spell or
null
if the index is invalid

Definition at line 362 of file SpellsManager.java.

References com.realtime.crossfire.jxclient.spells.SpellsManager.filteredSpells.

Referenced by com.realtime.crossfire.jxclient.items.SpellsView.getItem(), com.realtime.crossfire.jxclient.gui.list.GUISpellList.getTooltip(), and com.realtime.crossfire.jxclient.gui.item.GUIItemSpell.setSpell().

Here is the caller graph for this function:

◆ getFilteredSpells()

Collection<Spell> com.realtime.crossfire.jxclient.spells.SpellsManager.getFilteredSpells ( )

Returns all currently shown spells.

Returns
all currently shown spells

Definition at line 343 of file SpellsManager.java.

References com.realtime.crossfire.jxclient.spells.SpellsManager.filteredSpells.

◆ getFilteredSpellsCount()

int com.realtime.crossfire.jxclient.spells.SpellsManager.getFilteredSpellsCount ( )

◆ getSpell()

Spell com.realtime.crossfire.jxclient.spells.SpellsManager.getSpell ( @NotNull final String  spellName)

Returns a Spell instance by partial spell name.

Parameters
spellNamethe spell name to find
Returns
the spell instance or
null
if the spell is unknown

Definition at line 307 of file SpellsManager.java.

References com.realtime.crossfire.jxclient.spells.SpellsManager.spells.

Referenced by com.realtime.crossfire.jxclient.shortcuts.Shortcuts.setShortcutString().

Here is the caller graph for this function:

◆ getSpellSkill()

Skill com.realtime.crossfire.jxclient.spells.SpellsManager.getSpellSkill ( final int  index)

Returns the specified spell skill.

Parameters
indexthe skill index, from 0 to getSpellSkills()-1
Returns
the specified skill,
null
if index is invalid

Definition at line 453 of file SpellsManager.java.

References com.realtime.crossfire.jxclient.spells.SpellsManager.spellSkills.

Referenced by com.realtime.crossfire.jxclient.items.SpellSkillView.getItem(), com.realtime.crossfire.jxclient.gui.list.GUISpellSkillList.getTooltip(), and com.realtime.crossfire.jxclient.gui.item.GUIItemSpellSkill.setSkill().

Here is the caller graph for this function:

◆ getSpellSkills()

int com.realtime.crossfire.jxclient.spells.SpellsManager.getSpellSkills ( )

Returns the number of spell skills.

Returns
the number of skills

Definition at line 443 of file SpellsManager.java.

References com.realtime.crossfire.jxclient.spells.SpellsManager.spellSkills.

Referenced by com.realtime.crossfire.jxclient.items.SpellSkillView.getSize(), and com.realtime.crossfire.jxclient.items.SpellSkillView.SpellSkillView().

Here is the caller graph for this function:

◆ rebuildSkills()

void com.realtime.crossfire.jxclient.spells.SpellsManager.rebuildSkills ( )
private

◆ removeCrossfireSpellChangedListener()

void com.realtime.crossfire.jxclient.spells.SpellsManager.removeCrossfireSpellChangedListener ( @NotNull final SpellsManagerListener  listener)

Removes a SpellsManagerListener to notify about changes.

Parameters
listenerthe listener to remove

Definition at line 197 of file SpellsManager.java.

References com.realtime.crossfire.jxclient.spells.SpellsManager.listeners.

Referenced by com.realtime.crossfire.jxclient.gui.item.GUIItemSpellSkill.dispose(), and com.realtime.crossfire.jxclient.gui.item.GUIItemSpell.dispose().

Here is the caller graph for this function:

◆ selectCharacter()

void com.realtime.crossfire.jxclient.spells.SpellsManager.selectCharacter ( )

◆ updateSpell()

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.

Parameters
flagsspecifies which fields to update
tagthe spell's tag
manathe spell's new mana cost
gracethe spell's new grace cost
damagethe spell's new damage

Definition at line 256 of file SpellsManager.java.

References com.realtime.crossfire.jxclient.spells.SpellsManager.spells, com.realtime.crossfire.jxclient.spells.SpellsManager.UPD_SP_DAMAGE, com.realtime.crossfire.jxclient.spells.SpellsManager.UPD_SP_GRACE, and com.realtime.crossfire.jxclient.spells.SpellsManager.UPD_SP_MANA.

Referenced by com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.processUpdSpell().

Here is the caller graph for this function:

Member Data Documentation

◆ filteredSpells

final List<Spell> com.realtime.crossfire.jxclient.spells.SpellsManager.filteredSpells = new CopyOnWriteArrayList<>()
private

◆ guiStateListener

final GuiStateListener com.realtime.crossfire.jxclient.spells.SpellsManager.guiStateListener
private

The GuiStateListener for detecting established or dropped connections.

Definition at line 112 of file SpellsManager.java.

Referenced by com.realtime.crossfire.jxclient.spells.SpellsManager.SpellsManager().

◆ listeners

final EventListenerList2<SpellsManagerListener> com.realtime.crossfire.jxclient.spells.SpellsManager.listeners = new EventListenerList2<>()
private

◆ skillAll

final Skill com.realtime.crossfire.jxclient.spells.SpellsManager.skillAll = new Skill("All spell skills")
private

Dummy skill for "all skills".

Definition at line 166 of file SpellsManager.java.

Referenced by com.realtime.crossfire.jxclient.spells.SpellsManager.rebuildSkills().

◆ skillFilter

int com.realtime.crossfire.jxclient.spells.SpellsManager.skillFilter = -1
private

Skill to filter spells by, as a skill id in SkillSet. -1 means to not filter.

Definition at line 83 of file SpellsManager.java.

Referenced by com.realtime.crossfire.jxclient.spells.SpellsManager.filterSkill(), and com.realtime.crossfire.jxclient.spells.SpellsManager.filterSpells().

◆ skillSet

final SkillSet com.realtime.crossfire.jxclient.spells.SpellsManager.skillSet
private

◆ spellNameComparator

final Comparator<Spell> com.realtime.crossfire.jxclient.spells.SpellsManager.spellNameComparator = new SpellComparator()
private

A Comparator to compare Spell instances by spell path and name.

Definition at line 104 of file SpellsManager.java.

Referenced by com.realtime.crossfire.jxclient.spells.SpellsManager.addSpell().

◆ spells

final List<Spell> com.realtime.crossfire.jxclient.spells.SpellsManager.spells = new CopyOnWriteArrayList<>()
private

◆ spellSkills

final List<Skill> com.realtime.crossfire.jxclient.spells.SpellsManager.spellSkills = new ArrayList<>()
private

◆ stats

final Stats com.realtime.crossfire.jxclient.spells.SpellsManager.stats
private

◆ unknownSpells

final Map<String, Spell> com.realtime.crossfire.jxclient.spells.SpellsManager.unknownSpells = new HashMap<>()
private

All unknown spells that have been referenced before. Maps spell name to Spell instance. Accesses are synchronized on this instance.

Definition at line 90 of file SpellsManager.java.

Referenced by com.realtime.crossfire.jxclient.spells.SpellsManager.addSpell(), and com.realtime.crossfire.jxclient.spells.SpellsManager.deleteSpellByIndex().

◆ UPD_SP_DAMAGE

final int com.realtime.crossfire.jxclient.spells.SpellsManager.UPD_SP_DAMAGE = 4
static

◆ UPD_SP_GRACE

final int com.realtime.crossfire.jxclient.spells.SpellsManager.UPD_SP_GRACE = 2
static

◆ UPD_SP_MANA

final int com.realtime.crossfire.jxclient.spells.SpellsManager.UPD_SP_MANA = 1
static

The documentation for this class was generated from the following file: