fix(Scripts/Spells): Fix group credit for Salvaging Life's Strength quest spell (#22779)

This commit is contained in:
Andrew
2025-09-03 08:13:42 -03:00
committed by GitHub
parent 4d0281552a
commit 11e448a230
+19 -4
View File
@@ -1527,12 +1527,27 @@ class spell_q12805_lifeblood_dummy : public SpellScript
void HandleScript(SpellEffIndex /*effIndex*/) void HandleScript(SpellEffIndex /*effIndex*/)
{ {
Player* caster = GetCaster()->ToPlayer(); Player* caster = GetCaster()->ToPlayer();
if (Creature* target = GetHitCreature()) Creature* target = GetHitCreature();
if (!target)
return;
if (Group* group = caster->GetGroup())
{ {
caster->KilledMonsterCredit(NPC_SHARD_KILL_CREDIT); ObjectGuid targetGUID = target->GetGUID();
target->CastSpell(target, uint32(GetEffectValue()), true); group->DoForAllMembers([targetGUID](Player* player)
target->DespawnOrUnsummon(2000); {
if (Creature* shard = ObjectAccessor::GetCreature(*player, targetGUID))
if (player->IsAtGroupRewardDistance(shard))
player->KilledMonsterCredit(NPC_SHARD_KILL_CREDIT);
});
} }
else
caster->KilledMonsterCredit(NPC_SHARD_KILL_CREDIT);
target->CastSpell(target, uint32(GetEffectValue()), true);
target->DespawnOrUnsummon(2000);
} }
void Register() override void Register() override