2020using CAP_ChatInteractive . Commands . CommandHandlers ;
2121using CAP_ChatInteractive . Commands . Cooldowns ;
2222using CAP_ChatInteractive . Utilities ;
23+ using RimWorld ;
2324using System ;
2425using System . Linq ;
2526using Verse ;
@@ -34,7 +35,8 @@ public override string Execute(ChatMessageWrapper messageWrapper, string[] args)
3435 {
3536 if ( args . Length == 0 )
3637 {
37- return "Usage: !buy <item> [quality] [material] [quantity], only used for items. Also !use !equip !wear" ;
38+ // return "Usage: !buy {item} [quality] [material] [quantity], only used for items. Also !use !equip !wear";
39+ return "RICS.CC.Buy.Usage" . Translate ( ) ;
3840 }
3941
4042 // Check if this is a pawn purchase
@@ -94,7 +96,8 @@ public override string Execute(ChatMessageWrapper messageWrapper, string[] args)
9496
9597 if ( ! cooldownManager . CanPurchaseItem ( ) )
9698 {
97- return $ "Store purchase limit reached ({ globalSettings . MaxItemPurchases } per { globalSettings . EventCooldownDays } days)";
99+ // return $"Store purchase limit reached ({globalSettings.MaxItemPurchases} per {globalSettings.EventCooldownDays} days)";
100+ return "RICS.CC.Buy.PurchaseLimit" . Translate ( globalSettings . MaxItemPurchases , globalSettings . EventCooldownDays ) ;
98101 }
99102
100103 return BuyItemCommandHandler . HandleBuyItem ( messageWrapper , args , false , false , false ) ;
@@ -115,7 +118,8 @@ public override string Execute(ChatMessageWrapper user, string[] args)
115118 {
116119 if ( args . Length == 0 )
117120 {
118- return "Usage: !use [item] " ;
121+ // return "Usage: !use [item] ";
122+ return "RICS.CC.use.usage" . Translate ( ) ;
119123 }
120124 var cooldownManager = Current . Game . GetComponent < GlobalCooldownManager > ( ) ;
121125 if ( cooldownManager == null )
@@ -126,7 +130,8 @@ public override string Execute(ChatMessageWrapper user, string[] args)
126130 var globalSettings = CAPChatInteractiveMod . Instance . Settings . GlobalSettings ;
127131 if ( ! cooldownManager . CanPurchaseItem ( ) )
128132 {
129- return $ "Store purchase limit reached ({ globalSettings . MaxItemPurchases } per { globalSettings . EventCooldownDays } days)";
133+ // return $"Store purchase limit reached ({globalSettings.MaxItemPurchases} per {globalSettings.EventCooldownDays} days)";
134+ return "RICS.CC.common.PurchaseLimit" . Translate ( globalSettings . MaxItemPurchases , globalSettings . EventCooldownDays ) ;
130135 }
131136 return UseItemCommandHandler . HandleUseItem ( user , args ) ;
132137 }
@@ -140,7 +145,8 @@ public override string Execute(ChatMessageWrapper user, string[] args)
140145 {
141146 if ( args . Length == 0 )
142147 {
143- return "Usage: !equip [item] [quality] [material]" ;
148+ // return "Usage: !equip [item] [quality] [material]";
149+ return "RICS.CC.equip.usage" . Translate ( ) ;
144150 }
145151
146152 var cooldownManager = Current . Game . GetComponent < GlobalCooldownManager > ( ) ;
@@ -152,7 +158,7 @@ public override string Execute(ChatMessageWrapper user, string[] args)
152158 var globalSettings = CAPChatInteractiveMod . Instance . Settings . GlobalSettings ;
153159 if ( ! cooldownManager . CanPurchaseItem ( ) )
154160 {
155- return $ "Store purchase limit reached ( { globalSettings . MaxItemPurchases } per { globalSettings . EventCooldownDays } days)" ;
161+ return "RICS.CC.common.PurchaseLimit" . Translate ( globalSettings . MaxItemPurchases , globalSettings . EventCooldownDays ) ;
156162 }
157163
158164 return BuyItemCommandHandler . HandleBuyItem ( user , args , true , false ) ;
@@ -167,7 +173,7 @@ public override string Execute(ChatMessageWrapper user, string[] args)
167173 {
168174 if ( args . Length == 0 )
169175 {
170- return "Usage: ! wear [item] [quality] [material]" ;
176+ return "RICS.CC. wear.usage" . Translate ( ) ;
171177 }
172178
173179 var cooldownManager = Current . Game . GetComponent < GlobalCooldownManager > ( ) ;
@@ -179,7 +185,7 @@ public override string Execute(ChatMessageWrapper user, string[] args)
179185 var globalSettings = CAPChatInteractiveMod . Instance . Settings . GlobalSettings ;
180186 if ( ! cooldownManager . CanPurchaseItem ( ) )
181187 {
182- return $ "Store purchase limit reached ( { globalSettings . MaxItemPurchases } per { globalSettings . EventCooldownDays } days)" ;
188+ return "RICS.CC.common.PurchaseLimit" . Translate ( globalSettings . MaxItemPurchases , globalSettings . EventCooldownDays ) ;
183189 }
184190 return BuyItemCommandHandler . HandleBuyItem ( user , args , false , true ) ;
185191 }
@@ -193,7 +199,7 @@ public override string Execute(ChatMessageWrapper user, string[] args)
193199 {
194200 if ( args . Length == 0 )
195201 {
196- return "Usage: ! backpack [item] [quality] [material]" ;
202+ return "RICS.CC. backpack.usage" . Translate ( ) ;
197203 }
198204 var cooldownManager = Current . Game . GetComponent < GlobalCooldownManager > ( ) ;
199205 if ( cooldownManager == null )
@@ -204,7 +210,7 @@ public override string Execute(ChatMessageWrapper user, string[] args)
204210 var globalSettings = CAPChatInteractiveMod . Instance . Settings . GlobalSettings ;
205211 if ( ! cooldownManager . CanPurchaseItem ( ) )
206212 {
207- return $ "Store purchase limit reached ( { globalSettings . MaxItemPurchases } per { globalSettings . EventCooldownDays } days)" ;
213+ return "RICS.CC.common.PurchaseLimit" . Translate ( globalSettings . MaxItemPurchases , globalSettings . EventCooldownDays ) ;
208214 }
209215 return BuyItemCommandHandler . HandleBuyItem ( user , args , false , false , true ) ;
210216 }
@@ -217,7 +223,8 @@ public class PurchaseList : ChatCommand
217223 public override string Execute ( ChatMessageWrapper user , string [ ] args )
218224 {
219225 var settings = CAPChatInteractiveMod . Instance . Settings . GlobalSettings ;
220- return $ "Check out the item prices and purchase list here: { settings . priceListUrl } ";
226+ // return $"Check out the item prices and purchase list here: {settings.priceListUrl}";
227+ return "RICS.CC.purchaselist.message" . Translate ( settings . priceListUrl ) ;
221228 }
222229 }
223230
@@ -229,7 +236,7 @@ public override string Execute(ChatMessageWrapper user, string[] args)
229236 {
230237 if ( args . Length == 0 )
231238 {
232- return "Usage: ! pricecheck [item] [quality] [material] [quantity] - Example: !pricecheck assault rifle masterwork 1" ;
239+ return "RICS.CC. pricecheck.usage" . Translate ( ) ;
233240 }
234241 var settings = CAPChatInteractiveMod . Instance . Settings . GlobalSettings ;
235242 var currencySymbol = settings . CurrencyName ? . Trim ( ) ?? "¢" ;
@@ -240,7 +247,7 @@ public override string Execute(ChatMessageWrapper user, string[] args)
240247 args ,
241248 allowQuality : true ,
242249 allowMaterial : true ,
243- allowSide : false , // Side doesn't affect price for non-surgery items
250+ allowSide : false , // Side doesn't affect price
244251 allowQuantity : true
245252 ) ;
246253
@@ -249,7 +256,7 @@ public override string Execute(ChatMessageWrapper user, string[] args)
249256 return $ "❌ { parsed . Error } ";
250257 }
251258
252- Logger . Debug ( $ "PriceCheck parsing - Item: '{ parsed . ItemName } ', Quality: '{ parsed . Quality } ', Material: '{ parsed . Material } ', Quantity: { parsed . Quantity } ") ;
259+ // Logger.Debug($"PriceCheck parsing - Item: '{parsed.ItemName}', Quality: '{parsed.Quality}', Material: '{parsed.Material}', Quantity: {parsed.Quantity}");
253260
254261 var storeItem = StoreCommandHelper . GetStoreItemByName ( parsed . ItemName ) ;
255262 if ( storeItem == null )
@@ -261,14 +268,15 @@ public override string Execute(ChatMessageWrapper user, string[] args)
261268 // var suggestionList = string.Join(", ", suggestions.Select(s => s.DisplayName));
262269 // return $"❌ Item '{parsed.ItemName}' not found. Did you mean: {suggestionList}?";
263270 //}
264- return $ "❌ Item ' { parsed . ItemName } ' not found in the store." ;
271+ return $ "RICS.CC.pricecheck.notfound" . Translate ( parsed . ItemName ) ;
265272 }
266273
267274 // Get the ThingDef for price calculation
268275 var thingDef = DefDatabase < ThingDef > . GetNamedSilentFail ( storeItem . DefName ) ;
269276 if ( thingDef == null )
270277 {
271- return $ "❌ Could not find item definition for '{ parsed . ItemName } '";
278+ // return $"❌ Could not find item definition for '{parsed.ItemName}'";
279+ return "RICS.CC.pricecheck.errorthingdef" . Translate ( parsed . ItemName ) ;
272280 }
273281
274282 // Parse quality using ItemConfigHelper
@@ -281,7 +289,7 @@ public override string Execute(ChatMessageWrapper user, string[] args)
281289 material = ItemConfigHelper . ParseMaterial ( parsed . Material , thingDef ) ;
282290 if ( material == null )
283291 {
284- return $ "❌ Material ' { parsed . Material } ' not found or cannot be used for { parsed . ItemName } ";
292+ parsed . Material = " ";
285293 }
286294 }
287295
@@ -290,7 +298,8 @@ public override string Execute(ChatMessageWrapper user, string[] args)
290298 {
291299 if ( settings != null )
292300 {
293- return $ "❌ { quality . Value } quality is disabled in settings";
301+ // return $"❌ {quality.Value} quality is not purchasable.";
302+ return "RICS.CC.pricecheck.errorquality" . Translate ( quality . Value . ToString ( ) ) ;
294303 }
295304 }
296305
@@ -302,12 +311,33 @@ public override string Execute(ChatMessageWrapper user, string[] args)
302311 material
303312 ) ;
304313
314+
305315 // Build a clear response message
306- string qualityStr = quality . HasValue ? quality . Value . ToString ( ) . ToLower ( ) : "normal" ;
307- string materialStr = material != null ? material . label : "default" ;
308316 string quantityStr = parsed . Quantity > 1 ? $ "{ parsed . Quantity } x " : "" ;
309317
310- return $ "💰 Price Check: { quantityStr } { storeItem . CustomName } ({ qualityStr } , { materialStr } ) = { price } { currencySymbol } ";
318+ string qualityStr = "" ;
319+ if ( quality . HasValue )
320+ {
321+ qualityStr = quality . Value . ToString ( ) . ToLower ( ) ;
322+ }
323+ else if ( thingDef . HasComp ( typeof ( CompQuality ) ) )
324+ {
325+ qualityStr = "normal" ; // default only when quality is supported
326+ }
327+
328+ // materialStr stays the same
329+ string materialStr = material != null ? material . label : "" ;
330+
331+ // Optional: trim extra spaces if both quality and material are present
332+ string details = string . Join ( " " , new [ ] { qualityStr , materialStr } . Where ( s => ! string . IsNullOrEmpty ( s ) ) ) ;
333+ string itemDisplay = $ "{ quantityStr } { storeItem . CustomName } ";
334+ if ( ! string . IsNullOrEmpty ( details ) )
335+ {
336+ itemDisplay += $ " { details } ";
337+ }
338+
339+ // return $"💰 Price Check: {quantityStr}{storeItem.CustomName} {qualityStr} {materialStr} = {price} {currencySymbol}";
340+ return "RICS.CC.pricecheck.success" . Translate ( quantityStr , storeItem . CustomName , qualityStr , materialStr , price , currencySymbol ) ;
311341 }
312342 catch ( Exception ex )
313343 {
@@ -325,7 +355,8 @@ public override string Execute(ChatMessageWrapper user, string[] args)
325355 {
326356 if ( args . Length == 0 )
327357 {
328- return "Usage: !surgery [implant] [left/right] [quantity] - Example: !surgery bionic arm left 1" ;
358+ //return "Usage: !surgery [implant/BiotechSurgery] [left/right] [quantity] https://tinyurl.com/SurgeryCmdWiki";
359+ return "RICS.CC.surgery.usage" . Translate ( ) ;
329360 }
330361 var cooldownManager = Current . Game . GetComponent < GlobalCooldownManager > ( ) ;
331362 if ( cooldownManager == null )
@@ -336,7 +367,7 @@ public override string Execute(ChatMessageWrapper user, string[] args)
336367 var globalSettings = CAPChatInteractiveMod . Instance . Settings . GlobalSettings ;
337368 if ( ! cooldownManager . CanPurchaseItem ( ) )
338369 {
339- return $ "Store purchase limit reached ( { globalSettings . MaxItemPurchases } per { globalSettings . EventCooldownDays } days)" ;
370+ return "RICS.CC.common.PurchaseLimit" . Translate ( globalSettings . MaxItemPurchases , globalSettings . EventCooldownDays ) ;
340371 }
341372 return SurgeryItemCommandHandler . HandleSurgery ( user , args ) ;
342373 }
0 commit comments