Skip to content

Commit

Permalink
remove special characters when checking worlds
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaksuhn committed Aug 2, 2024
1 parent 77fcbb7 commit bcc38cf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Automaton/Features/HuntRelayHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,14 @@ private SeStringBuilder BuildRelayMessage(MapLinkPayload MapLink, World World, u
World? partial = null;
if (Config.AllowPartialWorldMatches)
foreach (var word in RemoveConflicts(text).Split(' ').Where(t => !ECommons.GenericHelpers.IsNullOrEmpty(t) && t.Length > 2))
partial ??= FindRow<World>(x => x!.IsPublic && x.DataCenter.Value!.Name == Player.CurrentDataCenter && x.Name.RawString.Contains(word, StringComparison.OrdinalIgnoreCase));
partial ??= FindRow<World>(x => x!.IsPublic && x.DataCenter.Value!.Name == Player.CurrentDataCenter && x.Name.RawString.Contains(RemoveNonAlphaNumeric(word), StringComparison.OrdinalIgnoreCase));

return (partial ?? FindRow<World>(x => x!.IsPublic && RemoveConflicts(text).Contains(x.Name.RawString, StringComparison.OrdinalIgnoreCase)) ?? null, heuristicInstance != 0 ? (uint)heuristicInstance : (uint)mapInstance, (uint)relayType);
}

// I think this is the only case where an S rank has the name of a world contained within it
private string RemoveConflicts(string text) => text.Replace("kaiser behemoth", string.Empty, StringComparison.OrdinalIgnoreCase);
private string RemoveNonAlphaNumeric(string text) => Regex.Replace(text, @"\W+", "");

private char ReplaceSeIconChar(char c)
{
Expand Down

0 comments on commit bcc38cf

Please sign in to comment.