mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/PacketIO: Updated and enabled SMSG_DISPEL_FAILED
This commit is contained in:
@@ -813,7 +813,7 @@ WorldPacket const* WorldPackets::Spells::NotifyMissileTrajectoryCollision::Write
|
||||
_worldPacket << Caster;
|
||||
_worldPacket << uint8(CastID);
|
||||
_worldPacket << CollisionPos;
|
||||
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
@@ -844,3 +844,15 @@ WorldPacket const* WorldPackets::Spells::SpellDelayed::Write()
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Spells::DispelFailed::Write()
|
||||
{
|
||||
_worldPacket << CasterGUID;
|
||||
_worldPacket << VictimGUID;
|
||||
_worldPacket << uint32(SpellID);
|
||||
_worldPacket << uint32(FailedSpells.size());
|
||||
if (!FailedSpells.empty())
|
||||
_worldPacket.append(FailedSpells.data(), FailedSpells.size());
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
@@ -830,7 +830,7 @@ namespace WorldPackets
|
||||
{
|
||||
public:
|
||||
MissileTrajectoryCollision(WorldPacket&& packet) : ClientPacket(CMSG_MISSILE_TRAJECTORY_COLLISION, std::move(packet)) { }
|
||||
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Target;
|
||||
@@ -839,7 +839,7 @@ namespace WorldPackets
|
||||
G3D::Vector3 CollisionPos;
|
||||
};
|
||||
|
||||
class NotifyMissileTrajectoryCollision : public ServerPacket
|
||||
class NotifyMissileTrajectoryCollision final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
NotifyMissileTrajectoryCollision() : ServerPacket(SMSG_NOTIFY_MISSILE_TRAJECTORY_COLLISION, 8 + 1 + 12) { }
|
||||
@@ -855,7 +855,7 @@ namespace WorldPackets
|
||||
{
|
||||
public:
|
||||
UpdateMissileTrajectory(WorldPacket&& packet) : ClientPacket(CMSG_UPDATE_MISSILE_TRAJECTORY, std::move(packet)) { }
|
||||
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Guid;
|
||||
@@ -868,7 +868,7 @@ namespace WorldPackets
|
||||
Optional<MovementInfo> Status;
|
||||
};
|
||||
|
||||
class SpellDelayed : public ServerPacket
|
||||
class SpellDelayed final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
SpellDelayed() : ServerPacket(SMSG_SPELL_DELAYED, sizeof(ObjectGuid) + 4) { }
|
||||
@@ -878,6 +878,19 @@ namespace WorldPackets
|
||||
ObjectGuid Caster;
|
||||
int32 ActualDelay = 0;
|
||||
};
|
||||
|
||||
class DispelFailed final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
DispelFailed() : ServerPacket(SMSG_DISPEL_FAILED, 16 + 16 + 4 + 4 + 4 /* predict a single failure on average */) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
ObjectGuid CasterGUID;
|
||||
ObjectGuid VictimGUID;
|
||||
uint32 SpellID = 0;
|
||||
std::vector<int32> FailedSpells;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1023,7 +1023,7 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_DISENCHANT_CREDIT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_DISMOUNT, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_DISMOUNT_RESULT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_DISPEL_FAILED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_DISPEL_FAILED, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_DISPLAY_GAME_ERROR, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_DISPLAY_PLAYER_CHOICE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_DISPLAY_PROMOTION, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
|
||||
@@ -2307,9 +2307,12 @@ void Spell::EffectDispel(SpellEffIndex effIndex)
|
||||
return;
|
||||
|
||||
// Ok if exist some buffs for dispel try dispel it
|
||||
uint32 failCount = 0;
|
||||
DispelChargesList success_list;
|
||||
WorldPacket dataFail(SMSG_DISPEL_FAILED, 8+8+4+4+damage*4);
|
||||
WorldPackets::Spells::DispelFailed dispelFailed;
|
||||
dispelFailed.CasterGUID = m_caster->GetGUID();
|
||||
dispelFailed.VictimGUID = unitTarget->GetGUID();
|
||||
dispelFailed.SpellID = m_spellInfo->Id;
|
||||
|
||||
// dispel N = damage buffs (or while exist buffs for dispel)
|
||||
for (int32 count = 0; count < damage && !dispel_list.empty();)
|
||||
{
|
||||
@@ -2344,23 +2347,14 @@ void Spell::EffectDispel(SpellEffIndex effIndex)
|
||||
dispel_list.erase(itr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!failCount)
|
||||
{
|
||||
// Failed to dispell
|
||||
dataFail << m_caster->GetGUID(); // Caster GUID
|
||||
dataFail << unitTarget->GetGUID(); // Victim GUID
|
||||
dataFail << uint32(m_spellInfo->Id); // dispel spell id
|
||||
}
|
||||
++failCount;
|
||||
dataFail << uint32(itr->first->GetId()); // Spell Id
|
||||
}
|
||||
dispelFailed.FailedSpells.push_back(int32(itr->first->GetId()));
|
||||
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
if (failCount)
|
||||
m_caster->SendMessageToSet(&dataFail, true);
|
||||
if (!dispelFailed.FailedSpells.empty())
|
||||
m_caster->SendMessageToSet(dispelFailed.Write(), true);
|
||||
|
||||
if (success_list.empty())
|
||||
return;
|
||||
@@ -5163,9 +5157,12 @@ void Spell::EffectStealBeneficialBuff(SpellEffIndex /*effIndex*/)
|
||||
return;
|
||||
|
||||
// Ok if exist some buffs for dispel try dispel it
|
||||
uint32 failCount = 0;
|
||||
DispelList success_list;
|
||||
WorldPacket dataFail(SMSG_DISPEL_FAILED, 8+8+4+4+damage*4);
|
||||
WorldPackets::Spells::DispelFailed dispelFailed;
|
||||
dispelFailed.CasterGUID = m_caster->GetGUID();
|
||||
dispelFailed.VictimGUID = unitTarget->GetGUID();
|
||||
dispelFailed.SpellID = m_spellInfo->Id;
|
||||
|
||||
// dispel N = damage buffs (or while exist buffs for dispel)
|
||||
for (int32 count = 0; count < damage && !steal_list.empty();)
|
||||
{
|
||||
@@ -5190,23 +5187,14 @@ void Spell::EffectStealBeneficialBuff(SpellEffIndex /*effIndex*/)
|
||||
steal_list.erase(itr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!failCount)
|
||||
{
|
||||
// Failed to dispell
|
||||
dataFail << m_caster->GetGUID(); // Caster GUID
|
||||
dataFail << unitTarget->GetGUID(); // Victim GUID
|
||||
dataFail << uint32(m_spellInfo->Id); // dispel spell id
|
||||
}
|
||||
++failCount;
|
||||
dataFail << uint32(itr->first->GetId()); // Spell Id
|
||||
}
|
||||
dispelFailed.FailedSpells.push_back(int32(itr->first->GetId()));
|
||||
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
if (failCount)
|
||||
m_caster->SendMessageToSet(&dataFail, true);
|
||||
if (!dispelFailed.FailedSpells.empty())
|
||||
m_caster->SendMessageToSet(dispelFailed.Write(), true);
|
||||
|
||||
if (success_list.empty())
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user