Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 62 additions & 28 deletions PreloadAlert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class PreloadAlert : BaseSettingsPlugin<PreloadAlertSettings>
public static Dictionary<string, PreloadConfigLine> Strongboxes;
public static Dictionary<string, PreloadConfigLine> Preload;
public static Dictionary<string, PreloadConfigLine> Bestiary;
public static Dictionary<string, PreloadConfigLine> ExpeditionLeague;
public static Color AreaNameColor;
private readonly object _locker = new object();
private Dictionary<string, PreloadConfigLine> alertStrings;
Expand Down Expand Up @@ -103,7 +104,7 @@ public override void DrawSettings()
$"{GameController.Area.CurrentArea.Name}.txt");

DebugWindow.LogMsg(path);

File.WriteAllLines(path, PreloadDebug);
}

Expand Down Expand Up @@ -183,7 +184,7 @@ public override void DrawSettings()
}
}
ImGui.Text($"Area Change Count: {GameController.Game.AreaChangeCount}");

if (ImGui.Button("Close")) PreloadDebugAction = null;
};
}
Expand Down Expand Up @@ -273,8 +274,8 @@ public override void AreaChange(AreaInstance area)
Core.ParallelRunner.Run(new Coroutine(Parse(), this, "Preload parse"));

isLoading = false;
}
}

private IEnumerator Parse()
{
if (!working)
Expand All @@ -287,30 +288,30 @@ private IEnumerator Parse()
debugInformation.TickAction(() =>
{
try
{
var memory = GameController.Memory;
FilesFromMemory filesFromMemory = new FilesFromMemory(memory);
var AllFiles = filesFromMemory.GetAllFilesSync();
int areaChangeCount = GameController.Game.AreaChangeCount;
foreach (var file in AllFiles)
{
if (file.Value.ChangeCount == areaChangeCount)
{
var text = file.Key;
if (text.Contains('@')) text = text.Split('@')[0];
lock (_locker)
{
PreloadDebug.Add(text);
}
CheckForPreload(text);
}
}
}
catch (Exception e)
{
DebugWindow.LogError($"{nameof(PreloadAlert)} -> {e}");
{
var memory = GameController.Memory;
FilesFromMemory filesFromMemory = new FilesFromMemory(memory);
var AllFiles = filesFromMemory.GetAllFilesSync();
int areaChangeCount = GameController.Game.AreaChangeCount;
foreach (var file in AllFiles)
{
if (file.Value.ChangeCount == areaChangeCount)
{
var text = file.Key;
if (text.Contains('@')) text = text.Split('@')[0];

lock (_locker)
{
PreloadDebug.Add(text);
}

CheckForPreload(text);
}
}
}
catch (Exception e)
{
DebugWindow.LogError($"{nameof(PreloadAlert)} -> {e}");
}

lock (_locker)
Expand Down Expand Up @@ -660,6 +661,26 @@ private void SetupPredefinedConfigs()
new PreloadConfigLine {Text = "Malachai Strongbox", FastColor = () => Settings.MalachaiStrongbox}
}
};

ExpeditionLeague = new Dictionary<string, PreloadConfigLine>
{
{
"Metadata/Monsters/LeagueExpedition/NPC/ExpeditionTujen",
new PreloadConfigLine {Text = "Tujen, The Haggler", FastColor = () => Settings.ExpeditionTujen}
},
{
"Metadata/Monsters/LeagueExpedition/NPC/ExpeditionDannig",
new PreloadConfigLine {Text = "Dannig, Warrior Skald", FastColor = () => Settings.ExpeditionDannig}
},
{
"Metadata/Monsters/LeagueExpedition/NPC/ExpeditionRog; ",
new PreloadConfigLine {Text = "Rog, The Dealer", FastColor = () => Settings.ExpeditionRog}
},
{
"Metadata/Monsters/LeagueExpedition/NPC/ExpeditionGwennen_",
new PreloadConfigLine {Text = "Gwennen, The Gambler", FastColor = () => Settings.ExpeditionGwennen}
}
};

Preload = new Dictionary<string, PreloadConfigLine>
{
Expand Down Expand Up @@ -897,6 +918,19 @@ private void CheckForPreload(string text)
alerts[alert.Text] = alert;
}
}

if (Settings.Expedition)
{
var expedition_alert = ExpeditionLeague.Where(kv => text.StartsWith(kv.Key, StringComparison.OrdinalIgnoreCase)).Select(kv => kv.Value)
.FirstOrDefault();

if (expedition_alert == null) return;

lock (_locker)
{
alerts[expedition_alert.Text] = expedition_alert;
}
}
}
}
}
10 changes: 10 additions & 0 deletions PreloadAlertSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public PreloadAlertSettings()
CorruptedArea = new ToggleNode(true);
CorruptedTitle = new ToggleNode(true);
Bestiary = new ToggleNode(true);
Expedition = new ToggleNode(true);
ExpeditionTujen = new ColorBGRA(255, 242, 255, 255);
ExpeditionDannig = new ColorBGRA(255, 222, 13, 255);
ExpeditionRog = new ColorBGRA(255, 237, 12, 255);
ExpeditionGwennen = new ColorBGRA(255, 32, 219, 255);
TextSize = new RangeNode<int>(16, 10, 50);
BackgroundColor = new ColorBGRA(0, 0, 0, 255);
DefaultTextColor = new ColorBGRA(210, 210, 210, 255);
Expand Down Expand Up @@ -237,5 +242,10 @@ public PreloadAlertSettings()
public ColorNode UlyssesMorvant { get; set; }
public ColorNode AurelioVoidsinger { get; set; }
public ToggleNode Bestiary { get; set; }
public ToggleNode Expedition { get; set; }
public ColorNode ExpeditionTujen { get; set; }
public ColorNode ExpeditionDannig { get; set; }
public ColorNode ExpeditionRog { get; set; }
public ColorNode ExpeditionGwennen { get; set; }
}
}