Minor clean

no functional change
This commit is contained in:
Kurt 2020-06-02 07:11:11 -07:00
parent 3128e293ff
commit 4cf69da7e5
6 changed files with 23 additions and 17 deletions

View File

@ -52,5 +52,13 @@ protected AHTB(SerializationInfo info, StreamingContext context)
public IEnumerable<string> Summary => Entries.Select((z, i) => $"{i:0000}\t{z.Summary}");
public IEnumerable<string> ShortSummary => Entries.Select(z => z.Summary);
public Dictionary<ulong, string> ToDictionary()
{
var map = new Dictionary<ulong, string>();
foreach (var entry in Entries)
map[entry.Hash] = entry.Name;
return map;
}
}
}
}

View File

@ -8,7 +8,7 @@ public class EncounterGift6AO : EncounterGift
public EncounterGift6AO(byte[] data = null) : base(data ?? new byte[SIZE]) { }
public override int Species { get => BitConverter.ToUInt16(Data, 0x00); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x00); }
public int _02 { get => BitConverter.ToUInt16(Data, 0x02); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x02); }
public int Unk02 { get => BitConverter.ToUInt16(Data, 0x02); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x02); }
public override int Form { get => Data[0x04]; set => Data[0x04] = (byte)value; }
public override int Level { get => Data[0x05]; set => Data[0x05] = (byte)value; }
public override int Ability { get => (sbyte)Data[0x06]; set => Data[0x06] = (byte)value; }
@ -16,15 +16,15 @@ public class EncounterGift6AO : EncounterGift
public override Shiny Shiny { get => (Shiny)Data[0x08]; set => Data[0x08] = (byte)value; }
// padding?
public int _09 { get => Data[0x09]; set => Data[0x09] = (byte)value; }
public int _0A { get => Data[0x0A]; set => Data[0x0A] = (byte)value; }
public int _0B { get => Data[0x0B]; set => Data[0x0B] = (byte)value; }
public int Unk09 { get => Data[0x09]; set => Data[0x09] = (byte)value; }
public int Unk0A { get => Data[0x0A]; set => Data[0x0A] = (byte)value; }
public int Unk0B { get => Data[0x0B]; set => Data[0x0B] = (byte)value; }
public override int HeldItem { get => BitConverter.ToUInt16(Data, 0x0C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0C); }
public override FixedGender Gender { get => (FixedGender)Data[0x10]; set => Data[0x10] = (byte)value; }
// padding?
public int _11 { get => (sbyte)Data[0x11]; set => Data[0x11] = (byte)value; }
public int Unk11 { get => (sbyte)Data[0x11]; set => Data[0x11] = (byte)value; }
public short MetLocation { get => BitConverter.ToInt16(Data, 0x12); set => BitConverter.GetBytes(value).CopyTo(Data, 0x12); }
public int Move { get => BitConverter.ToUInt16(Data, 0x14); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x14); }
@ -42,6 +42,6 @@ public class EncounterGift6AO : EncounterGift
public int CNT_Tough { get => (sbyte)Data[0x20]; set => Data[0x20] = (byte)value; }
public int CNT_Sheen { get => (sbyte)Data[0x21]; set => Data[0x21] = (byte)value; }
public int _22 { get => (sbyte)Data[0x22]; set => Data[0x22] = (byte)value; }
public int Unk22 { get => (sbyte)Data[0x22]; set => Data[0x22] = (byte)value; }
}
}

View File

@ -31,6 +31,6 @@ public class EncounterGift6XY : EncounterGift
public override int IV_SPE { get => (sbyte)Data[0x16]; set => Data[0x16] = (byte)value; }
// padding
public int _17 { get => (sbyte)Data[0x17]; set => Data[0x17] = (byte)value; }
public int Unk17 { get => (sbyte)Data[0x17]; set => Data[0x17] = (byte)value; }
}
}

View File

@ -49,13 +49,13 @@ public override int Ability
set => Data[0x6] = (byte)((Data[0x6] & ~0x70) | ((value & 7) << 4));
}
public bool _7
public bool Unk7_0
{
get => (Data[0x7] & 1) >> 0 == 1;
set => Data[0x7] = (byte)((Data[0x7] & ~1) | (value ? 1 : 0));
}
public bool _7_1
public bool Unk7_1
{
get => (Data[0x7] & 2) >> 1 == 1;
set => Data[0x7] = (byte)((Data[0x7] & ~2) | (value ? 2 : 0));

View File

@ -1,6 +1,8 @@
namespace pkNX.Structures
{
#pragma warning disable CA1027 // Mark enums with FlagsAttribute
public enum AmxError
#pragma warning restore CA1027 // Mark enums with FlagsAttribute
{
AMX_ERR_NONE,
/* reserve the first 15 error codes for exit codes of the abstract machine */

View File

@ -114,23 +114,19 @@ public void DumpAHTB()
}
}
var outname = Path.Combine(DumpFolder, "ahtb.txt");
var outname2 = Path.Combine(DumpFolder, "ahtblist.txt");
var outname = GetPath("ahtb.txt");
var outname2 = GetPath("ahtblist.txt");
File.WriteAllLines(outname, result);
File.WriteAllLines(outname2, list);
}
public static Dictionary<ulong, string> ReadAHTB(byte[] bytes)
{
Dictionary<ulong, string> map = new Dictionary<ulong, string>();
if (!AHTB.IsAHTB(bytes))
throw new ArgumentException();
var tbl = new AHTB(bytes);
foreach (var entry in tbl.Entries)
map[entry.Hash] = entry.Name;
return map;
return tbl.ToDictionary();
}
private TrainerEditor GetTrainerEditor()