From 995bc5ba7d1b5e38cf294d6fa27db7ee89886a28 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 17 Nov 2015 20:16:14 +0300 Subject: Use magic command properties only if compiled for tmwa. --- src/spellmanager.cpp | 52 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 15 deletions(-) (limited to 'src/spellmanager.cpp') 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(MagicSchool::SkillMagic)) - >= static_cast(spell->getBaseLvl()) - && PlayerInfo::getSkillLevel(static_cast( +#ifdef TMWA_SUPPORT + if (spell->getCommandType() == TextCommandType::Text || + (playerHandler->canUseMagic() && + PlayerInfo::getSkillLevel(static_cast(MagicSchool::SkillMagic)) + >= static_cast(spell->getBaseLvl()) && + PlayerInfo::getSkillLevel(static_cast( spell->getSchool())) >= static_cast(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(commandType) == TextCommandType::Magic) { @@ -292,6 +302,7 @@ void SpellManager::load(const bool oldConfig) static_cast(school), schoolLvl, mana)); } else +#endif { addSpell(new TextCommand(i, symbol, cmd, comment, static_cast(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( - spell->getCommandType()), static_cast( - spell->getTargetType()), spell->getBaseLvl(), + strprintf("%u %u %u %u %u %u", + static_cast(spell->getCommandType()), + static_cast(spell->getTargetType()), + spell->getBaseLvl(), static_cast(spell->getSchool()), - spell->getSchoolLvl(), static_cast( - spell->getMana()))); + spell->getSchoolLvl(), + static_cast(spell->getMana()))); +#else + serverConfig.setValue("commandShortcutFlags" + toString(i), + strprintf("%u %u %u %u %u %u", 1U, + static_cast(spell->getTargetType()), + 0U, + 0U, + 0U, + 0U)); +#endif } else { -- cgit v1.2.3-70-g09d2