diff --git a/sql/migrations/20250408123201_world.sql b/sql/migrations/20250408123201_world.sql new file mode 100644 index 000000000..13d2dfb0b --- /dev/null +++ b/sql/migrations/20250408123201_world.sql @@ -0,0 +1,25 @@ +DROP PROCEDURE IF EXISTS add_migration; +DELIMITER ?? +CREATE PROCEDURE `add_migration`() +BEGIN +DECLARE v INT DEFAULT 1; +SET v = (SELECT COUNT(*) FROM `migrations` WHERE `id`='20250408123201'); +IF v = 0 THEN +INSERT INTO `migrations` VALUES ('20250408123201'); +-- Add your query below. + + +UPDATE `spell_template` SET `script_name`='spell_warlock_inferno' WHERE `entry` IN (1122, 24670); +UPDATE `spell_template` SET `script_name`='spell_thaddius_magnetic_pull' WHERE `entry`=28337; +UPDATE `spell_template` SET `script_name`='spell_maexxna_spider_web' WHERE `entry`=28434; +UPDATE `spell_template` SET `script_name`='spell_paladin_reckoning' WHERE `entry`=20178; +UPDATE `spell_template` SET `script_name`='spell_goblin_jumper_cables' WHERE `entry`=8342; +UPDATE `spell_template` SET `script_name`='spell_goblin_jumper_cables_xl' WHERE `entry`=22999; + + +-- End of migration. +END IF; +END?? +DELIMITER ; +CALL add_migration(); +DROP PROCEDURE IF EXISTS add_migration; diff --git a/src/game/Spells/SpellEffects.cpp b/src/game/Spells/SpellEffects.cpp index 396dd3cd6..acd0e779c 100644 --- a/src/game/Spells/SpellEffects.cpp +++ b/src/game/Spells/SpellEffects.cpp @@ -5296,30 +5296,6 @@ void Spell::EffectResurrect(SpellEffectIndex effIdx) if (!unitTarget->IsInWorld()) return; - switch (m_spellInfo->Id) - { - // Defibrillate (Goblin Jumper Cables) have 33% chance on success - case 8342: - if (roll_chance_i(67)) - { - if (m_casterUnit) - m_casterUnit->CastSpell(m_casterUnit, 8338, true, m_CastItem); - return; - } - break; - // Defibrillate (Goblin Jumper Cables XL) have 50% chance on success - case 22999: - if (roll_chance_i(50)) - { - if (m_casterUnit) - m_casterUnit->CastSpell(m_casterUnit, 23055, true, m_CastItem); - return; - } - break; - default: - break; - } - Player* pTarget = ((Player*)unitTarget); if (pTarget->IsRessurectRequested()) // already have one active request @@ -5342,16 +5318,17 @@ void Spell::EffectAddExtraAttacks(SpellEffectIndex effIdx) if (!unitTarget->IsAlive() || unitTarget->IsExtraAttacksLocked()) return; - if (m_spellInfo->Id == 20178) // Reckoning - { - if (unitTarget->GetExtraAttacks() < 4) - unitTarget->AddExtraAttack(); - return; - } - if (unitTarget->GetExtraAttacks()) return; + // World of Warcraft Client Patch 1.3.0 (2005-03-22) + // - Fixed a bug where abilities that give extra attacks, like the paladin + // Reckoning talent, could cause the following swing to take longer than + // it should. +#if SUPPORTED_CLIENT_BUILD <= CLIENT_BUILD_1_2_4 + unitTarget->ResetAttackTimer(); +#endif + unitTarget->AddExtraAttackOnUpdate(); unitTarget->SetExtraAttaks(damage); @@ -5580,43 +5557,11 @@ void Spell::EffectPlayerPull(SpellEffectIndex effIdx) if (!unitTarget) return; - switch (m_spellInfo->Id) - { - case 28337: // thaddius Magnetic Pull - { - float speedXY = float(m_spellInfo->EffectMiscValue[effIdx]) * 0.1f; - float speedZ = unitTarget->GetDistance(m_caster) / speedXY * 0.5f * 20.0f; - unitTarget->KnockBackFrom(m_caster, -speedXY, speedZ); - break; - } - case 28434: // Spider Web - { - // see boss_maexxnaAI::DoCastWebWrap() for some info on this rather weird implementation - float dx = unitTarget->GetPositionX() - m_caster->GetPositionX(); - float dy = unitTarget->GetPositionY() - m_caster->GetPositionY(); - float dist = sqrt((dx * dx) + (dy * dy)); - float yDist = m_caster->GetPositionZ() - unitTarget->GetPositionZ(); - float horizontalSpeed = dist / 1.5f; - float verticalSpeed = 12.0f + (yDist*0.5f); - float angle = unitTarget->GetAngle(m_caster->GetPositionX(), m_caster->GetPositionY()); - - // set immune anticheat and calculate speed - if (Player* plr = unitTarget->ToPlayer()) - plr->SetLaunched(true); - - unitTarget->KnockBack(angle, horizontalSpeed, verticalSpeed); - break; - } - default: - { - // Todo: this implementation seems very wrong. Gives terrible results for maexxna web-wrap and - // thaddius magnetic pull - float dist = unitTarget->GetDistance2d(m_caster); - if (damage && dist > damage) - dist = damage; - unitTarget->KnockBackFrom(m_caster, -dist, float(m_spellInfo->EffectMiscValue[effIdx]) / 10); - } - } + // Todo: this implementation seems very wrong. Gives terrible results for maexxna web-wrap and thaddius magnetic pull + float dist = unitTarget->GetDistance2d(m_caster); + if (damage && dist > damage) + dist = damage; + unitTarget->KnockBackFrom(m_caster, -dist, float(m_spellInfo->EffectMiscValue[effIdx]) / 10); } void Spell::EffectDispelMechanic(SpellEffectIndex effIdx) @@ -5927,20 +5872,6 @@ void Spell::EffectSummonDemon(SpellEffectIndex effIdx) // might not always work correctly, maybe the creature that dies from CoD casts the effect on itself and is therefore the caster? pSummon->SetLevel(m_caster->GetLevel()); - // TODO: Add damage/mana/hp according to level - - if (m_spellInfo->EffectMiscValue[effIdx] == 89) // Inferno summon - { - // Enslave demon effect, without mana cost and cooldown - m_caster->CastSpell(pSummon, 20882, true); // FIXME: enslave does not scale with level, level 62+ minions cannot be enslaved - - // Short root spell on infernal from sniffs - pSummon->CastSpell(pSummon, 22707, true); - - // Inferno effect - pSummon->CastSpell(pSummon, 22703, true); - } - AddExecuteLogInfo(effIdx, ExecuteLogInfo(pSummon->GetObjectGuid())); if (m_spellScript) diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_maexxna.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_maexxna.cpp index e699b025d..7709fb570 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_maexxna.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_maexxna.cpp @@ -448,6 +448,38 @@ SpellScript* GetScript_MaexxnaWebSpray(SpellEntry const*) return new MaexxnaWebSprayScript(); } +// 28434 - Spider Web (Naxx, Maexxna) +struct MaexxnaSpiderWebScript : public SpellScript +{ + bool OnEffectExecute(Spell* spell, SpellEffectIndex effIdx) const final + { + if (effIdx == EFFECT_INDEX_0 && spell->GetUnitTarget()) + { + // see boss_maexxnaAI::DoCastWebWrap() for some info on this rather weird implementation + float dx = spell->GetUnitTarget()->GetPositionX() - spell->m_caster->GetPositionX(); + float dy = spell->GetUnitTarget()->GetPositionY() - spell->m_caster->GetPositionY(); + float dist = sqrt((dx * dx) + (dy * dy)); + float yDist = spell->m_caster->GetPositionZ() - spell->GetUnitTarget()->GetPositionZ(); + float horizontalSpeed = dist / 1.5f; + float verticalSpeed = 12.0f + (yDist*0.5f); + float angle = spell->GetUnitTarget()->GetAngle(spell->m_caster->GetPositionX(), spell->m_caster->GetPositionY()); + + // set immune anticheat and calculate speed + if (Player* plr = spell->GetUnitTarget()->ToPlayer()) + plr->SetLaunched(true); + + spell->GetUnitTarget()->KnockBack(angle, horizontalSpeed, verticalSpeed); + return false; + } + return true; + } +}; + +SpellScript* GetScript_MaexxnaSpiderWeb(SpellEntry const*) +{ + return new MaexxnaSpiderWebScript(); +} + void AddSC_boss_maexxna() { Script* pNewScript; @@ -466,4 +498,9 @@ void AddSC_boss_maexxna() pNewScript->Name = "spell_maexxna_web_spray"; pNewScript->GetSpellScript = &GetScript_MaexxnaWebSpray; pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "spell_maexxna_spider_web"; + pNewScript->GetSpellScript = &GetScript_MaexxnaSpiderWeb; + pNewScript->RegisterSelf(); } diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_thaddius.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_thaddius.cpp index 584c290fd..8ce302a49 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_thaddius.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/boss_thaddius.cpp @@ -1127,6 +1127,27 @@ SpellScript* GetScript_ThaddiusNegativeCharge(SpellEntry const*) return new ThaddiusNegativeChargeScript(); } +// 28337 - Magnetic Pull (Thaddius) +struct ThaddiusMagneticPullScript : public SpellScript +{ + bool OnEffectExecute(Spell* spell, SpellEffectIndex effIdx) const final + { + if (effIdx == EFFECT_INDEX_0 && spell->GetUnitTarget()) + { + float speedXY = float(spell->m_spellInfo->EffectMiscValue[effIdx]) * 0.1f; + float speedZ = spell->GetUnitTarget()->GetDistance(spell->m_caster) / speedXY * 0.5f * 20.0f; + spell->GetUnitTarget()->KnockBackFrom(spell->m_caster, -speedXY, speedZ); + return false; + } + return true; + } +}; + +SpellScript* GetScript_ThaddiusMagneticPull(SpellEntry const*) +{ + return new ThaddiusMagneticPullScript(); +} + void AddSC_boss_thaddius() { Script* pNewScript; @@ -1160,4 +1181,9 @@ void AddSC_boss_thaddius() pNewScript->Name = "spell_thaddius_negative_charge"; pNewScript->GetSpellScript = &GetScript_ThaddiusNegativeCharge; pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "spell_thaddius_magnetic_pull"; + pNewScript->GetSpellScript = &GetScript_ThaddiusMagneticPull; + pNewScript->RegisterSelf(); } diff --git a/src/scripts/spells/spell_item.cpp b/src/scripts/spells/spell_item.cpp index 108715faf..7a0ca5f51 100644 --- a/src/scripts/spells/spell_item.cpp +++ b/src/scripts/spells/spell_item.cpp @@ -405,6 +405,54 @@ SpellScript* GetScript_VanquishedTentacleofCthun(SpellEntry const*) return new VanquishedTentacleofCthunScript(); } +// 8342 - Defibrillate (Goblin Jumper Cables) +struct GoblinJumperCablesScript : public SpellScript +{ + bool OnEffectExecute(Spell* spell, SpellEffectIndex effIdx) const final + { + if (effIdx == EFFECT_INDEX_0 && spell->m_casterUnit) + { + // Defibrillate (Goblin Jumper Cables) have 33% chance on success + if (roll_chance_i(67)) + { + if (spell->m_casterUnit) + spell->m_casterUnit->CastSpell(spell->m_casterUnit, 8338, true, spell->m_CastItem); + return false; + } + } + return true; + } +}; + +SpellScript* GetScript_GoblinJumperCables(SpellEntry const*) +{ + return new GoblinJumperCablesScript(); +} + +// 22999 - Defibrillate (Goblin Jumper Cables XL) +struct GoblinJumperCablesXLScript : public SpellScript +{ + bool OnEffectExecute(Spell* spell, SpellEffectIndex effIdx) const final + { + if (effIdx == EFFECT_INDEX_0 && spell->m_casterUnit) + { + // Defibrillate (Goblin Jumper Cables XL) have 50% chance on success + if (roll_chance_i(50)) + { + if (spell->m_casterUnit) + spell->m_casterUnit->CastSpell(spell->m_casterUnit, 23055, true, spell->m_CastItem); + return false; + } + } + return true; + } +}; + +SpellScript* GetScript_GoblinJumperCablesXL(SpellEntry const*) +{ + return new GoblinJumperCablesXLScript(); +} + void AddSC_item_spell_scripts() { Script* newscript; @@ -483,4 +531,14 @@ void AddSC_item_spell_scripts() newscript->Name = "spell_vanquished_tentacle_of_cthun"; newscript->GetSpellScript = &GetScript_VanquishedTentacleofCthun; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "spell_goblin_jumper_cables"; + newscript->GetSpellScript = &GetScript_GoblinJumperCables; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "spell_goblin_jumper_cables_xl"; + newscript->GetSpellScript = &GetScript_GoblinJumperCablesXL; + newscript->RegisterSelf(); } diff --git a/src/scripts/spells/spell_paladin.cpp b/src/scripts/spells/spell_paladin.cpp index 260bf3869..47fa03a53 100644 --- a/src/scripts/spells/spell_paladin.cpp +++ b/src/scripts/spells/spell_paladin.cpp @@ -165,6 +165,39 @@ SpellScript* GetScript_PaladinJudgementOfLightHeal(SpellEntry const*) return new PaladinJudgementOfLightHealScript(); } +// 20178 - Reckoning +struct PaladinReckoningScript : SpellScript +{ + bool OnEffectExecute(Spell* spell, SpellEffectIndex effIdx) const final + { + if (effIdx == EFFECT_INDEX_0 && spell->GetUnitTarget()) + { + // World of Warcraft Client Patch 1.3.0 (2005-03-22) + // - Fixed a bug where abilities that give extra attacks, like the paladin + // Reckoning talent, could cause the following swing to take longer than + // it should. +#if SUPPORTED_CLIENT_BUILD <= CLIENT_BUILD_1_2_4 + unitTarget->ResetAttackTimer(); +#endif + + // It was possible to stack infinite extra attacks in early vanilla. + // https://www.youtube.com/watch?v=TqPQ4SNmx2c +#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_4_2 + if (spell->GetUnitTarget()->GetExtraAttacks() < 4) +#endif + spell->GetUnitTarget()->AddExtraAttack(); + + return false; + } + return true; + } +}; + +SpellScript* GetScript_PaladinReckoning(SpellEntry const*) +{ + return new PaladinReckoningScript(); +} + void AddSC_paladin_spell_scripts() { Script* newscript; @@ -198,4 +231,9 @@ void AddSC_paladin_spell_scripts() newscript->Name = "spell_paladin_judgement_of_light_heal"; newscript->GetSpellScript = &GetScript_PaladinJudgementOfLightHeal; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "spell_paladin_reckoning"; + newscript->GetSpellScript = &GetScript_PaladinReckoning; + newscript->RegisterSelf(); } diff --git a/src/scripts/spells/spell_warlock.cpp b/src/scripts/spells/spell_warlock.cpp index 15cf028b2..df25096cf 100644 --- a/src/scripts/spells/spell_warlock.cpp +++ b/src/scripts/spells/spell_warlock.cpp @@ -194,6 +194,27 @@ SpellScript* GetScript_WarlockDevourMagic(SpellEntry const*) return new WarlockDevourMagicScript(); } +// 1122, 24670 - Inferno +struct WarlockInfernoScript : SpellScript +{ + void OnSummon(Spell* spell, Creature* summon) const final + { + // Enslave demon effect, without mana cost and cooldown + spell->m_caster->CastSpell(summon, 20882, true); + + // Short root spell on infernal from sniffs + summon->CastSpell(summon, 22707, true); + + // Inferno effect + summon->CastSpell(summon, 22703, true); + } +}; + +SpellScript* GetScript_WarlockInferno(SpellEntry const*) +{ + return new WarlockInfernoScript(); +} + void AddSC_warlock_spell_scripts() { Script* newscript; @@ -222,4 +243,9 @@ void AddSC_warlock_spell_scripts() newscript->Name = "spell_warlock_devour_magic"; newscript->GetSpellScript = &GetScript_WarlockDevourMagic; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "spell_warlock_inferno"; + newscript->GetSpellScript = &GetScript_WarlockInferno; + newscript->RegisterSelf(); }