Black market: anonymous hash merchant names with type tag
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
96d8b7cf3b
commit
4422bd99ab
5 files changed
+26
-11
No files matched your search
@@ -42,6 +42,9 @@ namespace Decentralized
|
||||
return ModHelper.SpawnItem(id);
|
||||
}
|
||||
|
||||
/// <summary>商家名:随机的匿名哈希,类型另外标注。</summary>
|
||||
public static string DisplayName(string name) => name;
|
||||
|
||||
public static string ItemName(string id)
|
||||
{
|
||||
var it = ModHelper.SpawnItem(GameId(id));
|
||||
@@ -115,8 +118,8 @@ namespace Decentralized
|
||||
switch (e.Kind)
|
||||
{
|
||||
case "ready": ps.AddNightLog(L.T("nightlog.bm.ready", name), "99bb66"); break;
|
||||
case "scam_refund": ps.AddNightLog(L.T("nightlog.bm.scam_refund", e.Order.Seller, name), "cc7755"); break;
|
||||
case "scam_loss": ps.AddNightLog(L.T("nightlog.bm.scam_loss", e.Order.Seller, name, Fmt.Num(e.Amount)), "cc7755"); break;
|
||||
case "scam_refund": ps.AddNightLog(L.T("nightlog.bm.scam_refund", DisplayName(e.Order.Seller), name), "cc7755"); break;
|
||||
case "scam_loss": ps.AddNightLog(L.T("nightlog.bm.scam_loss", DisplayName(e.Order.Seller), name, Fmt.Num(e.Amount)), "cc7755"); break;
|
||||
case "intercept": ps.AddNightLog(L.T("nightlog.bm.intercept", name, Fmt.Num(e.Amount)), "cc7755"); break;
|
||||
case "rug": ps.AddNightLog(L.T("nightlog.bm.rug", name, Fmt.Num(e.Amount)), "cc7755"); break;
|
||||
case "trap":
|
||||
|
||||
@@ -75,6 +75,12 @@ namespace Decentralized
|
||||
Log.Info($"黑市抽样:无法造出或价格为 0 的货 {missing.Count} 个:{string.Join(", ", missing)};基础价中位 {costs[costs.Count / 2]},最高 {costs.Last()}");
|
||||
Log.Info($"黑市抽样:60 周货架总值 平均 {vals.Average():0},最小 {vals.Min():0},最大 {vals.Max():0}");
|
||||
}));
|
||||
ModHelper.AddDebugFunction(ModInfo.Id, ModInfo.Name, "Black market all merchants (test)", () => Log.Guard("黑市全部商家(测试)", () =>
|
||||
{
|
||||
var d = Session.Data;
|
||||
d.Black.RefreshOrders(StoreStation.GetDayCounter(), StoreReputation.GetBMReputation(), d.Rng, BlackDelivery.Value, true);
|
||||
Log.Info($"黑市全部商家(测试):{d.Black.Sellers.Count} 家,货架 {d.Black.Catalog.Count} 种,{string.Join("/", d.Black.Sellers.Select(x => x.Type))}");
|
||||
}));
|
||||
ModHelper.AddDebugFunction(ModInfo.Id, ModInfo.Name, "Black market events (test)", () => Log.Guard("黑市事件(测试)", () =>
|
||||
{
|
||||
var d = Session.Data;
|
||||
|
||||
@@ -419,6 +419,8 @@ namespace Decentralized
|
||||
Open();
|
||||
}
|
||||
|
||||
private static string MerchantLabel(BmSeller s) => "[" + L.T("merchant." + s.Type) + "] " + s.Name;
|
||||
|
||||
private static int _merchant;
|
||||
private static int _qty = 1;
|
||||
private static readonly int[] Qtys = { 1, 5, 10 };
|
||||
@@ -442,13 +444,13 @@ namespace Decentralized
|
||||
for (int k = i; k < Math.Min(sellers.Count, i + 3); k++)
|
||||
{
|
||||
int idx = k;
|
||||
string n = L.T("merchant." + sellers[k].Type) + " " + sellers[k].Name;
|
||||
b.AddButton(idx == _merchant ? $"[{n}]" : n, () => { _merchant = idx; Open(); });
|
||||
string n = MerchantLabel(sellers[k]);
|
||||
b.AddButton(idx == _merchant ? "> " + n : n, () => { _merchant = idx; Open(); });
|
||||
}
|
||||
b.End();
|
||||
}
|
||||
var seller = sellers[_merchant];
|
||||
b.AddLabel(L.T("black.seller", seller.Name, seller.Trades, seller.Rating) + " " + L.T("black.days", seller.Days));
|
||||
b.AddLabel(L.T("black.seller", MerchantLabel(seller), seller.Trades, seller.Rating) + " " + L.T("black.days", seller.Days));
|
||||
var goods = d.Black.Catalog.Where(l => l.Seller == _merchant).Cast<BmGood>().ToList();
|
||||
if (goods.Count == 0) { b.AddLabel(L.T("black.empty")); return; }
|
||||
Shelf(b, goods, (c, g) =>
|
||||
@@ -541,13 +543,13 @@ namespace Decentralized
|
||||
if (sale.State == SaleState.Listed) l.AddButton(L.T("black.sell.delist"), () => Delist(sale));
|
||||
}
|
||||
foreach (var o in d.Black.Orders.OrderByDescending(x => x.PlacedDay))
|
||||
l.AddLabel(L.T("black.mine.line", ItemName(o.Item) + (o.Count > 1 ? " ×" + o.Count : ""), o.Seller, L.T("black.mode." + o.Mode), L.T("black.state." + o.State + (o.Why != null && o.State != OrderState.Done ? "." + o.Why : "")), o.DueDay));
|
||||
l.AddLabel(L.T("black.mine.line", ItemName(o.Item) + (o.Count > 1 ? " ×" + o.Count : ""), BlackDelivery.DisplayName(o.Seller), L.T("black.mode." + o.Mode), L.T("black.state." + o.State + (o.Why != null && o.State != OrderState.Done ? "." + o.Why : "")), o.DueDay));
|
||||
}, r =>
|
||||
{
|
||||
r.AddHeader(L.T("black.forum.h"));
|
||||
if (d.Black.Forum.Count == 0) r.AddLabel(L.T("black.forum.quiet"));
|
||||
foreach (var f in d.Black.Forum)
|
||||
r.AddLabel(f.StartsWith("scam:") ? L.T("black.forum.scam", f.Substring(5)) : f.StartsWith("busted:") ? L.T("black.forum.busted", f.Substring(7)) : L.T("black.forum." + f));
|
||||
r.AddLabel(f.StartsWith("scam:") ? L.T("black.forum.scam", BlackDelivery.DisplayName(f.Substring(5))) : f.StartsWith("busted:") ? L.T("black.forum.busted", f.Substring(7)) : L.T("black.forum." + f));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user