fix(Scripts/Creature): multi-raid faction leader credit (#22168)

This commit is contained in:
avarishd
2026-03-07 23:53:58 +02:00
committed by GitHub
parent 33a438a585
commit d3cd637d1f
13 changed files with 226 additions and 15 deletions
@@ -269,6 +269,16 @@ void ScriptedAI::DoStopAttack()
me->AttackStop();
}
void ScriptedAI::DoRewardPlayersInArea()
{
me->GetMap()->DoForAllPlayers([&](Player* player)
{
if (player->GetFaction() != me->GetCreatureTemplate()->faction && !player->IsGameMaster())
if (player->GetAreaId() == me->GetAreaId())
player->KilledMonsterCredit(me->GetEntry());
});
}
void ScriptedAI::DoCastSpell(Unit* target, SpellInfo const* spellInfo, bool triggered)
{
if (!target || me->IsNonMeleeSpellCast(false))
@@ -306,6 +306,9 @@ struct ScriptedAI : public CreatureAI
//Stop attack of current victim
void DoStopAttack();
//Reward kill credit to all players from the oposing faction in the area (faction leaders)
void DoRewardPlayersInArea();
//Cast spell by spell info
void DoCastSpell(Unit* target, SpellInfo const* spellInfo, bool triggered = false);