ManaPlus
|
#include <spellmanager.h>
Public Member Functions | |
SpellManager () | |
~SpellManager () | |
TextCommand * | getSpell (const int spellId) const |
const TextCommand * | getSpellByItem (const int itemId) const |
bool | addSpell (TextCommand *const spell) |
TextCommand * | createNewSpell () const |
const std::vector< TextCommand * > & | getAll () const A_CONST |
void | useItem (const int itemId) const |
void | invoke (const int spellId) const |
void | load () |
void | save () const |
std::string | autoComplete (const std::string &partName) const |
void | swap (const int id1, const int id2) |
Static Public Member Functions | |
static void | invokeCommand (const std::string &command, const Being *const target) |
Private Member Functions | |
void | fillSpells () |
Static Private Member Functions | |
static void | invokeSpell (const TextCommand *const spell, const Being *const target) |
static void | invokeSpell (const TextCommand *const spell) |
static std::string | parseCommand (std::string command, const Being *const target) |
Private Attributes | |
std::map< unsigned int, TextCommand * > | mSpells |
std::vector< TextCommand * > | mSpellsVector |
Definition at line 36 of file spellmanager.h.
SpellManager::SpellManager | ( | ) |
SpellManager::~SpellManager | ( | ) |
Definition at line 57 of file spellmanager.cpp.
References delete_all(), mSpells, and mSpellsVector.
bool SpellManager::addSpell | ( | TextCommand *const | spell | ) |
Definition at line 98 of file spellmanager.cpp.
References CAST_S32, TextCommand::getId(), mSpells, mSpellsVector, SPELL_SHORTCUT_ITEMS, and SPELL_SHORTCUT_TABS.
Referenced by fillSpells(), and load().
std::string SpellManager::autoComplete | ( | const std::string & | partName | ) | const |
Definition at line 373 of file spellmanager.cpp.
References findSameSubstring(), TextCommand::getCommand(), TextCommand::getTargetType(), mSpellsVector, and CommandTarget::NeedTarget.
Referenced by ChatWindow::autoComplete().
TextCommand * SpellManager::createNewSpell | ( | ) | const |
|
private |
Definition at line 80 of file spellmanager.cpp.
References addSpell(), FOR_EACH, CommandsDB::getAll(), CommandsDB::load(), mSpells, SPELL_SHORTCUT_ITEMS, SPELL_SHORTCUT_TABS, and CommandsDB::unload().
Referenced by load().
const std::vector< TextCommand * > & SpellManager::getAll | ( | ) | const |
Definition at line 121 of file spellmanager.cpp.
References mSpellsVector.
Referenced by SpellShortcut::load().
TextCommand * SpellManager::getSpell | ( | const int | spellId | ) | const |
Definition at line 64 of file spellmanager.cpp.
References CAST_SIZE, and mSpells.
Referenced by SpellShortcutContainer::draw(), getSpellByItem(), invoke(), SpellShortcutContainer::mouseDragged(), SpellShortcutContainer::mouseMoved(), SpellShortcutContainer::mouseReleased(), and SpellShortcutContainer::safeDraw().
const TextCommand * SpellManager::getSpellByItem | ( | const int | itemId | ) | const |
Definition at line 75 of file spellmanager.cpp.
References getSpell(), and SPELL_MIN_ID.
Referenced by ItemShortcutContainer::draw(), ItemShortcutContainer::mouseDragged(), ItemShortcutContainer::mouseMoved(), and ItemShortcutContainer::safeDraw().
void SpellManager::invoke | ( | const int | spellId | ) | const |
Definition at line 131 of file spellmanager.cpp.
References CommandTarget::AllowTarget, Net::PlayerHandler::canUseMagic(), CAST_S32, PlayerInfo::getAttribute(), TextCommand::getBaseLvl(), TextCommand::getCommand(), TextCommand::getCommandType(), TextCommand::getMana(), TextCommand::getSchool(), TextCommand::getSchoolLvl(), PlayerInfo::getSkillLevel(), getSpell(), LocalPlayer::getTarget(), TextCommand::getTargetType(), Being::getType(), invokeSpell(), localPlayer, ActorType::Monster, CommandTarget::NeedTarget, CommandTarget::NoTarget, Attributes::PLAYER_MP, playerHandler, MagicSchool::SkillMagic, and TextCommandType::Text.
Referenced by SpellShortcutContainer::mousePressed(), and useItem().
|
static |
Definition at line 201 of file spellmanager.cpp.
References chatWindow, ChatWindow::localChatInput(), and parseCommand().
Referenced by SkillDialog::useSkill().
|
staticprivate |
Definition at line 182 of file spellmanager.cpp.
References chatWindow, TextCommand::getCommand(), ChatWindow::localChatInput(), and parseCommand().
|
staticprivate |
Definition at line 189 of file spellmanager.cpp.
References chatWindow, TextCommand::getCommand(), ChatWindow::localChatInput(), and parseCommand().
Referenced by invoke().
void SpellManager::load | ( | ) |
Definition at line 262 of file spellmanager.cpp.
References addSpell(), delete_all(), fillSpells(), ConfigurationObject::getValue(), TextCommandType::Magic, mSpells, mSpellsVector, save(), serverConfig, SPELL_SHORTCUT_ITEMS, SPELL_SHORTCUT_TABS, and Catch::toString().
Referenced by SpellManager().
|
staticprivate |
Definition at line 209 of file spellmanager.cpp.
References ActorSprite::getId(), Being::getName(), localPlayer, replaceAll(), toInt, and Catch::toString().
Referenced by invokeCommand(), and invokeSpell().
void SpellManager::save | ( | ) | const |
Definition at line 329 of file spellmanager.cpp.
References CAST_U32, ConfigurationObject::deleteKey(), TextCommand::getBaseLvl(), TextCommand::getCommand(), TextCommand::getCommandType(), LanguageDb::getIcon(), TextCommand::getMana(), TextCommand::getSchool(), TextCommand::getSchoolLvl(), TextCommand::getSymbol(), TextCommand::getTargetType(), mSpellsVector, serverConfig, setOrDel, Configuration::setValue(), SPELL_SHORTCUT_ITEMS, SPELL_SHORTCUT_TABS, strprintf(), and Catch::toString().
Referenced by TextCommandEditor::deleteCommand(), load(), SpellShortcutContainer::mouseReleased(), and TextCommandEditor::save().
void SpellManager::swap | ( | const int | id1, |
const int | id2 | ||
) |
Definition at line 414 of file spellmanager.cpp.
References TextCommand::getId(), mSpells, mSpellsVector, TextCommand::setId(), SPELL_SHORTCUT_ITEMS, and SPELL_SHORTCUT_TABS.
Referenced by SpellShortcutContainer::mouseReleased().
void SpellManager::useItem | ( | const int | itemId | ) | const |
Definition at line 126 of file spellmanager.cpp.
References invoke(), and SPELL_MIN_ID.
Referenced by ItemShortcut::useItem().
|
private |
Definition at line 84 of file spellmanager.h.
Referenced by addSpell(), fillSpells(), getSpell(), load(), swap(), and ~SpellManager().
|
private |
Definition at line 85 of file spellmanager.h.
Referenced by addSpell(), autoComplete(), createNewSpell(), getAll(), load(), save(), swap(), and ~SpellManager().