mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-27 10:39:46 +00:00
[Client] Move item magic hook to correct location
Previously, synchronization for strike enchantments was partially broken because it triggered the sending of ITEM_MAGIC attack packets, which are only supposed to be sent when a spell is cast from a magical inventory item.
This commit is contained in:
parent
c9ad411dd3
commit
7d221509cd
2 changed files with 22 additions and 19 deletions
|
@ -938,25 +938,6 @@ namespace MWMechanics
|
|||
else if (isProjectile || !mTarget.isEmpty())
|
||||
inflict(mTarget, mCaster, enchantment->mEffects, ESM::RT_Target);
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
If this mCaster belongs to a LocalPlayer or LocalActor, get their Attack and prepare
|
||||
it for sending
|
||||
*/
|
||||
mwmp::Attack *localAttack = MechanicsHelper::getLocalAttack(mCaster);
|
||||
|
||||
if (localAttack)
|
||||
{
|
||||
MechanicsHelper::resetAttack(localAttack);
|
||||
localAttack->type = mwmp::Attack::ITEM_MAGIC;
|
||||
localAttack->itemId = item.getCellRef().getRefId();
|
||||
localAttack->shouldSend = true;
|
||||
}
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "../mwmp/DedicatedActor.hpp"
|
||||
#include "../mwmp/ObjectList.hpp"
|
||||
#include "../mwmp/CellController.hpp"
|
||||
#include "../mwmp/MechanicsHelper.hpp"
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
@ -3260,7 +3261,28 @@ namespace MWWorld
|
|||
{
|
||||
MWWorld::InventoryStore& inv = actor.getClass().getInventoryStore(actor);
|
||||
if (inv.getSelectedEnchantItem() != inv.end())
|
||||
/*
|
||||
Start of tes3mp change (minor)
|
||||
|
||||
If this actor is a LocalPlayer or LocalActor, get their Attack and prepare
|
||||
it for sending
|
||||
*/
|
||||
{
|
||||
cast.cast(*inv.getSelectedEnchantItem());
|
||||
|
||||
mwmp::Attack *localAttack = MechanicsHelper::getLocalAttack(actor);
|
||||
|
||||
if (localAttack)
|
||||
{
|
||||
MechanicsHelper::resetAttack(localAttack);
|
||||
localAttack->type = mwmp::Attack::ITEM_MAGIC;
|
||||
localAttack->itemId = inv.getSelectedEnchantItem()->getCellRef().getRefId();
|
||||
localAttack->shouldSend = true;
|
||||
}
|
||||
}
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue