diff --git a/src/Decentralized/Items.cs b/src/Decentralized/Items.cs index 77f2b08..a0cb329 100644 --- a/src/Decentralized/Items.cs +++ b/src/Decentralized/Items.cs @@ -102,9 +102,21 @@ namespace Decentralized Refresh(item); } + /// 说明:算力和耗电按标称写;成色在归玩家之前只给粗略等级(要看外观自己判断),归玩家之后给精确健康度。 + 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); } diff --git a/src/Decentralized/ModFiles/Localization/en.csv b/src/Decentralized/ModFiles/Localization/en.csv index a30ec56..f5f1cf0 100644 --- a/src/Decentralized/ModFiles/Localization/en.csv +++ b/src/Decentralized/ModFiles/Localization/en.csv @@ -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" diff --git a/src/Decentralized/ModFiles/Localization/zh.csv b/src/Decentralized/ModFiles/Localization/zh.csv index b4f724d..55b7d98 100644 --- a/src/Decentralized/ModFiles/Localization/zh.csv +++ b/src/Decentralized/ModFiles/Localization/zh.csv @@ -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,"磨损严重"