Skip to content

Commit 27f9ea7

Browse files
committed
log when remapping legacy unlock names
1 parent 40443a3 commit 27f9ea7

1 file changed

Lines changed: 29 additions & 2 deletions

File tree

DataTool/ToolLogic/Extract/ExtractHeroUnlocks.cs

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,6 @@ private static bool ShouldDo(Unlock unlock, IgnoreCaseDict<ParsedArg>? config, D
385385
return false;
386386
}
387387

388-
// todo: different extracted name from query is confusing (log?)
389388
// todo: if there are issues with dup names (cn, for now), maybe it could be a precise locale mapping using data instead
390389
ReadOnlySpan<string> alternateNames = unlock.GetSTU().m_name.GUID.GUID switch {
391390
0x0DE00000000024D4 => OW1SkinAlternateNames,
@@ -403,6 +402,34 @@ private static bool ShouldDo(Unlock unlock, IgnoreCaseDict<ParsedArg>? config, D
403402
_ => []
404403
};
405404

406-
return configForType.ShouldDo(unlock.GetName(), tags, alternateNames);
405+
var shouldDo = configForType.ShouldDo(unlock.GetName(), tags, alternateNames);
406+
if (shouldDo) {
407+
LogAlternateName(unlock, configForType, tags, alternateNames);
408+
}
409+
410+
return shouldDo;
411+
}
412+
413+
private static void LogAlternateName(Unlock unlock, ParsedArg configForType, Dictionary<string, TagExpectedValue>? tags, ReadOnlySpan<string> alternateNames) {
414+
if (alternateNames.Length < 0) {
415+
return;
416+
}
417+
418+
var shouldDoWithNoAlternateNames = configForType.ShouldDo(unlock.GetName(), tags);
419+
if (shouldDoWithNoAlternateNames) {
420+
// didn't match via an alternate name
421+
// nothing to log
422+
return;
423+
}
424+
425+
// todo: this can be a little weird because the alt names are not precise to the active locale
426+
// e,g "Classic" skins have been renamed to "守望先锋经典版"
427+
foreach (var alternateName in alternateNames) {
428+
var shouldDoForThisAltName = configForType.ShouldDo(unlock.GetName(), tags, [alternateName]);
429+
if (!shouldDoForThisAltName) continue;
430+
431+
Logger.Warn("Query", $"The tool automatically edited your query - After 2026: Season 1, \"{alternateName}\" skins have been renamed to \"{unlock.GetName()}\". The extracted data will use the new name.");
432+
break;
433+
}
407434
}
408435
}

0 commit comments

Comments
 (0)