//
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
namespace MUnique.OpenMU.DataModel.Configuration.ItemCrafting;
using MUnique.OpenMU.Annotations;
using MUnique.OpenMU.DataModel.Configuration.Items;
///
/// Defines the resulting item of a crafting.
///
[Cloneable]
public partial class ItemCraftingResultItem
{
///
/// Gets or sets the item definition.
///
public virtual ItemDefinition? ItemDefinition { get; set; }
///
/// Gets or sets the random minimum level for a created item.
///
public byte RandomMinimumLevel { get; set; }
///
/// Gets or sets the random maximum level for a created item.
///
public byte RandomMaximumLevel { get; set; }
///
/// Gets or sets the durability for a created item explicitly.
///
public byte? Durability { get; set; }
///
/// Gets or sets the reference to the corresponding .
/// If 0, no reference exists.
///
///
/// For Item Upping.
///
public byte Reference { get; set; }
///
/// Gets or sets the add level.
///
///
/// For Item Upping.
///
public byte AddLevel { get; set; }
///
public override string ToString()
{
string itemName;
if (this.ItemDefinition is null)
{
itemName = $"Referenced item {this.Reference} will be modified.";
}
else
{
itemName = this.ItemDefinition.Name;
}
string level;
if (this.RandomMinimumLevel == this.RandomMaximumLevel && this.RandomMinimumLevel == 0)
{
level = string.Empty;
}
else if (this.RandomMinimumLevel == this.RandomMaximumLevel)
{
level = $"+{this.RandomMinimumLevel}";
}
else
{
level = $"+{this.RandomMinimumLevel}~{this.RandomMaximumLevel}";
}
return $"{itemName}{level}";
}
}