baseline: OpenMU upstream b5a0961 (fresh source)

This commit is contained in:
Acentech Dev
2026-07-14 19:00:35 +03:00
parent 450402e47d
commit 36fc125d5c
11968 changed files with 748705 additions and 0 deletions

View File

@@ -0,0 +1,139 @@
// <copyright file="Armors.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>
namespace MUnique.OpenMU.Persistence.Initialization.Version075.Items;
using MUnique.OpenMU.DataModel.Configuration;
using MUnique.OpenMU.Persistence.Initialization.Items;
/// <summary>
/// Initializer for armor data.
/// </summary>
public class Armors : ArmorInitializerBase
{
/// <summary>
/// Initializes a new instance of the <see cref="Armors"/> class.
/// </summary>
/// <param name="context">The persistence context.</param>
/// <param name="gameConfiguration">The game configuration.</param>
public Armors(IContext context, GameConfiguration gameConfiguration)
: base(context, gameConfiguration)
{
}
/// <inheritdoc />
protected override byte MaximumArmorLevel => 11;
/// <summary>
/// Initializes armor data.
/// </summary>
public override void Initialize()
{
base.Initialize();
// Shields:
this.CreateShield(0, 1, 0, 2, 2, "Small Shield", 3, 1, 3, 22, 70, 0, 1, 1, 1);
this.CreateShield(1, 1, 0, 2, 2, "Horn Shield", 9, 3, 9, 28, 100, 0, 0, 1, 0);
this.CreateShield(2, 1, 0, 2, 2, "Kite Shield", 12, 4, 12, 32, 110, 0, 0, 1, 0);
this.CreateShield(3, 1, 0, 2, 2, "Elven Shield", 21, 8, 21, 36, 30, 100, 0, 0, 1);
this.CreateShield(4, 1, 18, 2, 2, "Buckler", 6, 2, 6, 24, 80, 0, 1, 1, 1);
this.CreateShield(5, 1, 18, 2, 2, "Dragon Slayer Shield", 35, 10, 36, 44, 100, 40, 0, 1, 0);
this.CreateShield(6, 1, 18, 2, 2, "Skull Shield", 15, 5, 15, 34, 110, 0, 1, 1, 1);
this.CreateShield(7, 1, 18, 2, 2, "Spiked Shield", 30, 9, 30, 40, 130, 0, 0, 1, 0);
this.CreateShield(8, 1, 18, 2, 2, "Tower Shield", 40, 11, 40, 46, 130, 0, 0, 1, 1);
this.CreateShield(9, 1, 18, 2, 2, "Plate Shield", 25, 8, 25, 38, 120, 0, 0, 1, 0);
this.CreateShield(10, 1, 18, 2, 2, "Big Round Shield", 18, 6, 18, 35, 120, 0, 0, 1, 0);
this.CreateShield(11, 1, 18, 2, 2, "Serpent Shield", 45, 12, 45, 48, 130, 0, 0, 1, 1);
this.CreateShield(12, 1, 18, 2, 2, "Bronze Shield", 54, 13, 54, 52, 140, 0, 0, 1, 0);
this.CreateShield(13, 1, 18, 2, 2, "Dragon Shield", 60, 14, 60, 60, 120, 40, 0, 1, 0);
this.CreateShield(14, 1, 0, 2, 3, "Legendary Shield", 48, 7, 48, 50, 90, 25, 1, 0, 1);
// Helmets:
this.CreateArmor(0, 2, 2, 2, "Bronze Helm", 16, 9, 34, 80, 20, 0, 1, 0);
this.CreateArmor(1, 2, 2, 2, "Dragon Helm", 57, 24, 68, 120, 30, 0, 1, 0);
this.CreateArmor(2, 2, 2, 2, "Pad Helm", 5, 4, 28, 20, 0, 1, 0, 0);
this.CreateArmor(3, 2, 2, 2, "Legendary Helm", 50, 18, 42, 30, 0, 1, 0, 0);
this.CreateArmor(4, 2, 2, 2, "Bone Helm", 18, 9, 30, 30, 0, 1, 0, 0);
this.CreateArmor(5, 2, 2, 2, "Leather Helm", 6, 5, 30, 80, 0, 0, 1, 0);
this.CreateArmor(6, 2, 2, 2, "Scale Helm", 26, 12, 40, 110, 0, 0, 1, 0);
this.CreateArmor(7, 2, 2, 2, "Sphinx Mask", 32, 13, 36, 30, 0, 1, 0, 0);
this.CreateArmor(8, 2, 2, 2, "Brass Helm", 36, 17, 44, 100, 30, 0, 1, 0);
this.CreateArmor(9, 2, 2, 2, "Plate Helm", 46, 20, 50, 130, 0, 0, 1, 0);
this.CreateArmor(10, 2, 2, 2, "Vine Helm", 6, 4, 22, 30, 60, 0, 0, 1);
this.CreateArmor(11, 2, 2, 2, "Silk Helm", 16, 8, 26, 30, 70, 0, 0, 1);
this.CreateArmor(12, 2, 2, 2, "Wind Helm", 28, 12, 32, 30, 80, 0, 0, 1);
this.CreateArmor(13, 2, 2, 2, "Spirit Helm", 40, 16, 38, 40, 80, 0, 0, 1);
this.CreateArmor(14, 2, 2, 2, "Guardian Helm", 53, 23, 45, 40, 80, 0, 0, 1);
// Armors:
this.CreateArmor(0, 3, 2, 2, "Bronze Armor", 18, 14, 34, 80, 20, 0, 1, 0);
this.CreateArmor(1, 3, 2, 3, "Dragon Armor", 59, 37, 68, 120, 30, 0, 1, 0);
this.CreateArmor(2, 3, 2, 2, "Pad Armor", 10, 7, 28, 30, 0, 1, 0, 0);
this.CreateArmor(3, 3, 2, 2, "Legendary Armor", 56, 22, 42, 40, 0, 1, 0, 0);
this.CreateArmor(4, 3, 2, 2, "Bone Armor", 22, 13, 30, 40, 0, 1, 0, 0);
this.CreateArmor(5, 3, 2, 3, "Leather Armor", 10, 10, 30, 80, 0, 0, 1, 0);
this.CreateArmor(6, 3, 2, 2, "Scale Armor", 28, 18, 40, 110, 0, 0, 1, 0);
this.CreateArmor(7, 3, 2, 3, "Sphinx Armor", 38, 17, 36, 40, 0, 1, 0, 0);
this.CreateArmor(8, 3, 2, 2, "Brass Armor", 38, 22, 44, 100, 30, 0, 1, 0);
this.CreateArmor(9, 3, 2, 2, "Plate Armor", 48, 30, 50, 130, 0, 0, 1, 0);
this.CreateArmor(10, 3, 2, 2, "Vine Armor", 10, 8, 22, 30, 60, 0, 0, 1);
this.CreateArmor(11, 3, 2, 2, "Silk Armor", 20, 12, 26, 30, 70, 0, 0, 1);
this.CreateArmor(12, 3, 2, 2, "Wind Armor", 32, 16, 32, 30, 80, 0, 0, 1);
this.CreateArmor(13, 3, 2, 2, "Spirit Armor", 44, 21, 38, 40, 80, 0, 0, 1);
this.CreateArmor(14, 3, 2, 2, "Guardian Armor", 57, 29, 45, 40, 80, 0, 0, 1);
// Pants:
this.CreateArmor(0, 4, 2, 2, "Bronze Pants", 15, 10, 34, 80, 20, 0, 1, 0);
this.CreateArmor(1, 4, 2, 2, "Dragon Pants", 55, 26, 68, 120, 30, 0, 1, 0);
this.CreateArmor(2, 4, 2, 2, "Pad Pants", 8, 5, 28, 30, 0, 1, 0, 0);
this.CreateArmor(3, 4, 2, 2, "Legendary Pants", 53, 20, 42, 40, 0, 1, 0, 0);
this.CreateArmor(4, 4, 2, 2, "Bone Pants", 20, 10, 30, 40, 0, 1, 0, 0);
this.CreateArmor(5, 4, 2, 2, "Leather Pants", 8, 7, 30, 80, 0, 0, 1, 0);
this.CreateArmor(6, 4, 2, 2, "Scale Pants", 25, 14, 40, 110, 0, 0, 1, 0);
this.CreateArmor(7, 4, 2, 2, "Sphinx Pants", 34, 15, 36, 40, 0, 1, 0, 0);
this.CreateArmor(8, 4, 2, 2, "Brass Pants", 35, 18, 44, 100, 30, 0, 1, 0);
this.CreateArmor(9, 4, 2, 2, "Plate Pants", 45, 22, 50, 130, 0, 0, 1, 0);
this.CreateArmor(10, 4, 2, 2, "Vine Pants", 8, 6, 22, 30, 60, 0, 0, 1);
this.CreateArmor(11, 4, 2, 2, "Silk Pants", 18, 10, 26, 30, 70, 0, 0, 1);
this.CreateArmor(12, 4, 2, 2, "Wind Pants", 30, 14, 32, 30, 80, 0, 0, 1);
this.CreateArmor(13, 4, 2, 2, "Spirit Pants", 42, 18, 38, 40, 80, 0, 0, 1);
this.CreateArmor(14, 4, 2, 2, "Guardian Pants", 54, 25, 45, 40, 80, 0, 0, 1);
// Gloves:
this.CreateGloves(0, "Bronze Gloves", 13, 4, 4, 34, 80, 20, 0, 1, 0);
this.CreateGloves(1, "Dragon Gloves", 52, 14, 6, 68, 120, 30, 0, 1, 0);
this.CreateGloves(2, "Pad Gloves", 3, 2, 0, 28, 20, 0, 1, 0, 0);
this.CreateGloves(3, "Legendary Gloves", 44, 11, 0, 42, 20, 0, 1, 0, 0);
this.CreateGloves(4, "Bone Gloves", 14, 5, 0, 30, 20, 0, 1, 0, 0);
this.CreateGloves(5, "Leather Gloves", 4, 2, 8, 30, 80, 0, 0, 1, 0);
this.CreateGloves(6, "Scale Gloves", 22, 7, 10, 40, 110, 0, 0, 1, 0);
this.CreateGloves(7, "Sphinx Gloves", 28, 8, 0, 36, 20, 0, 1, 0, 0);
this.CreateGloves(8, "Brass Gloves", 32, 9, 8, 44, 100, 30, 0, 1, 0);
this.CreateGloves(9, "Plate Gloves", 42, 12, 4, 50, 130, 0, 0, 1, 0);
this.CreateGloves(10, "Vine Gloves", 4, 2, 4, 22, 30, 60, 0, 0, 1);
this.CreateGloves(11, "Silk Gloves", 14, 4, 8, 26, 30, 70, 0, 0, 1);
this.CreateGloves(12, "Wind Gloves", 26, 6, 10, 32, 30, 80, 0, 0, 1);
this.CreateGloves(13, "Spirit Gloves", 38, 9, 4, 38, 40, 80, 0, 0, 1);
this.CreateGloves(14, "Guardian Gloves", 50, 15, 6, 45, 40, 80, 0, 0, 1);
// Boots:
this.CreateBoots(0, 6, 2, 2, "Bronze Boots", 12, 4, 10, 34, 80, 20, 0, 1, 0);
this.CreateBoots(1, 6, 2, 2, "Dragon Boots", 54, 15, 2, 68, 120, 30, 0, 1, 0);
this.CreateBoots(2, 6, 2, 2, "Pad Boots", 4, 3, 10, 28, 20, 0, 1, 0, 0);
this.CreateBoots(3, 6, 2, 2, "Legendary Boots", 46, 12, 0, 42, 30, 0, 1, 0, 0);
this.CreateBoots(4, 6, 2, 2, "Bone Boots", 16, 6, 6, 30, 30, 0, 1, 0, 0);
this.CreateBoots(5, 6, 2, 2, "Leather Boots", 5, 2, 12, 30, 80, 0, 0, 1, 0);
this.CreateBoots(6, 6, 2, 2, "Scale Boots", 22, 8, 8, 40, 110, 0, 0, 1, 0);
this.CreateBoots(7, 6, 2, 2, "Sphinx Boots", 30, 9, 8, 36, 30, 0, 1, 0, 0);
this.CreateBoots(8, 6, 2, 2, "Brass Boots", 32, 10, 6, 44, 100, 30, 0, 1, 0);
this.CreateBoots(9, 6, 2, 2, "Plate Boots", 42, 12, 4, 50, 130, 0, 0, 1, 0);
this.CreateBoots(10, 6, 2, 2, "Vine Boots", 5, 2, 0, 22, 30, 60, 0, 0, 1);
this.CreateBoots(11, 6, 2, 2, "Silk Boots", 15, 4, 0, 26, 30, 70, 0, 0, 1);
this.CreateBoots(12, 6, 2, 2, "Wind Boots", 27, 7, 0, 32, 30, 80, 0, 0, 1);
this.CreateBoots(13, 6, 2, 2, "Spirit Boots", 40, 10, 0, 38, 40, 80, 0, 0, 1);
this.CreateBoots(14, 6, 2, 2, "Guardian Boots", 52, 16, 0, 45, 40, 80, 0, 0, 1);
this.BuildSets();
}
}

