69 const std::map<unsigned int, TextCommand*>::const_iterator
72 return it !=
mSpells.end() ? (*it).second :
nullptr;
90 const std::map<unsigned int, TextCommand*>::const_iterator
100 if (spell ==
nullptr)
103 const int id = spell->
getId();
110 const std::map<unsigned int, TextCommand*>::const_iterator
137 if (spell ==
nullptr)
161 if ((target !=
nullptr &&
168 if (target !=
nullptr &&
184 if ((
chatWindow ==
nullptr) || (spell ==
nullptr))
190 const Being *
const target)
202 const Being *
const target)
210 const Being *
const target)
219 if (target !=
nullptr)
232 size_t idx = command.find(
"<TARGET>");
233 if (idx != std::string::npos)
236 command =
replaceAll(command,
"<TARGET>", name);
238 idx = command.find(
"<TARGETID>");
239 if (idx != std::string::npos)
242 command =
replaceAll(command,
"<TARGETID>",
id);
244 idx = command.find(
"<TARGETORSELF>");
245 if (idx != std::string::npos)
248 command =
replaceAll(command,
"<TARGETORSELF>", name2);
251 if (!found && !name.empty())
252 command.append(
" ").append(name);
270 if (cfg->
getValue(
"commandShortcutFlags0",
"").empty())
279 unsigned int targetType;
280 unsigned int basicLvl;
282 unsigned int schoolLvl;
284 unsigned int commandType;
288 std::stringstream ss(flags);
296 std::string cmd = cfg->
getValue(
"commandShortcutCmd"
298 std::string comment = cfg->
getValue(
"commandShortcutComment"
300 std::string symbol = cfg->
getValue(
"commandShortcutSymbol"
302 std::string icon = cfg->
getValue(
"commandShortcutIcon"
322 #define setOrDel(str, method) \
323 const std::string var##method = spell->method(); \
324 if (!var##method.empty()) \
325 serverConfig.setValue((str) + toString(i), var##method); \
327 serverConfig.deleteKey((str) + toString(i))
334 if (spell !=
nullptr)
336 setOrDel(
"commandShortcutCmd", getCommand);
337 setOrDel(
"commandShortcutComment", getComment);
338 setOrDel(
"commandShortcutSymbol", getSymbol);
375 STD_VECTOR<TextCommand*>::const_iterator i =
mSpellsVector.begin();
376 const STD_VECTOR<TextCommand*>::const_iterator
388 const size_t pos = line.find(partName, 0);
391 if (!newName.empty())
394 newCommand =
nullptr;
405 if (!newName.empty() &&
406 (newCommand !=
nullptr) &&
409 return newName.append(
" ");
418 if ((spell1 ==
nullptr) || (spell2 ==
nullptr))
426 const int tmp = spell1->
getId();
432 for (
size_t f = 0; f < sz; f++)
435 if (spellA == spell1)
437 for (
size_t d = 0; d < sz; d++)
440 if (spellB == spell2)
const std::string & getName() const
ActorTypeT getType() const
void localChatInput(const std::string &msg) const
std::string getValue(const std::string &key, const std::string &deflt) const
void deleteKey(const std::string &key)
void setValue(const std::string &key, const std::string &value)
Being * getTarget() const
virtual bool canUseMagic() const =0
std::vector< TextCommand * > mSpellsVector
const std::vector< TextCommand * > & getAll() const A_CONST
TextCommand * createNewSpell() const
static void invokeCommand(const std::string &command, const Being *const target)
const TextCommand * getSpellByItem(const int itemId) const
std::map< unsigned int, TextCommand * > mSpells
void swap(const int id1, const int id2)
static void invokeSpell(const TextCommand *const spell, const Being *const target)
bool addSpell(TextCommand *const spell)
void invoke(const int spellId) const
std::string autoComplete(const std::string &partName) const
TextCommand * getSpell(const int spellId) const
static std::string parseCommand(std::string command, const Being *const target)
void useItem(const int itemId) const
unsigned getBaseLvl() const
unsigned int getMana() const
std::string getCommand() const
unsigned getSchoolLvl() const
MagicSchoolT getSchool() const
std::string getSymbol() const
TextCommandTypeT getCommandType() const
CommandTargetT getTargetType() const
CommandsMap::iterator CommandsMapIter
std::map< int, TextCommand * > CommandsMap
CommandTarget ::T CommandTargetT
Configuration serverConfig
void delete_all(Container &c)
#define FOR_EACH(type, iter, array)
LocalPlayer * localPlayer
MagicSchool ::T MagicSchoolT
std::string toString(T const &value)
converts any type to a string
const std::string & getIcon(const int id)
int32_t getAttribute(const AttributesT id)
int getSkillLevel(const int id)
Net::PlayerHandler * playerHandler
SpellManager * spellManager
#define setOrDel(str, method)
const unsigned int SPELL_SHORTCUT_ITEMS
const unsigned int SPELL_SHORTCUT_TABS
std::string & replaceAll(std::string &context, const std::string &from, const std::string &to)
std::string strprintf(const char *const format,...)
const std::string findSameSubstring(const std::string &str1, const std::string &str2)
TextCommandType ::T TextCommandTypeT