Used cards: counter quote tag instead of client-temporary feature; item type Material

Client-temporary features are stripped when an item sits on the front
counter, so the scam markup never applied. The quote now lives in a tag and
counts only while the item is not owned. GPU item type ELECTRONIC has no
translation in the game, so cards are typed as Material.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ZHU MINCHAOandClaude Sonnet 5.5 committed 2026-11-03 12:00:39 +08:00
1 parent 9b48d7bf0e
commit de7d5caafe
4 files changed
+30 -22

No files matched your search

+18 -2
View File
@@ -21,7 +21,7 @@ namespace Decentralized
public const string FakeTag = "PD_FAKE_OF";
public const string RefurbTag = "PD_REFURBISHED";
public const string DeadTag = "PD_DEAD";
public const string LookTag = "PD_LOOK", BackTag = "PD_BACK";
public const string LookTag = "PD_LOOK", BackTag = "PD_BACK", QuoteTag = "PD_QUOTE";
public static Action OpenTerminal;
@@ -69,7 +69,7 @@ namespace Decentralized
private static GameItem CreateGpu(HardwareSpec spec)
{
var item = ItemDirectory.CreateEmptyItem(GpuId(spec.Model));
item.SetGameItemType("ELECTRONIC");
item.SetGameItemType("MATERIAL");
item.onLoaded = Refresh;
// 右键"切换"翻面;外观差异用叠加图画在同一张底图上
item.EnableTag(ToggleAppearanceHelper.TOGGLE_APPEARANCE_TAG);
@@ -95,6 +95,20 @@ namespace Decentralized
return item;
}
/// <summary>贩子的柜台报价:只在物品还不属于玩家时按报价算,归玩家之后立刻只值真实价值。</summary>
public static void SetQuote(GameItem item, long quote)
{
item.ModifyTag(QuoteTag, t => t.Enable().SetLong(quote));
Refresh(item);
}
private static void SyncValue(GameItem item)
{
if (item.IsTag(DeadTag)) return;
long value = item.IsTag(QuoteTag) && !GeneralHelper.IsItemOwned(item) ? item.GetTagReadonly(QuoteTag).GetLong() : CardValue.True(ToUnit(item));
if (item.unitValue != value) item.unitValue = value;
}
public static Unit ToUnit(GameItem item)
{
string model = item.identifier.Substring(GpuPrefix.Length);
@@ -135,6 +149,7 @@ namespace Decentralized
item.name = L.T("item.gpu.name", label.Brand, DisplayModel(label.Model));
item.shortDescription = L.T("item.gpu.desc", Fmt.Num(label.DisplayHash), Fmt.Num(label.Kj), Mathf.RoundToInt((float)u.Health));
item.unitValue = CardValue.True(u);
SyncValue(item);
}
private static Sprite ModSprite(string key)
@@ -147,6 +162,7 @@ namespace Decentralized
private static List<ItemSpriteModifier> Overlays(GameItem item)
{
var list = new List<ItemSpriteModifier>();
SyncValue(item); // 归属变化(买下)后价格随之变回真实价值
if (item.IsTag(DeadTag)) return list;
var u = ToUnit(item);
var keys = new List<string>();