chore: required properties

This commit is contained in:
Timothy Schenk 2023-11-25 14:23:16 +01:00
parent ec155ecab1
commit dc9f96fb19
6 changed files with 26 additions and 20 deletions

View file

@ -6,12 +6,12 @@ namespace Wonderking.Game.Mapping;
public class CharacterStatsMappingConfiguration public class CharacterStatsMappingConfiguration
{ {
[JsonPropertyName("default")] public DefaultCharacterMapping DefaultCharacterMapping { get; set; } [JsonPropertyName("default")] public required DefaultCharacterMapping DefaultCharacterMapping { get; set; }
[JsonPropertyName("1")] public JobSpecificMapping Swordsman { get; set; } [JsonPropertyName("1")] public required JobSpecificMapping Swordsman { get; set; }
[JsonPropertyName("2")] public JobSpecificMapping Mage { get; set; } [JsonPropertyName("2")] public required JobSpecificMapping Mage { get; set; }
[JsonPropertyName("3")] public JobSpecificMapping Thief { get; set; } [JsonPropertyName("3")] public required JobSpecificMapping Thief { get; set; }
[JsonPropertyName("4")] public JobSpecificMapping Scout { get; set; } [JsonPropertyName("4")] public required JobSpecificMapping Scout { get; set; }
} }

View file

@ -6,5 +6,5 @@ namespace Wonderking.Game.Mapping;
public class DefaultCharacterMapping public class DefaultCharacterMapping
{ {
[JsonPropertyName("items")] public List<Item> Items { get; set; } [JsonPropertyName("items")] public required ICollection<Item> Items { get; set; }
} }

View file

@ -1,15 +1,17 @@
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License. // Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using JetBrains.Annotations;
using Wonderking.Packets.Outgoing.Data; using Wonderking.Packets.Outgoing.Data;
namespace Wonderking.Game.Mapping; namespace Wonderking.Game.Mapping;
[UsedImplicitly]
public class JobSpecificMapping public class JobSpecificMapping
{ {
[JsonPropertyName("items")] public ICollection<Item> Items { get; set; } [JsonPropertyName("items")] public required ICollection<Item> Items { get; set; }
[JsonPropertyName("baseStats")] public BaseStats BaseStats { get; set; } [JsonPropertyName("baseStats")] public required BaseStats BaseStats { get; set; }
[JsonPropertyName("dynamicStats")] public DynamicStats DynamicStats { get; set; } [JsonPropertyName("dynamicStats")] public required DynamicStats DynamicStats { get; set; }
} }

View file

@ -14,7 +14,9 @@ public class ItemReader(string path) : DataReader<ItemObject>(path)
return (uint)((DatFileContent.Length - 9) / SizeOfEntry); return (uint)((DatFileContent.Length - 9) / SizeOfEntry);
} }
#pragma warning disable MA0051
public override ItemObject GetEntry(uint entryId) public override ItemObject GetEntry(uint entryId)
#pragma warning restore MA0051
{ {
var item = new ItemObject(); var item = new ItemObject();
var arraySegment = new ArraySegment<byte>(DatFileContent, var arraySegment = new ArraySegment<byte>(DatFileContent,

View file

@ -8,17 +8,17 @@ namespace Wonderking.Packets.Incoming;
[PacketId(OperationCode.CharacterCreation)] [PacketId(OperationCode.CharacterCreation)]
public class CharacterCreationPacket : IPacket public class CharacterCreationPacket : IPacket
{ {
public byte Slot { get; set; } public required byte Slot { get; set; }
public byte Unknown { get; set; } public required byte Unknown { get; set; }
public ushort Id { get; set; } public required ushort Id { get; set; }
public string Name { get; set; } public required string Name { get; set; }
public byte FirstJob { get; set; } public required byte FirstJob { get; set; }
public Gender Gender { get; set; } public required Gender Gender { get; set; }
public byte Hair { get; set; } public required byte Hair { get; set; }
public byte Eyes { get; set; } public required byte Eyes { get; set; }
public byte Shirt { get; set; } public required byte Shirt { get; set; }
public byte Pants { get; set; } public required byte Pants { get; set; }
public void Deserialize(byte[] data) public void Deserialize(byte[] data)
{ {

View file

@ -1,5 +1,7 @@
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License. // Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
using NotSupportedException = System.NotSupportedException;
namespace Wonderking.Packets.Outgoing; namespace Wonderking.Packets.Outgoing;
[PacketId(OperationCode.CharacterDeletionResponse)] [PacketId(OperationCode.CharacterDeletionResponse)]
@ -9,7 +11,7 @@ public class CharacterDeleteResponsePacket : IPacket
public void Deserialize(byte[] data) public void Deserialize(byte[] data)
{ {
throw new NotImplementedException(); throw new NotSupportedException();
} }
public byte[] Serialize() public byte[] Serialize()