fix(Scripts/Hunter): Bestial Wrath shoul not be castable on dead pets. (#9896)

Bestial Wrath should expire while pet is offline.
This commit is contained in:
UltraNix
2022-01-24 03:45:24 +01:00
committed by GitHub
parent 58507e2fe8
commit 2f8318fd58
4 changed files with 49 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1640635780171945100');
DELETE FROM `spell_script_names` WHERE `spell_id`=19574;
INSERT INTO `spell_script_names` VALUES
(19574,'spell_hun_bestial_wrath');

View File

@@ -1601,10 +1601,12 @@ void Pet::_LoadAuras(PreparedQueryResult result, uint32 timediff)
continue;
// negative effects should continue counting down after logout
if (remaintime != -1 && !spellInfo->IsPositive())
if (remaintime != -1 && (!spellInfo->IsPositive() || spellInfo->HasAttribute(SPELL_ATTR4_AURA_EXPIRES_OFFLINE)))
{
if (remaintime / IN_MILLISECONDS <= int32(timediff))
{
continue;
}
remaintime -= timediff * IN_MILLISECONDS;
}

View File

@@ -7552,6 +7552,12 @@ void SpellMgr::LoadDbcDataCorrections()
spellInfo->EffectSpellClassMask[EFFECT_1][1] = 0x00020000;
});
// Bestial Wrath
ApplySpellFix({ 19574 }, [](SpellEntry* spellInfo)
{
spellInfo->AttributesEx4 |= SPELL_ATTR4_AURA_EXPIRES_OFFLINE;
});
for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i)
{
SpellEntry* spellInfo = (SpellEntry*)sSpellStore.LookupEntry(i);

View File

@@ -1254,6 +1254,40 @@ class spell_hun_intimidation : public AuraScript
}
};
// 19574 - Bestial Wrath
class spell_hun_bestial_wrath : public SpellScript
{
PrepareSpellScript(spell_hun_bestial_wrath);
SpellCastResult CheckCast()
{
Unit* caster = GetCaster();
if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
{
return SPELL_FAILED_NO_VALID_TARGETS;
}
Pet* pet = caster->ToPlayer()->GetPet();
if (!pet)
{
return SPELL_FAILED_NO_PET;
}
if (!pet->IsAlive())
{
SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_PET_IS_DEAD);
return SPELL_FAILED_CUSTOM_ERROR;
}
return SPELL_CAST_OK;
}
void Register() override
{
OnCheckCast += SpellCheckCastFn(spell_hun_bestial_wrath::CheckCast);
}
};
void AddSC_hunter_spell_scripts()
{
RegisterSpellScript(spell_hun_check_pet_los);
@@ -1283,4 +1317,5 @@ void AddSC_hunter_spell_scripts()
RegisterSpellScript(spell_hun_volley_trigger);
RegisterSpellScript(spell_hun_lock_and_load);
RegisterSpellScript(spell_hun_intimidation);
RegisterSpellScript(spell_hun_bestial_wrath);
}