import {createHash} from 'node:crypto'; import {HOUSES} from './house-selection.mjs'; import {defaultItemDesign} from '../control-panel/public/item-design-model.mjs'; import {validateKitset} from '../control-panel/public/kitset-model.mjs'; // A fixed House baseline uses the same item generator as organisation kits. // It creates a definition, never inventory, ownership, payment or quest progress. export function starterIdentity(value){const h=createHash('sha256').update('starter-kit:'+value).digest('hex');return h.slice(0,8)+'-'+h.slice(8,12)+'-5'+h.slice(13,16)+'-8'+h.slice(17,20)+'-'+h.slice(20,32);} const palette={atreides:'#3D7654',harkonnen:'#8D323B',corrino:'#735287',ordos:'#487C7A',fremen:'#58769C'}; export function starterKitSnapshot(faction){ const house=HOUSES.find(h=>h.id===faction);if(!house)throw TypeError('Choose a current House for the starter kit.'); const name=house.name+' T0 Stillsuit',slots=['helmet','chestplate','leggings','boots']; const items=slots.map(slot=>{ const design=defaultItemDesign('dr_s1_common_mk0_'+slot);design.name=house.name+' Starter '+slot[0].toUpperCase()+slot.slice(1);design.trim={pattern:'dune',material:'iron'}; design.lore=[{text:'Your first shelter against the desert.',color:palette[faction],bold:false,italic:true}]; return{id:starterIdentity(faction+':'+slot),quantity:1,design}; }); items.push({id:starterIdentity(faction+':shovel'),quantity:1,design:defaultItemDesign('dr_s1_spice_shovel_mk1')}); return {version:2,name,quality:'common',commerceKind:'faction_sale',color:palette[faction],lore:['A House-issued starter stillsuit.'],kitset:validateKitset({version:1,name,owner:{kind:'office',id:'starter_'+faction},items})}; } export function validateNativeStarterSnapshot(input){ const kit=validateKitset(input.kitset),required=['dr_s1_common_mk0_helmet','dr_s1_common_mk0_chestplate','dr_s1_common_mk0_leggings','dr_s1_common_mk0_boots','dr_s1_spice_shovel_mk1']; if(input.version!==2||input.quality!=='common'||kit.name!==input.name||kit.owner.kind!=='office'||!HOUSES.some(h=>kit.owner.id==='starter_'+h.id)||kit.items.length!==required.length||kit.items.some(i=>i.quantity!==1)||required.some(id=>kit.items.filter(i=>i.design.templateId===id).length!==1))throw TypeError('Use the complete House T0 starter baseline.'); return kit; }