diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-11-17 20:16:14 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-11-17 20:16:14 +0300 |
commit | 995bc5ba7d1b5e38cf294d6fa27db7ee89886a28 (patch) | |
tree | e4d553b28cc68de9a629d0174503146624c63f27 /src/spellmanager.cpp | |
parent | 21fa38275fc8ec00d32dd1b2f7fe211a7925a596 (diff) | |
download | ManaVerse-995bc5ba7d1b5e38cf294d6fa27db7ee89886a28.tar.gz ManaVerse-995bc5ba7d1b5e38cf294d6fa27db7ee89886a28.tar.bz2 ManaVerse-995bc5ba7d1b5e38cf294d6fa27db7ee89886a28.tar.xz ManaVerse-995bc5ba7d1b5e38cf294d6fa27db7ee89886a28.zip |
Use magic command properties only if compiled for tmwa.
Diffstat (limited to 'src/spellmanager.cpp')
-rw-r--r-- | src/spellmanager.cpp | 52 |
1 files changed, 37 insertions, 15 deletions
diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp index 316ca5530..50530e059 100644 --- a/src/spellmanager.cpp +++ b/src/spellmanager.cpp @@ -134,23 +134,32 @@ void SpellManager::invoke(const int spellId) const if (!playerHandler || spell->getCommand().empty()) return; - if (spell->getCommandType() == TextCommandType::Text - || (playerHandler->canUseMagic() - && PlayerInfo::getSkillLevel(static_cast<int>(MagicSchool::SkillMagic)) - >= static_cast<signed>(spell->getBaseLvl()) - && PlayerInfo::getSkillLevel(static_cast<int>( +#ifdef TMWA_SUPPORT + if (spell->getCommandType() == TextCommandType::Text || + (playerHandler->canUseMagic() && + PlayerInfo::getSkillLevel(static_cast<int>(MagicSchool::SkillMagic)) + >= static_cast<signed>(spell->getBaseLvl()) && + PlayerInfo::getSkillLevel(static_cast<int>( spell->getSchool())) >= static_cast<signed>(spell->getSchoolLvl()) - && PlayerInfo::getAttribute(Attributes::MP) >= spell->getMana())) + && PlayerInfo::getAttribute(Attributes::MP) >= spell->getMana()) + ) +#endif { const Being *const target = localPlayer->getTarget(); if (spell->getTargetType() == CommandTarget::NoTarget) { invokeSpell(spell); } - if ((target && (target->getType() != ActorType::Monster - || spell->getCommandType() == TextCommandType::Text)) - && (spell->getTargetType() == CommandTarget::AllowTarget - || spell->getTargetType() == CommandTarget::NeedTarget)) +#ifdef TMWA_SUPPORT + if ((target && (target->getType() != ActorType::Monster || + spell->getCommandType() == TextCommandType::Text)) && + (spell->getTargetType() == CommandTarget::AllowTarget || + spell->getTargetType() == CommandTarget::NeedTarget)) +#else + if (target && + (spell->getTargetType() == CommandTarget::AllowTarget || + spell->getTargetType() == CommandTarget::NeedTarget)) +#endif { invokeSpell(spell, target); } @@ -284,6 +293,7 @@ void SpellManager::load(const bool oldConfig) std::string icon = cfg->getValue("commandShortcutIcon" + toString(i), ""); +#ifdef TMWA_SUPPORT if (static_cast<TextCommandTypeT>(commandType) == TextCommandType::Magic) { @@ -292,6 +302,7 @@ void SpellManager::load(const bool oldConfig) static_cast<MagicSchoolT>(school), schoolLvl, mana)); } else +#endif { addSpell(new TextCommand(i, symbol, cmd, comment, static_cast<CommandTargetT>(targetType), icon)); @@ -319,13 +330,24 @@ void SpellManager::save() const setOrDel("commandShortcutIcon", getIcon); if (spell->getCommand() != "" && spell->getSymbol() != "") { +#ifdef TMWA_SUPPORT serverConfig.setValue("commandShortcutFlags" + toString(i), - strprintf("%u %u %u %u %u %u", static_cast<unsigned>( - spell->getCommandType()), static_cast<unsigned>( - spell->getTargetType()), spell->getBaseLvl(), + strprintf("%u %u %u %u %u %u", + static_cast<unsigned>(spell->getCommandType()), + static_cast<unsigned>(spell->getTargetType()), + spell->getBaseLvl(), static_cast<unsigned>(spell->getSchool()), - spell->getSchoolLvl(), static_cast<unsigned>( - spell->getMana()))); + spell->getSchoolLvl(), + static_cast<unsigned>(spell->getMana()))); +#else + serverConfig.setValue("commandShortcutFlags" + toString(i), + strprintf("%u %u %u %u %u %u", 1U, + static_cast<unsigned>(spell->getTargetType()), + 0U, + 0U, + 0U, + 0U)); +#endif } else { |