Merge branch 'azerothcore:master' into Playerbot

This commit is contained in:
ZhengPeiRu21
2022-09-21 09:42:10 -06:00
committed by GitHub
27 changed files with 327 additions and 72 deletions

View File

@@ -655,13 +655,12 @@ class spell_hun_readiness : public SpellScript
SpellCooldowns& cooldowns = caster->GetSpellCooldownMap();
SpellCooldowns::iterator itr, next;
for (itr = cooldowns.begin(); itr != cooldowns.end(); itr = next)
{
next = itr;
++next;
std::set<std::pair<uint32, bool>> spellsToRemove;
std::set<uint32> categoriesToRemove;
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
for (const auto& [spellId, cooldown] : cooldowns)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (spellInfo
&& spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER
&& spellInfo->Id != SPELL_HUNTER_READINESS
@@ -669,12 +668,18 @@ class spell_hun_readiness : public SpellScript
&& spellInfo->Id != SPELL_DRAENEI_GIFT_OF_THE_NAARU)
{
if (spellInfo->RecoveryTime > 0)
caster->RemoveSpellCooldown(spellInfo->Id, itr->second.needSendToClient);
spellsToRemove.insert(std::make_pair(spellInfo->Id, cooldown.needSendToClient));
if (spellInfo->CategoryRecoveryTime > 0)
caster->RemoveCategoryCooldown(spellInfo->GetCategory());
categoriesToRemove.insert(spellInfo->GetCategory());
}
}
// we can't remove spell cooldowns while iterating.
for (const auto& [spellId, sendToClient] : spellsToRemove)
caster->RemoveSpellCooldown(spellId, sendToClient);
for (const auto& category : categoriesToRemove)
caster->RemoveCategoryCooldown(category);
}
void Register() override

View File

@@ -3702,6 +3702,29 @@ class spell_item_snowman : public SpellScript
}
};
// https://www.wowhead.com/wotlk/spell=16028 Freeze Rookery Egg - Prototype
// https://www.wowhead.com/wotlk/spell=15748 Freeze Rookery Egg
class spell_item_freeze_rookery_egg : public SpellScript
{
PrepareSpellScript(spell_item_freeze_rookery_egg);
void HandleOpenObject(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (GameObject* rookery = GetHitGObj())
{
if (rookery->getLootState() == GO_READY)
rookery->UseDoorOrButton(0, true);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_item_freeze_rookery_egg::HandleOpenObject, EFFECT_0, SPELL_EFFECT_OPEN_LOCK);
}
};
void AddSC_item_spell_scripts()
{
RegisterSpellScript(spell_item_massive_seaforium_charge);
@@ -3816,4 +3839,5 @@ void AddSC_item_spell_scripts()
RegisterSpellScript(spell_item_wraith_scythe_drain_life);
RegisterSpellScript(spell_item_mirrens_drinking_hat);
RegisterSpellScript(spell_item_snowman);
RegisterSpellScript(spell_item_freeze_rookery_egg);
}