From 6058c1cf2c373f9d229cdaf7b74c9ab45e354d72 Mon Sep 17 00:00:00 2001 From: Gengar <80122551+bdawg1989@users.noreply.github.com> Date: Wed, 31 Jul 2024 20:33:53 -0500 Subject: [PATCH] Remove Level adjustment from AutoCorrect --- SysBot.Pokemon/Helpers/AutoCorrectShowdown.cs | 27 ++++--------------- SysBot.Pokemon/Settings/TradeSettings.cs | 9 ------- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/SysBot.Pokemon/Helpers/AutoCorrectShowdown.cs b/SysBot.Pokemon/Helpers/AutoCorrectShowdown.cs index 6457340df..326dccf91 100644 --- a/SysBot.Pokemon/Helpers/AutoCorrectShowdown.cs +++ b/SysBot.Pokemon/Helpers/AutoCorrectShowdown.cs @@ -74,7 +74,7 @@ namespace SysBot.Pokemon; } } - (string abilityName, string natureName, string ballName, string levelValue) = ParseLines(lines); + (string abilityName, string natureName, string ballName) = ParseLines(lines); string correctedAbilityName = string.Empty; if (!string.IsNullOrEmpty(abilityName) && autoCorrectConfig.AutoCorrectAbility) @@ -114,16 +114,6 @@ namespace SysBot.Pokemon; } } - if (autoCorrectConfig.AutoCorrectLevel && !string.IsNullOrWhiteSpace(levelValue)) - { - var levelVerifier = new LevelVerifier(); - levelVerifier.Verify(la); - if (!la.Valid) - { - correctionMessages.Add($"Level was incorrect. Adjusted to **Level 100**."); - } - } - if (autoCorrectConfig.AutoCorrectMovesLearnset && lines.Any(line => line.StartsWith("- "))) { await MoveHelper.ValidateMovesAsync(lines, pk, la, gameStrings, speciesName, correctedFormName ?? formName, correctionMessages); @@ -178,7 +168,7 @@ namespace SysBot.Pokemon; } } - string[] correctedLines = lines.Select((line, i) => CorrectLine(line, i, speciesName, correctedSpeciesName, correctedFormName ?? formName, formName, correctedGender, gender, correctedHeldItem, heldItem, correctedAbilityName, correctedNatureName, correctedBallName, levelValue, la, nickname)).ToArray(); + string[] correctedLines = lines.Select((line, i) => CorrectLine(line, i, speciesName, correctedSpeciesName, correctedFormName ?? formName, formName, correctedGender, gender, correctedHeldItem, heldItem, correctedAbilityName, correctedNatureName, correctedBallName, la, nickname)).ToArray(); // TODO: Validate Scale Line and remove if necessary. @@ -277,12 +267,11 @@ private static (string speciesName, string formName, string gender, string heldI return (speciesName, formName, gender, heldItem, nickname); } - private static (string abilityName, string natureName, string ballName, string levelValue) ParseLines(string[] lines) + private static (string abilityName, string natureName, string ballName) ParseLines(string[] lines) { string abilityName = string.Empty; string natureName = string.Empty; string ballName = string.Empty; - string levelValue = string.Empty; foreach (string line in lines) { @@ -294,14 +283,12 @@ private static (string abilityName, string natureName, string ballName, string l natureName = trimmedLine[..^" Nature".Length].Trim(); else if (trimmedLine.StartsWith("Ball:")) ballName = trimmedLine["Ball:".Length..].Trim(); - else if (trimmedLine.StartsWith("Level:")) - levelValue = trimmedLine["Level:".Length..].Trim(); } - return (abilityName, natureName, ballName, levelValue); + return (abilityName, natureName, ballName); } - private static string CorrectLine(string line, int index, string speciesName, string correctedSpeciesName, string correctedFormName, string formName, string correctedGender, string gender, string correctedHeldItem, string heldItem, string correctedAbilityName, string correctedNatureName, string correctedBallName, string levelValue, LegalityAnalysis la, string nickname) + private static string CorrectLine(string line, int index, string speciesName, string correctedSpeciesName, string correctedFormName, string formName, string correctedGender, string gender, string correctedHeldItem, string heldItem, string correctedAbilityName, string correctedNatureName, string correctedBallName, LegalityAnalysis la, string nickname) { if (index == 0) // Species line { @@ -349,10 +336,6 @@ private static string CorrectLine(string line, int index, string speciesName, st { return $"Ball: {correctedBallName}"; } - else if (line.StartsWith("Level:")) - { - return !la.Valid ? "Level: 100" : $"Level: {levelValue}"; - } else if (line.StartsWith("Shiny:", StringComparison.OrdinalIgnoreCase)) { return la.EncounterMatch.Shiny.IsValid(la.Entity) ? "Shiny: Yes" : "Shiny: No"; diff --git a/SysBot.Pokemon/Settings/TradeSettings.cs b/SysBot.Pokemon/Settings/TradeSettings.cs index 3869cecf0..823af3570 100644 --- a/SysBot.Pokemon/Settings/TradeSettings.cs +++ b/SysBot.Pokemon/Settings/TradeSettings.cs @@ -216,15 +216,6 @@ public bool AutoCorrectBall set => _autoCorrectBall = value; } - private bool _autoCorrectLevel = true; - - [Category(nameof(AutoCorrectShowdownCategory)), Description("If set to True, auto correction will correct wrong level."), DisplayName("Auto Correct Level")] - public bool AutoCorrectLevel - { - get => EnableAutoCorrect && _autoCorrectLevel; - set => _autoCorrectLevel = value; - } - private bool _autoCorrectGender = true; [Category(nameof(AutoCorrectShowdownCategory)), Description("If set to True, auto correction will correct wrong gender."), DisplayName("Auto Correct Gender")]