Stage 7.1: prediction markets (LMSR, event/faction/purity/price markets, insider check)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ZHU MINCHAOandClaude Sonnet 5.5 committed 2026-11-04 07:26:27 +08:00
1 parent 7d13ae2fe8
commit e5a6e3e22c
11 files changed
+810 -4

No files matched your search

+15
View File
@@ -56,6 +56,7 @@ namespace Decentralized
int day = StoreStation.GetDayCounter();
d.Market.Open(ActiveEvents(), d.Rng, day);
d.Market.Whale(d.Rng);
PredictGame.Morning(d, day);
if (!d.OpeningNewsShown)
{
News.Show("pd_news_open", L.T("news.open.title"), L.T("news.open.desc"), 2);
@@ -181,6 +182,9 @@ namespace Decentralized
d.Network.Night(day, d.Market.Price, hash);
if (d.Network.Reward < rewardBefore) d.Market.OnHalving(d.Rng);
if (d.Network.Reward < rewardBefore) News.Show("pd_news_halving_" + day, L.T("news.halving.title"), L.T("news.halving.desc"), 2);
// 预测市场:先登记今晚的观测再结算到期的盘口;行情盘读夜间更新之前的价格
var predictEvents = PredictGame.Available(day) || d.Predict.Markets.Count > 0
? d.Predict.Night(day, PredictGame.ActiveIds(), m => PredictGame.Outcome(m, d), d.Poinbase, d.Rng) : new List<PredictEvent>();
// 永续:用今天的标记价(当日均价)结算,要在今晚的价格更新之前
var perpEvents = d.Perps.Night(day, new Dictionary<string, double> { ["PSC"] = d.Market.Mark, ["SPARK"] = d.Stable.Spark }, d.Poinbase, Session.Price);
if (perpEvents.Any(e => e.Kind == "seize")) SeizeForDebt(d, day);
@@ -225,6 +229,17 @@ namespace Decentralized
case Network.EraStep.Warn: News.Show("pd_news_erawarn_" + day, L.T("news.erawarn.title"), L.T("news.erawarn.desc"), 5); break;
case Network.EraStep.Start: News.Show("pd_news_era_" + day, L.T("news.era.title"), L.T("news.era.desc"), 5); Log.Info("矿机时代到来:NPC 耗电效率翻倍"); break;
}
foreach (var e in predictEvents)
{
if (e.Kind == "win") ps.AddNightLog(L.T("nightlog.predict.win", PredictGame.Question(e.Market), Fmt.Credits(e.Amount)));
else if (e.Kind == "lose") ps.AddNightLog(L.T("nightlog.predict.lose", PredictGame.Question(e.Market), Fmt.Credits(e.Amount)), "cc7755");
else if (e.Kind == "void") ps.AddNightLog(L.T("nightlog.predict.void", PredictGame.Question(e.Market), Fmt.Credits(e.Amount)));
else if (e.Kind == "caught")
{
ps.secData.CommitCrime("FRAUD", (int)Math.Round(e.Fraud));
ps.AddNightLog(L.T("nightlog.predict.caught", PredictGame.Question(e.Market), Fmt.Credits(e.Amount)), "cc7755");
}
}
foreach (var e in perpEvents)
{
string who = e.Product + " " + L.T(e.Long ? "perp.long" : "perp.short");