aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/base/world_database.sql3
-rw-r--r--sql/updates/9162_world_spell_script_names.sql3
-rw-r--r--src/server/game/Grids/Notifiers/GridNotifiers.cpp17
-rw-r--r--src/server/game/Grids/Notifiers/GridNotifiers.h26
-rw-r--r--src/server/game/Spells/Spell.cpp7
-rw-r--r--src/server/game/Spells/SpellEffects.cpp3
-rw-r--r--src/server/scripts/Spells/spell_hunter.cpp42
7 files changed, 96 insertions, 5 deletions
diff --git a/sql/base/world_database.sql b/sql/base/world_database.sql
index d5d2efda351..0f1afc20237 100644
--- a/sql/base/world_database.sql
+++ b/sql/base/world_database.sql
@@ -14694,8 +14694,9 @@ INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
( 53271, 'spell_hun_masters_call'),
( 53478, 'spell_hun_last_stand_pet'),
( 55709, 'spell_hun_pet_heart_of_the_phoenix'),
+( 54044, 'spell_hun_pet_carrion_feeder'),
-- rogue
-( 5938, 'spell_rog_shiv'),
+( 5938, 'spell_rog_shiv'),
( 14185, 'spell_rog_preparation'),
( 31231, 'spell_rog_cheat_death'),
( 51662, 'spell_rog_hunger_for_blood'),
diff --git a/sql/updates/9162_world_spell_script_names.sql b/sql/updates/9162_world_spell_script_names.sql
new file mode 100644
index 00000000000..47f46b6d0dc
--- /dev/null
+++ b/sql/updates/9162_world_spell_script_names.sql
@@ -0,0 +1,3 @@
+DELETE FROM `spell_script_names` WHERE `spell_id`=54044 AND `ScriptName`='spell_hun_pet_carrion_feeder';
+INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
+(54044, 'spell_hun_pet_carrion_feeder');
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp
index 88d17b0286f..df980c315b6 100644
--- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.cpp
@@ -349,5 +349,22 @@ bool CannibalizeObjectCheck::operator()(Corpse* u)
return false;
}
+bool CarrionFeederObjectCheck::operator()(Corpse* u)
+{
+ // ignore bones
+ if (u->GetType() == CORPSE_BONES)
+ return false;
+
+ Player* owner = ObjectAccessor::FindPlayer(u->GetOwnerGUID());
+
+ if (!owner || i_funit->IsFriendlyTo(owner))
+ return false;
+
+ if (i_funit->IsWithinDistInMap(u, i_range))
+ return true;
+
+ return false;
+}
+
template void ObjectUpdater::Visit<GameObject>(GameObjectMapType &);
template void ObjectUpdater::Visit<DynamicObject>(DynamicObjectMapType &);
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h
index 21092648869..77a8d8ae300 100644
--- a/src/server/game/Grids/Notifiers/GridNotifiers.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.h
@@ -562,6 +562,32 @@ namespace Trinity
float i_range;
};
+ class CarrionFeederObjectCheck
+ {
+ public:
+ CarrionFeederObjectCheck(Unit* funit, float range) : i_funit(funit), i_range(range) {}
+ bool operator()(Player* u)
+ {
+ if (i_funit->IsFriendlyTo(u) || u->isAlive() || u->isInFlight())
+ return false;
+
+ return i_funit->IsWithinDistInMap(u, i_range);
+ }
+ bool operator()(Corpse* u);
+ bool operator()(Creature* u)
+ {
+ if (i_funit->IsFriendlyTo(u) || u->isAlive() || u->isInFlight() ||
+ (u->GetCreatureTypeMask() & CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL) != 0)
+ return false;
+
+ return i_funit->IsWithinDistInMap(u, i_range);
+ }
+ template<class NOT_INTERESTED> bool operator()(NOT_INTERESTED*) { return false; }
+ private:
+ Unit* const i_funit;
+ float i_range;
+ };
+
// WorldObject do classes
class RespawnDo
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 8ab005cc064..57f0c56a987 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -542,8 +542,13 @@ void Spell::SelectSpellTargets()
switch(m_spellInfo->Id)
{
case 20577: // Cannibalize
+ case 54044: // Carrion Feeder
{
- WorldObject* result = FindCorpseUsing<Trinity::CannibalizeObjectCheck> ();
+ WorldObject* result = NULL;
+ if (m_spellInfo->Id == 20577)
+ result = FindCorpseUsing<Trinity::CannibalizeObjectCheck>();
+ else
+ result = FindCorpseUsing<Trinity::CarrionFeederObjectCheck>();
if (result)
{
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index f7a45311b0f..4bfd8a44175 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -715,10 +715,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
damage += m_caster->ToPlayer()->GetAmmoDPS()*item->GetProto()->Delay*0.001f;
}
}
-
}
- else if (m_spellInfo->Id == 53508)
- damage *= m_caster->getLevel();
break;
}
case SPELLFAMILY_PALADIN:
diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp
index 733274ebe51..ce0d97e5191 100644
--- a/src/server/scripts/Spells/spell_hunter.cpp
+++ b/src/server/scripts/Spells/spell_hunter.cpp
@@ -31,6 +31,7 @@ enum HunterSpells
HUNTER_PET_HEART_OF_THE_PHOENIX = 55709,
HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED = 54114,
HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF = 55711,
+ HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED = 54045,
};
class spell_hun_last_stand_pet_SpellScript : public SpellScript
@@ -163,6 +164,42 @@ SpellScript * GetSpellScript_spell_hun_pet_heart_of_the_phoenix()
return new spell_hun_pet_heart_of_the_phoenix();
}
+class spell_hun_pet_carrion_feeder : public SpellScript
+{
+ bool Validate(SpellEntry const * spellEntry)
+ {
+ if (!sSpellStore.LookupEntry(HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED))
+ return false;
+ return true;
+ }
+
+ void HandleDummy(SpellEffIndex effIndex)
+ {
+ if (!GetHitUnit())
+ return;
+ Unit *caster = GetCaster();
+ caster->CastSpell(caster, HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED, false);
+ }
+
+ void Register()
+ {
+ // add dummy effect spell handler to pet's Last Stand
+ EffectHandlers += EffectHandlerFn(spell_hun_pet_carrion_feeder::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+
+ bool Load()
+ {
+ if (!GetCaster()->isPet())
+ return false;
+ return true;
+ }
+};
+
+SpellScript * GetSpellScript_spell_hun_pet_carrion_feeder()
+{
+ return new spell_hun_pet_carrion_feeder();
+}
+
void AddSC_hunter_spell_scripts()
{
Script *newscript;
@@ -186,4 +223,9 @@ void AddSC_hunter_spell_scripts()
newscript->Name = "spell_hun_pet_heart_of_the_phoenix";
newscript->GetSpellScript = &GetSpellScript_spell_hun_pet_heart_of_the_phoenix;
newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name = "spell_hun_pet_carrion_feeder";
+ newscript->GetSpellScript = &GetSpellScript_spell_hun_pet_carrion_feeder;
+ newscript->RegisterSelf();
}