feat: add factory sample machines and robot pricing conversations

This commit is contained in:
2026-10-28 12:53:07 +03:30
parent d0da416923
commit 55d4123fe5
71 changed files with 8179 additions and 3978 deletions
+31
View File
@@ -0,0 +1,31 @@
import { SHOWROOM_CATALOG } from '../constants/showroomCatalog.js';
/** Looks up a display model by its stable identifier.
* @param {string} id - Model identifier.
* @returns {object|null} Catalog model, or null for unknown identifiers.
*/
export function showroomModelById(id) {
return SHOWROOM_CATALOG.find((model) => model.id === id) ?? null;
}
/** Formats a machine purchase price in rial without converting it to game money.
* @param {number} price - Full machine price in rial.
* @returns {string} Persian rial price.
*/
export function formatRial(price) {
return `${price.toLocaleString('fa-IR')} ریال`;
}
/** Builds the robot's deterministic answer from the shared showroom catalog.
* @param {{modelId:string,topic:'price'|'features'}} question - Requested model and topic.
* @returns {string|null} Robot answer; unknown questions are rejected.
*/
export function showroomAnswer({ modelId, topic }) {
const model = showroomModelById(modelId);
if (!model) return null;
if (topic === 'price')
return `قیمت ${model.name}، ${formatRial(model.priceNumeric)} است. این قیمت خود دستگاه به ریال است و از بودجهٔ بازی کم نمی‌شود.`;
if (topic === 'features')
return `${model.name}: ${model.description} امکانات: ${model.highlights.join('، ')}.`;
return null;
}