Beispiel #1
0
        public Player(int idx, PersonalSaveFile personalSave)
        {
            _personalFile = personalSave;
            var offsets = GetOffsetsFromRevision();

            Index = idx;
            // TODO: Convert this to a "PersonalID" struct
            TownUID   = personalSave.ReadU32(offsets.PersonalId);
            TownName  = personalSave.ReadString(offsets.PersonalId + 4, 10);
            PlayerUID = personalSave.ReadU32(offsets.PersonalId + 0x1C);
            Name      = personalSave.ReadString(offsets.PersonalId + 0x20, 10);

            Wallet    = new EncryptedInt32(personalSave, offsets.Wallet);
            Bank      = new EncryptedInt32(personalSave, offsets.Bank);
            NookMiles = new EncryptedInt32(personalSave, offsets.NookMiles);

            // TODO: This should be refactored to detect the "expanded pockets" state
            var pockets = new Item[40];

            for (var i = 0; i < 20; i++)
            {
                pockets[i]      = new Item(personalSave, offsets.Pockets + 0xB8 + i * 8);
                pockets[i + 20] = new Item(personalSave, offsets.Pockets + i * 8);
            }

            Pockets = new ItemCollection(pockets);

            var storage = new Item[5000];

            for (var i = 0; i < 5000; i++)
            {
                storage[i] = new Item(personalSave, offsets.Storage + i * 8);
            }
            Storage = new ItemCollection(storage);
        }
Beispiel #2
0
        public Player(int idx, PersonalSaveFile personalSave)
        {
            _personalFile = personalSave;
            var offsets = GetOffsetsFromRevision();

            Index = idx;
            // TODO: Convert this to a "PersonalID" struct
            TownUID   = personalSave.ReadU32(offsets.PersonalId);
            TownName  = personalSave.ReadString(offsets.PersonalId + 4, 10);
            PlayerUID = personalSave.ReadU32(offsets.PersonalId + 0x1C);
            Name      = personalSave.ReadString(offsets.PersonalId + 0x20, 10);

            Wallet = new EncryptedInt32(personalSave, offsets.Wallet);
            // Bank
            NookMiles = new EncryptedInt32(personalSave, offsets.NookMiles);
        }