View File

@@ -0,0 +1,21 @@
// <copyright file="Constants.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>
namespace MUnique.OpenMU.Persistence.Initialization.Version075.Items;
/// <summary>
/// Constants for this game version.
/// </summary>
internal static class Constants
{
/// <summary>
/// Gets the maximum item level.
/// </summary>
public static byte MaximumItemLevel => 11;
/// <summary>
/// Gets the maximum option level.
/// </summary>
public static byte MaximumOptionLevel => 4;
}

View File

@@ -0,0 +1,216 @@
// <copyright file="Jewelery.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>
namespace MUnique.OpenMU.Persistence.Initialization.Version075.Items;
using MUnique.OpenMU.AttributeSystem;
using MUnique.OpenMU.DataModel.Configuration;
using MUnique.OpenMU.DataModel.Configuration.Items;
using MUnique.OpenMU.GameLogic.Attributes;
/// <summary>
/// Initializer for jewelery (rings and pendants).
/// </summary>
internal class Jewelery : InitializerBase
{
private static readonly float[] ResistanceIncreaseByLevel = { 0, 1, 2, 3, 4 };
private ItemOptionDefinition? _healthRecoverOptionDefinition;
private ItemLevelBonusTable? _resistancesBonusTable;
/// <summary>
/// Initializes a new instance of the <see cref="Jewelery"/> class.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="gameConfiguration">The game configuration.</param>
public Jewelery(IContext context, GameConfiguration gameConfiguration)
: base(context, gameConfiguration)
{
}
/// <inheritdoc/>
protected override int MaximumOptionLevel => 3;
/// <inheritdoc/>
public sealed override void Initialize()
{
this._healthRecoverOptionDefinition = this.CreateOption("Health recover for jewelery", Stats.HealthRecoveryMultiplier, 0.01f, ItemOptionDefinitionNumbers.JeweleryHealth);
this._resistancesBonusTable = this.CreateItemBonusTable(ResistanceIncreaseByLevel, "Elemental resistances (Jewelery)", "Defines the elemental resistances for jewelery. It's 1 per item level.");
this.CreateItems();
}
/// <summary>
/// Creates the items.
/// </summary>
protected virtual void CreateItems()
{
this.CreateRing(8, "Ring of Ice", 20, 50, Stats.IceResistance);
this.CreateRing(9, "Ring of Poison", 17, 50, Stats.PoisonResistance);
this.CreatePendant(12, "Pendant of Lighting", 21, 50, Stats.LightningResistance);
this.CreatePendant(13, "Pendant of Fire", 13, 50, Stats.FireResistance);
this.CreateTransformationRing(
10,
"Transformation Ring",
0,
200,
20, // It's actually lvl 50 for the last 3
CharacterTransformationSkin.BudgeDragon,
CharacterTransformationSkin.Giant,
CharacterTransformationSkin.SkeletonWarrior,
CharacterTransformationSkin.PoisonBullFighter,
CharacterTransformationSkin.ThunderLich,
CharacterTransformationSkin.DeathCow);
}
/// <summary>
/// Creates a transformation ring.
/// </summary>
/// <param name="number">The number.</param>
/// <param name="name">The name.</param>
/// <param name="dropLevel">The level.</param>
/// <param name="durability">The durability.</param>
/// <param name="requiredlevel">The required level to wear.</param>
/// <param name="transformationSkins">The transformation skins, per item level.</param>
/// <returns>The definition of the created ring.</returns>
protected ItemDefinition CreateTransformationRing(byte number, string name, byte dropLevel, byte durability, byte requiredlevel, params CharacterTransformationSkin[] transformationSkins)
{
var ring = this.Context.CreateNew<ItemDefinition>();
this.GameConfiguration.Items.Add(ring);
ring.Group = 13;
ring.Number = number;
ring.ItemSlot = this.GameConfiguration.ItemSlotTypes.FirstOrDefault(slotType => slotType.ItemSlots.Contains(10));
ring.Name = name;
ring.DropLevel = dropLevel;
ring.Durability = durability;
ring.MaximumItemLevel = (byte)(transformationSkins.Length - 1);
ring.Width = 1;
ring.Height = 1;
this.CreateItemRequirementIfNeeded(ring, Stats.Level, requiredlevel);
var powerUp = this.Context.CreateNew<ItemBasePowerUpDefinition>();
ring.BasePowerUpAttributes.Add(powerUp);
powerUp.BaseValue = 0;
powerUp.TargetAttribute = Stats.TransformationSkin.GetPersistent(this.GameConfiguration);
powerUp.BonusPerLevelTable = this.CreateItemBonusTable(transformationSkins.Select(v => (float)v).ToArray(), $"Transformation Ring Skins ({name})", $"Contains the skin numbers for the different levels of the transformation ring ({name}).");
foreach (var characterClass in this.GameConfiguration.CharacterClasses)
{
ring.QualifiedCharacters.Add(characterClass);
}
ring.SetGuid(ring.Group, ring.Number);
return ring;
}
/// <summary>
/// Creates the option.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="targetAttribute">The target attribute.</param>
/// <param name="boostPerLevel">The boost per level.</param>
/// <param name="optionNumber">The option number.</param>
/// <param name="aggregateType">Type of the aggregate.</param>
/// <returns>
/// The created option.
/// </returns>
protected ItemOptionDefinition CreateOption(string name, AttributeDefinition targetAttribute, float boostPerLevel, short optionNumber, AggregateType aggregateType = AggregateType.AddRaw)
{
var optionDefinition = this.Context.CreateNew<ItemOptionDefinition>();
optionDefinition.SetGuid(optionNumber, targetAttribute.Id.ExtractFirstTwoBytes());
optionDefinition.AddsRandomly = true;
optionDefinition.Name = name;
optionDefinition.AddChance = 0.25f;
optionDefinition.MaximumOptionsPerItem = 1;
var option = this.CreateItemOption(0, targetAttribute, 0, aggregateType, boostPerLevel, optionNumber);
optionDefinition.PossibleOptions.Add(option);
this.GameConfiguration.ItemOptions.Add(optionDefinition);
return optionDefinition;
}
/// <summary>
/// Creates the jewelery.
/// </summary>
/// <param name="number">The number.</param>
/// <param name="slot">The slot.</param>
/// <param name="dropsFromMonsters">if set to <c>true</c> [drops from monsters].</param>
/// <param name="name">The name.</param>
/// <param name="level">The level.</param>
/// <param name="durability">The durability.</param>
/// <param name="resistanceAttribute">The resistance attribute.</param>
/// <param name="withHealthOption">if set to <c>true</c> [with health option].</param>
/// <returns>The created jewelery.</returns>
protected ItemDefinition CreateJewelery(byte number, int slot, bool dropsFromMonsters, string name, byte level, byte durability, AttributeDefinition? resistanceAttribute, bool withHealthOption = true)
{
var item = this.Context.CreateNew<ItemDefinition>();
this.GameConfiguration.Items.Add(item);
item.Group = 13;
item.Number = number;
item.ItemSlot = this.GameConfiguration.ItemSlotTypes.FirstOrDefault(slotType => slotType.ItemSlots.Contains(slot));
item.DropsFromMonsters = dropsFromMonsters;
item.Name = name;
item.DropLevel = level;
item.MaximumItemLevel = 4;
item.Width = 1;
item.Height = 1;
item.Durability = durability;
//// TODO: Requirement increases with item level
this.CreateItemRequirementIfNeeded(item, Stats.Level, level);
if (withHealthOption)
{
item.PossibleItemOptions.Add(this._healthRecoverOptionDefinition!);
}
if (resistanceAttribute != null)
{
var powerUp = this.CreateItemBasePowerUpDefinition(resistanceAttribute, 1f, AggregateType.Maximum);
powerUp.BonusPerLevelTable = this._resistancesBonusTable;
item.BasePowerUpAttributes.Add(powerUp);
}
foreach (var characterClass in this.GameConfiguration.CharacterClasses)
{
item.QualifiedCharacters.Add(characterClass);
}
item.SetGuid(item.Group, item.Number);
return item;
}
/// <summary>
/// Creates a ring.
/// </summary>
/// <param name="number">The number.</param>
/// <param name="name">The name.</param>
/// <param name="level">The level.</param>
/// <param name="durability">The durability.</param>
/// <param name="resistanceAttribute">The resistance attribute.</param>
/// <remarks>
/// Rings always have defensive excellent options.
/// </remarks>
private void CreateRing(byte number, string name, byte level, byte durability, AttributeDefinition? resistanceAttribute)
{
this.CreateJewelery(number, 10, true, name, level, durability, resistanceAttribute);
}
/// <summary>
/// Creates a pendant.
/// </summary>
/// <param name="number">The number.</param>
/// <param name="name">The name.</param>
/// <param name="level">The level.</param>
/// <param name="durability">The durability.</param>
/// <param name="resistanceAttribute">The resistance attribute.</param>
/// <remarks>
/// Pendants always have offensive excellent options. If it's wizardry or physical depends on the specific item. I didn't find a pattern yet.
/// </remarks>
private void CreatePendant(byte number, string name, byte level, byte durability, AttributeDefinition? resistanceAttribute)
{
this.CreateJewelery(number, 9, true, name, level, durability, resistanceAttribute);
}
}

