diff --git a/SoG_SGreader.Test/DataReaderTests.cs b/SoG_SGreader.Test/DataReaderTests.cs index 04545fd..b7a38c9 100644 --- a/SoG_SGreader.Test/DataReaderTests.cs +++ b/SoG_SGreader.Test/DataReaderTests.cs @@ -22,7 +22,7 @@ private static Player GetSaveGame(int saveGameNumber) if (Environment.GetEnvironmentVariable("GITHUB_WORKSPACE") != null) { projectDirectory = Environment.GetEnvironmentVariable("GITHUB_WORKSPACE"); } - else + else if (Environment.OSVersion.Platform != PlatformID.Unix) { projectDirectory = Path.Combine(projectDirectory, "SoG_SGreader"); } @@ -95,15 +95,68 @@ private void TestCanReadBirthday(int birthdayDay, int birthdayMonth, Player play private static IEnumerable FirstItem() { - yield return new object[] { new Item(SogItems.Usable_CardAlbum, 1, 189755), GetSaveGame(0).Inventory }; - yield return new object[] { new Item(SogItems.KeyItem_DivaMirror, 0, 158319), GetSaveGame(1).Inventory }; - yield return new object[] { new Item(SogItems.Usable_CardAlbum, 1, 46623), GetSaveGame(2).Inventory }; - yield return new object[] { new Item(SogItems.Usable_CardAlbum, 1, 16756), GetSaveGame(3).Inventory }; - yield return new object[] { new Item(SogItems.Usable_CardAlbum, 1, 25026), GetSaveGame(4).Inventory }; - yield return new object[] { new Item(SogItems.Usable_CardAlbum, 1, 18895), GetSaveGame(5).Inventory }; - yield return new object[] { new Item(SogItems.Usable_CardAlbum, 1, 16634), GetSaveGame(6).Inventory }; - yield return new object[] { new Item(SogItems.Usable_CardAlbum, 1, 14455), GetSaveGame(7).Inventory }; - yield return new object[] { new Item(SogItems.Usable_CardAlbum, 1, 96617), GetSaveGame(8).Inventory }; + yield return new object[] { + new Item { + ItemID = SogItems.Usable_CardAlbum, + ItemCount = 1, + ItemPos = 189755 + }, GetSaveGame(0).Inventory }; + + yield return new object[] { + new Item{ + ItemID = SogItems.KeyItem_DivaMirror, + ItemCount = 0, + ItemPos = 158319 + }, GetSaveGame(1).Inventory }; + + yield return new object[] { + new Item{ + ItemID = SogItems.Usable_CardAlbum, + ItemCount = 1, + ItemPos = 46623 + }, GetSaveGame(2).Inventory }; + + yield return new object[] { + new Item{ + ItemID = SogItems.Usable_CardAlbum, + ItemCount = 1, + ItemPos = 16756 + }, GetSaveGame(3).Inventory }; + + yield return new object[] { + new Item{ + ItemID = SogItems.Usable_CardAlbum, + ItemCount = 1, + ItemPos = 25026 + }, GetSaveGame(4).Inventory }; + + yield return new object[] { + new Item{ + ItemID = SogItems.Usable_CardAlbum, + ItemCount = 1, + ItemPos = 18895 + }, GetSaveGame(5).Inventory }; + + yield return new object[] { + new Item{ + ItemID = SogItems.Usable_CardAlbum, + ItemCount = 1, + ItemPos = 16634 + }, GetSaveGame(6).Inventory }; + + yield return new object[] { + new Item{ + ItemID = SogItems.Usable_CardAlbum, + ItemCount = 1, + ItemPos = 14455 + }, GetSaveGame(7).Inventory }; + + yield return new object[] { + new Item{ + ItemID = SogItems.Usable_CardAlbum, + ItemCount = 1, + ItemPos = 96617 + }, GetSaveGame(8).Inventory }; } [Theory] @@ -115,15 +168,68 @@ private void TestCanGetFirstItemFromInventory(Item firstItem, List invento private static IEnumerable LastItem() { - yield return new object[] { new Item(SogItems.Furniture_Decoration_ArcadeChallengeTrophyF08, 1, 189760), GetSaveGame(0).Inventory }; - yield return new object[] { new Item(SogItems.KeyItem_CatalystOfPower, 1, 159243), GetSaveGame(1).Inventory }; - yield return new object[] { new Item(SogItems.KeyItem_CatalystOfPower, 1, 46457), GetSaveGame(2).Inventory }; - yield return new object[] { new Item(SogItems.Shoes_MushroomSlippers, 1, 16738), GetSaveGame(3).Inventory }; - yield return new object[] { new Item(SogItems.TwoHanded_BugNet, 0, 25025), GetSaveGame(4).Inventory }; - yield return new object[] { new Item(SogItems.TwoHanded_BugNet, 0, 18894), GetSaveGame(5).Inventory }; - yield return new object[] { new Item(SogItems.Furniture_Carpet_MasterHQRed, 0, 16614), GetSaveGame(6).Inventory }; - yield return new object[] { new Item(SogItems.TwoHanded_BugNet, 0, 14454), GetSaveGame(7).Inventory }; - yield return new object[] { new Item(SogItems.OneHanded_UgrasScroll, 1, 96375), GetSaveGame(8).Inventory }; + yield return new object[] { + new Item { + ItemID = SogItems.Furniture_Decoration_ArcadeChallengeTrophyF08, + ItemCount = 1, + ItemPos = 189760 + }, GetSaveGame(0).Inventory }; + + yield return new object[] { + new Item { + ItemID = SogItems.KeyItem_CatalystOfPower, + ItemCount = 1, + ItemPos = 159243 + }, GetSaveGame(1).Inventory }; + + yield return new object[] { + new Item { + ItemID = SogItems.KeyItem_CatalystOfPower, + ItemCount = 1, + ItemPos = 46457 + }, GetSaveGame(2).Inventory }; + + yield return new object[] { + new Item { + ItemID = SogItems.Shoes_MushroomSlippers, + ItemCount = 1, + ItemPos = 16738}, + GetSaveGame(3).Inventory }; + + yield return new object[] { + new Item { + ItemID = SogItems.TwoHanded_BugNet, + ItemCount = 0, + ItemPos = 25025 + }, GetSaveGame(4).Inventory }; + + yield return new object[] { + new Item { + ItemID = SogItems.TwoHanded_BugNet, + ItemCount = 0, + ItemPos = 18894}, + GetSaveGame(5).Inventory }; + + yield return new object[] { + new Item { + ItemID = SogItems.Furniture_Carpet_MasterHQRed, + ItemCount = 0, + ItemPos = 16614}, + GetSaveGame(6).Inventory }; + + yield return new object[] { + new Item { + ItemID = SogItems.TwoHanded_BugNet, + ItemCount = 0, + ItemPos =14454}, + GetSaveGame(7).Inventory }; + + yield return new object[] { + new Item { + ItemID = SogItems.OneHanded_UgrasScroll, + ItemCount = 1, + ItemPos =96375 + }, GetSaveGame(8).Inventory }; } [Theory] diff --git a/SoG_SGreader.Test/IntegrationTests.cs b/SoG_SGreader.Test/IntegrationTests.cs index 6e15d01..75df916 100644 --- a/SoG_SGreader.Test/IntegrationTests.cs +++ b/SoG_SGreader.Test/IntegrationTests.cs @@ -16,7 +16,7 @@ private static string GetExePath() projectDirectory = Environment.GetEnvironmentVariable("GITHUB_WORKSPACE"); return Path.Combine(projectDirectory, "SoG_SGreader", "bin", "Release", "SoG_SGreader.exe"); } - else + else if (Environment.OSVersion.Platform != PlatformID.Unix) { projectDirectory = Path.Combine(projectDirectory, "SoG_SGreader"); } @@ -32,7 +32,7 @@ private static string GetSaveGamePath(string saveGameNumber) if (Environment.GetEnvironmentVariable("GITHUB_WORKSPACE") != null) { projectDirectory = Environment.GetEnvironmentVariable("GITHUB_WORKSPACE"); } - else + else if (Environment.OSVersion.Platform != PlatformID.Unix) { projectDirectory = Path.Combine(projectDirectory,"SoG_SGreader"); } diff --git a/SoG_SGreader/DataReader.cs b/SoG_SGreader/DataReader.cs index 0d29999..299c223 100644 --- a/SoG_SGreader/DataReader.cs +++ b/SoG_SGreader/DataReader.cs @@ -15,6 +15,8 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) BinaryReader readBinary = new BinaryReader(fileStream); txtConsole.AppendText("\r\nFilesize: " + new FileInfo(fileName).Length); + // show current position in HEX in the file + txtConsole.AppendText("\r\nStarting Position: " + readBinary.BaseStream.Position.ToString("X")); playerObject.MagicByte = readBinary.ReadInt32(); //I dont know yet what the first bytes stand for tbh @@ -22,18 +24,22 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) playerObject.Equip.Hat = readBinary.ReadInt32(); playerObject.Equip.Facegear = readBinary.ReadInt32(); playerObject.Style.Bodytype = readBinary.ReadChar(); //seems like always B ? + txtConsole.AppendText("\r\nBodytype: " + playerObject.Style.Bodytype); + txtConsole.AppendText("\r\nBodytype Position: " + readBinary.BaseStream.Position.ToString("X")); playerObject.Style.Hair = readBinary.ReadInt32(); playerObject.Equip.Weapon = readBinary.ReadInt32(); playerObject.Equip.Shield = readBinary.ReadInt32(); playerObject.Equip.Armor = readBinary.ReadInt32(); playerObject.Equip.Shoes = readBinary.ReadInt32(); + txtConsole.AppendText("\r\nShoes Position: " + readBinary.BaseStream.Position.ToString("X")); playerObject.Equip.Accessory1 = readBinary.ReadInt32(); playerObject.Equip.Accessory2 = readBinary.ReadInt32(); playerObject.Style.Hat = readBinary.ReadInt32(); playerObject.Style.Facegear = readBinary.ReadInt32(); playerObject.Style.Weapon = readBinary.ReadInt32(); playerObject.Style.Shield = readBinary.ReadInt32(); - + txtConsole.AppendText("\r\nShield Position: " + readBinary.BaseStream.Position.ToString("X")); + playerObject.Style.HatHidden = readBinary.ReadBoolean(); //[Sog_PlayerProperty(16)] playerObject.Style.FacegearHidden = readBinary.ReadBoolean(); @@ -41,10 +47,14 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) playerObject.LastTwoHander = readBinary.ReadInt32(); //last equipped onehander? playerObject.LastOneHander = readBinary.ReadInt32(); //last equipped twohander? playerObject.LastBow = readBinary.ReadInt32(); //last equipped bow? + txtConsole.AppendText("\r\nLastBow Position: " + readBinary.BaseStream.Position.ToString("X")); for (int i = 0; i < 10; i++) { int quickSlotType = readBinary.ReadByte(); + txtConsole.AppendText("\r\nquickSlotType: " + quickSlotType); + txtConsole.AppendText("\r\nquickSlotType Position: " + readBinary.BaseStream.Position.ToString("X")); + switch (quickSlotType) { case 1: @@ -58,12 +68,13 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) break; } } - + txtConsole.AppendText("\r\nAfter-quickSlot Position: " + readBinary.BaseStream.Position.ToString("X")); playerObject.Style.HairColor = readBinary.ReadByte(); playerObject.Style.SkinColor = readBinary.ReadByte(); playerObject.Style.PonchoColor = readBinary.ReadByte(); playerObject.Style.ShirtColor = readBinary.ReadByte(); playerObject.Style.PantsColor = readBinary.ReadByte(); + txtConsole.AppendText("\r\nStyle Position: " + readBinary.BaseStream.Position.ToString("X")); playerObject.Style.Sex = readBinary.ReadByte(); // female = 0; male = 1 txtConsole.AppendText("\r\nGender: " + playerObject.Style.Sex); @@ -76,15 +87,17 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) playerObject.ItemsCount = readBinary.ReadInt32(); playerObject.Inventory = new List(playerObject.ItemsCount); + txtConsole.AppendText("\r\nInventory Position: " + readBinary.BaseStream.Position.ToString("X")); for (int i = 0; i != playerObject.ItemsCount; i++) { playerObject.Inventory.Add(new Item - ( - (SogItems)readBinary.ReadInt32(), - (int)readBinary.ReadInt32(), - readBinary.ReadUInt32() - )); + { + ItemID = (SogItems)readBinary.ReadInt32(), + ItemCount = readBinary.ReadInt32(), + ItemPos = readBinary.ReadUInt32() + }); } + txtConsole.AppendText("\r\n After-Inventory Position: " + readBinary.BaseStream.Position.ToString("X")); txtConsole.AppendText("\r\nInventorySize: " + playerObject.ItemsCount); @@ -93,36 +106,48 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) playerObject.MerchantItemsCount = readBinary.ReadInt32(); //itemscount by shady merchant playerObject.MerchantItems = new List(playerObject.MerchantItemsCount); + txtConsole.AppendText("\r\nMerchantItems Position: " + readBinary.BaseStream.Position.ToString("X")); + for (int i = 0; i != playerObject.MerchantItemsCount; i++) { - playerObject.MerchantItems.Add(new MerchantItem - ( - (SogItems)readBinary.ReadInt32(), - (int)readBinary.ReadInt32() - )); + playerObject.MerchantItems.Add(new MerchantItem + { + ItemID = (SogItems)readBinary.ReadInt32(), + ItemCount = readBinary.ReadInt32() + }); } + + txtConsole.AppendText("\r\nAfter-MerchantItems Position: " + readBinary.BaseStream.Position.ToString("X")); + txtConsole.AppendText("\r\nItemCountMerchant: " + playerObject.MerchantItemsCount); playerObject.CardsCount = readBinary.ReadInt32(); //How many cards do we need to count playerObject.Cards = new List(playerObject.CardsCount); + txtConsole.AppendText("\r\nCards Position: " + readBinary.BaseStream.Position.ToString("X")); + for (int i = 0; i != playerObject.CardsCount; i++) { playerObject.Cards.Add(new Card - ( - (SogEnemies)readBinary.ReadInt32() - )); + { + CardID = (SogEnemies)readBinary.ReadInt32() + }); } + txtConsole.AppendText("\r\nAfter-Cards Position: " + readBinary.BaseStream.Position.ToString("X")); + txtConsole.AppendText("\r\nCardsCount: " + playerObject.CardsCount); playerObject.TreasureMapsCount = readBinary.ReadInt32(); //How many Treasure Maps do we need to count playerObject.TreasureMaps = new List(playerObject.TreasureMapsCount); + txtConsole.AppendText("\r\nTreasuremaps Position: " + readBinary.BaseStream.Position.ToString("X")); for (int i = 0; i != playerObject.TreasureMapsCount; i++) { playerObject.TreasureMaps.Add(new TreasureMap - ( - readBinary.ReadInt16() - )); + { + TreasureMapID = readBinary.ReadInt16() + }); } + txtConsole.AppendText("\r\nCards Position: " + readBinary.BaseStream.Position.ToString("X")); + txtConsole.AppendText("\r\nTreasureMapCount: " + playerObject.TreasureMapsCount); playerObject.UnknownVariable01Count = readBinary.ReadInt32(); //How many Unknown Int16 do we need to count @@ -130,9 +155,9 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) for (int i = 0; i != playerObject.UnknownVariable01Count; i++) { playerObject.UnknownVariables01.Add(new UnknownVariable01 - ( - readBinary.ReadInt16() - )); + { + UnknownVariable01ID = readBinary.ReadInt16() + }); } txtConsole.AppendText("\r\nUnknownCount: " + playerObject.UnknownVariable01Count); @@ -141,11 +166,12 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) for (int i = 0; i != playerObject.SkillsCount; i++) { playerObject.Skills.Add(new Skill - ( - (SogSkills)readBinary.ReadInt16(), - readBinary.ReadByte() - )); + { + SkillID = (SogSkills)readBinary.ReadInt16(), + SkillLevel = readBinary.ReadByte() + }); } + txtConsole.AppendText("\r\nSkillCount: " + playerObject.SkillsCount); playerObject.Level = readBinary.ReadInt16(); //Level @@ -204,9 +230,9 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) for (int i = 0; i != playerObject.QuestsCount; i++) { playerObject.Quests.Add(new Quest - ( - readBinary.ReadUInt16() - )); + { + QuestID = readBinary.ReadUInt16() + }); } txtConsole.AppendText("\r\n" + "QuestsCount: " + playerObject.QuestsCount); @@ -226,9 +252,9 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) for (int i = 0; i != playerObject.UnknownVariable02Count; i++) { playerObject.UnknownVariables02.Add(new UnknownVariable02 - ( - readBinary.ReadByte() - )); + { + UnknownByte = readBinary.ReadByte() + }); } txtConsole.AppendText("\r\n" + "UnknownVariable02Count: " + playerObject.UnknownVariable02Count); @@ -240,9 +266,9 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) for (int i = 0; i != playerObject.UnknownVariable03Count; i++) { playerObject.UnknownVariables03.Add(new UnknownVariable03 - ( - readBinary.ReadUInt16() - )); + { + UnknownVariable = readBinary.ReadUInt16() + }); } txtConsole.AppendText("\r\n" + "UnknownVariable03Count: " + playerObject.UnknownVariable03Count); @@ -251,9 +277,9 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) for (int i = 0; i != playerObject.ItemsMetCount; i++) { playerObject.ItemsMet.Add(new ItemsSeen - ( - (SogItems)readBinary.ReadInt32() - )); + { + ItemID = (SogItems)readBinary.ReadInt32() + }); } txtConsole.AppendText("\r\n" + "ItemsMetCount: " + playerObject.ItemsMetCount); @@ -262,9 +288,9 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) for (int i = 0; i != playerObject.ItemsCraftedCount; i++) { playerObject.ItemsCrafted.Add(new ItemCrafted - ( - (SogItems)readBinary.ReadInt32() - )); + { + ItemID = (SogItems)readBinary.ReadInt32() + }); } txtConsole.AppendText("\r\n" + "ItemsCraftedCount: " + playerObject.ItemsCraftedCount); @@ -273,9 +299,9 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) for (int i = 0; i != playerObject.FishiesCaughtCount; i++) { playerObject.FishiesCaught.Add(new FishCaught - ( - (SogItems)readBinary.ReadInt32() - )); + { + FishID = (SogItems)readBinary.ReadInt32() + }); } txtConsole.AppendText("\r\n" + "FishiesCaughtCount: " + playerObject.FishiesCaughtCount); @@ -284,9 +310,10 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) for (int i = 0; i != playerObject.KilledEnemiesCount; i++) { playerObject.KilledEnemies.Add(new KilledEnemy - ( - readBinary.ReadInt32(), readBinary.ReadInt32() - )); + { + EnemyID = readBinary.ReadInt32(), + KillCount = readBinary.ReadInt32() + }); } txtConsole.AppendText("\r\n" + "KilledEnemiesCount: " + playerObject.KilledEnemiesCount); @@ -300,9 +327,9 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) for (int i = 0; i != playerObject.PotionsEquipped; i++) { playerObject.Potions.Add(new Potion - ( - readBinary.ReadInt32() - )); + { + PotionID = readBinary.ReadInt32() + }); } playerObject.BirthdayMonth = readBinary.ReadInt32(); @@ -322,10 +349,10 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) { string unknownString = readBinary.ReadString(); playerObject.UnknownVariables07.Add(new UnknownVariable07 - ( - unknownString, - readBinary.ReadSingle() - )); + { + UnknownString = unknownString, + UnknownFloat = readBinary.ReadSingle() + }); txtConsole.AppendText("\r\nUnknownstring: " + unknownString); } @@ -335,9 +362,9 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) for (int i = 0; i != playerObject.FlagsCount; i++) { playerObject.Flags.Add(new Flag - ( - readBinary.ReadUInt16() - )); + { + FlagID = readBinary.ReadUInt16() + }); } txtConsole.AppendText("\r\nFlagsCount: " + playerObject.FlagsCount); @@ -353,11 +380,13 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) { styleBytes[j] = readBinary.ReadByte(); } - + // add the housestyle to the list playerObject.Houses.Add(new HouseStyle - ( - styleNumber, styleLength, styleBytes - )); + { + HouseStyleNumber = styleNumber, + HouseStyleLength = styleLength, + HouseStyleBytes = styleBytes + }); } txtConsole.AppendText("\r\nHouseStylesCount: " + playerObject.HouseStylesCount); diff --git a/SoG_SGreader/Enum/SogEnemies.cs b/SoG_SGreader/Enum/SogEnemies.cs index 2a54278..586885b 100644 --- a/SoG_SGreader/Enum/SogEnemies.cs +++ b/SoG_SGreader/Enum/SogEnemies.cs @@ -1,6 +1,6 @@ namespace SoG_SGreader { - public enum SogEnemies + public enum SogEnemies: int { Null = -1, GreenSlime = 0, diff --git a/SoG_SGreader/Enum/SogItems.cs b/SoG_SGreader/Enum/SogItems.cs index 5804bd2..38758e0 100644 --- a/SoG_SGreader/Enum/SogItems.cs +++ b/SoG_SGreader/Enum/SogItems.cs @@ -2,7 +2,7 @@ { // Source: Secrets of Grindea: SoG.ItemCodex // Game Version: 0.99g - public enum SogItems + public enum SogItems: int { Null = -1, Apple = 0, diff --git a/SoG_SGreader/Enum/SogPets.cs b/SoG_SGreader/Enum/SogPets.cs index 22199e7..96646a8 100644 --- a/SoG_SGreader/Enum/SogPets.cs +++ b/SoG_SGreader/Enum/SogPets.cs @@ -2,7 +2,7 @@ { // Source: Secrets of Grindea: SoG.NPCCodex // Game Version: 0.99c - public enum SogPets + public enum SogPets: int { Rabby = 0x2710, Slimy = 0x2711, diff --git a/SoG_SGreader/Forms/FrmMain.cs b/SoG_SGreader/Forms/FrmMain.cs index 6112387..05cddb4 100644 --- a/SoG_SGreader/Forms/FrmMain.cs +++ b/SoG_SGreader/Forms/FrmMain.cs @@ -333,11 +333,16 @@ private void GetDataFromFields() for (int i = 0; i != lstInventory.Items.Count; i++) { - Item item = new Item( - (SogItems)Enum.Parse(typeof(SogItems), lstInventory.Items[i].SubItems[0].Text), - Int32.Parse(lstInventory.Items[i].SubItems[1].Text), - UInt32.Parse(lstInventory.Items[i].SubItems[2].Text) - ); + var itemId = (SogItems)Enum.Parse(typeof(SogItems), lstInventory.Items[i].SubItems[0].Text); + var itemCount = Int32.Parse(lstInventory.Items[i].SubItems[1].Text); + var itemPos = UInt32.Parse(lstInventory.Items[i].SubItems[2].Text); + + Item item = new Item + { + ItemID = itemId, + ItemCount = itemCount, + ItemPos = itemPos + }; playerObject.Inventory.Add(item); } @@ -399,9 +404,9 @@ private void GetDataFromFields() if (cblstCards.GetItemChecked(i)) { playerObject.Cards.Add( - new Card( - (SogEnemies)Enum.Parse(typeof(SogEnemies), cblstCards.Items[i].ToString()) - ) + new Card{ + CardID = (SogEnemies)Enum.Parse(typeof(SogEnemies), cblstCards.Items[i].ToString()) + } ); } } diff --git a/SoG_SGreader/Objects/Card.cs b/SoG_SGreader/Objects/Card.cs index 07bb9c6..135db22 100644 --- a/SoG_SGreader/Objects/Card.cs +++ b/SoG_SGreader/Objects/Card.cs @@ -1,12 +1,8 @@ namespace SoG_SGreader { + [System.Serializable] public class Card { public SogEnemies CardID { get; set; } - - public Card(SogEnemies cardId) - { - this.CardID = cardId; - } } } \ No newline at end of file diff --git a/SoG_SGreader/Objects/Enemy.cs b/SoG_SGreader/Objects/Enemy.cs index f4a72ed..468eece 100644 --- a/SoG_SGreader/Objects/Enemy.cs +++ b/SoG_SGreader/Objects/Enemy.cs @@ -1,5 +1,6 @@ namespace SoG_SGreader { + [System.Serializable] public class Enemy { public int EnemyID { get; set; } diff --git a/SoG_SGreader/Objects/Equip.cs b/SoG_SGreader/Objects/Equip.cs index 3ae7dd9..d2d2dd4 100644 --- a/SoG_SGreader/Objects/Equip.cs +++ b/SoG_SGreader/Objects/Equip.cs @@ -1,5 +1,6 @@ namespace SoG_SGreader { + [System.Serializable] public class Equip { public int Hat { get; set; } diff --git a/SoG_SGreader/Objects/FishCaught.cs b/SoG_SGreader/Objects/FishCaught.cs index a72c516..cd9098d 100644 --- a/SoG_SGreader/Objects/FishCaught.cs +++ b/SoG_SGreader/Objects/FishCaught.cs @@ -1,12 +1,8 @@ namespace SoG_SGreader { + [System.Serializable] public class FishCaught { public SogItems FishID { get; set; } - - public FishCaught(SogItems fishId) - { - this.FishID = fishId; - } } } \ No newline at end of file diff --git a/SoG_SGreader/Objects/Flag.cs b/SoG_SGreader/Objects/Flag.cs index 7063493..8fd4e4c 100644 --- a/SoG_SGreader/Objects/Flag.cs +++ b/SoG_SGreader/Objects/Flag.cs @@ -1,14 +1,8 @@ -using System; - namespace SoG_SGreader -{ +{ + [System.Serializable] public class Flag { - public UInt16 FlagID { get; set; } - - public Flag(UInt16 flagId) - { - this.FlagID = flagId; - } + public ushort FlagID { get; set; } } } \ No newline at end of file diff --git a/SoG_SGreader/Objects/HouseStyle.cs b/SoG_SGreader/Objects/HouseStyle.cs index d3c8685..c2487c7 100644 --- a/SoG_SGreader/Objects/HouseStyle.cs +++ b/SoG_SGreader/Objects/HouseStyle.cs @@ -1,16 +1,10 @@ namespace SoG_SGreader { + [System.Serializable] public class HouseStyle { public byte HouseStyleNumber { get; set; } //style 0, 1, 2 etc public int HouseStyleLength { get; set; } public byte[] HouseStyleBytes { get; set; } - - public HouseStyle(byte houseStyleNumber, int houseStyleLength, byte[] houseStyleBytes) - { - this.HouseStyleNumber = houseStyleNumber; - this.HouseStyleLength = houseStyleLength; - this.HouseStyleBytes = houseStyleBytes; - } } } \ No newline at end of file diff --git a/SoG_SGreader/Objects/Item.cs b/SoG_SGreader/Objects/Item.cs index 3165668..ebdca1c 100644 --- a/SoG_SGreader/Objects/Item.cs +++ b/SoG_SGreader/Objects/Item.cs @@ -2,17 +2,12 @@ namespace SoG_SGreader { + [System.Serializable] public class Item { public SogItems ItemID { get; set; } public int ItemCount { get; set; } - public UInt32 ItemPos { get; set; } - public Item(SogItems _ItemID, int _ItemCount, UInt32 _ItemPos) - { - this.ItemID = _ItemID; - this.ItemCount = _ItemCount; - this.ItemPos = _ItemPos; - } + public uint ItemPos { get; set; } public override bool Equals(object obj) { @@ -22,7 +17,7 @@ public override bool Equals(object obj) return false; } - return this.ItemID == item.ItemID && this.ItemCount == item.ItemCount && this.ItemPos == item.ItemPos; + return ItemID == item.ItemID && ItemCount == item.ItemCount && ItemPos == item.ItemPos; } } } \ No newline at end of file diff --git a/SoG_SGreader/Objects/ItemCrafted.cs b/SoG_SGreader/Objects/ItemCrafted.cs index 7031c6d..00e845c 100644 --- a/SoG_SGreader/Objects/ItemCrafted.cs +++ b/SoG_SGreader/Objects/ItemCrafted.cs @@ -1,12 +1,8 @@ namespace SoG_SGreader { + [System.Serializable] public class ItemCrafted { public SogItems ItemID { get; set; } - - public ItemCrafted(SogItems itemId) - { - this.ItemID = itemId; - } } } \ No newline at end of file diff --git a/SoG_SGreader/Objects/KilledEnemy.cs b/SoG_SGreader/Objects/KilledEnemy.cs index e18186e..69e1f4e 100644 --- a/SoG_SGreader/Objects/KilledEnemy.cs +++ b/SoG_SGreader/Objects/KilledEnemy.cs @@ -1,14 +1,9 @@ namespace SoG_SGreader { + [System.Serializable] public class KilledEnemy { public int EnemyID { get; set; } public int KillCount { get; set; } - public KilledEnemy(int enemyId, int killCount) - { - this.EnemyID = enemyId; - this.KillCount = killCount; - } - } } \ No newline at end of file diff --git a/SoG_SGreader/Objects/MerchantItem.cs b/SoG_SGreader/Objects/MerchantItem.cs index 223bf78..4ec6f63 100644 --- a/SoG_SGreader/Objects/MerchantItem.cs +++ b/SoG_SGreader/Objects/MerchantItem.cs @@ -1,12 +1,8 @@ namespace SoG_SGreader { + [System.Serializable] public class MerchantItem { - public MerchantItem(SogItems _ItemID, int _ItemCount) - { - this.ItemID = _ItemID; - this.ItemCount = _ItemCount; - } public SogItems ItemID { get; set; } public int ItemCount { get; set; } } diff --git a/SoG_SGreader/Objects/Pet.cs b/SoG_SGreader/Objects/Pet.cs index 689e647..3480444 100644 --- a/SoG_SGreader/Objects/Pet.cs +++ b/SoG_SGreader/Objects/Pet.cs @@ -2,9 +2,9 @@ namespace SoG_SGreader { + [System.Serializable] public class Pet { - public int Type1 { get; set; } public int Type2 { get; set; } public string Nickname { get; set; } @@ -22,6 +22,5 @@ public class Pet public UInt16 StatProgressDamage { get; set; } public UInt16 StatProgressCrit { get; set; } public UInt16 StatProgressSpeed { get; set; } - } } \ No newline at end of file diff --git a/SoG_SGreader/Objects/Player.ItemsSeen.cs b/SoG_SGreader/Objects/Player.ItemsSeen.cs index 33c911e..09d1a8c 100644 --- a/SoG_SGreader/Objects/Player.ItemsSeen.cs +++ b/SoG_SGreader/Objects/Player.ItemsSeen.cs @@ -1,12 +1,8 @@ namespace SoG_SGreader { + [System.Serializable] public class ItemsSeen { public SogItems ItemID { get; set; } - - public ItemsSeen(SogItems itemId) - { - this.ItemID = itemId; - } } } \ No newline at end of file diff --git a/SoG_SGreader/Objects/Player.cs b/SoG_SGreader/Objects/Player.cs index 524e393..4f63e93 100644 --- a/SoG_SGreader/Objects/Player.cs +++ b/SoG_SGreader/Objects/Player.cs @@ -1,11 +1,11 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Runtime.Serialization; namespace SoG_SGreader { - public partial class Player + [Serializable] + public class Player { public int MagicByte { get; set; } public int LastTwoHander { get; set; } @@ -31,35 +31,35 @@ public partial class Player public List UnknownVariables01; public int SkillsCount { get; set; } public List Skills; - public Int16 Level { get; set; } + public short Level { get; set; } public int ExpCurrent { get; set; } public int ExpUnknown0 { get; set; } public int ExpUnknown1 { get; set; } - public Int16 SkillTalentPoints { get; set; } - public Int16 SkillSilverPoints { get; set; } - public Int16 SkillGoldPoints { get; set; } + public short SkillTalentPoints { get; set; } + public short SkillSilverPoints { get; set; } + public short SkillGoldPoints { get; set; } public int Cash { get; set; } public byte PetsCount { get; set; } public List Pets; public int PetsSelected { get; set; } public byte PetHidden { get; set; } - public UInt16 QuestsCount { get; set; } + public ushort QuestsCount { get; set; } public List Quests; - public UInt16 EnemiesMetCount { get; set; } + public ushort EnemiesMetCount { get; set; } public List Enemies; - public UInt16 UnknownVariable02Count { get; set; } //something to do with challenges? + public ushort UnknownVariable02Count { get; set; } //something to do with challenges? public List UnknownVariables02; public int RobinBowHighscore { get; set; } - public UInt16 UnknownVariable03Count { get; set; } //trophies? + public ushort UnknownVariable03Count { get; set; } //trophies? public List UnknownVariables03; - public UInt16 ItemsMetCount { get; set; } + public ushort ItemsMetCount { get; set; } public List ItemsMet; - public UInt16 ItemsCraftedCount { get; set; } + public ushort ItemsCraftedCount { get; set; } public List ItemsCrafted; - public UInt16 FishiesCaughtCount { get; set; } + public ushort FishiesCaughtCount { get; set; } public List FishiesCaught; - public UInt16 KilledEnemiesCount { get; set; } + public ushort KilledEnemiesCount { get; set; } public List KilledEnemies; public byte PotionsMax { get; set; } public byte PotionsEquipped { get; set; } @@ -71,19 +71,19 @@ public partial class Player public int UnknownVariable05 { get; set; } // saving mechanism related public int PlayTimeTotal { get; set; } // saved in frames public byte UnknownVariable06 { get; set; } //?? - public Int16 UnknownVariable07Count { get; set; } + public short UnknownVariable07Count { get; set; } public List UnknownVariables07; - public Int16 FlagsCount { get; set; } + public short FlagsCount { get; set; } public List Flags; public byte HouseStylesCount { get; set; } public List Houses; - public byte GetSkillLevel(SogSkills skillId) + internal byte GetSkillLevel(SogSkills skillId) { return Skills.FirstOrDefault(skill => skill.SkillID == skillId)?.SkillLevel ?? 0; } - public byte GetSkillLevel(Skill skill) + internal byte GetSkillLevel(Skill skill) { return Skills.FirstOrDefault(s => s.SkillID == skill.SkillID)?.SkillLevel ?? 0; } @@ -98,7 +98,10 @@ internal void AddCard(SogEnemies sogEnemies) // add card to player, dont add duplicates if (!HasCard(sogEnemies)) { - Cards.Add(new Card(sogEnemies)); + Cards.Add(new Card + { + CardID = sogEnemies + }); } } diff --git a/SoG_SGreader/Objects/Potion.cs b/SoG_SGreader/Objects/Potion.cs index 32b9680..2d7f2bf 100644 --- a/SoG_SGreader/Objects/Potion.cs +++ b/SoG_SGreader/Objects/Potion.cs @@ -1,12 +1,8 @@ namespace SoG_SGreader { + [System.Serializable] public class Potion { public int PotionID { get; set; } - - public Potion(int potionId) - { - this.PotionID = potionId; - } } } \ No newline at end of file diff --git a/SoG_SGreader/Objects/Quest.cs b/SoG_SGreader/Objects/Quest.cs index 5a20b55..9f4e0e2 100644 --- a/SoG_SGreader/Objects/Quest.cs +++ b/SoG_SGreader/Objects/Quest.cs @@ -2,13 +2,9 @@ namespace SoG_SGreader { + [System.Serializable] public class Quest { - public UInt16 QuestID { get; set; } - - public Quest(UInt16 questId) - { - this.QuestID = questId; - } + public ushort QuestID { get; set; } } } \ No newline at end of file diff --git a/SoG_SGreader/Objects/Skill.cs b/SoG_SGreader/Objects/Skill.cs index 20ba4f1..157430d 100644 --- a/SoG_SGreader/Objects/Skill.cs +++ b/SoG_SGreader/Objects/Skill.cs @@ -1,13 +1,9 @@ namespace SoG_SGreader { + [System.Serializable] public class Skill { public SogSkills SkillID { get; set; } public byte SkillLevel { get; set; } - public Skill(SogSkills skillId, byte skillLevel) - { - this.SkillID = skillId; - this.SkillLevel = skillLevel; - } } } \ No newline at end of file diff --git a/SoG_SGreader/Objects/Style.cs b/SoG_SGreader/Objects/Style.cs index 9dc6c4c..20a38b6 100644 --- a/SoG_SGreader/Objects/Style.cs +++ b/SoG_SGreader/Objects/Style.cs @@ -1,5 +1,6 @@ namespace SoG_SGreader { + [System.Serializable] public class Style { public char Bodytype { get; set; } diff --git a/SoG_SGreader/Objects/TreasureMap.cs b/SoG_SGreader/Objects/TreasureMap.cs index 9e959f1..f09f30f 100644 --- a/SoG_SGreader/Objects/TreasureMap.cs +++ b/SoG_SGreader/Objects/TreasureMap.cs @@ -1,14 +1,8 @@ -using System; - namespace SoG_SGreader { + [System.Serializable] public class TreasureMap { - public Int16 TreasureMapID { get; set; } - - public TreasureMap(Int16 treasureMapID) - { - this.TreasureMapID = treasureMapID; - } + public short TreasureMapID { get; set; } } } \ No newline at end of file diff --git a/SoG_SGreader/Objects/UnknownVariable01.cs b/SoG_SGreader/Objects/UnknownVariable01.cs index 03e49c4..1c4c5db 100644 --- a/SoG_SGreader/Objects/UnknownVariable01.cs +++ b/SoG_SGreader/Objects/UnknownVariable01.cs @@ -2,13 +2,9 @@ namespace SoG_SGreader { + [System.Serializable] public class UnknownVariable01 { public Int16 UnknownVariable01ID { get; set; } - - public UnknownVariable01(Int16 unknownVariable01Id) - { - this.UnknownVariable01ID = unknownVariable01Id; - } } } \ No newline at end of file diff --git a/SoG_SGreader/Objects/UnknownVariable02.cs b/SoG_SGreader/Objects/UnknownVariable02.cs index d39453b..dad2dcf 100644 --- a/SoG_SGreader/Objects/UnknownVariable02.cs +++ b/SoG_SGreader/Objects/UnknownVariable02.cs @@ -1,12 +1,8 @@ namespace SoG_SGreader { + [System.Serializable] public class UnknownVariable02 { public byte UnknownByte { get; set; } - - public UnknownVariable02(byte unknownByte) - { - this.UnknownByte = unknownByte; - } } } \ No newline at end of file diff --git a/SoG_SGreader/Objects/UnknownVariable03.cs b/SoG_SGreader/Objects/UnknownVariable03.cs index 3aacb22..e82a487 100644 --- a/SoG_SGreader/Objects/UnknownVariable03.cs +++ b/SoG_SGreader/Objects/UnknownVariable03.cs @@ -2,13 +2,9 @@ namespace SoG_SGreader { + [System.Serializable] public class UnknownVariable03 { public UInt16 UnknownVariable { get; set; } - - public UnknownVariable03(UInt16 unknownVariable) - { - this.UnknownVariable = unknownVariable; - } } } \ No newline at end of file diff --git a/SoG_SGreader/Objects/UnknownVariable07.cs b/SoG_SGreader/Objects/UnknownVariable07.cs index 820a10a..3b679db 100644 --- a/SoG_SGreader/Objects/UnknownVariable07.cs +++ b/SoG_SGreader/Objects/UnknownVariable07.cs @@ -1,12 +1,8 @@ namespace SoG_SGreader { + [System.Serializable] public class UnknownVariable07 //.archie.....lmb...C { - public UnknownVariable07(string unknownString, float unknownFloat) - { - this.UnknownString = unknownString; - this.UnknownFloat = unknownFloat; - } public string UnknownString { get; set; } public float UnknownFloat { get; set; } }