import * as _ from "lodash" ; import { IStorage } from "../istorage" ; import { ITime } from "../time" ; export class Farm { public coin : number ; public flags : any ; constructor ( storage ? ) { this . coin = 1000 ; this . flags = { } ; this . flags . Visit = 0 ; if ( storage ) { this . FromStorage ( storage ) ; } } public FromStorage ( storage ) { this . coin = parseInt ( storage . coin , 10 ) || this . coin ; _ . forIn ( storage . flags , ( value , key ) => { this . flags [ key ] = parseInt ( value as string , 10 ) ; } ) ; } public ToStorage ( ) { const storage = { } ; storage . coin = this . coin . toString ( ) ; storage . flags = this . flags ; return storage ; } public Update ( step ) { } public Found ( ) { return this . flags . Visit !== 0 ; } }