View File

@@ -0,0 +1,95 @@
// <copyright file="Jewels.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>
namespace MUnique.OpenMU.Persistence.Initialization.Version075.Items;
using MUnique.OpenMU.DataModel.Configuration;
using MUnique.OpenMU.DataModel.Configuration.Items;
/// <summary>
/// Jewels for MU Version 0.75.
/// </summary>
public class Jewels : InitializerBase
{
/// <summary>
/// Initializes a new instance of the <see cref="Jewels"/> class.
/// </summary>
/// <param name="context">The persistence context.</param>
/// <param name="gameConfiguration">The game configuration.</param>
public Jewels(IContext context, GameConfiguration gameConfiguration)
: base(context, gameConfiguration)
{
}
/// <inheritdoc />
public override void Initialize()
{
this.GameConfiguration.Items.Add(this.CreateJewelOfBless());
this.GameConfiguration.Items.Add(this.CreateJewelOfSoul());
this.GameConfiguration.Items.Add(this.CreateJewelOfChaos());
}
/// <summary>
/// Creates an <see cref="ItemDefinition"/> for the 'Jewel of Bless'.
/// </summary>
/// <returns><see cref="ItemDefinition"/> for the 'Jewel of Bless'.</returns>
private ItemDefinition CreateJewelOfBless()
{
var itemDefinition = this.Context.CreateNew<ItemDefinition>();
itemDefinition.Name = "Jewel of Bless";
itemDefinition.Number = 13;
itemDefinition.Group = 14;
itemDefinition.DropsFromMonsters = false;
itemDefinition.DropLevel = 25;
itemDefinition.Durability = 1;
itemDefinition.Width = 1;
itemDefinition.Height = 1;
itemDefinition.Value = 150;
itemDefinition.SetGuid(itemDefinition.Group, itemDefinition.Number);
this.AddItemToJewelItemDrop(itemDefinition);
return itemDefinition;
}
/// <summary>
/// Creates an <see cref="ItemDefinition"/> for the 'Jewel of Bless'.
/// </summary>
/// <returns><see cref="ItemDefinition"/> for the 'Jewel of Bless'.</returns>
private ItemDefinition CreateJewelOfSoul()
{
var itemDefinition = this.Context.CreateNew<ItemDefinition>();
itemDefinition.Name = "Jewel of Soul";
itemDefinition.Number = 14;
itemDefinition.Group = 14;
itemDefinition.DropsFromMonsters = false;
itemDefinition.DropLevel = 30;
itemDefinition.Durability = 1;
itemDefinition.Width = 1;
itemDefinition.Height = 1;
itemDefinition.Value = 150;
itemDefinition.SetGuid(itemDefinition.Group, itemDefinition.Number);
this.AddItemToJewelItemDrop(itemDefinition);
return itemDefinition;
}
/// <summary>
/// Creates an <see cref="ItemDefinition"/> for the 'Jewel of Chaos'.
/// </summary>
/// <returns><see cref="ItemDefinition"/> for the 'Jewel of Chaos'.</returns>
private ItemDefinition CreateJewelOfChaos()
{
var itemDefinition = this.Context.CreateNew<ItemDefinition>();
itemDefinition.Name = "Jewel of Chaos";
itemDefinition.Number = 15;
itemDefinition.Group = 12;
itemDefinition.DropsFromMonsters = false;
itemDefinition.DropLevel = 12;
itemDefinition.MaximumDropLevel = 66;
itemDefinition.Durability = 1;
itemDefinition.Width = 1;
itemDefinition.Height = 1;
itemDefinition.SetGuid(itemDefinition.Group, itemDefinition.Number);
this.AddItemToJewelItemDrop(itemDefinition);
return itemDefinition;
}
}

View File

@@ -0,0 +1,84 @@
// <copyright file="Orbs.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>
namespace MUnique.OpenMU.Persistence.Initialization.Version075.Items;
using MUnique.OpenMU.DataModel.Configuration;
using MUnique.OpenMU.DataModel.Configuration.Items;
using MUnique.OpenMU.GameLogic.Attributes;
using MUnique.OpenMU.Persistence.Initialization.CharacterClasses;
using MUnique.OpenMU.Persistence.Initialization.Skills;
/// <summary>
/// Initializes orb items which are used to learn skills.
/// </summary>
internal class Orbs : InitializerBase
{
/// <summary>
/// Initializes a new instance of the <see cref="Orbs"/> class.
/// </summary>
/// <param name="context">The persistence context.</param>
/// <param name="gameConfiguration">The game configuration.</param>
public Orbs(IContext context, GameConfiguration gameConfiguration)
: base(context, gameConfiguration)
{
}
/// <summary>
/// Initializes all orbs.
/// </summary>
public override void Initialize()
{
this.CreateOrb(8, SkillNumber.Heal, 1, "Orb of Healing", 8, 0, 100, 0, 0, 800, CharacterClasses.FairyElf);
this.CreateOrb(9, SkillNumber.GreaterDefense, 1, "Orb of Greater Defense", 13, 0, 100, 0, 0, 3000, CharacterClasses.FairyElf);
this.CreateOrb(10, SkillNumber.GreaterDamage, 1, "Orb of Greater Damage", 18, 0, 100, 0, 0, 7000, CharacterClasses.FairyElf);
var summonOrb = this.CreateOrb(11, SkillNumber.SummonGoblin, 1, "Orb of Summoning", 3, 0, 0, 0, 0, 150, CharacterClasses.FairyElf);
summonOrb.MaximumItemLevel = 5;
}
/// <summary>
/// Creates the orb definition.
/// </summary>
/// <param name="number">The number.</param>
/// <param name="skillNumber">The skill number.</param>
/// <param name="height">The height.</param>
/// <param name="name">The name.</param>
/// <param name="dropLevel">The drop level.</param>
/// <param name="levelRequirement">The level requirement.</param>
/// <param name="energyRequirement">The energy requirement.</param>
/// <param name="strengthRequirement">The strength requirement.</param>
/// <param name="agilityRequirement">The agility requirement.</param>
/// <param name="money">The money.</param>
/// <param name="characterClasses">The character classes.</param>
/// <returns>The created definition.</returns>
protected ItemDefinition CreateOrb(byte number, SkillNumber skillNumber, byte height, string name, byte dropLevel, int levelRequirement, int energyRequirement, int strengthRequirement, int agilityRequirement, int money, CharacterClasses characterClasses)
{
var orb = this.Context.CreateNew<ItemDefinition>();
this.GameConfiguration.Items.Add(orb);
orb.Group = 12;
orb.Number = number;
orb.Skill = this.GameConfiguration.Skills.First(skill => skill.Number == (short)skillNumber);
orb.Width = 1;
orb.Height = height;
orb.Name = name;
orb.DropLevel = dropLevel;
orb.DropsFromMonsters = true;
orb.Durability = 1;
this.CreateItemRequirementIfNeeded(orb, Stats.Level, levelRequirement);
this.CreateItemRequirementIfNeeded(orb, Stats.TotalEnergy, energyRequirement);
this.CreateItemRequirementIfNeeded(orb, Stats.TotalStrength, strengthRequirement);
this.CreateItemRequirementIfNeeded(orb, Stats.TotalAgility, agilityRequirement);
orb.Value = money;
var classes = this.GameConfiguration.DetermineCharacterClasses(characterClasses);
foreach (var characterClass in classes)
{
orb.QualifiedCharacters.Add(characterClass);
}
orb.SetGuid(orb.Group, orb.Number);
return orb;
}
}

