Подскажите, в чем проблема?
//handlers.js
import { updateGold } from './functions.js';
export function handleKeyPress (term, state) {
return function handleKeyPressInfo(name, matches, data){
const key = String.fromCharCode(data.code);
if (key === 'g' || key === 'G'){
state.gold++
updateGold(term, state);
}
for (let i = 0; i < state.producers.length; i++){
if(String.fromCharCode(data.code) === '${state.producers[i].id}'){
state.gold = state.gold - state.producers[i].cost
state.producers[i].cost = state.producers[i].cost * state.producers[i].growthRate
state.producers[i].count = state.producers[i].count++
updateGold(term, state)
}
}
}
}
//constants.js
import terminalKit from 'terminal-kit'
export const term = terminalKit.terminal
export const config = {
gold : 0,
producers: [
{ id: 1, title: 'Miner', cost: 10, growthRate: 1.13, baseProduction: 0.1, count: 0 },
{ id: 2, title: 'Adventurer', cost: 100, growthRate: 1.17, baseProduction: 1, count: 0 },
{ id: 3, title: 'Professional', cost: 1200, growthRate: 1.14, baseProduction: 9, count: 0 }
]
}