diff options
| author | Rat <gmstreetrat@gmail.com> | 2012-01-01 22:31:48 +0100 |
|---|---|---|
| committer | Rat <gmstreetrat@gmail.com> | 2012-01-01 22:31:48 +0100 |
| commit | 0e950d5e467a63827d1e280929a2e5bd36e6dc98 (patch) | |
| tree | 41c3424fe560ee1a338140203ffdf1b1ae7b6469 /src/server/scripts/Spells | |
| parent | bff7c18251e8c16dfbe3f4484a76d8df76f05076 (diff) | |
| parent | b1e19257bcd80427986cbb670cbc69c45d6154b6 (diff) | |
Merge branch '4.x' of git://github.com/TrinityCore/TrinityCore into 4.x
Diffstat (limited to 'src/server/scripts/Spells')
| -rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 53 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_quest.cpp | 49 |
2 files changed, 102 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 260b0c57563..298e9b6410e 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -26,6 +26,8 @@ #include "SpellAuraEffects.h" #include "SkillDiscovery.h" #include "GridNotifiers.h" +#include "Group.h" +#include "LFGMgr.h" class spell_gen_absorb0_hitlimit1 : public SpellScriptLoader { @@ -564,6 +566,9 @@ class spell_creature_permanent_feign_death : public SpellScriptLoader 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() @@ -1419,6 +1424,53 @@ public: } }; +class spell_gen_luck_of_the_draw : public SpellScriptLoader +{ + public: + spell_gen_luck_of_the_draw() : SpellScriptLoader("spell_gen_luck_of_the_draw") { } + + class spell_gen_luck_of_the_draw_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_luck_of_the_draw_AuraScript); + + // cheap hax to make it have update calls + void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude) + { + isPeriodic = true; + amplitude = 5 * IN_MILLISECONDS; + } + + void Update(AuraEffect* /*effect*/) + { + if (GetUnitOwner()->GetTypeId() != TYPEID_PLAYER) + return; + + LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*(sLFGMgr->GetSelectedDungeons(GetUnitOwner()->GetGUID()).begin())); + Group* group = GetUnitOwner()->ToPlayer()->GetGroup(); + Map const* map = GetUnitOwner()->GetMap(); + if (group && group->isLFGGroup()) + if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) + if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) + if (dungeon->map == map->GetId() && dungeon->difficulty == map->GetDifficulty()) + if (randomDungeon && randomDungeon->type == LFG_TYPE_RANDOM) + return; // in correct dungeon + + Remove(AURA_REMOVE_BY_DEFAULT); + } + + void Register() + { + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_gen_luck_of_the_draw_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_gen_luck_of_the_draw_AuraScript::Update, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_gen_luck_of_the_draw_AuraScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -1451,4 +1503,5 @@ void AddSC_generic_spell_scripts() new spell_gen_vehicle_scaling(); new spell_gen_oracle_wolvar_reputation(); new spell_gen_damage_reduction_aura(); + new spell_gen_luck_of_the_draw(); } diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 3b2cc5f5e00..ecdbd582b76 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -1026,6 +1026,54 @@ public: } }; +// http://old01.wowhead.com/quest=9452 - Red Snapper - Very Tasty! +enum RedSnapperVeryTasty +{ + SPELL_CAST_NET = 29866, + ITEM_RED_SNAPPER = 23614, + NPC_ANGRY_MURLOC = 17102, +}; + +class spell_q9452_cast_net: public SpellScriptLoader +{ + public: + spell_q9452_cast_net() : SpellScriptLoader("spell_q9452_cast_net") { } + + class spell_q9452_cast_net_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q9452_cast_net_SpellScript) + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Player* caster = GetCaster()->ToPlayer(); + + if (!caster) + return; + + switch (urand(0, 2)) + { + case 0: case 1: + caster->AddItem(ITEM_RED_SNAPPER, 1); + break; + case 2: + if (Creature* murloc = caster->SummonCreature(NPC_ANGRY_MURLOC, caster->GetPositionX()+5, caster->GetPositionY(), caster->GetPositionZ(), 0.0f, TEMPSUMMON_MANUAL_DESPAWN, 120000)) + murloc->AI()->AttackStart(caster); + break; + } + } + + void Register() + { + OnEffectHit += SpellEffectFn(spell_q9452_cast_net_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_q9452_cast_net_SpellScript(); + } +}; + void AddSC_quest_spell_scripts() { new spell_q55_sacred_cleansing(); @@ -1050,4 +1098,5 @@ void AddSC_quest_spell_scripts() new spell_q12805_lifeblood_dummy(); new spell_q13280_13283_plant_battle_standard(); new spell_q14112_14145_chum_the_water(); + new spell_q9452_cast_net(); } |
