Skip to content

Commit

Permalink
Lvup: commit this only for traceability
Browse files Browse the repository at this point in the history
Will be moved into Lvup next commit
  • Loading branch information
Rikux3 committed May 30, 2020
1 parent cef90ea commit 0c03e9c
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions OpenKh.Kh2/Battle/Lvup2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ namespace OpenKh.Kh2.Battle
{
public class Lvup2
{
[Data] public int MagicCode { get; set; }
[Data] public int Count { get; set; }
[Data(Count = 0x38)] public byte[] Unknown08 { get; set; }
[Data(Count = 13)] public List<Character> Characters { get; set; }

public class Character
{
[Data] public int Unknown00 { get; set; }
[Data] public int NumLevels { get; set; }
[Data(Count = 99)] public List<Level> Levels { get; set; }

public class Level
Expand All @@ -25,28 +30,25 @@ public class Level
}
}

private class Header
{
[Data] public int MagicCode { get; set; }
[Data] public int Count { get => Characters.TryGetCount(); set => Characters = Characters.CreateOrResize(value); }
[Data(Count = 0x38)] public byte[] Unknown08 { get; set; }
[Data(Count = 13)] public List<Character> Characters { get; set; }
}


static Lvup2()
public enum PlayableCharacterType
{
//BinaryMapping.SetMemberLengthMapping<Header>(nameof(Header.Characters), (o, m) => o.Count);
Sora,
Donald,
Goofy,
Mickey,
Auron,
PingMulan,
Aladdin,
Sparrow,
Biest,
Jack,
Simba,
Tron,
Riku
}

public static List<Character> Read(Stream stream) =>
BinaryMapping.ReadObject<Header>(stream).Characters;
public static Lvup2 Read(Stream stream) => BinaryMapping.ReadObject<Lvup2>(stream);

//public static void Write(Stream stream, List<Character> entries) =>
// BinaryMapping.WriteObject(stream, new Header
// {
// MagicCode = 1,
// Entries = entries
// });
public void Write(Stream stream) => BinaryMapping.WriteObject(stream, this);
}
}

0 comments on commit 0c03e9c

Please sign in to comment.