From e1e5873398f89e339f33faebbd26b278783e27de Mon Sep 17 00:00:00 2001 From: Chris Miles Date: Sun, 13 Jun 2021 02:09:23 -0500 Subject: [PATCH] [Hotfix] Fix crash pertaining to new PVPEnableGuardFactionAssist code (#1393) Pushing through due to crash severity on master --- zone/spells.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/zone/spells.cpp b/zone/spells.cpp index bcbe48d9f..757ec0645 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -383,7 +383,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot, Chat::SpellFailure, (IsClient() ? FilterPCSpells : FilterNPCSpells), (fizzle_msg == MISS_NOTE ? MISSED_NOTE_OTHER : SPELL_FIZZLE_OTHER), - /* + /* MessageFormat: You miss a note, bringing your song to a close! (if missed note) MessageFormat: A missed note brings %1's song to a close! MessageFormat: %1's spell fizzles! @@ -1235,7 +1235,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo else { if (!RuleB(Character, PetsUseReagents) && (IsEffectInSpell(spell_id, SE_SummonPet) || IsEffectInSpell(spell_id, SE_NecPet))) { //bypass reagent cost - } + } else if(c->GetInv().HasItem(component, component_count, invWhereWorn|invWherePersonal) == -1) // item not found { if (!missingreags) @@ -1421,7 +1421,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo Client *c = CastToClient(); if((IsFromItem && RuleB(Character, SkillUpFromItems)) || !IsFromItem) { c->CheckSongSkillIncrease(spell_id); - } + } if (spells[spell_id].EndurTimerIndex > 0 && slot < CastingSlot::MaxGems) c->SetLinkedSpellReuseTimer(spells[spell_id].EndurTimerIndex, spells[spell_id].recast_time / 1000); c->MemorizeSpell(static_cast(slot), spell_id, memSpellSpellbar); @@ -2049,14 +2049,14 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui //Death Touch targets the pet owner instead of the pet when said pet is tanking. if ((RuleB(Spells, CazicTouchTargetsPetOwner) && spell_target && spell_target->HasOwner()) && spell_id == DB_SPELL_CAZIC_TOUCH || spell_id == DB_SPELL_TOUCH_OF_VINITRAS) { Mob* owner = spell_target->GetOwner(); - + if (owner) { spell_target = owner; } } - + //Guard Assist Code - if (RuleB(Character, PVPEnableGuardFactionAssist) && IsDetrimentalSpell(spell_id) && spell_target != this) { + if (RuleB(Character, PVPEnableGuardFactionAssist) && spell_target && IsDetrimentalSpell(spell_id) && spell_target != this) { if (IsClient() || (HasOwner() && GetOwner()->IsClient())) { auto& mob_list = entity_list.GetCloseMobList(spell_target); for (auto& e : mob_list) { @@ -3430,7 +3430,7 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite) firstfree = i; } if(ret == -1) { - + LogAI("Buff [{}] would conflict with [{}] in slot [{}], reporting stack failure", spellid, curbuf.spellid, i); return -1; // stop the spell, can't stack it } @@ -3565,7 +3565,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r spelltar, /* Sender */ action_packet, /* Packet */ true, /* Ignore Sender */ - RuleI(Range, SpellMessages), + RuleI(Range, SpellMessages), this, /* Skip this Mob */ true, /* Packet ACK */ (spelltar->IsClient() ? FilterPCSpells : FilterNPCSpells) /* EQ Filter Type: (8 or 9) */ @@ -3908,7 +3908,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r spelltar->CastToClient()->BreakSneakWhenCastOn(this, true); spelltar->CastToClient()->BreakFeignDeathWhenCastOn(true); } - + spelltar->CheckNumHitsRemaining(NumHit::IncomingSpells); CheckNumHitsRemaining(NumHit::OutgoingSpells); @@ -4024,7 +4024,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r spelltar, /* Sender */ message_packet, /* Packet */ false, /* Ignore Sender */ - RuleI(Range, SpellMessages), + RuleI(Range, SpellMessages), 0, /* Skip this mob */ true, /* Packet ACK */ (spelltar->IsClient() ? FilterPCSpells : FilterNPCSpells) /* Message Filter Type: (8 or 9) */ @@ -4098,17 +4098,17 @@ bool Mob::FindBuff(uint16 spellid) uint16 Mob::FindBuffBySlot(int slot) { if (buffs[slot].spellid != SPELL_UNKNOWN) return buffs[slot].spellid; - + return 0; } uint32 Mob::BuffCount() { uint32 active_buff_count = 0; int buff_count = GetMaxTotalSlots(); - for (int i = 0; i < buff_count; i++) + for (int i = 0; i < buff_count; i++) if (buffs[i].spellid != SPELL_UNKNOWN) active_buff_count++; - + return active_buff_count; } @@ -5023,7 +5023,7 @@ void Mob::Mesmerize() if (spell_id) InterruptSpell(spell_id); - + StopNavigation(); } @@ -5141,7 +5141,7 @@ uint32 Client::GetSpellIDByBookSlot(int book_slot) { uint16 Client::FindMemmedSpellBySlot(int slot) { if (m_pp.mem_spells[slot] != 0xFFFFFFFF) return m_pp.mem_spells[slot]; - + return 0; } @@ -5150,7 +5150,7 @@ int Client::MemmedCount() { for (int i = 0; i < EQ::spells::SPELL_GEM_COUNT; i++) if (m_pp.mem_spells[i] != 0xFFFFFFFF) memmed_count++; - + return memmed_count; } @@ -5328,7 +5328,7 @@ bool Client::SpellBucketCheck(uint16 spell_id, uint32 char_id) { if (results.RowCount() != 1) return true; - + auto row = results.begin(); spell_bucket_name = row[0]; spell_bucket_value = atoi(row[1]);