Coin customers: buyer says the coin amount on deal; test entry spawns buyer through the bell queue

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ZHU MINCHAOandClaude Sonnet 5.5 committed 2026-11-03 16:20:58 +08:00
1 parent 090a973d23
commit b24dd8b9f2
4 files changed
+21 -6

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
### 第二阶段(进行中) ### 第二阶段(进行中)
- 用币付款的顾客:排队的买家里,上层付 CRC(12%)、黑市付 CRT(25%)、革命派付 CRA(25%)、下层付 PSC(10%)。成交时扣回信用点,按当日币价换成币进热钱包;赃物款项不记销赃,改成币带污点(货值 × 赃物热度%);夜间日志汇总当天用币结算的额度。开发者模式 F9 有测试入口。游戏内成交流程尚未实测(测试存档里顾客不上柜台),机制本身在技术验证里通过。 - 用币付款的顾客:排队的买家里,上层付 CRC(12%)、黑市付 CRT(25%)、革命派付 CRA(25%)、下层付 PSC(10%)。成交时扣回信用点(现金不变),按当日币价换成币进热钱包,顾客当场说一句"成交,N CRT 已转入热钱包";赃物款项不记销赃,改成币带污点(货值 × 赃物热度%);夜间日志汇总当天用币结算的额度。开发者模式 F9 有测试入口(Coin buyer)。已在游戏里实测:成交后现金不变,四笔种子按币价记入 CRT,顾客对话显示。
### 第一阶段完成(入门、挖矿、显卡鉴定、终端) ### 第一阶段完成(入门、挖矿、显卡鉴定、终端)
+18 -5
View File
@@ -24,12 +24,15 @@ namespace Decentralized
canClientExposeFeature = ClientCanExposeFunc.BasicClientExposeCapacity, canClientExposeFeature = ClientCanExposeFunc.BasicClientExposeCapacity,
}; };
c.SetBudget(5000); c.SetBudget(5000);
c.clientBuyingTagList.Add("WATER"); c.clientBuyingTagList.Add("BREVAGE"); c.clientBuyingTagList.Add("SEED");
c.mainDialogue.SetText(c.displayName, "CRT.").SetEndAction(() => { }); c.mainDialogue.SetText(c.displayName, "CRT.").SetEndAction(() => { });
c.AddBasicDialog(); c.AddBasicDialog();
c.CompleteClientCreation(); c.CompleteClientCreation();
Mark(c, Assets.CRT); Mark(c, Assets.CRT);
PlayerStore.Instance.currentClientInstance = StoreClientInstance.CreateClientInstance(c); // 测试:直接换成这位顾客 Log.Info($"用币付款顾客(测试)已设置,当前顾客 {PlayerStore.Instance.currentClientInstance?.GetClientBlueprint()?.identifier},队列 {PlayerStore.Instance.storeClientManager.clientStack.Count} 人");
PlayerStore.Instance.currentClientInstance = null; // 测试:丢掉在场的顾客(开局的高利贷者不可遣散)
PlayerStore.Instance.storeClientManager.clientStack.Insert(0, c);
PlayerStore.Instance.TryCallNextClient();
})); }));
} }
public static void Unsubscribe() => ModHook.OnGenerateCustomerLate -= OnGenerate; public static void Unsubscribe() => ModHook.OnGenerateCustomerLate -= OnGenerate;
@@ -55,24 +58,34 @@ namespace Decentralized
private static void Mark(StoreClient c, string asset) private static void Mark(StoreClient c, string asset)
{ {
var before = c.onItemBought; var before = c.onItemBought;
double total = 0; // 这位顾客这一单一共付了多少币
c.isNoContributeToEvidence = true; c.isNoContributeToEvidence = true;
c.onItemBought = (item, cost) => c.onItemBought = (item, cost) =>
{ {
before?.Invoke(item, cost); before?.Invoke(item, cost);
Log.Guard("用币付款成交", () => Pay(asset, item, cost)); Log.Guard("用币付款成交", () => { total += Pay(c, asset, item, cost); Say(c, asset, total); });
}; };
} }
private static void Pay(string asset, GameItem item, int cost) /// <summary>成交后顾客说的话:告诉玩家这单是币到账,不是信用点。</summary>
private static void Say(StoreClient client, string asset, double total)
{
client.acceptDealDialogue = new Dialogue().SetText(client.displayName, L.T("coinpay.line", Fmt.Num(total), asset));
client.acceptDealDialogue.priority = 4;
client.acceptDealDialoguePlayed = false;
}
private static double Pay(StoreClient client, string asset, GameItem item, int cost)
{ {
var d = Session.Data; var d = Session.Data;
double price = Session.Price(asset); double price = Session.Price(asset);
if (cost <= 0 || price <= 0) return; if (cost <= 0 || price <= 0) return 0;
int heat = item.IsTag("STOLEN_VALUE_INT") ? item.GetTagReadonly("STOLEN_VALUE_INT").GetInt() : 0; int heat = item.IsTag("STOLEN_VALUE_INT") ? item.GetTagReadonly("STOLEN_VALUE_INT").GetInt() : 0;
ModHelper.AddCredit(-cost, false); ModHelper.AddCredit(-cost, false);
double qty = CoinPayment.Receive(d.Hot, asset, cost, price, heat); double qty = CoinPayment.Receive(d.Hot, asset, cost, price, heat);
d.CoinSalesToday += cost; d.CoinSalesToday += cost;
Log.Info($"用币付款:{item.name} {cost} 信用点 → {qty:0.####} {asset},污点 +{cost * heat / 100.0:0}"); Log.Info($"用币付款:{item.name} {cost} 信用点 → {qty:0.####} {asset},污点 +{cost * heat / 100.0:0}");
return qty;
} }
} }
} }
@@ -50,6 +50,7 @@ report.burnt,Cards burnt out: {0}
report.price,PSC price: {0} credits report.price,PSC price: {0} credits
nightlog.mined,Mining rigs produced {0} PSC. nightlog.mined,Mining rigs produced {0} PSC.
nightlog.burnt,A {0} burnt out. nightlog.burnt,A {0} burnt out.
coinpay.line,Deal. {0} {1} sent to your hot wallet.
nightlog.coinpay,Customers paying in coin settled {0} credits; the coins went to the hot wallet. nightlog.coinpay,Customers paying in coin settled {0} credits; the coins went to the hot wallet.
nightlog.unpowered,{0} mining rig(s) had no power. nightlog.unpowered,{0} mining rig(s) had no power.
news.open.title,Poinbase Lists PSC news.open.title,Poinbase Lists PSC
1 # Probably Decentralized localization table: English (en)
50 report.price
51 nightlog.mined
52 nightlog.burnt
53 coinpay.line
54 nightlog.coinpay
55 nightlog.unpowered
56 news.open.title
@@ -49,6 +49,7 @@ report.burnt,烧毁的显卡:{0}
report.price,PSC 价格:{0} 信用点 report.price,PSC 价格:{0} 信用点
nightlog.mined,矿架挖出 {0} PSC。 nightlog.mined,矿架挖出 {0} PSC。
nightlog.burnt,一张 {0} 烧毁了。 nightlog.burnt,一张 {0} 烧毁了。
coinpay.line,成交,{0} {1} 已转入热钱包。
nightlog.coinpay,用币付款的顾客共结算 {0} 信用点,已换成币进了热钱包。 nightlog.coinpay,用币付款的顾客共结算 {0} 信用点,已换成币进了热钱包。
nightlog.unpowered,{0} 个矿架没有电。 nightlog.unpowered,{0} 个矿架没有电。
news.open.title,Poinbase 上架 PSC news.open.title,Poinbase 上架 PSC
1 # Probably Decentralized 本地化表:简体中文(zh)
49 report.price
50 nightlog.mined
51 nightlog.burnt
52 coinpay.line
53 nightlog.coinpay
54 nightlog.unpowered
55 news.open.title