import { Item } from "../../items/types/Item" ; import { Set , SET_ITEMS , SetItem , SETS } from "../../../game-data" ; import { SETS_ORDER } from "./setsOrder" ; export function groupBySet < T extends Item | SetItem > ( items ) { const bySet = new Map < Set , T [ ] > ( ) ; for ( const section of SETS_ORDER ) { for ( const { set } of section ) { bySet . set ( SETS [ set ] , [ ] ) ; } } for ( const item of items ) { const setItem = "set" in item ? item : SET_ITEMS [ item . unique ! ] ; bySet . get ( SETS [ setItem . set ] ) ! . push ( item ) ; } return bySet ; }