forked from sebastian-heinz/Arrowgene.DragonsDogmaOnline
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Review comments; move legend pawns into their own asset, fix DB hang …
…when using a master craft pawn, clean up skill assets, fix missing serializer from sebastian-heinz#671.
- Loading branch information
1 parent
849e0bf
commit 5cbe298
Showing
13 changed files
with
529 additions
and
509 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
Arrowgene.Ddon.Shared/AssetReader/PawnCraftMasterLegendDeserializer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using Arrowgene.Ddon.Shared.Asset; | ||
using Arrowgene.Ddon.Shared.Entity.Structure; | ||
using Arrowgene.Ddon.Shared.Model; | ||
using Arrowgene.Logging; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Text.Json; | ||
using System.Threading.Tasks; | ||
|
||
namespace Arrowgene.Ddon.Shared.AssetReader | ||
{ | ||
public class PawnCraftMasterLegendDeserializer : IAssetDeserializer<List<CDataRegisteredLegendPawnInfo>> | ||
{ | ||
private static readonly ILogger Logger = LogProvider.Logger(typeof(PawnCraftMasterLegendDeserializer)); | ||
|
||
public List<CDataRegisteredLegendPawnInfo> ReadPath(string path) | ||
{ | ||
Logger.Info($"Reading {path}"); | ||
|
||
List<CDataRegisteredLegendPawnInfo> asset = new(); | ||
|
||
string json = Util.ReadAllText(path); | ||
JsonDocument document = JsonDocument.Parse(json); | ||
|
||
var pawnElements = document.RootElement.EnumerateArray().ToList(); | ||
foreach (var pawn in pawnElements) | ||
{ | ||
var skillList = new List<CDataPawnCraftSkill>(); | ||
foreach (var skill in pawn.GetProperty("PawnCraftSkillList").EnumerateArray()) | ||
{ | ||
skillList.Add(new() | ||
{ | ||
Level = skill.GetProperty("Level").GetUInt32(), | ||
Type = (CraftSkillType)skill.GetProperty("Type").GetByte() | ||
}); | ||
} | ||
|
||
asset.Add(new CDataRegisteredLegendPawnInfo() | ||
{ | ||
PawnId = pawn.GetProperty("PawnId").GetUInt32(), | ||
PointType = (WalletType)pawn.GetProperty("PointType").GetByte(), | ||
RentalCost = pawn.GetProperty("RentalCost").GetUInt32(), | ||
Unk3 = pawn.GetProperty("Unk3").GetUInt32(), | ||
Name = pawn.GetProperty("Name").GetString(), | ||
CraftRank = pawn.GetProperty("CraftRank").GetUInt32(), | ||
PawnCraftSkillList = skillList | ||
}); | ||
} | ||
|
||
return asset; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.