fix(Scripts/Spells): Fix group credit for Salvaging Life's Strength quest spell (#22779)
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user