Skip to content

Commit

Permalink
Added the configuration for duels
Browse files Browse the repository at this point in the history
  • Loading branch information
sven-n committed Jul 7, 2024
1 parent 9816233 commit 93f2621
Show file tree
Hide file tree
Showing 15 changed files with 5,921 additions and 1 deletion.
40 changes: 40 additions & 0 deletions src/DataModel/Configuration/DuelArea.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// <copyright file="DuelArea.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>

namespace MUnique.OpenMU.DataModel.Configuration;

using MUnique.OpenMU.Annotations;

/// <summary>
/// Defines an area where a duel can take place.
/// </summary>
[Cloneable]
public partial class DuelArea
{
/// <summary>
/// Gets or sets the index of the area.
/// </summary>
public short Index { get; set; }

/// <summary>
/// Gets or sets the first player gate to which the player is teleported when he enters the duel.
/// </summary>
public virtual ExitGate? FirstPlayerGate { get; set; }

/// <summary>
/// Gets or sets the second player gate to which the player is teleported when he enters the duel.
/// </summary>
public virtual ExitGate? SecondPlayerGate { get; set; }

/// <summary>
/// Gets or sets the gate to which a spectator is teleported when he enters the duel.
/// </summary>
public virtual ExitGate? SpectatorsGate { get; set; }

/// <inheritdoc />
public override string ToString()
{
return $"{this.Index} - {this.FirstPlayerGate} - {this.SecondPlayerGate}";
}
}
52 changes: 52 additions & 0 deletions src/DataModel/Configuration/DuelConfiguration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// <copyright file="DuelConfiguration.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>

namespace MUnique.OpenMU.DataModel.Configuration;

using MUnique.OpenMU.Annotations;

/// <summary>
/// Configuration for the duel feature.
/// </summary>
[Cloneable]
public partial class DuelConfiguration
{
/// <summary>
/// Gets or sets the maximum score at which the duel will end with a winner.
/// </summary>
public int MaximumScore {get; set; }

/// <summary>
/// Gets or sets the entrance fee for a duel.
/// </summary>
public int EntranceFee { get; set; }

/// <summary>
/// Gets or sets the minimum character level to start a duel.
/// </summary>
public int MinimumCharacterLevel { get; set; }

/// <summary>
/// Gets or sets the maximum spectators per duel room.
/// </summary>
public int MaximumSpectatorsPerDuelRoom { get; set; }

/// <summary>
/// Gets or sets the exit gate to which all players are ported after the duel has ended.
/// If not set, players will be ported to the safezone.
/// </summary>
public virtual ExitGate? Exit { get; set; }

/// <summary>
/// Gets or sets the available duel areas.
/// </summary>
[MemberOfAggregate]
public virtual ICollection<DuelArea> DuelAreas { get; protected set; } = null!;

/// <inheritdoc />
public override string ToString()
{
return $"Duel Configuration {this.DuelAreas.Count} Arenas, Exit: {this.Exit}";
}
}
6 changes: 6 additions & 0 deletions src/DataModel/Configuration/GameConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ public partial class GameConfiguration
/// </summary>
public double HitsPerOneItemDurability { get; set; }

/// <summary>
/// Gets or sets the duel configuration.
/// </summary>
[MemberOfAggregate]
public virtual DuelConfiguration? DuelConfiguration { get; set; }

/// <summary>
/// Gets or sets the possible jewel mixes.
/// </summary>
Expand Down
117 changes: 117 additions & 0 deletions src/Persistence/BasicModel/DuelArea.Generated.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
// <copyright file="DuelArea.Generated.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>

//------------------------------------------------------------------------------
// <auto-generated>
// This source code was auto-generated by a roslyn code generator.
// </auto-generated>
//------------------------------------------------------------------------------

// ReSharper disable All

namespace MUnique.OpenMU.Persistence.BasicModel;

using MUnique.OpenMU.Persistence.Json;

/// <summary>
/// A plain implementation of <see cref="DuelArea"/>.
/// </summary>
public partial class DuelArea : MUnique.OpenMU.DataModel.Configuration.DuelArea, IIdentifiable, IConvertibleTo<DuelArea>
{

/// <summary>
/// Gets or sets the identifier of this instance.
/// </summary>
public Guid Id { get; set; }

/// <summary>
/// Gets the raw object of <see cref="FirstPlayerGate" />.
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("firstPlayerGate")]
public ExitGate RawFirstPlayerGate
{
get => base.FirstPlayerGate as ExitGate;
set => base.FirstPlayerGate = value;
}

/// <inheritdoc/>
[System.Text.Json.Serialization.JsonIgnore]
public override MUnique.OpenMU.DataModel.Configuration.ExitGate FirstPlayerGate
{
get => base.FirstPlayerGate;
set => base.FirstPlayerGate = value;
}

/// <summary>
/// Gets the raw object of <see cref="SecondPlayerGate" />.
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("secondPlayerGate")]
public ExitGate RawSecondPlayerGate
{
get => base.SecondPlayerGate as ExitGate;
set => base.SecondPlayerGate = value;
}

/// <inheritdoc/>
[System.Text.Json.Serialization.JsonIgnore]
public override MUnique.OpenMU.DataModel.Configuration.ExitGate SecondPlayerGate
{
get => base.SecondPlayerGate;
set => base.SecondPlayerGate = value;
}

