From 65197ac027c1f4941e46f103bed86fd46da69736 Mon Sep 17 00:00:00 2001 From: cybernine186 <91032199+cybernine186@users.noreply.github.com> Date: Thu, 11 Nov 2021 20:41:03 -0500 Subject: [PATCH] [Rules] Gate /tgb, /autofire and /melody (#1679) * Rules to negate /tgb, /autofire, and /melody Created new rules to negate server and client side effects of commands: /tgb, /autofire, and /melody. These commands are enabled by default and can be disabled to enforce a classic EQ experience if using progression style play for example. Rules -------------- RULE_BOOL(Character, EnableBardMelody, true, "Enable Bard /melody by default, to disable change to false for a classic experience.") RULE_BOOL(Character, EnableRangerAutoFire, true, "Enable Ranger /autofire by default, to disable change to false for a classic experience.") RULE_BOOL(Character, EnableTGB, true, "Enable /tgb (Target Group Buff) by default, to disable change to false for a classic experience.") * Removed sql query for rules per Mackal recommendation. --- common/ruletypes.h | 3 +++ zone/client_packet.cpp | 3 +++ zone/client_process.cpp | 5 +++++ zone/spells.cpp | 3 ++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 2def8abb8..3ee4b49c8 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -171,6 +171,9 @@ RULE_BOOL(Character, EnableTestBuff, false, "Allow the use of /testbuff") RULE_BOOL(Character, UseResurrectionSickness, true, "Use Resurrection Sickness based on Resurrection spell cast, set to false to disable Resurrection Sickness.") RULE_INT(Character, OldResurrectionSicknessSpellID, 757, "757 is Default Old Resurrection Sickness Spell ID") RULE_INT(Character, ResurrectionSicknessSpellID, 756, "756 is Default Resurrection Sickness Spell ID") +RULE_BOOL(Character, EnableBardMelody, true, "Enable Bard /melody by default, to disable change to false for a classic experience.") +RULE_BOOL(Character, EnableRangerAutoFire, true, "Enable Ranger /autofire by default, to disable change to false for a classic experience.") +RULE_BOOL(Character, EnableTGB, true, "Enable /tgb (Target Group Buff) by default, to disable change to false for a classic experience.") RULE_CATEGORY_END() RULE_CATEGORY(Mercs) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 6fa07623f..2372dd31c 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3388,6 +3388,9 @@ void Client::Handle_OP_AutoFire(const EQApplicationPacket *app) } bool *af = (bool*)app->pBuffer; auto_fire = *af; + if(!RuleB(Character, EnableRangerAutoFire)) + auto_fire = false; + auto_attack = false; SetAttackTimer(); } diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 97dfdb012..d4108a819 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1026,6 +1026,11 @@ void Client::OPTGB(const EQApplicationPacket *app) { if(!app) return; if(!app->pBuffer) return; + + if(!RuleB(Character, EnableTGB)) + { + return; + } uint32 tgb_flag = *(uint32 *)app->pBuffer; if(tgb_flag == 2) diff --git a/zone/spells.cpp b/zone/spells.cpp index 386963949..73b9b49bc 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -1479,7 +1479,8 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo } if (spells[spell_id].timer_id > 0 && slot < CastingSlot::MaxGems) c->SetLinkedSpellReuseTimer(spells[spell_id].timer_id, spells[spell_id].recast_time / 1000); - c->MemorizeSpell(static_cast(slot), spell_id, memSpellSpellbar); + if(RuleB(Spells, EnableBardMelody)) + c->MemorizeSpell(static_cast(slot), spell_id, memSpellSpellbar); } LogSpells("Bard song [{}] should be started", spell_id); }