Skip to content

Commit

Permalink
improve locations and events
Browse files Browse the repository at this point in the history
  • Loading branch information
Razzmatazzz committed Aug 18, 2023
1 parent 48dd17f commit 7b78745
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 19 deletions.
2 changes: 1 addition & 1 deletion RemnantSaveGuardian/RemnantSaveGuardian.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<UseWindowsForms>true</UseWindowsForms>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>Assets\256.ico</ApplicationIcon>
<AssemblyVersion>1.0.2.1</AssemblyVersion>
<AssemblyVersion>1.0.2.2</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
53 changes: 41 additions & 12 deletions RemnantSaveGuardian/RemnantWorldEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ static public void ProcessEvents_old_again(RemnantCharacter character, string sa

}
}
static public void ProcessEvents(RemnantCharacter character, MatchCollection areas, Dictionary<ProcessMode, Dictionary<Match, Match>> allInjectables, ProcessMode mode)
static public void ProcessEvents(RemnantCharacter character, List<Match> areas, Dictionary<ProcessMode, Dictionary<Match, Match>> allInjectables, ProcessMode mode)
{
Dictionary<string, Dictionary<string, string>> zones = new Dictionary<string, Dictionary<string, string>>();
Dictionary<string, List<RemnantWorldEvent>> zoneEvents = new Dictionary<string, List<RemnantWorldEvent>>();
Expand All @@ -933,7 +933,8 @@ static public void ProcessEvents(RemnantCharacter character, MatchCollection are
Dictionary<string, RemnantWorldEvent> lastTemplates = new();
RemnantWorldEvent lastTileInfo;
RemnantWorldEvent lastEventTree;
List<string> excludeTypes = new() { "Global", "Earth" };
//List<string> excludeTypes = new() { "Global", "Earth" };
List<string> excludeWorlds = new() { "World_Base", "World_Labyrinth" };
var unknownAreaCount = 0;
foreach (Match area in areas)
{
Expand All @@ -950,6 +951,10 @@ static public void ProcessEvents(RemnantCharacter character, MatchCollection are
foreach (Match eventMatch in eventMatches)
{
currentWorld = eventMatch.Groups["world"].Value;
if (excludeWorlds.Contains(currentWorld))
{
continue;
}
var lastTemplate = lastTemplates.ContainsKey(eventMatch.Groups["world"].Value) ? lastTemplates[eventMatch.Groups["world"].Value] : null;
if (lastTemplate != null)
{
Expand All @@ -965,7 +970,7 @@ static public void ProcessEvents(RemnantCharacter character, MatchCollection are
if (eventMatch.Value.Contains("EventTree"))
{
//Debug.WriteLine(eventMatch.Value);
continue;
//continue;
}
if (GameInfo.SubLocations.ContainsKey(eventMatch.Groups["eventName"].Value))
{
Expand Down Expand Up @@ -1090,7 +1095,7 @@ static public void ProcessEvents(RemnantCharacter character, MatchCollection are
};
if (areaEvents.Count == 1 && ignoreSoloEventTypes.Contains(areaEvents[0].RawType))
{
continue;
//continue; // causes Eternal Empress to disappear
}
var invalidFirstZones = new List<string>() {
"World_RootEarth",
Expand All @@ -1110,7 +1115,8 @@ static public void ProcessEvents(RemnantCharacter character, MatchCollection are
"SideD",
"Miniboss",
"Point of Interest",
"OverworldPOI"
"OverworldPOI",
"Story"
};
var exclusiveEvents = areaEvents.FindAll(e => exclusiveTypes.Contains(e.RawType));
if (exclusiveEvents.Count > 0)
Expand All @@ -1132,6 +1138,10 @@ static public void ProcessEvents(RemnantCharacter character, MatchCollection are
RemnantWorldEvent widowsCourt = new RemnantWorldEvent("RedDoeStatue", new List<string>() { currentWorld, "Widow's Court" }, "OverworldPOI");
widowsCourt.setMissingItems(character);
areaEvents.Insert(lastRedThrone+1, widowsCourt);

var matriarch = new RemnantWorldEvent("Amulet_MatriarchsInsignia", new List<string>() { currentWorld, "Widow's Court" }, "Item");
matriarch.setMissingItems(character);
areaEvents.Insert(lastRedThrone+2, matriarch);
}
zoneEvents[currentWorld].AddRange(areaEvents);
}
Expand All @@ -1142,10 +1152,6 @@ static public void ProcessEvents(RemnantCharacter character, MatchCollection are
{
var injectable = new RemnantWorldEvent(injectablePair.Key);
var parent = new RemnantWorldEvent(injectablePair.Value);
if (GameInfo.InjectableParents.ContainsKey(injectable._name))
{
//parent._name = GameInfo.InjectableParents[injectable._name];
}
var world = injectablePair.Key.Groups["world"].Value;
if (!zoneEvents.ContainsKey(world))
{
Expand Down Expand Up @@ -1548,11 +1554,23 @@ static public Dictionary<ProcessMode, Dictionary<Match, Match>> GetInjectables(s
continue;
}
var ev = events[eventIndex];
Match parentEvent = events[eventIndex - 1];
if (ev.Groups["eventType"].Value != "Injectable")
{
continue;
}
var eventName = ev.Groups["eventName"].Value.Split("_").Last();
Match parentEvent;
if (GameInfo.InjectableParents.ContainsKey(eventName))
{
var parentName = GameInfo.InjectableParents[eventName];
parentEvent = events.First(e => e.Groups["eventName"].Value.Split("_").Last() == parentName);
if (parentEvent != null)
{
injectables[processMode].Add(events[eventIndex], parentEvent);
continue;
}
}
parentEvent = events[eventIndex - 1];
if (ev.Groups["world"].Value != parentEvent.Groups["world"].Value || parentEvent.Groups["eventType"].Value == "Injectable")
{
parentEvent = null;
Expand Down Expand Up @@ -1583,12 +1601,23 @@ static public void ProcessEvents(RemnantCharacter character, string saveText)
{
return;
}
var eventGroupMatches = new List<MatchCollection>();
var eventGroupMatches = new List<List<Match>>();
for (var i = 0; i < eventStarts.Count; i++)
{
var eventText = saveText[eventStarts[i].Index..eventEnds[i].Index];
//var matches = Regex.Matches(eventText, @"/Game/(?<world>[\w/]+)/SpawnTables/(?<spawnTable>[\w/]+)\.\w+(?<events>.+)MapGen[\w\W]+?/Script/Remnant\.ZoneActor.{10}(?:.\u0001....(?<tileSet>/.+?))+.{9}ID");
var matches = Regex.Matches(eventText, @"[A-Z0-9]{32}.{5}(?<locationName>[a-zA-Z0-9 ']+)\x00.+?(?:\n.+?)?/Game/(?<world>[\w/]+)/SpawnTables/(?<spawnTable>[\w/]+)\.\w+.{5}(?<events>/.+).{20}MapGen[\w\W]+?/Script/Remnant\.ZoneActor.{10}(?:.\u0001....(?<tileSet>/.+?))+.{9}ID");
var areas = Regex.Split(eventText, @"[A-Z0-9]{32}[\s\S]{5}");
var matches = new List<Match>();
foreach (var ar in areas)
{
//var match = Regex.Match(ar, @"^(?<locationName>[a-zA-Z0-9 ']+)\x00.+?(?:\n.+?)?/Game/(?<world>[\w/]+)/SpawnTables/(?<spawnTable>[\w/]+)\.\w+.{5}(?<events>/.+).{20}MapGen[\w\W]+?/Script/Remnant\.ZoneActor.{10}(?:.\u0001....(?<tileSet>/.+?))+.{9}ID");
var match = Regex.Match(ar, @"^(?<locationName>[a-zA-Z0-9 ']+)[\x00 ][\s\S]+?/Game/(?<world>[\w/]+)/SpawnTables/(?<spawnTable>[\w/]+)\.\w+[\s\S]{5}(?<events>/[\s\S]+)[\s\S]{20}MapGen[\s\S]+?/Script/Remnant\.ZoneActor[\s\S]{10}(?:[\s\S]\u0001[\s\S]{4}(?<tileSet>/.+?))+[\s\S]{9}ID");
if (match.Success)
{
matches.Add(match);
}
}
//var matches = Regex.Matches(eventText, @"[A-Z0-9]{32}.{5}(?<locationName>[a-zA-Z0-9 ']+)\x00.+?(?:\n.+?)?/Game/(?<world>[\w/]+)/SpawnTables/(?<spawnTable>[\w/]+)\.\w+.{5}(?<events>/.+).{20}MapGen[\w\W]+?/Script/Remnant\.ZoneActor.{10}(?:.\u0001....(?<tileSet>/.+?))+.{9}ID");
if (matches.Count > 7)
{
eventGroupMatches.Add(matches);
Expand Down
1 change: 1 addition & 0 deletions RemnantSaveGuardian/Views/Pages/LogPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//using System.Drawing;
using System;
using System.Text.RegularExpressions;
using Wpf.Ui.Common.Interfaces;
using Wpf.Ui.Controls;

Expand Down
18 changes: 12 additions & 6 deletions RemnantSaveGuardian/game.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
],
"subLocations": {
"Jungle": {
"Corruptor": "The Great Bole",
"Shrewd": "The Expanding Glade",
"RavagerStory": "Ravager's Lair",
"RootHorror": "Kaeula's Rest",
Expand All @@ -22,10 +23,10 @@
"HiddenMaze": "Endaira's End",
"TheTangle": "Imperial Gardens",
"TheLament": "The Lament",
"Sarcophagus": "The Lament",
"TheChimney": "Laemir's Lyceum",
"__Sarcophagus": "The Lament",
"__TheChimney": "Laemir's Lyceum",
"WailingField": "Forgotten Field",
"CathedralOfSeasons": "Cathedral Of Seasons",
"CathedralOfSeasons": "Cathedral of Omens",
"Empress": "The Red Throne",
"ManyFaces": "The Great Bole"
},
Expand Down Expand Up @@ -207,9 +208,6 @@
{
"name": "/Items/Trinkets/Rings/SealOfTheEmpress/Ring_SealOfTheEmpress"
},
{
"name": "/Items/Trinkets/Amulets/MatriarchsInsignia/Amulet_MatriarchsInsignia"
},
{
"name": "/Items/Trinkets/Amulets/RedDoeSigil/Amulet_RedDoeSigil",
"notes": "Awarded after giving the Ornate Lockbox item (unopened) found in The Widow's Court location on Yaesha, to The Eternal Empress at the Red Throne location on Yaesha."
Expand Down Expand Up @@ -268,6 +266,9 @@
"Sarcophagus": [
{
"name": "/Items/Gems/Ranged/MetaGems/Extender/MetaGem_Extender"
},
{
"name": "/Items/Trinkets/Rings/BerserkersCrest/Ring_BerserkersCrest"
}
],
"CryptHidden": [
Expand Down Expand Up @@ -500,6 +501,11 @@
{
"name": "/Items/Gems/Ranged/MetaGems/GhostShell/MetaGem_GhostShell"
}
],
"Amulet_MatriarchsInsignia": [
{
"name": "/Items/Trinkets/Amulets/MatriarchsInsignia/Amulet_MatriarchsInsignia"
}
]
},
"Fae": {
Expand Down
9 changes: 9 additions & 0 deletions RemnantSaveGuardian/locales/GameStrings.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/locales/GameStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1917,4 +1917,7 @@
<data name="WidowsCourt" xml:space="preserve">
<value>The Widow's Court</value>
</data>
<data name="Ring_BerserkersCrest" xml:space="preserve">
<value>Berserker's Crest</value>
</data>
</root>

0 comments on commit 7b78745

Please sign in to comment.