Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to System.Text.Json #4002

Merged
merged 25 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
678a856
Switch to System.Text.Json
LtRipley36706 May 4, 2023
eea9b00
Update GameConfiguration.cs
LtRipley36706 May 4, 2023
3990903
Update MasterConfiguration.cs
LtRipley36706 May 4, 2023
a67b8ce
Update ThreadConfiguration.cs
LtRipley36706 May 4, 2023
83754f2
Update StarterSpell.cs
LtRipley36706 May 4, 2023
6f66ca0
Update StarterGearFactory.cs
LtRipley36706 May 4, 2023
207f1ec
Update Program_Setup.cs
LtRipley36706 May 4, 2023
52e003a
Update LifestonedConverter.cs
LtRipley36706 May 5, 2023
b12c914
Update Program_Setup.cs
LtRipley36706 May 5, 2023
56d020e
Update Program_Setup.cs
LtRipley36706 May 6, 2023
4cb5f16
Update ACE.Adaptor
LtRipley36706 May 6, 2023
88532c9
Update LifestonedConverter.cs
LtRipley36706 May 6, 2023
8733476
Update StarterGearFactory.cs
LtRipley36706 May 6, 2023
a1684fb
Merge branch 'master' into remove-newtonsoft
LtRipley36706 Sep 17, 2023
9d2a10c
Update ACE.Server.csproj
LtRipley36706 Sep 17, 2023
ace256b
Update ACE.Server.Tests.csproj
LtRipley36706 Sep 17, 2023
201c8e1
Update Program.cs
LtRipley36706 Sep 17, 2023
2e54e76
Update MySqlConfiguration.cs
LtRipley36706 Sep 17, 2023
ab46bdc
Update DDDConfiguration.cs
LtRipley36706 Sep 17, 2023
b02b042
Update ModContainer.cs
LtRipley36706 Sep 17, 2023
788d295
Update ModManager.cs
LtRipley36706 Sep 17, 2023
376eaa1
Update ModMetadata.cs
LtRipley36706 Sep 17, 2023
22dd74e
Update ModMetadata.cs
LtRipley36706 Sep 17, 2023
a4f1543
Merge branch 'master' into remove-newtonsoft
LtRipley36706 Nov 27, 2023
9d02bbf
Merge branch 'master' into remove-newtonsoft
LtRipley36706 Dec 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions Source/ACE.Adapter/ACE.Adapter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
<RepositoryType>git</RepositoryType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ACE.Database\ACE.Database.csproj" />
<ProjectReference Include="..\ACE.Entity\ACE.Entity.csproj" />
Expand All @@ -38,4 +34,8 @@
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Text.Json" Version="6.0.7" />
</ItemGroup>