/// <summary>
/// Gets the raw object of <see cref="SpectatorsGate" />.
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("spectatorsGate")]
public ExitGate RawSpectatorsGate
{
get => base.SpectatorsGate as ExitGate;
set => base.SpectatorsGate = value;
}

/// <inheritdoc/>
[System.Text.Json.Serialization.JsonIgnore]
public override MUnique.OpenMU.DataModel.Configuration.ExitGate SpectatorsGate
{
get => base.SpectatorsGate;
set => base.SpectatorsGate = value;
}

/// <inheritdoc />
public override MUnique.OpenMU.DataModel.Configuration.DuelArea Clone(MUnique.OpenMU.DataModel.Configuration.GameConfiguration gameConfiguration)
{
var clone = new DuelArea();
clone.AssignValuesOf(this, gameConfiguration);
return clone;
}

/// <inheritdoc />
public override void AssignValuesOf(MUnique.OpenMU.DataModel.Configuration.DuelArea other, MUnique.OpenMU.DataModel.Configuration.GameConfiguration gameConfiguration)
{
base.AssignValuesOf(other, gameConfiguration);
this.Id = other.GetId();
}

/// <inheritdoc/>
public override bool Equals(object obj)
{
var baseObject = obj as IIdentifiable;
if (baseObject != null)
{
return baseObject.Id == this.Id;
}

return base.Equals(obj);
}

/// <inheritdoc/>
public override int GetHashCode()
{
return this.Id.GetHashCode();
}

/// <inheritdoc/>
public DuelArea Convert() => this;
}
102 changes: 102 additions & 0 deletions src/Persistence/BasicModel/DuelConfiguration.Generated.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// <copyright file="DuelConfiguration.Generated.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>

//------------------------------------------------------------------------------
// <auto-generated>
// This source code was auto-generated by a roslyn code generator.
// </auto-generated>
//------------------------------------------------------------------------------

// ReSharper disable All

namespace MUnique.OpenMU.Persistence.BasicModel;

using MUnique.OpenMU.Persistence.Json;

/// <summary>
/// A plain implementation of <see cref="DuelConfiguration"/>.
/// </summary>
public partial class DuelConfiguration : MUnique.OpenMU.DataModel.Configuration.DuelConfiguration, IIdentifiable, IConvertibleTo<DuelConfiguration>
{

/// <summary>
/// Gets or sets the identifier of this instance.
/// </summary>
public Guid Id { get; set; }

/// <summary>
/// Gets the raw collection of <see cref="DuelAreas" />.
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("duelAreas")]
public ICollection<DuelArea> RawDuelAreas { get; } = new List<DuelArea>();

/// <inheritdoc/>
[System.Text.Json.Serialization.JsonIgnore]
public override ICollection<MUnique.OpenMU.DataModel.Configuration.DuelArea> DuelAreas
{
get => base.DuelAreas ??= new CollectionAdapter<MUnique.OpenMU.DataModel.Configuration.DuelArea, DuelArea>(this.RawDuelAreas);
protected set
{
this.DuelAreas.Clear();
foreach (var item in value)
{
this.DuelAreas.Add(item);
}
}
}

/// <summary>
/// Gets the raw object of <see cref="Exit" />.
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("exit")]
public ExitGate RawExit
{
get => base.Exit as ExitGate;
set => base.Exit = value;
}

/// <inheritdoc/>
[System.Text.Json.Serialization.JsonIgnore]
public override MUnique.OpenMU.DataModel.Configuration.ExitGate Exit
{
get => base.Exit;
set => base.Exit = value;
}

/// <inheritdoc />
public override MUnique.OpenMU.DataModel.Configuration.DuelConfiguration Clone(MUnique.OpenMU.DataModel.Configuration.GameConfiguration gameConfiguration)
{
var clone = new DuelConfiguration();
clone.AssignValuesOf(this, gameConfiguration);
return clone;
}

/// <inheritdoc />
public override void AssignValuesOf(MUnique.OpenMU.DataModel.Configuration.DuelConfiguration other, MUnique.OpenMU.DataModel.Configuration.GameConfiguration gameConfiguration)
{
base.AssignValuesOf(other, gameConfiguration);
this.Id = other.GetId();
}

/// <inheritdoc/>
public override bool Equals(object obj)
{
var baseObject = obj as IIdentifiable;
if (baseObject != null)
{
return baseObject.Id == this.Id;
}

return base.Equals(obj);
}

/// <inheritdoc/>
public override int GetHashCode()
{
return this.Id.GetHashCode();
}

/// <inheritdoc/>
public DuelConfiguration Convert() => this;
}
18 changes: 18 additions & 0 deletions src/Persistence/BasicModel/GameConfiguration.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,24 @@ protected set
}
}

/// <summary>
/// Gets the raw object of <see cref="DuelConfiguration" />.
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("duelConfiguration")]
public DuelConfiguration RawDuelConfiguration
{
get => base.DuelConfiguration as DuelConfiguration;
set => base.DuelConfiguration = value;
}

/// <inheritdoc/>
[System.Text.Json.Serialization.JsonIgnore]
public override MUnique.OpenMU.DataModel.Configuration.DuelConfiguration DuelConfiguration
{
get => base.DuelConfiguration;
set => base.DuelConfiguration = value;
}

/// <inheritdoc />
public override MUnique.OpenMU.DataModel.Configuration.GameConfiguration Clone(MUnique.OpenMU.DataModel.Configuration.GameConfiguration gameConfiguration)
{
Expand Down
Loading

0 comments on commit 93f2621

Please sign in to comment.