Skip to content

Commit 9472ae7

Browse files
committed
Likely fix for character selection changing bug reported by Punishbear. Improved accuracy of some item drops on Earth.
1 parent d7e589b commit 9472ae7

File tree

5 files changed

+66
-27
lines changed

5 files changed

+66
-27
lines changed

MainWindow.xaml.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public partial class MainWindow : Window
4343

4444
private System.Timers.Timer saveTimer;
4545
private DateTime lastUpdateCheck;
46+
private int saveCount;
4647

4748
public MainWindow()
4849
{
@@ -111,6 +112,7 @@ public MainWindow()
111112

112113
GameInfo.GameInfoUpdate += OnGameInfoUpdate;
113114
dataBackups.CanUserDeleteRows = false;
115+
saveCount = 0;
114116
}
115117

116118
private void Window_Loaded(object sender, RoutedEventArgs e)
@@ -397,8 +399,7 @@ private void BtnRestore_Click(object sender, RoutedEventArgs e)
397399

398400
private void ChkAutoBackup_Click(object sender, RoutedEventArgs e)
399401
{
400-
bool autoBackup = chkAutoBackup.IsChecked.HasValue ? chkAutoBackup.IsChecked.Value : false;
401-
Properties.Settings.Default.AutoBackup = autoBackup;
402+
Properties.Settings.Default.AutoBackup = chkAutoBackup.IsChecked.HasValue ? chkAutoBackup.IsChecked.Value : false;
402403
Properties.Settings.Default.Save();
403404
}
404405

@@ -415,7 +416,12 @@ private void OnSaveFileChanged(object source, FileSystemEventArgs e)
415416
//and a backup only occurs after the timer expires.
416417
saveTimer.Interval = 10000;
417418
saveTimer.Enabled = true;
418-
updateCurrentWorldAnalyzer();
419+
saveCount++;
420+
if (saveCount == 4)
421+
{
422+
updateCurrentWorldAnalyzer();
423+
saveCount = 0;
424+
}
419425
}
420426
catch (Exception ex)
421427
{
@@ -470,7 +476,11 @@ private void OnSaveTimerElapsed(Object source, System.Timers.ElapsedEventArgs e)
470476
}*/
471477
}
472478
}
473-
//updateCurrentWorldAnalyzer();
479+
if (saveCount != 0)
480+
{
481+
updateCurrentWorldAnalyzer();
482+
saveCount = 0;
483+
}
474484

475485
if (gameProcess == null || gameProcess.HasExited)
476486
{

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// You can specify all the values or you can default the Build and Revision Numbers
5252
// by using the '*' as shown below:
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("1.95.22.0")]
55-
[assembly: AssemblyFileVersion("1.95.22.0")]
54+
[assembly: AssemblyVersion("1.95.23.0")]
55+
[assembly: AssemblyFileVersion("1.95.23.0")]

RemnantCharacter.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,18 @@ public RemnantCharacter()
5151
public void processSaveData(string savetext)
5252
{
5353
//get campaign info
54-
string campaigntext = savetext.Split(new string[] { "/Game/Campaign_Main/Quest_Campaign_Ward13.Quest_Campaign_Ward13" }, StringSplitOptions.None)[0];
55-
string[] campaign = campaigntext.Split(new string[] { "/Game/Campaign_Main/Quest_Campaign_City.Quest_Campaign_City" }, StringSplitOptions.None);
56-
if (campaign.Length > 1)
54+
string strCmpaignEnd = "/Game/Campaign_Main/Quest_Campaign_Main.Quest_Campaign_Main_C";
55+
string strCampaignStart = "/Game/Campaign_Main/Quest_Campaign_City.Quest_Campaign_City";
56+
int campaignEnd = savetext.IndexOf(strCmpaignEnd);
57+
int campaignStart = savetext.IndexOf(strCampaignStart);
58+
if (campaignStart != -1 && campaignEnd != -1)
5759
{
58-
campaigntext = campaign[1];
60+
string campaigntext = savetext.Substring(0, campaignEnd);
61+
campaignStart = campaigntext.LastIndexOf(strCampaignStart);
62+
campaigntext = campaigntext.Substring(campaignStart);
5963
RemnantWorldEvent.ProcessEvents(this, campaigntext, RemnantWorldEvent.ProcessMode.Campaign);
60-
} else
64+
}
65+
else
6166
{
6267
Console.WriteLine("Campaign not found; likely in tutorial mission.");
6368
}

