Skip to content

Commit

Permalink
Merge pull request #193 from TheNasbit/DLC1
Browse files Browse the repository at this point in the history
DLC1: The Awakened King
  • Loading branch information
Razzmatazzz authored Nov 22, 2023
2 parents 7a2ed9f + 3137746 commit 0a35f5d
Show file tree
Hide file tree
Showing 7 changed files with 2,039 additions and 725 deletions.
5 changes: 4 additions & 1 deletion RemnantSaveGuardian/RemnantCharacter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ public static List<RemnantCharacter> GetCharactersFromSave(RemnantSave remnantSa
try
{
string profileData = remnantSave.GetProfileData();
var archetypes = Regex.Matches(profileData, @"/Game/(World_Base|World_DLC\d)/Items/Archetypes/(?<archetype>\w+)/Archetype_\w+_UI\.Archetype_\w+_UI_C");
#if DEBUG
File.WriteAllText(remnantSave.SaveProfilePath.Replace(".sav", ".txt"), profileData);
#endif
var archetypes = Regex.Matches(profileData, @"/Game/World_(Base|DLC\d+)/Items/Archetypes/(?<archetype>\w+)/Archetype_\w+_UI\.Archetype_\w+_UI_C");
var inventoryStarts = Regex.Matches(profileData, "/Game/Characters/Player/Base/Character_Master_Player.Character_Master_Player_C");
var inventoryEnds = Regex.Matches(profileData, "[^.]Character_Master_Player_C");
for (var i = 0; i < inventoryStarts.Count; i++)
Expand Down
11 changes: 7 additions & 4 deletions RemnantSaveGuardian/RemnantItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ public class RemnantItem : IEquatable<Object>, IComparable
@"/Items/(?<itemType>Mods)/\w+/(?<itemName>\w+)(?:\.|$)", // weapon mods
@"/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/(?<itemType>Traits)/(?<traitType>\w+?/)?\w+?/(?<itemName>\w+)(?:\.|$)", // traits
@"/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
@"/Items/(?<itemType>Gems)/(?:\w+/)+(?<itemName>\w+)(?:\.|$)", // gems
@"/Items/Armor/(?:\w+/)?(?<itemType>Relic)Testing/(?:\w+/)+(?<itemName>\w+)(?:\.|$)", // relics
@"/Items/(?<itemType>Relic)s/(?:\w+/)+(?<itemName>\w+)(?:\.|$)", // relics
@"/Items/Materials/(?<itemType>Engrams)/(?<itemName>\w+)(?:\.|$)", // engrams
@"/(?<itemType>Quests)/Quest_\w+/Items/(?<itemName>\w+)(?:\.|$)", // quest items
@"/Items/(?<itemType>Materials)/World/\w+/(?<itemName>\w+)(?:\.|$)", // materials
Expand All @@ -33,7 +35,7 @@ public enum RemnantItemMode
private string _type;
private string _set;
private string _part;
public string Name {
public string Name {
get
{
if (this._set != "" && this._part != "")
Expand All @@ -49,7 +51,7 @@ public string Name {
}
}
return Loc.GameT(_name);
}
}
}
public string RawName
{
Expand Down Expand Up @@ -96,7 +98,7 @@ public RemnantItem(string nameOrKey)
this.Coop = false;
TileSet = "";
IsArmorSet = true;
foreach (string pattern in ItemKeyPatterns) {
foreach (string pattern in ItemKeyPatterns) {
var nameMatch = Regex.Match(nameOrKey, pattern);
if (!nameMatch.Success)
{
Expand All @@ -107,6 +109,7 @@ public RemnantItem(string nameOrKey)
this._name = nameMatch.Groups["itemName"].Value;
if (nameMatch.Groups.ContainsKey("armorSet"))
{
//this._type = "Armor";
this._set = nameMatch.Groups["armorSet"].Value;
var armorMatch = Regex.Match(this._name, @"Armor_(?<armorPart>\w+)_\w+");
if (armorMatch.Success)
Expand Down
43 changes: 28 additions & 15 deletions RemnantSaveGuardian/RemnantWorldEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public string Name
}
}
public List<RemnantItem> MissingItems {
get
get
{
return mItems;
}
Expand Down Expand Up @@ -139,7 +139,8 @@ public RemnantWorldEvent(string key, string name, List<string> locations, string
}
if (type.Contains("Injectable") || type.Contains("Abberation"))
{
_name = _name.Split('_').Last();
var nameSplit = _name.Split('_');
_name = nameSplit.Last() == "DLC" ? nameSplit[nameSplit.Length-2] : nameSplit.Last();
}
if (type == "RootEarth")
{
Expand Down Expand Up @@ -434,11 +435,7 @@ static public void ProcessEventsOld(RemnantCharacter character, string savetext,
}
}

List<RemnantWorldEvent> eventList = character.CampaignEvents;
if (mode == ProcessMode.Adventure)
{
eventList = character.AdventureEvents;
}
List<RemnantWorldEvent> eventList = mode==ProcessMode.Adventure?character.AdventureEvents:character.CampaignEvents;
eventList.Clear();

/*bool churchAdded = false;
Expand Down Expand Up @@ -595,7 +592,7 @@ static public void ProcessEvents_old_again(RemnantCharacter character, string sa
{
return;
}

if (eventEnds.Count != eventStarts.Count)
{
return;
Expand Down Expand Up @@ -942,7 +939,7 @@ static public void ProcessEvents(RemnantCharacter character, List<Match> areas,
RemnantWorldEvent lastEventTree;
//List<string> excludeTypes = new() { "Global", "Earth" };
List<string> excludeWorlds = new() { "World_Base", "World_Labyrinth" };
List<string> excludeEventDetails = new() { "TheHunterDream" };
List<string> excludeEventDetails = new() { "TheHunterDream", "Dranception" };
var unknownAreaCount = 0;
foreach (Match area in areas)
{
Expand All @@ -958,12 +955,19 @@ static public void ProcessEvents(RemnantCharacter character, List<Match> areas,
MatchCollection eventMatches = Regex.Matches(area.Groups["events"].Value, @"/Game/(?<world>(?:World|Campaign)_\w+)/Quests/(?:Quest_)?(?<eventType>[a-zA-Z0-9]+)_(?<eventName>\w+)/(?<details>\w+)\.\w+");
foreach (Match eventMatch in eventMatches)
{
var prevWorld = currentWorld;
currentWorld = eventMatch.Groups["world"].Value;
if (currentWorld == null || excludeWorlds.Contains(currentWorld))
{
continue;
}
var lastTemplate = lastTemplates.ContainsKey(eventMatch.Groups["world"].Value) ? lastTemplates[eventMatch.Groups["world"].Value] : null;

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

}
var lastTemplate = lastTemplates.ContainsKey(currentWorld) ? lastTemplates[currentWorld] : null;
if (lastTemplate != null)
{
currentMainLocation = lastTemplate.RawName;
Expand All @@ -987,6 +991,10 @@ static public void ProcessEvents(RemnantCharacter character, List<Match> areas,
{
currentSublocation = area.Groups["locationName"].Value;
}
if (currentSublocation == "Consecrated Throne")
{
continue;
}
if (currentSublocation == null && eventMatch.Groups["eventType"].Value != "OverworldPOI")
{
if (spawnTable != null)
Expand All @@ -1006,7 +1014,8 @@ static public void ProcessEvents(RemnantCharacter character, List<Match> areas,
}

//eventStrings.Add(eventMatch.Value);
var worldEvent = new RemnantWorldEvent(eventMatch);//, currentArea.Groups["location"].Value.Trim());
//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)
{
Expand Down Expand Up @@ -1323,7 +1332,7 @@ static public void ProcessEventsAC(RemnantCharacter character, string saveText,
firstZone = zone;
}
//Debug.WriteLine("Parse: " + textLine);

if (textLine.Contains("Ring") || textLine.Contains("Amulet"))
{
//eventName = textLine.Split('/')[4].Split('_')[3];
Expand Down Expand Up @@ -1561,7 +1570,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/Quest_AdventureMode_\w+.Quest_AdventureMode_\w+_C");
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");
if (adventureMatch.Success)
{
int adventureEnd = adventureMatch.Index;
Expand All @@ -1586,7 +1595,9 @@ static public Dictionary<ProcessMode, Dictionary<Match, Match>> GetInjectables(s
{
continue;
}
var eventName = ev.Groups["eventName"].Value.Split("_").Last();

var eventNameSplitted = ev.Groups["eventName"].Value.Split("_");
var eventName = eventNameSplitted.Last() == "DLC" ? eventNameSplitted[eventNameSplitted.Length-2] : eventNameSplitted.Last();
Match parentEvent;
if (GameInfo.InjectableParents.ContainsKey(eventName))
{
Expand Down Expand Up @@ -1677,7 +1688,9 @@ static public void ProcessEvents(RemnantCharacter character, string saveText)
static public void ProcessEvents(RemnantCharacter character)
{
var savetext = RemnantSave.DecompressSaveAsString(character.Save.WorldSaves[character.WorldIndex]);
//File.WriteAllText(character.Save.WorldSaves[character.WorldIndex].Replace(".sav", ".txt"), savetext);
#if DEBUG
System.IO.File.WriteAllText(character.Save.WorldSaves[character.WorldIndex].Replace(".sav", ".txt"), savetext);
#endif
ProcessEvents(character, savetext);
}

Expand Down
Loading

0 comments on commit 0a35f5d

Please sign in to comment.