View File

@@ -0,0 +1,72 @@
// <copyright file="Pets.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>
namespace MUnique.OpenMU.Persistence.Initialization.Version075.Items;
using MUnique.OpenMU.AttributeSystem;
using MUnique.OpenMU.DataModel.Configuration;
using MUnique.OpenMU.DataModel.Configuration.Items;
using MUnique.OpenMU.GameLogic;
using MUnique.OpenMU.GameLogic.Attributes;
using MUnique.OpenMU.Persistence.Initialization.CharacterClasses;
/// <summary>
/// Initializer for pets.
/// </summary>
public class Pets : InitializerBase
{
/// <summary>
/// Initializes a new instance of the <see cref="Pets"/> class.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="gameConfiguration">The game configuration.</param>
public Pets(IContext context, GameConfiguration gameConfiguration)
: base(context, gameConfiguration)
{
}
/// <inheritdoc />
public override void Initialize()
{
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, (Stats.MovementSpeed, MovementSpeedConstants.BasicMountMovementSpeed, AggregateType.Maximum), (Stats.MovementSpeedUnderwater, MovementSpeedConstants.BasicMountMovementSpeed, AggregateType.Maximum));
this.AddItemToJewelItemDrop(uniria);
}
private ItemDefinition CreatePet(byte number, string name, int dropLevelAndLevelRequirement, params (AttributeDefinition, float, AggregateType)[] basePowerUps)
{
var pet = this.Context.CreateNew<ItemDefinition>();
this.GameConfiguration.Items.Add(pet);
pet.Group = 13;
pet.Number = number;
pet.Width = 1;
pet.Height = 1;
pet.Name = name;
pet.DropLevel = (byte)System.Math.Min(255, dropLevelAndLevelRequirement);
pet.DropsFromMonsters = true;
pet.Durability = 255;
pet.ItemSlot = this.GameConfiguration.ItemSlotTypes.First(st => st.ItemSlots.Contains(8));
this.GameConfiguration.DetermineCharacterClasses(true, true, true).ForEach(pet.QualifiedCharacters.Add);
this.CreateItemRequirementIfNeeded(pet, Stats.Level, dropLevelAndLevelRequirement);
foreach (var basePowerUp in basePowerUps)
{
if (basePowerUp.Item1 != null)
{
var powerUpDefinition = this.Context.CreateNew<ItemBasePowerUpDefinition>();
powerUpDefinition.TargetAttribute = basePowerUp.Item1.GetPersistent(this.GameConfiguration);
powerUpDefinition.BaseValue = basePowerUp.Item2;
powerUpDefinition.AggregateType = basePowerUp.Item3;
pet.BasePowerUpAttributes.Add(powerUpDefinition);
}
}
pet.SetGuid(pet.Group, pet.Number);
return pet;
}
}

View File

@@ -0,0 +1,237 @@
// <copyright file="Potions.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>
namespace MUnique.OpenMU.Persistence.Initialization.Version075.Items;
using MUnique.OpenMU.DataModel.Configuration;
using MUnique.OpenMU.DataModel.Configuration.Items;
using MUnique.OpenMU.Persistence.Initialization.Skills;
/// <summary>
/// Class which contains item definitions for jewels.
/// </summary>
public class Potions : InitializerBase
{
/// <summary>
/// Initializes a new instance of the <see cref="Potions"/> class.
/// </summary>
/// <param name="context">The persistence context.</param>
/// <param name="gameConfiguration">The game configuration.</param>
public Potions(IContext context, GameConfiguration gameConfiguration)
: base(context, gameConfiguration)
{
}
/// <summary>
/// Creates the potion item definitions.
/// </summary>
public override void Initialize()
{
this.GameConfiguration.Items.Add(this.CreateApple());
this.GameConfiguration.Items.Add(this.CreateSmallHealingPotion());
this.GameConfiguration.Items.Add(this.CreateMediumHealingPotion());
this.GameConfiguration.Items.Add(this.CreateLargeHealingPotion());
this.GameConfiguration.Items.Add(this.CreateSmallManaPotion());
this.GameConfiguration.Items.Add(this.CreateMediumManaPotion());
this.GameConfiguration.Items.Add(this.CreateLargeManaPotion());
this.GameConfiguration.Items.Add(this.CreateAlcohol());
this.GameConfiguration.Items.Add(this.CreateAntidotePotion());
this.GameConfiguration.Items.Add(this.CreateTownPortalScroll());
}
private ItemDefinition CreateAlcohol()
{
var alcohol = this.Context.CreateNew<ItemDefinition>();
alcohol.Name = "Ale";
alcohol.Number = 9;
alcohol.Group = 14;
alcohol.DropsFromMonsters = true;
alcohol.DropLevel = 15;
alcohol.Durability = 1;
alcohol.Value = 30;
alcohol.Width = 1;
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;
}
/// <summary>
/// Creates the apple definition.
/// </summary>
/// <returns>The created apple definition.</returns>
private ItemDefinition CreateApple()
{
var apple = this.Context.CreateNew<ItemDefinition>();
apple.Name = "Apple";
apple.Number = 0;
apple.Group = 14;
apple.DropsFromMonsters = true;
apple.DropLevel = 1;
apple.Durability = 3;
apple.Value = 5;
apple.Width = 1;
apple.Height = 1;
apple.SetGuid(apple.Group, apple.Number);
return apple;
}
/// <summary>
/// Gets the small healing potion definition.
/// </summary>
/// <returns>The created small healing potion definition.</returns>
private ItemDefinition CreateSmallHealingPotion()
{
var potion = this.Context.CreateNew<ItemDefinition>();
potion.Name = "Small Healing Potion";
potion.Number = 1;
potion.Group = 14;
potion.DropsFromMonsters = true;
potion.DropLevel = 10;
potion.Durability = 3;
potion.Value = 10;
potion.Width = 1;
potion.Height = 1;
potion.SetGuid(potion.Group, potion.Number);
return potion;
}
/// <summary>
/// Gets the medium healing potion definition.
/// </summary>
/// <returns>The created medium healing potion definition.</returns>
private ItemDefinition CreateMediumHealingPotion()
{
var potion = this.Context.CreateNew<ItemDefinition>();
potion.Name = "Medium Healing Potion";
potion.Number = 2;
potion.Group = 14;
potion.DropsFromMonsters = true;
potion.DropLevel = 25;
potion.Durability = 3;
potion.Value = 20;
potion.Width = 1;
potion.Height = 1;
potion.SetGuid(potion.Group, potion.Number);
return potion;
}
/// <summary>
/// Gets the large healing potion definition.
/// </summary>
/// <returns>The created large healing definition.</returns>
private ItemDefinition CreateLargeHealingPotion()
{
var definition = this.Context.CreateNew<ItemDefinition>();
definition.Name = "Large Healing Potion";
definition.Number = 3;
definition.Group = 14;
definition.DropsFromMonsters = true;
definition.DropLevel = 40;
definition.Durability = 3;
definition.Value = 30;
definition.Width = 1;
definition.Height = 1;
definition.SetGuid(definition.Group, definition.Number);
return definition;
}
/// <summary>
/// Gets the small mana potion definition.
/// </summary>
/// <returns>The created small mana potion definition.</returns>
private ItemDefinition CreateSmallManaPotion()
{
var potion = this.Context.CreateNew<ItemDefinition>();
potion.Name = "Small Mana Potion";
potion.Number = 4;
potion.Group = 14;
potion.DropsFromMonsters = true;
potion.DropLevel = 10;
potion.Durability = 3;
potion.Value = 10;
potion.Width = 1;
potion.Height = 1;
potion.SetGuid(potion.Group, potion.Number);
return potion;
}
/// <summary>
/// Gets the medium mana potion definition.
/// </summary>
/// <returns>The created medium mana potion definition.</returns>
private ItemDefinition CreateMediumManaPotion()
{
var potion = this.Context.CreateNew<ItemDefinition>();
potion.Name = "Medium Mana Potion";
potion.Number = 5;
potion.Group = 14;
potion.DropsFromMonsters = true;
potion.DropLevel = 25;
potion.Durability = 3;
potion.Value = 20;
potion.Width = 1;
potion.Height = 1;
potion.SetGuid(potion.Group, potion.Number);
return potion;
}
/// <summary>
/// Gets the large mana potion definition.
/// </summary>
/// <returns>The created large mana definition.</returns>
private ItemDefinition CreateLargeManaPotion()
{
var definition = this.Context.CreateNew<ItemDefinition>();
definition.Name = "Large Mana Potion";
definition.Number = 6;
definition.Group = 14;
definition.DropsFromMonsters = true;
definition.DropLevel = 40;
definition.Durability = 3;
definition.Value = 30;
definition.Width = 1;
definition.Height = 1;
definition.SetGuid(definition.Group, definition.Number);
return definition;
}
/// <summary>
/// Gets the antidote definition.
/// </summary>
/// <returns>The created antidote definition.</returns>
private ItemDefinition CreateAntidotePotion()
{
var definition = this.Context.CreateNew<ItemDefinition>();
definition.Name = "Antidote";
definition.Number = 8;
definition.Group = 14;
definition.DropsFromMonsters = true;
definition.DropLevel = 10;
definition.Durability = 3;
definition.Value = 10;
definition.Width = 1;
definition.Height = 1;
definition.SetGuid(definition.Group, definition.Number);
return definition;
}
private ItemDefinition CreateTownPortalScroll()
{
var definition = this.Context.CreateNew<ItemDefinition>();
definition.Name = "Town Portal Scroll";
definition.Number = 10;
definition.Group = 14;
definition.DropsFromMonsters = true;
definition.DropLevel = 30;
definition.Durability = 1;
definition.Value = 30;
definition.Width = 1;
definition.Height = 2;
definition.SetGuid(definition.Group, definition.Number);
this.AddItemToJewelItemDrop(definition);
return definition;
}
}

