Test entries for running nights and crackdowns; night logging; changelog with in-game verification

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ZHU MINCHAOandClaude Sonnet 5.5 committed 2026-11-03 17:20:08 +08:00
1 parent c295e72a48
commit ad12918511
3 files changed
+25 -3

No files matched your search

+18 -1
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using Decentralized.Domain;
namespace Decentralized
@@ -15,6 +16,22 @@ namespace Decentralized
public static void Subscribe()
{
ModHook.OnGenerateCustomerLate += OnGenerate;
ModHelper.AddDebugFunction(ModInfo.Id, ModInfo.Name, "Run night (test)", () => Log.Guard("过夜(测试)", () =>
{
// 走游戏自己的夜间流程(EndNight 会触发本 mod 的夜间结算),再进下一天并开门前的日程
// 游戏过夜会清空前柜台,先把自己的东西收进物品栏
foreach (var it in EmporiumEntry.Instance.frontInvinvElement.childItems.ToList())
if (GeneralHelper.IsItemOwned(it)) GraphUtils.TryAcceptAll(EmporiumEntry.Instance.invElement, it);
PlayerStore.Instance.EndNight();
StoreStation.Instance.storeEventManager.OnDayEnd(); // 让事件按天数过期
StoreStation.Instance.StartDay();
Log.Info($"过夜完成,现在是第 {StoreStation.GetDayCounter()} 天");
}));
ModHelper.AddDebugFunction(ModInfo.Id, ModInfo.Name, "Start crackdown (test)", () => Log.Guard("镇压(测试)", () =>
{
StoreStation.Instance.storeEventManager.ActivateEvent(OperationListSec.Crackdown());
Log.Info("镇压事件已激活");
}));
ModHelper.AddDebugFunction(ModInfo.Id, ModInfo.Name, "Frozen CRT (test)", () => Log.Guard("冻结 CRT(测试)", () =>
{
var w = Session.Data.Hot;
@@ -25,7 +42,7 @@ namespace Decentralized
ModHelper.AddDebugFunction(ModInfo.Id, ModInfo.Name, "Tainted wallet (test)", () => Log.Guard("带污点的钱包(测试)", () =>
{
var w = Session.Data.Hot;
w.Add(Assets.PSC, 100); w.Taint += 3000; w.Basis += 2000;
w.Add(Assets.PSC, 100); w.Add(Assets.CRT, 1000); w.Taint += 3000; w.Basis += 2000;
Log.Info($"钱包:PSC {w.Get(Assets.PSC):0.##},污点 {w.Taint:0}");
}));
ModHelper.AddDebugFunction(ModInfo.Id, ModInfo.Name, "Coin buyer (test)", () => Log.Guard("用币付款顾客(测试)", () =>
+3
View File
@@ -82,6 +82,7 @@ namespace Decentralized
var d = Session.Data;
int day = StoreStation.GetDayCounter();
var events = ActiveEvents();
Log.Info($"夜间事件:{string.Join(",", events)}(新增 {string.Join(",", events.Where(e => !d.ActiveEvents.Contains(e)))}),黑市声望 {StoreReputation.GetBMReputation()}");
bool wasSanctioned = d.Mixer.Sanctioned(day);
foreach (var ev in events.Where(e => !d.ActiveEvents.Contains(e)))
{
@@ -135,6 +136,7 @@ namespace Decentralized
if (mined > 0) ps.AddNightLog(L.T("nightlog.mined", Fmt.Num(mined)));
foreach (var m in d.Mixer.Night(d.Hot, day, Session.Price, d.Rng))
{
Log.Info($"混币器:{(m.Rugged ? "跑路" : "提回")} {m.Amount:0.##} {m.Asset},污点 {m.TaintBefore:0} → {m.TaintAfter:0},标记 {m.Flagged}");
if (m.Rugged) ps.AddNightLog(L.T("nightlog.mixer_rug", Fmt.Num(m.Amount), m.Asset), "cc7755");
else
{
@@ -147,6 +149,7 @@ namespace Decentralized
if (unpowered > 0 && units.Count + unpowered > 0) ps.AddNightLog(L.T("nightlog.unpowered", unpowered), "cc7755");
if (d.CoinSalesToday > 0) ps.AddNightLog(L.T("nightlog.coinpay", Fmt.Credits(d.CoinSalesToday)));
d.CoinSalesToday = 0;
Log.Info($"夜间结算第 {day} 天:钱包污点 {d.Hot.Taint:0},CRT {d.Hot.Get(Assets.CRT):0}(冻结 {(d.Hot.Frozen.TryGetValue(Assets.CRT, out var fz) ? fz : 0):0}),混币器在途 {d.Mixer.Pending.Count},制裁至 {d.Mixer.SanctionedUntil}");
Session.Save();
}
}