import type {Roomtype} from '../../framework/sdk/contracts/roomtype.ts'; /** Source: 01_SubGame_modify.js. Options are presentation state, not a rule-array encoder. */ export class TemplateRoomRules { readonly labels=['10局(房卡X1)','20局(房卡X2)','房主扣卡','每人扣卡'] as const; private selected:[number,number]=[0,0]; get selection():readonly number[]{return [...this.selected];} open(previous:unknown=null):void{ if(previous===null){this.selected=[0,0];return;} if(!Array.isArray(previous)||!Number.isInteger(previous[0])||!Number.isInteger(previous[1]))throw Error('Invalid template saved roomtype'); this.selected=[previous[0]-1,previous[1]-1]; } select(group:0|1,index:number):void{ if(!Number.isInteger(index)||index<0||index>1)throw Error('Invalid template option'); this.selected[group]=index; } build():unknown[]{return [1,4,1,2,2,[1,1,[1,2000,10],null,null,1],[1,0,5]];} seatCount(roomtype: Roomtype):number{ if(!Array.isArray(roomtype))throw Error('Template roomtype must be an array'); // Desk.Create uses Game_Config.Max.PlayerCnt because the template defines no getMaxPlayerCount hook. return 10; } }