Skip to content

Commit

Permalink
Remove rlvl/clvl propaganda
Browse files Browse the repository at this point in the history
  • Loading branch information
WorkingRobot committed Jul 1, 2024
1 parent 2c0978f commit 4dffebf
Show file tree
Hide file tree
Showing 11 changed files with 5 additions and 55 deletions.
4 changes: 0 additions & 4 deletions Benchmark/Bench.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions Benchmark/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions Craftimizer/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -95,7 +94,6 @@ public Plugin(IDalamudPluginInterface pluginInterface)
CanUseManipulation = false,
HasSplendorousBuff = false,
IsSpecialist = false,
CLvl = 10,
},
stats.Recipe ?? new(1023),
stats.Buffs ?? new(null)
Expand Down
24 changes: 0 additions & 24 deletions Craftimizer/Utils/Gearsets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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) =>
Expand All @@ -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)
{
Expand Down
1 change: 0 additions & 1 deletion Craftimizer/Utils/RecipeData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 0 additions & 5 deletions Craftimizer/Windows/MacroEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
};
}
}
Expand Down Expand Up @@ -299,8 +298,6 @@ void DrawStat(string name, int value, Action<int> 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);
Expand Down Expand Up @@ -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)
{
Expand Down
6 changes: 1 addition & 5 deletions Craftimizer/Windows/RecipeNote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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();

Expand Down
1 change: 0 additions & 1 deletion Simulator/CharacterStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
1 change: 0 additions & 1 deletion Simulator/Recipe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
8 changes: 4 additions & 4 deletions Simulator/SimulationInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
4 changes: 0 additions & 4 deletions Test/Simulator/Simulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

1 comment on commit 4dffebf

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 4dffebf Previous: 7ad073a Ratio
Craftimizer.Benchmark.Bench.Solve(State: 5FBC2E36, Config: C4FA5371) 109624800 ns (± 754599.0578540936)
Craftimizer.Benchmark.Bench.Solve(State: DB4E85FC, Config: C4FA5371) 83062196.9387755 ns (± 315570.1353665726)

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.