mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-28 21:02:14 +01:00
Scripts/Quests: Fix Red Snapper - Very Tasty! GOb
Fix 'School of Red Snapper' now disappear correctly when using 'Draenei Fishing Net', the bug is caused because the GameObject is SpellFocus type.
Fix #1673
Closes #13748
(cherry picked from commit b0b7a55bdb)
This commit is contained in:
@@ -1076,9 +1076,12 @@ class spell_q14112_14145_chum_the_water: public SpellScriptLoader
|
||||
// http://old01.wowhead.com/quest=9452 - Red Snapper - Very Tasty!
|
||||
enum RedSnapperVeryTasty
|
||||
{
|
||||
SPELL_CAST_NET = 29866,
|
||||
ITEM_RED_SNAPPER = 23614,
|
||||
SPELL_NEW_SUMMON_TEST = 49214,
|
||||
ITEM_RED_SNAPPER = 23614,
|
||||
|
||||
SPELL_CAST_NET = 29866,
|
||||
SPELL_NEW_SUMMON_TEST = 49214,
|
||||
|
||||
GO_SCHOOL_OF_RED_SNAPPER = 181616
|
||||
};
|
||||
|
||||
class spell_q9452_cast_net: public SpellScriptLoader
|
||||
@@ -1095,6 +1098,15 @@ class spell_q9452_cast_net: public SpellScriptLoader
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
GameObject* go = GetCaster()->FindNearestGameObject(GO_SCHOOL_OF_RED_SNAPPER, 3.0f);
|
||||
if (!go || go->GetRespawnTime())
|
||||
return SPELL_FAILED_REQUIRES_SPELL_FOCUS;
|
||||
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
@@ -1104,9 +1116,19 @@ class spell_q9452_cast_net: public SpellScriptLoader
|
||||
caster->CastSpell(caster, SPELL_NEW_SUMMON_TEST, true);
|
||||
}
|
||||
|
||||
void HandleActiveObject(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
GetHitGObj()->SetRespawnTime(roll_chance_i(50) ? 2 * MINUTE : 3 * MINUTE);
|
||||
GetHitGObj()->Use(GetCaster());
|
||||
GetHitGObj()->SetLootState(GO_JUST_DEACTIVATED);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnCheckCast += SpellCheckCastFn(spell_q9452_cast_net_SpellScript::CheckCast);
|
||||
OnEffectHit += SpellEffectFn(spell_q9452_cast_net_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_q9452_cast_net_SpellScript::HandleActiveObject, EFFECT_1, SPELL_EFFECT_ACTIVATE_OBJECT);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user