diff --git a/src/server/game/DataStores/DB2Stores.h b/src/server/game/DataStores/DB2Stores.h index b6ebb899e2..5be5912667 100644 --- a/src/server/game/DataStores/DB2Stores.h +++ b/src/server/game/DataStores/DB2Stores.h @@ -97,6 +97,7 @@ TC_GAME_API extern DB2Storage sCriteriaSto TC_GAME_API extern DB2Storage sCriteriaTreeStore; TC_GAME_API extern DB2Storage sCurrencyTypesStore; TC_GAME_API extern DB2Storage sCurveStore; +TC_GAME_API extern DB2Storage sCurvePointStore; TC_GAME_API extern DB2Storage sDestructibleModelDataStore; TC_GAME_API extern DB2Storage sDifficultyStore; TC_GAME_API extern DB2Storage sDungeonEncounterStore; diff --git a/src/server/game/Spells/ClassicVanillaAoe.h b/src/server/game/Spells/ClassicVanillaAoe.h new file mode 100644 index 0000000000..d3d41f4d7d --- /dev/null +++ b/src/server/game/Spells/ClassicVanillaAoe.h @@ -0,0 +1,88 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef TRINITY_CLASSIC_VANILLA_AOE_H +#define TRINITY_CLASSIC_VANILLA_AOE_H + +#include + +// Forever.VanillaAoE (worldserver.conf, default 0 = the WoW Forever spells): puts the two AoE spells WoW Forever reworked back to +// vanilla 1.12. +// +// Consecration. Forever (client 70790 / 70938): every rank casts a tick spell once a second for 8 sec. Effect 0 of the tick is a +// small hit with no spell power (rank 1: 2), effect 1 is the bigger hit with the spell power (rank 1: 4, coefficient 0.042), and the +// text says only "the first $s3" (4) enemies take effect 1. Vanilla (VMaNGOS spell_template): one hit a second on every enemy in +// it, base points + 1d1 (rank 1: 7 + 1 = 8, 64 over 8 sec), about 33% spell power over the 8 ticks (0.042 a tick, as Forever's +// effect 1). With the switch on, the tick casts effect 0 for 0 and effect 1 for the vanilla tick, so the spell power stays on. +// Mana is vanilla already (SpellPower.db2: 135 / 235 / 320 / 435 / 565). +// +// Improved Blizzard (talent 11185, 3 ranks through curve 83071): Forever chills 15 / 25 / 40%, vanilla 30 / 50 / 65% (12484 / +// 12485 / 12486), 1.5 sec in both. +// +// Pure: no game types, so tests/game/ClassicVanillaAoe.cpp can check it. +namespace ClassicVanillaAoe +{ + struct ConsecrationRank + { + uint32_t RankSpell; // the spell the paladin casts + uint32_t TickSpell; // what each 1 sec tick casts at the consecrated spot + uint32_t TickEffect0Id; // SpellEffect.db2 row of the tick's effect 0 (the hit every enemy takes) + uint32_t TickEffect1Id; // SpellEffect.db2 row of the tick's effect 1 (the "first 4" hit) + int32_t VanillaTick; // vanilla damage a tick before spell power (VMaNGOS base points + 1d1) + }; + + inline constexpr ConsecrationRank ConsecrationRanks[] = + { + { 26573, 1280345, 1293268, 1330578, 8 }, // rank 1, level 20: 64 over 8 sec + { 20116, 1280346, 1293269, 1330580, 15 }, // rank 2, level 30: 120 + { 20922, 1280347, 1293270, 1330583, 24 }, // rank 3, level 40: 192 + { 20923, 1280348, 1293271, 1330584, 35 }, // rank 4, level 50: 280 + { 20924, 1280349, 1293272, 1330586, 48 }, // rank 5, level 60: 384 + }; + + inline constexpr ConsecrationRank const* FindConsecrationRank(uint32_t rankSpell) + { + for (ConsecrationRank const& rank : ConsecrationRanks) + if (rank.RankSpell == rankSpell) + return &rank; + return nullptr; + } + + // The tick spell of a Consecration rank, 0 when the spell is not one. + inline constexpr uint32_t ConsecrationTickSpell(uint32_t rankSpell) + { + ConsecrationRank const* rank = FindConsecrationRank(rankSpell); + return rank ? rank->TickSpell : 0; + } + + // Improved Blizzard talent rows (curve 83071, CurvePoint.db2): rank 1, 2, 3. + inline constexpr uint32_t ImprovedBlizzardCurvePoints[] = { 241076, 241077, 241078 }; + inline constexpr int32_t ImprovedBlizzardForever[] = { -15, -25, -40 }; + inline constexpr int32_t ImprovedBlizzardVanilla[] = { -30, -50, -65 }; + + // The chill (a negative speed percent) for the talent amount the player has. A Forever rank amount becomes the vanilla one of + // the same rank; anything else (a vanilla amount already, a changed curve) stays as it is. + inline constexpr int32_t ImprovedBlizzardChill(int32_t talentAmount) + { + for (int i = 0; i < 3; ++i) + if (talentAmount == ImprovedBlizzardForever[i]) + return ImprovedBlizzardVanilla[i]; + return talentAmount; + } +} + +#endif // TRINITY_CLASSIC_VANILLA_AOE_H diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index e99fabc471..0d547adb24 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -20,6 +20,7 @@ #include "BattlefieldMgr.h" #include "BattlegroundMgr.h" #include "Chat.h" +#include "ClassicVanillaAoe.h" #include "DB2HotfixGenerator.h" #include "DB2Stores.h" #include "DatabaseEnv.h" @@ -34,6 +35,7 @@ #include "SpellAuraDefines.h" #include "SpellInfo.h" #include "StringConvert.h" +#include "World.h" #include #include #include @@ -3755,6 +3757,60 @@ ClassicSpellValue::Cost const* SpellMgr::GetClassicSpellCost(uint32 spellId) con return Trinity::Containers::MapGetValuePtr(mClassicSpellCosts, spellId); } +// Forever.VanillaAoE = 1: the vanilla Consecration and Improved Blizzard (ClassicVanillaAoe.h). The spell scripts do the +// damage and the chill; here the client gets the same numbers for its tooltips. Only the client's copy of these rows changes: the +// server's spells were built from the DB2 before this runs, and the talent curve is read from DB2Manager's own copy. +// - Consecration tick effect 0 shows the vanilla tick (rank 1: 8 a tick, "64 Holy damage over 8 sec"), effect 1 shows 0. +// - The five SpellPower rows are sent unchanged, so a client holding Blizzard's live cache (73 mana for rank 1) shows the 135 the +// server charges. +// - Improved Blizzard curve 83071 shows 30 / 50 / 65%. +void SpellMgr::LoadForeverVanillaAoe() +{ + if (!sWorld->getBoolConfig(CONFIG_FOREVER_VANILLA_AOE)) + return; + + uint32 sent = 0; + for (ClassicVanillaAoe::ConsecrationRank const& rank : ClassicVanillaAoe::ConsecrationRanks) + { + if (SpellEffectEntry const* effect = sSpellEffectStore.LookupEntry(rank.TickEffect0Id)) + { + const_cast(effect)->EffectBasePoints = float(rank.VanillaTick); + DB2HotfixGeneratorBase::AddClientHotfix(sSpellEffectStore.GetTableHash(), effect->ID); + ++sent; + } + + if (SpellEffectEntry const* effect = sSpellEffectStore.LookupEntry(rank.TickEffect1Id)) + { + const_cast(effect)->EffectBasePoints = 0.0f; + DB2HotfixGeneratorBase::AddClientHotfix(sSpellEffectStore.GetTableHash(), effect->ID); + ++sent; + } + + if (SpellInfo const* spellInfo = GetSpellInfo(rank.RankSpell, DIFFICULTY_NONE)) + { + for (SpellPowerEntry const* power : spellInfo->PowerCosts) + { + if (!power) + continue; + DB2HotfixGeneratorBase::AddClientHotfix(sSpellPowerStore.GetTableHash(), power->ID); + ++sent; + } + } + } + + for (std::size_t i = 0; i < std::size(ClassicVanillaAoe::ImprovedBlizzardCurvePoints); ++i) + { + if (CurvePointEntry const* point = sCurvePointStore.LookupEntry(ClassicVanillaAoe::ImprovedBlizzardCurvePoints[i])) + { + const_cast(point)->Pos.Y = float(ClassicVanillaAoe::ImprovedBlizzardVanilla[i]); + DB2HotfixGeneratorBase::AddClientHotfix(sCurvePointStore.GetTableHash(), point->ID); + ++sent; + } + } + + TC_LOG_INFO("server.loading", ">> Forever.VanillaAoE = 1: vanilla Consecration and Improved Blizzard ({} client rows sent)", sent); +} + // Classic 1.60 (Forever): the bundles a labeled Waylaid Crate takes. The client lists them only in the Stock Crate spell's text // ("$M3 Peacebloom ...") with the counts in its dummy effects, and offers the materials of its ItemSalvage list; the server needs // the pairs, so classic_crate_bundle holds them (one row per material, made from the client data). diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index 53050a0ba7..43a7b62db2 100644 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -800,6 +800,7 @@ class TC_GAME_API SpellMgr void LoadClassicTwinChannels(); // must be after LoadClassicSpellInfo (table classic_spell_twin: a twin of a channeled vanilla spell is channeled too) void LoadClassicSpellValues(); // must be after LoadSpellInfoStore void LoadClassicSpellCosts(); // must be after LoadSpellInfoStore + void LoadForeverVanillaAoe(); // after LoadClassicSpellCosts; Forever.VanillaAoE tooltips void LoadClassicCrateBundles(); // must be after LoadSpellInfoStore and LoadItemTemplates void LoadSpellInfoSpellSpecificAndAuraState(); void LoadSpellInfoDiminishing(); diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 82a25de3d1..ebf18aa5e9 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -712,6 +712,7 @@ void World::LoadConfigSettings(bool reload) { .Name = "Classic.ForeverKillXp"sv, .DefaultValue = false, .Index = CONFIG_CLASSIC_FOREVER_KILL_XP }, { .Name = "Classic.AutoEquipNewBags"sv, .DefaultValue = false, .Index = CONFIG_CLASSIC_AUTO_EQUIP_NEW_BAGS }, { .Name = "Classic.CreatureHealth.Raids"sv, .DefaultValue = false, .Index = CONFIG_CLASSIC_CREATURE_HEALTH_RAIDS }, + { .Name = "Forever.VanillaAoE"sv, .DefaultValue = false, .Index = CONFIG_FOREVER_VANILLA_AOE }, } }; static constexpr ConfigOptionLoadDefinitionArray ints = @@ -1462,6 +1463,7 @@ bool World::SetInitialWorldSettings() sSpellMgr->LoadClassicSpellEffects(); sSpellMgr->LoadClassicSpellValues(); sSpellMgr->LoadClassicSpellCosts(); + sSpellMgr->LoadForeverVanillaAoe(); TC_LOG_INFO("server.loading", "Loading SkillLineAbilityMultiMap Data..."); sSpellMgr->LoadSkillLineAbilityMap(); diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 607a45d55a..dbd6c248f9 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -214,6 +214,7 @@ enum WorldBoolConfigs : uint32 CONFIG_CLASSIC_FOREVER_KILL_XP, CONFIG_CLASSIC_AUTO_EQUIP_NEW_BAGS, CONFIG_CLASSIC_CREATURE_HEALTH_RAIDS, + CONFIG_FOREVER_VANILLA_AOE, BOOL_CONFIG_VALUE_COUNT }; diff --git a/src/server/scripts/Custom/Classic/world/classic_spell_scripts.cpp b/src/server/scripts/Custom/Classic/world/classic_spell_scripts.cpp index f31f410584..53f5bd6190 100644 --- a/src/server/scripts/Custom/Classic/world/classic_spell_scripts.cpp +++ b/src/server/scripts/Custom/Classic/world/classic_spell_scripts.cpp @@ -21,6 +21,7 @@ #include "AreaTrigger.h" #include "CellImpl.h" #include "ClassicLegacyPerks.h" +#include "ClassicVanillaAoe.h" #include "Creature.h" #include "CreatureAI.h" #include "ConditionMgr.h" @@ -48,6 +49,7 @@ #include "SpellScript.h" #include "ThreatManager.h" #include "Unit.h" +#include "World.h" #include "WorldSession.h" #include #include @@ -1528,19 +1530,13 @@ class classic_spell_pal_judgement_of_fury : public SpellScript // 26573, 20116, 20922, 20923, 20924 - Consecration (Classic 1.60, official dungeon sniff): the cast puts a 1 sec periodic dummy on the // paladin for 8 sec and creates area trigger 41311-41316 at his feet (no data on our server); each tick the official server casts the // rank's Consecration damage (1280345-1280349) at the consecrated spot, hitting the enemies standing in it. +// Forever.VanillaAoE = 1: each tick does the vanilla damage instead (ClassicVanillaAoe.h): effect 0 for 0, effect 1 (the one with +// the spell power) for the vanilla tick, on every enemy in it. class classic_spell_pal_consecration : public AuraScript { static uint32 TickSpell(uint32 spellId) { - switch (spellId) - { - case 26573: return 1280345; - case 20116: return 1280346; - case 20922: return 1280347; - case 20923: return 1280348; - case 20924: return 1280349; - default: return 0; - } + return ClassicVanillaAoe::ConsecrationTickSpell(spellId); } bool Validate(SpellInfo const* spellInfo) override @@ -1557,7 +1553,16 @@ class classic_spell_pal_consecration : public AuraScript { PreventDefaultAction(); Unit* paladin = GetUnitOwner(); - paladin->CastSpell(_center, TickSpell(GetId()), CastSpellExtraArgs(aurEff)); + CastSpellExtraArgs args(aurEff); + if (sWorld->getBoolConfig(CONFIG_FOREVER_VANILLA_AOE)) + { + if (ClassicVanillaAoe::ConsecrationRank const* rank = ClassicVanillaAoe::FindConsecrationRank(GetId())) + { + args.AddSpellMod(SPELLVALUE_BASE_POINT0, 0); + args.AddSpellMod(SPELLVALUE_BASE_POINT1, rank->VanillaTick); + } + } + paladin->CastSpell(_center, TickSpell(GetId()), args); } void Register() override diff --git a/src/server/scripts/Custom/Classic/world/talents/classic_talents_mage_shaman.cpp b/src/server/scripts/Custom/Classic/world/talents/classic_talents_mage_shaman.cpp index 51f10fac95..70f7195b32 100644 --- a/src/server/scripts/Custom/Classic/world/talents/classic_talents_mage_shaman.cpp +++ b/src/server/scripts/Custom/Classic/world/talents/classic_talents_mage_shaman.cpp @@ -22,6 +22,7 @@ #include "ScriptMgr.h" #include "AreaTrigger.h" #include "CellImpl.h" +#include "ClassicVanillaAoe.h" #include "Creature.h" #include "Item.h" #include "ItemTemplate.h" @@ -37,6 +38,7 @@ #include "SpellMgr.h" #include "SpellScript.h" #include "Unit.h" +#include "World.h" #include enum ClassicMageTalentSpells @@ -291,7 +293,7 @@ class classic_spell_mage_fingers_of_frost : public AuraScript // 11185 - Improved Blizzard: "Adds a Chill effect to your Blizzard spell. This effect lowers the target's movement speed by 40% // for 1.5 sec." Blizzard (10, 6141, 8427, 10185-10187) ticks through classic_spell_ground_area_damage; this second script on the // same tick chills the enemies inside the Blizzard with 12484 (talent amount as the snare), which is a Chill effect for Fingers -// of Frost. +// of Frost. Forever ranks chill 15 / 25 / 40%; Forever.VanillaAoE = 1 chills the vanilla 30 / 50 / 65% (ClassicVanillaAoe.h). class classic_spell_mage_improved_blizzard : public AuraScript { bool Validate(SpellInfo const* /*spellInfo*/) override @@ -309,6 +311,10 @@ class classic_spell_mage_improved_blizzard : public AuraScript if (!talent || talent->GetAmount() >= 0) return; + int32 chill = talent->GetAmountAsInt(); + if (sWorld->getBoolConfig(CONFIG_FOREVER_VANILLA_AOE)) + chill = ClassicVanillaAoe::ImprovedBlizzardChill(chill); + SpellInfo const* spellInfo = GetSpellInfo(); GuidUnorderedSet targets; for (AreaTrigger* areaTrigger : caster->GetAreaTriggers(spellInfo->Id)) @@ -321,7 +327,7 @@ class classic_spell_mage_improved_blizzard : public AuraScript if (!target || !target->IsAlive() || !caster->IsValidAttackTarget(target, spellInfo)) continue; - caster->CastSpell(target, SPELL_MAGE_CHILLED, CastSpellExtraArgs(TRIGGERED_FULL_MASK).AddSpellBP0(talent->GetAmount())); + caster->CastSpell(target, SPELL_MAGE_CHILLED, CastSpellExtraArgs(TRIGGERED_FULL_MASK).AddSpellBP0(chill)); chilled = true; } diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 2217d7feee..9cc05b3dea 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -5170,6 +5170,17 @@ Classic.CreatureHealth.RaiseFromLevel = 20 Classic.CreatureHealth.RaiseAt60Pct = 20 Classic.CreatureHealth.Raids = 0 +# Forever.VanillaAoE +# Description: Puts the two AoE spells WoW Forever reworked back to vanilla 1.12. +# Consecration: every enemy in it takes the vanilla damage each second (rank 1: 64 over 8 sec, rank 5: +# 384) with about 33% spell power, instead of Forever's small hit plus an extra hit. +# Improved Blizzard: the Chill slows by 30 / 50 / 65% (rank 1 / 2 / 3) instead of 15 / 25 / 40%. +# Players' tooltips show the vanilla numbers too (sent at login). Needs a restart. +# Default: 0 - (Disabled, the WoW Forever spells) +# 1 - (Enabled, vanilla) + +Forever.VanillaAoE = 0 + # Classic.AutoEquipNewBags # Description: A new bag goes straight onto an empty bag slot. WoW Forever stopped this: new bags go into the # backpack and the player puts them on by hand. Bots always put new bags on. diff --git a/tests/game/ClassicVanillaAoe.cpp b/tests/game/ClassicVanillaAoe.cpp new file mode 100644 index 0000000000..598836ee7d --- /dev/null +++ b/tests/game/ClassicVanillaAoe.cpp @@ -0,0 +1,57 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "tc_catch2.h" + +#include "../../src/server/game/Spells/ClassicVanillaAoe.h" +#include + +using namespace ClassicVanillaAoe; + +TEST_CASE("Consecration ranks map to their tick spells as before", "[ClassicVanillaAoe]") +{ + CHECK(ConsecrationTickSpell(26573) == 1280345); + CHECK(ConsecrationTickSpell(20116) == 1280346); + CHECK(ConsecrationTickSpell(20922) == 1280347); + CHECK(ConsecrationTickSpell(20923) == 1280348); + CHECK(ConsecrationTickSpell(20924) == 1280349); + CHECK(ConsecrationTickSpell(10) == 0); // Blizzard is not a Consecration + CHECK(FindConsecrationRank(1280345) == nullptr); // a tick spell is not a rank +} + +TEST_CASE("Vanilla Consecration does 64 / 120 / 192 / 280 / 384 over its 8 ticks", "[ClassicVanillaAoe]") +{ + int32_t const totals[] = { 64, 120, 192, 280, 384 }; + for (std::size_t i = 0; i < std::size(ConsecrationRanks); ++i) + CHECK(ConsecrationRanks[i].VanillaTick * 8 == totals[i]); +} + +TEST_CASE("Improved Blizzard chills 30 / 50 / 65% instead of 15 / 25 / 40%", "[ClassicVanillaAoe]") +{ + CHECK(ImprovedBlizzardChill(-15) == -30); + CHECK(ImprovedBlizzardChill(-25) == -50); + CHECK(ImprovedBlizzardChill(-40) == -65); +} + +TEST_CASE("Improved Blizzard leaves an amount that is not a Forever rank alone", "[ClassicVanillaAoe]") +{ + // already vanilla (a second pass, or a curve someone changed by hand) must not be pushed further + CHECK(ImprovedBlizzardChill(-30) == -30); + CHECK(ImprovedBlizzardChill(-50) == -50); + CHECK(ImprovedBlizzardChill(-65) == -65); + CHECK(ImprovedBlizzardChill(0) == 0); +}