import { toTitleCase } from 'common/string'; import { Fragment } from 'inferno'; import { useBackend } from '../backend'; import { Box, Button, Dropdown, Section, LabeledList, AnimatedNumber } from '../components'; import { Window } from '../layouts'; import { MiningUser } from './common/Mining'; export const MiningOreProcessingConsole = (props, context) => { const { act, data } = useBackend(context); const { unclaimedPoints, ores, showAllOres, power, speed } = data; return ( in order to claim points. } />
}> act('claim')}> Claim }>
); }; // ORDER IS IMPORTANT HERE. const processingOptions = ['Not Processing', 'Smelting', 'Compressing', 'Alloying']; // Higher in the list == closer to top // This is just kind of an arbitrary list to sort by because the machine has no predictable ore order in it's list // and alphabetizing them doesn't really make sense const oreOrder = [ 'verdantium', 'mhydrogen', 'diamond', 'platinum', 'uranium', 'gold', 'silver', 'rutile', 'phoron', 'marble', 'lead', 'sand', 'carbon', 'hematite', ]; const oreSorter = (a, b) => { if (oreOrder.indexOf(a.ore) === -1) { return a.ore - b.ore; } if (oreOrder.indexOf(b.ore) === -1) { return a.ore - b.ore; } return oreOrder.indexOf(b.ore) - oreOrder.indexOf(a.ore); }; const MOPCOres = (props, context) => { const { act, data } = useBackend(context); const { ores, showAllOres, power } = data; return (
act('showAllOres')}> {showAllOres ? 'All Ores' : 'Ores in Machine'} }> {(ores.length && ores.sort(oreSorter).map((ore) => ( act('toggleSmelting', { ore: ore.ore, set: processingOptions.indexOf(val), }) } /> }> ))) || ( No ores in machine. )}
); };