RemnantWorldEvent.cs

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,21 @@ static public void ProcessEvents(RemnantCharacter character, string eventsText,
6767
{
6868
Dictionary<string, Dictionary<string, string>> zones = new Dictionary<string, Dictionary<string, string>>();
6969
Dictionary<string, List<RemnantWorldEvent>> zoneEvents = new Dictionary<string, List<RemnantWorldEvent>>();
70+
List<RemnantWorldEvent> churchEvents = new List<RemnantWorldEvent>();
7071
foreach (string z in GameInfo.Zones)
7172
{
7273
zones.Add(z, new Dictionary<string, string>());
7374
zoneEvents.Add(z, new List<RemnantWorldEvent>());
7475
}
7576

77+
string zone = null;
7678
string currentMainLocation = "Fairview";
7779
string currentSublocation = null;
7880

7981
string eventName = null;
80-
MatchCollection matches = Regex.Matches(eventsText, "(?:/[a-zA-Z0-9_]+){3}/([a-zA-Z0-9]+_[a-zA-Z0-9]+_[a-zA-Z0-9_]+)");
82+
MatchCollection matches = Regex.Matches(eventsText, "(?:/[a-zA-Z0-9_]+){3}/(([a-zA-Z0-9]+_[a-zA-Z0-9]+_[a-zA-Z0-9_]+)|Quest_Church)");
8183
foreach (Match match in matches)
8284
{
83-
RemnantWorldEvent se = new RemnantWorldEvent();
84-
string zone = null;
8585
string eventType = null;
8686
string lastEventname = eventName;
8787
eventName = null;
@@ -98,6 +98,7 @@ static public void ProcessEvents(RemnantCharacter character, string eventsText,
9898
eventType = getEventType(textLine);
9999
if (textLine.Contains("Overworld_Zone"))
100100
{
101+
//process overworld zone marker
101102
currentMainLocation = textLine.Split('/')[4].Split('_')[1] + " " + textLine.Split('/')[4].Split('_')[2] + " " + textLine.Split('/')[4].Split('_')[3];
102103
if (GameInfo.MainLocations.ContainsKey(currentMainLocation))
103104
{
@@ -107,9 +108,18 @@ static public void ProcessEvents(RemnantCharacter character, string eventsText,
107108
{
108109
currentMainLocation = null;
109110
}
111+
continue;
112+
}
113+
else if (textLine.Contains("Quest_Church"))
114+
{
115+
//process Root Mother event
116+
currentMainLocation = "Chapel Station";
117+
eventName = "RootMother";
118+
currentSublocation = "Church of the Harbinger";
110119
}
111120
else if (eventType != null)
112121
{
122+
//process other events, if they're recognized by getEventType
113123
eventName = textLine.Split('/')[4].Split('_')[2];
114124
if (textLine.Contains("OverworldPOI") || textLine.Contains("Sketterling"))
115125
{
@@ -126,12 +136,23 @@ static public void ProcessEvents(RemnantCharacter character, string eventsText,
126136
currentSublocation = null;
127137
}
128138
}
139+
if ("Chapel Station".Equals(currentMainLocation))
140+
{
141+
if (textLine.Contains("Quest_Boss"))
142+
{
143+
currentMainLocation = "Westcourt";
144+
} else
145+
{
146+
currentSublocation = null;
147+
}
148+
}
129149
}
130150

131151
if (mode == ProcessMode.Adventure) currentMainLocation = null;
132152

133153
if (eventName != lastEventname)
134154
{
155+
RemnantWorldEvent se = new RemnantWorldEvent();
135156
// Replacements
136157
if (eventName != null)
137158
{
@@ -156,7 +177,13 @@ static public void ProcessEvents(RemnantCharacter character, string eventsText,
156177
se.Location = string.Join(": ", locationList);
157178
se.Type = eventType;
158179
se.setMissingItems(character);
159-
zoneEvents[zone].Add(se);
180+
if (!"Chapel Station".Equals(currentMainLocation)) {
181+
zoneEvents[zone].Add(se);
182+
}
183+
else
184+
{
185+
churchEvents.Insert(0, se);
186+
}
160187

161188
// rings drop with the Cryptolith on Rhom
162189
if (eventName.Equals("Cryptolith") && zone.Equals("Rhom"))
@@ -207,7 +234,6 @@ static public void ProcessEvents(RemnantCharacter character, string eventsText,
207234
bool navunAdded = false;
208235
RemnantWorldEvent ward13 = new RemnantWorldEvent();
209236
RemnantWorldEvent hideout = new RemnantWorldEvent();
210-
RemnantWorldEvent church = new RemnantWorldEvent();
211237
RemnantWorldEvent undying = new RemnantWorldEvent();
212238
RemnantWorldEvent queen = new RemnantWorldEvent();
213239
RemnantWorldEvent navun = new RemnantWorldEvent();
@@ -228,12 +254,6 @@ static public void ProcessEvents(RemnantCharacter character, string eventsText,
228254
hideout.setMissingItems(character);
229255
if (hideout.MissingItems.Length > 0) orderedEvents.Add(hideout);
230256

231-
church.setKey("RootMother");
232-
church.Name = "Root Mother";
233-
church.Location = "Earth: Church of the Harbinger";
234-
church.Type = "Siege";
235-
church.setMissingItems(character);
236-
237257
undying.setKey("UndyingKing");
238258
undying.Name = "Undying King";
239259
undying.Location = "Rhom: Undying Throne";
@@ -263,7 +283,10 @@ static public void ProcessEvents(RemnantCharacter character, string eventsText,
263283
{
264284
if (mode == ProcessMode.Campaign && !churchAdded && zoneEvents["Earth"][i].Location.Contains("Westcourt"))
265285
{
266-
if (church.MissingItems.Length > 0) orderedEvents.Add(church);
286+
foreach (RemnantWorldEvent rwe in churchEvents)
287+
{
288+
orderedEvents.Add(rwe);
289+
}
267290
churchAdded = true;
268291
}
269292
orderedEvents.Add(zoneEvents["Earth"][i]);
@@ -313,7 +336,7 @@ static public void ProcessEvents(RemnantCharacter character, string eventsText,
313336
static private string getZone(string textLine)
314337
{
315338
string zone = null;
316-
if (textLine.Contains("World_City"))
339+
if (textLine.Contains("World_City") || textLine.Contains("Quest_Church"))
317340
{
318341
zone = "Earth";
319342
}
@@ -343,7 +366,7 @@ static private string getEventType(string textLine)
343366
{
344367
eventType = "World Boss";
345368
}
346-
else if (textLine.Contains("Siege"))
369+
else if (textLine.Contains("Siege")|| textLine.Contains("Quest_Church"))
347370
{
348371
eventType = "Siege";
349372
}

SaveAnalyzer.xaml.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,19 +138,21 @@ private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs
138138

139139
private void CmbCharacter_SelectionChanged(object sender, SelectionChangedEventArgs e)
140140
{
141+
if (cmbCharacter.SelectedIndex == -1 && listCharacters.Count > 0) return;
142+
Console.WriteLine("Selection changed: " + cmbCharacter.SelectedIndex);
141143
if (cmbCharacter.Items.Count > 0 && cmbCharacter.SelectedIndex > -1)
142144
{
143145
dgCampaign.ItemsSource = listCharacters[cmbCharacter.SelectedIndex].CampaignEvents;
144146
if (listCharacters[cmbCharacter.SelectedIndex].AdventureEvents.Count > 0)
145147
{
146148
((TabItem)tabAnalyzer.Items[1]).IsEnabled = true;
147149
dgAdventure.ItemsSource = listCharacters[cmbCharacter.SelectedIndex].AdventureEvents;
150+
148151
} else
149152
{
150153
((TabItem)tabAnalyzer.Items[1]).IsEnabled = false;
151154
if (tabAnalyzer.SelectedIndex == 1) tabAnalyzer.SelectedIndex = 0;
152155
}
153-
//Console.WriteLine(listCharacters[cmbCharacter.SelectedIndex].ToFullString());
154156
txtMissingItems.Text = string.Join("\n", listCharacters[cmbCharacter.SelectedIndex].GetMissingItems());
155157

156158
foreach (TreeViewItem item in treeMissingItems.Items)
@@ -163,7 +165,6 @@ private void CmbCharacter_SelectionChanged(object sender, SelectionChangedEventA
163165
item.Header = rItem.ItemName;
164166
if (!rItem.ItemNotes.Equals("")) item.ToolTip = rItem.ItemNotes;
165167
item.Foreground = treeMissingItems.Foreground;
166-
//((TreeViewItem)treeMissingItems.Items[(int)rItem.ItemMode]).Items.Add(item);
167168
TreeViewItem modeNode = ((TreeViewItem)treeMissingItems.Items[(int)rItem.ItemMode]);
168169
TreeViewItem itemTypeNode = null;
169170
foreach (TreeViewItem typeNode in modeNode.Items)

0 commit comments

Comments
 (0)