diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/scripts/EasternKingdoms/zone_ironforge.cpp | 11 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 3521 | ||||
| -rw-r--r-- | src/server/scripts/World/go_scripts.cpp | 143 |
3 files changed, 1819 insertions, 1856 deletions
diff --git a/src/server/scripts/EasternKingdoms/zone_ironforge.cpp b/src/server/scripts/EasternKingdoms/zone_ironforge.cpp index fb5758fa5cf..3886f08159f 100644 --- a/src/server/scripts/EasternKingdoms/zone_ironforge.cpp +++ b/src/server/scripts/EasternKingdoms/zone_ironforge.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * 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 @@ -16,16 +15,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Ironforge -SD%Complete: 0 -SDComment: -SDCategory: Ironforge -EndScriptData */ - -/* ContentData -EndContentData */ - #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 10e2b265570..68951c48350 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -62,7 +62,7 @@ class spell_gen_absorb0_hitlimit1 : public SpellScriptLoader void Register() OVERRIDE { - OnEffectAbsorb += AuraEffectAbsorbFn(spell_gen_absorb0_hitlimit1_AuraScript::Absorb, EFFECT_0); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_gen_absorb0_hitlimit1_AuraScript::Absorb, EFFECT_0); } }; @@ -163,962 +163,566 @@ class spell_gen_adaptive_warding : public SpellScriptLoader } }; -// 41337 Aura of Anger -class spell_gen_aura_of_anger : public SpellScriptLoader -{ - public: - spell_gen_aura_of_anger() : SpellScriptLoader("spell_gen_aura_of_anger") { } - - class spell_gen_aura_of_anger_AuraScript : public AuraScript - { - PrepareAuraScript(spell_gen_aura_of_anger_AuraScript); - - void HandleEffectPeriodicUpdate(AuraEffect* aurEff) - { - if (AuraEffect* aurEff1 = aurEff->GetBase()->GetEffect(EFFECT_1)) - aurEff1->ChangeAmount(aurEff1->GetAmount() + 5); - aurEff->SetAmount(100 * aurEff->GetTickNumber()); - } - - void Register() OVERRIDE - { - OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_gen_aura_of_anger_AuraScript::HandleEffectPeriodicUpdate, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); - } - }; - - AuraScript* GetAuraScript() const OVERRIDE - { - return new spell_gen_aura_of_anger_AuraScript(); - } -}; - -class spell_gen_av_drekthar_presence : public SpellScriptLoader -{ - public: - spell_gen_av_drekthar_presence() : SpellScriptLoader("spell_gen_av_drekthar_presence") { } - - class spell_gen_av_drekthar_presence_AuraScript : public AuraScript - { - PrepareAuraScript(spell_gen_av_drekthar_presence_AuraScript); - - bool CheckAreaTarget(Unit* target) - { - switch (target->GetEntry()) - { - // alliance - case 14762: // Dun Baldar North Marshal - case 14763: // Dun Baldar South Marshal - case 14764: // Icewing Marshal - case 14765: // Stonehearth Marshal - case 11948: // Vandar Stormspike - // horde - case 14772: // East Frostwolf Warmaster - case 14776: // Tower Point Warmaster - case 14773: // Iceblood Warmaster - case 14777: // West Frostwolf Warmaster - case 11946: // Drek'thar - return true; - default: - return false; - break; - } - } - void Register() OVERRIDE - { - DoCheckAreaTarget += AuraCheckAreaTargetFn(spell_gen_av_drekthar_presence_AuraScript::CheckAreaTarget); - } - }; - - AuraScript* GetAuraScript() const OVERRIDE - { - return new spell_gen_av_drekthar_presence_AuraScript(); - } -}; - -// 46394 Brutallus Burn -class spell_gen_burn_brutallus : public SpellScriptLoader +class spell_gen_allow_cast_from_item_only : public SpellScriptLoader { public: - spell_gen_burn_brutallus() : SpellScriptLoader("spell_gen_burn_brutallus") { } + spell_gen_allow_cast_from_item_only() : SpellScriptLoader("spell_gen_allow_cast_from_item_only") { } - class spell_gen_burn_brutallus_AuraScript : public AuraScript + class spell_gen_allow_cast_from_item_only_SpellScript : public SpellScript { - PrepareAuraScript(spell_gen_burn_brutallus_AuraScript); + PrepareSpellScript(spell_gen_allow_cast_from_item_only_SpellScript); - void HandleEffectPeriodicUpdate(AuraEffect* aurEff) + SpellCastResult CheckRequirement() { - if (aurEff->GetTickNumber() % 11 == 0) - aurEff->SetAmount(aurEff->GetAmount() * 2); + if (!GetCastItem()) + return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; + return SPELL_CAST_OK; } void Register() OVERRIDE { - OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_gen_burn_brutallus_AuraScript::HandleEffectPeriodicUpdate, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); + OnCheckCast += SpellCheckCastFn(spell_gen_allow_cast_from_item_only_SpellScript::CheckRequirement); } }; - AuraScript* GetAuraScript() const OVERRIDE + SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_burn_brutallus_AuraScript(); + return new spell_gen_allow_cast_from_item_only_SpellScript(); } }; -enum CannibalizeSpells +enum AnimalBloodPoolSpell { - SPELL_CANNIBALIZE_TRIGGERED = 20578, + SPELL_ANIMAL_BLOOD = 46221, + SPELL_SPAWN_BLOOD_POOL = 63471 }; -class spell_gen_cannibalize : public SpellScriptLoader +class spell_gen_animal_blood : public SpellScriptLoader { public: - spell_gen_cannibalize() : SpellScriptLoader("spell_gen_cannibalize") { } + spell_gen_animal_blood() : SpellScriptLoader("spell_gen_animal_blood") { } - class spell_gen_cannibalize_SpellScript : public SpellScript + class spell_gen_animal_blood_AuraScript : public AuraScript { - PrepareSpellScript(spell_gen_cannibalize_SpellScript); + PrepareAuraScript(spell_gen_animal_blood_AuraScript); - bool Validate(SpellInfo const* /*spellEntry*/) OVERRIDE + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { - if (!sSpellMgr->GetSpellInfo(SPELL_CANNIBALIZE_TRIGGERED)) + if (!sSpellMgr->GetSpellInfo(SPELL_SPAWN_BLOOD_POOL)) return false; return true; } - SpellCastResult CheckIfCorpseNear() + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* caster = GetCaster(); - float max_range = GetSpellInfo()->GetMaxRange(false); - WorldObject* result = NULL; - // search for nearby enemy corpse in range - Trinity::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_CHECK_ENEMY); - Trinity::WorldObjectSearcher<Trinity::AnyDeadUnitSpellTargetInRangeCheck> searcher(caster, result, check); - caster->GetMap()->VisitFirstFound(caster->m_positionX, caster->m_positionY, max_range, searcher); - if (!result) - return SPELL_FAILED_NO_EDIBLE_CORPSES; - return SPELL_CAST_OK; + // Remove all auras with spell id 46221, except the one currently being applied + while (Aura* aur = GetUnitOwner()->GetOwnedAura(SPELL_ANIMAL_BLOOD, 0, 0, 0, GetAura())) + GetUnitOwner()->RemoveOwnedAura(aur); } - void HandleDummy(SpellEffIndex /*effIndex*/) + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* caster = GetCaster(); - caster->CastSpell(caster, SPELL_CANNIBALIZE_TRIGGERED, false); + if (Unit* owner = GetUnitOwner()) + if (owner->IsInWater()) + owner->CastSpell(owner, SPELL_SPAWN_BLOOD_POOL, true); } void Register() OVERRIDE { - OnEffectHit += SpellEffectFn(spell_gen_cannibalize_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - OnCheckCast += SpellCheckCastFn(spell_gen_cannibalize_SpellScript::CheckIfCorpseNear); + AfterEffectApply += AuraEffectRemoveFn(spell_gen_animal_blood_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_gen_animal_blood_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); } }; - SpellScript* GetSpellScript() const OVERRIDE + AuraScript* GetAuraScript() const OVERRIDE { - return new spell_gen_cannibalize_SpellScript(); + return new spell_gen_animal_blood_AuraScript(); } }; -// 63845 - Create Lance -enum CreateLanceSpells -{ - SPELL_CREATE_LANCE_ALLIANCE = 63914, - SPELL_CREATE_LANCE_HORDE = 63919 -}; - -class spell_gen_create_lance : public SpellScriptLoader +// 41337 Aura of Anger +class spell_gen_aura_of_anger : public SpellScriptLoader { public: - spell_gen_create_lance() : SpellScriptLoader("spell_gen_create_lance") { } + spell_gen_aura_of_anger() : SpellScriptLoader("spell_gen_aura_of_anger") { } - class spell_gen_create_lance_SpellScript : public SpellScript + class spell_gen_aura_of_anger_AuraScript : public AuraScript { - PrepareSpellScript(spell_gen_create_lance_SpellScript); - - bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE - { - if (!sSpellMgr->GetSpellInfo(SPELL_CREATE_LANCE_ALLIANCE) || !sSpellMgr->GetSpellInfo(SPELL_CREATE_LANCE_HORDE)) - return false; - return true; - } + PrepareAuraScript(spell_gen_aura_of_anger_AuraScript); - void HandleScript(SpellEffIndex effIndex) + void HandleEffectPeriodicUpdate(AuraEffect* aurEff) { - PreventHitDefaultEffect(effIndex); - - if (Player* target = GetHitPlayer()) - { - if (target->GetTeam() == ALLIANCE) - GetCaster()->CastSpell(target, SPELL_CREATE_LANCE_ALLIANCE, true); - else - GetCaster()->CastSpell(target, SPELL_CREATE_LANCE_HORDE, true); - } + if (AuraEffect* aurEff1 = aurEff->GetBase()->GetEffect(EFFECT_1)) + aurEff1->ChangeAmount(aurEff1->GetAmount() + 5); + aurEff->SetAmount(100 * aurEff->GetTickNumber()); } void Register() OVERRIDE { - OnEffectHitTarget += SpellEffectFn(spell_gen_create_lance_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_gen_aura_of_anger_AuraScript::HandleEffectPeriodicUpdate, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); } }; - SpellScript* GetSpellScript() const OVERRIDE + AuraScript* GetAuraScript() const OVERRIDE { - return new spell_gen_create_lance_SpellScript(); + return new spell_gen_aura_of_anger_AuraScript(); } }; -// 28702 - Netherbloom -enum Netherbloom +enum ServiceUniform { - SPELL_NETHERBLOOM_POLLEN_1 = 28703 + // Spells + SPELL_SERVICE_UNIFORM = 71450, + + // Models + MODEL_GOBLIN_MALE = 31002, + MODEL_GOBLIN_FEMALE = 31003 }; -class spell_gen_netherbloom : public SpellScriptLoader +class spell_gen_aura_service_uniform : public SpellScriptLoader { public: - spell_gen_netherbloom() : SpellScriptLoader("spell_gen_netherbloom") { } + spell_gen_aura_service_uniform() : SpellScriptLoader("spell_gen_aura_service_uniform") { } - class spell_gen_netherbloom_SpellScript : public SpellScript + class spell_gen_aura_service_uniform_AuraScript : public AuraScript { - PrepareSpellScript(spell_gen_netherbloom_SpellScript); + PrepareAuraScript(spell_gen_aura_service_uniform_AuraScript); bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { - for (uint8 i = 0; i < 5; ++i) - if (!sSpellMgr->GetSpellInfo(SPELL_NETHERBLOOM_POLLEN_1 + i)) - return false; + if (!sSpellMgr->GetSpellInfo(SPELL_SERVICE_UNIFORM)) + return false; return true; } - void HandleScript(SpellEffIndex effIndex) + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - PreventHitDefaultEffect(effIndex); - - if (Unit* target = GetHitUnit()) + // Apply model goblin + Unit* target = GetTarget(); + if (target->GetTypeId() == TYPEID_PLAYER) { - // 25% chance of casting a random buff - if (roll_chance_i(75)) - return; - - // triggered spells are 28703 to 28707 - // Note: some sources say, that there was the possibility of - // receiving a debuff. However, this seems to be removed by a patch. - - // don't overwrite an existing aura - for (uint8 i = 0; i < 5; ++i) - if (target->HasAura(SPELL_NETHERBLOOM_POLLEN_1 + i)) - return; - - target->CastSpell(target, SPELL_NETHERBLOOM_POLLEN_1 + urand(0, 4), true); + if (target->getGender() == GENDER_MALE) + target->SetDisplayId(MODEL_GOBLIN_MALE); + else + target->SetDisplayId(MODEL_GOBLIN_FEMALE); } } - void Register() OVERRIDE - { - OnEffectHitTarget += SpellEffectFn(spell_gen_netherbloom_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; - - SpellScript* GetSpellScript() const OVERRIDE - { - return new spell_gen_netherbloom_SpellScript(); - } -}; - -// 28720 - Nightmare Vine -enum NightmareVine -{ - SPELL_NIGHTMARE_POLLEN = 28721 -}; - -class spell_gen_nightmare_vine : public SpellScriptLoader -{ - public: - spell_gen_nightmare_vine() : SpellScriptLoader("spell_gen_nightmare_vine") { } - - class spell_gen_nightmare_vine_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_nightmare_vine_SpellScript); - - bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE - { - if (!sSpellMgr->GetSpellInfo(SPELL_NIGHTMARE_POLLEN)) - return false; - return true; - } - - void HandleScript(SpellEffIndex effIndex) + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - PreventHitDefaultEffect(effIndex); - - if (Unit* target = GetHitUnit()) - { - // 25% chance of casting Nightmare Pollen - if (roll_chance_i(25)) - target->CastSpell(target, SPELL_NIGHTMARE_POLLEN, true); - } + Unit* target = GetTarget(); + if (target->GetTypeId() == TYPEID_PLAYER) + target->RestoreDisplayId(); } void Register() OVERRIDE { - OnEffectHitTarget += SpellEffectFn(spell_gen_nightmare_vine_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + AfterEffectApply += AuraEffectRemoveFn(spell_gen_aura_service_uniform_AuraScript::OnApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_gen_aura_service_uniform_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); } }; - SpellScript* GetSpellScript() const OVERRIDE + AuraScript* GetAuraScript() const OVERRIDE { - return new spell_gen_nightmare_vine_SpellScript(); + return new spell_gen_aura_service_uniform_AuraScript(); } }; -// 27539 - Obsidian Armor -enum ObsidianArmor -{ - SPELL_GEN_OBSIDIAN_ARMOR_HOLY = 27536, - SPELL_GEN_OBSIDIAN_ARMOR_FIRE = 27533, - SPELL_GEN_OBSIDIAN_ARMOR_NATURE = 27538, - SPELL_GEN_OBSIDIAN_ARMOR_FROST = 27534, - SPELL_GEN_OBSIDIAN_ARMOR_SHADOW = 27535, - SPELL_GEN_OBSIDIAN_ARMOR_ARCANE = 27540 -}; - -class spell_gen_obsidian_armor : public SpellScriptLoader +class spell_gen_av_drekthar_presence : public SpellScriptLoader { public: - spell_gen_obsidian_armor() : SpellScriptLoader("spell_gen_obsidian_armor") { } + spell_gen_av_drekthar_presence() : SpellScriptLoader("spell_gen_av_drekthar_presence") { } - class spell_gen_obsidian_armor_AuraScript : public AuraScript + class spell_gen_av_drekthar_presence_AuraScript : public AuraScript { - PrepareAuraScript(spell_gen_obsidian_armor_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE - { - if (!sSpellMgr->GetSpellInfo(SPELL_GEN_OBSIDIAN_ARMOR_HOLY) || - !sSpellMgr->GetSpellInfo(SPELL_GEN_OBSIDIAN_ARMOR_FIRE) || - !sSpellMgr->GetSpellInfo(SPELL_GEN_OBSIDIAN_ARMOR_NATURE) || - !sSpellMgr->GetSpellInfo(SPELL_GEN_OBSIDIAN_ARMOR_FROST) || - !sSpellMgr->GetSpellInfo(SPELL_GEN_OBSIDIAN_ARMOR_SHADOW) || - !sSpellMgr->GetSpellInfo(SPELL_GEN_OBSIDIAN_ARMOR_ARCANE)) - return false; - return true; - } - - bool CheckProc(ProcEventInfo& eventInfo) - { - if (eventInfo.GetDamageInfo()->GetSpellInfo()) // eventInfo.GetSpellInfo() - return false; - - if (GetFirstSchoolInMask(eventInfo.GetSchoolMask()) == SPELL_SCHOOL_NORMAL) - return false; - - return true; - } + PrepareAuraScript(spell_gen_av_drekthar_presence_AuraScript); - void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + bool CheckAreaTarget(Unit* target) { - PreventDefaultAction(); - - uint32 spellId = 0; - switch (GetFirstSchoolInMask(eventInfo.GetSchoolMask())) + switch (target->GetEntry()) { - case SPELL_SCHOOL_HOLY: - spellId = SPELL_GEN_OBSIDIAN_ARMOR_HOLY; - break; - case SPELL_SCHOOL_FIRE: - spellId = SPELL_GEN_OBSIDIAN_ARMOR_FIRE; - break; - case SPELL_SCHOOL_NATURE: - spellId = SPELL_GEN_OBSIDIAN_ARMOR_NATURE; - break; - case SPELL_SCHOOL_FROST: - spellId = SPELL_GEN_OBSIDIAN_ARMOR_FROST; - break; - case SPELL_SCHOOL_SHADOW: - spellId = SPELL_GEN_OBSIDIAN_ARMOR_SHADOW; - break; - case SPELL_SCHOOL_ARCANE: - spellId = SPELL_GEN_OBSIDIAN_ARMOR_ARCANE; - break; + // alliance + case 14762: // Dun Baldar North Marshal + case 14763: // Dun Baldar South Marshal + case 14764: // Icewing Marshal + case 14765: // Stonehearth Marshal + case 11948: // Vandar Stormspike + // horde + case 14772: // East Frostwolf Warmaster + case 14776: // Tower Point Warmaster + case 14773: // Iceblood Warmaster + case 14777: // West Frostwolf Warmaster + case 11946: // Drek'thar + return true; default: - return; + return false; } - GetTarget()->CastSpell(GetTarget(), spellId, true, NULL, aurEff); } void Register() OVERRIDE { - DoCheckProc += AuraCheckProcFn(spell_gen_obsidian_armor_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_gen_obsidian_armor_AuraScript::OnProc, EFFECT_0, SPELL_AURA_DUMMY); + DoCheckAreaTarget += AuraCheckAreaTargetFn(spell_gen_av_drekthar_presence_AuraScript::CheckAreaTarget); } }; AuraScript* GetAuraScript() const OVERRIDE { - return new spell_gen_obsidian_armor_AuraScript(); + return new spell_gen_av_drekthar_presence_AuraScript(); } }; -// 45472 Parachute -enum ParachuteSpells +enum GenericBandage { - SPELL_PARACHUTE = 45472, - SPELL_PARACHUTE_BUFF = 44795, + SPELL_RECENTLY_BANDAGED = 11196 }; -class spell_gen_parachute : public SpellScriptLoader +class spell_gen_bandage : public SpellScriptLoader { public: - spell_gen_parachute() : SpellScriptLoader("spell_gen_parachute") { } + spell_gen_bandage() : SpellScriptLoader("spell_gen_bandage") { } - class spell_gen_parachute_AuraScript : public AuraScript + class spell_gen_bandage_SpellScript : public SpellScript { - PrepareAuraScript(spell_gen_parachute_AuraScript); + PrepareSpellScript(spell_gen_bandage_SpellScript); - bool Validate(SpellInfo const* /*spell*/) OVERRIDE + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { - if (!sSpellMgr->GetSpellInfo(SPELL_PARACHUTE) || !sSpellMgr->GetSpellInfo(SPELL_PARACHUTE_BUFF)) + if (!sSpellMgr->GetSpellInfo(SPELL_RECENTLY_BANDAGED)) return false; return true; } - void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) - { - if (Player* target = GetTarget()->ToPlayer()) - if (target->IsFalling()) - { - target->RemoveAurasDueToSpell(SPELL_PARACHUTE); - target->CastSpell(target, SPELL_PARACHUTE_BUFF, true); - } - } - - void Register() OVERRIDE - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_parachute_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; - - AuraScript* GetAuraScript() const OVERRIDE - { - return new spell_gen_parachute_AuraScript(); - } -}; - -enum NPCEntries -{ - NPC_DOOMGUARD = 11859, - NPC_INFERNAL = 89, - NPC_IMP = 416, -}; - -class spell_gen_pet_summoned : public SpellScriptLoader -{ - public: - spell_gen_pet_summoned() : SpellScriptLoader("spell_gen_pet_summoned") { } - - class spell_gen_pet_summoned_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_pet_summoned_SpellScript); - - bool Load() OVERRIDE - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } - - void HandleScript(SpellEffIndex /*effIndex*/) + SpellCastResult CheckCast() { - Player* player = GetCaster()->ToPlayer(); - if (player->GetLastPetNumber()) + if (Unit* target = GetExplTargetUnit()) { - PetType newPetType = (player->getClass() == CLASS_HUNTER) ? HUNTER_PET : SUMMON_PET; - if (Pet* newPet = new Pet(player, newPetType)) - { - if (newPet->LoadPetFromDB(player, 0, player->GetLastPetNumber(), true)) - { - // revive the pet if it is dead - if (newPet->getDeathState() == DEAD) - newPet->setDeathState(ALIVE); - - newPet->SetFullHealth(); - newPet->SetPower(newPet->getPowerType(), newPet->GetMaxPower(newPet->getPowerType())); - - switch (newPet->GetEntry()) - { - case NPC_DOOMGUARD: - case NPC_INFERNAL: - newPet->SetEntry(NPC_IMP); - break; - default: - break; - } - } - else - delete newPet; - } + if (target->HasAura(SPELL_RECENTLY_BANDAGED)) + return SPELL_FAILED_TARGET_AURASTATE; } + return SPELL_CAST_OK; } - void Register() OVERRIDE - { - OnEffectHitTarget += SpellEffectFn(spell_gen_pet_summoned_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; - - SpellScript* GetSpellScript() const OVERRIDE - { - return new spell_gen_pet_summoned_SpellScript(); - } -}; - -class spell_gen_remove_flight_auras : public SpellScriptLoader -{ - public: - spell_gen_remove_flight_auras() : SpellScriptLoader("spell_gen_remove_flight_auras") {} - - class spell_gen_remove_flight_auras_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_remove_flight_auras_SpellScript); - - void HandleScript(SpellEffIndex /*effIndex*/) + void HandleScript() { if (Unit* target = GetHitUnit()) - { - target->RemoveAurasByType(SPELL_AURA_FLY); - target->RemoveAurasByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED); - } + GetCaster()->CastSpell(target, SPELL_RECENTLY_BANDAGED, true); } void Register() OVERRIDE { - OnEffectHitTarget += SpellEffectFn(spell_gen_remove_flight_auras_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + OnCheckCast += SpellCheckCastFn(spell_gen_bandage_SpellScript::CheckCast); + AfterHit += SpellHitFn(spell_gen_bandage_SpellScript::HandleScript); } }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_remove_flight_auras_SpellScript(); + return new spell_gen_bandage_SpellScript(); } }; -enum EluneCandle +enum Bonked { - NPC_OMEN = 15467, - - SPELL_ELUNE_CANDLE_OMEN_HEAD = 26622, - SPELL_ELUNE_CANDLE_OMEN_CHEST = 26624, - SPELL_ELUNE_CANDLE_OMEN_HAND_R = 26625, - SPELL_ELUNE_CANDLE_OMEN_HAND_L = 26649, - SPELL_ELUNE_CANDLE_NORMAL = 26636, + SPELL_BONKED = 62991, + SPELL_FOAM_SWORD_DEFEAT = 62994, + SPELL_ON_GUARD = 62972 }; -class spell_gen_elune_candle : public SpellScriptLoader +class spell_gen_bonked : public SpellScriptLoader { public: - spell_gen_elune_candle() : SpellScriptLoader("spell_gen_elune_candle") {} + spell_gen_bonked() : SpellScriptLoader("spell_gen_bonked") { } - class spell_gen_elune_candle_SpellScript : public SpellScript + class spell_gen_bonked_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_elune_candle_SpellScript); - bool Validate(SpellInfo const* /*spellEntry*/) OVERRIDE - { - if (!sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_OMEN_HEAD)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_OMEN_CHEST)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_OMEN_HAND_R)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_OMEN_HAND_L)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_NORMAL)) - return false; - return true; - } + PrepareSpellScript(spell_gen_bonked_SpellScript); void HandleScript(SpellEffIndex /*effIndex*/) { - uint32 spellId = 0; - - if (GetHitUnit()->GetEntry() == NPC_OMEN) + if (Player* target = GetHitPlayer()) { - switch (urand(0, 3)) + Aura const* aura = GetHitAura(); + if (!(aura && aura->GetStackAmount() == 3)) + return; + + target->CastSpell(target, SPELL_FOAM_SWORD_DEFEAT, true); + target->RemoveAurasDueToSpell(SPELL_BONKED); + + if (Aura const* aura = target->GetAura(SPELL_ON_GUARD)) { - case 0: spellId = SPELL_ELUNE_CANDLE_OMEN_HEAD; break; - case 1: spellId = SPELL_ELUNE_CANDLE_OMEN_CHEST; break; - case 2: spellId = SPELL_ELUNE_CANDLE_OMEN_HAND_R; break; - case 3: spellId = SPELL_ELUNE_CANDLE_OMEN_HAND_L; break; + if (Item* item = target->GetItemByGuid(aura->GetCastItemGUID())) + target->DestroyItemCount(item->GetEntry(), 1, true); } } - else - spellId = SPELL_ELUNE_CANDLE_NORMAL; - - GetCaster()->CastSpell(GetHitUnit(), spellId, true, NULL); } void Register() OVERRIDE { - OnEffectHitTarget += SpellEffectFn(spell_gen_elune_candle_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_gen_bonked_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); } }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_elune_candle_SpellScript(); + return new spell_gen_bonked_SpellScript(); } }; -class spell_creature_permanent_feign_death : public SpellScriptLoader -{ - public: - spell_creature_permanent_feign_death() : SpellScriptLoader("spell_creature_permanent_feign_death") { } - - class spell_creature_permanent_feign_death_AuraScript : public AuraScript - { - PrepareAuraScript(spell_creature_permanent_feign_death_AuraScript); - - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - target->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); - - if (target->GetTypeId() == TYPEID_UNIT) - target->ToCreature()->SetReactState(REACT_PASSIVE); - } +/* DOCUMENTATION: Break-Shield spells + Break-Shield spells can be classified in three groups: - void Register() OVERRIDE - { - OnEffectApply += AuraEffectApplyFn(spell_creature_permanent_feign_death_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; + - Spells on vehicle bar used by players: + + EFFECT_0: SCRIPT_EFFECT + + EFFECT_1: NONE + + EFFECT_2: NONE + - Spells casted by players triggered by script: + + EFFECT_0: SCHOOL_DAMAGE + + EFFECT_1: SCRIPT_EFFECT + + EFFECT_2: FORCE_CAST + - Spells casted by NPCs on players: + + EFFECT_0: SCHOOL_DAMAGE + + EFFECT_1: SCRIPT_EFFECT + + EFFECT_2: NONE - AuraScript* GetAuraScript() const OVERRIDE - { - return new spell_creature_permanent_feign_death_AuraScript(); - } -}; + In the following script we handle the SCRIPT_EFFECT for effIndex EFFECT_0 and EFFECT_1. + - When handling EFFECT_0 we're in the "Spells on vehicle bar used by players" case + and we'll trigger "Spells casted by players triggered by script" + - When handling EFFECT_1 we're in the "Spells casted by players triggered by script" + or "Spells casted by NPCs on players" so we'll search for the first defend layer and drop it. +*/ -enum PvPTrinketTriggeredSpells +enum BreakShieldSpells { - SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER = 72752, - SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER_WOTF = 72757, + SPELL_BREAK_SHIELD_DAMAGE_2K = 62626, + SPELL_BREAK_SHIELD_DAMAGE_10K = 64590, + + SPELL_BREAK_SHIELD_TRIGGER_FACTION_MOUNTS = 62575, // Also on ToC5 mounts + SPELL_BREAK_SHIELD_TRIGGER_CAMPAING_WARHORSE = 64595, + SPELL_BREAK_SHIELD_TRIGGER_UNK = 66480 }; -class spell_pvp_trinket_wotf_shared_cd : public SpellScriptLoader +class spell_gen_break_shield: public SpellScriptLoader { public: - spell_pvp_trinket_wotf_shared_cd() : SpellScriptLoader("spell_pvp_trinket_wotf_shared_cd") {} + spell_gen_break_shield(const char* name) : SpellScriptLoader(name) { } - class spell_pvp_trinket_wotf_shared_cd_SpellScript : public SpellScript + class spell_gen_break_shield_SpellScript : public SpellScript { - PrepareSpellScript(spell_pvp_trinket_wotf_shared_cd_SpellScript); + PrepareSpellScript(spell_gen_break_shield_SpellScript) - bool Load() OVERRIDE + void HandleScriptEffect(SpellEffIndex effIndex) { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } + Unit* target = GetHitUnit(); - bool Validate(SpellInfo const* /*spellEntry*/) OVERRIDE - { - if (!sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER) || !sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER_WOTF)) - return false; - return true; - } + switch (effIndex) + { + case EFFECT_0: // On spells wich trigger the damaging spell (and also the visual) + { + uint32 spellId; - void HandleScript() - { - // This is only needed because spells cast from spell_linked_spell are triggered by default - // Spell::SendSpellCooldown() skips all spells with TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD - GetCaster()->ToPlayer()->AddSpellAndCategoryCooldowns(GetSpellInfo(), GetCastItem() ? GetCastItem()->GetEntry() : 0, GetSpell()); + switch (GetSpellInfo()->Id) + { + case SPELL_BREAK_SHIELD_TRIGGER_UNK: + case SPELL_BREAK_SHIELD_TRIGGER_CAMPAING_WARHORSE: + spellId = SPELL_BREAK_SHIELD_DAMAGE_10K; + break; + case SPELL_BREAK_SHIELD_TRIGGER_FACTION_MOUNTS: + spellId = SPELL_BREAK_SHIELD_DAMAGE_2K; + break; + default: + return; + } + + if (Unit* rider = GetCaster()->GetCharmer()) + rider->CastSpell(target, spellId, false); + else + GetCaster()->CastSpell(target, spellId, false); + break; + } + case EFFECT_1: // On damaging spells, for removing a defend layer + { + Unit::AuraApplicationMap const& auras = target->GetAppliedAuras(); + for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + if (Aura* aura = itr->second->GetBase()) + { + SpellInfo const* auraInfo = aura->GetSpellInfo(); + if (auraInfo && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN)) + { + aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL); + // Remove dummys from rider (Necessary for updating visual shields) + if (Unit* rider = target->GetCharmer()) + if (Aura* defend = rider->GetAura(aura->GetId())) + defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL); + break; + } + } + } + break; + } + default: + break; + } } void Register() OVERRIDE { - AfterCast += SpellCastFn(spell_pvp_trinket_wotf_shared_cd_SpellScript::HandleScript); + OnEffectHitTarget += SpellEffectFn(spell_gen_break_shield_SpellScript::HandleScriptEffect, EFFECT_FIRST_FOUND, SPELL_EFFECT_SCRIPT_EFFECT); } }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_pvp_trinket_wotf_shared_cd_SpellScript(); + return new spell_gen_break_shield_SpellScript(); } }; -enum AnimalBloodPoolSpell -{ - SPELL_ANIMAL_BLOOD = 46221, - SPELL_SPAWN_BLOOD_POOL = 63471, -}; - -class spell_gen_animal_blood : public SpellScriptLoader +// 46394 Brutallus Burn +class spell_gen_burn_brutallus : public SpellScriptLoader { public: - spell_gen_animal_blood() : SpellScriptLoader("spell_gen_animal_blood") { } + spell_gen_burn_brutallus() : SpellScriptLoader("spell_gen_burn_brutallus") { } - class spell_gen_animal_blood_AuraScript : public AuraScript + class spell_gen_burn_brutallus_AuraScript : public AuraScript { - PrepareAuraScript(spell_gen_animal_blood_AuraScript); - - bool Validate(SpellInfo const* /*spell*/) OVERRIDE - { - if (!sSpellMgr->GetSpellInfo(SPELL_SPAWN_BLOOD_POOL)) - return false; - return true; - } - - void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - // Remove all auras with spell id 46221, except the one currently being applied - while (Aura* aur = GetUnitOwner()->GetOwnedAura(SPELL_ANIMAL_BLOOD, 0, 0, 0, GetAura())) - GetUnitOwner()->RemoveOwnedAura(aur); - } + PrepareAuraScript(spell_gen_burn_brutallus_AuraScript); - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleEffectPeriodicUpdate(AuraEffect* aurEff) { - if (Unit* owner = GetUnitOwner()) - if (owner->IsInWater()) - owner->CastSpell(owner, SPELL_SPAWN_BLOOD_POOL, true); + if (aurEff->GetTickNumber() % 11 == 0) + aurEff->SetAmount(aurEff->GetAmount() * 2); } void Register() OVERRIDE { - AfterEffectApply += AuraEffectRemoveFn(spell_gen_animal_blood_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectRemoveFn(spell_gen_animal_blood_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_gen_burn_brutallus_AuraScript::HandleEffectPeriodicUpdate, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); } }; AuraScript* GetAuraScript() const OVERRIDE { - return new spell_gen_animal_blood_AuraScript(); + return new spell_gen_burn_brutallus_AuraScript(); } }; -enum DivineStormSpell +enum CannibalizeSpells { - SPELL_DIVINE_STORM = 53385, + SPELL_CANNIBALIZE_TRIGGERED = 20578 }; -// 70769 Divine Storm! -class spell_gen_divine_storm_cd_reset : public SpellScriptLoader +class spell_gen_cannibalize : public SpellScriptLoader { public: - spell_gen_divine_storm_cd_reset() : SpellScriptLoader("spell_gen_divine_storm_cd_reset") {} + spell_gen_cannibalize() : SpellScriptLoader("spell_gen_cannibalize") { } - class spell_gen_divine_storm_cd_reset_SpellScript : public SpellScript + class spell_gen_cannibalize_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_divine_storm_cd_reset_SpellScript); - - bool Load() OVERRIDE - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } + PrepareSpellScript(spell_gen_cannibalize_SpellScript); bool Validate(SpellInfo const* /*spellEntry*/) OVERRIDE { - if (!sSpellMgr->GetSpellInfo(SPELL_DIVINE_STORM)) + if (!sSpellMgr->GetSpellInfo(SPELL_CANNIBALIZE_TRIGGERED)) return false; return true; } - void HandleScript(SpellEffIndex /*effIndex*/) - { - Player* caster = GetCaster()->ToPlayer(); - if (caster->HasSpellCooldown(SPELL_DIVINE_STORM)) - caster->RemoveSpellCooldown(SPELL_DIVINE_STORM, true); - } - - void Register() OVERRIDE - { - OnEffectHitTarget += SpellEffectFn(spell_gen_divine_storm_cd_reset_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript* GetSpellScript() const OVERRIDE - { - return new spell_gen_divine_storm_cd_reset_SpellScript(); - } -}; - -class spell_gen_gunship_portal : public SpellScriptLoader -{ - public: - spell_gen_gunship_portal() : SpellScriptLoader("spell_gen_gunship_portal") { } - - class spell_gen_gunship_portal_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_gunship_portal_SpellScript); - - bool Load() OVERRIDE + SpellCastResult CheckIfCorpseNear() { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + Unit* caster = GetCaster(); + float max_range = GetSpellInfo()->GetMaxRange(false); + WorldObject* result = NULL; + // search for nearby enemy corpse in range + Trinity::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_CHECK_ENEMY); + Trinity::WorldObjectSearcher<Trinity::AnyDeadUnitSpellTargetInRangeCheck> searcher(caster, result, check); + caster->GetMap()->VisitFirstFound(caster->m_positionX, caster->m_positionY, max_range, searcher); + if (!result) + return SPELL_FAILED_NO_EDIBLE_CORPSES; + return SPELL_CAST_OK; } - void HandleScript(SpellEffIndex /*effIndex*/) + void HandleDummy(SpellEffIndex /*effIndex*/) { - Player* caster = GetCaster()->ToPlayer(); - if (Battleground* bg = caster->GetBattleground()) - if (bg->GetTypeID(true) == BATTLEGROUND_IC) - bg->DoAction(1, caster->GetGUID()); + GetCaster()->CastSpell(GetCaster(), SPELL_CANNIBALIZE_TRIGGERED, false); } void Register() OVERRIDE { - OnEffectHitTarget += SpellEffectFn(spell_gen_gunship_portal_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHit += SpellEffectFn(spell_gen_cannibalize_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnCheckCast += SpellCheckCastFn(spell_gen_cannibalize_SpellScript::CheckIfCorpseNear); } }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_gunship_portal_SpellScript(); + return new spell_gen_cannibalize_SpellScript(); } }; -enum parachuteIC +enum ChaosBlast { - SPELL_PARACHUTE_IC = 66657, + SPELL_CHAOS_BLAST = 37675 }; -class spell_gen_parachute_ic : public SpellScriptLoader -{ - public: - spell_gen_parachute_ic() : SpellScriptLoader("spell_gen_parachute_ic") { } - - class spell_gen_parachute_ic_AuraScript : public AuraScript - { - PrepareAuraScript(spell_gen_parachute_ic_AuraScript) - - void HandleTriggerSpell(AuraEffect const* /*aurEff*/) - { - if (Player* target = GetTarget()->ToPlayer()) - if (target->m_movementInfo.jump.fallTime > 2000) - target->CastSpell(target, SPELL_PARACHUTE_IC, true); - } - - void Register() OVERRIDE - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_parachute_ic_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; - - AuraScript* GetAuraScript() const OVERRIDE - { - return new spell_gen_parachute_ic_AuraScript(); - } -}; - -class spell_gen_dungeon_credit : public SpellScriptLoader +class spell_gen_chaos_blast : public SpellScriptLoader { public: - spell_gen_dungeon_credit() : SpellScriptLoader("spell_gen_dungeon_credit") { } + spell_gen_chaos_blast() : SpellScriptLoader("spell_gen_chaos_blast") { } - class spell_gen_dungeon_credit_SpellScript : public SpellScript + class spell_gen_chaos_blast_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_dungeon_credit_SpellScript); + PrepareSpellScript(spell_gen_chaos_blast_SpellScript) - bool Load() OVERRIDE + bool Validate(SpellInfo const* /*SpellEntry*/) OVERRIDE { - _handled = false; - return GetCaster()->GetTypeId() == TYPEID_UNIT; + if (!sSpellMgr->GetSpellInfo(SPELL_CHAOS_BLAST)) + return false; + return true; } - - void CreditEncounter() + void HandleDummy(SpellEffIndex /* effIndex */) { - // This hook is executed for every target, make sure we only credit instance once - if (_handled) - return; - - _handled = true; + int32 basepoints0 = 100; Unit* caster = GetCaster(); - if (InstanceScript* instance = caster->GetInstanceScript()) - instance->UpdateEncounterState(ENCOUNTER_CREDIT_CAST_SPELL, GetSpellInfo()->Id, caster); - } - - void Register() OVERRIDE - { - AfterHit += SpellHitFn(spell_gen_dungeon_credit_SpellScript::CreditEncounter); - } - - bool _handled; - }; - - SpellScript* GetSpellScript() const OVERRIDE - { - return new spell_gen_dungeon_credit_SpellScript(); - } -}; - -class spell_gen_profession_research : public SpellScriptLoader -{ - public: - spell_gen_profession_research() : SpellScriptLoader("spell_gen_profession_research") {} - - class spell_gen_profession_research_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_profession_research_SpellScript); - - bool Load() OVERRIDE - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } - - SpellCastResult CheckRequirement() - { - if (HasDiscoveredAllSpells(GetSpellInfo()->Id, GetCaster()->ToPlayer())) - { - SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_NOTHING_TO_DISCOVER); - return SPELL_FAILED_CUSTOM_ERROR; - } - - return SPELL_CAST_OK; - } - - void HandleScript(SpellEffIndex /*effIndex*/) - { - Player* caster = GetCaster()->ToPlayer(); - uint32 spellId = GetSpellInfo()->Id; - - // learn random explicit discovery recipe (if any) - if (uint32 discoveredSpellId = GetExplicitDiscoverySpell(spellId, caster)) - caster->learnSpell(discoveredSpellId, false); - - caster->UpdateCraftSkill(spellId); + if (Unit* target = GetHitUnit()) + caster->CastCustomSpell(target, SPELL_CHAOS_BLAST, &basepoints0, NULL, NULL, true); } void Register() OVERRIDE { - OnCheckCast += SpellCheckCastFn(spell_gen_profession_research_SpellScript::CheckRequirement); - OnEffectHitTarget += SpellEffectFn(spell_gen_profession_research_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_gen_chaos_blast_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_profession_research_SpellScript(); + return new spell_gen_chaos_blast_SpellScript(); } }; -class spell_generic_clone : public SpellScriptLoader +class spell_gen_clone : public SpellScriptLoader { public: - spell_generic_clone() : SpellScriptLoader("spell_generic_clone") { } + spell_gen_clone() : SpellScriptLoader("spell_gen_clone") { } - class spell_generic_clone_SpellScript : public SpellScript + class spell_gen_clone_SpellScript : public SpellScript { - PrepareSpellScript(spell_generic_clone_SpellScript); + PrepareSpellScript(spell_gen_clone_SpellScript); void HandleScriptEffect(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - uint32 spellId = uint32(GetSpellInfo()->Effects[effIndex].CalcValue()); - GetHitUnit()->CastSpell(GetCaster(), spellId, true); + GetHitUnit()->CastSpell(GetCaster(), GetEffectValue(), true); } void Register() OVERRIDE { - OnEffectHitTarget += SpellEffectFn(spell_generic_clone_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); - OnEffectHitTarget += SpellEffectFn(spell_generic_clone_SpellScript::HandleScriptEffect, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_gen_clone_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_gen_clone_SpellScript::HandleScriptEffect, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT); } }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_generic_clone_SpellScript(); + return new spell_gen_clone_SpellScript(); } }; @@ -1134,14 +738,14 @@ enum CloneWeaponSpells SPELL_COPY_RANGED_AURA = 57594 }; -class spell_generic_clone_weapon : public SpellScriptLoader +class spell_gen_clone_weapon : public SpellScriptLoader { public: - spell_generic_clone_weapon() : SpellScriptLoader("spell_generic_clone_weapon") { } + spell_gen_clone_weapon() : SpellScriptLoader("spell_gen_clone_weapon") { } - class spell_generic_clone_weapon_SpellScript : public SpellScript + class spell_gen_clone_weapon_SpellScript : public SpellScript { - PrepareSpellScript(spell_generic_clone_weapon_SpellScript); + PrepareSpellScript(spell_gen_clone_weapon_SpellScript); void HandleScriptEffect(SpellEffIndex effIndex) { @@ -1149,22 +753,18 @@ class spell_generic_clone_weapon : public SpellScriptLoader Unit* caster = GetCaster(); if (Unit* target = GetHitUnit()) - { - - uint32 spellId = uint32(GetSpellInfo()->Effects[EFFECT_0].CalcValue()); - caster->CastSpell(target, spellId, true); - } + caster->CastSpell(target, GetEffectValue(), true); } void Register() OVERRIDE { - OnEffectHitTarget += SpellEffectFn(spell_generic_clone_weapon_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_gen_clone_weapon_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_generic_clone_weapon_SpellScript(); + return new spell_gen_clone_weapon_SpellScript(); } }; @@ -1181,8 +781,12 @@ class spell_gen_clone_weapon_aura : public SpellScriptLoader bool Validate(SpellInfo const* /*spellEntry*/) OVERRIDE { - if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_AURA) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_2_AURA) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_3_AURA) - || !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_AURA) || !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_2_AURA) || !sSpellMgr->GetSpellInfo(SPELL_COPY_RANGED_AURA)) + if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_AURA) || + !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_2_AURA) || + !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_3_AURA) || + !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_AURA) || + !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_2_AURA) || + !sSpellMgr->GetSpellInfo(SPELL_COPY_RANGED_AURA)) return false; return true; } @@ -1191,7 +795,6 @@ class spell_gen_clone_weapon_aura : public SpellScriptLoader { Unit* caster = GetCaster(); Unit* target = GetTarget(); - if (!caster) return; @@ -1253,21 +856,15 @@ class spell_gen_clone_weapon_aura : public SpellScriptLoader case SPELL_COPY_WEAPON_AURA: case SPELL_COPY_WEAPON_2_AURA: case SPELL_COPY_WEAPON_3_AURA: - { target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, prevItem); break; - } case SPELL_COPY_OFFHAND_AURA: case SPELL_COPY_OFFHAND_2_AURA: - { target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, prevItem); break; - } case SPELL_COPY_RANGED_AURA: - { target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, prevItem); break; - } default: break; } @@ -1287,374 +884,432 @@ class spell_gen_clone_weapon_aura : public SpellScriptLoader } }; -enum SeaforiumSpells -{ - SPELL_PLANT_CHARGES_CREDIT_ACHIEVEMENT = 60937, -}; - -class spell_gen_seaforium_blast : public SpellScriptLoader +class spell_gen_count_pct_from_max_hp : public SpellScriptLoader { public: - spell_gen_seaforium_blast() : SpellScriptLoader("spell_gen_seaforium_blast") {} + spell_gen_count_pct_from_max_hp(char const* name, int32 damagePct = 0) : SpellScriptLoader(name), _damagePct(damagePct) { } - class spell_gen_seaforium_blast_SpellScript : public SpellScript + class spell_gen_count_pct_from_max_hp_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_seaforium_blast_SpellScript); + PrepareSpellScript(spell_gen_count_pct_from_max_hp_SpellScript) - bool Validate(SpellInfo const* /*spell*/) OVERRIDE - { - if (!sSpellMgr->GetSpellInfo(SPELL_PLANT_CHARGES_CREDIT_ACHIEVEMENT)) - return false; - return true; - } + public: + spell_gen_count_pct_from_max_hp_SpellScript(int32 damagePct) : SpellScript(), _damagePct(damagePct) { } - bool Load() OVERRIDE + void RecalculateDamage() { - // OriginalCaster is always available in Spell::prepare - return GetOriginalCaster()->GetTypeId() == TYPEID_PLAYER; - } + if (!_damagePct) + _damagePct = GetHitDamage(); - void AchievementCredit(SpellEffIndex /*effIndex*/) - { - // but in effect handling OriginalCaster can become NULL - if (Unit* originalCaster = GetOriginalCaster()) - if (GameObject* go = GetHitGObj()) - if (go->GetGOInfo()->type == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING) - originalCaster->CastSpell(originalCaster, SPELL_PLANT_CHARGES_CREDIT_ACHIEVEMENT, true); + SetHitDamage(GetHitUnit()->CountPctFromMaxHealth(_damagePct)); } void Register() OVERRIDE { - OnEffectHitTarget += SpellEffectFn(spell_gen_seaforium_blast_SpellScript::AchievementCredit, EFFECT_1, SPELL_EFFECT_GAMEOBJECT_DAMAGE); + OnHit += SpellHitFn(spell_gen_count_pct_from_max_hp_SpellScript::RecalculateDamage); } + + private: + int32 _damagePct; }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_seaforium_blast_SpellScript(); + return new spell_gen_count_pct_from_max_hp_SpellScript(_damagePct); } + + private: + int32 _damagePct; }; -enum FriendOrFowl +// 63845 - Create Lance +enum CreateLanceSpells { - SPELL_TURKEY_VENGEANCE = 25285, + SPELL_CREATE_LANCE_ALLIANCE = 63914, + SPELL_CREATE_LANCE_HORDE = 63919 }; -class spell_gen_turkey_marker : public SpellScriptLoader +class spell_gen_create_lance : public SpellScriptLoader { public: - spell_gen_turkey_marker() : SpellScriptLoader("spell_gen_turkey_marker") { } + spell_gen_create_lance() : SpellScriptLoader("spell_gen_create_lance") { } - class spell_gen_turkey_marker_AuraScript : public AuraScript + class spell_gen_create_lance_SpellScript : public SpellScript { - PrepareAuraScript(spell_gen_turkey_marker_AuraScript); + PrepareSpellScript(spell_gen_create_lance_SpellScript); - void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { - // store stack apply times, so we can pop them while they expire - _applyTimes.push_back(getMSTime()); - Unit* target = GetTarget(); - - // on stack 15 cast the achievement crediting spell - if (GetStackAmount() >= 15) - target->CastSpell(target, SPELL_TURKEY_VENGEANCE, true, NULL, aurEff, GetCasterGUID()); + if (!sSpellMgr->GetSpellInfo(SPELL_CREATE_LANCE_ALLIANCE) || + !sSpellMgr->GetSpellInfo(SPELL_CREATE_LANCE_HORDE)) + return false; + return true; } - void OnPeriodic(AuraEffect const* /*aurEff*/) + void HandleScript(SpellEffIndex effIndex) { - if (_applyTimes.empty()) - return; + PreventHitDefaultEffect(effIndex); - // pop stack if it expired for us - if (_applyTimes.front() + GetMaxDuration() < getMSTime()) - ModStackAmount(-1, AURA_REMOVE_BY_EXPIRE); + if (Player* target = GetHitPlayer()) + { + if (target->GetTeam() == ALLIANCE) + GetCaster()->CastSpell(target, SPELL_CREATE_LANCE_ALLIANCE, true); + else + GetCaster()->CastSpell(target, SPELL_CREATE_LANCE_HORDE, true); + } } void Register() OVERRIDE { - AfterEffectApply += AuraEffectApplyFn(spell_gen_turkey_marker_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); - OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_turkey_marker_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_gen_create_lance_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } - - std::list<uint32> _applyTimes; }; - AuraScript* GetAuraScript() const OVERRIDE + SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_turkey_marker_AuraScript(); + return new spell_gen_create_lance_SpellScript(); } }; -class spell_gen_lifeblood : public SpellScriptLoader +class spell_gen_creature_permanent_feign_death : public SpellScriptLoader { public: - spell_gen_lifeblood() : SpellScriptLoader("spell_gen_lifeblood") { } + spell_gen_creature_permanent_feign_death() : SpellScriptLoader("spell_gen_creature_permanent_feign_death") { } - class spell_gen_lifeblood_AuraScript : public AuraScript + class spell_gen_creature_permanent_feign_death_AuraScript : public AuraScript { - PrepareAuraScript(spell_gen_lifeblood_AuraScript); + PrepareAuraScript(spell_gen_creature_permanent_feign_death_AuraScript); - void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (Unit* owner = GetUnitOwner()) - amount += int32(CalculatePct(owner->GetMaxHealth(), 1.5f / aurEff->GetTotalTicks())); + Unit* target = GetTarget(); + target->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); + + if (target->GetTypeId() == TYPEID_UNIT) + target->ToCreature()->SetReactState(REACT_PASSIVE); } void Register() OVERRIDE { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_lifeblood_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); + OnEffectApply += AuraEffectApplyFn(spell_gen_creature_permanent_feign_death_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; AuraScript* GetAuraScript() const OVERRIDE { - return new spell_gen_lifeblood_AuraScript(); + return new spell_gen_creature_permanent_feign_death_AuraScript(); } }; -enum MagicRoosterSpells +enum DalaranDisguiseSpells { - SPELL_MAGIC_ROOSTER_NORMAL = 66122, - SPELL_MAGIC_ROOSTER_DRAENEI_MALE = 66123, - SPELL_MAGIC_ROOSTER_TAUREN_MALE = 66124, + SPELL_SUNREAVER_DISGUISE_TRIGGER = 69672, + SPELL_SUNREAVER_DISGUISE_FEMALE = 70973, + SPELL_SUNREAVER_DISGUISE_MALE = 70974, + + SPELL_SILVER_COVENANT_DISGUISE_TRIGGER = 69673, + SPELL_SILVER_COVENANT_DISGUISE_FEMALE = 70971, + SPELL_SILVER_COVENANT_DISGUISE_MALE = 70972 }; -class spell_gen_magic_rooster : public SpellScriptLoader +class spell_gen_dalaran_disguise : public SpellScriptLoader { public: - spell_gen_magic_rooster() : SpellScriptLoader("spell_gen_magic_rooster") { } + spell_gen_dalaran_disguise(const char* name) : SpellScriptLoader(name) { } - class spell_gen_magic_rooster_SpellScript : public SpellScript + class spell_gen_dalaran_disguise_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_magic_rooster_SpellScript); + PrepareSpellScript(spell_gen_dalaran_disguise_SpellScript); + bool Validate(SpellInfo const* spellEntry) OVERRIDE + { + switch (spellEntry->Id) + { + case SPELL_SUNREAVER_DISGUISE_TRIGGER: + if (!sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_FEMALE) || + !sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_MALE)) + return false; + break; + case SPELL_SILVER_COVENANT_DISGUISE_TRIGGER: + if (!sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_FEMALE) || + !sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_MALE)) + return false; + break; + } + return true; + } - void HandleScript(SpellEffIndex effIndex) + void HandleScript(SpellEffIndex /*effIndex*/) { - PreventHitDefaultEffect(effIndex); - if (Player* target = GetHitPlayer()) + if (Player* player = GetHitPlayer()) { - // prevent client crashes from stacking mounts - target->RemoveAurasByType(SPELL_AURA_MOUNTED); + uint8 gender = player->getGender(); - uint32 spellId = SPELL_MAGIC_ROOSTER_NORMAL; - switch (target->getRace()) + uint32 spellId = GetSpellInfo()->Id; + + switch (spellId) { - case RACE_DRAENEI: - if (target->getGender() == GENDER_MALE) - spellId = SPELL_MAGIC_ROOSTER_DRAENEI_MALE; + case SPELL_SUNREAVER_DISGUISE_TRIGGER: + spellId = gender ? SPELL_SUNREAVER_DISGUISE_FEMALE : SPELL_SUNREAVER_DISGUISE_MALE; break; - case RACE_TAUREN: - if (target->getGender() == GENDER_MALE) - spellId = SPELL_MAGIC_ROOSTER_TAUREN_MALE; + case SPELL_SILVER_COVENANT_DISGUISE_TRIGGER: + spellId = gender ? SPELL_SILVER_COVENANT_DISGUISE_FEMALE : SPELL_SILVER_COVENANT_DISGUISE_MALE; break; default: break; } - target->CastSpell(target, spellId, true); + GetCaster()->CastSpell(player, spellId, true); } } void Register() OVERRIDE { - OnEffectHitTarget += SpellEffectFn(spell_gen_magic_rooster_SpellScript::HandleScript, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_gen_dalaran_disguise_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_magic_rooster_SpellScript(); + return new spell_gen_dalaran_disguise_SpellScript(); } }; -class spell_gen_allow_cast_from_item_only : public SpellScriptLoader +enum DefendVisuals +{ + SPELL_VISUAL_SHIELD_1 = 63130, + SPELL_VISUAL_SHIELD_2 = 63131, + SPELL_VISUAL_SHIELD_3 = 63132 +}; + +class spell_gen_defend : public SpellScriptLoader { public: - spell_gen_allow_cast_from_item_only() : SpellScriptLoader("spell_gen_allow_cast_from_item_only") { } + spell_gen_defend() : SpellScriptLoader("spell_gen_defend") { } - class spell_gen_allow_cast_from_item_only_SpellScript : public SpellScript + class spell_gen_defend_AuraScript : public AuraScript { - PrepareSpellScript(spell_gen_allow_cast_from_item_only_SpellScript); + PrepareAuraScript(spell_gen_defend_AuraScript); - SpellCastResult CheckRequirement() + bool Validate(SpellInfo const* /*spellEntry*/) OVERRIDE { - if (!GetCastItem()) - return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - return SPELL_CAST_OK; + if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_1)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_2)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_3)) + return false; + return true; + } + + void RefreshVisualShields(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (GetCaster()) + { + Unit* target = GetTarget(); + + for (uint8 i = 0; i < GetSpellInfo()->StackAmount; ++i) + target->RemoveAurasDueToSpell(SPELL_VISUAL_SHIELD_1 + i); + + target->CastSpell(target, SPELL_VISUAL_SHIELD_1 + GetAura()->GetStackAmount() - 1, true, NULL, aurEff); + } + else + GetTarget()->RemoveAurasDueToSpell(GetId()); + } + + void RemoveVisualShields(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + for (uint8 i = 0; i < GetSpellInfo()->StackAmount; ++i) + GetTarget()->RemoveAurasDueToSpell(SPELL_VISUAL_SHIELD_1 + i); + } + + void RemoveDummyFromDriver(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + if (TempSummon* vehicle = caster->ToTempSummon()) + if (Unit* rider = vehicle->GetSummoner()) + rider->RemoveAurasDueToSpell(GetId()); } void Register() OVERRIDE { - OnCheckCast += SpellCheckCastFn(spell_gen_allow_cast_from_item_only_SpellScript::CheckRequirement); + SpellInfo const* spell = sSpellMgr->GetSpellInfo(m_scriptSpellId); + + // Defend spells casted by NPCs (add visuals) + if (spell->Effects[EFFECT_0].ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN) + { + AfterEffectApply += AuraEffectApplyFn(spell_gen_defend_AuraScript::RefreshVisualShields, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveVisualShields, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + } + + // Remove Defend spell from player when he dismounts + if (spell->Effects[EFFECT_2].ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN) + OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveDummyFromDriver, EFFECT_2, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL); + + // Defend spells casted by players (add/remove visuals) + if (spell->Effects[EFFECT_1].ApplyAuraName == SPELL_AURA_DUMMY) + { + AfterEffectApply += AuraEffectApplyFn(spell_gen_defend_AuraScript::RefreshVisualShields, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveVisualShields, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); + } } }; - SpellScript* GetSpellScript() const OVERRIDE + AuraScript* GetAuraScript() const OVERRIDE { - return new spell_gen_allow_cast_from_item_only_SpellScript(); + return new spell_gen_defend_AuraScript(); } }; -enum Launch -{ - SPELL_LAUNCH_NO_FALLING_DAMAGE = 66251 -}; - -class spell_gen_launch : public SpellScriptLoader +class spell_gen_despawn_self : public SpellScriptLoader { public: - spell_gen_launch() : SpellScriptLoader("spell_gen_launch") {} + spell_gen_despawn_self() : SpellScriptLoader("spell_gen_despawn_self") { } - class spell_gen_launch_SpellScript : public SpellScript + class spell_gen_despawn_self_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_launch_SpellScript); + PrepareSpellScript(spell_gen_despawn_self_SpellScript); - void HandleScript(SpellEffIndex /*effIndex*/) + bool Load() OVERRIDE { - if (Player* player = GetHitPlayer()) - player->AddAura(SPELL_LAUNCH_NO_FALLING_DAMAGE, player); // prevents falling damage + return GetCaster()->GetTypeId() == TYPEID_UNIT; } - void Launch() + void HandleDummy(SpellEffIndex effIndex) { - WorldLocation const* const position = GetExplTargetDest(); - - if (Player* player = GetHitPlayer()) - { - player->ExitVehicle(); - - // A better research is needed - // There is no spell for this, the following calculation was based on void Spell::CalculateJumpSpeeds - - float speedZ = 10.0f; - float dist = position->GetExactDist2d(player->GetPositionX(), player->GetPositionY()); - float speedXY = dist; - - player->GetMotionMaster()->MoveJump(position->GetPositionX(), position->GetPositionY(), position->GetPositionZ(), speedXY, speedZ); - } + if (GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_DUMMY || GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_SCRIPT_EFFECT) + GetCaster()->ToCreature()->DespawnOrUnsummon(); } void Register() OVERRIDE { - OnEffectHitTarget += SpellEffectFn(spell_gen_launch_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_FORCE_CAST); - AfterHit += SpellHitFn(spell_gen_launch_SpellScript::Launch); + OnEffectHitTarget += SpellEffectFn(spell_gen_despawn_self_SpellScript::HandleDummy, EFFECT_ALL, SPELL_EFFECT_ANY); } }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_launch_SpellScript(); + return new spell_gen_despawn_self_SpellScript(); } }; -enum VehicleScaling +enum DivineStormSpell { - SPELL_GEAR_SCALING = 66668, + SPELL_DIVINE_STORM = 53385, }; -class spell_gen_vehicle_scaling : public SpellScriptLoader +// 70769 Divine Storm! +class spell_gen_divine_storm_cd_reset : public SpellScriptLoader { public: - spell_gen_vehicle_scaling() : SpellScriptLoader("spell_gen_vehicle_scaling") { } + spell_gen_divine_storm_cd_reset() : SpellScriptLoader("spell_gen_divine_storm_cd_reset") { } - class spell_gen_vehicle_scaling_AuraScript : public AuraScript + class spell_gen_divine_storm_cd_reset_SpellScript : public SpellScript { - PrepareAuraScript(spell_gen_vehicle_scaling_AuraScript); + PrepareSpellScript(spell_gen_divine_storm_cd_reset_SpellScript); bool Load() OVERRIDE { - return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER; + return GetCaster()->GetTypeId() == TYPEID_PLAYER; } - void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + bool Validate(SpellInfo const* /*spellEntry*/) OVERRIDE { - Unit* caster = GetCaster(); - float factor; - uint16 baseItemLevel; - - /// @todo Reserach coeffs for different vehicles - switch (GetId()) - { - case SPELL_GEAR_SCALING: - factor = 1.0f; - baseItemLevel = 205; - break; - default: - factor = 1.0f; - baseItemLevel = 170; - break; - } - - float avgILvl = caster->ToPlayer()->GetAverageItemLevel(); - if (avgILvl < baseItemLevel) - return; /// @todo Research possibility of scaling down + if (!sSpellMgr->GetSpellInfo(SPELL_DIVINE_STORM)) + return false; + return true; + } - amount = uint16((avgILvl - baseItemLevel) * factor); + void HandleScript(SpellEffIndex /*effIndex*/) + { + Player* caster = GetCaster()->ToPlayer(); + if (caster->HasSpellCooldown(SPELL_DIVINE_STORM)) + caster->RemoveSpellCooldown(SPELL_DIVINE_STORM, true); } void Register() OVERRIDE { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_vehicle_scaling_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_vehicle_scaling_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_vehicle_scaling_AuraScript::CalculateAmount, EFFECT_2, SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT); + OnEffectHitTarget += SpellEffectFn(spell_gen_divine_storm_cd_reset_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); } }; - AuraScript* GetAuraScript() const OVERRIDE + SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_vehicle_scaling_AuraScript(); + return new spell_gen_divine_storm_cd_reset_SpellScript(); } }; -class spell_gen_oracle_wolvar_reputation : public SpellScriptLoader +class spell_gen_dream_funnel: public SpellScriptLoader { public: - spell_gen_oracle_wolvar_reputation() : SpellScriptLoader("spell_gen_oracle_wolvar_reputation") { } + spell_gen_dream_funnel() : SpellScriptLoader("spell_gen_dream_funnel") { } - class spell_gen_oracle_wolvar_reputation_SpellScript : public SpellScript + class spell_gen_dream_funnel_AuraScript : public AuraScript { - PrepareSpellScript(spell_gen_oracle_wolvar_reputation_SpellScript); + PrepareAuraScript(spell_gen_dream_funnel_AuraScript); - bool Load() OVERRIDE + void HandleEffectCalcAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; + if (GetCaster()) + amount = GetCaster()->GetMaxHealth() * 0.05f; + + canBeRecalculated = false; } - void HandleDummy(SpellEffIndex effIndex) + void Register() OVERRIDE { - Player* player = GetCaster()->ToPlayer(); - uint32 factionId = GetSpellInfo()->Effects[effIndex].CalcValue(); - int32 repChange = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_dream_funnel_AuraScript::HandleEffectCalcAmount, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_dream_funnel_AuraScript::HandleEffectCalcAmount, EFFECT_2, SPELL_AURA_PERIODIC_DAMAGE); + } + }; - FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_gen_dream_funnel_AuraScript(); + } +}; - if (!factionEntry) - return; +class spell_gen_ds_flush_knockback : public SpellScriptLoader +{ + public: + spell_gen_ds_flush_knockback() : SpellScriptLoader("spell_gen_ds_flush_knockback") { } - // Set rep to baserep + basepoints (expecting spillover for oposite faction -> become hated) - // Not when player already has equal or higher rep with this faction - if (player->GetReputationMgr().GetBaseReputation(factionEntry) < repChange) - player->GetReputationMgr().SetReputation(factionEntry, repChange); + class spell_gen_ds_flush_knockback_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_ds_flush_knockback_SpellScript); - // EFFECT_INDEX_2 most likely update at war state, we already handle this in SetReputation + void HandleScript(SpellEffIndex /*effIndex*/) + { + // Here the target is the water spout and determines the position where the player is knocked from + if (Unit* target = GetHitUnit()) + { + if (Player* player = GetCaster()->ToPlayer()) + { + float horizontalSpeed = 20.0f + (40.0f - GetCaster()->GetDistance(target)); + float verticalSpeed = 8.0f; + // This method relies on the Dalaran Sewer map disposition and Water Spout position + // What we do is knock the player from a position exactly behind him and at the end of the pipe + player->KnockbackFrom(target->GetPositionX(), player->GetPositionY(), horizontalSpeed, verticalSpeed); + } + } } void Register() OVERRIDE { - OnEffectHit += SpellEffectFn(spell_gen_oracle_wolvar_reputation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_gen_ds_flush_knockback_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); } }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_oracle_wolvar_reputation_SpellScript(); + return new spell_gen_ds_flush_knockback_SpellScript(); } }; enum DummyTrigger { SPELL_PERSISTANT_SHIELD_TRIGGERED = 26470, - SPELL_PERSISTANT_SHIELD = 26467, + SPELL_PERSISTANT_SHIELD = 26467 }; class spell_gen_dummy_trigger : public SpellScriptLoader @@ -1668,7 +1323,8 @@ class spell_gen_dummy_trigger : public SpellScriptLoader bool Validate(SpellInfo const* /*SpellEntry*/) OVERRIDE { - if (!sSpellMgr->GetSpellInfo(SPELL_PERSISTANT_SHIELD_TRIGGERED) || !sSpellMgr->GetSpellInfo(SPELL_PERSISTANT_SHIELD)) + if (!sSpellMgr->GetSpellInfo(SPELL_PERSISTANT_SHIELD_TRIGGERED) || + !sSpellMgr->GetSpellInfo(SPELL_PERSISTANT_SHIELD)) return false; return true; } @@ -1693,43 +1349,119 @@ class spell_gen_dummy_trigger : public SpellScriptLoader { return new spell_gen_dummy_trigger_SpellScript(); } - }; -class spell_gen_spirit_healer_res : public SpellScriptLoader +class spell_gen_dungeon_credit : public SpellScriptLoader { public: - spell_gen_spirit_healer_res(): SpellScriptLoader("spell_gen_spirit_healer_res") { } + spell_gen_dungeon_credit() : SpellScriptLoader("spell_gen_dungeon_credit") { } - class spell_gen_spirit_healer_res_SpellScript : public SpellScript + class spell_gen_dungeon_credit_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_spirit_healer_res_SpellScript); + PrepareSpellScript(spell_gen_dungeon_credit_SpellScript); bool Load() OVERRIDE { - return GetOriginalCaster() && GetOriginalCaster()->GetTypeId() == TYPEID_PLAYER; + _handled = false; + return GetCaster()->GetTypeId() == TYPEID_UNIT; } - void HandleDummy(SpellEffIndex /* effIndex */) + void CreditEncounter() { - Player* originalCaster = GetOriginalCaster()->ToPlayer(); - if (Unit* target = GetHitUnit()) + // This hook is executed for every target, make sure we only credit instance once + if (_handled) + return; + + _handled = true; + Unit* caster = GetCaster(); + if (InstanceScript* instance = caster->GetInstanceScript()) + instance->UpdateEncounterState(ENCOUNTER_CREDIT_CAST_SPELL, GetSpellInfo()->Id, caster); + } + + void Register() OVERRIDE + { + AfterHit += SpellHitFn(spell_gen_dungeon_credit_SpellScript::CreditEncounter); + } + + private: + bool _handled; + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_gen_dungeon_credit_SpellScript(); + } +}; + +enum EluneCandle +{ + // Creatures + NPC_OMEN = 15467, + + // Spells + SPELL_ELUNE_CANDLE_OMEN_HEAD = 26622, + SPELL_ELUNE_CANDLE_OMEN_CHEST = 26624, + SPELL_ELUNE_CANDLE_OMEN_HAND_R = 26625, + SPELL_ELUNE_CANDLE_OMEN_HAND_L = 26649, + SPELL_ELUNE_CANDLE_NORMAL = 26636 +}; + +class spell_gen_elune_candle : public SpellScriptLoader +{ + public: + spell_gen_elune_candle() : SpellScriptLoader("spell_gen_elune_candle") { } + + class spell_gen_elune_candle_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_elune_candle_SpellScript); + bool Validate(SpellInfo const* /*spellEntry*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_OMEN_HEAD) || + !sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_OMEN_CHEST) || + !sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_OMEN_HAND_R) || + !sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_OMEN_HAND_L) || + !sSpellMgr->GetSpellInfo(SPELL_ELUNE_CANDLE_NORMAL)) + return false; + return true; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + uint32 spellId = 0; + + if (GetHitUnit()->GetEntry() == NPC_OMEN) { - WorldPacket data(SMSG_SPIRIT_HEALER_CONFIRM, 8); - data << uint64(target->GetGUID()); - originalCaster->GetSession()->SendPacket(&data); + switch (urand(0, 3)) + { + case 0: + spellId = SPELL_ELUNE_CANDLE_OMEN_HEAD; + break; + case 1: + spellId = SPELL_ELUNE_CANDLE_OMEN_CHEST; + break; + case 2: + spellId = SPELL_ELUNE_CANDLE_OMEN_HAND_R; + break; + case 3: + spellId = SPELL_ELUNE_CANDLE_OMEN_HAND_L; + break; + } } + else + spellId = SPELL_ELUNE_CANDLE_NORMAL; + + GetCaster()->CastSpell(GetHitUnit(), spellId, true, NULL); } void Register() OVERRIDE { - OnEffectHitTarget += SpellEffectFn(spell_gen_spirit_healer_res_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_gen_elune_candle_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); } }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_spirit_healer_res_SpellScript(); + return new spell_gen_elune_candle_SpellScript(); } }; @@ -1737,7 +1469,7 @@ enum TransporterBackfires { SPELL_TRANSPORTER_MALFUNCTION_POLYMORPH = 23444, SPELL_TRANSPORTER_EVIL_TWIN = 23445, - SPELL_TRANSPORTER_MALFUNCTION_MISS = 36902, + SPELL_TRANSPORTER_MALFUNCTION_MISS = 36902 }; class spell_gen_gadgetzan_transporter_backfire : public SpellScriptLoader @@ -1751,8 +1483,9 @@ class spell_gen_gadgetzan_transporter_backfire : public SpellScriptLoader bool Validate(SpellInfo const* /*SpellEntry*/) OVERRIDE { - if (!sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_MALFUNCTION_POLYMORPH) || !sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_EVIL_TWIN) - || !sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_MALFUNCTION_MISS)) + if (!sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_MALFUNCTION_POLYMORPH) || + !sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_EVIL_TWIN) || + !sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_MALFUNCTION_MISS)) return false; return true; } @@ -1781,10 +1514,63 @@ class spell_gen_gadgetzan_transporter_backfire : public SpellScriptLoader } }; + +class spell_gen_gift_of_naaru : public SpellScriptLoader +{ + public: + spell_gen_gift_of_naaru() : SpellScriptLoader("spell_gen_gift_of_naaru") { } + + class spell_gen_gift_of_naaru_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_gift_of_naaru_AuraScript); + + void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (!GetCaster()) + return; + + float heal = 0.0f; + switch (GetSpellInfo()->SpellFamilyName) + { + case SPELLFAMILY_MAGE: + case SPELLFAMILY_WARLOCK: + case SPELLFAMILY_PRIEST: + heal = 1.885f * float(GetCaster()->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask())); + break; + case SPELLFAMILY_PALADIN: + case SPELLFAMILY_SHAMAN: + heal = std::max(1.885f * float(GetCaster()->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask())), 1.1f * float(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK))); + break; + case SPELLFAMILY_WARRIOR: + case SPELLFAMILY_HUNTER: + case SPELLFAMILY_DEATHKNIGHT: + heal = 1.1f * float(std::max(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetCaster()->GetTotalAttackPowerValue(RANGED_ATTACK))); + break; + case SPELLFAMILY_GENERIC: + default: + break; + } + + int32 healTick = floor(heal / aurEff->GetTotalTicks()); + amount += int32(std::max(healTick, 0)); + } + + void Register() OVERRIDE + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_gift_of_naaru_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_gen_gift_of_naaru_AuraScript(); + } +}; + enum GnomishTransporter { SPELL_TRANSPORTER_SUCCESS = 23441, - SPELL_TRANSPORTER_FAILURE = 23446, + SPELL_TRANSPORTER_FAILURE = 23446 }; class spell_gen_gnomish_transporter : public SpellScriptLoader @@ -1798,15 +1584,15 @@ class spell_gen_gnomish_transporter : public SpellScriptLoader bool Validate(SpellInfo const* /*SpellEntry*/) OVERRIDE { - if (!sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_SUCCESS) || !sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_FAILURE)) + if (!sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_SUCCESS) || + !sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_FAILURE)) return false; return true; } void HandleDummy(SpellEffIndex /* effIndex */) { - Unit* caster = GetCaster(); - caster->CastSpell(caster, roll_chance_i(50) ? SPELL_TRANSPORTER_SUCCESS : SPELL_TRANSPORTER_FAILURE, true); + GetCaster()->CastSpell(GetCaster(), roll_chance_i(50) ? SPELL_TRANSPORTER_SUCCESS : SPELL_TRANSPORTER_FAILURE, true); } void Register() OVERRIDE @@ -1821,182 +1607,256 @@ class spell_gen_gnomish_transporter : public SpellScriptLoader } }; -enum DalaranDisguiseSpells +class spell_gen_gunship_portal : public SpellScriptLoader { - SPELL_SUNREAVER_DISGUISE_TRIGGER = 69672, - SPELL_SUNREAVER_DISGUISE_FEMALE = 70973, - SPELL_SUNREAVER_DISGUISE_MALE = 70974, + public: + spell_gen_gunship_portal() : SpellScriptLoader("spell_gen_gunship_portal") { } - SPELL_SILVER_COVENANT_DISGUISE_TRIGGER = 69673, - SPELL_SILVER_COVENANT_DISGUISE_FEMALE = 70971, - SPELL_SILVER_COVENANT_DISGUISE_MALE = 70972, + class spell_gen_gunship_portal_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_gunship_portal_SpellScript); + + bool Load() OVERRIDE + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + Player* caster = GetCaster()->ToPlayer(); + if (Battleground* bg = caster->GetBattleground()) + if (bg->GetTypeID(true) == BATTLEGROUND_IC) + bg->DoAction(1, caster->GetGUID()); + } + + void Register() OVERRIDE + { + OnEffectHitTarget += SpellEffectFn(spell_gen_gunship_portal_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_gen_gunship_portal_SpellScript(); + } }; -class spell_gen_dalaran_disguise : public SpellScriptLoader +enum Launch +{ + SPELL_LAUNCH_NO_FALLING_DAMAGE = 66251 +}; + +class spell_gen_launch : public SpellScriptLoader { public: - spell_gen_dalaran_disguise(const char* name) : SpellScriptLoader(name) {} + spell_gen_launch() : SpellScriptLoader("spell_gen_launch") { } - class spell_gen_dalaran_disguise_SpellScript : public SpellScript + class spell_gen_launch_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_dalaran_disguise_SpellScript); - bool Validate(SpellInfo const* spellEntry) OVERRIDE + PrepareSpellScript(spell_gen_launch_SpellScript); + + void HandleScript(SpellEffIndex /*effIndex*/) { - switch (spellEntry->Id) - { - case SPELL_SUNREAVER_DISGUISE_TRIGGER: - if (!sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_MALE)) - return false; - break; - case SPELL_SILVER_COVENANT_DISGUISE_TRIGGER: - if (!sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_MALE)) - return false; - break; - } - return true; + if (Player* player = GetHitPlayer()) + player->AddAura(SPELL_LAUNCH_NO_FALLING_DAMAGE, player); // prevents falling damage } - void HandleScript(SpellEffIndex /*effIndex*/) + void Launch() { + WorldLocation const* const position = GetExplTargetDest(); + if (Player* player = GetHitPlayer()) { - uint8 gender = player->getGender(); + player->ExitVehicle(); - uint32 spellId = GetSpellInfo()->Id; + // A better research is needed + // There is no spell for this, the following calculation was based on void Spell::CalculateJumpSpeeds - switch (spellId) - { - case SPELL_SUNREAVER_DISGUISE_TRIGGER: - spellId = gender ? SPELL_SUNREAVER_DISGUISE_FEMALE : SPELL_SUNREAVER_DISGUISE_MALE; - break; - case SPELL_SILVER_COVENANT_DISGUISE_TRIGGER: - spellId = gender ? SPELL_SILVER_COVENANT_DISGUISE_FEMALE : SPELL_SILVER_COVENANT_DISGUISE_MALE; - break; - default: - break; - } - GetCaster()->CastSpell(player, spellId, true); + float speedZ = 10.0f; + float dist = position->GetExactDist2d(player->GetPositionX(), player->GetPositionY()); + float speedXY = dist; + + player->GetMotionMaster()->MoveJump(position->GetPositionX(), position->GetPositionY(), position->GetPositionZ(), speedXY, speedZ); } } void Register() OVERRIDE { - OnEffectHitTarget += SpellEffectFn(spell_gen_dalaran_disguise_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_gen_launch_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_FORCE_CAST); + AfterHit += SpellHitFn(spell_gen_launch_SpellScript::Launch); } }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_dalaran_disguise_SpellScript(); + return new spell_gen_launch_SpellScript(); } }; -/* DOCUMENTATION: Break-Shield spells - Break-Shield spells can be classified in three groups: +class spell_gen_increase_stats_buff : public SpellScriptLoader +{ + public: + spell_gen_increase_stats_buff(char const* scriptName) : SpellScriptLoader(scriptName) { } - - Spells on vehicle bar used by players: - + EFFECT_0: SCRIPT_EFFECT - + EFFECT_1: NONE - + EFFECT_2: NONE - - Spells casted by players triggered by script: - + EFFECT_0: SCHOOL_DAMAGE - + EFFECT_1: SCRIPT_EFFECT - + EFFECT_2: FORCE_CAST - - Spells casted by NPCs on players: - + EFFECT_0: SCHOOL_DAMAGE - + EFFECT_1: SCRIPT_EFFECT - + EFFECT_2: NONE + class spell_gen_increase_stats_buff_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_increase_stats_buff_SpellScript); - In the following script we handle the SCRIPT_EFFECT for effIndex EFFECT_0 and EFFECT_1. - - When handling EFFECT_0 we're in the "Spells on vehicle bar used by players" case - and we'll trigger "Spells casted by players triggered by script" - - When handling EFFECT_1 we're in the "Spells casted by players triggered by script" - or "Spells casted by NPCs on players" so we'll search for the first defend layer and drop it. -*/ + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (GetHitUnit()->IsInRaidWith(GetCaster())) + GetCaster()->CastSpell(GetCaster(), GetEffectValue() + 1, true); // raid buff + else + GetCaster()->CastSpell(GetHitUnit(), GetEffectValue(), true); // single-target buff + } -enum BreakShieldSpells + void Register() OVERRIDE + { + OnEffectHitTarget += SpellEffectFn(spell_gen_increase_stats_buff_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_gen_increase_stats_buff_SpellScript(); + } +}; + +class spell_gen_lifeblood : public SpellScriptLoader { - SPELL_BREAK_SHIELD_DAMAGE_2K = 62626, - SPELL_BREAK_SHIELD_DAMAGE_10K = 64590, + public: + spell_gen_lifeblood() : SpellScriptLoader("spell_gen_lifeblood") { } - SPELL_BREAK_SHIELD_TRIGGER_FACTION_MOUNTS = 62575, // Also on ToC5 mounts - SPELL_BREAK_SHIELD_TRIGGER_CAMPAING_WARHORSE = 64595, - SPELL_BREAK_SHIELD_TRIGGER_UNK = 66480, + class spell_gen_lifeblood_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_lifeblood_AuraScript); + + void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* owner = GetUnitOwner()) + amount += int32(CalculatePct(owner->GetMaxHealth(), 1.5f / aurEff->GetTotalTicks())); + } + + void Register() OVERRIDE + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_lifeblood_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_gen_lifeblood_AuraScript(); + } }; -class spell_gen_break_shield: public SpellScriptLoader +enum GenericLifebloom +{ + SPELL_HEXLORD_MALACRASS_LIFEBLOOM_FINAL_HEAL = 43422, + SPELL_TUR_RAGEPAW_LIFEBLOOM_FINAL_HEAL = 52552, + SPELL_CENARION_SCOUT_LIFEBLOOM_FINAL_HEAL = 53692, + SPELL_TWISTED_VISAGE_LIFEBLOOM_FINAL_HEAL = 57763, + SPELL_FACTION_CHAMPIONS_DRU_LIFEBLOOM_FINAL_HEAL = 66094 +}; + +class spell_gen_lifebloom : public SpellScriptLoader { public: - spell_gen_break_shield(const char* name) : SpellScriptLoader(name) {} + spell_gen_lifebloom(const char* name, uint32 spellId) : SpellScriptLoader(name), _spellId(spellId) { } - class spell_gen_break_shield_SpellScript : public SpellScript + class spell_gen_lifebloom_AuraScript : public AuraScript { - PrepareSpellScript(spell_gen_break_shield_SpellScript) + PrepareAuraScript(spell_gen_lifebloom_AuraScript); - void HandleScriptEffect(SpellEffIndex effIndex) + public: + spell_gen_lifebloom_AuraScript(uint32 spellId) : AuraScript(), _spellId(spellId) { } + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { - Unit* target = GetHitUnit(); + if (!sSpellMgr->GetSpellInfo(_spellId)) + return false; + return true; + } - switch (effIndex) - { - case EFFECT_0: // On spells wich trigger the damaging spell (and also the visual) - { - uint32 spellId; + void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + // Final heal only on duration end + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL) + return; - switch (GetSpellInfo()->Id) - { - case SPELL_BREAK_SHIELD_TRIGGER_UNK: - case SPELL_BREAK_SHIELD_TRIGGER_CAMPAING_WARHORSE: - spellId = SPELL_BREAK_SHIELD_DAMAGE_10K; - break; - case SPELL_BREAK_SHIELD_TRIGGER_FACTION_MOUNTS: - spellId = SPELL_BREAK_SHIELD_DAMAGE_2K; - break; - default: - return; - } + // final heal + GetTarget()->CastSpell(GetTarget(), _spellId, true, NULL, aurEff, GetCasterGUID()); + } - if (Unit* rider = GetCaster()->GetCharmer()) - rider->CastSpell(target, spellId, false); - else - GetCaster()->CastSpell(target, spellId, false); - break; - } - case EFFECT_1: // On damaging spells, for removing a defend layer + void Register() OVERRIDE + { + AfterEffectRemove += AuraEffectRemoveFn(spell_gen_lifebloom_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL); + } + + private: + uint32 _spellId; + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_gen_lifebloom_AuraScript(_spellId); + } + + private: + uint32 _spellId; +}; + +enum MagicRoosterSpells +{ + SPELL_MAGIC_ROOSTER_NORMAL = 66122, + SPELL_MAGIC_ROOSTER_DRAENEI_MALE = 66123, + SPELL_MAGIC_ROOSTER_TAUREN_MALE = 66124 +}; + +class spell_gen_magic_rooster : public SpellScriptLoader +{ + public: + spell_gen_magic_rooster() : SpellScriptLoader("spell_gen_magic_rooster") { } + + class spell_gen_magic_rooster_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_magic_rooster_SpellScript); + + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Player* target = GetHitPlayer()) + { + // prevent client crashes from stacking mounts + target->RemoveAurasByType(SPELL_AURA_MOUNTED); + + uint32 spellId = SPELL_MAGIC_ROOSTER_NORMAL; + switch (target->getRace()) { - Unit::AuraApplicationMap const& auras = target->GetAppliedAuras(); - for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) - { - if (Aura* aura = itr->second->GetBase()) - { - SpellInfo const* auraInfo = aura->GetSpellInfo(); - if (auraInfo && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN)) - { - aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL); - // Remove dummys from rider (Necessary for updating visual shields) - if (Unit* rider = target->GetCharmer()) - if (Aura* defend = rider->GetAura(aura->GetId())) - defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL); - break; - } - } - } - break; + case RACE_DRAENEI: + if (target->getGender() == GENDER_MALE) + spellId = SPELL_MAGIC_ROOSTER_DRAENEI_MALE; + break; + case RACE_TAUREN: + if (target->getGender() == GENDER_MALE) + spellId = SPELL_MAGIC_ROOSTER_TAUREN_MALE; + break; + default: + break; } - default: - break; + + target->CastSpell(target, spellId, true); } } void Register() OVERRIDE { - OnEffectHitTarget += SpellEffectFn(spell_gen_break_shield_SpellScript::HandleScriptEffect, EFFECT_FIRST_FOUND, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_gen_magic_rooster_SpellScript::HandleScript, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT); } }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_break_shield_SpellScript(); + return new spell_gen_magic_rooster_SpellScript(); } }; @@ -2161,285 +2021,290 @@ class spell_gen_mounted_charge: public SpellScriptLoader } }; -enum DefendVisuals +enum Netherbloom { - SPELL_VISUAL_SHIELD_1 = 63130, - SPELL_VISUAL_SHIELD_2 = 63131, - SPELL_VISUAL_SHIELD_3 = 63132, + SPELL_NETHERBLOOM_POLLEN_1 = 28703 }; -class spell_gen_defend : public SpellScriptLoader +// 28702 - Netherbloom +class spell_gen_netherbloom : public SpellScriptLoader { public: - spell_gen_defend() : SpellScriptLoader("spell_gen_defend") { } + spell_gen_netherbloom() : SpellScriptLoader("spell_gen_netherbloom") { } - class spell_gen_defend_AuraScript : public AuraScript + class spell_gen_netherbloom_SpellScript : public SpellScript { - PrepareAuraScript(spell_gen_defend_AuraScript); + PrepareSpellScript(spell_gen_netherbloom_SpellScript); - bool Validate(SpellInfo const* /*spellEntry*/) OVERRIDE + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { - if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_1)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_2)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_3)) - return false; + for (uint8 i = 0; i < 5; ++i) + if (!sSpellMgr->GetSpellInfo(SPELL_NETHERBLOOM_POLLEN_1 + i)) + return false; return true; } - void RefreshVisualShields(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + void HandleScript(SpellEffIndex effIndex) { - if (GetCaster()) - { - Unit* target = GetTarget(); + PreventHitDefaultEffect(effIndex); - for (uint8 i = 0; i < GetSpellInfo()->StackAmount; ++i) - target->RemoveAurasDueToSpell(SPELL_VISUAL_SHIELD_1 + i); + if (Unit* target = GetHitUnit()) + { + // 25% chance of casting a random buff + if (roll_chance_i(75)) + return; - target->CastSpell(target, SPELL_VISUAL_SHIELD_1 + GetAura()->GetStackAmount() - 1, true, NULL, aurEff); - } - else - GetTarget()->RemoveAurasDueToSpell(GetId()); - } + // triggered spells are 28703 to 28707 + // Note: some sources say, that there was the possibility of + // receiving a debuff. However, this seems to be removed by a patch. - void RemoveVisualShields(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - for (uint8 i = 0; i < GetSpellInfo()->StackAmount; ++i) - GetTarget()->RemoveAurasDueToSpell(SPELL_VISUAL_SHIELD_1 + i); - } + // don't overwrite an existing aura + for (uint8 i = 0; i < 5; ++i) + if (target->HasAura(SPELL_NETHERBLOOM_POLLEN_1 + i)) + return; - void RemoveDummyFromDriver(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Unit* caster = GetCaster()) - if (TempSummon* vehicle = caster->ToTempSummon()) - if (Unit* rider = vehicle->GetSummoner()) - rider->RemoveAurasDueToSpell(GetId()); + target->CastSpell(target, SPELL_NETHERBLOOM_POLLEN_1 + urand(0, 4), true); + } } void Register() OVERRIDE { - SpellInfo const* spell = sSpellMgr->GetSpellInfo(m_scriptSpellId); - - // Defend spells casted by NPCs (add visuals) - if (spell->Effects[EFFECT_0].ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN) - { - AfterEffectApply += AuraEffectApplyFn(spell_gen_defend_AuraScript::RefreshVisualShields, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); - OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveVisualShields, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); - } - - // Remove Defend spell from player when he dismounts - if (spell->Effects[EFFECT_2].ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN) - OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveDummyFromDriver, EFFECT_2, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL); - - // Defend spells casted by players (add/remove visuals) - if (spell->Effects[EFFECT_1].ApplyAuraName == SPELL_AURA_DUMMY) - { - AfterEffectApply += AuraEffectApplyFn(spell_gen_defend_AuraScript::RefreshVisualShields, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); - OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveVisualShields, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); - } + OnEffectHitTarget += SpellEffectFn(spell_gen_netherbloom_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; - AuraScript* GetAuraScript() const OVERRIDE + SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_defend_AuraScript(); + return new spell_gen_netherbloom_SpellScript(); } }; -enum MountedDuelSpells +enum NightmareVine { - SPELL_ON_TOURNAMENT_MOUNT = 63034, - SPELL_MOUNTED_DUEL = 62875, + SPELL_NIGHTMARE_POLLEN = 28721 }; -class spell_gen_tournament_duel : public SpellScriptLoader +// 28720 - Nightmare Vine +class spell_gen_nightmare_vine : public SpellScriptLoader { public: - spell_gen_tournament_duel() : SpellScriptLoader("spell_gen_tournament_duel") { } + spell_gen_nightmare_vine() : SpellScriptLoader("spell_gen_nightmare_vine") { } - class spell_gen_tournament_duel_SpellScript : public SpellScript + class spell_gen_nightmare_vine_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_tournament_duel_SpellScript); + PrepareSpellScript(spell_gen_nightmare_vine_SpellScript); - bool Validate(SpellInfo const* /*spellEntry*/) OVERRIDE + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { - if (!sSpellMgr->GetSpellInfo(SPELL_ON_TOURNAMENT_MOUNT)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_MOUNTED_DUEL)) + if (!sSpellMgr->GetSpellInfo(SPELL_NIGHTMARE_POLLEN)) return false; return true; } - void HandleScriptEffect(SpellEffIndex /*effIndex*/) + void HandleScript(SpellEffIndex effIndex) { - if (Unit* rider = GetCaster()->GetCharmer()) + PreventHitDefaultEffect(effIndex); + + if (Unit* target = GetHitUnit()) { - if (Player* plrTarget = GetHitPlayer()) - { - if (plrTarget->HasAura(SPELL_ON_TOURNAMENT_MOUNT) && plrTarget->GetVehicleBase()) - rider->CastSpell(plrTarget, SPELL_MOUNTED_DUEL, true); - } - else if (Unit* unitTarget = GetHitUnit()) - { - if (unitTarget->GetCharmer() && unitTarget->GetCharmer()->GetTypeId() == TYPEID_PLAYER && unitTarget->GetCharmer()->HasAura(SPELL_ON_TOURNAMENT_MOUNT)) - rider->CastSpell(unitTarget->GetCharmer(), SPELL_MOUNTED_DUEL, true); - } + // 25% chance of casting Nightmare Pollen + if (roll_chance_i(25)) + target->CastSpell(target, SPELL_NIGHTMARE_POLLEN, true); } } void Register() OVERRIDE { - OnEffectHitTarget += SpellEffectFn(spell_gen_tournament_duel_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_gen_nightmare_vine_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_tournament_duel_SpellScript(); + return new spell_gen_nightmare_vine_SpellScript(); } }; -enum TournamentMountsSpells +enum ObsidianArmor { - SPELL_LANCE_EQUIPPED = 62853, + SPELL_GEN_OBSIDIAN_ARMOR_HOLY = 27536, + SPELL_GEN_OBSIDIAN_ARMOR_FIRE = 27533, + SPELL_GEN_OBSIDIAN_ARMOR_NATURE = 27538, + SPELL_GEN_OBSIDIAN_ARMOR_FROST = 27534, + SPELL_GEN_OBSIDIAN_ARMOR_SHADOW = 27535, + SPELL_GEN_OBSIDIAN_ARMOR_ARCANE = 27540 }; -class spell_gen_summon_tournament_mount : public SpellScriptLoader +// 27539 - Obsidian Armor +class spell_gen_obsidian_armor : public SpellScriptLoader { public: - spell_gen_summon_tournament_mount() : SpellScriptLoader("spell_gen_summon_tournament_mount") { } + spell_gen_obsidian_armor() : SpellScriptLoader("spell_gen_obsidian_armor") { } - class spell_gen_summon_tournament_mount_SpellScript : public SpellScript + class spell_gen_obsidian_armor_AuraScript : public AuraScript { - PrepareSpellScript(spell_gen_summon_tournament_mount_SpellScript); + PrepareAuraScript(spell_gen_obsidian_armor_AuraScript); - bool Validate(SpellInfo const* /*spellEntry*/) OVERRIDE + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { - if (!sSpellMgr->GetSpellInfo(SPELL_LANCE_EQUIPPED)) + if (!sSpellMgr->GetSpellInfo(SPELL_GEN_OBSIDIAN_ARMOR_HOLY) || + !sSpellMgr->GetSpellInfo(SPELL_GEN_OBSIDIAN_ARMOR_FIRE) || + !sSpellMgr->GetSpellInfo(SPELL_GEN_OBSIDIAN_ARMOR_NATURE) || + !sSpellMgr->GetSpellInfo(SPELL_GEN_OBSIDIAN_ARMOR_FROST) || + !sSpellMgr->GetSpellInfo(SPELL_GEN_OBSIDIAN_ARMOR_SHADOW) || + !sSpellMgr->GetSpellInfo(SPELL_GEN_OBSIDIAN_ARMOR_ARCANE)) return false; return true; } - SpellCastResult CheckIfLanceEquiped() + bool CheckProc(ProcEventInfo& eventInfo) { - if (GetCaster()->IsInDisallowedMountForm()) - GetCaster()->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT); + if (eventInfo.GetDamageInfo()->GetSpellInfo()) // eventInfo.GetSpellInfo() + return false; - if (!GetCaster()->HasAura(SPELL_LANCE_EQUIPPED)) + if (GetFirstSchoolInMask(eventInfo.GetSchoolMask()) == SPELL_SCHOOL_NORMAL) + return false; + + return true; + } + + void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + + uint32 spellId = 0; + switch (GetFirstSchoolInMask(eventInfo.GetSchoolMask())) { - SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_HAVE_LANCE_EQUIPPED); - return SPELL_FAILED_CUSTOM_ERROR; + case SPELL_SCHOOL_HOLY: + spellId = SPELL_GEN_OBSIDIAN_ARMOR_HOLY; + break; + case SPELL_SCHOOL_FIRE: + spellId = SPELL_GEN_OBSIDIAN_ARMOR_FIRE; + break; + case SPELL_SCHOOL_NATURE: + spellId = SPELL_GEN_OBSIDIAN_ARMOR_NATURE; + break; + case SPELL_SCHOOL_FROST: + spellId = SPELL_GEN_OBSIDIAN_ARMOR_FROST; + break; + case SPELL_SCHOOL_SHADOW: + spellId = SPELL_GEN_OBSIDIAN_ARMOR_SHADOW; + break; + case SPELL_SCHOOL_ARCANE: + spellId = SPELL_GEN_OBSIDIAN_ARMOR_ARCANE; + break; + default: + return; } - - return SPELL_CAST_OK; + GetTarget()->CastSpell(GetTarget(), spellId, true, NULL, aurEff); } void Register() OVERRIDE { - OnCheckCast += SpellCheckCastFn(spell_gen_summon_tournament_mount_SpellScript::CheckIfLanceEquiped); + DoCheckProc += AuraCheckProcFn(spell_gen_obsidian_armor_AuraScript::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_gen_obsidian_armor_AuraScript::OnProc, EFFECT_0, SPELL_AURA_DUMMY); } }; - SpellScript* GetSpellScript() const OVERRIDE + AuraScript* GetAuraScript() const OVERRIDE { - return new spell_gen_summon_tournament_mount_SpellScript(); + return new spell_gen_obsidian_armor_AuraScript(); } }; enum TournamentPennantSpells { - SPELL_PENNANT_STORMWIND_ASPIRANT = 62595, - SPELL_PENNANT_STORMWIND_VALIANT = 62596, - SPELL_PENNANT_STORMWIND_CHAMPION = 62594, - SPELL_PENNANT_GNOMEREGAN_ASPIRANT = 63394, - SPELL_PENNANT_GNOMEREGAN_VALIANT = 63395, - SPELL_PENNANT_GNOMEREGAN_CHAMPION = 63396, - SPELL_PENNANT_SEN_JIN_ASPIRANT = 63397, - SPELL_PENNANT_SEN_JIN_VALIANT = 63398, - SPELL_PENNANT_SEN_JIN_CHAMPION = 63399, - SPELL_PENNANT_SILVERMOON_ASPIRANT = 63401, - SPELL_PENNANT_SILVERMOON_VALIANT = 63402, - SPELL_PENNANT_SILVERMOON_CHAMPION = 63403, - SPELL_PENNANT_DARNASSUS_ASPIRANT = 63404, - SPELL_PENNANT_DARNASSUS_VALIANT = 63405, - SPELL_PENNANT_DARNASSUS_CHAMPION = 63406, - SPELL_PENNANT_EXODAR_ASPIRANT = 63421, - SPELL_PENNANT_EXODAR_VALIANT = 63422, - SPELL_PENNANT_EXODAR_CHAMPION = 63423, - SPELL_PENNANT_IRONFORGE_ASPIRANT = 63425, - SPELL_PENNANT_IRONFORGE_VALIANT = 63426, - SPELL_PENNANT_IRONFORGE_CHAMPION = 63427, - SPELL_PENNANT_UNDERCITY_ASPIRANT = 63428, - SPELL_PENNANT_UNDERCITY_VALIANT = 63429, - SPELL_PENNANT_UNDERCITY_CHAMPION = 63430, - SPELL_PENNANT_ORGRIMMAR_ASPIRANT = 63431, - SPELL_PENNANT_ORGRIMMAR_VALIANT = 63432, - SPELL_PENNANT_ORGRIMMAR_CHAMPION = 63433, - SPELL_PENNANT_THUNDER_BLUFF_ASPIRANT = 63434, - SPELL_PENNANT_THUNDER_BLUFF_VALIANT = 63435, - SPELL_PENNANT_THUNDER_BLUFF_CHAMPION = 63436, - SPELL_PENNANT_ARGENT_CRUSADE_ASPIRANT = 63606, - SPELL_PENNANT_ARGENT_CRUSADE_VALIANT = 63500, - SPELL_PENNANT_ARGENT_CRUSADE_CHAMPION = 63501, - SPELL_PENNANT_EBON_BLADE_ASPIRANT = 63607, - SPELL_PENNANT_EBON_BLADE_VALIANT = 63608, - SPELL_PENNANT_EBON_BLADE_CHAMPION = 63609, + SPELL_PENNANT_STORMWIND_ASPIRANT = 62595, + SPELL_PENNANT_STORMWIND_VALIANT = 62596, + SPELL_PENNANT_STORMWIND_CHAMPION = 62594, + SPELL_PENNANT_GNOMEREGAN_ASPIRANT = 63394, + SPELL_PENNANT_GNOMEREGAN_VALIANT = 63395, + SPELL_PENNANT_GNOMEREGAN_CHAMPION = 63396, + SPELL_PENNANT_SEN_JIN_ASPIRANT = 63397, + SPELL_PENNANT_SEN_JIN_VALIANT = 63398, + SPELL_PENNANT_SEN_JIN_CHAMPION = 63399, + SPELL_PENNANT_SILVERMOON_ASPIRANT = 63401, + SPELL_PENNANT_SILVERMOON_VALIANT = 63402, + SPELL_PENNANT_SILVERMOON_CHAMPION = 63403, + SPELL_PENNANT_DARNASSUS_ASPIRANT = 63404, + SPELL_PENNANT_DARNASSUS_VALIANT = 63405, + SPELL_PENNANT_DARNASSUS_CHAMPION = 63406, + SPELL_PENNANT_EXODAR_ASPIRANT = 63421, + SPELL_PENNANT_EXODAR_VALIANT = 63422, + SPELL_PENNANT_EXODAR_CHAMPION = 63423, + SPELL_PENNANT_IRONFORGE_ASPIRANT = 63425, + SPELL_PENNANT_IRONFORGE_VALIANT = 63426, + SPELL_PENNANT_IRONFORGE_CHAMPION = 63427, + SPELL_PENNANT_UNDERCITY_ASPIRANT = 63428, + SPELL_PENNANT_UNDERCITY_VALIANT = 63429, + SPELL_PENNANT_UNDERCITY_CHAMPION = 63430, + SPELL_PENNANT_ORGRIMMAR_ASPIRANT = 63431, + SPELL_PENNANT_ORGRIMMAR_VALIANT = 63432, + SPELL_PENNANT_ORGRIMMAR_CHAMPION = 63433, + SPELL_PENNANT_THUNDER_BLUFF_ASPIRANT = 63434, + SPELL_PENNANT_THUNDER_BLUFF_VALIANT = 63435, + SPELL_PENNANT_THUNDER_BLUFF_CHAMPION = 63436, + SPELL_PENNANT_ARGENT_CRUSADE_ASPIRANT = 63606, + SPELL_PENNANT_ARGENT_CRUSADE_VALIANT = 63500, + SPELL_PENNANT_ARGENT_CRUSADE_CHAMPION = 63501, + SPELL_PENNANT_EBON_BLADE_ASPIRANT = 63607, + SPELL_PENNANT_EBON_BLADE_VALIANT = 63608, + SPELL_PENNANT_EBON_BLADE_CHAMPION = 63609 }; enum TournamentMounts { - NPC_STORMWIND_STEED = 33217, - NPC_IRONFORGE_RAM = 33316, - NPC_GNOMEREGAN_MECHANOSTRIDER = 33317, - NPC_EXODAR_ELEKK = 33318, - NPC_DARNASSIAN_NIGHTSABER = 33319, - NPC_ORGRIMMAR_WOLF = 33320, - NPC_DARK_SPEAR_RAPTOR = 33321, - NPC_THUNDER_BLUFF_KODO = 33322, - NPC_SILVERMOON_HAWKSTRIDER = 33323, - NPC_FORSAKEN_WARHORSE = 33324, - NPC_ARGENT_WARHORSE = 33782, - NPC_ARGENT_STEED_ASPIRANT = 33845, - NPC_ARGENT_HAWKSTRIDER_ASPIRANT = 33844, + NPC_STORMWIND_STEED = 33217, + NPC_IRONFORGE_RAM = 33316, + NPC_GNOMEREGAN_MECHANOSTRIDER = 33317, + NPC_EXODAR_ELEKK = 33318, + NPC_DARNASSIAN_NIGHTSABER = 33319, + NPC_ORGRIMMAR_WOLF = 33320, + NPC_DARK_SPEAR_RAPTOR = 33321, + NPC_THUNDER_BLUFF_KODO = 33322, + NPC_SILVERMOON_HAWKSTRIDER = 33323, + NPC_FORSAKEN_WARHORSE = 33324, + NPC_ARGENT_WARHORSE = 33782, + NPC_ARGENT_STEED_ASPIRANT = 33845, + NPC_ARGENT_HAWKSTRIDER_ASPIRANT = 33844 }; enum TournamentQuestsAchievements { - ACHIEVEMENT_CHAMPION_STORMWIND = 2781, - ACHIEVEMENT_CHAMPION_DARNASSUS = 2777, - ACHIEVEMENT_CHAMPION_IRONFORGE = 2780, - ACHIEVEMENT_CHAMPION_GNOMEREGAN = 2779, - ACHIEVEMENT_CHAMPION_THE_EXODAR = 2778, - ACHIEVEMENT_CHAMPION_ORGRIMMAR = 2783, - ACHIEVEMENT_CHAMPION_SEN_JIN = 2784, - ACHIEVEMENT_CHAMPION_THUNDER_BLUFF = 2786, - ACHIEVEMENT_CHAMPION_UNDERCITY = 2787, - ACHIEVEMENT_CHAMPION_SILVERMOON = 2785, - ACHIEVEMENT_ARGENT_VALOR = 2758, - ACHIEVEMENT_CHAMPION_ALLIANCE = 2782, - ACHIEVEMENT_CHAMPION_HORDE = 2788, - - QUEST_VALIANT_OF_STORMWIND = 13593, - QUEST_A_VALIANT_OF_STORMWIND = 13684, - QUEST_VALIANT_OF_DARNASSUS = 13706, - QUEST_A_VALIANT_OF_DARNASSUS = 13689, - QUEST_VALIANT_OF_IRONFORGE = 13703, - QUEST_A_VALIANT_OF_IRONFORGE = 13685, - QUEST_VALIANT_OF_GNOMEREGAN = 13704, - QUEST_A_VALIANT_OF_GNOMEREGAN = 13688, - QUEST_VALIANT_OF_THE_EXODAR = 13705, - QUEST_A_VALIANT_OF_THE_EXODAR = 13690, - QUEST_VALIANT_OF_ORGRIMMAR = 13707, - QUEST_A_VALIANT_OF_ORGRIMMAR = 13691, - QUEST_VALIANT_OF_SEN_JIN = 13708, - QUEST_A_VALIANT_OF_SEN_JIN = 13693, - QUEST_VALIANT_OF_THUNDER_BLUFF = 13709, - QUEST_A_VALIANT_OF_THUNDER_BLUFF = 13694, - QUEST_VALIANT_OF_UNDERCITY = 13710, - QUEST_A_VALIANT_OF_UNDERCITY = 13695, - QUEST_VALIANT_OF_SILVERMOON = 13711, - QUEST_A_VALIANT_OF_SILVERMOON = 13696, + ACHIEVEMENT_CHAMPION_STORMWIND = 2781, + ACHIEVEMENT_CHAMPION_DARNASSUS = 2777, + ACHIEVEMENT_CHAMPION_IRONFORGE = 2780, + ACHIEVEMENT_CHAMPION_GNOMEREGAN = 2779, + ACHIEVEMENT_CHAMPION_THE_EXODAR = 2778, + ACHIEVEMENT_CHAMPION_ORGRIMMAR = 2783, + ACHIEVEMENT_CHAMPION_SEN_JIN = 2784, + ACHIEVEMENT_CHAMPION_THUNDER_BLUFF = 2786, + ACHIEVEMENT_CHAMPION_UNDERCITY = 2787, + ACHIEVEMENT_CHAMPION_SILVERMOON = 2785, + ACHIEVEMENT_ARGENT_VALOR = 2758, + ACHIEVEMENT_CHAMPION_ALLIANCE = 2782, + ACHIEVEMENT_CHAMPION_HORDE = 2788, + + QUEST_VALIANT_OF_STORMWIND = 13593, + QUEST_A_VALIANT_OF_STORMWIND = 13684, + QUEST_VALIANT_OF_DARNASSUS = 13706, + QUEST_A_VALIANT_OF_DARNASSUS = 13689, + QUEST_VALIANT_OF_IRONFORGE = 13703, + QUEST_A_VALIANT_OF_IRONFORGE = 13685, + QUEST_VALIANT_OF_GNOMEREGAN = 13704, + QUEST_A_VALIANT_OF_GNOMEREGAN = 13688, + QUEST_VALIANT_OF_THE_EXODAR = 13705, + QUEST_A_VALIANT_OF_THE_EXODAR = 13690, + QUEST_VALIANT_OF_ORGRIMMAR = 13707, + QUEST_A_VALIANT_OF_ORGRIMMAR = 13691, + QUEST_VALIANT_OF_SEN_JIN = 13708, + QUEST_A_VALIANT_OF_SEN_JIN = 13693, + QUEST_VALIANT_OF_THUNDER_BLUFF = 13709, + QUEST_A_VALIANT_OF_THUNDER_BLUFF = 13694, + QUEST_VALIANT_OF_UNDERCITY = 13710, + QUEST_A_VALIANT_OF_UNDERCITY = 13695, + QUEST_VALIANT_OF_SILVERMOON = 13711, + QUEST_A_VALIANT_OF_SILVERMOON = 13696 }; class spell_gen_on_tournament_mount : public SpellScriptLoader @@ -2600,605 +2465,323 @@ class spell_gen_on_tournament_mount : public SpellScriptLoader } }; -class spell_gen_tournament_pennant : public SpellScriptLoader +class spell_gen_oracle_wolvar_reputation : public SpellScriptLoader { public: - spell_gen_tournament_pennant() : SpellScriptLoader("spell_gen_tournament_pennant") { } + spell_gen_oracle_wolvar_reputation() : SpellScriptLoader("spell_gen_oracle_wolvar_reputation") { } - class spell_gen_tournament_pennant_AuraScript : public AuraScript + class spell_gen_oracle_wolvar_reputation_SpellScript : public SpellScript { - PrepareAuraScript(spell_gen_tournament_pennant_AuraScript); + PrepareSpellScript(spell_gen_oracle_wolvar_reputation_SpellScript); bool Load() OVERRIDE { - return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER; - } - - void HandleApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Unit* caster = GetCaster()) - if (!caster->GetVehicleBase()) - caster->RemoveAurasDueToSpell(GetId()); - } - - void Register() OVERRIDE - { - OnEffectApply += AuraEffectApplyFn(spell_gen_tournament_pennant_AuraScript::HandleApplyEffect, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); - } - }; - - AuraScript* GetAuraScript() const OVERRIDE - { - return new spell_gen_tournament_pennant_AuraScript(); - } -}; - -enum ChaosBlast -{ - SPELL_CHAOS_BLAST = 37675, -}; - -class spell_gen_chaos_blast : public SpellScriptLoader -{ - public: - spell_gen_chaos_blast() : SpellScriptLoader("spell_gen_chaos_blast") { } - - class spell_gen_chaos_blast_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_chaos_blast_SpellScript) - - bool Validate(SpellInfo const* /*SpellEntry*/) OVERRIDE - { - if (!sSpellMgr->GetSpellInfo(SPELL_CHAOS_BLAST)) - return false; - return true; - } - void HandleDummy(SpellEffIndex /* effIndex */) - { - int32 basepoints0 = 100; - Unit* caster = GetCaster(); - if (Unit* target = GetHitUnit()) - caster->CastCustomSpell(target, SPELL_CHAOS_BLAST, &basepoints0, NULL, NULL, true); - } - - void Register() OVERRIDE - { - OnEffectHitTarget += SpellEffectFn(spell_gen_chaos_blast_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript* GetSpellScript() const OVERRIDE - { - return new spell_gen_chaos_blast_SpellScript(); - } - -}; - -class spell_gen_ds_flush_knockback : public SpellScriptLoader -{ - public: - spell_gen_ds_flush_knockback() : SpellScriptLoader("spell_gen_ds_flush_knockback") {} - - class spell_gen_ds_flush_knockback_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_ds_flush_knockback_SpellScript); - - void HandleScript(SpellEffIndex /*effIndex*/) - { - // Here the target is the water spout and determines the position where the player is knocked from - if (Unit* target = GetHitUnit()) - { - if (Player* player = GetCaster()->ToPlayer()) - { - float horizontalSpeed = 20.0f + (40.0f - GetCaster()->GetDistance(target)); - float verticalSpeed = 8.0f; - // This method relies on the Dalaran Sewer map disposition and Water Spout position - // What we do is knock the player from a position exactly behind him and at the end of the pipe - player->KnockbackFrom(target->GetPositionX(), player->GetPositionY(), horizontalSpeed, verticalSpeed); - } - } - } - - void Register() OVERRIDE - { - OnEffectHitTarget += SpellEffectFn(spell_gen_ds_flush_knockback_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript* GetSpellScript() const OVERRIDE - { - return new spell_gen_ds_flush_knockback_SpellScript(); - } -}; - -class spell_gen_wg_water : public SpellScriptLoader -{ - public: - spell_gen_wg_water() : SpellScriptLoader("spell_gen_wg_water") {} - - class spell_gen_wg_water_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_wg_water_SpellScript); - - SpellCastResult CheckCast() - { - if (!GetSpellInfo()->CheckTargetCreatureType(GetCaster())) - return SPELL_FAILED_DONT_REPORT; - return SPELL_CAST_OK; + return GetCaster()->GetTypeId() == TYPEID_PLAYER; } - void Register() OVERRIDE + void HandleDummy(SpellEffIndex effIndex) { - OnCheckCast += SpellCheckCastFn(spell_gen_wg_water_SpellScript::CheckCast); - } - }; - - SpellScript* GetSpellScript() const OVERRIDE - { - return new spell_gen_wg_water_SpellScript(); - } -}; - -class spell_gen_count_pct_from_max_hp : public SpellScriptLoader -{ - public: - spell_gen_count_pct_from_max_hp(char const* name, int32 damagePct = 0) : SpellScriptLoader(name), _damagePct(damagePct) { } + Player* player = GetCaster()->ToPlayer(); + uint32 factionId = GetSpellInfo()->Effects[effIndex].CalcValue(); + int32 repChange = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); - class spell_gen_count_pct_from_max_hp_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_count_pct_from_max_hp_SpellScript) + FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); - public: - spell_gen_count_pct_from_max_hp_SpellScript(int32 damagePct) : SpellScript(), _damagePct(damagePct) { } + if (!factionEntry) + return; - void RecalculateDamage() - { - if (!_damagePct) - _damagePct = GetHitDamage(); + // Set rep to baserep + basepoints (expecting spillover for oposite faction -> become hated) + // Not when player already has equal or higher rep with this faction + if (player->GetReputationMgr().GetBaseReputation(factionEntry) < repChange) + player->GetReputationMgr().SetReputation(factionEntry, repChange); - SetHitDamage(GetHitUnit()->CountPctFromMaxHealth(_damagePct)); + // EFFECT_INDEX_2 most likely update at war state, we already handle this in SetReputation } void Register() OVERRIDE { - OnHit += SpellHitFn(spell_gen_count_pct_from_max_hp_SpellScript::RecalculateDamage); + OnEffectHit += SpellEffectFn(spell_gen_oracle_wolvar_reputation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } - - private: - int32 _damagePct; }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_count_pct_from_max_hp_SpellScript(_damagePct); - } - - private: - int32 _damagePct; -}; - -class spell_gen_despawn_self : public SpellScriptLoader -{ -public: - spell_gen_despawn_self() : SpellScriptLoader("spell_gen_despawn_self") { } - - class spell_gen_despawn_self_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_despawn_self_SpellScript); - - bool Load() OVERRIDE - { - return GetCaster()->GetTypeId() == TYPEID_UNIT; - } - - void HandleDummy(SpellEffIndex effIndex) - { - if (GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_DUMMY || GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_SCRIPT_EFFECT) - GetCaster()->ToCreature()->DespawnOrUnsummon(); - } - - void Register() OVERRIDE - { - OnEffectHitTarget += SpellEffectFn(spell_gen_despawn_self_SpellScript::HandleDummy, EFFECT_ALL, SPELL_EFFECT_ANY); - } - }; - - SpellScript* GetSpellScript() const OVERRIDE - { - return new spell_gen_despawn_self_SpellScript(); - } -}; - -class spell_gen_touch_the_nightmare : public SpellScriptLoader -{ -public: - spell_gen_touch_the_nightmare() : SpellScriptLoader("spell_gen_touch_the_nightmare") { } - - class spell_gen_touch_the_nightmare_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_touch_the_nightmare_SpellScript); - - void HandleDamageCalc(SpellEffIndex /*effIndex*/) - { - uint32 bp = GetCaster()->GetMaxHealth() * 0.3f; - SetHitDamage(bp); - } - - void Register() OVERRIDE - { - OnEffectHitTarget += SpellEffectFn(spell_gen_touch_the_nightmare_SpellScript::HandleDamageCalc, EFFECT_2, SPELL_EFFECT_SCHOOL_DAMAGE); - } - }; - - SpellScript* GetSpellScript() const OVERRIDE - { - return new spell_gen_touch_the_nightmare_SpellScript(); - } -}; - -class spell_gen_dream_funnel: public SpellScriptLoader -{ -public: - spell_gen_dream_funnel() : SpellScriptLoader("spell_gen_dream_funnel") { } - - class spell_gen_dream_funnel_AuraScript : public AuraScript - { - PrepareAuraScript(spell_gen_dream_funnel_AuraScript); - - void HandleEffectCalcAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) - { - if (GetCaster()) - amount = GetCaster()->GetMaxHealth() * 0.05f; - - canBeRecalculated = false; - } - - void Register() OVERRIDE - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_dream_funnel_AuraScript::HandleEffectCalcAmount, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_dream_funnel_AuraScript::HandleEffectCalcAmount, EFFECT_2, SPELL_AURA_PERIODIC_DAMAGE); + return new spell_gen_oracle_wolvar_reputation_SpellScript(); } - }; - - AuraScript* GetAuraScript() const OVERRIDE - { - return new spell_gen_dream_funnel_AuraScript(); - } }; -enum GenericBandage +enum OrcDisguiseSpells { - SPELL_RECENTLY_BANDAGED = 11196, + SPELL_ORC_DISGUISE_TRIGGER = 45759, + SPELL_ORC_DISGUISE_MALE = 45760, + SPELL_ORC_DISGUISE_FEMALE = 45762 }; -class spell_gen_bandage : public SpellScriptLoader +class spell_gen_orc_disguise : public SpellScriptLoader { public: - spell_gen_bandage() : SpellScriptLoader("spell_gen_bandage") { } + spell_gen_orc_disguise() : SpellScriptLoader("spell_gen_orc_disguise") { } - class spell_gen_bandage_SpellScript : public SpellScript + class spell_gen_orc_disguise_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_bandage_SpellScript); + PrepareSpellScript(spell_gen_orc_disguise_SpellScript); - bool Validate(SpellInfo const* /*spell*/) OVERRIDE + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { - if (!sSpellMgr->GetSpellInfo(SPELL_RECENTLY_BANDAGED)) + if (!sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_TRIGGER) || + !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_MALE) || + !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_FEMALE)) return false; return true; } - SpellCastResult CheckCast() + void HandleScript(SpellEffIndex /*effIndex*/) { - if (Unit* target = GetExplTargetUnit()) + Unit* caster = GetCaster(); + if (Player* target = GetHitPlayer()) { - if (target->HasAura(SPELL_RECENTLY_BANDAGED)) - return SPELL_FAILED_TARGET_AURASTATE; + uint8 gender = target->getGender(); + if (!gender) + caster->CastSpell(target, SPELL_ORC_DISGUISE_MALE, true); + else + caster->CastSpell(target, SPELL_ORC_DISGUISE_FEMALE, true); } - return SPELL_CAST_OK; - } - - void HandleScript() - { - if (Unit* target = GetHitUnit()) - GetCaster()->CastSpell(target, SPELL_RECENTLY_BANDAGED, true); } void Register() OVERRIDE { - OnCheckCast += SpellCheckCastFn(spell_gen_bandage_SpellScript::CheckCast); - AfterHit += SpellHitFn(spell_gen_bandage_SpellScript::HandleScript); + OnEffectHitTarget += SpellEffectFn(spell_gen_orc_disguise_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_bandage_SpellScript(); + return new spell_gen_orc_disguise_SpellScript(); } }; -enum GenericLifebloom +enum ParachuteSpells { - SPELL_HEXLORD_MALACRASS_LIFEBLOOM_FINAL_HEAL = 43422, - SPELL_TUR_RAGEPAW_LIFEBLOOM_FINAL_HEAL = 52552, - SPELL_CENARION_SCOUT_LIFEBLOOM_FINAL_HEAL = 53692, - SPELL_TWISTED_VISAGE_LIFEBLOOM_FINAL_HEAL = 57763, - SPELL_FACTION_CHAMPIONS_DRU_LIFEBLOOM_FINAL_HEAL = 66094, + SPELL_PARACHUTE = 45472, + SPELL_PARACHUTE_BUFF = 44795, }; -class spell_gen_lifebloom : public SpellScriptLoader +// 45472 Parachute +class spell_gen_parachute : public SpellScriptLoader { public: - spell_gen_lifebloom(const char* name, uint32 spellId) : SpellScriptLoader(name), _spellId(spellId) { } + spell_gen_parachute() : SpellScriptLoader("spell_gen_parachute") { } - class spell_gen_lifebloom_AuraScript : public AuraScript + class spell_gen_parachute_AuraScript : public AuraScript { - PrepareAuraScript(spell_gen_lifebloom_AuraScript); - - public: - spell_gen_lifebloom_AuraScript(uint32 spellId) : AuraScript(), _spellId(spellId) { } + PrepareAuraScript(spell_gen_parachute_AuraScript); - bool Validate(SpellInfo const* /*spell*/) OVERRIDE + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { - if (!sSpellMgr->GetSpellInfo(_spellId)) + if (!sSpellMgr->GetSpellInfo(SPELL_PARACHUTE) || + !sSpellMgr->GetSpellInfo(SPELL_PARACHUTE_BUFF)) return false; return true; } - void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) { - // Final heal only on duration end - if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL) - return; - - // final heal - GetTarget()->CastSpell(GetTarget(), _spellId, true, NULL, aurEff, GetCasterGUID()); + if (Player* target = GetTarget()->ToPlayer()) + if (target->IsFalling()) + { + target->RemoveAurasDueToSpell(SPELL_PARACHUTE); + target->CastSpell(target, SPELL_PARACHUTE_BUFF, true); + } } void Register() OVERRIDE { - AfterEffectRemove += AuraEffectRemoveFn(spell_gen_lifebloom_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_parachute_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); } - - private: - uint32 _spellId; }; AuraScript* GetAuraScript() const OVERRIDE { - return new spell_gen_lifebloom_AuraScript(_spellId); + return new spell_gen_parachute_AuraScript(); } - - private: - uint32 _spellId; }; -enum SummonElemental +enum ParachuteIC { - SPELL_SUMMON_FIRE_ELEMENTAL = 8985, - SPELL_SUMMON_EARTH_ELEMENTAL = 19704 + SPELL_PARACHUTE_IC = 66657 }; -class spell_gen_summon_elemental : public SpellScriptLoader +class spell_gen_parachute_ic : public SpellScriptLoader { public: - spell_gen_summon_elemental(const char* name, uint32 spellId) : SpellScriptLoader(name), _spellId(spellId) { } + spell_gen_parachute_ic() : SpellScriptLoader("spell_gen_parachute_ic") { } - class spell_gen_summon_elemental_AuraScript : public AuraScript + class spell_gen_parachute_ic_AuraScript : public AuraScript { - PrepareAuraScript(spell_gen_summon_elemental_AuraScript); - - public: - spell_gen_summon_elemental_AuraScript(uint32 spellId) : AuraScript(), _spellId(spellId) { } - - bool Validate(SpellInfo const* /*spell*/) OVERRIDE - { - if (!sSpellMgr->GetSpellInfo(_spellId)) - return false; - return true; - } - - void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (GetCaster()) - if (Unit* owner = GetCaster()->GetOwner()) - owner->CastSpell(owner, _spellId, true); - } + PrepareAuraScript(spell_gen_parachute_ic_AuraScript) - void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleTriggerSpell(AuraEffect const* /*aurEff*/) { - if (GetCaster()) - if (Unit* owner = GetCaster()->GetOwner()) - if (owner->GetTypeId() == TYPEID_PLAYER) /// @todo this check is maybe wrong - owner->ToPlayer()->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); + if (Player* target = GetTarget()->ToPlayer()) + if (target->m_movementInfo.jump.fallTime > 2000) + target->CastSpell(target, SPELL_PARACHUTE_IC, true); } void Register() OVERRIDE { - AfterEffectApply += AuraEffectApplyFn(spell_gen_summon_elemental_AuraScript::AfterApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectRemoveFn(spell_gen_summon_elemental_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_parachute_ic_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } - - private: - uint32 _spellId; }; AuraScript* GetAuraScript() const OVERRIDE { - return new spell_gen_summon_elemental_AuraScript(_spellId); + return new spell_gen_parachute_ic_AuraScript(); } - - private: - uint32 _spellId; }; -enum FoamSword +enum PetSummoned { - ITEM_FOAM_SWORD_GREEN = 45061, - ITEM_FOAM_SWORD_PINK = 45176, - ITEM_FOAM_SWORD_BLUE = 45177, - ITEM_FOAM_SWORD_RED = 45178, - ITEM_FOAM_SWORD_YELLOW = 45179, - - SPELL_BONKED = 62991, - SPELL_FOAM_SWORD_DEFEAT = 62994, - SPELL_ON_GUARD = 62972, + NPC_DOOMGUARD = 11859, + NPC_INFERNAL = 89, + NPC_IMP = 416 }; -class spell_gen_upper_deck_create_foam_sword : public SpellScriptLoader +class spell_gen_pet_summoned : public SpellScriptLoader { public: - spell_gen_upper_deck_create_foam_sword() : SpellScriptLoader("spell_gen_upper_deck_create_foam_sword") { } + spell_gen_pet_summoned() : SpellScriptLoader("spell_gen_pet_summoned") { } - class spell_gen_upper_deck_create_foam_sword_SpellScript : public SpellScript + class spell_gen_pet_summoned_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_upper_deck_create_foam_sword_SpellScript); - - void HandleScript(SpellEffIndex effIndex) - { - if (Player* player = GetHitPlayer()) - { - static uint32 const itemId[5] = { ITEM_FOAM_SWORD_GREEN, ITEM_FOAM_SWORD_PINK, ITEM_FOAM_SWORD_BLUE, ITEM_FOAM_SWORD_RED, ITEM_FOAM_SWORD_YELLOW }; - // player can only have one of these items - for (uint8 i = 0; i < 5; ++i) - { - if (player->HasItemCount(itemId[i], 1, true)) - return; - } - - CreateItem(effIndex, itemId[urand(0, 4)]); - } - } + PrepareSpellScript(spell_gen_pet_summoned_SpellScript); - void Register() OVERRIDE + bool Load() OVERRIDE { - OnEffectHitTarget += SpellEffectFn(spell_gen_upper_deck_create_foam_sword_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + return GetCaster()->GetTypeId() == TYPEID_PLAYER; } - }; - - SpellScript* GetSpellScript() const OVERRIDE - { - return new spell_gen_upper_deck_create_foam_sword_SpellScript(); - } -}; - -class spell_gen_bonked : public SpellScriptLoader -{ - public: - spell_gen_bonked() : SpellScriptLoader("spell_gen_bonked") { } - - class spell_gen_bonked_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_bonked_SpellScript); void HandleScript(SpellEffIndex /*effIndex*/) { - if (Player* target = GetHitPlayer()) + Player* player = GetCaster()->ToPlayer(); + if (player->GetLastPetNumber()) { - Aura const* aura = GetHitAura(); - if (!(aura && aura->GetStackAmount() == 3)) - return; + PetType newPetType = (player->getClass() == CLASS_HUNTER) ? HUNTER_PET : SUMMON_PET; + if (Pet* newPet = new Pet(player, newPetType)) + { + if (newPet->LoadPetFromDB(player, 0, player->GetLastPetNumber(), true)) + { + // revive the pet if it is dead + if (newPet->getDeathState() == DEAD) + newPet->setDeathState(ALIVE); - target->CastSpell(target, SPELL_FOAM_SWORD_DEFEAT, true); - target->RemoveAurasDueToSpell(SPELL_BONKED); + newPet->SetFullHealth(); + newPet->SetPower(newPet->getPowerType(), newPet->GetMaxPower(newPet->getPowerType())); - if (Aura const* aura = target->GetAura(SPELL_ON_GUARD)) - { - if (Item* item = target->GetItemByGuid(aura->GetCastItemGUID())) - target->DestroyItemCount(item->GetEntry(), 1, true); + switch (newPet->GetEntry()) + { + case NPC_DOOMGUARD: + case NPC_INFERNAL: + newPet->SetEntry(NPC_IMP); + break; + default: + break; + } + } + else + delete newPet; } } } void Register() OVERRIDE { - OnEffectHitTarget += SpellEffectFn(spell_gen_bonked_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_gen_pet_summoned_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_bonked_SpellScript(); + return new spell_gen_pet_summoned_SpellScript(); } }; -class spell_gen_gift_of_naaru : public SpellScriptLoader +class spell_gen_profession_research : public SpellScriptLoader { public: - spell_gen_gift_of_naaru() : SpellScriptLoader("spell_gen_gift_of_naaru") { } + spell_gen_profession_research() : SpellScriptLoader("spell_gen_profession_research") { } - class spell_gen_gift_of_naaru_AuraScript : public AuraScript + class spell_gen_profession_research_SpellScript : public SpellScript { - PrepareAuraScript(spell_gen_gift_of_naaru_AuraScript); + PrepareSpellScript(spell_gen_profession_research_SpellScript); - void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + bool Load() OVERRIDE { - if (!GetCaster()) - return; + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - float heal = 0.0f; - switch (GetSpellInfo()->SpellFamilyName) + SpellCastResult CheckRequirement() + { + if (HasDiscoveredAllSpells(GetSpellInfo()->Id, GetCaster()->ToPlayer())) { - case SPELLFAMILY_MAGE: - case SPELLFAMILY_WARLOCK: - case SPELLFAMILY_PRIEST: - heal = 1.885f * float(GetCaster()->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask())); - break; - case SPELLFAMILY_PALADIN: - case SPELLFAMILY_SHAMAN: - heal = std::max(1.885f * float(GetCaster()->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask())), 1.1f * float(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK))); - break; - case SPELLFAMILY_WARRIOR: - case SPELLFAMILY_HUNTER: - case SPELLFAMILY_DEATHKNIGHT: - heal = 1.1f * float(std::max(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetCaster()->GetTotalAttackPowerValue(RANGED_ATTACK))); - break; - case SPELLFAMILY_GENERIC: - default: - break; + SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_NOTHING_TO_DISCOVER); + return SPELL_FAILED_CUSTOM_ERROR; } - int32 healTick = floor(heal / aurEff->GetTotalTicks()); - amount += int32(std::max(healTick, 0)); + return SPELL_CAST_OK; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + Player* caster = GetCaster()->ToPlayer(); + uint32 spellId = GetSpellInfo()->Id; + + // learn random explicit discovery recipe (if any) + if (uint32 discoveredSpellId = GetExplicitDiscoverySpell(spellId, caster)) + caster->learnSpell(discoveredSpellId, false); + + caster->UpdateCraftSkill(spellId); } void Register() OVERRIDE { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_gift_of_naaru_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); + OnCheckCast += SpellCheckCastFn(spell_gen_profession_research_SpellScript::CheckRequirement); + OnEffectHitTarget += SpellEffectFn(spell_gen_profession_research_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); } }; - AuraScript* GetAuraScript() const OVERRIDE + SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_gift_of_naaru_AuraScript(); + return new spell_gen_profession_research_SpellScript(); } }; -class spell_gen_increase_stats_buff : public SpellScriptLoader +class spell_gen_remove_flight_auras : public SpellScriptLoader { public: - spell_gen_increase_stats_buff(char const* scriptName) : SpellScriptLoader(scriptName) { } + spell_gen_remove_flight_auras() : SpellScriptLoader("spell_gen_remove_flight_auras") { } - class spell_gen_increase_stats_buff_SpellScript : public SpellScript + class spell_gen_remove_flight_auras_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_increase_stats_buff_SpellScript); + PrepareSpellScript(spell_gen_remove_flight_auras_SpellScript); - void HandleDummy(SpellEffIndex /*effIndex*/) + void HandleScript(SpellEffIndex /*effIndex*/) { - if (GetHitUnit()->IsInRaidWith(GetCaster())) - GetCaster()->CastSpell(GetCaster(), GetEffectValue() + 1, true); // raid buff - else - GetCaster()->CastSpell(GetHitUnit(), GetEffectValue(), true); // single-target buff + if (Unit* target = GetHitUnit()) + { + target->RemoveAurasByType(SPELL_AURA_FLY); + target->RemoveAurasByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED); + } } void Register() OVERRIDE { - OnEffectHitTarget += SpellEffectFn(spell_gen_increase_stats_buff_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_gen_remove_flight_auras_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); } }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_increase_stats_buff_SpellScript(); + return new spell_gen_remove_flight_auras_SpellScript(); } }; @@ -3217,10 +2800,10 @@ class spell_gen_replenishment : public SpellScriptLoader { PrepareAuraScript(spell_gen_replenishment_AuraScript); - bool Validate(SpellInfo const* /*spell*/) OVERRIDE + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { if (!sSpellMgr->GetSpellInfo(SPELL_REPLENISHMENT) || - !sSpellMgr->GetSpellInfo(SPELL_INFINITE_REPLENISHMENT)) + !sSpellMgr->GetSpellInfo(SPELL_INFINITE_REPLENISHMENT)) return false; return true; } @@ -3257,11 +2840,12 @@ class spell_gen_replenishment : public SpellScriptLoader } }; + enum RunningWildMountIds { RUNNING_WILD_MODEL_MALE = 29422, RUNNING_WILD_MODEL_FEMALE = 29423, - SPELL_ALTERED_FORM = 97709, + SPELL_ALTERED_FORM = 97709 }; class spell_gen_running_wild : public SpellScriptLoader @@ -3410,133 +2994,523 @@ class spell_gen_darkflight : public SpellScriptLoader return new spell_gen_darkflight_SpellScript(); } }; - -enum OrcDisguiseSpells +enum SeaforiumSpells { - SPELL_ORC_DISGUISE_TRIGGER = 45759, - SPELL_ORC_DISGUISE_MALE = 45760, - SPELL_ORC_DISGUISE_FEMALE = 45762, + SPELL_PLANT_CHARGES_CREDIT_ACHIEVEMENT = 60937 }; -class spell_gen_orc_disguise : public SpellScriptLoader +class spell_gen_seaforium_blast : public SpellScriptLoader { public: - spell_gen_orc_disguise() : SpellScriptLoader("spell_gen_orc_disguise") { } + spell_gen_seaforium_blast() : SpellScriptLoader("spell_gen_seaforium_blast") { } - class spell_gen_orc_disguise_SpellScript : public SpellScript + class spell_gen_seaforium_blast_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_orc_disguise_SpellScript); + PrepareSpellScript(spell_gen_seaforium_blast_SpellScript); - bool Validate(SpellInfo const* /*spell*/) OVERRIDE + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { - if (!sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_TRIGGER) || !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_MALE) || - !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_FEMALE)) + if (!sSpellMgr->GetSpellInfo(SPELL_PLANT_CHARGES_CREDIT_ACHIEVEMENT)) return false; return true; } - void HandleScript(SpellEffIndex /*effIndex*/) + bool Load() OVERRIDE { - Unit* caster = GetCaster(); - if (Player* target = GetHitPlayer()) + // OriginalCaster is always available in Spell::prepare + return GetOriginalCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void AchievementCredit(SpellEffIndex /*effIndex*/) + { + // but in effect handling OriginalCaster can become NULL + if (Unit* originalCaster = GetOriginalCaster()) + if (GameObject* go = GetHitGObj()) + if (go->GetGOInfo()->type == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING) + originalCaster->CastSpell(originalCaster, SPELL_PLANT_CHARGES_CREDIT_ACHIEVEMENT, true); + } + + void Register() OVERRIDE + { + OnEffectHitTarget += SpellEffectFn(spell_gen_seaforium_blast_SpellScript::AchievementCredit, EFFECT_1, SPELL_EFFECT_GAMEOBJECT_DAMAGE); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_gen_seaforium_blast_SpellScript(); + } +}; + +enum SpectatorCheerTrigger +{ + EMOTE_ONE_SHOT_CHEER = 4, + EMOTE_ONE_SHOT_EXCLAMATION = 5, + EMOTE_ONE_SHOT_APPLAUD = 21 +}; + +uint8 const EmoteArray[3] = { EMOTE_ONE_SHOT_CHEER, EMOTE_ONE_SHOT_EXCLAMATION, EMOTE_ONE_SHOT_APPLAUD }; + +class spell_gen_spectator_cheer_trigger : public SpellScriptLoader +{ + public: + spell_gen_spectator_cheer_trigger() : SpellScriptLoader("spell_gen_spectator_cheer_trigger") { } + + class spell_gen_spectator_cheer_trigger_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_spectator_cheer_trigger_SpellScript) + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + GetCaster()->HandleEmoteCommand(EmoteArray[urand(0, 2)]); + } + + void Register() OVERRIDE + { + OnEffectHitTarget += SpellEffectFn(spell_gen_spectator_cheer_trigger_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_gen_spectator_cheer_trigger_SpellScript(); + } +}; + +class spell_gen_spirit_healer_res : public SpellScriptLoader +{ + public: + spell_gen_spirit_healer_res(): SpellScriptLoader("spell_gen_spirit_healer_res") { } + + class spell_gen_spirit_healer_res_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_spirit_healer_res_SpellScript); + + bool Load() OVERRIDE + { + return GetOriginalCaster() && GetOriginalCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + Player* originalCaster = GetOriginalCaster()->ToPlayer(); + if (Unit* target = GetHitUnit()) { - uint8 gender = target->getGender(); - if (!gender) - caster->CastSpell(target, SPELL_ORC_DISGUISE_MALE, true); - else - caster->CastSpell(target, SPELL_ORC_DISGUISE_FEMALE, true); + WorldPacket data(SMSG_SPIRIT_HEALER_CONFIRM, 8); + data << uint64(target->GetGUID()); + originalCaster->GetSession()->SendPacket(&data); } } void Register() OVERRIDE { - OnEffectHitTarget += SpellEffectFn(spell_gen_orc_disguise_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_gen_spirit_healer_res_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_orc_disguise_SpellScript(); + return new spell_gen_spirit_healer_res_SpellScript(); } }; -enum WhisperGulchYoggSaronWhisper +enum SummonElemental { - SPELL_YOGG_SARON_WHISPER_DUMMY = 29072 + SPELL_SUMMON_FIRE_ELEMENTAL = 8985, + SPELL_SUMMON_EARTH_ELEMENTAL = 19704 }; -class spell_gen_whisper_gulch_yogg_saron_whisper : public SpellScriptLoader +class spell_gen_summon_elemental : public SpellScriptLoader { public: - spell_gen_whisper_gulch_yogg_saron_whisper() : SpellScriptLoader("spell_gen_whisper_gulch_yogg_saron_whisper") { } + spell_gen_summon_elemental(const char* name, uint32 spellId) : SpellScriptLoader(name), _spellId(spellId) { } - class spell_gen_whisper_gulch_yogg_saron_whisper_AuraScript : public AuraScript + class spell_gen_summon_elemental_AuraScript : public AuraScript { - PrepareAuraScript(spell_gen_whisper_gulch_yogg_saron_whisper_AuraScript); + PrepareAuraScript(spell_gen_summon_elemental_AuraScript); + + public: + spell_gen_summon_elemental_AuraScript(uint32 spellId) : AuraScript(), _spellId(spellId) { } bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { - if (!sSpellMgr->GetSpellInfo(SPELL_YOGG_SARON_WHISPER_DUMMY)) + if (!sSpellMgr->GetSpellInfo(_spellId)) return false; return true; } - void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) + void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - PreventDefaultAction(); - GetTarget()->CastSpell((Unit*)NULL, SPELL_YOGG_SARON_WHISPER_DUMMY, true); + if (GetCaster()) + if (Unit* owner = GetCaster()->GetOwner()) + owner->CastSpell(owner, _spellId, true); + } + + void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (GetCaster()) + if (Unit* owner = GetCaster()->GetOwner()) + if (owner->GetTypeId() == TYPEID_PLAYER) /// @todo this check is maybe wrong + owner->ToPlayer()->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); } void Register() OVERRIDE { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_whisper_gulch_yogg_saron_whisper_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + AfterEffectApply += AuraEffectApplyFn(spell_gen_summon_elemental_AuraScript::AfterApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_gen_summon_elemental_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } + + private: + uint32 _spellId; }; AuraScript* GetAuraScript() const OVERRIDE { - return new spell_gen_whisper_gulch_yogg_saron_whisper_AuraScript(); + return new spell_gen_summon_elemental_AuraScript(_spellId); } + + private: + uint32 _spellId; }; -enum SpectatorCheerTrigger +enum TournamentMountsSpells { - EMOTE_ONE_SHOT_CHEER = 4, - EMOTE_ONE_SHOT_EXCLAMATION = 5, - EMOTE_ONE_SHOT_APPLAUD = 21 + SPELL_LANCE_EQUIPPED = 62853 }; -uint8 const EmoteArray[3] = { EMOTE_ONE_SHOT_CHEER, EMOTE_ONE_SHOT_EXCLAMATION, EMOTE_ONE_SHOT_APPLAUD }; +class spell_gen_summon_tournament_mount : public SpellScriptLoader +{ + public: + spell_gen_summon_tournament_mount() : SpellScriptLoader("spell_gen_summon_tournament_mount") { } -class spell_gen_spectator_cheer_trigger : public SpellScriptLoader + class spell_gen_summon_tournament_mount_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_summon_tournament_mount_SpellScript); + + bool Validate(SpellInfo const* /*spellEntry*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_LANCE_EQUIPPED)) + return false; + return true; + } + + SpellCastResult CheckIfLanceEquiped() + { + if (GetCaster()->IsInDisallowedMountForm()) + GetCaster()->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT); + + if (!GetCaster()->HasAura(SPELL_LANCE_EQUIPPED)) + { + SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_HAVE_LANCE_EQUIPPED); + return SPELL_FAILED_CUSTOM_ERROR; + } + + return SPELL_CAST_OK; + } + + void Register() OVERRIDE + { + OnCheckCast += SpellCheckCastFn(spell_gen_summon_tournament_mount_SpellScript::CheckIfLanceEquiped); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_gen_summon_tournament_mount_SpellScript(); + } +}; + + +enum MountedDuelSpells +{ + SPELL_ON_TOURNAMENT_MOUNT = 63034, + SPELL_MOUNTED_DUEL = 62875 +}; + +class spell_gen_tournament_duel : public SpellScriptLoader { public: - spell_gen_spectator_cheer_trigger() : SpellScriptLoader("spell_gen_spectator_cheer_trigger") { } + spell_gen_tournament_duel() : SpellScriptLoader("spell_gen_tournament_duel") { } - class spell_gen_spectator_cheer_trigger_SpellScript : public SpellScript + class spell_gen_tournament_duel_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_spectator_cheer_trigger_SpellScript) + PrepareSpellScript(spell_gen_tournament_duel_SpellScript); - void HandleDummy(SpellEffIndex /*effIndex*/) + bool Validate(SpellInfo const* /*spellEntry*/) OVERRIDE { - GetCaster()->HandleEmoteCommand(EmoteArray[urand(0, 2)]); + if (!sSpellMgr->GetSpellInfo(SPELL_ON_TOURNAMENT_MOUNT) || + !sSpellMgr->GetSpellInfo(SPELL_MOUNTED_DUEL)) + return false; + return true; + } + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + if (Unit* rider = GetCaster()->GetCharmer()) + { + if (Player* playerTarget = GetHitPlayer()) + { + if (playerTarget->HasAura(SPELL_ON_TOURNAMENT_MOUNT) && playerTarget->GetVehicleBase()) + rider->CastSpell(playerTarget, SPELL_MOUNTED_DUEL, true); + } + else if (Unit* unitTarget = GetHitUnit()) + { + if (unitTarget->GetCharmer() && unitTarget->GetCharmer()->GetTypeId() == TYPEID_PLAYER && unitTarget->GetCharmer()->HasAura(SPELL_ON_TOURNAMENT_MOUNT)) + rider->CastSpell(unitTarget->GetCharmer(), SPELL_MOUNTED_DUEL, true); + } + } } void Register() OVERRIDE { - OnEffectHitTarget += SpellEffectFn(spell_gen_spectator_cheer_trigger_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_gen_tournament_duel_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_gen_spectator_cheer_trigger_SpellScript(); + return new spell_gen_tournament_duel_SpellScript(); + } +}; + +class spell_gen_tournament_pennant : public SpellScriptLoader +{ + public: + spell_gen_tournament_pennant() : SpellScriptLoader("spell_gen_tournament_pennant") { } + + class spell_gen_tournament_pennant_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_tournament_pennant_AuraScript); + + bool Load() OVERRIDE + { + return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void HandleApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + if (!caster->GetVehicleBase()) + caster->RemoveAurasDueToSpell(GetId()); + } + + void Register() OVERRIDE + { + OnEffectApply += AuraEffectApplyFn(spell_gen_tournament_pennant_AuraScript::HandleApplyEffect, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_gen_tournament_pennant_AuraScript(); } +}; + + +enum PvPTrinketTriggeredSpells +{ + SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER = 72752, + SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER_WOTF = 72757 }; -enum VendorBarkTrigger +class spell_pvp_trinket_wotf_shared_cd : public SpellScriptLoader +{ + public: + spell_pvp_trinket_wotf_shared_cd() : SpellScriptLoader("spell_pvp_trinket_wotf_shared_cd") { } + + class spell_pvp_trinket_wotf_shared_cd_SpellScript : public SpellScript + { + PrepareSpellScript(spell_pvp_trinket_wotf_shared_cd_SpellScript); + + bool Load() OVERRIDE + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + bool Validate(SpellInfo const* /*spellEntry*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER) || + !sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER_WOTF)) + return false; + return true; + } + + void HandleScript() + { + // This is only needed because spells cast from spell_linked_spell are triggered by default + // Spell::SendSpellCooldown() skips all spells with TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD + GetCaster()->ToPlayer()->AddSpellAndCategoryCooldowns(GetSpellInfo(), GetCastItem() ? GetCastItem()->GetEntry() : 0, GetSpell()); + } + + void Register() OVERRIDE + { + AfterCast += SpellCastFn(spell_pvp_trinket_wotf_shared_cd_SpellScript::HandleScript); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_pvp_trinket_wotf_shared_cd_SpellScript(); + } +}; + +enum FriendOrFowl +{ + SPELL_TURKEY_VENGEANCE = 25285 +}; + +class spell_gen_turkey_marker : public SpellScriptLoader +{ + public: + spell_gen_turkey_marker() : SpellScriptLoader("spell_gen_turkey_marker") { } + + class spell_gen_turkey_marker_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_turkey_marker_AuraScript); + + void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + // store stack apply times, so we can pop them while they expire + _applyTimes.push_back(getMSTime()); + Unit* target = GetTarget(); + + // on stack 15 cast the achievement crediting spell + if (GetStackAmount() >= 15) + target->CastSpell(target, SPELL_TURKEY_VENGEANCE, true, NULL, aurEff, GetCasterGUID()); + } + + void OnPeriodic(AuraEffect const* /*aurEff*/) + { + if (_applyTimes.empty()) + return; + + // pop stack if it expired for us + if (_applyTimes.front() + GetMaxDuration() < getMSTime()) + ModStackAmount(-1, AURA_REMOVE_BY_EXPIRE); + } + + void Register() OVERRIDE + { + AfterEffectApply += AuraEffectApplyFn(spell_gen_turkey_marker_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_turkey_marker_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + + std::list<uint32> _applyTimes; + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_gen_turkey_marker_AuraScript(); + } +}; + +enum FoamSword +{ + ITEM_FOAM_SWORD_GREEN = 45061, + ITEM_FOAM_SWORD_PINK = 45176, + ITEM_FOAM_SWORD_BLUE = 45177, + ITEM_FOAM_SWORD_RED = 45178, + ITEM_FOAM_SWORD_YELLOW = 45179 +}; + +class spell_gen_upper_deck_create_foam_sword : public SpellScriptLoader +{ + public: + spell_gen_upper_deck_create_foam_sword() : SpellScriptLoader("spell_gen_upper_deck_create_foam_sword") { } + + class spell_gen_upper_deck_create_foam_sword_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_upper_deck_create_foam_sword_SpellScript); + + void HandleScript(SpellEffIndex effIndex) + { + if (Player* player = GetHitPlayer()) + { + static uint32 const itemId[5] = { ITEM_FOAM_SWORD_GREEN, ITEM_FOAM_SWORD_PINK, ITEM_FOAM_SWORD_BLUE, ITEM_FOAM_SWORD_RED, ITEM_FOAM_SWORD_YELLOW }; + // player can only have one of these items + for (uint8 i = 0; i < 5; ++i) + { + if (player->HasItemCount(itemId[i], 1, true)) + return; + } + + CreateItem(effIndex, itemId[urand(0, 4)]); + } + } + + void Register() OVERRIDE + { + OnEffectHitTarget += SpellEffectFn(spell_gen_upper_deck_create_foam_sword_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_gen_upper_deck_create_foam_sword_SpellScript(); + } +}; + +enum VehicleScaling +{ + SPELL_GEAR_SCALING = 66668 +}; + +class spell_gen_vehicle_scaling : public SpellScriptLoader +{ + public: + spell_gen_vehicle_scaling() : SpellScriptLoader("spell_gen_vehicle_scaling") { } + + class spell_gen_vehicle_scaling_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_vehicle_scaling_AuraScript); + + bool Load() OVERRIDE + { + return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + Unit* caster = GetCaster(); + float factor; + uint16 baseItemLevel; + + /// @todo Reserach coeffs for different vehicles + switch (GetId()) + { + case SPELL_GEAR_SCALING: + factor = 1.0f; + baseItemLevel = 205; + break; + default: + factor = 1.0f; + baseItemLevel = 170; + break; + } + + float avgILvl = caster->ToPlayer()->GetAverageItemLevel(); + if (avgILvl < baseItemLevel) + return; /// @todo Research possibility of scaling down + + amount = uint16((avgILvl - baseItemLevel) * factor); + } + + void Register() OVERRIDE + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_vehicle_scaling_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_vehicle_scaling_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_vehicle_scaling_AuraScript::CalculateAmount, EFFECT_2, SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_gen_vehicle_scaling_AuraScript(); + } +}; +enum VendorBarkTrigger { NPC_AMPHITHEATER_VENDOR = 30098, SAY_AMPHITHEATER_VENDOR = 0 @@ -3571,74 +3545,111 @@ class spell_gen_vendor_bark_trigger : public SpellScriptLoader }; +class spell_gen_wg_water : public SpellScriptLoader +{ + public: + spell_gen_wg_water() : SpellScriptLoader("spell_gen_wg_water") { } + + class spell_gen_wg_water_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_wg_water_SpellScript); + + SpellCastResult CheckCast() + { + if (!GetSpellInfo()->CheckTargetCreatureType(GetCaster())) + return SPELL_FAILED_DONT_REPORT; + return SPELL_CAST_OK; + } + + void Register() OVERRIDE + { + OnCheckCast += SpellCheckCastFn(spell_gen_wg_water_SpellScript::CheckCast); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_gen_wg_water_SpellScript(); + } +}; + +enum WhisperGulchYoggSaronWhisper +{ + SPELL_YOGG_SARON_WHISPER_DUMMY = 29072 +}; + +class spell_gen_whisper_gulch_yogg_saron_whisper : public SpellScriptLoader +{ + public: + spell_gen_whisper_gulch_yogg_saron_whisper() : SpellScriptLoader("spell_gen_whisper_gulch_yogg_saron_whisper") { } + + class spell_gen_whisper_gulch_yogg_saron_whisper_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_whisper_gulch_yogg_saron_whisper_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_YOGG_SARON_WHISPER_DUMMY)) + return false; + return true; + } + + void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + GetTarget()->CastSpell((Unit*)NULL, SPELL_YOGG_SARON_WHISPER_DUMMY, true); + } + + void Register() OVERRIDE + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_whisper_gulch_yogg_saron_whisper_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_gen_whisper_gulch_yogg_saron_whisper_AuraScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); new spell_gen_adaptive_warding(); + new spell_gen_allow_cast_from_item_only(); + new spell_gen_animal_blood(); new spell_gen_aura_of_anger(); + new spell_gen_aura_service_uniform(); new spell_gen_av_drekthar_presence(); + new spell_gen_bandage(); + new spell_gen_bonked(); + new spell_gen_break_shield("spell_gen_break_shield"); + new spell_gen_break_shield("spell_gen_tournament_counterattack"); new spell_gen_burn_brutallus(); new spell_gen_cannibalize(); - new spell_gen_create_lance(); - new spell_gen_netherbloom(); - new spell_gen_nightmare_vine(); - new spell_gen_obsidian_armor(); - new spell_gen_parachute(); - new spell_gen_pet_summoned(); - new spell_gen_remove_flight_auras(); - new spell_creature_permanent_feign_death(); - new spell_pvp_trinket_wotf_shared_cd(); - new spell_gen_animal_blood(); - new spell_gen_divine_storm_cd_reset(); - new spell_gen_parachute_ic(); - new spell_gen_gunship_portal(); - new spell_gen_dungeon_credit(); - new spell_gen_profession_research(); - new spell_generic_clone(); - new spell_generic_clone_weapon(); + new spell_gen_chaos_blast(); + new spell_gen_clone(); + new spell_gen_clone_weapon(); new spell_gen_clone_weapon_aura(); - new spell_gen_seaforium_blast(); - new spell_gen_turkey_marker(); - new spell_gen_lifeblood(); - new spell_gen_magic_rooster(); - new spell_gen_allow_cast_from_item_only(); - new spell_gen_launch(); - new spell_gen_vehicle_scaling(); - new spell_gen_oracle_wolvar_reputation(); - new spell_gen_dummy_trigger(); - new spell_gen_spirit_healer_res(); - new spell_gen_gadgetzan_transporter_backfire(); - new spell_gen_gnomish_transporter(); + new spell_gen_count_pct_from_max_hp("spell_gen_default_count_pct_from_max_hp"); + new spell_gen_count_pct_from_max_hp("spell_gen_30pct_count_pct_from_max_hp", 30); + new spell_gen_count_pct_from_max_hp("spell_gen_50pct_count_pct_from_max_hp", 50); + new spell_gen_create_lance(); + new spell_gen_creature_permanent_feign_death(); new spell_gen_dalaran_disguise("spell_gen_sunreaver_disguise"); new spell_gen_dalaran_disguise("spell_gen_silver_covenant_disguise"); - new spell_gen_elune_candle(); - new spell_gen_break_shield("spell_gen_break_shield"); - new spell_gen_break_shield("spell_gen_tournament_counterattack"); - new spell_gen_mounted_charge(); new spell_gen_defend(); - new spell_gen_tournament_duel(); - new spell_gen_summon_tournament_mount(); - new spell_gen_on_tournament_mount(); - new spell_gen_tournament_pennant(); - new spell_gen_chaos_blast(); - new spell_gen_ds_flush_knockback(); - new spell_gen_wg_water(); - new spell_gen_count_pct_from_max_hp("spell_gen_default_count_pct_from_max_hp"); - new spell_gen_count_pct_from_max_hp("spell_gen_50pct_count_pct_from_max_hp", 50); new spell_gen_despawn_self(); - new spell_gen_touch_the_nightmare(); + new spell_gen_divine_storm_cd_reset(); new spell_gen_dream_funnel(); - new spell_gen_bandage(); - new spell_gen_lifebloom("spell_hexlord_lifebloom", SPELL_HEXLORD_MALACRASS_LIFEBLOOM_FINAL_HEAL); - new spell_gen_lifebloom("spell_tur_ragepaw_lifebloom", SPELL_TUR_RAGEPAW_LIFEBLOOM_FINAL_HEAL); - new spell_gen_lifebloom("spell_cenarion_scout_lifebloom", SPELL_CENARION_SCOUT_LIFEBLOOM_FINAL_HEAL); - new spell_gen_lifebloom("spell_twisted_visage_lifebloom", SPELL_TWISTED_VISAGE_LIFEBLOOM_FINAL_HEAL); - new spell_gen_lifebloom("spell_faction_champion_dru_lifebloom", SPELL_FACTION_CHAMPIONS_DRU_LIFEBLOOM_FINAL_HEAL); - new spell_gen_summon_elemental("spell_gen_summon_fire_elemental", SPELL_SUMMON_FIRE_ELEMENTAL); - new spell_gen_summon_elemental("spell_gen_summon_earth_elemental", SPELL_SUMMON_EARTH_ELEMENTAL); - new spell_gen_upper_deck_create_foam_sword(); - new spell_gen_bonked(); + new spell_gen_ds_flush_knockback(); + new spell_gen_dummy_trigger(); + new spell_gen_dungeon_credit(); + new spell_gen_elune_candle(); + new spell_gen_gadgetzan_transporter_backfire(); new spell_gen_gift_of_naaru(); + new spell_gen_gnomish_transporter(); + new spell_gen_gunship_portal(); new spell_gen_increase_stats_buff("spell_pal_blessing_of_kings"); new spell_gen_increase_stats_buff("spell_pal_blessing_of_might"); new spell_gen_increase_stats_buff("spell_dru_mark_of_the_wild"); @@ -3646,12 +3657,44 @@ void AddSC_generic_spell_scripts() new spell_gen_increase_stats_buff("spell_pri_shadow_protection"); new spell_gen_increase_stats_buff("spell_mage_arcane_brilliance"); new spell_gen_increase_stats_buff("spell_mage_dalaran_brilliance"); + new spell_gen_launch(); + new spell_gen_lifeblood(); + new spell_gen_lifebloom("spell_hexlord_lifebloom", SPELL_HEXLORD_MALACRASS_LIFEBLOOM_FINAL_HEAL); + new spell_gen_lifebloom("spell_tur_ragepaw_lifebloom", SPELL_TUR_RAGEPAW_LIFEBLOOM_FINAL_HEAL); + new spell_gen_lifebloom("spell_cenarion_scout_lifebloom", SPELL_CENARION_SCOUT_LIFEBLOOM_FINAL_HEAL); + new spell_gen_lifebloom("spell_twisted_visage_lifebloom", SPELL_TWISTED_VISAGE_LIFEBLOOM_FINAL_HEAL); + new spell_gen_lifebloom("spell_faction_champion_dru_lifebloom", SPELL_FACTION_CHAMPIONS_DRU_LIFEBLOOM_FINAL_HEAL); + new spell_gen_magic_rooster(); + new spell_gen_mounted_charge(); + new spell_gen_netherbloom(); + new spell_gen_obsidian_armor(); + new spell_gen_on_tournament_mount(); + new spell_gen_oracle_wolvar_reputation(); + new spell_gen_orc_disguise(); + new spell_gen_parachute(); + new spell_gen_parachute_ic(); + new spell_gen_pet_summoned(); + new spell_gen_profession_research(); + new spell_gen_remove_flight_auras(); new spell_gen_replenishment(); + // Running Wild new spell_gen_running_wild(); new spell_gen_two_forms(); new spell_gen_darkflight(); - new spell_gen_orc_disguise(); - new spell_gen_whisper_gulch_yogg_saron_whisper(); + /* */ + new spell_gen_seaforium_blast(); new spell_gen_spectator_cheer_trigger(); + new spell_gen_spirit_healer_res(); + new spell_gen_summon_elemental("spell_gen_summon_fire_elemental", SPELL_SUMMON_FIRE_ELEMENTAL); + new spell_gen_summon_elemental("spell_gen_summon_earth_elemental", SPELL_SUMMON_EARTH_ELEMENTAL); + new spell_gen_summon_tournament_mount(); + new spell_gen_tournament_duel(); + new spell_gen_tournament_pennant(); + new spell_pvp_trinket_wotf_shared_cd(); + new spell_gen_turkey_marker(); + new spell_gen_upper_deck_create_foam_sword(); + new spell_gen_vehicle_scaling(); new spell_gen_vendor_bark_trigger(); + new spell_gen_wg_water(); + new spell_gen_whisper_gulch_yogg_saron_whisper(); } diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 1847e3390ef..87533fbe47d 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -18,9 +18,6 @@ /* ContentData go_cat_figurine (the "trap" version of GO, two different exist) -go_northern_crystal_pylon -go_eastern_crystal_pylon -go_western_crystal_pylon go_barov_journal go_ethereum_prison go_ethereum_stasis @@ -80,69 +77,6 @@ public: }; /*###### -## go_crystal_pylons (3x) -######*/ -class go_northern_crystal_pylon : public GameObjectScript -{ -public: - go_northern_crystal_pylon() : GameObjectScript("go_northern_crystal_pylon") { } - - bool OnGossipHello(Player* player, GameObject* go) OVERRIDE - { - if (go->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) - { - player->PrepareQuestMenu(go->GetGUID()); - player->SendPreparedQuest(go->GetGUID()); - } - - if (player->GetQuestStatus(4285) == QUEST_STATUS_INCOMPLETE) - player->AreaExploredOrEventHappens(4285); - - return true; - } -}; - -class go_eastern_crystal_pylon : public GameObjectScript -{ -public: - go_eastern_crystal_pylon() : GameObjectScript("go_eastern_crystal_pylon") { } - - bool OnGossipHello(Player* player, GameObject* go) OVERRIDE - { - if (go->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) - { - player->PrepareQuestMenu(go->GetGUID()); - player->SendPreparedQuest(go->GetGUID()); - } - - if (player->GetQuestStatus(4287) == QUEST_STATUS_INCOMPLETE) - player->AreaExploredOrEventHappens(4287); - - return true; - } -}; - -class go_western_crystal_pylon : public GameObjectScript -{ -public: - go_western_crystal_pylon() : GameObjectScript("go_western_crystal_pylon") { } - - bool OnGossipHello(Player* player, GameObject* go) OVERRIDE - { - if (go->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) - { - player->PrepareQuestMenu(go->GetGUID()); - player->SendPreparedQuest(go->GetGUID()); - } - - if (player->GetQuestStatus(4288) == QUEST_STATUS_INCOMPLETE) - player->AreaExploredOrEventHappens(4288); - - return true; - } -}; - -/*###### ## go_barov_journal ######*/ @@ -1375,44 +1309,41 @@ public: void AddSC_go_scripts() { - new go_cat_figurine; - new go_northern_crystal_pylon; - new go_eastern_crystal_pylon; - new go_western_crystal_pylon; - new go_barov_journal; - new go_field_repair_bot_74A; - new go_gilded_brazier; - new go_orb_of_command; - new go_shrine_of_the_birds; - new go_southfury_moonstone; - new go_tablet_of_madness; - new go_tablet_of_the_seven; - new go_jump_a_tron; - new go_ethereum_prison; - new go_ethereum_stasis; - new go_resonite_cask; - new go_sacred_fire_of_life; - new go_tele_to_dalaran_crystal; - new go_tele_to_violet_stand; - new go_fel_crystalforge; - new go_bashir_crystalforge; - new go_matrix_punchograph; - new go_scourge_cage; - new go_arcane_prison; - new go_blood_filled_orb; - new go_jotunheim_cage; - new go_table_theka; - new go_inconspicuous_landmark; - new go_ethereal_teleport_pad; - new go_soulwell; - new go_tadpole_cage; - new go_dragonflayer_cage; - new go_amberpine_outhouse; - new go_hive_pod; - new go_massive_seaforium_charge; - new go_gjalerbron_cage; - new go_large_gjalerbron_cage; - new go_veil_skith_cage; - new go_frostblade_shrine; - new go_midsummer_bonfire; + new go_cat_figurine(); + new go_barov_journal(); + new go_field_repair_bot_74A(); + new go_gilded_brazier(); + new go_orb_of_command(); + new go_shrine_of_the_birds(); + new go_southfury_moonstone(); + new go_tablet_of_madness(); + new go_tablet_of_the_seven(); + new go_jump_a_tron(); + new go_ethereum_prison(); + new go_ethereum_stasis(); + new go_resonite_cask(); + new go_sacred_fire_of_life(); + new go_tele_to_dalaran_crystal(); + new go_tele_to_violet_stand(); + new go_fel_crystalforge(); + new go_bashir_crystalforge(); + new go_matrix_punchograph(); + new go_scourge_cage(); + new go_arcane_prison(); + new go_blood_filled_orb(); + new go_jotunheim_cage(); + new go_table_theka(); + new go_inconspicuous_landmark(); + new go_ethereal_teleport_pad(); + new go_soulwell(); + new go_tadpole_cage(); + new go_dragonflayer_cage(); + new go_amberpine_outhouse(); + new go_hive_pod(); + new go_massive_seaforium_charge(); + new go_gjalerbron_cage(); + new go_large_gjalerbron_cage(); + new go_veil_skith_cage(); + new go_frostblade_shrine(); + new go_midsummer_bonfire(); } |
