mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-07-01 22:21:36 +00:00
Merge pull request #524 from uramer/0.7.0summon_duration
Make the server receive the correct summon durations regardless of spell casting order
This commit is contained in:
commit
a2f110ae6d
3 changed files with 11 additions and 7 deletions
|
@ -324,14 +324,18 @@ namespace MWMechanics
|
||||||
|
|
||||||
Make it easy to get an effect's duration
|
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 (TContainer::iterator it = mSpells.begin(); it != mSpells.end(); ++it)
|
||||||
{
|
{
|
||||||
for (std::vector<ActiveEffect>::iterator effectIt = it->second.mEffects.begin();
|
if (sourceId.compare(it->first) == 0)
|
||||||
effectIt != it->second.mEffects.end();)
|
|
||||||
{
|
{
|
||||||
return effectIt->mDuration;
|
for (std::vector<ActiveEffect>::iterator effectIt = it->second.mEffects.begin();
|
||||||
|
effectIt != it->second.mEffects.end(); it++)
|
||||||
|
{
|
||||||
|
if (effectIt->mEffectId == effectId)
|
||||||
|
return effectIt->mDuration;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0.f;
|
return 0.f;
|
||||||
|
|
|
@ -109,7 +109,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
Make it easy to get an effect's duration
|
Make it easy to get an effect's duration
|
||||||
*/
|
*/
|
||||||
float getEffectDuration(short effectId);
|
float getEffectDuration(short effectId, std::string sourceId);
|
||||||
/*
|
/*
|
||||||
End of tes3mp addition
|
End of tes3mp addition
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -111,8 +111,8 @@ namespace MWMechanics
|
||||||
objectList->packetOrigin = mwmp::CLIENT_GAMEPLAY;
|
objectList->packetOrigin = mwmp::CLIENT_GAMEPLAY;
|
||||||
|
|
||||||
MWMechanics::CreatureStats *actorCreatureStats = &mActor.getClass().getCreatureStats(mActor);
|
MWMechanics::CreatureStats *actorCreatureStats = &mActor.getClass().getCreatureStats(mActor);
|
||||||
|
float duration = actorCreatureStats->getActiveSpells().getEffectDuration(it->first, it->second);
|
||||||
objectList->addObjectSpawn(placed, mActor, actorCreatureStats->getActiveSpells().getEffectDuration(it->first));
|
objectList->addObjectSpawn(placed, mActor, duration);
|
||||||
objectList->sendObjectSpawn();
|
objectList->sendObjectSpawn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue