diff options
author | Souler <soulerhyd@gmail.com> | 2012-01-17 12:55:54 +0100 |
---|---|---|
committer | Souler <soulerhyd@gmail.com> | 2012-01-17 12:55:54 +0100 |
commit | 4bdc5353735a7ec73c23e11f824adb378eea3adf (patch) | |
tree | d1588e79c95b5e901cd645116f7c2a9450aeac9a /src | |
parent | c398f2098805fe6030dc9c08543f13cdef5fd043 (diff) |
Script/Quest: Solve some related problems with "An Audience With The Arcanist" and "A Meeting With The Magister"
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Northrend/dalaran.cpp | 13 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 80 |
2 files changed, 89 insertions, 4 deletions
diff --git a/src/server/scripts/Northrend/dalaran.cpp b/src/server/scripts/Northrend/dalaran.cpp index 57007a93fa7..cd3cbf29d0d 100644 --- a/src/server/scripts/Northrend/dalaran.cpp +++ b/src/server/scripts/Northrend/dalaran.cpp @@ -32,7 +32,12 @@ Script Data End */ enum Spells { SPELL_TRESPASSER_A = 54028, - SPELL_TRESPASSER_H = 54029 + SPELL_TRESPASSER_H = 54029, + + SPELL_SUNREAVER_DISGUISE_FEMALE = 70973, + SPELL_SUNREAVER_DISGUISE_MALE = 70974, + SPELL_SILVER_COVENANT_DISGUISE_FEMALE = 70971, + SPELL_SILVER_COVENANT_DISGUISE_MALE = 70972, }; enum NPCs // All outdoor guards are within 35.0f of these NPCs @@ -71,8 +76,10 @@ public: Player* player = who->GetCharmerOrOwnerPlayerOrPlayerItself(); - // If player has Disguise aura for quest A Meeting With The Magister or An Audience With The Arcanist, do not teleport it away but let it pass - if (!player || player->isGameMaster() || player->IsBeingTeleported() || player->HasAura(70973) || player->HasAura(70971)) + if (!player || player->isGameMaster() || player->IsBeingTeleported() || + // If player has Disguise aura for quest A Meeting With The Magister or An Audience With The Arcanist, do not teleport it away but let it pass + player->HasAura(SPELL_SUNREAVER_DISGUISE_FEMALE) || player->HasAura(SPELL_SUNREAVER_DISGUISE_MALE) || + player->HasAura(SPELL_SILVER_COVENANT_DISGUISE_FEMALE) || player->HasAura(SPELL_SILVER_COVENANT_DISGUISE_MALE)) return; switch (me->GetEntry()) diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 38e5771ccca..bb3e63af8e4 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1471,6 +1471,82 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader } }; +enum DalaranDisguiseSpells +{ + 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_dalaran_disguise : public SpellScriptLoader +{ + public: + spell_gen_dalaran_disguise(const char* name) : SpellScriptLoader(name) {} + + class spell_gen_dalaran_disguise_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_dalaran_disguise_SpellScript); + bool Validate(SpellInfo const* spellEntry) + { + switch (spellEntry->Id) + { + case SPELL_SUNREAVER_DISGUISE_TRIGGER: + if (!sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_FEMALE)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_MALE)) + return false; + break; + case SPELL_SILVER_COVENANT_DISGUISE_TRIGGER: + if (!sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_FEMALE)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_MALE)) + return false; + break; + } + return true; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + + if (Player* player = GetHitPlayer()) + { + uint8 gender = player->getGender(); + + uint32 spellId = GetSpellInfo()->Id; + + 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); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_dalaran_disguise_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_dalaran_disguise_SpellScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -1504,4 +1580,6 @@ void AddSC_generic_spell_scripts() new spell_gen_oracle_wolvar_reputation(); new spell_gen_damage_reduction_aura(); new spell_gen_luck_of_the_draw(); -} + new spell_gen_dalaran_disguise("spell_gen_sunreaver_disguise"); + new spell_gen_dalaran_disguise("spell_gen_silver_covenant_disguise"); +}
\ No newline at end of file |