Skip to content

Commit

Permalink
HOI4 1.12 support
Browse files Browse the repository at this point in the history
  • Loading branch information
bcssov committed Sep 27, 2022
1 parent ac75992 commit c8cba6b
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 7 deletions.
34 changes: 32 additions & 2 deletions References/CopyAll/Maps/HeartsofIronIVParserMap.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
}, {
"DirectoryPath": "common\\bookmarks",
"PreferredParser": "HOI4KeyParser"
}, {
"DirectoryPath": "common\\bop",
"PreferredParser": "DefaultParser"
}, {
"DirectoryPath": "common\\buildings",
"PreferredParser": "HOI4InnerLayerParser"
Expand Down Expand Up @@ -91,6 +94,9 @@
}, {
"DirectoryPath": "common\\intelligence_agency_upgrades",
"PreferredParser": "DefaultParser"
}, {
"DirectoryPath": "common\\medals",
"PreferredParser": "HOI4InnerLayerParser"
}, {
"DirectoryPath": "common\\modifiers",
"PreferredParser": "DefaultParser"
Expand Down Expand Up @@ -121,6 +127,18 @@
}, {
"DirectoryPath": "common\\opinion_modifiers",
"PreferredParser": "HOI4InnerLayerParser"
}, {
"DirectoryPath": "common\\peace_conference\\ai_peace",
"PreferredParser": "HOI4WholeTextParser"
}, {
"DirectoryPath": "common\\peace_conference\\categories",
"PreferredParser": "HOI4WholeTextParser"
}, {
"DirectoryPath": "common\\peace_conference\\cost_modifiers",
"PreferredParser": "HOI4WholeTextParser"
}, {
"DirectoryPath": "common\\profile_pictures",
"PreferredParser": "HOI4WholeTextParser"
}, {
"DirectoryPath": "common\\resistance_activity",
"PreferredParser": "DefaultParser"
Expand All @@ -130,6 +148,9 @@
}, {
"DirectoryPath": "common\\resources",
"PreferredParser": "HOI4InnerLayerParser"
}, {
"DirectoryPath": "common\\ribbons",
"PreferredParser": "HOI4InnerLayerParser"
}, {
"DirectoryPath": "common\\scorers\\country",
"PreferredParser": "DefaultParser"
Expand Down Expand Up @@ -199,6 +220,9 @@
}, {
"DirectoryPath": "common\\unit_leader",
"PreferredParser": "HOI4InnerLayerParser"
}, {
"DirectoryPath": "common\\unit_medals",
"PreferredParser": "HOI4InnerLayerParser"
}, {
"DirectoryPath": "common\\unit_tags",
"PreferredParser": "DefaultParser"
Expand Down Expand Up @@ -260,7 +284,7 @@
"DirectoryPath": "gfx\\FX",
"PreferredParser": "GenericWholeTextParser"
}, {
"DirectoryPath": "gfx\\interface\\equipmentdesigner\\tanks\\designer",
"DirectoryPath": "gfx\\interface\\equipmentdesigner\\graphic_db",
"PreferredParser": "HOI4WholeTextParser"
}, {
"DirectoryPath": "gfx\\maparrows",
Expand Down Expand Up @@ -359,7 +383,13 @@
"DirectoryPath": "interface\\career_profile",
"PreferredParser": "GenericGraphicsParser"
}, {
"DirectoryPath": "interface\\equipmentdesigner",
"DirectoryPath": "interface\\equipmentdesigner\\planes",
"PreferredParser": "GenericGraphicsParser"
}, {
"DirectoryPath": "interface\\equipmentdesigner\\ships",
"PreferredParser": "GenericGraphicsParser"
}, {
"DirectoryPath": "interface\\equipmentdesigner\\tanks",
"PreferredParser": "GenericGraphicsParser"
}, {
"DirectoryPath": "interface\\pdx_online",
Expand Down
27 changes: 26 additions & 1 deletion src/IronyModManager.Parser.Common/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Created : 02-16-2020
//
// Last Modified By : Mario
// Last Modified On : 09-20-2022
// Last Modified On : 09-27-2022
// ***********************************************************************
// <copyright file="Constants.cs" company="Mario">
// Mario
Expand Down Expand Up @@ -269,16 +269,36 @@ public static class HOI4
/// </summary>
public static readonly string IntelligenceAgencies = MergePath(CommonPath, "intelligence_agencies");

/// <summary>
/// The medals
/// </summary>
public static readonly string Medals = MergePath(CommonPath, "medals");

/// <summary>
/// The opinion modifiers
/// </summary>
public static readonly string OpinionModifiers = MergePath(CommonPath, "opinion_modifiers");

/// <summary>
/// The peace conference
/// </summary>
public static readonly string PeaceConference = MergePath(CommonPath, "peace_conference");

/// <summary>
/// The profile pictures
/// </summary>
public static readonly string ProfilePictures = MergePath(CommonPath, "profile_pictures");

/// <summary>
/// The resources
/// </summary>
public static readonly string Resources = MergePath(CommonPath, "resources");

/// <summary>
/// The ribbons
/// </summary>
public static readonly string Ribbons = MergePath(CommonPath, "ribbons");

/// <summary>
/// The scripted diplomatic actions
/// </summary>
Expand Down Expand Up @@ -309,6 +329,11 @@ public static class HOI4
/// </summary>
public static readonly string UnitLeader = MergePath(CommonPath, "unit_leader");

/// <summary>
/// The unit medals
/// </summary>
public static readonly string UnitMedals = MergePath(CommonPath, "unit_medals");

/// <summary>
/// The units
/// </summary>
Expand Down
45 changes: 45 additions & 0 deletions src/IronyModManager.Parser.Tests/HOI4InnerLayerParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,51 @@ public void CanParse_scripted_diplomatic_actions_should_be_true()
parser.CanParse(args).Should().BeTrue();
}

