示例#1
0
        public BAC.BAC_Entry ConvertToXv2(int skillID)
        {
            if (skillID != -1)
            {
                Type8 = BAC.BAC_Type8.ChangeSkillId(Type8, skillID);
                Type9 = BAC.BAC_Type9.ChangeSkillId(Type9, skillID);
            }

            return(new BAC.BAC_Entry()
            {
                Index = Index,
                Flag = Flag,
                Type0 = Type0,
                Type1 = Type1,
                Type2 = Type2,
                Type3 = Type3,
                Type4 = Type4,
                Type5 = Type5,
                Type6 = Type6,
                Type7 = Type7,
                Type8 = Type8,
                Type9 = Type9,
                Type10 = BAC_Type10.ConvertToXv2(Type10),
                Type11 = Type11,
                Type12 = Type12,
                Type13 = Type13,
                Type14 = Type14,
                Type15 = BAC_Type15.ConvertToXv2(Type15),
                Type16 = Type16,
                Type17 = Type17,
                Type18 = Type18,
                Type19 = Type19,
                Type20 = Type20,
                Type21 = Type21,
                Type22 = Type22,
                Type23 = Type23,
                Type24 = Type24,
            });
        }
示例#2
0
        private void ParseBac()
        {
            int offset = BitConverter.ToInt32(rawBytes, 12);
            int count  = BitConverter.ToInt32(rawBytes, 8);

            bacFile.I_20       = BitConverter_Ex.ToInt32Array(rawBytes, 20, 3);
            bacFile.F_32       = BitConverter_Ex.ToFloat32Array(rawBytes, 32, 12);
            bacFile.I_80       = BitConverter_Ex.ToInt32Array(rawBytes, 80, 4);
            bacFile.BacEntries = new List <BAC_Entry>();

            for (int i = 0; i < count; i++)
            {
                int typeListOffset = BitConverter.ToInt32(rawBytes, offset + 8);
                int typeListCount  = BitConverter.ToInt16(rawBytes, offset + 4);

                bacFile.BacEntries.Add(new BAC_Entry()
                {
                    Flag  = (BAC.BAC_Entry.Flags)BitConverter.ToUInt32(rawBytes, offset + 0),
                    Index = i.ToString()
                });

                for (int a = 0; a < typeListCount; a++)
                {
                    int thisType       = BitConverter.ToInt16(rawBytes, typeListOffset + 0);
                    int thisTypeCount  = BitConverter.ToInt16(rawBytes, typeListOffset + 2);
                    int thisTypeOffset = BitConverter.ToInt32(rawBytes, typeListOffset + 4);


                    if (thisTypeOffset != 0)
                    {
                        switch (thisType)
                        {
                        case 0:
                            bacFile.BacEntries[i].Type0 = BAC.BAC_Type0.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 1:
                            bacFile.BacEntries[i].Type1 = BAC.BAC_Type1.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 2:
                            bacFile.BacEntries[i].Type2 = BAC.BAC_Type2.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 3:
                            bacFile.BacEntries[i].Type3 = BAC.BAC_Type3.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 4:
                            bacFile.BacEntries[i].Type4 = BAC.BAC_Type4.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 5:
                            bacFile.BacEntries[i].Type5 = BAC.BAC_Type5.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 6:
                            bacFile.BacEntries[i].Type6 = BAC.BAC_Type6.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 7:
                            bacFile.BacEntries[i].Type7 = BAC.BAC_Type7.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 8:
                            bacFile.BacEntries[i].Type8 = BAC.BAC_Type8.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 9:
                            bacFile.BacEntries[i].Type9 = BAC.BAC_Type9.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 10:
                            bacFile.BacEntries[i].Type10 = BAC_Type10.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 11:
                            bacFile.BacEntries[i].Type11 = BAC.BAC_Type11.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 12:
                            bacFile.BacEntries[i].Type12 = BAC.BAC_Type12.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 13:
                            bacFile.BacEntries[i].Type13 = BAC.BAC_Type13.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 14:
                            bacFile.BacEntries[i].Type14 = BAC.BAC_Type14.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 15:
                            bacFile.BacEntries[i].Type15 = BAC_Type15.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 16:
                            bacFile.BacEntries[i].Type16 = BAC.BAC_Type16.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 17:
                            bacFile.BacEntries[i].Type17 = BAC.BAC_Type17.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount, IsType17Small(thisTypeOffset, thisTypeCount, i));
                            break;

                        case 18:
                            bacFile.BacEntries[i].Type18 = BAC.BAC_Type18.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 19:
                            bacFile.BacEntries[i].Type19 = BAC.BAC_Type19.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 20:
                            bacFile.BacEntries[i].Type20 = BAC.BAC_Type20.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 21:
                            bacFile.BacEntries[i].Type21 = BAC.BAC_Type21.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 22:
                            bacFile.BacEntries[i].Type22 = BAC.BAC_Type22.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 23:
                            bacFile.BacEntries[i].Type23 = BAC.BAC_Type23.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        case 24:
                            bacFile.BacEntries[i].Type24 = BAC.BAC_Type24.Read(rawBytes, bytes, thisTypeOffset, thisTypeCount);
                            break;

                        default:
                            Console.WriteLine(String.Format("Parse failed. Unknown BacType encountered ({0})\nOffset: {1}\nCount: {2}.", thisType, thisTypeOffset, thisTypeCount));
                            Utils.WaitForInputThenQuit();
                            break;
                        }
                    }
                    else
                    {
                        if (bacFile.BacEntries[i].TypeDummy == null)
                        {
                            bacFile.BacEntries[i].TypeDummy = new List <int>();
                        }
                        bacFile.BacEntries[i].TypeDummy.Add(thisType);
                    }


                    typeListOffset += 8;
                }


                offset += 16;
            }
        }