Skip to content

Commit

Permalink
Merge pull request #236 from TheNasbit/feature/dlc2
Browse files Browse the repository at this point in the history
DLC: The Forgotten Kingdom
  • Loading branch information
Razzmatazzz authored May 5, 2024
2 parents 4e79144 + 7b93b96 commit d564a07
Show file tree
Hide file tree
Showing 14 changed files with 1,591 additions and 91 deletions.
3 changes: 3 additions & 0 deletions RemnantSaveGuardian/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@
<setting name="OnlyInactive" serializeAs="String">
<value>True</value>
</setting>
<setting name="Wiki" serializeAs="String">
<value>remwiki</value>
</setting>
</RemnantSaveGuardian.Properties.Settings>
</userSettings>
</configuration>
14 changes: 13 additions & 1 deletion RemnantSaveGuardian/Properties/Settings.Designer.cs

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

3 changes: 3 additions & 0 deletions RemnantSaveGuardian/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,8 @@
<Setting Name="OnlyInactive" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="Wiki" Type="System.String" Scope="User">
<Value Profile="(Default)">remwiki</Value>
</Setting>
</Settings>
</SettingsFile>
1 change: 1 addition & 0 deletions RemnantSaveGuardian/RemnantItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class RemnantItem : IEquatable<Object>, IComparable
@"/Items/(?<itemType>Archetypes)/\w+/(?<itemName>Archetype_\w+)(?:\.|$)", // archetypes
@"/Items/Archetypes/(?<archetypeName>\w+)/(?<itemType>\w+)/\w+/(?<itemName>\w+)(?:\.|$)", // perks and skills
@"/Items/(?<itemType>Traits)/(?<traitType>\w+?/)?\w+?/(?<itemName>\w+)(?:\.|$)", // traits
@"/Items/Archetypes/(?<archetypeName>\w+)/PerksAnd(?<itemType>Traits)/(?<itemName>\w+)", // archetype traits dlc2
@"/Items/Archetypes/(?<armorSet>\w+)/(?<itemType>Armor)/(?<itemName>\w+)(?:\.|$)", // armors
@"/Items/(?<itemType>Armor)/(?:\w+/)?(?:(?<armorSet>\w+)/)?(?<itemName>\w+)(?:\.|$)", // armor
@"/Items/(?<itemType>Weapons)/(?:\w+/)+(?<itemName>\w+)(?:\.|$)", // weapons
Expand Down
7 changes: 6 additions & 1 deletion RemnantSaveGuardian/RemnantSaveGuardian.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
<SatelliteResourceLanguages>en;ru;de;es;fr;it;ja;ko;pt-BR;zh-Hans;zh-Hant</SatelliteResourceLanguages>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>Assets\256.ico</ApplicationIcon>
<AssemblyVersion>1.2.2.0</AssemblyVersion>
<AssemblyVersion>1.3.0.0</AssemblyVersion>
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -98,4 +99,8 @@
<ZipDirectory SourceDirectory="$(TargetDir)" Overwrite="True" DestinationFile="$(UserProfile)\Desktop\RemnantSaveGuardian.zip" />
</Target>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="echo Version: $(AssemblyVersion)" />
</Target>

