diff --git a/apps/openmw/mwmechanics/activespells.cpp b/apps/openmw/mwmechanics/activespells.cpp index cc0dcec79..5885a612b 100644 --- a/apps/openmw/mwmechanics/activespells.cpp +++ b/apps/openmw/mwmechanics/activespells.cpp @@ -324,14 +324,18 @@ namespace MWMechanics Make it easy to get an effect's duration */ - float ActiveSpells::getEffectDuration(short effectId) + float ActiveSpells::getEffectDuration(short effectId, std::string sourceId) { for (TContainer::iterator it = mSpells.begin(); it != mSpells.end(); ++it) { - for (std::vector::iterator effectIt = it->second.mEffects.begin(); - effectIt != it->second.mEffects.end();) + if (sourceId.compare(it->first) == 0) { - return effectIt->mDuration; + for (std::vector::iterator effectIt = it->second.mEffects.begin(); + effectIt != it->second.mEffects.end(); it++) + { + if (effectIt->mEffectId == effectId) + return effectIt->mDuration; + } } } return 0.f; diff --git a/apps/openmw/mwmechanics/activespells.hpp b/apps/openmw/mwmechanics/activespells.hpp index a9c3a2761..c29c0cbd3 100644 --- a/apps/openmw/mwmechanics/activespells.hpp +++ b/apps/openmw/mwmechanics/activespells.hpp @@ -109,7 +109,7 @@ namespace MWMechanics Make it easy to get an effect's duration */ - float getEffectDuration(short effectId); + float getEffectDuration(short effectId, std::string sourceId); /* End of tes3mp addition */ diff --git a/apps/openmw/mwmechanics/summoning.cpp b/apps/openmw/mwmechanics/summoning.cpp index fcf0826ce..5be5e247e 100644 --- a/apps/openmw/mwmechanics/summoning.cpp +++ b/apps/openmw/mwmechanics/summoning.cpp @@ -111,8 +111,8 @@ namespace MWMechanics objectList->packetOrigin = mwmp::CLIENT_GAMEPLAY; MWMechanics::CreatureStats *actorCreatureStats = &mActor.getClass().getCreatureStats(mActor); - - objectList->addObjectSpawn(placed, mActor, actorCreatureStats->getActiveSpells().getEffectDuration(it->first)); + float duration = actorCreatureStats->getActiveSpells().getEffectDuration(it->first, it->second); + objectList->addObjectSpawn(placed, mActor, duration); objectList->sendObjectSpawn(); }