baseline: OpenMU upstream b5a0961 (fresh source)
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
// <copyright file="UnlockCharacterAtLevelBase.cs" company="MUnique">
|
||||
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
|
||||
// </copyright>
|
||||
|
||||
namespace MUnique.OpenMU.GameLogic.PlugIns.UnlockCharacterClass;
|
||||
|
||||
/// <summary>
|
||||
/// Unlocks the a character class as soon as the first character of an account reaches a certain level.
|
||||
/// </summary>
|
||||
public abstract class UnlockCharacterAtLevelBase : ICharacterLevelUpPlugIn
|
||||
{
|
||||
private readonly byte _classNumber;
|
||||
private readonly int _minimumLevel;
|
||||
private readonly string _warningMessage;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UnlockCharacterAtLevelBase"/> class.
|
||||
/// </summary>
|
||||
/// <param name="classNumber">The class number.</param>
|
||||
/// <param name="minimumLevel">The minimum level.</param>
|
||||
/// <param name="className">Name of the class.</param>
|
||||
protected UnlockCharacterAtLevelBase(byte classNumber, int minimumLevel, string className)
|
||||
{
|
||||
this._classNumber = classNumber;
|
||||
this._minimumLevel = minimumLevel;
|
||||
this._warningMessage = $"Couldn't unlock {className}, because it couldn't be found in the configuration.";
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void CharacterLeveledUp(Player player)
|
||||
{
|
||||
if (player.Level >= this._minimumLevel
|
||||
&& player.Account is { } account
|
||||
&& account.UnlockedCharacterClasses.All(c => c.Number != this._classNumber))
|
||||
{
|
||||
var unlockedClass = player.GameContext.Configuration.CharacterClasses.FirstOrDefault(c => c.Number == this._classNumber);
|
||||
if (unlockedClass is null)
|
||||
{
|
||||
player.Logger.LogWarning(this._warningMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
account.UnlockedCharacterClasses.Add(unlockedClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// <copyright file="UnlockDarkLordAtLevel250.cs" company="MUnique">
|
||||
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
|
||||
// </copyright>
|
||||
|
||||
namespace MUnique.OpenMU.GameLogic.PlugIns.UnlockCharacterClass;
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
using MUnique.OpenMU.PlugIns;
|
||||
|
||||
/// <summary>
|
||||
/// Unlocks the Dark Lord character class as soon as the first character of an account reaches level 250.
|
||||
/// </summary>
|
||||
[PlugIn]
|
||||
[Display(Name = nameof(PlugInResources.UnlockDarkLordAtLevel250_Name), Description = nameof(PlugInResources.UnlockDarkLordAtLevel250_Description), ResourceType = typeof(PlugInResources))]
|
||||
[Guid("2DFFD75A-765D-4FA7-93DD-9890CA0F04F0")]
|
||||
public class UnlockDarkLordAtLevel250 : UnlockCharacterAtLevelBase
|
||||
{
|
||||
private const byte DarkLordNumber = 16;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UnlockDarkLordAtLevel250"/> class.
|
||||
/// </summary>
|
||||
public UnlockDarkLordAtLevel250()
|
||||
: base(DarkLordNumber, 250, "Dark Lord")
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// <copyright file="UnlockMagicGladiatorAtLevel220.cs" company="MUnique">
|
||||
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
|
||||
// </copyright>
|
||||
|
||||
namespace MUnique.OpenMU.GameLogic.PlugIns.UnlockCharacterClass;
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
using MUnique.OpenMU.PlugIns;
|
||||
|
||||
/// <summary>
|
||||
/// Unlocks the Magic Gladiator character class as soon as the first character of an account reaches level 220.
|
||||
/// </summary>
|
||||
[PlugIn]
|
||||
[Display(Name = nameof(PlugInResources.UnlockMagicGladiatorAtLevel220_Name), Description = nameof(PlugInResources.UnlockMagicGladiatorAtLevel220_Description), ResourceType = typeof(PlugInResources))]
|
||||
[Guid("8C765FF3-B574-41C6-9151-ABC10D3FD959")]
|
||||
public class UnlockMagicGladiatorAtLevel220 : UnlockCharacterAtLevelBase
|
||||
{
|
||||
private const byte MagicGladiatorNumber = 12;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UnlockMagicGladiatorAtLevel220"/> class.
|
||||
/// </summary>
|
||||
public UnlockMagicGladiatorAtLevel220()
|
||||
: base(MagicGladiatorNumber, 220, "Magic Gladiator")
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// <copyright file="UnlockRageFighterAtLevel150.cs" company="MUnique">
|
||||
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
|
||||
// </copyright>
|
||||
|
||||
namespace MUnique.OpenMU.GameLogic.PlugIns.UnlockCharacterClass;
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
using MUnique.OpenMU.PlugIns;
|
||||
|
||||
/// <summary>
|
||||
/// Unlocks the Rage Fighter character class as soon as the first character of an account reaches level 150.
|
||||
/// TODO: Add configuration for the level and change name; remove the "AtLevel150" suffix.
|
||||
/// </summary>
|
||||
[PlugIn]
|
||||
[Display(Name = nameof(PlugInResources.UnlockRageFighterAtLevel150_Name), Description = nameof(PlugInResources.UnlockRageFighterAtLevel150_Description), ResourceType = typeof(PlugInResources))]
|
||||
[Guid("2DFFD752-7652-4FA2-93D2-9890CA0F04F2")]
|
||||
public class UnlockRageFighterAtLevel150 : UnlockCharacterAtLevelBase
|
||||
{
|
||||
private const byte RageFighterNumber = 24;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UnlockRageFighterAtLevel150"/> class.
|
||||
/// </summary>
|
||||
public UnlockRageFighterAtLevel150()
|
||||
: base(RageFighterNumber, 150, "Rage Fighter")
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// <copyright file="UnlockSummonerAtLevel1.cs" company="MUnique">
|
||||
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
|
||||
// </copyright>
|
||||
|
||||
namespace MUnique.OpenMU.GameLogic.PlugIns.UnlockCharacterClass;
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
using MUnique.OpenMU.PlugIns;
|
||||
|
||||
/// <summary>
|
||||
/// Unlocks the Summoner character class as soon as the first character of an account reaches level 1.
|
||||
/// TODO: Add configuration for the level and change name; remove the "AtLevel1" suffix.
|
||||
/// </summary>
|
||||
[PlugIn]
|
||||
[Display(Name = nameof(PlugInResources.UnlockSummonerAtLevel1_Name), Description = nameof(PlugInResources.UnlockSummonerAtLevel1_Description), ResourceType = typeof(PlugInResources))]
|
||||
[Guid("2DFFD751-7651-4FA1-93D1-9890CA0F04F1")]
|
||||
public class UnlockSummonerAtLevel1 : UnlockCharacterAtLevelBase
|
||||
{
|
||||
private const byte SummonerNumber = 20;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UnlockSummonerAtLevel1"/> class.
|
||||
/// </summary>
|
||||
public UnlockSummonerAtLevel1()
|
||||
: base(SummonerNumber, 1, "Summoner")
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user