Exemple #1
0
        private PersonalTable(byte[] data, GameVersion format)
        {
            int size = 0;
            switch (format)
            {
                case GameVersion.RBY: size = PersonalInfoG1.SIZE; break;
                case GameVersion.GS:
                case GameVersion.C: size = PersonalInfoG2.SIZE; break;
                case GameVersion.RS:
                case GameVersion.E:
                case GameVersion.FR:
                case GameVersion.LG: size = PersonalInfoG3.SIZE; break;
                case GameVersion.DP:
                case GameVersion.Pt:
                case GameVersion.HGSS: size = PersonalInfoG4.SIZE; break;
                case GameVersion.BW: size = PersonalInfoBW.SIZE; break;
                case GameVersion.B2W2: size = PersonalInfoB2W2.SIZE; break;
                case GameVersion.XY: size = PersonalInfoXY.SIZE; break;
                case GameVersion.ORAS: size = PersonalInfoORAS.SIZE; break;
                case GameVersion.SM: size = PersonalInfoSM.SIZE; break;
            }

            if (size == 0)
            { Table = null; return; }

            byte[][] entries = splitBytes(data, size);
            PersonalInfo[] d = new PersonalInfo[data.Length / size];

            switch (format)
            {
                case GameVersion.RBY:
                    for (int i = 0; i < d.Length; i++)
                        d[i] = new PersonalInfoG1(entries[i]);
                    break;
                case GameVersion.GS:
                case GameVersion.C:
                    for (int i = 0; i < d.Length; i++)
                        d[i] = new PersonalInfoG2(entries[i]);
                    break;
                case GameVersion.RS:
                case GameVersion.E:
                case GameVersion.FR:
                case GameVersion.LG:
                    Array.Resize(ref d, 387);
                    for (int i = 0; i < d.Length; i++) // entries are not in order of natdexID
                        d[i] = new PersonalInfoG3(entries[PKX.getG3Species(i)]);
                    break;
                case GameVersion.DP:
                case GameVersion.Pt:
                case GameVersion.HGSS:
                    for (int i = 0; i < d.Length; i++)
                        d[i] = new PersonalInfoG4(entries[i]);
                    break;
                case GameVersion.BW:
                    for (int i = 0; i < d.Length; i++)
                        d[i] = new PersonalInfoBW(entries[i]);
                    break;
                case GameVersion.B2W2:
                    for (int i = 0; i < d.Length; i++)
                        d[i] = new PersonalInfoB2W2(entries[i]);
                    break;
                case GameVersion.XY:
                    for (int i = 0; i < d.Length; i++)
                        d[i] = new PersonalInfoXY(entries[i]);
                    break;
                case GameVersion.ORAS:
                    for (int i = 0; i < d.Length; i++)
                        d[i] = new PersonalInfoORAS(entries[i]);
                    break;
                case GameVersion.SM:
                    for (int i = 0; i < d.Length; i++)
                        d[i] = new PersonalInfoSM(entries[i]);
                    break;
            }
            Table = d;
        }
