[NPCs] Convert Load of NPC Emotes to Repositories (#3954)

* [NPCs] Convert Load of NPC Emotes to Repositories

- Convert `LoadNPCEmotes()` to repositories.

* Cleanup
This commit is contained in:
Alex King
2024-01-13 00:33:11 -05:00
committed by GitHub
parent 4c028b85f0
commit fc627ed52d
11 changed files with 112 additions and 90 deletions
+13 -12
View File
@@ -1818,9 +1818,9 @@ bool Client::Death(Mob* killerMob, int64 damage, uint16 spell, EQ::skills::Skill
parse->EventNPC(EVENT_SLAY, killerMob->CastToNPC(), this, "", 0);
}
auto emote_id = killerMob->GetEmoteID();
const uint32 emote_id = killerMob->GetEmoteID();
if (emote_id) {
killerMob->CastToNPC()->DoNPCEmote(EQ::constants::EmoteEventTypes::KilledPC, emoteid, this);
killerMob->CastToNPC()->DoNPCEmote(EQ::constants::EmoteEventTypes::KilledPC, emote_id, this);
}
killerMob->TrySpellOnKill(killed_level, spell);
@@ -2725,7 +2725,7 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
entity_list.RemoveFromAutoXTargets(this);
uint32 emoteid = GetEmoteID();
const uint32 emote_id = GetEmoteID();
corpse = new Corpse(this, &itemlist, GetNPCTypeID(), &NPCTypedata,
level > 54 ? RuleI(NPC, MajorNPCCorpseDecayTimeMS)
: RuleI(NPC, MinorNPCCorpseDecayTimeMS));
@@ -2740,8 +2740,8 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
SetID(0);
ApplyIllusionToCorpse(illusion_spell_id, corpse);
if (killer != 0 && emoteid != 0)
corpse->CastToNPC()->DoNPCEmote(EQ::constants::EmoteEventTypes::AfterDeath, emoteid, killer);
if (killer != 0 && emote_id)
corpse->CastToNPC()->DoNPCEmote(EQ::constants::EmoteEventTypes::AfterDeath, emote_id, killer);
if (killer != 0 && killer->IsClient()) {
corpse->AllowPlayerLoot(killer, 0);
if (killer->IsGrouped()) {
@@ -2823,9 +2823,9 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
// Parse quests even if we're killed by an NPC
if (oos) {
if (IsNPC()) {
auto emote_id = GetEmoteID();
const uint32 emote_id = GetEmoteID();
if (emote_id) {
DoNPCEmote(EQ::constants::EmoteEventTypes::OnDeath, emoteid, killer_mob);
DoNPCEmote(EQ::constants::EmoteEventTypes::OnDeath, emote_id, killer_mob);
}
}
@@ -2834,10 +2834,11 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
parse->EventNPC(EVENT_NPC_SLAY, oos->CastToNPC(), this, "", 0);
}
auto emote_id = oos->GetEmoteID();
const uint32 emote_id = oos->GetEmoteID();
if (emote_id) {
oos->CastToNPC()->DoNPCEmote(EQ::constants::EmoteEventTypes::KilledNPC, emote_id, this);
}
if (killer_mob) {
killer_mob->TrySpellOnKill(killed_level, spell);
}
@@ -4308,7 +4309,7 @@ void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, cons
} else {
a->force *= 0.10f; // force against NPCs is divided by 10 I guess? ex bash is 0.3, parsed 0.03 against an NPC
}
if (ForcedMovement == 0 && a->force != 0.0f && position_update_melee_push_timer.Check()) {
m_Delta.x += a->force * g_Math.FastSin(a->hit_heading);
m_Delta.y += a->force * g_Math.FastCos(a->hit_heading);
@@ -5314,8 +5315,8 @@ bool Mob::TryFinishingBlow(Mob *defender, int64 &damage)
(RuleB(Combat, FinishingBlowOnlyWhenFleeing) && !defender->currently_fleeing) ||
!RuleB(Combat, FinishingBlowOnlyWhenFleeing)
) &&
finishing_blow_level &&
finishing_blow_damage &&
finishing_blow_level &&
finishing_blow_damage &&
defender->GetLevel() <= finishing_blow_level &&
proc_chance >= zone->random.Int(1, 1000)
) {
@@ -6406,7 +6407,7 @@ void Client::DoAttackRounds(Mob *target, int hand, bool IsFromSpell)
if (flurry_chance && zone->random.Roll(flurry_chance)) {
Attack(target, hand, false, false, IsFromSpell);
if (zone->random.Roll(flurry_chance)) {
Attack(target, hand, false, false, IsFromSpell);
}