View File

@@ -0,0 +1,78 @@
// <copyright file="Scrolls.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>
namespace MUnique.OpenMU.Persistence.Initialization.Version075.Items;
using MUnique.OpenMU.DataModel.Configuration;
using MUnique.OpenMU.DataModel.Configuration.Items;
using MUnique.OpenMU.GameLogic.Attributes;
using MUnique.OpenMU.Persistence.Initialization.CharacterClasses;
/// <summary>
/// Initializer for scroll items which allow a character to learn <see cref="Skill"/>s.
/// </summary>
/// <seealso cref="MUnique.OpenMU.Persistence.Initialization.InitializerBase" />
public class Scrolls : InitializerBase
{
/// <summary>
/// Initializes a new instance of the <see cref="Scrolls"/> class.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="gameConfiguration">The game configuration.</param>
public Scrolls(IContext context, GameConfiguration gameConfiguration)
: base(context, gameConfiguration)
{
}
/// <summary>
/// Initializes the scroll data.
/// </summary>
public override void Initialize()
{
this.CreateScroll(0, 1, "Scroll of Poison", 30, 0, 140, 17000);
this.CreateScroll(1, 2, "Scroll of Meteorite", 21, 0, 104, 11000);
this.CreateScroll(2, 3, "Scroll of Lighting", 13, 0, 72, 3000);
this.CreateScroll(3, 4, "Scroll of Fire Ball", 5, 0, 40, 300);
this.CreateScroll(4, 5, "Scroll of Flame", 35, 0, 160, 21000);
this.CreateScroll(5, 6, "Scroll of Teleport", 17, 0, 88, 5000);
this.CreateScroll(6, 7, "Scroll of Ice", 25, 0, 120, 14000);
this.CreateScroll(7, 8, "Scroll of Twister", 40, 0, 180, 25000);
this.CreateScroll(8, 9, "Scroll of Evil Spirit", 50, 0, 220, 35000);
this.CreateScroll(9, 10, "Scroll of Hellfire", 60, 0, 260, 60000);
this.CreateScroll(10, 11, "Scroll of Power Wave", 9, 0, 56, 1100);
this.CreateScroll(11, 12, "Scroll of Aqua Beam", 74, 0, 345, 100000);
}
/// <summary>
/// Creates the scroll.
/// </summary>
/// <param name="number">The number.</param>
/// <param name="skillNumber">The skill number.</param>
/// <param name="name">The name.</param>
/// <param name="dropLevel">The drop level.</param>
/// <param name="levelRequirement">The level requirement.</param>
/// <param name="energyRequirement">The energy requirement.</param>
/// <param name="money">The money.</param>
protected void CreateScroll(byte number, int skillNumber, string name, byte dropLevel, int levelRequirement, int energyRequirement, int money)
{
var scroll = this.Context.CreateNew<ItemDefinition>();
this.GameConfiguration.Items.Add(scroll);
scroll.Group = 15;
scroll.Number = number;
scroll.Skill = this.GameConfiguration.Skills.First(skill => skill.Number == skillNumber);
scroll.Width = 1;
scroll.Height = 2;
scroll.Name = name;
scroll.DropLevel = dropLevel;
scroll.DropsFromMonsters = true;
scroll.Durability = 1;
scroll.QualifiedCharacters.Add(this.GameConfiguration.CharacterClasses.First(c => c.Number == (int)CharacterClassNumber.DarkWizard));
this.CreateItemRequirementIfNeeded(scroll, Stats.Level, levelRequirement);
this.CreateItemRequirementIfNeeded(scroll, Stats.TotalEnergyRequirementValue, energyRequirement);
scroll.Value = money;
scroll.SetGuid(scroll.Group, scroll.Number);
}
}

View File

@@ -0,0 +1,102 @@
// <copyright file="SlotTypesInitializer.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>
namespace MUnique.OpenMU.Persistence.Initialization.Version075.Items;
using MUnique.OpenMU.DataModel.Configuration;
using MUnique.OpenMU.DataModel.Configuration.Items;
/// <summary>
/// Initializer for <see cref="ItemSlotType"/>s.
/// </summary>
public class SlotTypesInitializer : InitializerBase
{
/// <summary>
/// Initializes a new instance of the <see cref="SlotTypesInitializer"/> class.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="gameConfiguration">The game configuration.</param>
public SlotTypesInitializer(IContext context, GameConfiguration gameConfiguration)
: base(context, gameConfiguration)
{
}
/// <inheritdoc />
public override void Initialize()
{
var leftHand = this.Context.CreateNew<ItemSlotType>();
leftHand.SetGuid(100);
leftHand.Description = "Left Hand";
leftHand.ItemSlots.Add(0);
this.GameConfiguration.ItemSlotTypes.Add(leftHand);
var rightHand = this.Context.CreateNew<ItemSlotType>();
rightHand.SetGuid(101);
rightHand.Description = "Right Hand";
rightHand.ItemSlots.Add(1);
this.GameConfiguration.ItemSlotTypes.Add(rightHand);
var leftOrRightHand = this.Context.CreateNew<ItemSlotType>();
leftOrRightHand.SetGuid(1);
leftOrRightHand.Description = "Left or Right Hand";
leftOrRightHand.ItemSlots.Add(0);
leftOrRightHand.ItemSlots.Add(1);
this.GameConfiguration.ItemSlotTypes.Add(leftOrRightHand);
var helm = this.Context.CreateNew<ItemSlotType>();
helm.SetGuid(2);
helm.Description = "Helm";
helm.ItemSlots.Add(2);
this.GameConfiguration.ItemSlotTypes.Add(helm);
var armor = this.Context.CreateNew<ItemSlotType>();
armor.SetGuid(3);
armor.Description = "Armor";
armor.ItemSlots.Add(3);
this.GameConfiguration.ItemSlotTypes.Add(armor);
var pants = this.Context.CreateNew<ItemSlotType>();
pants.SetGuid(4);
pants.Description = "Pants";
pants.ItemSlots.Add(4);
this.GameConfiguration.ItemSlotTypes.Add(pants);
var gloves = this.Context.CreateNew<ItemSlotType>();
gloves.SetGuid(5);
gloves.Description = "Gloves";
gloves.ItemSlots.Add(5);
this.GameConfiguration.ItemSlotTypes.Add(gloves);
var boots = this.Context.CreateNew<ItemSlotType>();
boots.SetGuid(6);
boots.Description = "Boots";
boots.ItemSlots.Add(6);
this.GameConfiguration.ItemSlotTypes.Add(boots);
var wings = this.Context.CreateNew<ItemSlotType>();
wings.SetGuid(7);
wings.Description = "Wings";
wings.ItemSlots.Add(7);
this.GameConfiguration.ItemSlotTypes.Add(wings);
var pet = this.Context.CreateNew<ItemSlotType>();
pet.SetGuid(8);
pet.Description = "Pet";
pet.ItemSlots.Add(8);
this.GameConfiguration.ItemSlotTypes.Add(pet);
var pendant = this.Context.CreateNew<ItemSlotType>();
pendant.SetGuid(9);
pendant.Description = "Pendant";
pendant.ItemSlots.Add(9);
this.GameConfiguration.ItemSlotTypes.Add(pendant);
var ring = this.Context.CreateNew<ItemSlotType>();
ring.SetGuid(10);
ring.Description = "Ring";
ring.ItemSlots.Add(10);
ring.ItemSlots.Add(11);
this.GameConfiguration.ItemSlotTypes.Add(ring);
}
}

View File