Exemple #2
0
        private PersonalTable(byte[] data, GameVersion format)
        {
            int size = 0;

            switch (format)
            {
            case GameVersion.RBY: size = PersonalInfoG1.SIZE; break;

            case GameVersion.GS:
            case GameVersion.C: size = PersonalInfoG2.SIZE; break;

            case GameVersion.RS:
            case GameVersion.E:
            case GameVersion.FR:
            case GameVersion.LG: size = PersonalInfoG3.SIZE; break;

            case GameVersion.DP:
            case GameVersion.Pt:
            case GameVersion.HGSS: size = PersonalInfoG4.SIZE; break;

            case GameVersion.BW: size = PersonalInfoBW.SIZE; break;

            case GameVersion.B2W2: size = PersonalInfoB2W2.SIZE; break;

            case GameVersion.XY: size = PersonalInfoXY.SIZE; break;

            case GameVersion.ORAS: size = PersonalInfoORAS.SIZE; break;

            case GameVersion.SM: size = PersonalInfoSM.SIZE; break;
            }

            if (size == 0)
            {
                Table = null; return;
            }

            byte[][]       entries = splitBytes(data, size);
            PersonalInfo[] d       = new PersonalInfo[data.Length / size];

            switch (format)
            {
            case GameVersion.RBY:
                for (int i = 0; i < d.Length; i++)
                {
                    d[i] = new PersonalInfoG1(entries[i]);
                }
                break;

            case GameVersion.GS:
            case GameVersion.C:
                for (int i = 0; i < d.Length; i++)
                {
                    d[i] = new PersonalInfoG2(entries[i]);
                }
                break;

            case GameVersion.RS:
            case GameVersion.E:
            case GameVersion.FR:
            case GameVersion.LG:
                Array.Resize(ref d, 387);
                for (int i = 0; i < d.Length; i++)     // entries are not in order of natdexID
                {
                    d[i] = new PersonalInfoG3(entries[PKX.getG3Species(i)]);
                }
                break;

            case GameVersion.DP:
            case GameVersion.Pt:
            case GameVersion.HGSS:
                for (int i = 0; i < d.Length; i++)
                {
                    d[i] = new PersonalInfoG4(entries[i]);
                }
                break;

            case GameVersion.BW:
                for (int i = 0; i < d.Length; i++)
                {
                    d[i] = new PersonalInfoBW(entries[i]);
                }
                break;

            case GameVersion.B2W2:
                for (int i = 0; i < d.Length; i++)
                {
                    d[i] = new PersonalInfoB2W2(entries[i]);
                }
                break;

            case GameVersion.XY:
                for (int i = 0; i < d.Length; i++)
                {
                    d[i] = new PersonalInfoXY(entries[i]);
                }
                break;

            case GameVersion.ORAS:
                for (int i = 0; i < d.Length; i++)
                {
                    d[i] = new PersonalInfoORAS(entries[i]);
                }
                break;

            case GameVersion.SM:
                for (int i = 0; i < d.Length; i++)
                {
                    d[i] = new PersonalInfoSM(entries[i]);
                }
                break;
            }
            Table = d;
        }
Exemple #3
0
        private static PersonalInfo[] GetArray(byte[] data, GameVersion format, int size)
        {
            byte[][]       entries = SplitBytes(data, size);
            PersonalInfo[] d       = new PersonalInfo[data.Length / size];

            switch (format)
            {
            case GameVersion.RBY:
                for (int i = 0; i < d.Length; i++)
                {
                    d[i] = new PersonalInfoG1(entries[i]);
                }
                return(d);

            case GameVersion.GS:
            case GameVersion.C:
                for (int i = 0; i < d.Length; i++)
                {
                    d[i] = new PersonalInfoG2(entries[i]);
                }
                return(d);

            case GameVersion.RS:
            case GameVersion.E:
            case GameVersion.FR:
            case GameVersion.LG:
                for (int i = 0; i < d.Length; i++)
                {
                    d[i] = new PersonalInfoG3(entries[i]);
                }
                return(d);

            case GameVersion.DP:
            case GameVersion.Pt:
            case GameVersion.HGSS:
                for (int i = 0; i < d.Length; i++)
                {
                    d[i] = new PersonalInfoG4(entries[i]);
                }
                return(d);

            case GameVersion.BW:
                for (int i = 0; i < d.Length; i++)
                {
                    d[i] = new PersonalInfoBW(entries[i]);
                }
                return(d);

            case GameVersion.B2W2:
                for (int i = 0; i < d.Length; i++)
                {
                    d[i] = new PersonalInfoB2W2(entries[i]);
                }
                return(d);

            case GameVersion.XY:
                for (int i = 0; i < d.Length; i++)
                {
                    d[i] = new PersonalInfoXY(entries[i]);
                }
                return(d);

            case GameVersion.ORAS:
                for (int i = 0; i < d.Length; i++)
                {
                    d[i] = new PersonalInfoORAS(entries[i]);
                }
                return(d);

            case GameVersion.SM:
                for (int i = 0; i < d.Length; i++)
                {
                    d[i] = new PersonalInfoSM(entries[i]);
                }
                return(d);

            default:
                return(null);
            }
        }