Core/Spells: Removed extra health from feed pet
Port From (https://github.com/TrinityCore/TrinityCore/commit/60df74933f0bf75865ba963b33c2c1bdd9cdefbd)
This commit is contained in:
@@ -57,6 +57,7 @@ namespace System.Collections.Generic
|
|||||||
{
|
{
|
||||||
if (Count >= _limit)
|
if (Count >= _limit)
|
||||||
throw new InternalBufferOverflowException("Attempted to read more array elements from packet " + Count + 1 + " than allowed " + _limit);
|
throw new InternalBufferOverflowException("Attempted to read more array elements from packet " + Count + 1 + " than allowed " + _limit);
|
||||||
|
|
||||||
Insert(index, value);
|
Insert(index, value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -750,22 +750,6 @@ namespace Game.Entities
|
|||||||
return diet.HasAnyFlag(FoodMask);
|
return diet.HasAnyFlag(FoodMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint GetCurrentFoodBenefitLevel(uint itemlevel)
|
|
||||||
{
|
|
||||||
// -5 or greater food level
|
|
||||||
if (GetLevel() <= itemlevel + 5) //possible to feed level 60 pet with level 55 level food for full effect
|
|
||||||
return 35000;
|
|
||||||
// -10..-6
|
|
||||||
else if (GetLevel() <= itemlevel + 10) //pure guess, but sounds good
|
|
||||||
return 17000;
|
|
||||||
// -14..-11
|
|
||||||
else if (GetLevel() <= itemlevel + 14) //level 55 food gets green on 70, makes sense to me
|
|
||||||
return 8000;
|
|
||||||
// -15 or less
|
|
||||||
else
|
|
||||||
return 0; //food too low level
|
|
||||||
}
|
|
||||||
|
|
||||||
void _LoadSpellCooldowns()
|
void _LoadSpellCooldowns()
|
||||||
{
|
{
|
||||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PET_SPELL_COOLDOWN);
|
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PET_SPELL_COOLDOWN);
|
||||||
|
|||||||
@@ -3266,7 +3266,6 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
UpdateInterruptMask();
|
UpdateInterruptMask();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2 flag, uint except = 0)
|
public void RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2 flag, uint except = 0)
|
||||||
|
|||||||
@@ -4996,7 +4996,7 @@ namespace Game.Spells
|
|||||||
if (!pet.HaveInDiet(foodItem.GetTemplate()))
|
if (!pet.HaveInDiet(foodItem.GetTemplate()))
|
||||||
return SpellCastResult.WrongPetFood;
|
return SpellCastResult.WrongPetFood;
|
||||||
|
|
||||||
if (pet.GetCurrentFoodBenefitLevel(foodItem.GetTemplate().GetBaseItemLevel()) == 0)
|
if (foodItem.GetTemplate().GetBaseItemLevel() + 30 <= pet.GetLevel())
|
||||||
return SpellCastResult.FoodLowlevel;
|
return SpellCastResult.FoodLowlevel;
|
||||||
|
|
||||||
if (m_caster.IsInCombat() || pet.IsInCombat())
|
if (m_caster.IsInCombat() || pet.IsInCombat())
|
||||||
|
|||||||
@@ -3578,19 +3578,24 @@ namespace Game.Spells
|
|||||||
if (!pet.IsAlive())
|
if (!pet.IsAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int benefit = (int)pet.GetCurrentFoodBenefitLevel(foodItem.GetTemplate().GetBaseItemLevel());
|
|
||||||
if (benefit <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ExecuteLogEffectDestroyItem(effIndex, foodItem.GetEntry());
|
ExecuteLogEffectDestroyItem(effIndex, foodItem.GetEntry());
|
||||||
|
|
||||||
uint count = 1;
|
uint count = 1;
|
||||||
player.DestroyItemCount(foodItem, ref count, true);
|
player.DestroyItemCount(foodItem, ref count, true);
|
||||||
// @todo fix crash when a spell has two effects, both pointed at the same item target
|
// @todo fix crash when a spell has two effects, both pointed at the same item target
|
||||||
|
|
||||||
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
|
int pct;
|
||||||
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, benefit);
|
int levelDiff = (int)(pet.GetLevel() - foodItem.GetTemplate().GetBaseItemLevel());
|
||||||
m_caster.CastSpell(pet, effectInfo.TriggerSpell, args);
|
if (levelDiff >= 30)
|
||||||
|
return;
|
||||||
|
else if (levelDiff >= 20)
|
||||||
|
pct = (int)12.5; // we can't pass double so keeping the cast here for future references
|
||||||
|
else if (levelDiff >= 10)
|
||||||
|
pct = 25;
|
||||||
|
else
|
||||||
|
pct = 50;
|
||||||
|
|
||||||
|
m_caster.CastSpell(pet, effectInfo.TriggerSpell, new CastSpellExtraArgs(SpellValueMod.BasePoint0, pct).SetTriggerFlags(TriggerCastFlags.FullMask));
|
||||||
}
|
}
|
||||||
|
|
||||||
[SpellEffectHandler(SpellEffectName.DismissPet)]
|
[SpellEffectHandler(SpellEffectName.DismissPet)]
|
||||||
|
|||||||
Reference in New Issue
Block a user