Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/DataModel/Configuration/DropItemGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ public enum SpecialItemType
/// The money special item type.
/// </summary>
Money,

/// <summary>
/// The jewel special item type.
/// </summary>
Jewel,
}

/// <summary>
Expand Down
18 changes: 17 additions & 1 deletion src/GameLogic/DefaultDropGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,23 @@ private void AddRandomExcOptions(Item item)
else
{
var monsterLevel = (int)monster[Stats.Level];
var filteredPossibleItems = selectedGroup.PossibleItems.Where(it => it.DropLevel == 0 || ((it.DropLevel <= monsterLevel) && (it.DropLevel > monsterLevel - 12))).ToArray();
List<ItemDefinition> filteredPossibleItems;

if (selectedGroup.ItemType == SpecialItemType.Jewel)
{
filteredPossibleItems = [.. selectedGroup.PossibleItems.Where(it => it.DropLevel <= monsterLevel)];

if (monsterLevel > 66)
{
// Jewel of Chaos doesn't drop after a certain monster level
filteredPossibleItems.RemoveAll(it => it.Group == 12 && it.Number == 15);
}
}
else
{
filteredPossibleItems = [.. selectedGroup.PossibleItems.Where(it => it.DropLevel == 0 || (it.DropLevel <= monsterLevel && it.DropLevel > monsterLevel - 12))];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accordint to zTeamS6.3 (1, 2), emu (1, 2), the gap is 18 and not 12. Let me know if you want to change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question... I'm not sure if it is the correct value for all items. This would mean that Items can drop up to Level 5. If I remember correctly, this wasn't possible for all items. E.g. leather boots and gloves dropped until level 5, while other armor parts were limited to 3 or 4.
This 12 is btw at two places, it probably needs a constant, or to defined in ItemDefinition.

}

return this.GenerateItemDrop(selectedGroup, filteredPossibleItems);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private void AddItemDropGroups()
var jewelsDropItemGroup = this.Context.CreateNew<DropItemGroup>();
jewelsDropItemGroup.SetGuid(4);
jewelsDropItemGroup.Chance = 0.001;
jewelsDropItemGroup.ItemType = SpecialItemType.RandomItem;
jewelsDropItemGroup.ItemType = SpecialItemType.Jewel;
jewelsDropItemGroup.Description = "The jewels drop item group (0.1 % drop chance)";
this.GameConfiguration.DropItemGroups.Add(jewelsDropItemGroup);
BaseMapInitializer.RegisterDefaultDropItemGroup(jewelsDropItemGroup);
Expand Down
11 changes: 7 additions & 4 deletions src/Persistence/Initialization/Version075/Items/Pets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace MUnique.OpenMU.Persistence.Initialization.Version075.Items;
/// <summary>
/// Initializer for pets.
/// </summary>
public class Pets : InitializerBase
public class Pets : Jewels
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks strange. Can you move the AddItemToJewelItemDrop to InitializerBase instead?

{
/// <summary>
/// Initializes a new instance of the <see cref="Pets"/> class.
Expand All @@ -29,9 +29,12 @@ public Pets(IContext context, GameConfiguration gameConfiguration)
/// <inheritdoc />
public override void Initialize()
{
this.CreatePet(0, "Guardian Angel", 23, (Stats.DamageReceiveDecrement, 0.8f, AggregateType.Multiplicate), (Stats.MaximumHealth, 50f, AggregateType.AddRaw));
this.CreatePet(1, "Imp", 28, (Stats.AttackDamageIncrease, 1.3f, AggregateType.Multiplicate));
this.CreatePet(2, "Horn of Uniria", 25);
var angel = this.CreatePet(0, "Guardian Angel", 23, (Stats.DamageReceiveDecrement, 0.8f, AggregateType.Multiplicate), (Stats.MaximumHealth, 50f, AggregateType.AddRaw));
this.AddItemToJewelItemDrop(angel);
var imp = this.CreatePet(1, "Imp", 28, (Stats.AttackDamageIncrease, 1.3f, AggregateType.Multiplicate));
this.AddItemToJewelItemDrop(imp);
var uniria = this.CreatePet(2, "Horn of Uniria", 25);
this.AddItemToJewelItemDrop(uniria);
}

private ItemDefinition CreatePet(byte number, string name, int dropLevelAndLevelRequirement, params (AttributeDefinition, float, AggregateType)[] basePowerUps)
Expand Down
4 changes: 3 additions & 1 deletion src/Persistence/Initialization/Version075/Items/Potions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace MUnique.OpenMU.Persistence.Initialization.Version075.Items;
/// <summary>
/// Class which contains item definitions for jewels.
/// </summary>
public class Potions : InitializerBase
public class Potions : Jewels
{
/// <summary>
/// Initializes a new instance of the <see cref="Potions"/> class.
Expand Down Expand Up @@ -54,6 +54,7 @@ private ItemDefinition CreateAlcohol()
alcohol.Height = 2;
alcohol.SetGuid(alcohol.Group, alcohol.Number);
alcohol.ConsumeEffect = this.GameConfiguration.MagicEffects.First(effect => effect.Number == (short)MagicEffectNumber.Alcohol);
this.AddItemToJewelItemDrop(alcohol);
return alcohol;
}

Expand Down Expand Up @@ -230,6 +231,7 @@ private ItemDefinition CreateTownPortalScroll()
definition.Width = 1;
definition.Height = 2;
definition.SetGuid(definition.Group, definition.Number);
this.AddItemToJewelItemDrop(definition);
return definition;
}
}
11 changes: 7 additions & 4 deletions src/Persistence/Initialization/Version095d/Items/Pets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace MUnique.OpenMU.Persistence.Initialization.Version095d.Items;
/// <summary>
/// Initializer for pets.
/// </summary>
public class Pets : InitializerBase
public class Pets : Jewels
{
/// <summary>
/// Initializes a new instance of the <see cref="Pets"/> class.
Expand All @@ -30,9 +30,12 @@ public Pets(IContext context, GameConfiguration gameConfiguration)
/// <inheritdoc />
public override void Initialize()
{
this.CreatePet(0, 0, "Guardian Angel", 23, true, (Stats.DamageReceiveDecrement, 0.8f, AggregateType.Multiplicate), (Stats.MaximumHealth, 50f, AggregateType.AddRaw));
this.CreatePet(1, 0, "Imp", 28, true, (Stats.AttackDamageIncrease, 1.3f, AggregateType.Multiplicate));
this.CreatePet(2, 0, "Horn of Uniria", 25, true);
var angel = this.CreatePet(0, 0, "Guardian Angel", 23, true, (Stats.DamageReceiveDecrement, 0.8f, AggregateType.Multiplicate), (Stats.MaximumHealth, 50f, AggregateType.AddRaw));
this.AddItemToJewelItemDrop(angel);
var imp = this.CreatePet(1, 0, "Imp", 28, true, (Stats.AttackDamageIncrease, 1.3f, AggregateType.Multiplicate));
this.AddItemToJewelItemDrop(imp);
var uniria = this.CreatePet(2, 0, "Horn of Uniria", 25, true);
this.AddItemToJewelItemDrop(uniria);

var dinorant = this.CreatePet(3, SkillNumber.FireBreath, "Horn of Dinorant", 110, false, (Stats.IsDinorantEquipped, 1, AggregateType.AddRaw), (Stats.DamageReceiveDecrement, 0.9f, AggregateType.Multiplicate), (Stats.AttackDamageIncrease, 1.15f, AggregateType.Multiplicate));
this.AddDinorantOptions(dinorant);
Expand Down
11 changes: 7 additions & 4 deletions src/Persistence/Initialization/VersionSeasonSix/Items/Pets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace MUnique.OpenMU.Persistence.Initialization.VersionSeasonSix.Items;
/// Initializer for pets.
/// </summary>
/// <remarks>Pet system changed in Season 9. Reference: https://muonline.webzen.com/en/gameinfo/guide/detail/76 .</remarks>
public class Pets : InitializerBase
public class Pets : Jewels
{
private const string PetExperienceFormula = "level * level * level * 100 * (level + 10)";

Expand All @@ -37,12 +37,15 @@ public Pets(IContext context, GameConfiguration gameConfiguration)
public override void Initialize()
{
#pragma warning disable SA1117 // Parameters should be on same line or separete lines
this.CreatePet(0, 0, 1, 1, "Guardian Angel", 23, true, true,
var angel = this.CreatePet(0, 0, 1, 1, "Guardian Angel", 23, true, true,
(Stats.DamageReceiveDecrement, 0.8f, AggregateType.Multiplicate),
(Stats.MaximumHealth, 50f, AggregateType.AddRaw));
this.CreatePet(1, 0, 1, 1, "Imp", 28, true, true,
this.AddItemToJewelItemDrop(angel);
var imp = this.CreatePet(1, 0, 1, 1, "Imp", 28, true, true,
(Stats.AttackDamageIncrease, 1.3f, AggregateType.Multiplicate));
this.CreatePet(2, 0, 1, 1, "Horn of Uniria", 25, true, true);
this.AddItemToJewelItemDrop(imp);
var uniria = this.CreatePet(2, 0, 1, 1, "Horn of Uniria", 25, true, true);
this.AddItemToJewelItemDrop(uniria);

var dinorant = this.CreatePet(3, SkillNumber.FireBreath, 1, 1, "Horn of Dinorant", 110, false, true,
(Stats.IsDinorantEquipped, 1, AggregateType.AddRaw),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace MUnique.OpenMU.Persistence.Initialization.VersionSeasonSix.Items;
/// <summary>
/// Class which contains item definitions for jewels.
/// </summary>
public class Potions : InitializerBase
public class Potions : Jewels
{
/// <summary>
/// Initializes a new instance of the <see cref="Potions"/> class.
Expand Down Expand Up @@ -75,6 +75,7 @@ private ItemDefinition CreateAlcohol()
alcohol.Height = 2;
alcohol.SetGuid(alcohol.Group, alcohol.Number);
alcohol.ConsumeEffect = this.GameConfiguration.MagicEffects.First(effect => effect.Number == (short)MagicEffectNumber.Alcohol);
this.AddItemToJewelItemDrop(alcohol);
return alcohol;
}

Expand Down Expand Up @@ -375,6 +376,7 @@ private ItemDefinition CreateTownPortalScroll()
definition.Width = 1;
definition.Height = 2;
definition.SetGuid(definition.Group, definition.Number);
this.AddItemToJewelItemDrop(definition);
return definition;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ protected override void InitializeDropItemGroups()
var jewelsDropItemGroup = this.Context.CreateNew<DropItemGroup>();
jewelsDropItemGroup.SetGuid(this.MapNumber, 1);
jewelsDropItemGroup.Chance = 0.001;
jewelsDropItemGroup.ItemType = SpecialItemType.RandomItem;
jewelsDropItemGroup.ItemType = SpecialItemType.Jewel;
jewelsDropItemGroup.Description = "Jewel of Guardian";

var jewelOfGuardian = this.GameConfiguration.Items.First(y => y.Group == 14 && y.Number == 31);
Expand Down