chore(Scripts/Misc): Cleanup some more JustDied hooks (#9768)

This commit is contained in:
Kitzunu
2021-12-31 16:00:40 +01:00
committed by GitHub
parent 0556f0b3d5
commit 69683a3472
22 changed files with 34 additions and 31 deletions

View File

@@ -577,8 +577,7 @@ namespace lfg
rDungeonId = (*dungeons.begin());
sScriptMgr->OnPlayerQueueRandomDungeon(player, rDungeonId);
}
// No break on purpose (Random can only be dungeon or heroic dungeon)
[[fallthrough]];
[[fallthrough]]; // On purpose (Random can only be dungeon or heroic dungeon)
case LFG_TYPE_HEROIC:
case LFG_TYPE_DUNGEON:
if (isRaid)

View File

@@ -562,8 +562,6 @@ void GameObject::Update(uint32 diff)
m_lootState = GO_READY; // for other GOis same switched without delay to GO_READY
break;
}
// NO BREAK for switch (m_lootState)
[[fallthrough]];
}
case GO_READY:

View File

@@ -17198,8 +17198,10 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp
killer->ToCreature()->AI()->KilledUnit(victim);
// Call creature just died function
if (creature->IsAIEnabled)
creature->AI()->JustDied(killer ? killer : victim);
if (CreatureAI* ai = creature->AI())
{
ai->JustDied(killer);
}
if (TempSummon* summon = creature->ToTempSummon())
if (Unit* summoner = summon->GetSummonerUnit())

View File

@@ -569,7 +569,11 @@ public:
void JustDied(Unit* killer) override
{
Talk(SAY_VALROTH_DEATH);
killer->CastSpell(me, SPELL_SUMMON_VALROTH_REMAINS, true);
if (killer)
{
killer->CastSpell(me, SPELL_SUMMON_VALROTH_REMAINS, true);
}
}
};
};

View File

@@ -159,7 +159,7 @@ struct boss_jarien : public BossAI
me->SummonCreature(NPC_SPIRIT_OF_JARIEN, me->GetPosition());
if (_sothosDied)
if (_sothosDied && killer)
{
HandleBothDead(me, true, killer);
}
@@ -281,7 +281,7 @@ struct boss_sothos : public BossAI
me->SummonCreature(NPC_SPIRIT_OF_SOTHOS, me->GetPosition());
if (_jarienDied)
if (_jarienDied && killer)
{
HandleBothDead(me, false, killer);
}

View File

@@ -330,7 +330,7 @@ struct npc_love_in_air_hummel : public ScriptedAI
speachTimer = 1;
}
void JustDied(Unit* ) override
void JustDied(Unit* /*killer*/) override
{
me->AI()->Talk(SAY_HUMMEL_5);
Map::PlayerList const& players = me->GetMap()->GetPlayers();
@@ -465,7 +465,7 @@ struct npc_love_in_air_hummel_helper : public ScriptedAI
}
}
void JustDied(Unit* ) override
void JustDied(Unit* /*killer*/) override
{
me->AI()->Talk(SAY_HUMMEL_HELPER_SAY_5);
}

View File

@@ -75,7 +75,7 @@ public:
void JustDied(Unit* killer) override
{
if (killer == me)
if (killer && killer == me)
return;
Talk(SAY_DEATH);
me->GetInstanceScript()->SetData(DATA_ESCORT_PROGRESS, ENCOUNTER_PROGRESS_EPOCH_KILLED);

View File

@@ -494,7 +494,7 @@ public:
void JustDied(Unit* killer) override
{
if (killer == me)
if (killer && killer == me)
return;
summons.DespawnAll();

View File

@@ -194,7 +194,7 @@ public:
}
}
void JustDied(Unit* ) override
void JustDied(Unit* /*killer*/) override
{
me->SetRespawnTime(DAY);
events.Reset();

View File

@@ -347,7 +347,7 @@ public:
me->CallForHelp(500.0f);
}
void JustDied(Unit* /*pKiller*/) override
void JustDied(Unit* /*killer*/) override
{
RespawnDragons(true);
_JustDied();

View File

@@ -494,7 +494,7 @@ public:
if (me->IsDamageEnoughForLootingAndReward())
halion->LowerPlayerDamageReq(halion->GetMaxHealth());
if (halion->IsAlive())
if (killer && halion->IsAlive())
Unit::Kill(killer, halion);
}

View File

