diff --git a/Source/Framework/Collections/Array.cs b/Source/Framework/Collections/Array.cs index 338d7427c..19a578f6f 100644 --- a/Source/Framework/Collections/Array.cs +++ b/Source/Framework/Collections/Array.cs @@ -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 diff --git a/Source/Game/Entities/Pet.cs b/Source/Game/Entities/Pet.cs index b2d1b322c..e5386ef5b 100644 --- a/Source/Game/Entities/Pet.cs +++ b/Source/Game/Entities/Pet.cs @@ -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); diff --git a/Source/Game/Entities/Unit/Unit.Spells.cs b/Source/Game/Entities/Unit/Unit.Spells.cs index 64734f1ee..80b0fff75 100644 --- a/Source/Game/Entities/Unit/Unit.Spells.cs +++ b/Source/Game/Entities/Unit/Unit.Spells.cs @@ -3266,7 +3266,6 @@ namespace Game.Entities } UpdateInterruptMask(); - } public void RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2 flag, uint except = 0) diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index f1e749fa4..ae92efea1 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -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()) diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index 714aa56fe..38639a5aa 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -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)]