diff --git a/src/MaaCore/Task/Fight/StageDropsTaskPlugin.cpp b/src/MaaCore/Task/Fight/StageDropsTaskPlugin.cpp index 6c8b65409a..c291c52863 100644 --- a/src/MaaCore/Task/Fight/StageDropsTaskPlugin.cpp +++ b/src/MaaCore/Task/Fight/StageDropsTaskPlugin.cpp @@ -242,11 +242,6 @@ void asst::StageDropsTaskPlugin::drop_info_callback() } stats_vec.emplace_back(std::move(info)); } - //// 排个序,数量多的放前面 - // std::sort(stats_vec.begin(), stats_vec.end(), - // [](const json::value& lhs, const json::value& rhs) -> bool { - // return lhs.at("count").as_integer() > rhs.at("count").as_integer(); - // }); json::value info = basic_info_with_what("StageDrops"); json::value& details = info["details"]; diff --git a/src/MaaWpfGui/Helper/ToolTipHelper.cs b/src/MaaWpfGui/Helper/ToolTipHelper.cs index 5d9eb2d4ef..76eb391423 100644 --- a/src/MaaWpfGui/Helper/ToolTipHelper.cs +++ b/src/MaaWpfGui/Helper/ToolTipHelper.cs @@ -129,7 +129,7 @@ namespace MaaWpfGui.Helper /// /// 掉落物列表 /// ToolTip - public static ToolTip CreateMaterialDropTooltip(this IEnumerable<(string ItemId, int Total, int Add)> drops) + public static ToolTip CreateMaterialDropTooltip(this IEnumerable<(string ItemId, string ItemName, int Total, int Add)> drops) { var row = new WrapPanel { @@ -140,9 +140,7 @@ namespace MaaWpfGui.Helper MaxWidth = (64 * 5) + (4 * 10), }; - foreach (var (itemId, total, add) in drops - .OrderByDescending(x => x.Add) - .ThenByDescending(x => x.Total)) + foreach (var (itemId, _, total, add) in drops) { var image = new Image { diff --git a/src/MaaWpfGui/Main/AsstProxy.cs b/src/MaaWpfGui/Main/AsstProxy.cs index 2972cea86d..e40f91db5d 100644 --- a/src/MaaWpfGui/Main/AsstProxy.cs +++ b/src/MaaWpfGui/Main/AsstProxy.cs @@ -1515,12 +1515,12 @@ namespace MaaWpfGui.Main var statistics = subTaskDetails!["stats"] ?? new JArray(); var stageInfo = subTaskDetails!["stage"] ?? new JObject(); int curTimes = (int)(subTaskDetails["cur_times"] ?? -1); - var drops = new List<(string ItemId, int Total, int Add)>(); + var drops = new List<(string ItemId, string ItemName, int Total, int Add)>(); foreach (var item in statistics) { - var itemId = item["itemId"]?.ToString(); - var itemName = item["itemName"]?.ToString(); + var itemId = item["itemId"]?.ToString() ?? string.Empty; + var itemName = item["itemName"]?.ToString() ?? string.Empty; if (itemName == "furni") { itemName = LocalizationHelper.GetString("FurnitureDrop"); @@ -1529,28 +1529,34 @@ namespace MaaWpfGui.Main int totalQuantity = (int)(item["quantity"] ?? -1); int addQuantity = (int)(item["addQuantity"] ?? -1); + drops.Add((itemId, itemName, totalQuantity, addQuantity)); + } + + // 先按新增数量降序,再按总数量降序 + drops = [.. drops.OrderByDescending(x => x.Add).ThenByDescending(x => x.Total)]; + + foreach (var (_, itemName, totalQuantity, addQuantity) in drops) + { allDrops += $"{itemName} : {totalQuantity:#,#}"; if (addQuantity > 0) { allDrops += $" (+{addQuantity:#,#})"; } - if (!string.IsNullOrEmpty(itemId)) - { - drops.Add((itemId, totalQuantity, addQuantity)); - } - allDrops += "\n"; } var stageCode = stageInfo["stageCode"]?.ToString(); allDrops = allDrops.EndsWith('\n') ? allDrops.TrimEnd('\n') : LocalizationHelper.GetString("NoDrop"); + + var dropsForTooltip = drops.Where(x => !string.IsNullOrEmpty(x.ItemId)).ToList(); + Instances.TaskQueueViewModel.AddLog( $"{stageCode} {LocalizationHelper.GetString("TotalDrop")}\n" + $"{allDrops}{(curTimes >= 0 ? $"\n{LocalizationHelper.GetString("CurTimes")} : {curTimes}" : string.Empty)}", - toolTip: drops.CreateMaterialDropTooltip()); + toolTip: dropsForTooltip.CreateMaterialDropTooltip()); AchievementTrackerHelper.Instance.AddProgressToGroup(AchievementIds.SanitySpenderGroup, curTimes > 0 ? curTimes : 1);