public Player(int idx, PersonalSaveFile personalSave) { _personalFile = personalSave; var offsets = GetOffsetsFromRevision(); Index = idx; PersonalId = new PersonalID(personalSave, offsets.PersonalId); 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); }
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); }
public void TestParse() { const int expect = 31_280; byte[] data = { 0x8A, 0xC4, 0xE3, 0xCF, 0x37, 0xD5, 0x1A, 0xD3 }; var val = EncryptedInt32.ReadVerify(data, 0); val.Value.Should().Be(expect); var encode = EncryptedInt32.Encrypt(expect, val.Shift, val.Adjust); val.OriginalEncrypted.Should().Be(encode); }
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); }
public void LoadPoki(byte[] bytes) => Poki = EncryptedInt32.ReadVerify(bytes, 0);
public void LoadMilesForever(byte[] bytes) => MilesTotal = EncryptedInt32.ReadVerify(bytes, UI_MoneyMiles.ENCRYPTIONSIZE);
public void LoadMilesNow(byte[] bytes) => MilesNow = EncryptedInt32.ReadVerify(bytes, 0);
public void LoadBank(byte[] bytes) => Bank = EncryptedInt32.ReadVerify(bytes, 0);