Skip to content

Commit

Permalink
Fix missing percents and use % for stats of expert recipe quality bar
Browse files Browse the repository at this point in the history
  • Loading branch information
WorkingRobot committed Nov 14, 2023
1 parent 51e5f6e commit 466d7ab
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Craftimizer/Windows/MacroEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ public SimulationReliablity(in SimulationState startState, IEnumerable<ActionTyp
if (recipeData.Recipe.ItemResult.Value!.IsCollectable)
getParam = s => s.Collectability;
else if (recipeData.Recipe.RequiredQuality > 0)
getParam = s => s.Quality;
{
var reqQual = recipeData.Recipe.RequiredQuality;
getParam = s => (int)((float)s.Quality / reqQual * 100);
}
else if (recipeData.RecipeInfo.MaxQuality > 0)
getParam = s => s.HQPercent;
else
Expand Down Expand Up @@ -1098,9 +1101,12 @@ private void DrawMacroInfo()
if (RecipeData.Recipe.ItemResult.Value!.IsCollectable)
datas.Add(new("Collectability", Colors.HQ, Reliability.Param, State.Collectability, State.MaxCollectability, $"{State.Collectability}", null));
else if (RecipeData.Recipe.RequiredQuality > 0)
datas.Add(new("Quality %", Colors.HQ, Reliability.Param, State.Quality, RecipeData.Recipe.RequiredQuality, $"{(float)State.Quality / RecipeData.Recipe.RequiredQuality * 100:0}%", null));
{
var qualityPercent = (float)State.Quality / RecipeData.Recipe.RequiredQuality * 100;
datas.Add(new("Quality %%", Colors.HQ, Reliability.Param, qualityPercent, 100, $"{qualityPercent:0}%", null));
}
else if (RecipeData.RecipeInfo.MaxQuality > 0)
datas.Add(new("HQ %", Colors.HQ, Reliability.Param, State.HQPercent, 100, $"{State.HQPercent}%", null));
datas.Add(new("HQ %%", Colors.HQ, Reliability.Param, State.HQPercent, 100, $"{State.HQPercent}%", null));
DrawBars(datas);

ImGui.TableNextColumn();
Expand Down Expand Up @@ -1194,7 +1200,7 @@ private void DrawBars(IEnumerable<BarData> bars)
ImGui.Text(condition.Name());
}
if (ImGui.IsItemHovered())
ImGui.SetTooltip(condition.Description(CharacterStats.HasSplendorousBuff));
ImGui.SetTooltip(condition.Description(CharacterStats.HasSplendorousBuff).Replace("%", "%%"));

ImGui.SetCursorPos(pos);
ImGuiUtils.AlignRight(ImGui.GetFrameHeight(), totalSize);
Expand Down

1 comment on commit 466d7ab

@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: 466d7ab Previous: 4bf7397 Ratio
Craftimizer.Benchmark.Bench.Solve(State: 5372D31C98FA4C357F54029912394B0F5ECBE94AEC9D12C1C2B7F453C62ACD2F, Config: B75845A5DEDC79F3C98FE35F28206855B0EF4E065555FAF2AA129AED115B7744) 1371263907.142857 ns (± 3760209.3529000967) 1480306700 ns (± 23679878.252854258) 0.93
Craftimizer.Benchmark.Bench.Solve(State: 5372D31C98FA4C357F54029912394B0F5ECBE94AEC9D12C1C2B7F453C62ACD2F, Config: B75845A5DEDC79F3C98FE35F28206855B0EF4E065555FAF2AA129AED115B7744) 1065122123.0769231 ns (± 4074275.722373619) 1480306700 ns (± 23679878.252854258) 0.72
Craftimizer.Benchmark.Bench.Solve(State: 99B0F1AD46A18B4D8262F9BA75ABE23507217C2F20FBF895A49282DDFEF50190, Config: B75845A5DEDC79F3C98FE35F28206855B0EF4E065555FAF2AA129AED115B7744) 1504554964.2857144 ns (± 4139032.813743056) 1450385066.6666667 ns (± 6712458.243197247) 1.04
Craftimizer.Benchmark.Bench.Solve(State: 99B0F1AD46A18B4D8262F9BA75ABE23507217C2F20FBF895A49282DDFEF50190, Config: B75845A5DEDC79F3C98FE35F28206855B0EF4E065555FAF2AA129AED115B7744) 1142201266.6666667 ns (± 6131552.507512347) 1450385066.6666667 ns (± 6712458.243197247) 0.79

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

Please sign in to comment.