diff --git a/src/DataModel/ItemExtensions.cs b/src/DataModel/ItemExtensions.cs index 72fc7b590..95d67a2d1 100644 --- a/src/DataModel/ItemExtensions.cs +++ b/src/DataModel/ItemExtensions.cs @@ -58,6 +58,30 @@ public static bool IsTrainablePet(this ItemDefinition itemDefinition) return itemDefinition.PetExperienceFormula is not null; } + /// <summary> + /// Determines whether the specified item is a dark raven. + /// </summary> + /// <param name="item">The item.</param> + /// <returns> + /// <c>true</c> if the specified item is raven; otherwise, <c>false</c>. + /// </returns> + public static bool IsDarkRaven(this Item item) + { + return item.Definition is { Group: 13, Number: 5 }; + } + + /// <summary> + /// Gets the dark raven leadership requirement, based on pet level. + /// TODO: Make somehow configurable? + /// </summary> + /// <param name="item">The item.</param> + /// <param name="petLevel">The pet level.</param> + /// <returns>The required leadership.</returns> + public static int GetDarkRavenLeadershipRequirement(this Item item, int petLevel) + { + return petLevel * 15 + 185; + } + /// <summary> /// Determines whether this item can have a skill. /// </summary> diff --git a/src/GameLogic/Player.cs b/src/GameLogic/Player.cs index 90a185c01..91b84325d 100644 --- a/src/GameLogic/Player.cs +++ b/src/GameLogic/Player.cs @@ -2332,7 +2332,8 @@ async ValueTask AddExpToPetAsync(Item pet, double experience) { pet.PetExperience += (int)experience; - while (pet.PetExperience >= pet.Definition!.GetExperienceOfPetLevel((byte)(pet.Level + 1), pet.Definition!.MaximumItemLevel)) + while (pet.PetExperience >= pet.Definition!.GetExperienceOfPetLevel((byte)(pet.Level + 1), pet.Definition!.MaximumItemLevel) + && (!pet.IsDarkRaven() || pet.GetDarkRavenLeadershipRequirement(pet.Level + 1) <= this.Attributes![Stats.TotalLeadership])) { pet.Level++;