aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorOvahlord <dreadkiller@gmx.de>2024-07-11 18:29:07 +0200
committerOvahlord <dreadkiller@gmx.de>2024-07-11 18:29:07 +0200
commit934ef521e3b7ad147102beda71231d3cc8889c0f (patch)
treeb26b56f7f2e94d0d7d2fec33299737885f61c42a /src/server
parentc41e21db23799fb88e6e3f02b5796e478e4fb389 (diff)
Core/Auras: implemented SPELL_AURA_CONVERT_RUNE
Diffstat (limited to 'src/server')
-rw-r--r--src/server/game/Entities/Player/Player.cpp7
-rw-r--r--src/server/game/Entities/Player/Player.h1
-rw-r--r--src/server/game/Server/Packets/SpellPackets.cpp2
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp38
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.h1
5 files changed, 40 insertions, 9 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 3f74950042a..94a0d5bcc7c 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -25657,11 +25657,6 @@ void Player::ResyncRunes() const
SendDirectMessage(data.Write());
}
-void Player::SendConvertedRunes() const
-{
-
-}
-
void Player::AddRunePower(uint8 mask) const
{
WorldPackets::Spells::AddRunePower packet;
@@ -25787,7 +25782,7 @@ void Player::ConvertRune(uint8 index, RuneType newType)
{
SetCurrentRune(index, newType);
- WorldPackets::Spells::ConvertRune packet(MAX_RUNES);
+ WorldPackets::Spells::ConvertRune packet(0);
packet.Index = index;
packet.Rune = AsUnderlyingType(newType);
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index e0239cc08d2..aede357aefb 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -2673,7 +2673,6 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
void RestoreBaseRune(uint8 index);
void ConvertRune(uint8 index, RuneType newType);
void ResyncRunes() const;
- void SendConvertedRunes() const;
void AddRunePower(uint8 mask) const;
void InitRunes();
diff --git a/src/server/game/Server/Packets/SpellPackets.cpp b/src/server/game/Server/Packets/SpellPackets.cpp
index 324efd9fca3..95f54c440b4 100644
--- a/src/server/game/Server/Packets/SpellPackets.cpp
+++ b/src/server/game/Server/Packets/SpellPackets.cpp
@@ -936,7 +936,7 @@ WorldPacket const* ConvertRune::Write()
_worldPacket << uint32(Index);
_worldPacket << uint32(Rune);
- return nullptr;
+ return &_worldPacket;
}
WorldPacket const* AddRunePower::Write()
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 2c9ac51fd97..26248007f18 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -581,7 +581,7 @@ NonDefaultConstructible<pAuraEffectHandler> AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleNULL, //509
&AuraEffect::HandleNULL, //510 SPELL_AURA_MODIFIED_RAID_INSTANCE
&AuraEffect::HandleNULL, //511 SPELL_AURA_APPLY_PROFESSION_EFFECT
- &AuraEffect::HandleNULL, //512 SPELL_AURA_CONVERT_RUNE
+ &AuraEffect::HandleConvertRune, //512 SPELL_AURA_CONVERT_RUNE
&AuraEffect::HandleNULL, //513
&AuraEffect::HandleNULL, //514
&AuraEffect::HandleNULL, //515
@@ -6385,6 +6385,42 @@ void AuraEffect::HandleForceBreathBar(AuraApplication const* aurApp, uint8 mode,
playerTarget->UpdatePositionData();
}
+void AuraEffect::HandleConvertRune(AuraApplication const* aurApp, uint8 mode, bool apply) const
+{
+ if (!(mode & AURA_EFFECT_HANDLE_REAL))
+ return;
+
+ Player* playerTarget = aurApp->GetTarget()->ToPlayer();
+ if (!playerTarget || playerTarget->GetClass() != CLASS_DEATH_KNIGHT)
+ return;
+
+ /*
+ * Converts a rune into a new rune type.
+ * MiscValueA describes what rune type can be converted
+ * MiscValueB describes into what rune the eligible rune will be converted into
+ * Amount is the number of runes that will be converted if available
+ */
+
+ uint32 runesToConvert = GetAmount();
+
+ if (apply)
+ {
+ for (uint8 i = 0; i < MAX_RUNES && runesToConvert; ++i)
+ {
+ if (RuneType(GetMiscValue()) != playerTarget->GetCurrentRune(i))
+ continue;
+
+ if (!playerTarget->GetRuneCooldown(i))
+ {
+ playerTarget->AddRuneByAuraEffect(i, RuneType(GetMiscValueB()), this, GetAuraType(), GetSpellInfo());
+ --runesToConvert;
+ }
+ }
+ }
+ else
+ playerTarget->RemoveRunesByAuraEffect(this);
+}
+
template TC_GAME_API void AuraEffect::GetTargetList(std::list<Unit*>&) const;
template TC_GAME_API void AuraEffect::GetTargetList(std::deque<Unit*>&) const;
template TC_GAME_API void AuraEffect::GetTargetList(std::vector<Unit*>&) const;
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h
index 1bbf52e375e..aeb51472173 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.h
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.h
@@ -336,6 +336,7 @@ class TC_GAME_API AuraEffect
void HandleMountRestrictions(AuraApplication const* aurApp, uint8 mode, bool apply) const;
void HandleSuppressItemPassiveEffectBySpellLabel(AuraApplication const* aurApp, uint8 mode, bool apply) const;
void HandleForceBreathBar(AuraApplication const* aurApp, uint8 mode, bool apply) const;
+ void HandleConvertRune(AuraApplication const* aurApp, uint8 mode, bool apply) const;
// aura effect periodic tick handlers
void HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) const;