Skip to content

Commit bf0e876

Browse files
committed
fix: game object types should be included in swagger with a functioning type hierarchy
1 parent 026afd9 commit bf0e876

File tree

113 files changed

+650
-358
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+650
-358
lines changed

Framework/Intersect.Framework.Core/Config/DatabaseOptions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ public partial class DatabaseOptions
2020

2121
public ushort Port { get; set; } = 3306;
2222

23-
public string Database { get; set; } = "";
23+
public string Database { get; set; } = string.Empty;
2424

25-
public string Username { get; set; } = "";
25+
public string Username { get; set; } = string.Empty;
2626

27-
public string Password { get; set; } = "";
27+
public string Password { get; set; } = string.Empty;
2828

2929
[JsonConverter(typeof(StringEnumConverter))]
3030
[JsonProperty(

Framework/Intersect.Framework.Core/Config/Options.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Intersect;
88
public partial class Options
99
{
1010
//Caching Json
11-
private static string optionsCompressed = "";
11+
private static string optionsCompressed = string.Empty;
1212

1313
[JsonProperty("AdminOnly", Order = -3)]
1414
protected bool _adminOnly = false;

Framework/Intersect.Framework.Core/Config/SmtpSettings.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
public partial class SmtpSettings
44
{
5-
public string FromAddress { get; set; } = "";
5+
public string FromAddress { get; set; } = string.Empty;
66

7-
public string FromName { get; set; } = "";
7+
public string FromName { get; set; } = string.Empty;
88

9-
public string Host { get; set; } = "";
9+
public string Host { get; set; } = string.Empty;
1010

1111
public int Port { get; set; } = 587;
1212

1313
public bool UseSsl { get; set; } = true;
1414

15-
public string Username { get; set; } = "";
15+
public string Username { get; set; } = string.Empty;
1616

17-
public string Password { get; set; } = "";
17+
public string Password { get; set; } = string.Empty;
1818

1919
public bool IsValid()
2020
{

Framework/Intersect.Framework.Core/Configuration/ClientConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,12 @@ public void Validate()
202202
/// <summary>
203203
/// The address for the update manifest file generated by the editor.
204204
/// </summary>
205-
public string UpdateUrl { get; set; } = "";
205+
public string UpdateUrl { get; set; } = string.Empty;
206206

207207
/// <summary>
208208
/// Sets a custom mouse cursor.
209209
/// </summary>
210-
public string MouseCursor { get; set; } = "";
210+
public string MouseCursor { get; set; } = string.Empty;
211211

212212
/// <summary>
213213
/// Determines the time it takes to fade-in or fade-out a song when no other instructions are given.

Framework/Intersect.Framework.Core/Descriptors/GameObjectTypeExtensions.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ public static DatabaseObjectLookup GetLookup(this GameObjectType gameObjectType)
5353
return DatabaseObjectLookup.GetLookup(GetObjectType(gameObjectType));
5454
}
5555

56+
public static bool TryGetLookup(this GameObjectType gameObjectType,
57+
[NotNullWhen(true)] out DatabaseObjectLookup? lookup)
58+
{
59+
lookup = GetLookup(gameObjectType);
60+
return lookup != default;
61+
}
62+
5663
public static IDatabaseObject CreateNew(this GameObjectType gameObjectType)
5764
{
5865
var instance = Activator.CreateInstance(

Framework/Intersect.Framework.Core/GameObjects/AnimationBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,5 @@ public AnimationBase()
7777
public bool CompleteSound { get; set; }
7878

7979
/// <inheritdoc />
80-
public string Folder { get; set; } = "";
80+
public string Folder { get; set; } = string.Empty;
8181
}

Framework/Intersect.Framework.Core/GameObjects/Annotations/EditorBooleanAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ public override string Format(Type stringsType, object value)
2323
throw new InvalidOperationException($"{stringsType.FullName}.{nameof(stringsType)} is missing.");
2424
}
2525

26-
return formatBooleanMethodInfo.Invoke(null, new[] { value, Style })?.ToString();
26+
return formatBooleanMethodInfo.Invoke(null, [value, Style])?.ToString();
2727
}
2828
}

Framework/Intersect.Framework.Core/GameObjects/Annotations/EditorDictionaryAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private static GetStringFromLocaleDictionaryGeneric CreateWeaklyTypedDelegate<TK
129129
var dictionaryType = dictionaryObject.GetType();
130130
if (!_cachedFormatters.TryGetValue(dictionaryType, out var formatter))
131131
{
132-
var createdDelegate = _methodInfoCreateWeaklyTypedDelegate.MakeGenericMethod(key.GetType()).Invoke(null, Array.Empty<object>());
132+
var createdDelegate = _methodInfoCreateWeaklyTypedDelegate.MakeGenericMethod(key.GetType()).Invoke(null, []);
133133
if (createdDelegate is not GetStringFromLocaleDictionaryGeneric genericFormatter)
134134
{
135135
throw new InvalidOperationException();

Framework/Intersect.Framework.Core/GameObjects/Annotations/EditorFormattedAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ private static object InvokeFormatterMethod(IEnumerable<MethodInfo> methodInfos,
8484

8585
if (formatterMethodInfo.GetParameters().Length == 1)
8686
{
87-
return formatterMethodInfo.Invoke(default, new[] { value });
87+
return formatterMethodInfo.Invoke(default, [value]);
8888
}
8989

9090
return formatterMethodInfo.Invoke(

Framework/Intersect.Framework.Core/GameObjects/ClassBase.cs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,15 @@ public partial class ClassBase : DatabaseObject<ClassBase>, IFolderable
1717
public const long DEFAULT_EXPERIENCE_INCREASE = 50;
1818

1919
[NotMapped]
20-
public int[] BaseStat = new int[Enum.GetValues<Stat>().Length];
20+
public int[] BaseStat { get; set; } = new int[Enum.GetValues<Stat>().Length];
2121

2222
[NotMapped]
23-
public long[] BaseVital = new long[Enum.GetValues<Vital>().Length];
23+
public long[] BaseVital { get; set; } = new long[Enum.GetValues<Vital>().Length];
2424

25-
[NotMapped]
26-
public Dictionary<int, long> ExperienceOverrides = new Dictionary<int, long>();
25+
[NotMapped] public Dictionary<int, long> ExperienceOverrides { get; set; } = [];
2726

2827
[NotMapped]
29-
public List<ClassItem> Items = new List<ClassItem>();
28+
public List<ClassItem> Items { get; set; } = [];
3029

3130
[JsonIgnore]
3231
private long mBaseExp;
@@ -35,19 +34,19 @@ public partial class ClassBase : DatabaseObject<ClassBase>, IFolderable
3534
private long mExpIncrease;
3635

3736
[NotMapped]
38-
public List<ClassSpell> Spells = new List<ClassSpell>();
37+
public List<ClassSpell> Spells { get; set; } = [];
3938

4039
[NotMapped]
41-
public List<ClassSprite> Sprites = new List<ClassSprite>();
40+
public List<ClassSprite> Sprites { get; set; } = [];
4241

4342
[NotMapped]
44-
public int[] StatIncrease = new int[Enum.GetValues<Stat>().Length];
43+
public int[] StatIncrease { get; set; } = new int[Enum.GetValues<Stat>().Length];
4544

4645
[NotMapped]
47-
public long[] VitalIncrease = new long[Enum.GetValues<Vital>().Length];
46+
public long[] VitalIncrease { get; set; } = new long[Enum.GetValues<Vital>().Length];
4847

4948
[NotMapped]
50-
public long[] VitalRegen = new long[Enum.GetValues<Vital>().Length];
49+
public long[] VitalRegen { get; set; } = new long[Enum.GetValues<Vital>().Length];
5150

5251
[JsonConstructor]
5352
public ClassBase(Guid id) : base(id)
@@ -243,7 +242,7 @@ public string ExpOverridesJson
243242
}
244243

245244
/// <inheritdoc />
246-
public string Folder { get; set; } = "";
245+
public string Folder { get; set; } = string.Empty;
247246

248247
public long ExperienceToNextLevel(int level)
249248
{
@@ -284,9 +283,9 @@ public SpellBase Get()
284283

285284
public partial class ClassSprite
286285
{
287-
public string Face = "";
286+
public string Face = string.Empty;
288287

289288
public Gender Gender;
290289

291-
public string Sprite = "";
290+
public string Sprite = string.Empty;
292291
}

0 commit comments

Comments
 (0)