From 4dffebf0bd3de7842614b6db286349bc571fb374 Mon Sep 17 00:00:00 2001 From: Asriel Camora Date: Sun, 30 Jun 2024 18:58:14 -0700 Subject: [PATCH] Remove rlvl/clvl propaganda --- Benchmark/Bench.cs | 4 ---- Benchmark/Program.cs | 4 ---- Craftimizer/Plugin.cs | 2 -- Craftimizer/Utils/Gearsets.cs | 24 ------------------------ Craftimizer/Utils/RecipeData.cs | 1 - Craftimizer/Windows/MacroEditor.cs | 5 ----- Craftimizer/Windows/RecipeNote.cs | 6 +----- Simulator/CharacterStats.cs | 1 - Simulator/Recipe.cs | 1 - Simulator/SimulationInput.cs | 8 ++++---- Test/Simulator/Simulator.cs | 4 ---- 11 files changed, 5 insertions(+), 55 deletions(-) diff --git a/Benchmark/Bench.cs b/Benchmark/Bench.cs index 689b20e..8bc3c7d 100644 --- a/Benchmark/Bench.cs +++ b/Benchmark/Bench.cs @@ -37,13 +37,11 @@ public override readonly string ToString() => CanUseManipulation = true, HasSplendorousBuff = false, IsSpecialist = false, - CLvl = 560, }, new() { IsExpert = false, ClassJobLevel = 90, - RLvl = 560, ConditionsFlag = 0b1111, MaxDurability = 80, MaxQuality = 7200, @@ -65,13 +63,11 @@ public override readonly string ToString() => CanUseManipulation = true, HasSplendorousBuff = false, IsSpecialist = false, - CLvl = 560, }, new() { IsExpert = false, ClassJobLevel = 90, - RLvl = 580, ConditionsFlag = 0b1111, MaxDurability = 70, MaxQuality = 10920, diff --git a/Benchmark/Program.cs b/Benchmark/Program.cs index b8738f4..8470baa 100644 --- a/Benchmark/Program.cs +++ b/Benchmark/Program.cs @@ -54,13 +54,11 @@ private static async Task RunTrace() CanUseManipulation = true, HasSplendorousBuff = false, IsSpecialist = false, - CLvl = 560, }, new RecipeInfo() { IsExpert = false, ClassJobLevel = 90, - RLvl = 640, ConditionsFlag = 15, MaxDurability = 70, MaxQuality = 14040, @@ -102,13 +100,11 @@ private static async Task RunOther() CanUseManipulation = true, HasSplendorousBuff = false, IsSpecialist = false, - CLvl = 560, }, new RecipeInfo() { IsExpert = false, ClassJobLevel = 90, - RLvl = 640, ConditionsFlag = 15, MaxDurability = 70, MaxQuality = 14040, diff --git a/Craftimizer/Plugin.cs b/Craftimizer/Plugin.cs index 1556960..75363ce 100644 --- a/Craftimizer/Plugin.cs +++ b/Craftimizer/Plugin.cs @@ -65,7 +65,6 @@ public Plugin(IDalamudPluginInterface pluginInterface) // Trigger static constructors so a huge hitch doesn't occur on first RecipeNote frame. FoodStatus.Initialize(); ActionUtils.Initialize(); - Gearsets.Initialize(); Service.PluginInterface.UiBuilder.Draw += WindowSystem.Draw; Service.PluginInterface.UiBuilder.OpenConfigUi += OpenSettingsWindow; @@ -95,7 +94,6 @@ public Plugin(IDalamudPluginInterface pluginInterface) CanUseManipulation = false, HasSplendorousBuff = false, IsSpecialist = false, - CLvl = 10, }, stats.Recipe ?? new(1023), stats.Buffs ?? new(null) diff --git a/Craftimizer/Utils/Gearsets.cs b/Craftimizer/Utils/Gearsets.cs index 2f5bc10..b24dfe9 100644 --- a/Craftimizer/Utils/Gearsets.cs +++ b/Craftimizer/Utils/Gearsets.cs @@ -20,24 +20,6 @@ public record struct GearsetItem(uint ItemId, bool IsHq, GearsetMateria[] Materi public const int ParamCraftsmanship = 70; public const int ParamControl = 71; - private static readonly int[] LevelToCLvlLUT; - - static Gearsets() - { - LevelToCLvlLUT = new int[100]; - for (uint i = 0; i < 80; ++i) { - var level = i + 1; - LevelToCLvlLUT[i] = LuminaSheets.ParamGrowSheet.GetRow(level)!.CraftingLevel; - } - for (var i = 80; i < 100; ++i) - { - var level = i + 1; - LevelToCLvlLUT[i] = (int)LuminaSheets.RecipeLevelTableSheet.First(r => r.ClassJobLevel == level).RowId; - } - } - - public static void Initialize() { } - public static GearsetItem[] GetGearsetItems(InventoryContainer* container) { var items = new GearsetItem[(int)container->Size]; @@ -127,7 +109,6 @@ public static CharacterStats CalculateCharacterStats(GearsetStats gearsetStats, CanUseManipulation = canUseManipulation, HasSplendorousBuff = gearsetItems.Any(IsSplendorousTool), IsSpecialist = gearsetItems.Any(IsSpecialistSoulCrystal), - CLvl = CalculateCLvl(characterLevel), }; public static bool IsItem(GearsetItem item, uint itemId) => @@ -146,11 +127,6 @@ public static bool IsSpecialistSoulCrystal(GearsetItem item) public static bool IsSplendorousTool(GearsetItem item) => LuminaSheets.ItemSheetEnglish.GetRow(item.ItemId)!.Description.ToDalamudString().TextValue.Contains("Increases to quality are 1.75 times higher than normal when material condition is Good.", StringComparison.Ordinal); - public static int CalculateCLvl(int level) => - (level > 0 && level <= 100) ? - LevelToCLvlLUT[level - 1] : - throw new ArgumentOutOfRangeException(nameof(level), level, "Level is out of range."); - // https://github.com/ffxiv-teamcraft/ffxiv-teamcraft/blob/24d0db2d9676f264edf53651b21005305267c84c/apps/client/src/app/modules/gearsets/materia.service.ts#L265 private static int CalculateParamCap(Item item, uint paramId) { diff --git a/Craftimizer/Utils/RecipeData.cs b/Craftimizer/Utils/RecipeData.cs index 6b8fb06..bbe3d6f 100644 --- a/Craftimizer/Utils/RecipeData.cs +++ b/Craftimizer/Utils/RecipeData.cs @@ -36,7 +36,6 @@ public RecipeData(ushort recipeId) { IsExpert = Recipe.IsExpert, ClassJobLevel = Table.ClassJobLevel, - RLvl = (int)Table.RowId, ConditionsFlag = Table.ConditionsFlag, MaxDurability = Table.Durability * Recipe.DurabilityFactor / 100, MaxQuality = (Recipe.CanHq || Recipe.IsExpert) ? (int)Table.Quality * Recipe.QualityFactor / 100 : 0, diff --git a/Craftimizer/Windows/MacroEditor.cs b/Craftimizer/Windows/MacroEditor.cs index ba694e1..2cf416a 100644 --- a/Craftimizer/Windows/MacroEditor.cs +++ b/Craftimizer/Windows/MacroEditor.cs @@ -45,7 +45,6 @@ private set Control = Math.Clamp(value.Control, 0, 9000), CP = Math.Clamp(value.CP, 180, 1000), Level = Math.Clamp(value.Level, 1, 100), - CLvl = Gearsets.CalculateCLvl(value.Level), }; } } @@ -299,8 +298,6 @@ void DrawStat(string name, int value, Action setter) ? Math.Clamp(newLevel, 1, 100) : 1 }; - if (ImGui.IsItemHovered()) - ImGuiUtils.Tooltip($"CLvl {Gearsets.CalculateCLvl(CharacterStats.Level)}"); var disabledTint = new Vector4(0.5f, 0.5f, 0.5f, 0.75f); var imageButtonPadding = (int)(ImGui.GetStyle().FramePadding.Y / 2f); @@ -776,8 +773,6 @@ private bool DrawRecipeParams() ImGui.SameLine(0, 5); ImGui.TextUnformatted(textLevel); - if (ImGui.IsItemHovered()) - ImGuiUtils.Tooltip($"RLvl {RecipeData.RecipeInfo.RLvl}"); if (textStarsSize != Vector2.Zero) { diff --git a/Craftimizer/Windows/RecipeNote.cs b/Craftimizer/Windows/RecipeNote.cs index d2b72d2..1e2d77e 100644 --- a/Craftimizer/Windows/RecipeNote.cs +++ b/Craftimizer/Windows/RecipeNote.cs @@ -487,8 +487,6 @@ private void DrawCharacterStats() if (level != 0) { ImGui.TextUnformatted(levelText); - if (ImGui.IsItemHovered()) - ImGuiUtils.Tooltip($"CLvl {Gearsets.CalculateCLvl(level)}"); ImGui.SameLine(0, 3); } @@ -684,8 +682,6 @@ private void DrawRecipeStats() ImGui.SameLine(0, 5); ImGui.TextUnformatted(textLevel); - if (ImGui.IsItemHovered()) - ImGuiUtils.Tooltip($"RLvl {RecipeData.RecipeInfo.RLvl}"); if (textStarsSize != Vector2.Zero) { @@ -1202,7 +1198,7 @@ public void CalculateCommunityMacro() var config = Service.Configuration.RecipeNoteSolverConfig; var mctsConfig = new MCTSConfig(config); var simulator = new SimulatorNoRandom(); - var macros = Service.CommunityMacros.RetrieveRotations(input.Recipe.RLvl, token).GetAwaiter().GetResult(); + var macros = Service.CommunityMacros.RetrieveRotations((int)RecipeData.Table.RowId, token).GetAwaiter().GetResult(); token.ThrowIfCancellationRequested(); diff --git a/Simulator/CharacterStats.cs b/Simulator/CharacterStats.cs index 6cd932e..994b65e 100644 --- a/Simulator/CharacterStats.cs +++ b/Simulator/CharacterStats.cs @@ -9,5 +9,4 @@ public sealed record CharacterStats public bool CanUseManipulation { get; init; } public bool HasSplendorousBuff { get; init; } public bool IsSpecialist { get; init; } - public int CLvl { get; init; } } diff --git a/Simulator/Recipe.cs b/Simulator/Recipe.cs index 5cdb32b..cd2c3a3 100644 --- a/Simulator/Recipe.cs +++ b/Simulator/Recipe.cs @@ -4,7 +4,6 @@ public sealed record RecipeInfo { public bool IsExpert { get; init; } public int ClassJobLevel { get; init; } - public int RLvl { get; init; } public ushort ConditionsFlag { get; init; } public int MaxDurability { get; init; } public int MaxQuality { get; init; } diff --git a/Simulator/SimulationInput.cs b/Simulator/SimulationInput.cs index fe56059..cb6f364 100644 --- a/Simulator/SimulationInput.cs +++ b/Simulator/SimulationInput.cs @@ -20,14 +20,14 @@ public SimulationInput(CharacterStats stats, RecipeInfo recipe, int startingQual // https://github.com/NotRanged/NotRanged.github.io/blob/0f4aee074f969fb05aad34feaba605057c08ffd1/app/js/ffxivcraftmodel.js#L88 { var baseIncrease = (Stats.Craftsmanship * 10f / Recipe.ProgressDivider) + 2; - if (Stats.CLvl <= Recipe.RLvl) - baseIncrease *= Recipe.ProgressModifier / 100f; + if (Stats.Level <= Recipe.ClassJobLevel) + baseIncrease *= Recipe.ProgressModifier * 0.01f; BaseProgressGain = (int)baseIncrease; } { var baseIncrease = (Stats.Control * 10f / Recipe.QualityDivider) + 35; - if (Stats.CLvl <= Recipe.RLvl) - baseIncrease *= Recipe.QualityModifier / 100f; + if (Stats.Level <= Recipe.ClassJobLevel) + baseIncrease *= Recipe.QualityModifier * 0.01f; BaseQualityGain = (int)baseIncrease; } } diff --git a/Test/Simulator/Simulator.cs b/Test/Simulator/Simulator.cs index f48f597..d71e024 100644 --- a/Test/Simulator/Simulator.cs +++ b/Test/Simulator/Simulator.cs @@ -15,13 +15,11 @@ public class SimulatorTests CanUseManipulation = true, HasSplendorousBuff = false, IsSpecialist = false, - CLvl = 560, }, new() { IsExpert = false, ClassJobLevel = 90, - RLvl = 560, ConditionsFlag = 0b1111, MaxDurability = 80, MaxQuality = 7200, @@ -44,13 +42,11 @@ public class SimulatorTests CanUseManipulation = true, HasSplendorousBuff = false, IsSpecialist = false, - CLvl = 560, }, new() { IsExpert = false, ClassJobLevel = 90, - RLvl = 580, ConditionsFlag = 0b1111, MaxDurability = 70, MaxQuality = 10920,