Cards: coarse condition grade in the description until the card is owned

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ZHU MINCHAOandClaude Sonnet 5.5 committed 2026-11-03 13:23:54 +08:00
1 parent 821eb1b960
commit 68265095a8
3 files changed
+23 -3

No files matched your search

+13 -1
View File
@@ -102,9 +102,21 @@ namespace Decentralized
Refresh(item);
}
/// <summary>说明:算力和耗电按标称写;成色在归玩家之前只给粗略等级(要看外观自己判断),归玩家之后给精确健康度。</summary>
private static string Desc(GameItem item, Unit u)
{
var label = u.Label;
string cond = GeneralHelper.IsItemOwned(item)
? Mathf.RoundToInt((float)u.Health) + "%"
: L.T(u.Health >= 85 ? "item.gpu.grade.1" : u.Health >= 60 ? "item.gpu.grade.2" : u.Health >= 35 ? "item.gpu.grade.3" : "item.gpu.grade.4");
return L.T("item.gpu.desc", Fmt.Num(label.DisplayHash), Fmt.Num(label.Kj), cond);
}
private static void SyncValue(GameItem item)
{
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));
if (item.unitValue != value) item.unitValue = value;
}
@@ -147,7 +159,7 @@ namespace Decentralized
}
item.SetSpriteAndShapeFromMod(ModInfo.Id, (label.Brand == Hardware.Probidia ? "gpu_probidia" : "gpu_pmd") + (item.IsTag(BackTag) ? "_b" : "_f"));
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.shortDescription = Desc(item, u);
item.unitValue = CardValue.True(u);
SyncValue(item);
}
@@ -14,7 +14,7 @@ mat.common_electronic,Common electronics
mat.rare_electronic,Rare electronics
rig.label.cards,Graphics cards
item.gpu.name,{0} {1}
item.gpu.desc,"Hashrate {0} MH/s. Draws {1} kJ per day. Condition {2}%."
item.gpu.desc,"Hashrate {0} MH/s. Draws {1} kJ per day. Condition: {2}."
item.gpu.burnt.name,Burnt {0} {1}
item.gpu.burnt.desc,This card no longer works.
term.title,Trading Terminal
@@ -68,3 +68,7 @@ dealer.line2.2,"No warranty. Look before you take."
dealer.line2.3,"Price is negotiable if you want them."
inspect.flip.back,"Turn over"
inspect.flip.front,"Front side"
item.gpu.grade.1,"like new"
item.gpu.grade.2,"decent"
item.gpu.grade.3,"clearly worn"
item.gpu.grade.4,"badly worn"
1 # Probably Decentralized localization table: English (en)
14 mat.rare_electronic
15 rig.label.cards
16 item.gpu.name
17 item.gpu.desc
18 item.gpu.burnt.name
19 item.gpu.burnt.desc
20 term.title
68 dealer.line2.3
69 inspect.flip.back
70 inspect.flip.front
71 item.gpu.grade.1
72 item.gpu.grade.2
73 item.gpu.grade.3
74 item.gpu.grade.4
@@ -13,7 +13,7 @@ mat.common_electronic,普通电子元件
mat.rare_electronic,稀有电子元件
rig.label.cards,显卡
item.gpu.name,{0} {1}
item.gpu.desc,算力 {0} MH/s。耗电 {1} kJ/天。健康度 {2}%。
item.gpu.desc,算力 {0} MH/s。耗电 {1} kJ/天。成色 {2}。
item.gpu.burnt.name,烧毁的 {0} {1}
item.gpu.burnt.desc,此显卡已无法工作。
term.title,交易终端
@@ -67,3 +67,7 @@ dealer.line2.2,"不保修,看好了再拿。"
dealer.line2.3,"要的话价钱好商量。"
inspect.flip.back,"翻到背面"
inspect.flip.front,"翻到正面"
item.gpu.grade.1,"接近全新"
item.gpu.grade.2,"成色尚可"
item.gpu.grade.3,"明显旧了"
item.gpu.grade.4,"磨损严重"
1 # Probably Decentralized 本地化表:简体中文(zh)
13 mat.rare_electronic
14 rig.label.cards
15 item.gpu.name
16 item.gpu.desc
17 item.gpu.burnt.name
18 item.gpu.burnt.desc
19 term.title
67 dealer.line2.3
68 inspect.flip.back
69 inspect.flip.front
70 item.gpu.grade.1
71 item.gpu.grade.2
72 item.gpu.grade.3
73 item.gpu.grade.4