/// <summary>
/// Defines the test method CanParse_scripted_medals_should_be_true.
/// </summary>
[Fact]
public void CanParse_scripted_medals_should_be_true()
{
var args = new CanParseArgs()
{
File = "common\\medals\\test.txt",
GameType = "HeartsofIronIV"
};
var parser = new Games.HOI4.InnerLayerParser(new CodeParser(new Logger()), null);
parser.CanParse(args).Should().BeTrue();
}

/// <summary>
/// Defines the test method CanParse_ribbons_should_be_true.
/// </summary>
[Fact]
public void CanParse_ribbons_should_be_true()
{
var args = new CanParseArgs()
{
File = "common\\ribbons\\test.txt",
GameType = "HeartsofIronIV"
};
var parser = new Games.HOI4.InnerLayerParser(new CodeParser(new Logger()), null);
parser.CanParse(args).Should().BeTrue();
}

/// <summary>
/// Defines the test method CanParse_unit_medals_should_be_true.
/// </summary>
[Fact]
public void CanParse_unit_medals_should_be_true()
{
var args = new CanParseArgs()
{
File = "common\\unit_medals\\test.txt",
GameType = "HeartsofIronIV"
};
var parser = new Games.HOI4.InnerLayerParser(new CodeParser(new Logger()), null);
parser.CanParse(args).Should().BeTrue();
}

/// <summary>
/// Defines the test method Parse_should_yield_results.
/// </summary>
Expand Down
30 changes: 30 additions & 0 deletions src/IronyModManager.Parser.Tests/HOI4WholeTextParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,36 @@ public void CanParse_terrain_tags_should_be_true()
parser.CanParse(args).Should().BeTrue();
}

/// <summary>
/// Defines the test method CanParse_profile_pictures_should_be_true.
/// </summary>
[Fact]
public void CanParse_profile_pictures_should_be_true()
{
var args = new CanParseArgs()
{
File = "common\\profile_pictures\\fake.txt",
GameType = "HeartsofIronIV"
};
var parser = new WholeTextParser(new CodeParser(new Logger()), null);
parser.CanParse(args).Should().BeTrue();
}

/// <summary>
/// Defines the test method CanParse_peace_conference_should_be_true.
/// </summary>
[Fact]
public void CanParse_peace_conference_should_be_true()
{
var args = new CanParseArgs()
{
File = "common\\peace_conference\\fake.txt",
GameType = "HeartsofIronIV"
};
var parser = new WholeTextParser(new CodeParser(new Logger()), null);
parser.CanParse(args).Should().BeTrue();
}

/// <summary>
/// Defines the test method Parse_should_yield_results.
/// </summary>
Expand Down
5 changes: 3 additions & 2 deletions src/IronyModManager.Parser/Games/HOI4/InnerLayerParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Created : 01-29-2022
//
// Last Modified By : Mario
// Last Modified On : 08-20-2022
// Last Modified On : 09-27-2022
// ***********************************************************************
// <copyright file="InnerLayerParser.cs" company="Mario">
// Mario
Expand Down Expand Up @@ -51,7 +51,8 @@ public class InnerLayerParser : BaseParser, IGameParser
Common.Constants.HOI4.Technologies, Common.Constants.HOI4.UnitLeader,
Common.Constants.HOI4.CountryLeader, Common.Constants.HOI4.Aces,
Common.Constants.HOI4.AIAreas, Common.Constants.HOI4.Buildings, Common.Constants.HOI4.Ideologies,
Common.Constants.HOI4.Resources, Common.Constants.HOI4.Wargoals, Common.Constants.HOI4.ScriptedDiplomaticActions
Common.Constants.HOI4.Resources, Common.Constants.HOI4.Wargoals, Common.Constants.HOI4.ScriptedDiplomaticActions,
Common.Constants.HOI4.Medals, Common.Constants.HOI4.Ribbons, Common.Constants.HOI4.UnitMedals
};

#endregion Fields
Expand Down
5 changes: 3 additions & 2 deletions src/IronyModManager.Parser/Games/HOI4/WholeTextParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Created : 02-18-2020
//
// Last Modified By : Mario
// Last Modified On : 01-31-2022
// Last Modified On : 09-27-2022
// ***********************************************************************
// <copyright file="WholeTextParser.cs" company="Mario">
// Mario
Expand Down Expand Up @@ -48,7 +48,8 @@ public class WholeTextParser : Generic.WholeTextParser, IGameParser
Common.Constants.HOI4.AIStrategyPlanes, Common.Constants.HOI4.AIStrategy,
Common.Constants.HOI4.IntelligenceAgencies, Common.Constants.HOI4.ScriptedGui,
Common.Constants.HOI4.Units, Common.Constants.HOI4.History, Common.Constants.HOI4.Generation,
Common.Constants.HOI4.IdeaTags, Common.Constants.HOI4.Terrain
Common.Constants.HOI4.IdeaTags, Common.Constants.HOI4.Terrain, Common.Constants.HOI4.ProfilePictures,
Common.Constants.HOI4.PeaceConference
};

#endregion Fields
Expand Down

0 comments on commit c8cba6b

Please sign in to comment.