Core/Spells: Removed extra health from feed pet

Port From (https://github.com/TrinityCore/TrinityCore/commit/60df74933f0bf75865ba963b33c2c1bdd9cdefbd)
This commit is contained in:
hondacrx
2021-04-22 20:40:17 -04:00
parent e64b091512
commit 47f993bff5
5 changed files with 14 additions and 25 deletions
+1
View File
@@ -57,6 +57,7 @@ namespace System.Collections.Generic
{
if (Count >= _limit)
throw new InternalBufferOverflowException("Attempted to read more array elements from packet " + Count + 1 + " than allowed " + _limit);
Insert(index, value);
}
else
-16
View File
@@ -750,22 +750,6 @@ namespace Game.Entities
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()
{
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PET_SPELL_COOLDOWN);
-1
View File
@@ -3266,7 +3266,6 @@ namespace Game.Entities
}
UpdateInterruptMask();
}
public void RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2 flag, uint except = 0)
+1 -1
View File
@@ -4996,7 +4996,7 @@ namespace Game.Spells
if (!pet.HaveInDiet(foodItem.GetTemplate()))
return SpellCastResult.WrongPetFood;
if (pet.GetCurrentFoodBenefitLevel(foodItem.GetTemplate().GetBaseItemLevel()) == 0)
if (foodItem.GetTemplate().GetBaseItemLevel() + 30 <= pet.GetLevel())
return SpellCastResult.FoodLowlevel;
if (m_caster.IsInCombat() || pet.IsInCombat())
+12 -7
View File
@@ -3578,19 +3578,24 @@ namespace Game.Spells
if (!pet.IsAlive())
return;
int benefit = (int)pet.GetCurrentFoodBenefitLevel(foodItem.GetTemplate().GetBaseItemLevel());
if (benefit <= 0)
return;
ExecuteLogEffectDestroyItem(effIndex, foodItem.GetEntry());
uint count = 1;
player.DestroyItemCount(foodItem, ref count, true);
// @todo fix crash when a spell has two effects, both pointed at the same item target
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, benefit);
m_caster.CastSpell(pet, effectInfo.TriggerSpell, args);
int pct;
int levelDiff = (int)(pet.GetLevel() - foodItem.GetTemplate().GetBaseItemLevel());
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)]