mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-04 21:19:41 +00:00
[General] Track stacking spells in SpellsActive packets
This commit is contained in:
parent
da16c211a4
commit
767287ae51
10 changed files with 16 additions and 9 deletions
|
@ -202,6 +202,8 @@ namespace MWMechanics
|
|||
|
||||
Whenever a player gains an active spell, send an ID_PLAYER_SPELLS_ACTIVE packet to the server with it
|
||||
*/
|
||||
bool isStackingSpell = it == end() || stack;
|
||||
|
||||
ESM::ActiveSpells::ActiveSpellParams esmParams;
|
||||
esmParams.mEffects = effects;
|
||||
esmParams.mDisplayName = displayName;
|
||||
|
@ -209,11 +211,11 @@ namespace MWMechanics
|
|||
|
||||
if (this == &MWMechanics::getPlayer().getClass().getCreatureStats(MWMechanics::getPlayer()).getActiveSpells())
|
||||
{
|
||||
mwmp::Main::get().getLocalPlayer()->sendSpellsActiveAddition(id, esmParams);
|
||||
mwmp::Main::get().getLocalPlayer()->sendSpellsActiveAddition(id, isStackingSpell, esmParams);
|
||||
}
|
||||
else if (mwmp::Main::get().getCellController()->isLocalActor(MechanicsHelper::getCurrentActor()))
|
||||
{
|
||||
mwmp::Main::get().getCellController()->getLocalActor(MechanicsHelper::getCurrentActor())->sendSpellsActiveAddition(id, esmParams);
|
||||
mwmp::Main::get().getCellController()->getLocalActor(MechanicsHelper::getCurrentActor())->sendSpellsActiveAddition(id, isStackingSpell, esmParams);
|
||||
}
|
||||
/*
|
||||
End of tes3mp addition
|
||||
|
|
|
@ -366,7 +366,7 @@ void DedicatedActor::addSpellsActive()
|
|||
for (const auto& activeSpell : spellsActiveChanges.activeSpells)
|
||||
{
|
||||
// Don't do a check for a spell's existence, because active effects from potions need to be applied here too
|
||||
activeSpells.addSpell(activeSpell.id, false, activeSpell.params.mEffects, activeSpell.params.mDisplayName, 1);
|
||||
activeSpells.addSpell(activeSpell.id, activeSpell.isStackingSpell, activeSpell.params.mEffects, activeSpell.params.mDisplayName, 1);
|
||||
}
|
||||
|
||||
reloadPtr();
|
||||
|
|
|
@ -491,7 +491,7 @@ void DedicatedPlayer::addSpellsActive()
|
|||
for (const auto& activeSpell : spellsActiveChanges.activeSpells)
|
||||
{
|
||||
// Don't do a check for a spell's existence, because active effects from potions need to be applied here too
|
||||
activeSpells.addSpell(activeSpell.id, activeSpell.shouldStack, activeSpell.params.mEffects, activeSpell.params.mDisplayName, 1);
|
||||
activeSpells.addSpell(activeSpell.id, activeSpell.isStackingSpell, activeSpell.params.mEffects, activeSpell.params.mDisplayName, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -285,7 +285,7 @@ void LocalActor::sendEquipment()
|
|||
Main::get().getNetworking()->getActorPacket(ID_ACTOR_EQUIPMENT)->Send();
|
||||
}
|
||||
|
||||
void LocalActor::sendSpellsActiveAddition(const std::string id, ESM::ActiveSpells::ActiveSpellParams params)
|
||||
void LocalActor::sendSpellsActiveAddition(const std::string id, bool isStackingSpell, ESM::ActiveSpells::ActiveSpellParams params)
|
||||
{
|
||||
// Skip any bugged spells that somehow have clientside-only dynamic IDs
|
||||
if (id.find("$dynamic") != std::string::npos)
|
||||
|
@ -295,6 +295,7 @@ void LocalActor::sendSpellsActiveAddition(const std::string id, ESM::ActiveSpell
|
|||
|
||||
mwmp::ActiveSpell spell;
|
||||
spell.id = id;
|
||||
spell.isStackingSpell = isStackingSpell;
|
||||
spell.params = params;
|
||||
spellsActiveChanges.activeSpells.push_back(spell);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace mwmp
|
|||
void updateAttackOrCast();
|
||||
|
||||
void sendEquipment();
|
||||
void sendSpellsActiveAddition(const std::string id, ESM::ActiveSpells::ActiveSpellParams params);
|
||||
void sendSpellsActiveAddition(const std::string id, bool isStackingSpell, ESM::ActiveSpells::ActiveSpellParams params);
|
||||
void sendSpellsActiveRemoval(const std::string id);
|
||||
void sendDeath(char newDeathState);
|
||||
|
||||
|
|
|
@ -719,7 +719,7 @@ void LocalPlayer::addSpellsActive()
|
|||
for (const auto& activeSpell : spellsActiveChanges.activeSpells)
|
||||
{
|
||||
// Don't do a check for a spell's existence, because active effects from potions need to be applied here too
|
||||
activeSpells.addSpell(activeSpell.id, false, activeSpell.params.mEffects, activeSpell.params.mDisplayName, 1);
|
||||
activeSpells.addSpell(activeSpell.id, activeSpell.isStackingSpell, activeSpell.params.mEffects, activeSpell.params.mDisplayName, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1589,7 +1589,7 @@ void LocalPlayer::sendSpellsActive()
|
|||
getNetworking()->getPlayerPacket(ID_PLAYER_SPELLS_ACTIVE)->Send();
|
||||
}
|
||||
|
||||
void LocalPlayer::sendSpellsActiveAddition(const std::string id, ESM::ActiveSpells::ActiveSpellParams params)
|
||||
void LocalPlayer::sendSpellsActiveAddition(const std::string id, bool isStackingSpell, ESM::ActiveSpells::ActiveSpellParams params)
|
||||
{
|
||||
// Skip any bugged spells that somehow have clientside-only dynamic IDs
|
||||
if (id.find("$dynamic") != std::string::npos)
|
||||
|
@ -1599,6 +1599,7 @@ void LocalPlayer::sendSpellsActiveAddition(const std::string id, ESM::ActiveSpel
|
|||
|
||||
mwmp::ActiveSpell spell;
|
||||
spell.id = id;
|
||||
spell.isStackingSpell = isStackingSpell;
|
||||
spell.params = params;
|
||||
spellsActiveChanges.activeSpells.push_back(spell);
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace mwmp
|
|||
void sendSpellbook();
|
||||
void sendSpellChange(std::string id, unsigned int action);
|
||||
void sendSpellsActive();
|
||||
void sendSpellsActiveAddition(const std::string id, ESM::ActiveSpells::ActiveSpellParams params);
|
||||
void sendSpellsActiveAddition(const std::string id, bool isStackingSpell, ESM::ActiveSpells::ActiveSpellParams params);
|
||||
void sendSpellsActiveRemoval(const std::string id);
|
||||
void sendQuickKey(unsigned short slot, int type, const std::string& itemId = "");
|
||||
void sendJournalEntry(const std::string& quest, int index, const MWWorld::Ptr& actor);
|
||||
|
|
|
@ -160,6 +160,7 @@ namespace mwmp
|
|||
struct ActiveSpell
|
||||
{
|
||||
std::string id;
|
||||
bool isStackingSpell;
|
||||
ESM::ActiveSpells::ActiveSpellParams params;
|
||||
};
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ void PacketActorSpellsActive::Actor(BaseActor &actor, bool send)
|
|||
for (auto&& activeSpell : actor.spellsActiveChanges.activeSpells)
|
||||
{
|
||||
RW(activeSpell.id, send, true);
|
||||
RW(activeSpell.isStackingSpell, send);
|
||||
RW(activeSpell.params.mDisplayName, send, true);
|
||||
|
||||
uint32_t effectCount;
|
||||
|
|
|
@ -30,6 +30,7 @@ void PacketPlayerSpellsActive::Packet(RakNet::BitStream *newBitstream, bool send
|
|||
for (auto&& activeSpell : player->spellsActiveChanges.activeSpells)
|
||||
{
|
||||
RW(activeSpell.id, send, true);
|
||||
RW(activeSpell.isStackingSpell, send);
|
||||
RW(activeSpell.params.mDisplayName, send, true);
|
||||
|
||||
uint32_t effectCount;
|
||||
|
|
Loading…
Reference in a new issue