Dr. Jackson stocks mining hardware

Uses the game's inventor stock hook (his shop at night and his weekly visit
to the player's store) and his own table placement, so prices are item value
plus his markup. A rig if the player has none (30% otherwise), two basic
cards every time, advanced cards from day 10 (60%, a second at 30%),
flagships from day 30 (25%) or always during his special stock from day 20.
New, genuine cards only; only after Mining Access is unlocked. A test entry
in the dev panel (F9) restocks the counter the way his shop does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZHU MINCHAOandClaude Opus 5.5 committed 2026-11-03 09:27:28 +08:00
1 parent 79d4c686a0
commit a101b58f1c
5 files changed
+110

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
using System.Collections.Generic;
using System.Linq;
using Decentralized.Domain;
namespace Decentralized
{
/// <summary>
/// 杰克逊博士进货时(夜间去他店里,或他每周来本店摆摊)加上挖矿设备。用游戏给 mod 的进货钩子和他自己的上架函数,
/// 价格是物品价值加上他的加价(难度规则与夜间事件决定)。解锁矿业渠道之后才上货。
/// </summary>
public static class DealerStock
{
public static void Subscribe()
{
ModHook.OnPlaceInventorInventoryItemLate += OnPlace;
// 开发者模式(F9)里的测试入口:像到了杰克逊店里一样,清空并扩大柜台后上货
ModHelper.AddDebugFunction(ModInfo.Id, ModInfo.Name, "Dr. Jackson stock (test)", () =>
{
EmporiumEntry.Instance.ClearFrontInv();
EmporiumEntry.Instance.ExpandFrontCounterGrid();
StoreClientList.PlaceInventorInventory();
});
}
public static void Unsubscribe()
{
ModHook.OnPlaceInventorInventoryItemLate -= OnPlace;
ModHelper.RemoveDebugFunctions(ModInfo.Id);
}
private static void OnPlace(List<GameItem> owned)
{
if (Session.Data == null || !Unlock.IsUnlocked) return;
Log.Guard("杰克逊博士上货", () =>
{
bool ownsRig = owned != null && owned.Any(i => i.identifier == Items.Rig);
bool special = AfterhourEvents.IsActive("special_stock");
var placed = new List<string>();
foreach (var kind in Dealer.Stock(StoreStation.GetDayCounter(), ownsRig, special, Session.Data.Rng))
{
var item = ModHelper.SpawnItem(kind == Dealer.Rig ? Items.Rig : Items.GpuId(kind));
bool ok = PlayerStore.Instance.TryAddDirectSellingItemToTable(item);
placed.Add(ok ? $"{kind}#{item.uniqueId}" : kind + "(柜台已满)");
}
Log.Info("杰克逊博士上货:" + string.Join(",", placed));
});
}
}
}
+2
View File
@@ -14,6 +14,7 @@ namespace Decentralized
Items.OpenTerminal = TerminalWindow.Open;
Unlock.Register();
Night.Subscribe();
DealerStock.Subscribe();
ModHook.OnGameLoadedLate += Session.Load;
ModHook.OnNewGameStarted += OnNewGame;
Log.Info($"{ModInfo.Name} {ModInfo.Version} 已启用");
@@ -23,6 +24,7 @@ namespace Decentralized
{
Items.Unsubscribe();
Night.Unsubscribe();
DealerStock.Unsubscribe();
ModHook.OnGameLoadedLate -= Session.Load;
ModHook.OnNewGameStarted -= OnNewGame;
}