@@ -0,0 +1,337 @@
// <copyright file="Weapons.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>
namespace MUnique.OpenMU.Persistence.Initialization.Version075.Items;
using MUnique.OpenMU.AttributeSystem;
using MUnique.OpenMU.DataModel.Configuration;
using MUnique.OpenMU.DataModel.Configuration.Items;
using MUnique.OpenMU.GameLogic.Attributes;
using MUnique.OpenMU.Persistence.Initialization.CharacterClasses;
using MUnique.OpenMU.Persistence.Initialization.Items;
/// <summary>
/// Helper class to create weapon item definitions.
/// </summary>
internal class Weapons : InitializerBase
{
/// <summary>
/// The durability increase per level.
/// </summary>
protected static readonly float[] DurabilityIncreasePerLevel = { 0, 1, 2, 3, 4, 6, 8, 10, 12, 14, 17, 21 };
/// <summary>
/// The weapon damage increase by level.
/// </summary>
private static readonly float[] DamageIncreaseByLevel = { 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 31, 36 };
private static readonly float[] StaffRiseIncreaseByLevelEven = { 0, 3, 7, 10, 14, 17, 21, 24, 28, 31, 35, 40, 45, 50, 56, 63 }; // Staff with even magic power
private static readonly float[] StaffRiseIncreaseByLevelOdd = { 0, 4, 7, 11, 14, 18, 21, 25, 28, 32, 36, 40, 45, 51, 57, 63 }; // Staff with odd magic power
private ItemLevelBonusTable? _weaponDamageIncreaseTable;
private ItemLevelBonusTable? _staffRiseTableEven;
private ItemLevelBonusTable? _staffRiseTableOdd;
/// <summary>
/// Initializes a new instance of the <see cref="Weapons" /> class.
/// </summary>
/// <param name="context">The persistence context.</param>
/// <param name="gameConfiguration">The game configration.</param>
public Weapons(IContext context, GameConfiguration gameConfiguration)
: base(context, gameConfiguration)
{
}
/// <summary>
/// Gets the luck item option definition.
/// </summary>
protected ItemOptionDefinition Luck
{
get
{
return this.GameConfiguration.ItemOptions.First(iod => iod.PossibleOptions.Any(o => o.OptionType == ItemOptionTypes.Luck));
}
}
/// <summary>
/// Gets the physical damage option definition.
/// </summary>
protected ItemOptionDefinition PhysicalDamageOption
{
get
{
return this.GameConfiguration.ItemOptions.First(iod => iod.PossibleOptions.Any(o => o.OptionType == ItemOptionTypes.Option && o.PowerUpDefinition?.TargetAttribute == Stats.PhysicalBaseDmg));
}
}
/// <summary>
/// Gets the wizardry damage option definition.
/// </summary>
protected ItemOptionDefinition WizardryDamageOption
{
get
{
return this.GameConfiguration.ItemOptions.First(iod => iod.PossibleOptions.Any(o => o.OptionType == ItemOptionTypes.Option && o.PowerUpDefinition?.TargetAttribute == Stats.WizardryBaseDmg));
}
}
/// <summary>
/// Initializes the weapons.
/// </summary>
public override void Initialize()
{
this._weaponDamageIncreaseTable = this.CreateItemBonusTable(DamageIncreaseByLevel, "Damage Increase (Weapons)", "The damage increase by weapon level. It increases by 3 per level, and 1 more after level 10.");
this._staffRiseTableEven = this.CreateItemBonusTable(StaffRiseIncreaseByLevelEven, "Staff Rise (even)", "The staff rise bonus per item level for even magic power staves.");
this._staffRiseTableOdd = this.CreateItemBonusTable(StaffRiseIncreaseByLevelOdd, "Staff Rise (odd)", "The staff rise bonus per item level for odd magic power staves.");
this.CreateWeapon(0, 0, 0, 0, 1, 2, true, "Kris", 6, 6, 11, 50, 20, 0, 0, 40, 40, 0, 0, 1, 1, 1);
this.CreateWeapon(0, 1, 0, 0, 1, 3, true, "Short Sword", 3, 3, 7, 20, 22, 0, 0, 60, 0, 0, 0, 1, 1, 1);
this.CreateWeapon(0, 2, 0, 0, 1, 3, true, "Rapier", 9, 9, 15, 40, 23, 0, 0, 50, 40, 0, 0, 0, 1, 1);
this.CreateWeapon(0, 3, 0, 20, 1, 3, true, "Katache", 16, 16, 26, 35, 27, 0, 0, 80, 40, 0, 0, 0, 1, 0);
this.CreateWeapon(0, 4, 0, 21, 1, 3, true, "Sword of Assassin", 12, 12, 18, 30, 24, 0, 0, 60, 40, 0, 0, 0, 1, 0);
this.CreateWeapon(0, 5, 0, 22, 1, 3, true, "Blade", 36, 36, 47, 30, 39, 0, 0, 80, 50, 0, 0, 1, 1, 1);
this.CreateWeapon(0, 6, 0, 20, 1, 3, true, "Gladius", 20, 20, 30, 20, 30, 0, 0, 110, 0, 0, 0, 0, 1, 1);
this.CreateWeapon(0, 7, 0, 21, 1, 3, true, "Falchion", 24, 24, 34, 25, 34, 0, 0, 120, 0, 0, 0, 0, 1, 0);
this.CreateWeapon(0, 8, 0, 21, 1, 3, true, "Serpent Sword", 30, 30, 40, 20, 36, 0, 0, 130, 0, 0, 0, 0, 1, 0);
this.CreateWeapon(0, 9, 0, 20, 2, 3, true, "Sword of Salamander", 32, 32, 46, 30, 40, 0, 0, 103, 0, 0, 0, 0, 1, 0);
this.CreateWeapon(0, 10, 0, 22, 2, 4, true, "Light Saber", 40, 47, 61, 25, 50, 0, 0, 80, 60, 0, 0, 0, 1, 1);
this.CreateWeapon(0, 11, 0, 20, 2, 3, true, "Legendary Sword", 44, 56, 72, 20, 54, 0, 0, 120, 0, 0, 0, 0, 1, 0);
this.CreateWeapon(0, 12, 0, 19, 2, 3, true, "Heliacal Sword", 56, 73, 98, 25, 66, 0, 0, 140, 0, 0, 0, 0, 1, 0);
this.CreateWeapon(0, 13, 0, 22, 1, 3, true, "Double Blade", 48, 48, 56, 30, 43, 0, 0, 70, 70, 0, 0, 0, 1, 1);
this.CreateWeapon(0, 14, 0, 22, 1, 3, true, "Lighting Sword", 59, 59, 67, 30, 50, 0, 0, 90, 50, 0, 0, 0, 1, 1);
this.CreateWeapon(0, 15, 0, 23, 2, 3, true, "Giant Sword", 52, 60, 85, 20, 60, 0, 0, 140, 0, 0, 0, 0, 1, 0);
this.CreateWeapon(1, 0, 0, 0, 1, 3, true, "Small Axe", 1, 1, 6, 20, 18, 0, 0, 50, 0, 0, 0, 1, 1, 1);
this.CreateWeapon(1, 1, 0, 0, 1, 3, true, "Hand Axe", 4, 4, 9, 30, 20, 0, 0, 70, 0, 0, 0, 1, 1, 1);
this.CreateWeapon(1, 2, 0, 19, 1, 3, true, "Double Axe", 14, 14, 24, 20, 26, 0, 0, 90, 0, 0, 0, 0, 1, 0);
this.CreateWeapon(1, 3, 0, 19, 1, 3, true, "Tomahawk", 18, 18, 28, 30, 28, 0, 0, 100, 0, 0, 0, 0, 1, 0);
this.CreateWeapon(1, 4, 0, 0, 1, 3, true, "Elven Axe", 26, 26, 38, 40, 32, 0, 0, 50, 70, 0, 0, 1, 0, 1);
this.CreateWeapon(1, 5, 0, 19, 2, 3, true, "Battle Axe", 30, 36, 44, 20, 36, 0, 0, 120, 0, 0, 0, 0, 1, 1);
this.CreateWeapon(1, 6, 0, 19, 2, 3, true, "Nikkea Axe", 34, 38, 50, 30, 44, 0, 0, 130, 0, 0, 0, 0, 1, 1);
this.CreateWeapon(1, 7, 0, 19, 2, 3, true, "Larkan Axe", 46, 54, 67, 25, 55, 0, 0, 140, 0, 0, 0, 0, 1, 0);
this.CreateWeapon(1, 8, 0, 19, 2, 3, true, "Crescent Axe", 54, 69, 89, 30, 65, 0, 0, 100, 40, 0, 0, 1, 1, 0);
this.CreateWeapon(2, 0, 0, 0, 1, 3, true, "Mace", 7, 7, 13, 15, 21, 0, 0, 100, 0, 0, 0, 0, 1, 0);
this.CreateWeapon(2, 1, 0, 19, 1, 3, true, "Morning Star", 13, 13, 22, 15, 25, 0, 0, 100, 0, 0, 0, 0, 1, 0);
this.CreateWeapon(2, 2, 0, 0, 1, 3, true, "Flail", 22, 22, 32, 15, 32, 0, 0, 80, 50, 0, 0, 0, 1, 0);
this.CreateWeapon(2, 3, 0, 19, 2, 3, true, "Great Hammer", 38, 45, 56, 15, 50, 0, 0, 150, 0, 0, 0, 0, 1, 0);
this.CreateWeapon(2, 4, 0, 19, 2, 3, true, "Crystal Morning Star", 66, 78, 107, 30, 72, 0, 0, 130, 0, 0, 0, 1, 1, 1);
this.CreateWeapon(2, 5, 0, 23, 2, 4, true, "Crystal Sword", 72, 89, 120, 40, 76, 0, 0, 130, 70, 0, 0, 1, 1, 1);
this.CreateWeapon(2, 6, 0, 23, 2, 4, false, "Chaos Dragon Axe", 75, 102, 130, 35, 80, 0, 0, 140, 50, 0, 0, 0, 1, 0);
this.CreateWeapon(3, 0, 0, 22, 2, 4, true, "Light Spear", 42, 50, 63, 25, 56, 0, 0, 60, 70, 0, 0, 0, 1, 1);
this.CreateWeapon(3, 1, 0, 0, 2, 4, true, "Spear", 23, 30, 41, 30, 42, 0, 0, 70, 50, 0, 0, 0, 1, 1);
this.CreateWeapon(3, 2, 0, 0, 2, 4, true, "Dragon Lance", 15, 21, 33, 30, 34, 0, 0, 70, 50, 0, 0, 0, 1, 1);
this.CreateWeapon(3, 3, 0, 0, 2, 4, true, "Giant Trident", 29, 35, 43, 25, 44, 0, 0, 90, 30, 0, 0, 0, 1, 1);
this.CreateWeapon(3, 4, 0, 20, 2, 4, true, "Serpent Spear", 46, 58, 80, 20, 58, 0, 0, 90, 30, 0, 0, 0, 1, 1);
this.CreateWeapon(3, 5, 0, 0, 2, 4, true, "Double Poleaxe", 13, 19, 31, 30, 38, 0, 0, 70, 50, 0, 0, 0, 1, 1);
this.CreateWeapon(3, 6, 0, 0, 2, 4, true, "Halberd", 19, 25, 35, 30, 40, 0, 0, 70, 50, 0, 0, 0, 1, 1);
this.CreateWeapon(3, 7, 0, 22, 2, 4, true, "Berdysh", 37, 42, 54, 30, 54, 0, 0, 80, 50, 0, 0, 0, 1, 1);
this.CreateWeapon(3, 8, 0, 22, 2, 4, true, "Great Scythe", 54, 71, 92, 25, 68, 0, 0, 90, 50, 0, 0, 0, 1, 1);
this.CreateWeapon(3, 9, 0, 22, 2, 4, true, "Bill of Balrog", 63, 76, 102, 25, 74, 0, 0, 80, 50, 0, 0, 0, 1, 1);
this.CreateWeapon(4, 0, 1, 24, 2, 3, true, "Short Bow", 2, 3, 5, 30, 20, 0, 0, 20, 80, 0, 0, 0, 0, 1);
this.CreateWeapon(4, 1, 1, 24, 2, 3, true, "Bow", 8, 9, 13, 30, 24, 0, 0, 30, 90, 0, 0, 0, 0, 1);
this.CreateWeapon(4, 2, 1, 24, 2, 3, true, "Elven Bow", 16, 17, 24, 30, 28, 0, 0, 30, 90, 0, 0, 0, 0, 1);
this.CreateWeapon(4, 3, 1, 24, 2, 3, true, "Battle Bow", 26, 28, 37, 30, 36, 0, 0, 30, 90, 0, 0, 0, 0, 1);
this.CreateWeapon(4, 4, 1, 24, 2, 4, true, "Tiger Bow", 40, 42, 52, 30, 43, 0, 0, 30, 100, 0, 0, 0, 0, 1);
this.CreateWeapon(4, 5, 1, 24, 2, 4, true, "Silver Bow", 56, 59, 71, 40, 48, 0, 0, 30, 100, 0, 0, 0, 0, 1);
this.CreateWeapon(4, 6, 1, 24, 2, 4, false, "Chaos Nature Bow", 75, 88, 106, 35, 68, 0, 0, 40, 150, 0, 0, 0, 0, 1);
this.CreateAmmunition(4, 7, 1, 1, 2, false, "Bolt", 0, 255, 0, 0, 1);
this.CreateWeapon(4, 8, 0, 24, 2, 2, true, "Crossbow", 4, 5, 8, 40, 22, 0, 0, 20, 90, 0, 0, 0, 0, 1);
this.CreateWeapon(4, 9, 0, 24, 2, 2, true, "Golden Crossbow", 12, 13, 19, 40, 26, 0, 0, 30, 90, 0, 0, 0, 0, 1);
this.CreateWeapon(4, 10, 0, 24, 2, 2, true, "Arquebus", 20, 22, 30, 40, 31, 0, 0, 30, 90, 0, 0, 0, 0, 1);
this.CreateWeapon(4, 11, 0, 24, 2, 3, true, "Light Crossbow", 32, 35, 44, 40, 40, 0, 0, 30, 90, 0, 0, 0, 0, 1);
this.CreateWeapon(4, 12, 0, 24, 2, 3, true, "Serpent Crossbow", 48, 50, 61, 40, 45, 0, 0, 30, 100, 0, 0, 0, 0, 1);
this.CreateWeapon(4, 13, 0, 24, 2, 3, true, "Bluewing Crossbow", 68, 68, 82, 40, 56, 0, 0, 40, 110, 0, 0, 0, 0, 1);
this.CreateWeapon(4, 14, 0, 24, 2, 3, true, "Aquagold Crossbow", 72, 78, 92, 30, 60, 0, 0, 50, 130, 0, 0, 0, 0, 1);
this.CreateAmmunition(4, 15, 0, 1, 2, false, "Arrows", 0, 255, 0, 0, 1);
this.CreateWeapon(5, 0, 0, 0, 1, 3, true, "Skull Staff", 6, 3, 4, 20, 20, 6, 0, 40, 0, 0, 0, 1, 0, 0);
this.CreateWeapon(5, 1, 0, 0, 2, 3, true, "Angelic Staff", 18, 10, 12, 25, 38, 20, 0, 50, 0, 0, 0, 1, 0, 0);
this.CreateWeapon(5, 2, 0, 0, 2, 3, true, "Serpent Staff", 30, 17, 18, 25, 50, 34, 0, 50, 0, 0, 0, 1, 0, 0);
this.CreateWeapon(5, 3, 0, 0, 2, 4, true, "Thunder Staff", 42, 23, 25, 25, 60, 46, 0, 40, 10, 0, 0, 1, 0, 0);
this.CreateWeapon(5, 4, 0, 0, 2, 4, true, "Gorgon Staff", 52, 29, 32, 25, 65, 58, 0, 50, 0, 0, 0, 1, 0, 0);
this.CreateWeapon(5, 5, 0, 0, 1, 4, true, "Legendary Staff", 59, 29, 31, 25, 66, 59, 0, 50, 0, 0, 0, 1, 0, 0);
this.CreateWeapon(5, 6, 0, 0, 1, 4, true, "Staff of Resurrection", 70, 35, 39, 25, 70, 70, 0, 60, 10, 0, 0, 1, 0, 0);
this.CreateWeapon(5, 7, 0, 0, 2, 4, false, "Chaos Lightning Staff", 75, 47, 48, 30, 70, 94, 0, 60, 10, 0, 0, 1, 0, 0);
}
/// <summary>
/// Creates the ammunition.
/// </summary>
/// <param name="group">The group.</param>
/// <param name="number">The number.</param>
/// <param name="slot">The slot.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="dropsFromMonsters">if set to <c>true</c>, the item drops from monsters.</param>
/// <param name="name">The name.</param>
/// <param name="dropLevel">The drop level.</param>
/// <param name="durability">The durability.</param>
/// <param name="wizardClass">The wizard class.</param>
/// <param name="knightClass">The knight class.</param>
/// <param name="elfClass">The elf class.</param>
protected void CreateAmmunition(byte @group, byte number, byte slot, byte width, byte height, bool dropsFromMonsters, string name, byte dropLevel, byte durability, int wizardClass, int knightClass, int elfClass)
{
var item = this.Context.CreateNew<ItemDefinition>();
this.GameConfiguration.Items.Add(item);
item.Name = name;
item.Group = group;
item.Number = number;
item.Height = height;
item.Width = width;
item.DropLevel = dropLevel;
item.MaximumItemLevel = 0;
item.DropsFromMonsters = dropsFromMonsters;
item.SetGuid(item.Group, item.Number);
if (slot == 0 && knightClass > 0 && width == 1)
{
item.ItemSlot = this.GameConfiguration.ItemSlotTypes.First(t => t.ItemSlots.Contains(0) && t.ItemSlots.Contains(1));
}
else
{
item.ItemSlot = this.GameConfiguration.ItemSlotTypes.First(t => t.ItemSlots.Contains(slot));
}
item.Durability = durability;
var qualifiedCharacterClasses = this.GameConfiguration.DetermineCharacterClasses(wizardClass == 1, knightClass == 1, elfClass == 1);
qualifiedCharacterClasses.ToList().ForEach(item.QualifiedCharacters.Add);
item.IsAmmunition = true;
}
/// <summary>
/// Creates the item with the specified parameters.
/// </summary>
/// <param name="group">The group number.</param>
/// <param name="number">The item number inside the group.</param>
/// <param name="slot">The slot.</param>
/// <param name="skillNumber">The skill number.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="dropsFromMonsters">if set to <c>true</c>, the item drops from monsters.</param>
/// <param name="name">The name.</param>
/// <param name="dropLevel">The drop level.</param>
/// <param name="minimumDamage">The minimum damage.</param>
/// <param name="maximumDamage">The maximum damage.</param>
/// <param name="attackSpeed">The attack speed.</param>
/// <param name="durability">The durability.</param>
/// <param name="magicPower">The magic power.</param>
/// <param name="levelRequirement">The level requirement.</param>
/// <param name="strengthRequirement">The strength requirement.</param>
/// <param name="agilityRequirement">The agility requirement.</param>
/// <param name="energyRequirement">The energy requirement.</param>
/// <param name="vitalityRequirement">The vitality requirement.</param>
/// <param name="wizardClass">The wizard class.</param>
/// <param name="knightClass">The knight class.</param>
/// <param name="elfClass">The elf class.</param>
/// <param name="isAmmunition">If set to <c>true</c>, the item is ammunition for a weapon.</param>
protected void CreateWeapon(
byte @group,
byte number,
byte slot,
int skillNumber,
byte width,
byte height,
bool dropsFromMonsters,
string name,
byte dropLevel,
int minimumDamage,
int maximumDamage,
int attackSpeed,
byte durability,
int magicPower,
int levelRequirement,
int strengthRequirement,
int agilityRequirement,
int energyRequirement,
int vitalityRequirement,
int wizardClass,
int knightClass,
int elfClass,
bool isAmmunition = false)
{
var item = this.Context.CreateNew<ItemDefinition>();
this.GameConfiguration.Items.Add(item);
item.Name = name;
item.Group = group;
item.Number = number;
item.Height = height;
item.Width = width;
item.DropLevel = dropLevel;
item.MaximumItemLevel = isAmmunition ? (byte)0 : Constants.MaximumItemLevel;
item.DropsFromMonsters = dropsFromMonsters;
item.SetGuid(item.Group, item.Number);
if (slot == 0 && knightClass > 0 && width == 1)
{
item.ItemSlot = this.GameConfiguration.ItemSlotTypes.First(t => t.ItemSlots.Contains(0) && t.ItemSlots.Contains(1));
}
else
{
item.ItemSlot = this.GameConfiguration.ItemSlotTypes.First(t => t.ItemSlots.Contains(slot));
}
if (skillNumber > 0)
{
var itemSkill = this.GameConfiguration.Skills.First(s => s.Number == skillNumber);
item.Skill = itemSkill;
}
item.Durability = durability;
var qualifiedCharacterClasses = this.GameConfiguration.DetermineCharacterClasses(wizardClass == 1, knightClass == 1, elfClass == 1);
qualifiedCharacterClasses.ToList().ForEach(item.QualifiedCharacters.Add);
var minDamagePowerUp = this.CreateItemBasePowerUpDefinition(Stats.MinimumPhysBaseDmgByWeapon, minimumDamage, AggregateType.AddRaw);
minDamagePowerUp.BonusPerLevelTable = this._weaponDamageIncreaseTable;
item.BasePowerUpAttributes.Add(minDamagePowerUp);
var maxDamagePowerUp = this.CreateItemBasePowerUpDefinition(Stats.MaximumPhysBaseDmgByWeapon, maximumDamage, AggregateType.AddRaw);
maxDamagePowerUp.BonusPerLevelTable = this._weaponDamageIncreaseTable;
item.BasePowerUpAttributes.Add(maxDamagePowerUp);
var speedPowerUp = this.CreateItemBasePowerUpDefinition(Stats.AttackSpeedByWeapon, attackSpeed, AggregateType.AddRaw);
item.BasePowerUpAttributes.Add(speedPowerUp);
this.CreateItemRequirementIfNeeded(item, Stats.Level, levelRequirement);
this.CreateItemRequirementIfNeeded(item, Stats.TotalStrengthRequirementValue, strengthRequirement);
this.CreateItemRequirementIfNeeded(item, Stats.TotalAgilityRequirementValue, agilityRequirement);
this.CreateItemRequirementIfNeeded(item, Stats.TotalEnergyRequirementValue, energyRequirement);
this.CreateItemRequirementIfNeeded(item, Stats.TotalVitalityRequirementValue, vitalityRequirement);
item.PossibleItemOptions.Add(this.Luck);
if (magicPower == 0)
{
item.PossibleItemOptions.Add(this.PhysicalDamageOption);
}
else
{
item.PossibleItemOptions.Add(this.WizardryDamageOption);
var staffRisePowerUp = this.CreateItemBasePowerUpDefinition(Stats.StaffRise, magicPower / 2.0f, AggregateType.AddRaw);
staffRisePowerUp.BonusPerLevelTable = magicPower % 2 == 0 ? this._staffRiseTableEven : this._staffRiseTableOdd;
item.BasePowerUpAttributes.Add(staffRisePowerUp);
}
item.BasePowerUpAttributes.Add(this.CreateItemBasePowerUpDefinition(Stats.EquippedWeaponCount, 1, AggregateType.AddRaw));
if (group < (int)ItemGroups.Spears && width == 1)
{
item.BasePowerUpAttributes.Add(this.CreateItemBasePowerUpDefinition(Stats.DoubleWieldWeaponCount, 1, AggregateType.AddRaw));
}
if (group == (int)ItemGroups.Bows)
{
item.BasePowerUpAttributes.Add(this.CreateItemBasePowerUpDefinition(Stats.AmmunitionConsumptionRate, 1, AggregateType.AddRaw));
}
if (group < (int)ItemGroups.Bows && width == 2)
{
item.BasePowerUpAttributes.Add(this.CreateItemBasePowerUpDefinition(Stats.IsTwoHandedWeaponEquipped, 1, AggregateType.AddRaw));
}
}
}

