diff options
| author | Shauren <shauren.trinity@gmail.com> | 2016-07-07 22:56:07 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2016-07-07 22:56:07 +0200 |
| commit | ef344664e3ee1bef048cf197d416e83b95c74e30 (patch) | |
| tree | 81f45c9a9d90a5506aa2236fac76e59eb7bb187d /src/server/game/Server/Packets | |
| parent | 70137b8f3aae7c875f1fc0b1643d80aece933104 (diff) | |
Core: Update to 7.0.3.22150
Diffstat (limited to 'src/server/game/Server/Packets')
| -rw-r--r-- | src/server/game/Server/Packets/CombatLogPackets.h | 49 | ||||
| -rw-r--r-- | src/server/game/Server/Packets/SpellPackets.cpp | 30 | ||||
| -rw-r--r-- | src/server/game/Server/Packets/SpellPackets.h | 104 | ||||
| -rw-r--r-- | src/server/game/Server/Packets/SystemPackets.cpp | 1 |
4 files changed, 107 insertions, 77 deletions
diff --git a/src/server/game/Server/Packets/CombatLogPackets.h b/src/server/game/Server/Packets/CombatLogPackets.h index f4eed7caea5..5652ecba8ab 100644 --- a/src/server/game/Server/Packets/CombatLogPackets.h +++ b/src/server/game/Server/Packets/CombatLogPackets.h @@ -26,55 +26,6 @@ namespace WorldPackets { namespace CombatLog { - class CombatLogServerPacket : public ServerPacket - { - public: - CombatLogServerPacket(OpcodeServer opcode, size_t initialSize = 200, ConnectionType connection = CONNECTION_TYPE_DEFAULT) - : ServerPacket(opcode, initialSize, connection), _fullLogPacket(opcode, initialSize, connection) { } - - WorldPacket const* GetFullLogPacket() const { return &_fullLogPacket; } - WorldPacket const* GetBasicLogPacket() const { return &_worldPacket; } - - Spells::SpellCastLogData LogData; - - protected: - template<typename T> - void operator<<(T const& val) - { - _worldPacket << val; - _fullLogPacket << val; - } - - void WriteLogDataBit() - { - _worldPacket.WriteBit(false); - _fullLogPacket.WriteBit(true); - } - - void FlushBits() - { - _worldPacket.FlushBits(); - _fullLogPacket.FlushBits(); - } - - bool WriteBit(bool bit) - { - _worldPacket.WriteBit(bit); - _fullLogPacket.WriteBit(bit); - return bit; - } - - void WriteBits(uint32 value, uint32 bitCount) - { - _worldPacket.WriteBits(value, bitCount); - _fullLogPacket.WriteBits(value, bitCount); - } - - ByteBuffer& WriteLogData() { return _fullLogPacket << LogData; } - - WorldPacket _fullLogPacket; - }; - class SpellNonMeleeDamageLog final : public CombatLogServerPacket { public: diff --git a/src/server/game/Server/Packets/SpellPackets.cpp b/src/server/game/Server/Packets/SpellPackets.cpp index be57dc2ab9d..b2fff8cddfa 100644 --- a/src/server/game/Server/Packets/SpellPackets.cpp +++ b/src/server/game/Server/Packets/SpellPackets.cpp @@ -97,7 +97,25 @@ void WorldPackets::Spells::SpellCastLogData::Initialize(Unit const* unit) Health = unit->GetHealth(); AttackPower = unit->GetTotalAttackPowerValue(unit->getClass() == CLASS_HUNTER ? RANGED_ATTACK : BASE_ATTACK); SpellPower = unit->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SPELL); - PowerData.emplace_back(int32(unit->getPowerType()), unit->GetPower(unit->getPowerType())); + PowerData.emplace_back(int32(unit->getPowerType()), unit->GetPower(unit->getPowerType()), int32(0)); +} + +void WorldPackets::Spells::SpellCastLogData::Initialize(Spell const* spell) +{ + Health = spell->GetCaster()->GetHealth(); + AttackPower = spell->GetCaster()->GetTotalAttackPowerValue(spell->GetCaster()->getClass() == CLASS_HUNTER ? RANGED_ATTACK : BASE_ATTACK); + SpellPower = spell->GetCaster()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SPELL); + Powers primaryPowerType = spell->GetCaster()->getPowerType(); + bool primaryPowerAdded = false; + for (SpellInfo::CostData const& cost : spell->GetPowerCost()) + { + PowerData.emplace_back(int32(cost.Power), spell->GetCaster()->GetPower(Powers(cost.Power)), int32(cost.Amount)); + if (cost.Power == primaryPowerType) + primaryPowerAdded = true; + } + + if (!primaryPowerAdded) + PowerData.insert(PowerData.begin(), SpellLogPowerData(int32(primaryPowerType), spell->GetCaster()->GetPower(primaryPowerType), 0)); } ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastLogData const& spellCastLogData) @@ -112,6 +130,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastLogData { data << int32(powerData.PowerType); data << int32(powerData.Amount); + data << int32(powerData.Cost); } return data; @@ -453,13 +472,12 @@ WorldPacket const* WorldPackets::Spells::SpellStart::Write() WorldPacket const* WorldPackets::Spells::SpellGo::Write() { - _worldPacket << Cast; + *this << Cast; - _worldPacket.WriteBit(LogData.is_initialized()); - _worldPacket.FlushBits(); + WriteLogDataBit(); + FlushBits(); - if (LogData) - _worldPacket << *LogData; + WriteLogData(); return &_worldPacket; } diff --git a/src/server/game/Server/Packets/SpellPackets.h b/src/server/game/Server/Packets/SpellPackets.h index 60299e06c4d..595b5522175 100644 --- a/src/server/game/Server/Packets/SpellPackets.h +++ b/src/server/game/Server/Packets/SpellPackets.h @@ -28,6 +28,86 @@ namespace WorldPackets { namespace Spells { + struct SpellLogPowerData + { + SpellLogPowerData(int32 powerType, int32 amount, int32 cost) : PowerType(powerType), Amount(amount), Cost(cost) { } + + int32 PowerType = 0; + int32 Amount = 0; + int32 Cost = 0; + }; + + struct SpellCastLogData + { + int64 Health = 0; + int32 AttackPower = 0; + int32 SpellPower = 0; + std::vector<SpellLogPowerData> PowerData; + + void Initialize(Unit const* unit); + void Initialize(Spell const* spell); + }; + } +} + +ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastLogData const& spellCastLogData); + +namespace WorldPackets +{ + namespace CombatLog + { + class CombatLogServerPacket : public ServerPacket + { + public: + CombatLogServerPacket(OpcodeServer opcode, size_t initialSize = 200, ConnectionType connection = CONNECTION_TYPE_DEFAULT) + : ServerPacket(opcode, initialSize, connection), _fullLogPacket(opcode, initialSize, connection) { } + + WorldPacket const* GetFullLogPacket() const { return &_fullLogPacket; } + WorldPacket const* GetBasicLogPacket() const { return &_worldPacket; } + + Spells::SpellCastLogData LogData; + + protected: + template<typename T> + void operator<<(T const& val) + { + _worldPacket << val; + _fullLogPacket << val; + } + + void WriteLogDataBit() + { + _worldPacket.WriteBit(false); + _fullLogPacket.WriteBit(true); + } + + void FlushBits() + { + _worldPacket.FlushBits(); + _fullLogPacket.FlushBits(); + } + + bool WriteBit(bool bit) + { + _worldPacket.WriteBit(bit); + _fullLogPacket.WriteBit(bit); + return bit; + } + + void WriteBits(uint32 value, uint32 bitCount) + { + _worldPacket.WriteBits(value, bitCount); + _fullLogPacket.WriteBits(value, bitCount); + } + + ByteBuffer& WriteLogData() { return _fullLogPacket << LogData; } + + WorldPacket _fullLogPacket; + }; + } + + namespace Spells + { class CancelAura final : public ClientPacket { public: @@ -164,24 +244,6 @@ namespace WorldPackets std::vector<uint32> Spells; }; - struct SpellLogPowerData - { - SpellLogPowerData(int32 powerType, int32 amount) : PowerType(powerType), Amount(amount) { } - - int32 PowerType = 0; - int32 Amount = 0; - }; - - struct SpellCastLogData - { - int64 Health = 0; - int32 AttackPower = 0; - int32 SpellPower = 0; - std::vector<SpellLogPowerData> PowerData; - - void Initialize(Unit const* unit); - }; - struct SandboxScalingData { uint32 Type = 0; @@ -389,14 +451,13 @@ namespace WorldPackets SpellHealPrediction Predict; }; - class SpellGo final : public ServerPacket + class SpellGo final : public CombatLog::CombatLogServerPacket { public: - SpellGo() : ServerPacket(SMSG_SPELL_GO) { } + SpellGo() : CombatLog::CombatLogServerPacket(SMSG_SPELL_GO) { } WorldPacket const* Write() override; - Optional<SpellCastLogData> LogData; SpellCastData Cast; }; @@ -936,7 +997,6 @@ namespace WorldPackets } } -ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastLogData const& spellCastLogData); ByteBuffer& operator>>(ByteBuffer& buffer, WorldPackets::Spells::SpellCastRequest& request); ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SandboxScalingData const& sandboxScalingData); diff --git a/src/server/game/Server/Packets/SystemPackets.cpp b/src/server/game/Server/Packets/SystemPackets.cpp index e39182b280f..00882b27600 100644 --- a/src/server/game/Server/Packets/SystemPackets.cpp +++ b/src/server/game/Server/Packets/SystemPackets.cpp @@ -94,6 +94,7 @@ WorldPacket const* WorldPackets::System::FeatureSystemStatusGlueScreen::Write() _worldPacket.WriteBit(WillKickFromWorld); _worldPacket.WriteBit(IsExpansionPreorderInStore); _worldPacket.WriteBit(KioskModeEnabled); + _worldPacket.WriteBit(false); // not accessed in handler _worldPacket.WriteBit(TrialBoostEnabled); _worldPacket.FlushBits(); |
