Revert "feat: 新版药材提示"

This reverts commit c5b3b9661b.
This commit is contained in:
LyMysterious
2026-07-25 19:37:53 +08:00
parent c5b3b9661b
commit 82aae20a9b
2 changed files with 18 additions and 30 deletions
@@ -19,7 +19,7 @@ namespace NapCatRobotClient.Service.Group.TextProcess
if (string.IsNullOrWhiteSpace(groupMsg)) return false;
// 小小药材背包
List<string> keyWord = new() { "拥有药材", "坊市数据" };
List<string> keyWord = new() { "拥有数量", "坊市数据" };
if (keyWord.All(k => groupMsg.Contains(k)))
{
RedisHelper.Client.Set(json["message_id"].ToString(), groupMsg, 60 * 10);
@@ -67,40 +67,28 @@ namespace NapCatRobotClient.Service.Group.TextProcess
private static async Task<bool> Herbal(string groupId, string text, bool upCmd)
{
List<GoodsInfo> results = [];
var lines = text.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
var lines = text.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
foreach (var line in lines)
{
var content = line.Trim();
// 跳过无用行
if (content.StartsWith("鬼谷子的药材背包") ||
content.StartsWith("☆拥有药材☆") ||
content.StartsWith("第") ||
content.StartsWith("下一页"))
if (line.StartsWith("品级:"))
{
continue;
_ = line.Substring("品级:".Length).Trim();
}
// 品级标题,例如:☆五品药材☆
if (Regex.IsMatch(content, @"^☆.+品药材☆$"))
else if (line.StartsWith("名字:"))
{
// 如果以后需要品级,可以在这里记录
// currentLevel = ...
continue;
}
// 药材行,例如:天灵果 - 数量:4 炼金 | 坊市数据
var match = Regex.Match(content, @"^(.*?)\s*-\s*数量:(\d+)");
if (match.Success)
{
results.Add(new GoodsInfo
var name = line.Substring("名字:".Length).Trim();
// 找到下一行的数量
var index = Array.IndexOf(lines, line);
if (index + 1 < lines.Length && lines[index + 1].StartsWith("拥有数量:"))
{
Name = match.Groups[1].Value.Trim(),
Num = int.Parse(match.Groups[2].Value)
});
var quantityLine = lines[index + 1];
var match = Regex.Match(quantityLine, @"拥有数量:(\d+)");
if (match.Success)
{
var quantity = match.Groups[1].Value;
results.Add(new() { Name = name, Num = Convert.ToInt32(quantity) });
}
}
}
}