</Project>
116 changes: 96 additions & 20 deletions RemnantSaveGuardian/RemnantWorldEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -956,18 +956,14 @@ static public void ProcessEvents(RemnantCharacter character, List<Match> areas,
foreach (Match eventMatch in eventMatches)
{
var prevWorld = currentWorld;
currentWorld = eventMatch.Groups["world"].Value;
if (currentWorld == null || excludeWorlds.Contains(currentWorld))
string tmpCurrentWorld = eventMatch.Groups["world"].Value;

if (tmpCurrentWorld == null || excludeWorlds.Contains(tmpCurrentWorld))
{
continue;
}

if (currentWorld == "World_DLC1" && prevWorld != null)
{
currentWorld = prevWorld;

}
var lastTemplate = lastTemplates.ContainsKey(currentWorld) ? lastTemplates[currentWorld] : null;
var lastTemplate = lastTemplates.ContainsKey(tmpCurrentWorld) ? lastTemplates[tmpCurrentWorld] : null;
if (lastTemplate != null)
{
currentMainLocation = lastTemplate.RawName;
Expand Down Expand Up @@ -1013,12 +1009,25 @@ static public void ProcessEvents(RemnantCharacter character, List<Match> areas,
continue;
}

currentWorld = tmpCurrentWorld;
if (currentWorld.Contains("_DLC"))
{
if (prevWorld != null)
currentWorld = prevWorld;

if (currentSublocation == "Ancient Canopy" || currentSublocation == "Luminous Vale")
currentWorld = "World_Jungle";
if (currentSublocation == "Forlorn Coast")
currentWorld = "World_Fae";
}

//eventStrings.Add(eventMatch.Value);
//var worldEvent = new RemnantWorldEvent(eventMatch);//, currentArea.Groups["location"].Value.Trim());
var worldEvent = new RemnantWorldEvent(eventMatch.Value, eventMatch.Groups["eventName"].Value, new() { currentWorld }, eventMatch.Groups["eventType"].Value);
worldEvent.TileSet = tileSets;
if (areaEvents.FindIndex(e => e.RawName == worldEvent.RawName) != -1)
{
currentWorld = prevWorld;
continue;
}
if (currentMainLocation != null)
Expand All @@ -1041,14 +1050,16 @@ static public void ProcessEvents(RemnantCharacter character, List<Match> areas,
// Add associated events
if (worldEvent.RawWorld == "World_Nerud" && worldEvent.RawName.Contains("Story"))
{
var cust = new RemnantWorldEvent("TheCustodian", "World_Nerud", "Point of Interest");
var cust = new RemnantWorldEvent("TheCustodian", worldEvent.Locations, "Point of Interest");
cust.setMissingItems(character);
areaEvents.Add(cust);
if (areaEvents.FindIndex(e => e.RawName == "TheCustodian") == -1)
areaEvents.Add(cust);
if (worldEvent.RawName == "IAmLegendStory")
{
var talratha = new RemnantWorldEvent("TalRatha", "World_Nerud", "WorldBoss");
talratha.setMissingItems(character);
areaEvents.Add(talratha);
if (areaEvents.FindIndex(e => e.RawName == "TalRatha") == -1)
areaEvents.Add(talratha);
}

}
Expand All @@ -1058,50 +1069,111 @@ static public void ProcessEvents(RemnantCharacter character, List<Match> areas,
RemnantWorldEvent asylumhouse = new RemnantWorldEvent("AsylumHouse", "World_Fae", "Location");
asylumhouse.Locations.Add("Asylum");
asylumhouse.setMissingItems(character);
areaEvents.Add(asylumhouse);
if (areaEvents.FindIndex(e => e.RawName == "AsylumHouse") == -1)
areaEvents.Add(asylumhouse);

RemnantWorldEvent abberation = new RemnantWorldEvent("AsylumChainsaw", "World_Fae", "Abberation");
abberation.Locations.Add("Asylum");
abberation.setMissingItems(character);
areaEvents.Add(abberation);
if (areaEvents.FindIndex(e => e.RawName == "AsylumChainsaw") == -1)
areaEvents.Add(abberation);

RemnantWorldEvent nightweb = new RemnantWorldEvent("Nightweb", "World_Fae", "Point of Interest");
nightweb.Locations.Add("TormentedAsylum");
nightweb.setMissingItems(character);
areaEvents.Add(nightweb);
if (areaEvents.FindIndex(e => e.RawName == "Nightweb") == -1)
areaEvents.Add(nightweb);

}
else if (worldEvent.RawName == "FaelinFaerlin")
{
RemnantWorldEvent faerlin = new RemnantWorldEvent("Faerin", "Faerin", new() { "World_Fae", "Malefic Gallery" }, "Boss");
faerlin.setMissingItems(character);
areaEvents.Add(faerlin);
if (areaEvents.FindIndex(e => e.RawName == "Faerin") == -1)
areaEvents.Add(faerlin);
//addEventToZones(zoneEvents, faerlin);
}
// Abberation
else if (worldEvent.RawName == "HiddenMaze")
{
RemnantWorldEvent fester = new RemnantWorldEvent("Fester", worldEvent.Locations, "Abberation");
fester.setMissingItems(character);
areaEvents.Add(fester);
if (areaEvents.FindIndex(e => e.RawName == "Fester") == -1)
areaEvents.Add(fester);
}
else if (worldEvent.RawName == "TheLament")
{
RemnantWorldEvent wither = new RemnantWorldEvent("Wither", worldEvent.Locations, "Abberation");
wither.setMissingItems(character);
areaEvents.Add(wither);
if (areaEvents.FindIndex(e => e.RawName == "Wither") == -1)
areaEvents.Add(wither);
}
else if (worldEvent.RawName == "TheTangle")
{
RemnantWorldEvent mantagora = new RemnantWorldEvent("Mantagora", worldEvent.Locations, "Abberation");
mantagora.setMissingItems(character);
areaEvents.Add(mantagora);
if (areaEvents.FindIndex(e => e.RawName == "Mantagora") == -1)
areaEvents.Add(mantagora);
}
else if (worldEvent.RawName == "TheCustodian")
{
var drzyr = new RemnantWorldEvent("DrzyrReplicator", worldEvent.Locations, "Merchant");
drzyr.setMissingItems(character);
areaEvents.Add(drzyr);
if (areaEvents.FindIndex(e => e.RawName == "DrzyrReplicator") == -1)
areaEvents.Add(drzyr);
}
else if (worldEvent.RawName == "OneTrueKingStory")
{
// Story-Map
var coast = new RemnantWorldEvent("FarlornCoast", "FarlornCoast", new() { "World_Fae", "Farlorn Coast"}, worldEvent.RawType);
coast.setMissingItems(character);
if (areaEvents.FindIndex(e => e.RawName == "FarlornCoast") == -1)
areaEvents.Add(coast);
// Aberrations
RemnantWorldEvent abberationGeorge = new RemnantWorldEvent("CoastPig", "World_Fae", "Abberation");
abberationGeorge.Locations.Add("Farlorn Coast");
abberationGeorge.setMissingItems(character);
if (areaEvents.FindIndex(e => e.RawName == "CoastPig") == -1)
areaEvents.Add(abberationGeorge);

RemnantWorldEvent preacher = new RemnantWorldEvent("Preacher", "World_Fae", "Event");
preacher.Locations.Add("Farlorn Coast");
preacher.setMissingItems(character);
if (areaEvents.FindIndex(e => e.RawName == "Preacher") == -1)
areaEvents.Add(preacher);

RemnantWorldEvent abberationAtoner = new RemnantWorldEvent("CoastAtoner", "World_Fae", "Abberation");
abberationAtoner.Locations.Add("Farlorn Coast");
abberationAtoner.setMissingItems(character);
if (areaEvents.FindIndex(e => e.RawName == "CoastAtoner") == -1)
areaEvents.Add(abberationAtoner);
//Merchant
var leywise = new RemnantWorldEvent("Leywise", "Leywise", new() { "World_Fae", "Farlorn Coast" }, "Merchant");
leywise.setMissingItems(character);
if (areaEvents.FindIndex(e => e.RawName == "FarlornCoast") == -1)
areaEvents.Add(leywise);
}
else if (worldEvent.RawName == "DLC2Story")
{
if (currentSublocation == "Ancient Canopy")
{
var upper = new RemnantWorldEvent("AncientCanopy", worldEvent.Locations, worldEvent.RawType);
upper.setMissingItems(character);
if (areaEvents.FindIndex(e => e.RawName == "AncientCanopy") == -1)
areaEvents.Add(upper);

var walt = new RemnantWorldEvent("Rothinderahenwalt", worldEvent.Locations, "Merchant");
walt.setMissingItems(character);
if (areaEvents.FindIndex(e => e.RawName == "Rothinderahenwalt") == -1)
areaEvents.Add(walt);
}
else if (currentSublocation == "Luminous Vale")
{
var lower = new RemnantWorldEvent("LuminousVale", worldEvent.Locations, worldEvent.RawType);
lower.setMissingItems(character);
if (areaEvents.FindIndex(e => e.RawName == "LuminousVale") == -1)
areaEvents.Add(lower);
}
}
}
catch (Exception ex)
Expand Down Expand Up @@ -1195,6 +1267,10 @@ static public void ProcessEvents(RemnantCharacter character, List<Match> areas,
//Logger.Warn($"Injectable world {world} not found in {mode} events");
if (world == "World_DLC1")
world = "World_Fae";
else if (world == "World_DLC2")
world = "World_Jungle";
else if (world == "World_DLC3")
world = "World_Nerud";
else
continue;
}
Expand Down Expand Up @@ -1573,7 +1649,7 @@ static public Dictionary<ProcessMode, Dictionary<Match, Match>> GetInjectables(s
campaignStart = campaignBlob.LastIndexOf(strCampaignStart);
eventBlobs[ProcessMode.Campaign] = campaignBlob.Substring(campaignStart);
}
var adventureMatch = Regex.Match(saveText, @"/Game/World_(?<world>\w+)/Quests/Quest_AdventureMode(_[a-zA-Z]+)?/Quest_AdventureMode(_[a-zA-Z]+)?_\w+.Quest_AdventureMode(_[a-zA-Z]+)?_\w+_C");
var adventureMatch = Regex.Match(saveText, @"/Game/World_(?<world>\w+)/Quests/Quest_AdventureMode(_[a-zA-Z0-9]+)?/Quest_AdventureMode(_[a-zA-Z0-9]+)?_\w+.Quest_AdventureMode(_[a-zA-Z0-9]+)?_\w+_C");
if (adventureMatch.Success)
{
int adventureEnd = adventureMatch.Index;
Expand Down
9 changes: 8 additions & 1 deletion RemnantSaveGuardian/Views/Pages/SettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
xmlns:lex="http://wpflocalizeextension.codeplex.com"
lex:LocalizeDictionary.DesignCulture="en"
lex:ResxLocalizationProvider.DefaultAssembly="RemnantSaveGuardian"
lex:ResxLocalizationProvider.DefaultDictionary="Strings"
lex:ResxLocalizationProvider.DefaultDictionary="Strings"
Scrollable="True"
xmlns:properties="clr-namespace:RemnantSaveGuardian.Properties">
<ui:UiPage.Resources>
Expand Down Expand Up @@ -127,6 +127,13 @@
</ComboBox>
<TextBlock Name="lblStartPage" Text="{lex:Loc}" ToolTip="{lex:Loc}" VerticalAlignment="Center" Margin="20,0,0,0"/>
</WrapPanel>
<WrapPanel Margin="0,8,0,0">
<ComboBox Name="cmbWiki" VerticalAlignment="Top" Width="150" SelectionChanged="cmbWiki_SelectionChanged">
<ComboBoxItem Content="{lex:Loc Fextralife}" Tag="fextrawiki"/>
<ComboBoxItem Content="{lex:Loc RemnantWiki}" Tag="remwiki"/>
</ComboBox>
<TextBlock Name="lblWiki" Text="{lex:Loc}" ToolTip="{lex:Loc}" VerticalAlignment="Center" Margin="20,0,0,0"/>
</WrapPanel>
<WrapPanel Margin="0,8,0,0">
<ComboBox Name="cmbMissingItemColor" VerticalAlignment="Top" Width="150" SelectionChanged="CmbMissingItemColor_SelectionChanged">
<ComboBox.Items>
Expand Down
23 changes: 23 additions & 0 deletions RemnantSaveGuardian/Views/Pages/SettingsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ public SettingsPage(ViewModels.SettingsViewModel viewModel)
}
}

foreach (ComboBoxItem item in cmbWiki.Items)
{
if (item.Tag.ToString() == Properties.Settings.Default.Wiki)
{
cmbWiki.SelectedItem = item;
}
}

var langs = Application.Current.Properties["langs"] as CultureInfo[];

cmbSwitchLanguage.ItemsSource = langs.Select(e => e.NativeName);
Expand Down Expand Up @@ -334,6 +342,21 @@ private void cmbStartPage_SelectionChanged(object sender, SelectionChangedEventA
Properties.Settings.Default.StartPage = startPage;
}

private void cmbWiki_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var selected = cmbWiki.SelectedItem as ComboBoxItem;
if (selected == null)
{
return;
}
var wiki = selected.Tag.ToString();
if (wiki == Properties.Settings.Default.Wiki)
{
return;
}
Properties.Settings.Default.Wiki = wiki;
}

private void cmbSwitchLanguage_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (cmbSwitchLanguage.SelectedIndex > -1)
Expand Down
Loading

0 comments on commit d564a07

Please sign in to comment.