fix(Core/Spells): Item Fresh Brewfest Hops (#8010)

This commit is contained in:
IntelligentQuantum
2021-11-21 17:20:03 +03:30
committed by GitHub
parent faa4035de7
commit 92b3617f63
2 changed files with 51 additions and 0 deletions
@@ -2808,6 +2808,7 @@ void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bo
return; return;
Unit* target = aurApp->GetTarget(); Unit* target = aurApp->GetTarget();
Unit* caster = GetCaster();
if (apply) if (apply)
{ {
@@ -2822,6 +2823,19 @@ void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bo
creatureEntry = 15665; creatureEntry = 15665;
} }
// Festive Brewfest Mount
if (!GetBase()->HasEffectType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && target->HasAura(FRESH_BREWFEST_HOPS))
{
if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
{
creatureEntry = GREAT_BREWFEST_KODO;
}
else
{
creatureEntry = BREWFEST_KODO;
}
}
CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(creatureEntry); CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(creatureEntry);
if (!ci) if (!ci)
{ {
@@ -5365,6 +5379,36 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
} }
} }
break; break;
case FRESH_BREWFEST_HOPS: // Festive Brewfest Mount
if (target->HasAuraType(SPELL_AURA_MOUNTED) && !target->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED))
{
uint32 creatureEntry = 0;
if (apply)
{
if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
{
creatureEntry = GREAT_BREWFEST_KODO;
}
else
{
creatureEntry = BREWFEST_KODO;
}
}
else
{
creatureEntry = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
}
if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
{
uint32 displayID = ObjectMgr::ChooseDisplayId(creatureInfo);
sObjectMgr->GetCreatureModelRandomGender(&displayID);
target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, displayID);
}
}
break;
} }
break; break;
@@ -28,6 +28,13 @@ class SpellInfo;
typedef void(AuraEffect::*pAuraEffectHandler)(AuraApplication const* aurApp, uint8 mode, bool apply) const; typedef void(AuraEffect::*pAuraEffectHandler)(AuraApplication const* aurApp, uint8 mode, bool apply) const;
enum BrewfestEntries
{
BREWFEST_KODO = 30507,
GREAT_BREWFEST_KODO = 27707,
FRESH_BREWFEST_HOPS = 66052
};
class AuraEffect class AuraEffect
{ {
friend void Aura::_InitEffects(uint8 effMask, Unit* caster, int32* baseAmount); friend void Aura::_InitEffects(uint8 effMask, Unit* caster, int32* baseAmount);