Something went wrong. Try again.
Your trusty automation assistant in TLE Community misadventures!
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198/** * Ore concentration weights per body type, transcribed from the Lacuna server * (`lib/Lacuna/DB/Result/Map/Body/Planet/PNN.pm`, `.../Planet/GasGiant/GNN.pm` and * `.../Asteroid/ANN.pm`). * * Keyed by the body's "image token" - the part of its `image` string before the * `-`, e.g. `"p27-3"` -> `"p27"`. Habitable planets are `p1`..`p40`, gas giants are * `pg1`..`pg5`, asteroids are `a1`..`a26` (with the `a21` debris field reported by * the server as the token `"debris1"`). * * On the server every ore a module does not explicitly declare falls through to a * base-class value of `1`, so any ore missing from a `RAW` entry below is treated * as `1` by `oreVector`. * * @namespace oreDistributions */
export const ORE_TYPES = [ 'rutile', 'chromite', 'chalcopyrite', 'galena', 'gold', 'uraninite', 'bauxite', 'goethite', 'halite', 'gypsum', 'trona', 'kerogen', 'methane', 'anthracite', 'sulfur', 'zircon', 'monazite', 'fluorite', 'beryl', 'magnetite',]
const ALL = (n) => ORE_TYPES.reduce((acc, ore) => ((acc[ore] = n), acc), {})
// prettier-ignoreconst RAW = { // --- habitable planets --- p1: { rutile: 500, chromite: 5000, chalcopyrite: 1000, galena: 1500, gold: 500, uraninite: 250, bauxite: 250, goethite: 500, halite: 250, gypsum: 250 }, p2: { gypsum: 1500, trona: 1500, sulfur: 2300, methane: 2700, magnetite: 1000, fluorite: 190, beryl: 310, zircon: 120, monazite: 130, gold: 250 }, p3: { uraninite: 3000, methane: 2900, kerogen: 1400, anthracite: 1700, zircon: 1000 }, p4: { chalcopyrite: 1000, uraninite: 1500, goethite: 1500, gypsum: 1500, sulfur: 1500, kerogen: 1500, magnetite: 1500 }, p5: { rutile: 1250, chalcopyrite: 250, galena: 2250, uraninite: 250, bauxite: 2250, goethite: 1250, halite: 250, gypsum: 1250, trona: 250, sulfur: 250, methane: 250, magnetite: 250 }, p6: { goethite: 1400, halite: 1000, gypsum: 1500, trona: 1300, sulfur: 1700, methane: 1200, magnetite: 1900 }, p7: { chalcopyrite: 2800, bauxite: 1700, goethite: 2400, gypsum: 2100, beryl: 1000 }, p8: { halite: 1300, gypsum: 1250, trona: 1250, kerogen: 3100, anthracite: 3100 }, p9: { rutile: 800, chromite: 900, chalcopyrite: 100, galena: 200, uraninite: 400, bauxite: 300, goethite: 200, halite: 500, gypsum: 600, trona: 700, sulfur: 1600, methane: 1700, kerogen: 1800, anthracite: 100, magnetite: 100 }, p10: { goethite: 1000, gypsum: 500, trona: 500, kerogen: 500, methane: 500, anthracite: 500, sulfur: 500, zircon: 250, monazite: 250, fluorite: 250, beryl: 250, magnetite: 5000 }, p11: { chromite: 1000, galena: 1000, uraninite: 1000, goethite: 1000, gypsum: 1000, kerogen: 1000, anthracite: 1000, zircon: 1000, fluorite: 1000, magnetite: 1000 }, p12: { rutile: 1000, chalcopyrite: 1000, gold: 1000, bauxite: 1000, halite: 1000, trona: 1000, methane: 1000, sulfur: 1000, monazite: 1000, beryl: 1000 }, p13: { rutile: 2100, chromite: 1400, chalcopyrite: 1300, galena: 2200, kerogen: 1500, anthracite: 1500 }, p14: { rutile: 100, chromite: 100, chalcopyrite: 100, galena: 100, uraninite: 100, bauxite: 100, goethite: 100, halite: 100, gypsum: 100, trona: 4000, sulfur: 2300, methane: 2700, magnetite: 100 }, p15: { rutile: 200, chromite: 300, chalcopyrite: 100, galena: 400, uraninite: 250, bauxite: 250, goethite: 4500, halite: 500, gypsum: 500, trona: 330, sulfur: 270, methane: 500, magnetite: 2000 }, p16: { rutile: 600, chromite: 400, galena: 200, uraninite: 800, goethite: 300, halite: 700, trona: 900, sulfur: 100, kerogen: 2700, anthracite: 3300 }, p17: { trona: 3900, methane: 1900, magnetite: 4200 }, p18: { chromite: 3200, uraninite: 2600, bauxite: 4200 }, p19: { rutile: 700, chromite: 100, chalcopyrite: 700, galena: 200, uraninite: 700, bauxite: 300, goethite: 700, halite: 400, gypsum: 700, trona: 500, sulfur: 700, methane: 600, kerogen: 1200, anthracite: 1100, magnetite: 1400 }, p20: { rutile: 2800, chromite: 1400, galena: 3100, bauxite: 900, magnetite: 1800 }, p21: { uraninite: 8000, monazite: 2000 }, p22: { galena: 5000, halite: 5000 }, p23: { methane: 3500, kerogen: 3500, anthracite: 3000 }, p24: { gypsum: 3300, beryl: 3300, zircon: 3400 }, p25: { rutile: 2000, chromite: 1000, chalcopyrite: 3000, galena: 4000, gold: 1000 }, p26: { gold: 9000, rutile: 100, chromite: 100, chalcopyrite: 100, galena: 100, goethite: 100, halite: 100, gypsum: 100, methane: 100, kerogen: 100, magnetite: 100 }, p27: { halite: 9500, galena: 100, goethite: 100, methane: 100, zircon: 100, monazite: 100 }, p28: { uraninite: 1500, bauxite: 1500, goethite: 2500, halite: 3500, gypsum: 2000 }, p29: { gypsum: 3000, sulfur: 5000, monazite: 2000 }, p30: { chalcopyrite: 4000, gold: 3000, bauxite: 3000 }, p31: { trona: 2500, sulfur: 1500, methane: 1000, kerogen: 3000, anthracite: 2000 }, p32: { rutile: 2000, chromite: 2000, bauxite: 2000, goethite: 2000, magnetite: 2000, beryl: 2000 }, p33: ALL(1000), p34: { magnetite: 2000, fluorite: 2000, beryl: 2000, zircon: 2000, monazite: 2000 }, p35: ALL(500), p36: { rutile: 100, chromite: 100, chalcopyrite: 100, bauxite: 100, goethite: 100, gypsum: 100, sulfur: 100, monazite: 100 }, p37: { uraninite: 2000, kerogen: 2000, anthracite: 2000, magnetite: 2000, monazite: 2000 }, p38: { sulfur: 7000, fluorite: 3000 }, p39: { gypsum: 500, sulfur: 2000, methane: 4000, kerogen: 1500, anthracite: 500, monazite: 1500 }, p40: { halite: 4000, trona: 2000, sulfur: 4000 }, // --- gas giants (excavators cannot land here; kept for completeness) --- pg1: { rutile: 14000, chromite: 4000, chalcopyrite: 2000 }, pg2: { galena: 14000, bauxite: 4000, goethite: 2000 }, pg3: { halite: 14000, gypsum: 4000, sulfur: 2000 }, pg4: { chalcopyrite: 2000, sulfur: 4000, magnetite: 14000 }, pg5: { goethite: 14000, sulfur: 4000, magnetite: 2000 }, // --- asteroids --- a1: { fluorite: 9000, beryl: 1000 }, a2: { beryl: 4000, zircon: 1000, chalcopyrite: 5000 }, a3: { zircon: 8000, monazite: 1000, uraninite: 1000 }, a4: { monazite: 9000, gold: 1000 }, a5: { fluorite: 1000, gold: 8500 }, a6: { galena: 5790, kerogen: 40 }, a7: { uraninite: 2377, fluorite: 3291, monazite: 1239 }, a8: { zircon: 7954 }, a9: { methane: 5500 }, a10: { anthracite: 6250, trona: 300, halite: 55, bauxite: 108 }, a11: { magnetite: 9980 }, a12: { rutile: 258, chromite: 320, chalcopyrite: 299, galena: 278, gold: 310, uraninite: 276, bauxite: 269, goethite: 292, halite: 301, gypsum: 311, trona: 293, kerogen: 284, methane: 285, anthracite: 289, sulfur: 324, zircon: 275, monazite: 319, fluorite: 307, beryl: 313, magnetite: 296 }, a13: { zircon: 2590, trona: 6574 }, a14: { gypsum: 2897, galena: 3038, goethite: 2895 }, a15: { chromite: 8931 }, a16: { fluorite: 1793, gold: 2132, bauxite: 1894, trona: 2018 }, a17: { beryl: 4233 }, a18: { trona: 3326, gypsum: 4120 }, a19: { sulfur: 2873, chalcopyrite: 3333 }, a20: { goethite: 6342 }, a21: { magnetite: 10 }, a22: { rutile: 800, chromite: 900, chalcopyrite: 700, galena: 800, gold: 100, bauxite: 900, goethite: 400, trona: 400, magnetite: 500, fluorite: 100, zircon: 200, monazite: 300 }, a23: { rutile: 1000, chromite: 1000, chalcopyrite: 1000, galena: 1000, fluorite: 1000, beryl: 1000, zircon: 1000 }, a24: { gypsum: 4000, sulfur: 3000, monazite: 1500 }, a25: { halite: 7900 }, a26: { uraninite: 1750, kerogen: 1500, anthracite: 1500, magnetite: 1500, monazite: 750 },}
/** * The image token for a body's `image` string, e.g. `"p27-3"` -> `"p27"`. The * server reports the `a21` debris field as `"debris1"`; normalise it to `"a21"`. * * @memberof oreDistributions * @param {string} image - a body's `image` field * @returns {string} the lower-cased token */export function imageToken(image) { if (!image) { return '' }
let token = String(image).split('-')[0].toLowerCase()
return token === 'debris1' ? 'a21' : token}
/** * Classify a body from its image token. * * @memberof oreDistributions * @param {string} token - an image token from {@link oreDistributions.imageToken} * @returns {'planet'|'gas-giant'|'asteroid'|'station'|'unknown'} */export function bodyKind(token) { if (!token) { return 'unknown' } else if (token === 'station') { return 'station' } else if (token.startsWith('pg')) { return 'gas-giant' } else if (token.startsWith('a')) { return 'asteroid' } else if (token.startsWith('p')) { return 'planet' } else { return 'unknown' }}
/** * The full 20-ore concentration vector for a body type. Ores not declared for the * type default to `1` (matching the server's base class); an unknown token yields * a flat vector of `1`s. * * @memberof oreDistributions * @param {string} token - an image token from {@link oreDistributions.imageToken} * @returns {Object.<string, number>} */export function oreVector(token) { let raw = RAW[token] || {}
return ORE_TYPES.reduce((acc, ore) => { acc[ore] = raw[ore] || 1 return acc }, {})}
/** * {@link oreDistributions.oreVector} normalised so the 20 values sum to 1. * * @memberof oreDistributions * @param {string} token - an image token from {@link oreDistributions.imageToken} * @returns {Object.<string, number>} */export function oreFractions(token) { let vector = oreVector(token) let total = ORE_TYPES.reduce((sum, ore) => sum + vector[ore], 0)
return ORE_TYPES.reduce((acc, ore) => { acc[ore] = vector[ore] / total return acc }, {})}
export default { ORE_TYPES, imageToken, bodyKind, oreVector, oreFractions }