@@ -29,6 +29,7 @@ import type {
2929 questType ,
3030 specialOrderType
3131} from 'types/savefile' ;
32+ import type { fullPlayerDataType , museumCollectionType } from 'types/displayDataTypes' ;
3233
3334//Gets the info from the farm hands as an array of the same type
3435const GetFarmHands = ( locations : gameLocationType [ ] ) : playerType [ ] => {
@@ -65,13 +66,16 @@ type getParsedUserDataType = Omit<getDetailedInfoType, 'playerData'> & {
6566
6667//Calls the parser and creates an array of players depending on wether it is a single player or multiple
6768const GetDetailedInfo = ( { playerData , collectionStatus, specialRequests, availableSpecialRequests} : getDetailedInfoType ) => {
68- let fullPlayerData : any = [ ]
69+ let fullPlayerData : fullPlayerDataType [ ] = [ ]
6970 if ( Array . isArray ( playerData ) ) {
7071 playerData . forEach ( p => {
71- let playerFull = {
72+ let playerFull : fullPlayerDataType
73+ = {
7274 //...p,
7375 ...parseData ( { playerData : p , collectionStatus, specialRequests, availableSpecialRequests} )
7476 }
77+
78+ if ( playerFull !== null )
7579 fullPlayerData . push ( playerFull )
7680 } )
7781 }
@@ -80,12 +84,11 @@ const GetDetailedInfo = ({playerData , collectionStatus, specialRequests, availa
8084}
8185
8286//Creates an object per player with the cleanup playerData.from the file
83- const parseData = ( { playerData, collectionStatus, specialRequests, availableSpecialRequests} : getParsedUserDataType ) => {
84- if ( ! playerData ) return null ;
87+ const parseData = ( { playerData, collectionStatus, specialRequests, availableSpecialRequests} : getParsedUserDataType ) : fullPlayerDataType => {
8588 //Not finished
8689 console . log ( "Parsing data for:" , playerData )
87- let fullPlayerData = {
88- playerName : playerData . name ,
90+ let fullPlayerData : fullPlayerDataType = {
91+ playerName : playerData . name || "Unknown" ,
8992 farmName : playerData . farmName , //TODO: Remove and make global if even needed
9093 experience : GetXpInfo ( playerData . experiencePoints . int ) , //DONE
9194 moneyEarned : playerData . totalMoneyEarned || 0 , //DONE
@@ -123,7 +126,7 @@ const GetXpInfo = (xp: number[]): experienceType[] => {
123126 levelInfo : Levels . find ( ( level ) => level . val >= _skill ) || { id : 10 , val : 15000 }
124127 } )
125128 }
126- } )
129+ } )
127130 return skillLevelData
128131}
129132/* End of XP Data */
@@ -355,7 +358,7 @@ const GetMonsterQuests = (allMonsters: itemsType[], slimesKilled: number): forma
355358 } )
356359 return ( mData )
357360}
358- const GetMCollection = ( archeology : itemsType [ ] , geology : itemsType [ ] , currentCollection : itemsType [ ] ) => {
361+ const GetMCollection = ( archeology : itemsType [ ] , geology : itemsType [ ] , currentCollection : itemsType [ ] ) : museumCollectionType => {
359362
360363 if ( currentCollection === undefined || currentCollection . length === 0 ) return { artifacts : [ ] , minerals : [ ] } ;
361364
0 commit comments