Example #1
0
        public static void ReadNativeBankData(SaveTreeBaseRecord records)
        {
            SetupAccounts();

            if (records == null || records.RecordType != RecordTypes.BankAccount)
            {
                return;
            }

            MemoryStream stream = new MemoryStream(records.RecordData);
            BinaryReader reader = new BinaryReader(stream);

            int count = 0;

            while (reader.BaseStream.Position + 13 < records.RecordLength)
            {
                BankRecordData_v1 record = new BankRecordData_v1();
                record.accountGold  = reader.ReadInt32();
                record.loanTotal    = reader.ReadInt32();
                record.loanDueDate  = reader.ReadUInt32();
                record.hasDefaulted = reader.ReadBoolean();
                record.regionIndex  = count;

                if (record.regionIndex >= BankAccounts.Length)
                {
                    Debug.LogError("error reading bank data from classic save");
                    break;
                }

                BankAccounts[record.regionIndex] = record;
                count++;
            }
            reader.Close();
        }
Example #2
0
        public static void SetupAccounts()
        {
            bankAccounts = new BankRecordData_v1[DaggerfallUnity.Instance.ContentReader.MapFileReader.RegionCount];

            for (int i = 0; i < bankAccounts.Length; i++)
            {
                var account = new BankRecordData_v1();
                account.regionIndex = i;
                bankAccounts[i]     = account;
            }
        }