Skip to content

Commit

Permalink
added ability to load and save skills
Browse files Browse the repository at this point in the history
  • Loading branch information
tolik518 committed Aug 2, 2024
1 parent 2850ce3 commit fb6ce87
Show file tree
Hide file tree
Showing 7 changed files with 549 additions and 534 deletions.
9 changes: 6 additions & 3 deletions SoG_SGreader/DataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,16 @@ public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole)
playerObject.Skills = new List<Skill>(playerObject.SkillsCount);
for (int i = 0; i != playerObject.SkillsCount; i++)
{
var skillID = (SogSkill)readBinary.ReadInt16();
var skillLevel = readBinary.ReadByte();
playerObject.Skills.Add(new Skill
{
SkillID = (SogSkill)readBinary.ReadInt16(),
SkillLevel = readBinary.ReadByte()
SkillID = skillID,
SkillLevel = skillLevel
});
txtConsole.AppendText("\r\n" + "Skill " + i +": " + skillID.ToString() + " Level " + skillLevel);
}

txtConsole.AppendText("\r\nSkillCount: " + playerObject.SkillsCount);


Expand Down
2 changes: 1 addition & 1 deletion SoG_SGreader/Forms/FrmLoadSaveGame.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

997 changes: 470 additions & 527 deletions SoG_SGreader/Forms/FrmMain.Designer.cs

Large diffs are not rendered by default.

65 changes: 65 additions & 0 deletions SoG_SGreader/Forms/FrmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,18 @@ private void PopulateFields()
numSkillMagicA1.Value = playerObject.GetSkillLevel(SogSkill.Magic_Wind_SummonCloud);
numSkillMagicA2.Value = playerObject.GetSkillLevel(SogSkill.Magic_Wind_StaticTouch);

numUtilityO0.Value = playerObject.GetSkillLevel(SogSkill.Magic_Support_DeathMark);
numUtilityO1.Value = playerObject.GetSkillLevel(SogSkill.Magic_Support_Stasis);
numUtilityO2.Value = playerObject.GetSkillLevel(SogSkill.Magic_Support_Taunt);

numUtilityD0.Value = playerObject.GetSkillLevel(SogSkill.Magic_Support_Blink);
numUtilityD1.Value = playerObject.GetSkillLevel(SogSkill.Magic_Support_Focus);
numUtilityD2.Value = playerObject.GetSkillLevel(SogSkill.Magic_Support_Barrier);

numUtilityE0.Value = playerObject.GetSkillLevel(SogSkill.Magic_Support_BuffATK);
numUtilityE1.Value = playerObject.GetSkillLevel(SogSkill.Magic_Support_BuffSPD);
numUtilityE2.Value = playerObject.GetSkillLevel(SogSkill.Magic_Support_BuffDEF);

// find out if player has the card. mark the checkbox if yes
for (int i = 0; i < cblstCards.Items.Count; i++)
{
Expand Down Expand Up @@ -399,6 +411,21 @@ private void GetDataFromFields()
playerObject.SkillSilverPoints = (Int16)numSkillSilverPoints.Value;
playerObject.SkillGoldPoints = (Int16)numSkillGoldPoints.Value;

playerObject.Skills.Clear();
var skills = getSkillMappings();

foreach (var skill in skills)
{
if (skill.Field.Value != 0)
{
playerObject.Skills.Add(new Skill
{
SkillID = skill.SkillID,
SkillLevel = (byte)skill.Field.Value
});
}
}

playerObject.PetsCount = (byte)lstPets.Items.Count;

for (byte i = 0; i != playerObject.PetsCount; i++)
Expand Down Expand Up @@ -585,6 +612,44 @@ private void GetDataFromFields()
}
}

private (NumericUpDown Field, SogSkill SkillID)[] getSkillMappings()
{
return new (NumericUpDown Field, SogSkill SkillID)[]
{
(numSkillMelee1h0, SogSkill.Skill_OneHanded_Stinger),
(numSkillMelee1h1, SogSkill.Skill_OneHanded_MillionStabs),
(numSkillMelee1h2, SogSkill.Skill_OneHanded_SpiritSlash),
(numSkillMelee1h3, SogSkill.Skill_OneHanded_ShadowClone),
(numSkillMelee1h4, SogSkill.Skill_OneHanded_QuickCounter),
(numSkillMelee2h0, SogSkill.Skill_TwoHanded_Overhead),
(numSkillMelee2h1, SogSkill.Skill_TwoHanded_Spin),
(numSkillMelee2h2, SogSkill.Skill_TwoHanded_Throw),
(numSkillMelee2h3, SogSkill.Skill_TwoHanded_Smash),
(numSkillMelee2h4, SogSkill.Skill_TwoHanded_BerserkMode),
(numSkillMagicF0, SogSkill.Magic_Fire_Fireball),
(numSkillMagicF1, SogSkill.Magic_Fire_Meteor),
(numSkillMagicF2, SogSkill.Magic_Fire_Flamethrower),
(numSkillMagicI0, SogSkill.Magic_Ice_IceSpikes),
(numSkillMagicI1, SogSkill.Magic_Ice_IceNova),
(numSkillMagicI2, SogSkill.Magic_Ice_FrostyFriend),
(numSkillMagicE0, SogSkill.Magic_Earth_EarthSpike),
(numSkillMagicE1, SogSkill.Magic_Earth_SummonPlant),
(numSkillMagicE2, SogSkill.Magic_Earth_InsectSwarm),
(numSkillMagicA0, SogSkill.Magic_Wind_ChainLightning),
(numSkillMagicA1, SogSkill.Magic_Wind_SummonCloud),
(numSkillMagicA2, SogSkill.Magic_Wind_StaticTouch),
(numUtilityO0, SogSkill.Magic_Support_DeathMark),
(numUtilityO1, SogSkill.Magic_Support_Stasis),
(numUtilityO2, SogSkill.Magic_Support_Taunt),
(numUtilityD0, SogSkill.Magic_Support_Blink),
(numUtilityD1, SogSkill.Magic_Support_Focus),
(numUtilityD2, SogSkill.Magic_Support_Barrier),
(numUtilityE0, SogSkill.Magic_Support_BuffATK),
(numUtilityE1, SogSkill.Magic_Support_BuffSPD),
(numUtilityE2, SogSkill.Magic_Support_BuffDEF)
};
}

private void LstInventory_SelectedIndexChanged(object sender, EventArgs e)
{
if (lstInventory.FocusedItem == null || lstInventory.FocusedItem.Index == -1)
Expand Down
3 changes: 3 additions & 0 deletions SoG_SGreader/SoG_SGreader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
Expand Down
6 changes: 3 additions & 3 deletions SoG_SGreader/VersionInc.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

using System.Reflection;

[assembly: AssemblyVersion("0.7.1")]
[assembly: AssemblyFileVersion("0.7.1.1452")]
[assembly: AssemblyInformationalVersionAttribute("0.7.1")]
[assembly: AssemblyVersion("0.8.0")]
[assembly: AssemblyFileVersion("0.8.0.1452")]
[assembly: AssemblyInformationalVersionAttribute("0.8.0")]

1 change: 1 addition & 0 deletions SoG_SGreader/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<packages>
<package id="CommandLineParser" version="2.9.1" targetFramework="net452" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net452" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net452" />
</packages>

0 comments on commit fb6ce87

Please sign in to comment.