View File

@@ -0,0 +1,126 @@
// <copyright file="Wings.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>
namespace MUnique.OpenMU.Persistence.Initialization.Version075.Items;
using MUnique.OpenMU.AttributeSystem;
using MUnique.OpenMU.DataModel.Configuration;
using MUnique.OpenMU.DataModel.Configuration.Items;
using MUnique.OpenMU.GameLogic.Attributes;
using MUnique.OpenMU.Persistence.Initialization.CharacterClasses;
/// <summary>
/// Initializer for wing items.
/// </summary>
public class Wings : WingsInitializerBase
{
private ItemLevelBonusTable? _absorbByLevelTable;
private ItemLevelBonusTable? _defenseBonusByLevelTable;
private ItemLevelBonusTable? _damageIncreaseByLevelTable;
/// <summary>
/// Initializes a new instance of the <see cref="Wings"/> class.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="gameConfiguration">The game configuration.</param>
public Wings(IContext context, GameConfiguration gameConfiguration)
: base(context, gameConfiguration)
{
}
/// <inheritdoc />
protected override int MaximumItemLevel => Constants.MaximumItemLevel;
/// <summary>
/// Initializes all wings.
/// </summary>
public override void Initialize()
{
this._absorbByLevelTable = this.CreateAbsorbBonusPerLevel();
this._defenseBonusByLevelTable = this.CreateBonusDefensePerLevel();
this._damageIncreaseByLevelTable = this.CreateDamageIncreaseBonusPerLevelFirstAndThirdWings();
this.CreateWing(0, 3, 2, "Wings of Elf", 100, 10, 200, 180, 0, 0, 1, this.BuildOptions((0, OptionType.HealthRecover)), 12, 12);
this.CreateWing(1, 5, 3, "Wings of Heaven", 100, 10, 200, 180, 1, 0, 0, this.BuildOptions((0, OptionType.WizDamage)), 12, 12);
this.CreateWing(2, 5, 2, "Wings of Satan", 100, 20, 200, 180, 0, 1, 0, this.BuildOptions((0, OptionType.PhysDamage)), 12, 12);
}
private ItemDefinition CreateWing(byte number, byte width, byte height, string name, byte dropLevel, int defense, byte durability, int levelRequirement, int darkWizardClassLevel, int darkKnightClassLevel, int elfClassLevel, IEnumerable<IncreasableItemOption> possibleOptions, int damageIncreaseInitial, int damageAbsorbInitial)
{
var wing = this.CreateWing(number, width, height, name, dropLevel, defense, durability, levelRequirement, darkWizardClassLevel, darkKnightClassLevel, elfClassLevel);
if (damageAbsorbInitial > 0)
{
var powerUp = this.CreateItemBasePowerUpDefinition(Stats.DamageReceiveDecrement, 1f - (damageAbsorbInitial / 100f), AggregateType.Multiplicate);
powerUp.BonusPerLevelTable = this._absorbByLevelTable;
wing.BasePowerUpAttributes.Add(powerUp);
}
if (damageIncreaseInitial > 0)
{
var powerUp = this.CreateItemBasePowerUpDefinition(Stats.AttackDamageIncrease, 1f + (damageIncreaseInitial / 100f), AggregateType.Multiplicate);
powerUp.BonusPerLevelTable = this._damageIncreaseByLevelTable;
wing.BasePowerUpAttributes.Add(powerUp);
}
var optionDefinition = this.Context.CreateNew<ItemOptionDefinition>();
this.GameConfiguration.ItemOptions.Add(optionDefinition);
optionDefinition.Name = $"{name} Options";
optionDefinition.AddChance = 0.25f;
optionDefinition.AddsRandomly = true;
optionDefinition.MaximumOptionsPerItem = 1;
wing.PossibleItemOptions.Add(optionDefinition);
foreach (var option in possibleOptions)
{
optionDefinition.PossibleOptions.Add(option);
}
wing.PossibleItemOptions.Add(this.GameConfiguration.ItemOptions.First(iod => iod.PossibleOptions.Any(o => o?.OptionType == ItemOptionTypes.Luck)));
return wing;
}
private ItemDefinition CreateWing(byte number, byte width, byte height, string name, byte dropLevel, int defense, byte durability, int levelRequirement, int darkWizardClassLevel, int darkKnightClassLevel, int elfClassLevel)
{
var wing = this.Context.CreateNew<ItemDefinition>();
this.GameConfiguration.Items.Add(wing);
wing.Group = 12;
wing.Number = number;
wing.Width = width;
wing.Height = height;
wing.Name = name;
wing.DropLevel = dropLevel;
wing.MaximumItemLevel = Constants.MaximumItemLevel;
wing.DropsFromMonsters = false;
wing.Durability = durability;
wing.ItemSlot = this.GameConfiguration.ItemSlotTypes.First(st => st.ItemSlots.Contains(7));
wing.SetGuid(wing.Group, wing.Number);
//// TODO: each level increases the requirement by 5 Levels
this.CreateItemRequirementIfNeeded(wing, Stats.Level, levelRequirement);
if (defense > 0)
{
var powerUp = this.CreateItemBasePowerUpDefinition(Stats.DefenseBase, defense, AggregateType.AddRaw);
wing.BasePowerUpAttributes.Add(powerUp);
powerUp.BonusPerLevelTable = this._defenseBonusByLevelTable;
}
var classes = this.GameConfiguration.DetermineCharacterClasses(darkWizardClassLevel == 1, darkKnightClassLevel == 1, elfClassLevel == 1);
foreach (var characterClass in classes)
{
wing.QualifiedCharacters.Add(characterClass);
}
// add CanFly Attribute to all wings
var canFlyPowerUp = this.Context.CreateNew<ItemBasePowerUpDefinition>();
canFlyPowerUp.TargetAttribute = Stats.CanFly.GetPersistent(this.GameConfiguration);
canFlyPowerUp.BaseValue = 1;
wing.BasePowerUpAttributes.Add(canFlyPowerUp);
wing.BasePowerUpAttributes.Add(this.CreateItemBasePowerUpDefinition(Stats.MovementSpeed, MovementSpeedConstants.DefaultWingMovementSpeed, AggregateType.Maximum));
wing.BasePowerUpAttributes.Add(this.CreateItemBasePowerUpDefinition(Stats.MovementSpeedUnderwater, MovementSpeedConstants.DefaultWingMovementSpeed, AggregateType.Maximum));
return wing;
}
}