fix: 仓库识别无法识别 ”万“

This commit is contained in:
uye
2024-12-06 19:23:07 +08:00
parent f549c1feee
commit 941a98d90a
2 changed files with 11 additions and 2 deletions

View File

@@ -308,6 +308,11 @@ int asst::DepotImageAnalyzer::match_quantity(const ItemInfo& item)
multiple = 10000;
digit_str.erase(w_pos, digit_str.size());
}
// 更新:这个模型改成了 ASCII 识别,所以识别不到万了,得到的结果是 1.35 这种形式,表示 1.3 万
else if (size_t w2_pos = digit_str.find('.'); digit_str.size() > 1 && w2_pos != std::string::npos && digit_str[digit_str.size() - 1] == '5') {
multiple = 10000;
digit_str.erase(digit_str.size() - 1, digit_str.size());
}
else if (size_t k_pos = digit_str.find('K'); k_pos != std::string::npos) {
multiple = 1000;
digit_str.erase(k_pos, digit_str.size());

View File

@@ -335,7 +335,7 @@ namespace MaaWpfGui.ViewModels.UI
public BitmapImage? Image { get; set; }
public int Count { get; set; }
public string? Count { get; set; }
}
/// <summary>
@@ -391,7 +391,11 @@ namespace MaaWpfGui.ViewModels.UI
Id = id,
Name = ItemListHelper.GetItemName(id),
Image = image,
Count = (int)(item["have"] ?? -1),
Count = item["have"] != null && int.TryParse(item["have"]?.ToString() ?? "-1", out int haveValue)
? (haveValue > 10000
? $"{haveValue / 10000.0:F1}w"
: haveValue.ToString())
: "-1",
};
DepotResult.Add(result);