[Bug Fix] TGB - Added logic to stop bard errors on group songs. (#3906)

* [Bug Fix] TGB - Added logic to stop bard errors on group songs.

Occasionally bards would get an error when singing songs with another group member targetted.

* Logic Fix

* Fixed missing brace
This commit is contained in:
Fryguy 2024-01-08 02:27:45 -05:00 committed by GitHub
parent 47e2eb0acf
commit b2d5007466
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2620,21 +2620,21 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, in
case GroupSpell: case GroupSpell:
{ {
if (IsBot()) { if (IsBot()) {
bool StopLogic = false; bool stop_logic = false;
if(!CastToBot()->DoFinishedSpellGroupTarget(spell_id, spell_target, slot, StopLogic)) if (!CastToBot()->DoFinishedSpellGroupTarget(spell_id, spell_target, slot, stop_logic)) {
return false; return false;
if(StopLogic) }
if(stop_logic) {
break; break;
} }
}
// We hold off turning MBG off so we can still use it to calc the mana cost // We hold off turning MBG off so we can still use it to calc the mana cost
if(spells[spell_id].can_mgb && HasMGB()) if (spells[spell_id].can_mgb && HasMGB()) {
{
SpellOnTarget(spell_id, this); SpellOnTarget(spell_id, this);
entity_list.MassGroupBuff(this, this, spell_id, true); entity_list.MassGroupBuff(this, this, spell_id, true);
} } else {
else
{
// at this point spell_target is a member of the other group, or the // at this point spell_target is a member of the other group, or the
// caster if they're not using TGB // caster if they're not using TGB
// NOTE: this will always hit the caster, plus the target's group so // NOTE: this will always hit the caster, plus the target's group so
@ -2644,32 +2644,31 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, in
if (spell_target->IsPetOwnerClient() && IsPetOwnerClient()) { if (spell_target->IsPetOwnerClient() && IsPetOwnerClient()) {
Mob* owner = spell_target->GetOwner(); Mob* owner = spell_target->GetOwner();
if (owner) if (owner) {
spell_target = owner; spell_target = owner;
} }
}
if(spell_target->IsGrouped()) if (spell_target->IsGrouped()) {
{
Group *target_group = entity_list.GetGroupByMob(spell_target); Group *target_group = entity_list.GetGroupByMob(spell_target);
if(target_group) if (target_group) {
{
target_group->CastGroupSpell(this, spell_id); target_group->CastGroupSpell(this, spell_id);
if (GetClass() != Class::Bard) {
SpellOnTarget(spell_id, this);
} }
} }
else if(spell_target->IsRaidGrouped() && spell_target->IsClient()) } else if (spell_target->IsRaidGrouped() && spell_target->IsClient()) {
{
Raid *target_raid = entity_list.GetRaidByClient(spell_target->CastToClient()); Raid *target_raid = entity_list.GetRaidByClient(spell_target->CastToClient());
uint32 gid = 0xFFFFFFFF; uint32 gid = 0xFFFFFFFF;
if (target_raid) { if (target_raid) {
gid = target_raid->GetGroup(spell_target->GetName()); gid = target_raid->GetGroup(spell_target->GetName());
if(gid < 12) if (gid < 12) {
target_raid->CastGroupSpell(this, spell_id, gid); target_raid->CastGroupSpell(this, spell_id, gid);
else } else {
SpellOnTarget(spell_id, spell_target); SpellOnTarget(spell_id, spell_target);
} }
} }
else } else {
{
// if target is grouped, CastGroupSpell will cast it on the caster // if target is grouped, CastGroupSpell will cast it on the caster
// too, but if not then we have to do that here. // too, but if not then we have to do that here.
@ -2677,16 +2676,18 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, in
SpellOnTarget(spell_id, this); SpellOnTarget(spell_id, this);
#ifdef GROUP_BUFF_PETS #ifdef GROUP_BUFF_PETS
//pet too //pet too
if (spells[spell_id].target_type != ST_GroupNoPets && GetPet() && HasPetAffinity() && !GetPet()->IsCharmed()) if (spells[spell_id].target_type != ST_GroupNoPets && GetPet() && HasPetAffinity() && !GetPet()->IsCharmed()) {
SpellOnTarget(spell_id, GetPet()); SpellOnTarget(spell_id, GetPet());
}
#endif #endif
} }
SpellOnTarget(spell_id, spell_target); SpellOnTarget(spell_id, spell_target);
#ifdef GROUP_BUFF_PETS #ifdef GROUP_BUFF_PETS
//pet too //pet too
if (spells[spell_id].target_type != ST_GroupNoPets && spell_target->GetPet() && spell_target->HasPetAffinity() && !spell_target->GetPet()->IsCharmed()) if (spells[spell_id].target_type != ST_GroupNoPets && spell_target->GetPet() && spell_target->HasPetAffinity() && !spell_target->GetPet()->IsCharmed()) {
SpellOnTarget(spell_id, spell_target->GetPet()); SpellOnTarget(spell_id, spell_target->GetPet());
}
#endif #endif
} }
} }