Cards: appearance follows wear, hash depends on fan and contacts, seller confrontation
Fan, contact and scratch levels are recomputed from health and a per-card seed, so a card looks older as it wears. Fan and contacts scale hashrate. Each inspection-tray detail now maps to exactly one dimension value. Quoting dealers price the card as if its condition were fine; the player points out fan, contacts, bracket, print or sticker in the tray to take the matching discount or expose a fake (a wrong accusation costs reputation like the vanilla confrontation). Unowned cards show a coarse grade and rated specs. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
68265095a8
commit
f93dbc6eec
9 files changed
+279
-76
No files matched your search
+56
-11
@@ -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", QuoteTag = "PD_QUOTE";
|
||||
public const string LookTag = "PD_LOOK", BackTag = "PD_BACK", SeedTag = "PD_SEED", QuotedTag = "PD_QUOTED", MarkupTag = "PD_MARKUP", PointedTag = "PD_POINTED", ExposedTag = "PD_EXPOSED";
|
||||
|
||||
public static Action OpenTerminal;
|
||||
|
||||
@@ -95,13 +95,51 @@ namespace Decentralized
|
||||
return item;
|
||||
}
|
||||
|
||||
/// <summary>贩子的柜台报价:只在物品还不属于玩家时按报价算,归玩家之后立刻只值真实价值。</summary>
|
||||
public static void SetQuote(GameItem item, long quote)
|
||||
/// <summary>贩子的柜台报价:在物品还不属于玩家时,按 <see cref="CardValue.Quote"/> 算(装作成色没问题,玩家指出一项才扣一项);
|
||||
/// 归玩家之后立刻只值真实价值。老实人的卡不报价。</summary>
|
||||
public static void SetQuote(GameItem item, int markupPct)
|
||||
{
|
||||
item.ModifyTag(QuoteTag, t => t.Enable().SetLong(quote));
|
||||
item.EnableTag(QuotedTag);
|
||||
item.ModifyTag(MarkupTag, t => t.Enable().SetInt(markupPct));
|
||||
Refresh(item);
|
||||
}
|
||||
|
||||
public static int Pointed(GameItem item) => item.IsTag(PointedTag) ? item.GetTagReadonly(PointedTag).GetInt() : 0;
|
||||
|
||||
/// <summary>玩家对峙时能指出的五项:风扇、金手指、挡板、丝印、贴纸。</summary>
|
||||
public const int PointFan = 1, PointFingers = 2, PointBracket = 4, PointPrint = 8, PointSticker = 16;
|
||||
|
||||
/// <summary>指出过的项换算成报价里扣价的维度位(丝印、接口数、手写序列号不扣价,只拆穿假货)。</summary>
|
||||
private static int PricedDims(int pointed, CardLook l) =>
|
||||
((pointed & PointFan) != 0 ? CardLook.DimFan : 0) | ((pointed & PointFingers) != 0 ? CardLook.DimFingers : 0)
|
||||
| ((pointed & PointBracket) != 0 ? CardLook.DimScratch : 0) | ((pointed & PointSticker) != 0 ? CardLook.DimSeal : 0);
|
||||
|
||||
/// <summary>这一项有没有问题;返回 0 没问题,1 老化类问题(扣价),2 假货迹象(拆穿假货)。</summary>
|
||||
public static int Defect(GameItem item, int point)
|
||||
{
|
||||
var u = ToUnit(item);
|
||||
var l = u.Appearance;
|
||||
switch (point)
|
||||
{
|
||||
case PointFan: return l.Fan > 0 ? 1 : 0;
|
||||
case PointFingers: return l.Fingers > 0 ? 1 : 0;
|
||||
case PointBracket: return l.Bracket == 2 ? 2 : l.Bracket == 1 ? 1 : 0;
|
||||
case PointPrint: return l.Print != 0 ? 2 : 0;
|
||||
case PointSticker: return l.Sticker == 1 ? 2 : l.Sticker == 2 ? 1 : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>玩家指出一项:记下来,有问题就按维度扣价或拆穿假货;返回这一项的情况(0 没问题,1 扣价,2 拆穿)。</summary>
|
||||
public static int Point(GameItem item, int point)
|
||||
{
|
||||
int kind = Defect(item, point);
|
||||
item.ModifyTag(PointedTag, t => t.Enable().SetInt(Pointed(item) | point));
|
||||
if (kind == 2) item.EnableTag(ExposedTag);
|
||||
Refresh(item);
|
||||
return kind;
|
||||
}
|
||||
|
||||
/// <summary>说明:算力和耗电按标称写;成色在归玩家之前只给粗略等级(要看外观自己判断),归玩家之后给精确健康度。</summary>
|
||||
private static string Desc(GameItem item, Unit u)
|
||||
{
|
||||
@@ -117,7 +155,10 @@ namespace Decentralized
|
||||
if (item.IsTag(DeadTag)) return;
|
||||
string desc = Desc(item, ToUnit(item));
|
||||
if (item.shortDescription != desc) item.shortDescription = desc;
|
||||
long value = item.IsTag(QuoteTag) && !GeneralHelper.IsItemOwned(item) ? item.GetTagReadonly(QuoteTag).GetLong() : CardValue.True(ToUnit(item));
|
||||
var u = ToUnit(item);
|
||||
long value = item.IsTag(QuotedTag) && !GeneralHelper.IsItemOwned(item)
|
||||
? CardValue.Quote(u, item.IsTag(MarkupTag) ? item.GetTagReadonly(MarkupTag).GetInt() : 0, PricedDims(Pointed(item), u.Appearance), item.IsTag(ExposedTag))
|
||||
: CardValue.True(u);
|
||||
if (item.unitValue != value) item.unitValue = value;
|
||||
}
|
||||
|
||||
@@ -131,6 +172,8 @@ namespace Decentralized
|
||||
u.Refurbished = item.IsTag(RefurbTag);
|
||||
u.Dead = item.IsTag(DeadTag);
|
||||
if (item.IsTag(LookTag)) u.Look = CardLook.Decode(item.GetTagReadonly(LookTag).GetString());
|
||||
// 外观种子:没有记录的卡(正规渠道的新卡)用物品编号当种子,之后同样随损耗变旧
|
||||
u.Look.Seed = item.IsTag(SeedTag) ? (uint)item.GetTagReadonly(SeedTag).GetInt() : (uint)(item.uniqueId * 2654435761u) | 1u;
|
||||
return u;
|
||||
}
|
||||
|
||||
@@ -141,6 +184,7 @@ namespace Decentralized
|
||||
if (u.Refurbished) item.EnableTag(RefurbTag);
|
||||
if (u.Dead) item.EnableTag(DeadTag);
|
||||
item.ModifyTag(LookTag, s => s.Enable().SetString(u.Look.Encode()));
|
||||
item.ModifyTag(SeedTag, s => s.Enable().SetInt((int)u.Look.Seed));
|
||||
Refresh(item);
|
||||
}
|
||||
|
||||
@@ -176,21 +220,22 @@ namespace Decentralized
|
||||
public static string LookKeys(GameItem item, List<string> overlays)
|
||||
{
|
||||
var u = ToUnit(item);
|
||||
var l = u.Appearance;
|
||||
bool back = IsBack(item);
|
||||
string brand = u.Label.Brand == Hardware.Probidia ? "gpu_probidia" : "gpu_pmd";
|
||||
if (u.Dead) return back ? "gpu_burnt_b" : "gpu_burnt_f";
|
||||
if (!back)
|
||||
{
|
||||
if (u.Look.Fan > 0) overlays.Add("gpu_ov_fan" + u.Look.Fan);
|
||||
if (u.Look.Fingers > 0) overlays.Add("gpu_ov_fin" + u.Look.Fingers);
|
||||
if (u.Look.Bracket > 0) overlays.Add("gpu_ov_brk" + u.Look.Bracket);
|
||||
if (l.Fan > 0) overlays.Add("gpu_ov_fan" + l.Fan);
|
||||
if (l.Fingers > 0) overlays.Add("gpu_ov_fin" + l.Fingers);
|
||||
if (l.Bracket > 0) overlays.Add("gpu_ov_brk" + l.Bracket);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 丝印:0 标称型号;1 印的是真实芯片型号;2 标称型号但字歪(重印过)
|
||||
string model = u.Look.Print == 1 && u.FakeOf != null ? u.FakeOf : u.Model;
|
||||
overlays.Add((u.Look.Print == 2 ? "gpu_ov_txs_" : "gpu_ov_txt_") + model.ToLowerInvariant());
|
||||
if (u.Look.Sticker > 0) overlays.Add("gpu_ov_stk" + u.Look.Sticker);
|
||||
string model = l.Print == 1 && u.FakeOf != null ? u.FakeOf : u.Model;
|
||||
overlays.Add((l.Print == 2 ? "gpu_ov_txs_" : "gpu_ov_txt_") + model.ToLowerInvariant());
|
||||
if (l.Sticker > 0) overlays.Add("gpu_ov_stk" + l.Sticker);
|
||||
}
|
||||
return brand + (back ? "_b" : "_f");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user