Skip to content

Commit

Permalink
Parser: Fixed an issue where Ensemble cleanup could randomly cause a …
Browse files Browse the repository at this point in the history
…concurrency exception when debugging

Parser: Fixed an issue where Ensemble-Sourced items were receiving a 'races' field instead of the 'r' field for the whole Faction (this is likely the cause of why many TWW pre-patch 'Recruit' items were not being properly flagged as collected in Unique mode from their matching Faction-restricted BFA Ensemble shared appearances) (fixes #1717)
  • Loading branch information
ImUnicke committed Aug 14, 2024
1 parent 03ddc24 commit a02b623
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 27 deletions.
Binary file modified .contrib/Parser/Parser.exe
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ partial class Export
new [] { @";[\s]*", @";" },
new [] { @",[\s]*", @"," },
new [] { @"[\s]+=[\s]+", @"=" },
new [] { @"[\s]+==[\s]+", @"==" },
new [] { @"[\s]+>=[\s]+", @">=" },
new [] { @"[\s]+<=[\s]+", @"<=" },
new [] { @"[\s]+>[\s]+", @">" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using ATT.DB.Types;
using ATT.FieldTypes;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using static ATT.Export;
Expand Down Expand Up @@ -576,7 +577,7 @@ private static bool Process(IDictionary<string, object> data)

private static void CaptureDebugDBData(IDictionary<string, object> data)
{
foreach (KeyValuePair<string, SortedDictionary<decimal, IDictionary<string, object>>> dbKeyDatas in DebugDBs)
foreach (KeyValuePair<string, ConcurrentDictionary<decimal, IDictionary<string, object>>> dbKeyDatas in DebugDBs)
{
if (data.TryGetValue(dbKeyDatas.Key, out decimal keyValue) || dbKeyDatas.Key == "questID" && (
data.TryGetValue("questIDA", out keyValue) || data.TryGetValue("questIDA", out keyValue)) && keyValue > 0)
Expand Down Expand Up @@ -830,6 +831,7 @@ private static void DoConditionalDataMerging(IDictionary<string, object> data)

// ensure the FilterID for this data is double-checked after merging in the shared data
Objects.AssignFilterID(data);
Objects.AssignFactionID(data);

// Currently, this merges in data from actual Recipes to other non-Recipe Items which are linked to the same SpellID
// i.e. /att i:200037 causing them to magically become Recipes!
Expand Down
12 changes: 7 additions & 5 deletions .contrib/Source Code/Parser/Framework/Framework.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using ATT.DB;
using ATT.FieldTypes;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
Expand Down Expand Up @@ -488,8 +489,8 @@ public static ParseStage CurrentParseStage
/// A Dictionary of key-ID types and the respective objects which contain the specified key which will be captured and output during Debug runs</para>
/// NOTE: Each key name/value may contain multiple sets of data due to duplication of individual listings
/// </summary>
public static Dictionary<string, SortedDictionary<decimal, IDictionary<string, object>>> DebugDBs { get; }
= new Dictionary<string, SortedDictionary<decimal, IDictionary<string, object>>>();
public static ConcurrentDictionary<string, ConcurrentDictionary<decimal, IDictionary<string, object>>> DebugDBs { get; }
= new ConcurrentDictionary<string, ConcurrentDictionary<decimal, IDictionary<string, object>>>();

/// <summary>
/// A collection of named format strings for logging messages
Expand Down Expand Up @@ -653,7 +654,7 @@ public static void ApplyConfigSettings()
{
foreach (string key in configDebugDBs)
{
DebugDBs[key] = new SortedDictionary<decimal, IDictionary<string, object>>();
DebugDBs[key] = new ConcurrentDictionary<decimal, IDictionary<string, object>>();
}
}
ImportConfiguredObjectTypes(Config["ObjectTypes"]);
Expand Down Expand Up @@ -1700,9 +1701,10 @@ public static void Export()
// Export custom Debug DB data to the Debugging folder. (as JSON for simplicity)
var culture = Thread.CurrentThread.CurrentCulture;
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
foreach (KeyValuePair<string, SortedDictionary<decimal, IDictionary<string, object>>> dbKeyDatas in DebugDBs)
foreach (KeyValuePair<string, ConcurrentDictionary<decimal, IDictionary<string, object>>> dbKeyDatas in DebugDBs)
{
File.WriteAllText(Path.Combine(debugFolder.FullName, dbKeyDatas.Key + "_DebugDB.json"), ToJSON(dbKeyDatas.Value), Encoding.UTF8);
File.WriteAllText(Path.Combine(debugFolder.FullName, dbKeyDatas.Key + "_DebugDB.json"),
ToJSON(new SortedDictionary<decimal, IDictionary<string, object>>(dbKeyDatas.Value)), Encoding.UTF8);
}
Thread.CurrentThread.CurrentCulture = culture;

Expand Down
42 changes: 21 additions & 21 deletions db/Retail/Categories.lua

Large diffs are not rendered by default.

0 comments on commit a02b623

Please sign in to comment.