diff --git a/pkNX.Structures/Personal/Interfaces/IMovesInfo.cs b/pkNX.Structures/Personal/Interfaces/IMovesInfo.cs new file mode 100644 index 00000000..760bd40b --- /dev/null +++ b/pkNX.Structures/Personal/Interfaces/IMovesInfo.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace pkNX.Structures +{ + public interface IMovesInfo + { + } + + public interface IMovesInfo_1 : IMovesInfo + { + /// + /// TM/HM learn compatibility flags for individual moves. + /// + bool[] TMHM { get; set; } + + /// + /// Grass-Fire-Water-Etc typed learn compatibility flags for individual moves. + /// + bool[] TypeTutors { get; set; } + } + + /// + /// SpecialTutors added in BW2 + /// + public interface IMovesInfo_2 : IMovesInfo_1 + { + /// + /// Special tutor learn compatibility flags for individual moves. + /// + bool[][] SpecialTutors { get; set; } + } + + /// + /// Moves layout seems to have changed completely from the old verion + /// + public interface IMovesInfo_3 : IMovesInfo + { + uint TM_A { get; set; } + uint TM_B { get; set; } + uint TM_C { get; set; } + uint TM_D { get; set; } + uint TR_A { get; set; } + uint TR_B { get; set; } + uint TR_C { get; set; } + uint TR_D { get; set; } + uint TypeTutor { get; set; } + uint MoveShop1 { get; set; } // uint + uint MoveShop2 { get; set; } // uint + + /// + /// Special tutor learn compatibility flags for individual moves. + /// + bool[][] SpecialTutors { get; set; } + } + + public static class IPersonalMovesExtensions + { + public static void SetIMovesInfo(this IMovesInfo self, IMovesInfo other) + { + if (self is IMovesInfo_1 self_1 && other is IMovesInfo_1 other_1) + { + self_1.TMHM = other_1.TMHM; + self_1.TypeTutors = other_1.TypeTutors; + } + + if (self is IMovesInfo_2 self_2 && other is IMovesInfo_2 other_2) + { + self_2.SpecialTutors = other_2.SpecialTutors; + } + + if (self is IMovesInfo_3 self_3) + { + if (other is IMovesInfo_2 other_2b) + { + self_3.SpecialTutors = other_2b.SpecialTutors; + } + else if (other is IMovesInfo_3 other_3) + { + self_3.TM_A = other_3.TM_A; + self_3.TM_B = other_3.TM_B; + self_3.TM_C = other_3.TM_C; + self_3.TM_D = other_3.TM_D; + self_3.TR_A = other_3.TR_A; + self_3.TR_B = other_3.TR_B; + self_3.TR_C = other_3.TR_C; + self_3.TR_D = other_3.TR_D; + self_3.TypeTutor = other_3.TypeTutor; + self_3.MoveShop1 = other_3.MoveShop1; + self_3.MoveShop2 = other_3.MoveShop2; + self_3.SpecialTutors = other_3.SpecialTutors; + } + } + } + } +} diff --git a/pkNX.Structures/Personal/Interfaces/IPersonalInfo.cs b/pkNX.Structures/Personal/Interfaces/IPersonalInfo.cs index eb6f3018..0fc89825 100644 --- a/pkNX.Structures/Personal/Interfaces/IPersonalInfo.cs +++ b/pkNX.Structures/Personal/Interfaces/IPersonalInfo.cs @@ -3,59 +3,6 @@ namespace pkNX.Structures { - public interface IMovesInfo - { - } - - public interface IMovesInfo_1 : IMovesInfo - { - /// - /// TM/HM learn compatibility flags for individual moves. - /// - bool[] TMHM { get; set; } - - /// - /// Grass-Fire-Water-Etc typed learn compatibility flags for individual moves. - /// - bool[] TypeTutors { get; set; } - } - - /// - /// SpecialTutors added in BW2 - /// - public interface IMovesInfo_2 : IMovesInfo_1 - { - /// - /// Special tutor learn compatibility flags for individual moves. - /// - bool[][] SpecialTutors { get; set; } - } - - /// - /// Moves layout seems to have changed completely from the old verion - /// - public interface IMovesInfo_3 : IMovesInfo - { - uint TM_A { get; set; } - uint TM_B { get; set; } - uint TM_C { get; set; } - uint TM_D { get; set; } - uint TR_A { get; set; } - uint TR_B { get; set; } - uint TR_C { get; set; } - uint TR_D { get; set; } - uint TypeTutor { get; set; } - uint MoveShop1 { get; set; } // uint - uint MoveShop2 { get; set; } // uint - - /// - /// Special tutor learn compatibility flags for individual moves. - /// - bool[][] SpecialTutors { get; set; } - } - - // Version based interfaces - /// /// Base interface that can be used for any version. This should not contain variables that are not present in every game ///