@@ -570,7 +570,7 @@ public:
ScriptedAI::MoveInLineOfSight(who);
}
void JustDied(Unit* ) override
void JustDied(Unit* /*killer*/) override
{
if (me->GetEntry() == NPC_UNSTOPPABLE_ABOMINATION && me->GetInstanceScript())
{

View File

@@ -473,7 +473,7 @@ public:
}
}
void JustDied(Unit* ) override
void JustDied(Unit* /*killer*/) override
{
Talk(me->GetEntry() == NPC_STALAGG ? SAY_STAL_DEATH : SAY_FEUG_DEATH);
Talk(me->GetEntry() == NPC_STALAGG ? EMOTE_STAL_DEATH : EMOTE_FEUG_DEATH);

View File

@@ -1169,7 +1169,7 @@ public:
uint32 timer;
void JustDied(Unit* ) override
void JustDied(Unit* /*killer*/) override
{
if (me->GetEntry() == NPC_MR_BIGGLESWORTH && me->GetInstanceScript())
{

View File

@@ -718,7 +718,7 @@ public:
void JustDied(Unit* killer) override
{
if (me->GetEntry() == killer->GetEntry())
if (killer && me->GetEntry() == killer->GetEntry())
return;
me->Yell("Matron, flee! They are ruthless....", LANG_UNIVERSAL);
me->PlayDirectSound(SOUND_STONEBARK_DEATH);
@@ -824,7 +824,7 @@ public:
void JustDied(Unit* killer) override
{
if (me->GetEntry() == killer->GetEntry())
if (killer && me->GetEntry() == killer->GetEntry())
return;
me->Yell("Matron, one has fallen!", LANG_UNIVERSAL);
me->PlayDirectSound(SOUND_BRIGHTLEAF_DEATH);
@@ -945,7 +945,7 @@ public:
void JustDied(Unit* killer) override
{
if (me->GetEntry() == killer->GetEntry())
if (killer && me->GetEntry() == killer->GetEntry())
return;
me->Yell("Freya! They come for you.", LANG_UNIVERSAL);
me->PlayDirectSound(SOUND_IRONBRANCH_DEATH);
@@ -1011,7 +1011,7 @@ public:
{
boss_freya_iron_rootAI(Creature* pCreature) : NullCreatureAI(pCreature) { }
void JustDied(Unit*) override
void JustDied(Unit* /*killer*/) override
{
if (!me->IsSummon())
return;
@@ -1139,7 +1139,7 @@ public:
AttackStart(target);
}
void JustDied(Unit*) override
void JustDied(Unit* /*killer*/) override
{
if (Creature* freya = ObjectAccessor::GetCreature(*me, _freyaGUID))
{

View File

@@ -782,7 +782,7 @@ public:
me->m_Events.AddEvent(new BoomEvent(me), me->m_Events.CalculateTime(1 * IN_MILLISECONDS));
}
void JustDied(Unit*) override
void JustDied(Unit* /*killer*/) override
{
me->m_Events.AddEvent(new BoomEvent(me), me->m_Events.CalculateTime(1 * IN_MILLISECONDS));
}

View File

@@ -87,7 +87,7 @@ public:
void JustDied(Unit* killer) override
{
if (killer->GetGUID() != me->GetGUID())
if (killer && killer->GetGUID() != me->GetGUID())
if (InstanceScript* pInstance = me->GetInstanceScript())
pInstance->SetData(DATA_ON_THE_ROCKS_ACHIEV, 0);

View File

@@ -149,7 +149,7 @@ public:
pInstance->SetData(EVENT_EMALON, IN_PROGRESS);
}
void JustDied(Unit* ) override
void JustDied(Unit* /*killer*/) override
{
summons.DespawnAll();
events.Reset();

View File

@@ -97,7 +97,7 @@ public:
pInstance->SetData(EVENT_KORALON, IN_PROGRESS);
}
void JustDied(Unit* ) override
void JustDied(Unit* /*killer*/) override
{
if (pInstance)
pInstance->SetData(EVENT_KORALON, DONE);

View File

@@ -41,7 +41,7 @@ public:
uint32 faction;
EventMap events;
void JustDied(Unit* ) override
void JustDied(Unit* /*killer*/) override
{
if (me->GetEntry() == NPC_KEEP_CANNON)
{

View File

@@ -523,7 +523,7 @@ public:
}
}
void JustDied(Unit* /*killer*/) override
void JustDied(Unit* /*killer*/) override
{
Talk(ANGER_SAY_DEATH);
if (me->IsSummon())

View File

@@ -214,7 +214,7 @@ public:
trigger_deathAI(Creature* creature) : NullCreatureAI(creature) { }
void JustDied(Unit* killer) override
{
if (me->m_spells[0])
if (killer && me->m_spells[0])
me->CastSpell(killer, me->m_spells[0], true);
}
};