import { SaveFileReader } from "../../save-file/SaveFileReader" ; import { parseItemList } from "../../items/parsing/parseItemList" ; import { Character } from "../types" ; export function parseCorpses ( reader , character ) { const header = reader . readString ( 2 ) ; if ( header !== "JM" ) { throw new Error ( `Unexpected header ${ header } for corpse data` ) ; } const nbCorpses = reader . readInt16LE ( ) ; character . hasCorpse = nbCorpses > 0 ; for ( let i = 0 ; i < nbCorpses ; i ++ ) { reader . read ( 12 ) ; const items = parseItemList ( reader , character ) ; for ( const item of items ) { item . corpse = true ; } character . items . push ( ... items ) ; } }