From 46e34f6a986e935108757c45c1c2c183b23ca97b Mon Sep 17 00:00:00 2001 From: tolik518 Date: Wed, 21 Feb 2024 23:26:09 +0100 Subject: [PATCH] fixes: - fixed mangling with the time on save added: - seen enemies editing refactorings: - renamed variables - added more typehints - using .count instead of the dedicated count variable --- SoG_SGreader.Test/IntegrationTests.cs | 2 +- SoG_SGreader/DataReader.cs | 82 +++--- SoG_SGreader/DataWriter.cs | 87 +++--- SoG_SGreader/Forms/FrmMain.Designer.cs | 315 +++++++++++++--------- SoG_SGreader/Forms/FrmMain.cs | 88 +++++- SoG_SGreader/Objects/CharacterFlags.cs | 8 + SoG_SGreader/Objects/Enemy.cs | 2 +- SoG_SGreader/Objects/HouseStyle.cs | 6 +- SoG_SGreader/Objects/Player.cs | 30 ++- SoG_SGreader/Objects/Trophy.cs | 7 + SoG_SGreader/Objects/UnknownVariable03.cs | 7 - SoG_SGreader/Objects/UnknownVariable07.cs | 8 - SoG_SGreader/SoG_SGreader.csproj | 20 +- 13 files changed, 396 insertions(+), 266 deletions(-) create mode 100644 SoG_SGreader/Objects/CharacterFlags.cs create mode 100644 SoG_SGreader/Objects/Trophy.cs delete mode 100644 SoG_SGreader/Objects/UnknownVariable03.cs delete mode 100644 SoG_SGreader/Objects/UnknownVariable07.cs diff --git a/SoG_SGreader.Test/IntegrationTests.cs b/SoG_SGreader.Test/IntegrationTests.cs index 75df916..46d4de0 100644 --- a/SoG_SGreader.Test/IntegrationTests.cs +++ b/SoG_SGreader.Test/IntegrationTests.cs @@ -90,7 +90,7 @@ public void TestTextOutput() Assert.Contains("Filesize: 4494", output); Assert.Contains("Birthday: 24.6.1081", output); - Assert.Contains("ItemsMetCount: 124", output); + Assert.Contains("ItemsSeenCount: 124", output); Assert.Contains("KilledEnemiesCount: 58", output); } diff --git a/SoG_SGreader/DataReader.cs b/SoG_SGreader/DataReader.cs index d7c4b8a..6ba4906 100644 --- a/SoG_SGreader/DataReader.cs +++ b/SoG_SGreader/DataReader.cs @@ -224,12 +224,6 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) playerObject.PetHidden = readBinary.ReadByte(); - // | // - // | // - // new stuff // - // we're not editing // - // yet // - playerObject.QuestsCount = readBinary.ReadUInt16(); txtConsole.AppendText("\r\n" + "> QuestsCount Position: " + readBinary.BaseStream.Position.ToString("X")); @@ -243,18 +237,24 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) } txtConsole.AppendText("\r\n" + "QuestsCount: " + playerObject.QuestsCount); - txtConsole.AppendText("\r\n" + "> EnemiesMetCount Position: " + readBinary.BaseStream.Position.ToString("X")); - playerObject.EnemiesMetCount = readBinary.ReadUInt16(); - playerObject.Enemies = new List(playerObject.EnemiesMetCount); - for (int i = 0; i != playerObject.EnemiesMetCount; i++) + txtConsole.AppendText("\r\n" + "> EnemiesSeenCount Position: " + readBinary.BaseStream.Position.ToString("X")); + playerObject.EnemiesSeenCount = readBinary.ReadUInt16(); + playerObject.EnemiesSeen = new List(playerObject.EnemiesSeenCount); + for (int i = 0; i != playerObject.EnemiesSeenCount; i++) { - playerObject.Enemies.Add(new Enemy + playerObject.EnemiesSeen.Add(new Enemy { - EnemyID = readBinary.ReadInt32() + EnemyID = (SogEnemy) readBinary.ReadInt32() }); } - txtConsole.AppendText("\r\n" + "EnemiesMetCount: " + playerObject.EnemiesMetCount); - txtConsole.AppendText("\r\n" + "> EnemiesMetCount Position: " + readBinary.BaseStream.Position.ToString("X")); + txtConsole.AppendText("\r\n" + "EnemiesSeenCount: " + playerObject.EnemiesSeenCount); + txtConsole.AppendText("\r\n" + "> EnemiesSeenCount Position: " + readBinary.BaseStream.Position.ToString("X")); + + // | // + // | // + // new stuff // + // we're not editing // + // yet // playerObject.UnknownVariable02Count = (UInt16)(readBinary.ReadUInt16() * 16); // there are X sequences, each 10 bytes long txtConsole.AppendText("\r\n" + "UnknownVariable02Count: " + playerObject.UnknownVariable02Count); @@ -275,26 +275,26 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) txtConsole.AppendText("\r\n" + "RobinBowHighscore: " + playerObject.RobinBowHighscore); txtConsole.AppendText("\r\n" + "> RobinBowHighscore Position: " + readBinary.BaseStream.Position.ToString("X")); - playerObject.UnknownVariable03Count = (UInt16)(readBinary.ReadUInt16()); - playerObject.UnknownVariables03 = new List(playerObject.UnknownVariable03Count); - for (int i = 0; i != playerObject.UnknownVariable03Count; i++) + playerObject.TrophiesCount = (UInt16)(readBinary.ReadUInt16()); + playerObject.Trophies = new List(playerObject.TrophiesCount); + for (int i = 0; i != playerObject.TrophiesCount; i++) { - playerObject.UnknownVariables03.Add(new UnknownVariable03 + playerObject.Trophies.Add(new Trophy { - UnknownVariable = readBinary.ReadUInt16() + TrophyID = readBinary.ReadUInt16() }); } - txtConsole.AppendText("\r\n" + "UnknownVariable03Count: " + playerObject.UnknownVariable03Count); - txtConsole.AppendText("\r\n" + "> UnknownVariable03Count Position: " + readBinary.BaseStream.Position.ToString("X")); + txtConsole.AppendText("\r\n" + "TrophiesCount: " + playerObject.TrophiesCount); + txtConsole.AppendText("\r\n" + "> TrophiesCount Position: " + readBinary.BaseStream.Position.ToString("X")); - playerObject.ItemsMetCount = (UInt16)(readBinary.ReadUInt16()); - txtConsole.AppendText("\r\n" + "ItemsMetCount: " + playerObject.ItemsMetCount); - txtConsole.AppendText("\r\n" + "> ItemsMetCount Position: " + readBinary.BaseStream.Position.ToString("X")); + playerObject.ItemsSeenCount = (UInt16)(readBinary.ReadUInt16()); + txtConsole.AppendText("\r\n" + "ItemsSeenCount: " + playerObject.ItemsSeenCount); + txtConsole.AppendText("\r\n" + "> ItemsSeenCount Position: " + readBinary.BaseStream.Position.ToString("X")); - playerObject.ItemsMet = new List(playerObject.ItemsMetCount); - for (int i = 0; i != playerObject.ItemsMetCount; i++) + playerObject.ItemsSeen = new List(playerObject.ItemsSeenCount); + for (int i = 0; i != playerObject.ItemsSeenCount; i++) { - playerObject.ItemsMet.Add(new ItemsSeen + playerObject.ItemsSeen.Add(new ItemsSeen { ItemID = (SogItem)readBinary.ReadInt32() }); @@ -367,23 +367,23 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) playerObject.UniquePlayerId = readBinary.ReadUInt32(); txtConsole.AppendText("\r\n" + "UniquePlayerId: " + playerObject.UniquePlayerId); txtConsole.AppendText("\r\n" + "> UniquePlayerId Position: " + readBinary.BaseStream.Position.ToString("X")); - playerObject.UnknownVariable04 = readBinary.ReadInt32(); - playerObject.UnknownVariable05 = readBinary.ReadInt32(); + playerObject.LastAutosave = readBinary.ReadInt32(); + playerObject.SaveUnknown = readBinary.ReadInt32(); playerObject.PlayTimeTotal = readBinary.ReadInt32(); txtConsole.AppendText("\r\n" + "PlayTimeTotal: " + playerObject.PlayTimeTotal); txtConsole.AppendText("\r\n" + "> PlayTimeTotal Position: " + readBinary.BaseStream.Position.ToString("X")); txtConsole.AppendText("\r\nPlayTimeTotal: " + Math.Round((double)playerObject.PlayTimeTotal / 60 / 60 / 60, 2) + " hours"); - playerObject.UnknownVariable06 = readBinary.ReadByte(); + playerObject.PhaseShiftStuff = readBinary.ReadByte(); - playerObject.UnknownVariable07Count = readBinary.ReadInt16(); - playerObject.UnknownVariables07 = new List(playerObject.UnknownVariable07Count); - for (int i = 0; i != playerObject.UnknownVariable07Count; i++) + playerObject.CharacterFlagCount = readBinary.ReadInt16(); + playerObject.CharacterFlags = new List(playerObject.CharacterFlagCount); + for (int i = 0; i != playerObject.CharacterFlagCount; i++) { string unknownString = readBinary.ReadString(); - playerObject.UnknownVariables07.Add(new UnknownVariable07 + playerObject.CharacterFlags.Add(new CharacterFlags { - UnknownString = unknownString, - UnknownFloat = readBinary.ReadSingle() + Name = unknownString, + Value = readBinary.ReadSingle() }); txtConsole.AppendText("\r\nUnknownstring: " + unknownString); @@ -401,7 +401,7 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) txtConsole.AppendText("\r\nFlagsCount: " + playerObject.FlagsCount); playerObject.HouseStylesCount = readBinary.ReadByte(); - playerObject.Houses = new List(playerObject.HouseStylesCount); + playerObject.HouseStyles = new List(playerObject.HouseStylesCount); for (int i = 0; i != playerObject.HouseStylesCount; i++) { byte styleNumber = readBinary.ReadByte(); @@ -413,11 +413,11 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) styleBytes[j] = readBinary.ReadByte(); } // add the housestyle to the list - playerObject.Houses.Add(new HouseStyle + playerObject.HouseStyles.Add(new HouseStyle { - HouseStyleNumber = styleNumber, - HouseStyleLength = styleLength, - HouseStyleBytes = styleBytes + Number = styleNumber, + Length = styleLength, + Bytes = styleBytes }); } diff --git a/SoG_SGreader/DataWriter.cs b/SoG_SGreader/DataWriter.cs index 49956f8..9136119 100644 --- a/SoG_SGreader/DataWriter.cs +++ b/SoG_SGreader/DataWriter.cs @@ -65,7 +65,7 @@ public void WriteToFile(string fileName) writeBinary.Write((byte) style.Sex); writeBinary.Write(playerObject.Nickname); - writeBinary.Write(playerObject.ItemsCount); + writeBinary.Write((int) playerObject.ItemsCount); for (var i = 0; i != playerObject.ItemsCount; i++) { writeBinary.Write((int) playerObject.Inventory[i].ItemID); @@ -73,10 +73,11 @@ public void WriteToFile(string fileName) writeBinary.Write((int) playerObject.Inventory[i].ItemPos); } + // Inventory.DisplayItem.PickupNumberPool??? writeBinary.Write(playerObject.UnknownVariable0); - writeBinary.Write(playerObject.MerchantItemsCount); - for (var i = 0; i != playerObject.MerchantItemsCount; i++) + writeBinary.Write((int) playerObject.MerchantItems.Count); + for (var i = 0; i != playerObject.MerchantItems.Count; i++) { writeBinary.Write((int) playerObject.MerchantItems[i].ItemID); writeBinary.Write(playerObject.MerchantItems[i].ItemCount); @@ -88,22 +89,22 @@ public void WriteToFile(string fileName) writeBinary.Write((int) playerObject.Cards[i].CardID); } - writeBinary.Write(playerObject.TreasureMapsCount); - for (var i = 0; i != playerObject.TreasureMapsCount; i++) + writeBinary.Write((int) playerObject.TreasureMaps.Count); + for (var i = 0; i != playerObject.TreasureMaps.Count; i++) { writeBinary.Write(playerObject.TreasureMaps[i].TreasureMapID); } - writeBinary.Write(playerObject.UnknownVariable01Count); - for (var i = 0; i != playerObject.UnknownVariable01Count; i++) + writeBinary.Write((int) playerObject.UnknownVariables01.Count); + for (var i = 0; i != playerObject.UnknownVariables01.Count; i++) { writeBinary.Write(playerObject.UnknownVariables01[i].UnknownVariable01ID); } - writeBinary.Write(playerObject.SkillsCount); - for (var i = 0; i != playerObject.SkillsCount; i++) + writeBinary.Write((int) playerObject.Skills.Count); + for (var i = 0; i != playerObject.Skills.Count; i++) { - writeBinary.Write((short) playerObject.Skills[i].SkillID); + writeBinary.Write((ushort) playerObject.Skills[i].SkillID); writeBinary.Write(playerObject.Skills[i].SkillLevel); } @@ -149,48 +150,48 @@ public void WriteToFile(string fileName) writeBinary.Write((ushort) playerObject.Quests[i].QuestID); } - writeBinary.Write(playerObject.EnemiesMetCount); - for (int i = 0; i != playerObject.EnemiesMetCount; i++) + writeBinary.Write((ushort) playerObject.EnemiesSeen.Count); + for (int i = 0; i != playerObject.EnemiesSeen.Count; i++) { - writeBinary.Write((uint) playerObject.Enemies[i].EnemyID); + writeBinary.Write((int) playerObject.EnemiesSeen[i].EnemyID); } - writeBinary.Write((ushort) (playerObject.UnknownVariable02Count / 16)); - for (int i = 0; i != playerObject.UnknownVariable02Count; i++) + writeBinary.Write((ushort) (playerObject.UnknownVariables02.Count / 16)); + for (int i = 0; i != playerObject.UnknownVariables02.Count; i++) { writeBinary.Write(playerObject.UnknownVariables02[i].UnknownByte); } writeBinary.Write(playerObject.RobinBowHighscore); - writeBinary.Write(playerObject.UnknownVariable03Count); - for (int i = 0; i != playerObject.UnknownVariable03Count; i++) + writeBinary.Write((ushort) playerObject.Trophies.Count); + for (int i = 0; i != playerObject.Trophies.Count; i++) { - writeBinary.Write(playerObject.UnknownVariables03[i].UnknownVariable); + writeBinary.Write(playerObject.Trophies[i].TrophyID); } - writeBinary.Write(playerObject.ItemsMetCount); - for (int i = 0; i != playerObject.ItemsMetCount; i++) + writeBinary.Write((ushort)playerObject.ItemsSeen.Count); + for (int i = 0; i != playerObject.ItemsSeen.Count; i++) { - writeBinary.Write((int) playerObject.ItemsMet[i].ItemID); + writeBinary.Write((int) playerObject.ItemsSeen[i].ItemID); } - writeBinary.Write(playerObject.ItemsCraftedCount); - for (int i = 0; i != playerObject.ItemsCraftedCount; i++) + writeBinary.Write((ushort) playerObject.ItemsCrafted.Count); + for (int i = 0; i != playerObject.ItemsCrafted.Count; i++) { writeBinary.Write((int) playerObject.ItemsCrafted[i].ItemID); } - writeBinary.Write(playerObject.FishiesCaughtCount); - for (int i = 0; i != playerObject.FishiesCaughtCount; i++) + writeBinary.Write((ushort) playerObject.FishiesCaught.Count); + for (int i = 0; i != playerObject.FishiesCaught.Count; i++) { writeBinary.Write((int) playerObject.FishiesCaught[i].FishID); } - writeBinary.Write(playerObject.KilledEnemiesCount); - for (int i = 0; i != playerObject.KilledEnemiesCount; i++) + writeBinary.Write((ushort) playerObject.KilledEnemies.Count); + for (int i = 0; i != playerObject.KilledEnemies.Count; i++) { - writeBinary.Write(playerObject.KilledEnemies[i].EnemyID); + writeBinary.Write((int)playerObject.KilledEnemies[i].EnemyID); writeBinary.Write(playerObject.KilledEnemies[i].KillCount); } @@ -199,38 +200,38 @@ public void WriteToFile(string fileName) for (int i = 0; i != playerObject.PotionsEquipped; i++) { - writeBinary.Write(playerObject.Potions[i].PotionID); + writeBinary.Write((int) playerObject.Potions[i].PotionID); } writeBinary.Write(playerObject.BirthdayMonth); writeBinary.Write(playerObject.BirthdayDay); writeBinary.Write((int) playerObject.UniquePlayerId); - writeBinary.Write(playerObject.UnknownVariable04); - writeBinary.Write(playerObject.UnknownVariable05); + writeBinary.Write(playerObject.LastAutosave); + writeBinary.Write(playerObject.SaveUnknown); writeBinary.Write(playerObject.PlayTimeTotal); // check for overflow - writeBinary.Write((byte)playerObject.UnknownVariable06); + writeBinary.Write((byte )playerObject.PhaseShiftStuff); - writeBinary.Write((ushort) playerObject.UnknownVariable07Count); - for (int i = 0; i != playerObject.UnknownVariable07Count; i++) + writeBinary.Write((ushort) playerObject.CharacterFlags.Count); + for (int i = 0; i != playerObject.CharacterFlags.Count; i++) { - writeBinary.Write(playerObject.UnknownVariables07[i].UnknownString); - writeBinary.Write(playerObject.UnknownVariables07[i].UnknownFloat); + writeBinary.Write(playerObject.CharacterFlags[i].Name); + writeBinary.Write(playerObject.CharacterFlags[i].Value); } - writeBinary.Write((ushort) playerObject.FlagsCount); - for (int i = 0; i != playerObject.FlagsCount; i++) + writeBinary.Write((ushort) playerObject.Flags.Count); + for (int i = 0; i != playerObject.Flags.Count; i++) { writeBinary.Write(playerObject.Flags[i].FlagID); } - writeBinary.Write(playerObject.HouseStylesCount); - for (int i = 0; i != playerObject.HouseStylesCount; i++) + writeBinary.Write((byte) playerObject.HouseStyles.Count); + for (int i = 0; i != playerObject.HouseStyles.Count; i++) { - writeBinary.Write(playerObject.Houses[i].HouseStyleNumber); - writeBinary.Write(playerObject.Houses[i].HouseStyleLength); - writeBinary.Write(playerObject.Houses[i].HouseStyleBytes); + writeBinary.Write(playerObject.HouseStyles[i].Number); + writeBinary.Write(playerObject.HouseStyles[i].Length); + writeBinary.Write(playerObject.HouseStyles[i].Bytes); } writeBinary.Close(); diff --git a/SoG_SGreader/Forms/FrmMain.Designer.cs b/SoG_SGreader/Forms/FrmMain.Designer.cs index 3a655cb..deecfba 100644 --- a/SoG_SGreader/Forms/FrmMain.Designer.cs +++ b/SoG_SGreader/Forms/FrmMain.Designer.cs @@ -32,7 +32,7 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain)); - this.tabContainer = new System.Windows.Forms.TabControl(); + this.grpEnemiesSeen = new System.Windows.Forms.TabControl(); this.tabChar = new System.Windows.Forms.TabPage(); this.grpPatch = new System.Windows.Forms.GroupBox(); this.lblGamePatch = new System.Windows.Forms.Label(); @@ -149,6 +149,18 @@ private void InitializeComponent() this.btnResetCards = new System.Windows.Forms.Button(); this.btnDeselectAllCards = new System.Windows.Forms.Button(); this.cblstCards = new System.Windows.Forms.CheckedListBox(); + this.tabQuests = new System.Windows.Forms.TabPage(); + this.grpQuests = new System.Windows.Forms.GroupBox(); + this.btnSelectAllQuests = new System.Windows.Forms.Button(); + this.btnResetQuests = new System.Windows.Forms.Button(); + this.btnDeselectAllQuests = new System.Windows.Forms.Button(); + this.cblstQuests = new System.Windows.Forms.CheckedListBox(); + this.tabEnemiesSeen = new System.Windows.Forms.TabPage(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.btnSelectAllEnemiesSeen = new System.Windows.Forms.Button(); + this.btnResetEnemiesSeen = new System.Windows.Forms.Button(); + this.btnDeselectAllEnemiesSeen = new System.Windows.Forms.Button(); + this.cblstEnemiesSeens = new System.Windows.Forms.CheckedListBox(); this.tabQuickslots = new System.Windows.Forms.TabPage(); this.label57 = new System.Windows.Forms.Label(); this.grpQuickslots = new System.Windows.Forms.GroupBox(); @@ -243,16 +255,8 @@ private void InitializeComponent() this.tabTalentsGeneral = new System.Windows.Forms.TabPage(); this.tabTalentsMelee = new System.Windows.Forms.TabPage(); this.tabTalentsMagic = new System.Windows.Forms.TabPage(); - this.tabMerchant = new System.Windows.Forms.TabPage(); - this.label39 = new System.Windows.Forms.Label(); this.tabTreasureMaps = new System.Windows.Forms.TabPage(); this.label41 = new System.Windows.Forms.Label(); - this.tabPage1 = new System.Windows.Forms.TabPage(); - this.grpQuests = new System.Windows.Forms.GroupBox(); - this.btnSelectAllQuests = new System.Windows.Forms.Button(); - this.btnResetQuests = new System.Windows.Forms.Button(); - this.btnDeselectAllQuests = new System.Windows.Forms.Button(); - this.cblstQuests = new System.Windows.Forms.CheckedListBox(); this.msMenu = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -260,13 +264,14 @@ private void InitializeComponent() this.importToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.jSONToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openSavegameFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.txtConsole = new System.Windows.Forms.TextBox(); this.Tooltips = new System.Windows.Forms.ToolTip(this.components); this.pictureBox3 = new System.Windows.Forms.PictureBox(); - this.tabContainer.SuspendLayout(); + this.grpEnemiesSeen.SuspendLayout(); this.tabChar.SuspendLayout(); this.grpPatch.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numID)).BeginInit(); @@ -299,6 +304,10 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.numPetHP)).BeginInit(); this.tabCards.SuspendLayout(); this.grpCards.SuspendLayout(); + this.tabQuests.SuspendLayout(); + this.grpQuests.SuspendLayout(); + this.tabEnemiesSeen.SuspendLayout(); + this.groupBox1.SuspendLayout(); this.tabQuickslots.SuspendLayout(); this.grpQuickslots.SuspendLayout(); this.tabSkills.SuspendLayout(); @@ -377,33 +386,30 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.pictureBox25)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.sliderUtilityO2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox26)).BeginInit(); - this.tabMerchant.SuspendLayout(); this.tabTreasureMaps.SuspendLayout(); - this.tabPage1.SuspendLayout(); - this.grpQuests.SuspendLayout(); this.msMenu.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); this.SuspendLayout(); // - // tabContainer + // grpEnemiesSeen // - this.tabContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.grpEnemiesSeen.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.tabContainer.Controls.Add(this.tabChar); - this.tabContainer.Controls.Add(this.tabInventory); - this.tabContainer.Controls.Add(this.tabPets); - this.tabContainer.Controls.Add(this.tabCards); - this.tabContainer.Controls.Add(this.tabQuickslots); - this.tabContainer.Controls.Add(this.tabSkills); - this.tabContainer.Controls.Add(this.tabMerchant); - this.tabContainer.Controls.Add(this.tabTreasureMaps); - this.tabContainer.Controls.Add(this.tabPage1); - this.tabContainer.Location = new System.Drawing.Point(0, 24); - this.tabContainer.Name = "tabContainer"; - this.tabContainer.SelectedIndex = 0; - this.tabContainer.Size = new System.Drawing.Size(567, 422); - this.tabContainer.TabIndex = 0; + this.grpEnemiesSeen.Controls.Add(this.tabChar); + this.grpEnemiesSeen.Controls.Add(this.tabInventory); + this.grpEnemiesSeen.Controls.Add(this.tabPets); + this.grpEnemiesSeen.Controls.Add(this.tabCards); + this.grpEnemiesSeen.Controls.Add(this.tabQuests); + this.grpEnemiesSeen.Controls.Add(this.tabEnemiesSeen); + this.grpEnemiesSeen.Controls.Add(this.tabQuickslots); + this.grpEnemiesSeen.Controls.Add(this.tabSkills); + this.grpEnemiesSeen.Controls.Add(this.tabTreasureMaps); + this.grpEnemiesSeen.Location = new System.Drawing.Point(0, 24); + this.grpEnemiesSeen.Name = "grpEnemiesSeen"; + this.grpEnemiesSeen.SelectedIndex = 0; + this.grpEnemiesSeen.Size = new System.Drawing.Size(567, 422); + this.grpEnemiesSeen.TabIndex = 0; // // tabChar // @@ -1643,6 +1649,130 @@ private void InitializeComponent() this.cblstCards.Size = new System.Drawing.Size(442, 379); this.cblstCards.TabIndex = 2; // + // tabQuests + // + this.tabQuests.Controls.Add(this.grpQuests); + this.tabQuests.Controls.Add(this.cblstQuests); + this.tabQuests.Location = new System.Drawing.Point(4, 22); + this.tabQuests.Name = "tabQuests"; + this.tabQuests.Padding = new System.Windows.Forms.Padding(3); + this.tabQuests.Size = new System.Drawing.Size(559, 396); + this.tabQuests.TabIndex = 9; + this.tabQuests.Text = "Quests"; + this.tabQuests.UseVisualStyleBackColor = true; + // + // grpQuests + // + this.grpQuests.Controls.Add(this.btnSelectAllQuests); + this.grpQuests.Controls.Add(this.btnResetQuests); + this.grpQuests.Controls.Add(this.btnDeselectAllQuests); + this.grpQuests.Location = new System.Drawing.Point(454, 6); + this.grpQuests.Name = "grpQuests"; + this.grpQuests.Size = new System.Drawing.Size(97, 379); + this.grpQuests.TabIndex = 8; + this.grpQuests.TabStop = false; + this.grpQuests.Text = "Quests"; + // + // btnSelectAllQuests + // + this.btnSelectAllQuests.Location = new System.Drawing.Point(6, 19); + this.btnSelectAllQuests.Name = "btnSelectAllQuests"; + this.btnSelectAllQuests.Size = new System.Drawing.Size(87, 23); + this.btnSelectAllQuests.TabIndex = 3; + this.btnSelectAllQuests.Text = "Select all"; + this.btnSelectAllQuests.UseVisualStyleBackColor = true; + this.btnSelectAllQuests.Click += new System.EventHandler(this.btnSelectAllQuests_Click); + // + // btnResetQuests + // + this.btnResetQuests.Location = new System.Drawing.Point(6, 350); + this.btnResetQuests.Name = "btnResetQuests"; + this.btnResetQuests.Size = new System.Drawing.Size(87, 23); + this.btnResetQuests.TabIndex = 5; + this.btnResetQuests.Text = "Reset"; + this.btnResetQuests.UseVisualStyleBackColor = true; + this.btnResetQuests.Click += new System.EventHandler(this.btnResetQuests_Click); + // + // btnDeselectAllQuests + // + this.btnDeselectAllQuests.Location = new System.Drawing.Point(6, 48); + this.btnDeselectAllQuests.Name = "btnDeselectAllQuests"; + this.btnDeselectAllQuests.Size = new System.Drawing.Size(87, 23); + this.btnDeselectAllQuests.TabIndex = 4; + this.btnDeselectAllQuests.Text = "Deselect all"; + this.btnDeselectAllQuests.UseVisualStyleBackColor = true; + this.btnDeselectAllQuests.Click += new System.EventHandler(this.btnDeselectAllQuests_Click); + // + // cblstQuests + // + this.cblstQuests.FormattingEnabled = true; + this.cblstQuests.Location = new System.Drawing.Point(6, 6); + this.cblstQuests.Name = "cblstQuests"; + this.cblstQuests.Size = new System.Drawing.Size(442, 379); + this.cblstQuests.TabIndex = 7; + // + // tabEnemiesSeen + // + this.tabEnemiesSeen.Controls.Add(this.groupBox1); + this.tabEnemiesSeen.Controls.Add(this.cblstEnemiesSeens); + this.tabEnemiesSeen.Location = new System.Drawing.Point(4, 22); + this.tabEnemiesSeen.Name = "tabEnemiesSeen"; + this.tabEnemiesSeen.Padding = new System.Windows.Forms.Padding(3); + this.tabEnemiesSeen.Size = new System.Drawing.Size(559, 396); + this.tabEnemiesSeen.TabIndex = 4; + this.tabEnemiesSeen.Text = "Enemies seen"; + this.tabEnemiesSeen.UseVisualStyleBackColor = true; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.btnSelectAllEnemiesSeen); + this.groupBox1.Controls.Add(this.btnResetEnemiesSeen); + this.groupBox1.Controls.Add(this.btnDeselectAllEnemiesSeen); + this.groupBox1.Location = new System.Drawing.Point(454, 6); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(97, 379); + this.groupBox1.TabIndex = 10; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Enemies seen"; + // + // btnSelectAllEnemiesSeen + // + this.btnSelectAllEnemiesSeen.Location = new System.Drawing.Point(6, 19); + this.btnSelectAllEnemiesSeen.Name = "btnSelectAllEnemiesSeen"; + this.btnSelectAllEnemiesSeen.Size = new System.Drawing.Size(87, 23); + this.btnSelectAllEnemiesSeen.TabIndex = 3; + this.btnSelectAllEnemiesSeen.Text = "Select all"; + this.btnSelectAllEnemiesSeen.UseVisualStyleBackColor = true; + this.btnSelectAllEnemiesSeen.Click += new System.EventHandler(this.btnSelectAllEnemiesSeen_Click); + // + // btnResetEnemiesSeen + // + this.btnResetEnemiesSeen.Location = new System.Drawing.Point(6, 350); + this.btnResetEnemiesSeen.Name = "btnResetEnemiesSeen"; + this.btnResetEnemiesSeen.Size = new System.Drawing.Size(87, 23); + this.btnResetEnemiesSeen.TabIndex = 5; + this.btnResetEnemiesSeen.Text = "Reset"; + this.btnResetEnemiesSeen.UseVisualStyleBackColor = true; + this.btnResetEnemiesSeen.Click += new System.EventHandler(this.btnResetEnemiesSeen_Click); + // + // btnDeselectAllEnemiesSeen + // + this.btnDeselectAllEnemiesSeen.Location = new System.Drawing.Point(6, 48); + this.btnDeselectAllEnemiesSeen.Name = "btnDeselectAllEnemiesSeen"; + this.btnDeselectAllEnemiesSeen.Size = new System.Drawing.Size(87, 23); + this.btnDeselectAllEnemiesSeen.TabIndex = 4; + this.btnDeselectAllEnemiesSeen.Text = "Deselect all"; + this.btnDeselectAllEnemiesSeen.UseVisualStyleBackColor = true; + this.btnDeselectAllEnemiesSeen.Click += new System.EventHandler(this.btnDeselectAllEnemiesSeen_Click); + // + // cblstEnemiesSeens + // + this.cblstEnemiesSeens.FormattingEnabled = true; + this.cblstEnemiesSeens.Location = new System.Drawing.Point(6, 6); + this.cblstEnemiesSeens.Name = "cblstEnemiesSeens"; + this.cblstEnemiesSeens.Size = new System.Drawing.Size(442, 379); + this.cblstEnemiesSeens.TabIndex = 9; + // // tabQuickslots // this.tabQuickslots.Controls.Add(this.label57); @@ -2666,28 +2796,6 @@ private void InitializeComponent() this.tabTalentsMagic.Text = "Talents: Magic"; this.tabTalentsMagic.UseVisualStyleBackColor = true; // - // tabMerchant - // - this.tabMerchant.Controls.Add(this.label39); - this.tabMerchant.Location = new System.Drawing.Point(4, 22); - this.tabMerchant.Name = "tabMerchant"; - this.tabMerchant.Padding = new System.Windows.Forms.Padding(3); - this.tabMerchant.Size = new System.Drawing.Size(559, 396); - this.tabMerchant.TabIndex = 4; - this.tabMerchant.Text = "*Merchant"; - this.tabMerchant.UseVisualStyleBackColor = true; - // - // label39 - // - this.label39.AutoSize = true; - this.label39.BackColor = System.Drawing.Color.Transparent; - this.label39.ForeColor = System.Drawing.SystemColors.Desktop; - this.label39.Location = new System.Drawing.Point(6, 3); - this.label39.Name = "label39"; - this.label39.Size = new System.Drawing.Size(117, 13); - this.label39.TabIndex = 31; - this.label39.Text = "* = not yet implemented"; - // // tabTreasureMaps // this.tabTreasureMaps.Controls.Add(this.label41); @@ -2710,68 +2818,6 @@ private void InitializeComponent() this.label41.TabIndex = 31; this.label41.Text = "* = not yet implemented"; // - // tabPage1 - // - this.tabPage1.Controls.Add(this.grpQuests); - this.tabPage1.Controls.Add(this.cblstQuests); - this.tabPage1.Location = new System.Drawing.Point(4, 22); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(559, 396); - this.tabPage1.TabIndex = 9; - this.tabPage1.Text = "*Quests"; - this.tabPage1.UseVisualStyleBackColor = true; - // - // grpQuests - // - this.grpQuests.Controls.Add(this.btnSelectAllQuests); - this.grpQuests.Controls.Add(this.btnResetQuests); - this.grpQuests.Controls.Add(this.btnDeselectAllQuests); - this.grpQuests.Location = new System.Drawing.Point(454, 6); - this.grpQuests.Name = "grpQuests"; - this.grpQuests.Size = new System.Drawing.Size(97, 379); - this.grpQuests.TabIndex = 8; - this.grpQuests.TabStop = false; - this.grpQuests.Text = "Quests"; - // - // btnSelectAllQuests - // - this.btnSelectAllQuests.Location = new System.Drawing.Point(6, 19); - this.btnSelectAllQuests.Name = "btnSelectAllQuests"; - this.btnSelectAllQuests.Size = new System.Drawing.Size(87, 23); - this.btnSelectAllQuests.TabIndex = 3; - this.btnSelectAllQuests.Text = "Select all"; - this.btnSelectAllQuests.UseVisualStyleBackColor = true; - this.btnSelectAllQuests.Click += new System.EventHandler(this.btnSelectAllQuests_Click); - // - // btnResetQuests - // - this.btnResetQuests.Location = new System.Drawing.Point(6, 350); - this.btnResetQuests.Name = "btnResetQuests"; - this.btnResetQuests.Size = new System.Drawing.Size(87, 23); - this.btnResetQuests.TabIndex = 5; - this.btnResetQuests.Text = "Reset"; - this.btnResetQuests.UseVisualStyleBackColor = true; - this.btnResetQuests.Click += new System.EventHandler(this.btnResetQuests_Click); - // - // btnDeselectAllQuests - // - this.btnDeselectAllQuests.Location = new System.Drawing.Point(6, 48); - this.btnDeselectAllQuests.Name = "btnDeselectAllQuests"; - this.btnDeselectAllQuests.Size = new System.Drawing.Size(87, 23); - this.btnDeselectAllQuests.TabIndex = 4; - this.btnDeselectAllQuests.Text = "Deselect all"; - this.btnDeselectAllQuests.UseVisualStyleBackColor = true; - this.btnDeselectAllQuests.Click += new System.EventHandler(this.btnDeselectAllQuests_Click); - // - // cblstQuests - // - this.cblstQuests.FormattingEnabled = true; - this.cblstQuests.Location = new System.Drawing.Point(6, 6); - this.cblstQuests.Name = "cblstQuests"; - this.cblstQuests.Size = new System.Drawing.Size(442, 379); - this.cblstQuests.TabIndex = 7; - // // msMenu // this.msMenu.ImageScalingSize = new System.Drawing.Size(20, 20); @@ -2792,6 +2838,7 @@ private void InitializeComponent() this.saveToolStripMenuItem, this.importToolStripMenuItem, this.exportAsToolStripMenuItem, + this.openSavegameFolderToolStripMenuItem, this.exitToolStripMenuItem}); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); @@ -2800,7 +2847,7 @@ private void InitializeComponent() // openToolStripMenuItem // this.openToolStripMenuItem.Name = "openToolStripMenuItem"; - this.openToolStripMenuItem.Size = new System.Drawing.Size(131, 22); + this.openToolStripMenuItem.Size = new System.Drawing.Size(218, 22); this.openToolStripMenuItem.Text = "Open"; this.openToolStripMenuItem.Click += new System.EventHandler(this.OpenToolStripMenuItem_Click); // @@ -2808,7 +2855,7 @@ private void InitializeComponent() // this.saveToolStripMenuItem.Enabled = false; this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; - this.saveToolStripMenuItem.Size = new System.Drawing.Size(131, 22); + this.saveToolStripMenuItem.Size = new System.Drawing.Size(218, 22); this.saveToolStripMenuItem.Text = "Save"; this.saveToolStripMenuItem.Click += new System.EventHandler(this.SaveToolStripMenuItem_Click); // @@ -2816,7 +2863,7 @@ private void InitializeComponent() // this.importToolStripMenuItem.Enabled = false; this.importToolStripMenuItem.Name = "importToolStripMenuItem"; - this.importToolStripMenuItem.Size = new System.Drawing.Size(131, 22); + this.importToolStripMenuItem.Size = new System.Drawing.Size(218, 22); this.importToolStripMenuItem.Text = "Import"; // // exportAsToolStripMenuItem @@ -2824,7 +2871,7 @@ private void InitializeComponent() this.exportAsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.jSONToolStripMenuItem}); this.exportAsToolStripMenuItem.Name = "exportAsToolStripMenuItem"; - this.exportAsToolStripMenuItem.Size = new System.Drawing.Size(131, 22); + this.exportAsToolStripMenuItem.Size = new System.Drawing.Size(218, 22); this.exportAsToolStripMenuItem.Text = "Export as..."; // // jSONToolStripMenuItem @@ -2834,10 +2881,17 @@ private void InitializeComponent() this.jSONToolStripMenuItem.Text = "JSON"; this.jSONToolStripMenuItem.Click += new System.EventHandler(this.JSONToolStripMenuItem_Click); // + // openSavegameFolderToolStripMenuItem + // + this.openSavegameFolderToolStripMenuItem.Name = "openSavegameFolderToolStripMenuItem"; + this.openSavegameFolderToolStripMenuItem.Size = new System.Drawing.Size(218, 22); + this.openSavegameFolderToolStripMenuItem.Text = "Open Savegame Location..."; + this.openSavegameFolderToolStripMenuItem.Click += new System.EventHandler(this.openSavegameFolderToolStripMenuItem_Click); + // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(131, 22); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(218, 22); this.exitToolStripMenuItem.Text = "Exit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.ExitToolStripMenuItem_Click); // @@ -2890,14 +2944,14 @@ private void InitializeComponent() this.ClientSize = new System.Drawing.Size(567, 570); this.Controls.Add(this.pictureBox3); this.Controls.Add(this.txtConsole); - this.Controls.Add(this.tabContainer); + this.Controls.Add(this.grpEnemiesSeen); this.Controls.Add(this.msMenu); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.msMenu; this.Name = "FrmMain"; this.Text = "SoG: Savegame Editor v16.9.30803.129 by tolik518"; this.Load += new System.EventHandler(this.FrmMain_Load); - this.tabContainer.ResumeLayout(false); + this.grpEnemiesSeen.ResumeLayout(false); this.tabChar.ResumeLayout(false); this.tabChar.PerformLayout(); this.grpPatch.ResumeLayout(false); @@ -2941,6 +2995,10 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.numPetHP)).EndInit(); this.tabCards.ResumeLayout(false); this.grpCards.ResumeLayout(false); + this.tabQuests.ResumeLayout(false); + this.grpQuests.ResumeLayout(false); + this.tabEnemiesSeen.ResumeLayout(false); + this.groupBox1.ResumeLayout(false); this.tabQuickslots.ResumeLayout(false); this.tabQuickslots.PerformLayout(); this.grpQuickslots.ResumeLayout(false); @@ -3030,12 +3088,8 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.pictureBox25)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.sliderUtilityO2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox26)).EndInit(); - this.tabMerchant.ResumeLayout(false); - this.tabMerchant.PerformLayout(); this.tabTreasureMaps.ResumeLayout(false); this.tabTreasureMaps.PerformLayout(); - this.tabPage1.ResumeLayout(false); - this.grpQuests.ResumeLayout(false); this.msMenu.ResumeLayout(false); this.msMenu.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit(); @@ -3046,7 +3100,7 @@ private void InitializeComponent() #endregion - private System.Windows.Forms.TabControl tabContainer; + private System.Windows.Forms.TabControl grpEnemiesSeen; private System.Windows.Forms.TabPage tabQuickslots; private System.Windows.Forms.MenuStrip msMenu; private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; @@ -3097,7 +3151,7 @@ private void InitializeComponent() private System.Windows.Forms.Button btnSkinColor; private System.Windows.Forms.Button btnHairColor; private System.Windows.Forms.Label label1; - private System.Windows.Forms.TabPage tabMerchant; + private System.Windows.Forms.TabPage tabEnemiesSeen; private System.Windows.Forms.TabPage tabCards; private System.Windows.Forms.TabPage tabTreasureMaps; private System.Windows.Forms.GroupBox grpLevel; @@ -3144,7 +3198,6 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox cbStyleFacegear; private System.Windows.Forms.Label label17; private System.Windows.Forms.ComboBox cbStyleWeapon; - private System.Windows.Forms.Label label39; private System.Windows.Forms.Label label41; private System.Windows.Forms.TabPage tabPets; private System.Windows.Forms.ListView lstPets; @@ -3172,7 +3225,7 @@ private void InitializeComponent() private System.Windows.Forms.Label label48; private System.Windows.Forms.Button btnDeleteSelectedItem; private System.Windows.Forms.Label label49; - private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TabPage tabQuests; private System.Windows.Forms.Label label51; private System.Windows.Forms.ComboBox cbPetType; private System.Windows.Forms.Label label52; @@ -3283,5 +3336,11 @@ private void InitializeComponent() private Button btnResetQuests; private Button btnDeselectAllQuests; private CheckedListBox cblstQuests; + private ToolStripMenuItem openSavegameFolderToolStripMenuItem; + private GroupBox groupBox1; + private Button btnSelectAllEnemiesSeen; + private Button btnResetEnemiesSeen; + private Button btnDeselectAllEnemiesSeen; + private CheckedListBox cblstEnemiesSeens; } } diff --git a/SoG_SGreader/Forms/FrmMain.cs b/SoG_SGreader/Forms/FrmMain.cs index cb9fabd..0e70b8f 100644 --- a/SoG_SGreader/Forms/FrmMain.cs +++ b/SoG_SGreader/Forms/FrmMain.cs @@ -14,6 +14,7 @@ public partial class FrmMain : Form private Player playerObject = new Player(); private readonly ComboBox[] cbQuickslot = new ComboBox[10]; private readonly ComboBox[] cbQuickslotType = new ComboBox[10]; + private string InitialPlaytime; public string OpenedSaveGamePath { get; set; } @@ -167,12 +168,10 @@ private void InitFields() cbSelectedItem.DataSource = items; - //fill cblstCards with all the cards from Enemies enum - var cards = Enum.GetNames(typeof(SogEnemy)); - cblstCards.DataSource = cards; - - var quests = Enum.GetNames(typeof(SogQuest)); - cblstQuests.DataSource = quests; + //fill checkboxLists with all the values from the enums + cblstCards.DataSource = Enum.GetNames(typeof(SogEnemy)); + cblstQuests.DataSource = Enum.GetNames(typeof(SogQuest)); + cblstEnemiesSeens.DataSource = Enum.GetNames(typeof(SogEnemy)); } private void PopulateFields() @@ -246,7 +245,8 @@ private void PopulateFields() lstPets.Items.Add(pPet); } - txtTimePlayed.Text = TimeSpan.FromSeconds(playerObject.PlayTimeTotal / 60).ToString(@"d\:hh\:mm\:ss"); + InitialPlaytime = TimeSpan.FromSeconds(playerObject.PlayTimeTotal / 60).ToString(@"d\:hh\:mm\:ss"); + txtTimePlayed.Text = InitialPlaytime; numID.Value = playerObject.UniquePlayerId; numBirthdayDay.Value = playerObject.BirthdayDay; numBirtdayMonth.Value = playerObject.BirthdayMonth; @@ -295,6 +295,12 @@ private void PopulateFields() bool playerHasQuest = playerObject.HasQuest((SogQuest)Enum.Parse(typeof(SogQuest), cblstQuests.Items[i].ToString())); cblstQuests.SetItemChecked(i, playerHasQuest); } + + for (int i = 0; i < cblstQuests.Items.Count; i++) + { + bool playerHasMetEnemy = playerObject.HasSeenEnemy((SogEnemy)Enum.Parse(typeof(SogEnemy), cblstEnemiesSeens.Items[i].ToString())); + cblstEnemiesSeens.SetItemChecked(i, playerHasMetEnemy); + } } //TODO: we need to clean all our variables before we load a new file @@ -394,7 +400,22 @@ private void GetDataFromFields() // dont change the playtime if its not parseable if (TimeSpan.TryParse(txtTimePlayed.Text, out TimeSpan result)) { - playerObject.PlayTimeTotal = Math.Min((int)(result.TotalSeconds * 60), int.MaxValue); + if (result.TotalSeconds > int.MaxValue) + { + txtConsole.AppendText("\r\n\r\nPlaytime is too high. Please check the format."); + return; + } + + // if the playtime was changed, update the playtime + // was added to prevent rounding errors + if (InitialPlaytime != txtTimePlayed.Text) + { + playerObject.PlayTimeTotal = Math.Min((int)(result.TotalSeconds * 60), int.MaxValue); + } + else + { + playerObject.PlayTimeTotal = playerObject.PlayTimeTotal; + } } else { txtConsole.AppendText("\r\n\r\nPlaytime is not parseable. Please check the format."); } @@ -410,7 +431,8 @@ private void GetDataFromFields() if (cblstCards.GetItemChecked(i)) { playerObject.Cards.Add( - new Card { + new Card + { CardID = (SogEnemy)Enum.Parse(typeof(SogEnemy), cblstCards.Items[i].ToString()) } ); @@ -423,12 +445,27 @@ private void GetDataFromFields() if (cblstQuests.GetItemChecked(i)) { playerObject.Quests.Add( - new Quest { + new Quest + { QuestID = (SogQuest)Enum.Parse(typeof(SogQuest), cblstQuests.Items[i].ToString()) } ); } } + + playerObject.EnemiesSeen.Clear(); + for (int i = 0; i != cblstEnemiesSeens.Items.Count; i++) + { + if (cblstEnemiesSeens.GetItemChecked(i)) + { + playerObject.EnemiesSeen.Add( + new Enemy + { + EnemyID = (SogEnemy)Enum.Parse(typeof(SogEnemy), cblstEnemiesSeens.Items[i].ToString()) + } + ); + } + } } private void LstInventory_SelectedIndexChanged(object sender, EventArgs e) @@ -746,5 +783,36 @@ private void btnDeselectAllQuests_Click(object sender, EventArgs e) cblstQuests.SetItemChecked(i, false); } } + + private void btnSelectAllEnemiesSeen_Click(object sender, EventArgs e) + { + for (int i = 0; i < cblstEnemiesSeens.Items.Count; i++) + { + cblstEnemiesSeens.SetItemChecked(i, true); + } + } + + private void btnDeselectAllEnemiesSeen_Click(object sender, EventArgs e) + { + for (int i = 0; i < cblstEnemiesSeens.Items.Count; i++) + { + cblstEnemiesSeens.SetItemChecked(i, false); + } + } + + private void btnResetEnemiesSeen_Click(object sender, EventArgs e) + { + for (int i = 0; i < cblstEnemiesSeens.Items.Count; i++) + { + bool playerHasMetEnemy = playerObject.HasSeenEnemy((SogEnemy)Enum.Parse(typeof(SogEnemy), cblstEnemiesSeens.Items[i].ToString())); + cblstEnemiesSeens.SetItemChecked(i, playerHasMetEnemy); + } + } + + private void openSavegameFolderToolStripMenuItem_Click(object sender, EventArgs e) + { + string folderPath = Directory.GetParent(OpenedSaveGamePath).FullName; + System.Diagnostics.Process.Start(folderPath); + } } } \ No newline at end of file diff --git a/SoG_SGreader/Objects/CharacterFlags.cs b/SoG_SGreader/Objects/CharacterFlags.cs new file mode 100644 index 0000000..a338032 --- /dev/null +++ b/SoG_SGreader/Objects/CharacterFlags.cs @@ -0,0 +1,8 @@ +namespace SoG_SGreader +{ + public class CharacterFlags //.archie.....lmb...C + { + public string Name { get; set; } + public float Value { get; set; } + } +} \ No newline at end of file diff --git a/SoG_SGreader/Objects/Enemy.cs b/SoG_SGreader/Objects/Enemy.cs index 6d3cb29..918dcad 100644 --- a/SoG_SGreader/Objects/Enemy.cs +++ b/SoG_SGreader/Objects/Enemy.cs @@ -2,6 +2,6 @@ namespace SoG_SGreader { public class Enemy { - public int EnemyID { get; set; } + public SogEnemy EnemyID { get; set; } } } \ No newline at end of file diff --git a/SoG_SGreader/Objects/HouseStyle.cs b/SoG_SGreader/Objects/HouseStyle.cs index 0f84ca0..6e6f879 100644 --- a/SoG_SGreader/Objects/HouseStyle.cs +++ b/SoG_SGreader/Objects/HouseStyle.cs @@ -2,8 +2,8 @@ namespace SoG_SGreader { public class HouseStyle { - public byte HouseStyleNumber { get; set; } //style 0, 1, 2 etc - public int HouseStyleLength { get; set; } - public byte[] HouseStyleBytes { get; set; } + public byte Number { get; set; } //style 0, 1, 2 etc + public int Length { get; set; } + public byte[] Bytes { get; set; } } } \ No newline at end of file diff --git a/SoG_SGreader/Objects/Player.cs b/SoG_SGreader/Objects/Player.cs index 5173b7c..a3aa273 100644 --- a/SoG_SGreader/Objects/Player.cs +++ b/SoG_SGreader/Objects/Player.cs @@ -44,16 +44,16 @@ public class Player public byte PetHidden { get; set; } public ushort QuestsCount { get; set; } public List Quests; - public ushort EnemiesMetCount { get; set; } - public List Enemies; + public ushort EnemiesSeenCount { get; set; } + public List EnemiesSeen; public ushort UnknownVariable02Count { get; set; } //something to do with challenges? public List UnknownVariables02; public int RobinBowHighscore { get; set; } - public ushort UnknownVariable03Count { get; set; } //trophies? + public ushort TrophiesCount { get; set; } //trophies? - public List UnknownVariables03; - public ushort ItemsMetCount { get; set; } - public List ItemsMet; + public List Trophies; + public ushort ItemsSeenCount { get; set; } + public List ItemsSeen; public ushort ItemsCraftedCount { get; set; } public List ItemsCrafted; public ushort FishiesCaughtCount { get; set; } @@ -66,16 +66,16 @@ public class Player public int BirthdayMonth { get; set; } public int BirthdayDay { get; set; } public uint UniquePlayerId { get; set; } - public int UnknownVariable04 { get; set; } // saving mechanism related - public int UnknownVariable05 { get; set; } // saving mechanism related + public int LastAutosave { get; set; } // saving mechanism related + public int SaveUnknown { get; set; } // saving mechanism related public int PlayTimeTotal { get; set; } // saved in frames - public byte UnknownVariable06 { get; set; } //?? - public short UnknownVariable07Count { get; set; } - public List UnknownVariables07; + public byte PhaseShiftStuff { get; set; } //?? + public short CharacterFlagCount { get; set; } + public List CharacterFlags; public short FlagsCount { get; set; } public List Flags; public byte HouseStylesCount { get; set; } - public List Houses; + public List HouseStyles; internal byte GetSkillLevel(SogSkill skillId) { @@ -140,5 +140,11 @@ internal void RemoveQuest(SogQuest sogQuests) Quests.RemoveAll(quest => quest.QuestID == sogQuests); } } + + //same as above, but for enemies + internal bool HasSeenEnemy(SogEnemy sogEnemies) + { + return EnemiesSeen.Any(enemy => enemy.EnemyID == sogEnemies); + } } } diff --git a/SoG_SGreader/Objects/Trophy.cs b/SoG_SGreader/Objects/Trophy.cs new file mode 100644 index 0000000..c3d6708 --- /dev/null +++ b/SoG_SGreader/Objects/Trophy.cs @@ -0,0 +1,7 @@ +namespace SoG_SGreader +{ + public class Trophy + { + public ushort TrophyID { get; set; } + } +} \ No newline at end of file diff --git a/SoG_SGreader/Objects/UnknownVariable03.cs b/SoG_SGreader/Objects/UnknownVariable03.cs deleted file mode 100644 index 3369b70..0000000 --- a/SoG_SGreader/Objects/UnknownVariable03.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace SoG_SGreader -{ - public class UnknownVariable03 - { - public ushort UnknownVariable { get; set; } - } -} \ No newline at end of file diff --git a/SoG_SGreader/Objects/UnknownVariable07.cs b/SoG_SGreader/Objects/UnknownVariable07.cs deleted file mode 100644 index d66e6b0..0000000 --- a/SoG_SGreader/Objects/UnknownVariable07.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace SoG_SGreader -{ - public class UnknownVariable07 //.archie.....lmb...C - { - public string UnknownString { get; set; } - public float UnknownFloat { get; set; } - } -} \ No newline at end of file diff --git a/SoG_SGreader/SoG_SGreader.csproj b/SoG_SGreader/SoG_SGreader.csproj index 99cbb8f..0cea3ce 100644 --- a/SoG_SGreader/SoG_SGreader.csproj +++ b/SoG_SGreader/SoG_SGreader.csproj @@ -14,6 +14,7 @@ true false + 8 publish\ true Disk @@ -29,7 +30,6 @@ false true true - 8 AnyCPU @@ -129,10 +129,10 @@ - - + + @@ -160,8 +160,8 @@ - - + + True True @@ -171,12 +171,8 @@ - - Form - - - Form - + + Form @@ -249,7 +245,7 @@ False - Microsoft .NET Framework 4.5.2 %28x86 und x64%29 + Microsoft .NET Framework 4.5.2 %28x86 and x64%29 true