</Project>
54 changes: 27 additions & 27 deletions Source/ACE.Adapter/GDLE/GDLEConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,22 @@ public static bool TryConvert(List<LandblockInstance> input, out Models.Landbloc

// fix this ***, write it properly.
var pos = new Models.Position();
pos.objcell_id = lbi.ObjCellId;
pos.LandCellId = lbi.ObjCellId;

var frame = new Models.Frame();

frame.origin = new Models.Origin();
frame.origin.x = lbi.OriginX;
frame.origin.y = lbi.OriginY;
frame.origin.z = lbi.OriginZ;
frame.Position = new Models.XYZ();
frame.Position.X = lbi.OriginX;
frame.Position.Y = lbi.OriginY;
frame.Position.Z = lbi.OriginZ;

frame.angles = new Models.Angles();
frame.angles.w = lbi.AnglesW;
frame.angles.x = lbi.AnglesX;
frame.angles.y = lbi.AnglesY;
frame.angles.z = lbi.AnglesZ;
frame.Rotations = new Models.Quaternion();
frame.Rotations.W = lbi.AnglesW;
frame.Rotations.X = lbi.AnglesX;
frame.Rotations.Y = lbi.AnglesY;
frame.Rotations.Z = lbi.AnglesZ;

pos.frame = frame;
pos.Frame = frame;
weenie.pos = pos;

result.value.weenies.Add(weenie);
Expand Down Expand Up @@ -139,14 +139,14 @@ public static bool TryConvert(Models.Landblock input, out List<LandblockInstance
//result.Landblock = input.key; ACE uses a virtual column here of (result.ObjCellId >> 16)
result.WeenieClassId = value.wcid;

result.ObjCellId = value.pos.objcell_id;
result.OriginX = value.pos.frame.origin.x;
result.OriginY = value.pos.frame.origin.y;
result.OriginZ = value.pos.frame.origin.z;
result.AnglesW = value.pos.frame.angles.w;
result.AnglesX = value.pos.frame.angles.x;
result.AnglesY = value.pos.frame.angles.y;
result.AnglesZ = value.pos.frame.angles.z;
result.ObjCellId = value.pos.LandCellId;
result.OriginX = value.pos.Frame.Position.X;
result.OriginY = value.pos.Frame.Position.Y;
result.OriginZ = value.pos.Frame.Position.Z;
result.AnglesW = value.pos.Frame.Rotations.W;
result.AnglesX = value.pos.Frame.Rotations.X;
result.AnglesY = value.pos.Frame.Rotations.Y;
result.AnglesZ = value.pos.Frame.Rotations.Z;

results.Add(result);
}
Expand Down Expand Up @@ -352,16 +352,16 @@ public static bool TryConvert(uint id, Models.SpellValue input, out Spell result
// PortalSending, FellowPortalSending
if (input.MetaSpell.Spell.Position != null)
{
result.PositionObjCellId = input.MetaSpell.Spell.Position.objcell_id;
result.PositionObjCellId = input.MetaSpell.Spell.Position.LandCellId;

result.PositionOriginX = input.MetaSpell.Spell.Position.frame.origin.x;
result.PositionOriginY = input.MetaSpell.Spell.Position.frame.origin.y;
result.PositionOriginZ = input.MetaSpell.Spell.Position.frame.origin.z;
result.PositionOriginX = input.MetaSpell.Spell.Position.Frame.Position.X;
result.PositionOriginY = input.MetaSpell.Spell.Position.Frame.Position.Y;
result.PositionOriginZ = input.MetaSpell.Spell.Position.Frame.Position.Z;

result.PositionAnglesW = input.MetaSpell.Spell.Position.frame.angles.w;
result.PositionAnglesX = input.MetaSpell.Spell.Position.frame.angles.x;
result.PositionAnglesY = input.MetaSpell.Spell.Position.frame.angles.y;
result.PositionAnglesZ = input.MetaSpell.Spell.Position.frame.angles.z;
result.PositionAnglesW = input.MetaSpell.Spell.Position.Frame.Rotations.W;
result.PositionAnglesX = input.MetaSpell.Spell.Position.Frame.Rotations.X;
result.PositionAnglesY = input.MetaSpell.Spell.Position.Frame.Rotations.Y;
result.PositionAnglesZ = input.MetaSpell.Spell.Position.Frame.Rotations.Z;
}

// Dispel, FellowDispel
Expand Down
43 changes: 21 additions & 22 deletions Source/ACE.Adapter/GDLE/GDLELoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;

using Newtonsoft.Json;

using ACE.Database.Models.World;

namespace ACE.Adapter.GDLE
Expand All @@ -18,7 +17,7 @@ public static bool TryLoadLandblock(string file, out Models.Landblock result)
{
var fileText = File.ReadAllText(file);

result = JsonConvert.DeserializeObject<Models.Landblock>(fileText);
result = JsonSerializer.Deserialize<Models.Landblock>(fileText);

return true;
}
Expand Down Expand Up @@ -60,7 +59,7 @@ public static bool TryLoadWorldSpawns(string file, out Models.WorldSpawns result
{
var fileText = File.ReadAllText(file);

result = JsonConvert.DeserializeObject<Models.WorldSpawns>(fileText);
result = JsonSerializer.Deserialize<Models.WorldSpawns>(fileText);

return true;
}
Expand Down Expand Up @@ -114,7 +113,7 @@ private static void ReGuidAndConvertLandblocks(out List<LandblockInstance> resul

foreach (var weenie in landblock.value.weenies)
{
var newGuid = (0x70000000 | ((weenie.pos.objcell_id & 0xFFFF0000) >> 4) | currentOffset);
var newGuid = (0x70000000 | ((weenie.pos.LandCellId & 0xFFFF0000) >> 4) | currentOffset);
currentOffset++;

if (!idChanges[landblock.key].ContainsKey(weenie.id))
Expand Down Expand Up @@ -189,7 +188,7 @@ public static bool TryLoadWorldSpawnsConverted(string file, out List<LandblockIn
{
var fileText = File.ReadAllText(file);

var gdleModel = JsonConvert.DeserializeObject<Models.WorldSpawns>(fileText);
var gdleModel = JsonSerializer.Deserialize<Models.WorldSpawns>(fileText);


if (gdleModel.Landblocks == null)
Expand Down Expand Up @@ -219,7 +218,7 @@ public static bool TryLoadEvents(string file, out List<Models.Event> results)
{
var fileText = File.ReadAllText(file);

results = JsonConvert.DeserializeObject<List<Models.Event>>(fileText);
results = JsonSerializer.Deserialize<List<Models.Event>>(fileText);

return true;
}
Expand All @@ -236,7 +235,7 @@ public static bool TryLoadEventsConverted(string file, out List<Event> results)
{
var fileText = File.ReadAllText(file);

var gdleModel = JsonConvert.DeserializeObject<List<Models.Event>>(fileText);
var gdleModel = JsonSerializer.Deserialize<List<Models.Event>>(fileText);

results = new List<Event>();

Expand All @@ -262,7 +261,7 @@ public static bool TryLoadQuest(string file, out Models.Quest result)
{
var fileText = File.ReadAllText(file);

result = JsonConvert.DeserializeObject<Models.Quest>(fileText);
result = JsonSerializer.Deserialize<Models.Quest>(fileText);

return true;
}
Expand All @@ -279,7 +278,7 @@ public static bool TryLoadQuests(string file, out List<Models.Quest> results)
{
var fileText = File.ReadAllText(file);

results = JsonConvert.DeserializeObject<List<Models.Quest>>(fileText);
results = JsonSerializer.Deserialize<List<Models.Quest>>(fileText);

return true;
}
Expand All @@ -296,7 +295,7 @@ public static bool TryLoadQuestsConverted(string file, out List<Quest> results)
{
var fileText = File.ReadAllText(file);

var gdleModel = JsonConvert.DeserializeObject<List<Models.Quest>>(fileText);
var gdleModel = JsonSerializer.Deserialize<List<Models.Quest>>(fileText);

results = new List<Quest>();

Expand All @@ -323,7 +322,7 @@ public static bool TryLoadSpells(string file, out Models.Spells result)
{
var fileText = File.ReadAllText(file);

result = JsonConvert.DeserializeObject<Models.Spells>(fileText);
result = JsonSerializer.Deserialize<Models.Spells>(fileText);

return true;
}
Expand All @@ -340,7 +339,7 @@ public static bool TryLoadSpellsConverted(string file, out List<Spell> results)
{
var fileText = File.ReadAllText(file);

var gdleModel = JsonConvert.DeserializeObject<Models.Spells>(fileText);
var gdleModel = JsonSerializer.Deserialize<Models.Spells>(fileText);

results = new List<Spell>();

Expand All @@ -366,7 +365,7 @@ public static bool TryLoadRecipe(string file, out Models.Recipe result)
{
var fileText = File.ReadAllText(file);

result = JsonConvert.DeserializeObject<Models.Recipe>(fileText);
result = JsonSerializer.Deserialize<Models.Recipe>(fileText);

return true;
}
Expand All @@ -383,7 +382,7 @@ public static bool TryLoadRecipeCombined(string file, out Models.RecipeCombined
{
var fileText = File.ReadAllText(file);

result = JsonConvert.DeserializeObject<Models.RecipeCombined>(fileText);
result = JsonSerializer.Deserialize<Models.RecipeCombined>(fileText);

return true;
}
Expand Down Expand Up @@ -469,7 +468,7 @@ public static bool TryLoadRecipesConverted(string file, out List<Recipe> results
{
var fileText = File.ReadAllText(file);

var gdleModel = JsonConvert.DeserializeObject<List<Models.Recipe>>(fileText);
var gdleModel = JsonSerializer.Deserialize<List<Models.Recipe>>(fileText);

results = new List<Recipe>();

Expand All @@ -495,7 +494,7 @@ public static bool TryLoadRecipePrecursors(string file, out List<Models.RecipePr
{
var fileText = File.ReadAllText(file);

results = JsonConvert.DeserializeObject<List<Models.RecipePrecursor>>(fileText);
results = JsonSerializer.Deserialize<List<Models.RecipePrecursor>>(fileText);

return true;
}
Expand All @@ -512,7 +511,7 @@ public static bool TryLoadRecipePrecursorsConverted(string file, out List<CookBo
{
var fileText = File.ReadAllText(file);

var gdleModel = JsonConvert.DeserializeObject<List<Models.RecipePrecursor>>(fileText);
var gdleModel = JsonSerializer.Deserialize<List<Models.RecipePrecursor>>(fileText);

results = new List<CookBook>();

Expand All @@ -538,7 +537,7 @@ public static bool TryLoadRegion(string file, out Models.Region result)
{
var fileText = File.ReadAllText(file);

result = JsonConvert.DeserializeObject<Models.Region>(fileText);
result = JsonSerializer.Deserialize<Models.Region>(fileText);

return true;
}
Expand All @@ -555,7 +554,7 @@ public static bool TryLoadTerrainData(string file, out List<Models.TerrainData>
{
var fileText = File.ReadAllText(file);

results = JsonConvert.DeserializeObject<List<Models.TerrainData>>(fileText);
results = JsonSerializer.Deserialize<List<Models.TerrainData>>(fileText);

return true;
}
Expand All @@ -572,7 +571,7 @@ public static bool TryLoadWieldedTreasureTable(string file, out List<Models.Wiel
{
var fileText = File.ReadAllText(file);

results = JsonConvert.DeserializeObject<List<Models.WieldedTreasureTable>>(fileText);
results = JsonSerializer.Deserialize<List<Models.WieldedTreasureTable>>(fileText);

return true;
}
Expand All @@ -589,7 +588,7 @@ public static bool TryLoadWieldedTreasureTableConverted(string file, out List<Tr
{
var fileText = File.ReadAllText(file);

var gdleModel = JsonConvert.DeserializeObject<List<Models.WieldedTreasureTable>>(fileText);
var gdleModel = JsonSerializer.Deserialize<List<Models.WieldedTreasureTable>>(fileText);

results = new List<TreasureWielded>();

Expand Down
17 changes: 13 additions & 4 deletions Source/ACE.Adapter/GDLE/Models/Angles.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
using System.Text.Json.Serialization;

namespace ACE.Adapter.GDLE.Models
{
public class Angles
{
public float w { get; set; }
public float x { get; set; }
public float y { get; set; }
public float z { get; set; }
[JsonPropertyName("w")]
public float W { get; set; }

[JsonPropertyName("x")]
public float X { get; set; }

[JsonPropertyName("y")]
public float Y { get; set; }

[JsonPropertyName("z")]
public float Z { get; set; }
}
}
34 changes: 34 additions & 0 deletions Source/ACE.Adapter/GDLE/Models/ArmorValues.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System.Text.Json.Serialization;

namespace ACE.Adapter.GDLE.Models
{
public class ArmorValues
{
[JsonPropertyName("base_armor")]
public int BaseArmor { get; set; }

[JsonPropertyName("armor_vs_slash")]
public int ArmorVsSlash { get; set; }

[JsonPropertyName("armor_vs_pierce")]
public int ArmorVsPierce { get; set; }

[JsonPropertyName("armor_vs_bludgeon")]
public int ArmorVsBludgeon { get; set; }

[JsonPropertyName("armor_vs_cold")]
public int ArmorVsCold { get; set; }

[JsonPropertyName("armor_vs_fire")]
public int ArmorVsFire { get; set; }

[JsonPropertyName("armor_vs_acid")]
public int ArmorVsAcid { get; set; }

[JsonPropertyName("armor_vs_electric")]
public int ArmorVsElectric { get; set; }

[JsonPropertyName("armor_vs_nether")]
public int ArmorVsNether { get; set; }
}
}
19 changes: 19 additions & 0 deletions Source/ACE.Adapter/GDLE/Models/Attribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Text.Json.Serialization;

namespace ACE.Adapter.GDLE.Models
{
public class Attribute
{
[JsonPropertyName("cp_spent")]
public uint? XpSpent { get; set; } = 0u;


[JsonPropertyName("level_from_cp")]
public uint LevelFromCp { get; set; } = 0u;


[JsonPropertyName("init_level")]
public uint? Ranks { get; set; } = 0u;

}
}