From da8b129857a6abaa42b43f9233e0bbf9d912e376 Mon Sep 17 00:00:00 2001 From: Aokromes Date: Mon, 23 Jul 2018 14:13:26 +0200 Subject: [PATCH] Core/Handlers: Spell handler no longer downranks otherwise-negative spells because they have a potentially-positive aura effect. --- src/server/game/Handlers/SpellHandler.cpp | 16 +++++++++------- src/server/game/Scripting/ScriptReloadMgr.cpp | 2 +- src/server/game/Server/WorldSession.cpp | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index a97e5a58f6..52953d55a9 100644 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -439,14 +439,16 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) } // auto-selection buff level base at target level (in spellInfo) - if (targets.GetUnitTarget()) - { - SpellInfo const* actualSpellInfo = spellInfo->GetAuraRankForLevel(targets.GetUnitTarget()->getLevel()); + // TODO: is this even necessary? client already seems to send correct rank for "standard" buffs + if (spellInfo->IsPositive()) + if (Unit* target = targets.GetUnitTarget()) + { + SpellInfo const* actualSpellInfo = spellInfo->GetAuraRankForLevel(target->getLevel()); - // if rank not found then function return nullptr but in explicit cast case original spell can be cast and later failed with appropriate error message - if (actualSpellInfo) - spellInfo = actualSpellInfo; - } + // if rank not found then function return NULL but in explicit cast case original spell can be cast and later failed with appropriate error message + if (actualSpellInfo) + spellInfo = actualSpellInfo; + } Spell* spell = new Spell(caster, spellInfo, TRIGGERED_NONE, ObjectGuid::Empty, false); spell->m_cast_count = castCount; // set count of casts diff --git a/src/server/game/Scripting/ScriptReloadMgr.cpp b/src/server/game/Scripting/ScriptReloadMgr.cpp index 3e38adcfc4..7fcbcc7566 100644 --- a/src/server/game/Scripting/ScriptReloadMgr.cpp +++ b/src/server/game/Scripting/ScriptReloadMgr.cpp @@ -1034,7 +1034,7 @@ private: // Wait for the current build job to finish, if the job finishes in time // evaluate it and continue with the next one. if (_build_job->GetProcess()->GetFutureResult(). - wait_for(0s) == std::future_status::ready) + wait_for(std::chrono::seconds(0)) == std::future_status::ready) ProcessReadyBuildJob(); else return; // Return when the job didn't finish in time diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index b8d2fb8e8b..046c880bab 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -1045,11 +1045,11 @@ void WorldSession::ProcessQueryCallbacks() { _queryProcessor.ProcessReadyQueries(); - if (_realmAccountLoginCallback.valid() && _realmAccountLoginCallback.wait_for(0s) == std::future_status::ready) + if (_realmAccountLoginCallback.valid() && _realmAccountLoginCallback.wait_for(std::chrono::seconds(0)) == std::future_status::ready) InitializeSessionCallback(_realmAccountLoginCallback.get()); //! HandlePlayerLoginOpcode - if (_charLoginCallback.valid() && _charLoginCallback.wait_for(0s) == std::future_status::ready) + if (_charLoginCallback.valid() && _charLoginCallback.wait_for(std::chrono::seconds(0)) == std::future_status::ready) HandlePlayerLogin(reinterpret_cast(_charLoginCallback.get())); }