ogamejs 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -373,6 +373,13 @@ Ogame.Trader.parseRate('3:2:1', 'deut');
373
373
  // → { rateMetal: 3, rateCrystal: 2, rateDeut: 1 }
374
374
  ```
375
375
 
376
+ The reference term always comes back as `1`, so a rate and any multiple of it are the same rate, whichever resource you sell:
377
+
378
+ ```javascript
379
+ Ogame.Trader.parseRate('4:3:2', 'deut');
380
+ // → { rateMetal: 2, rateCrystal: 1.5, rateDeut: 1 } — same as '2:1.5:1'
381
+ ```
382
+
376
383
  ### `Ogame.i18n`
377
384
 
378
385
  Every model entry carries `names: { en, fr }`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ogamejs",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "OGame formulas as a dependency-free ESM library: building and research costs, production, build times, fleet debris and marketplace rates.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -20,9 +20,14 @@ function extract(rate, type) {
20
20
  rateDeut: deut / crystal,
21
21
  };
22
22
  } else if (type === 'deut') {
23
+ // Like the two branches above: express the other terms in units of the one
24
+ // being sold, so its own term becomes 1. Reading `metal` and `crystal` raw
25
+ // here only happened to work because rates are usually written against 1
26
+ // deuterium — `4:3:2` is the same rate as `2:1.5:1`, but used to pay twice
27
+ // as much for the very same deuterium.
23
28
  res = {
24
- rateMetal: metal,
25
- rateCrystal: crystal,
29
+ rateMetal: metal / deut,
30
+ rateCrystal: crystal / deut,
26
31
  rateDeut: 1,
27
32
  };
28
33
  } else {
@@ -1 +1 @@
1
- {"version":3,"file":"parseRate.d.ts","sourceRoot":"","sources":["../../src/trades/parseRate.js"],"names":[],"mappings":"AAkCA,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,IAAI,SAAY,EAAE,IAAI,SAAS,MAchE"}
1
+ {"version":3,"file":"parseRate.d.ts","sourceRoot":"","sources":["../../src/trades/parseRate.js"],"names":[],"mappings":"AAuCA,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,IAAI,SAAY,EAAE,IAAI,SAAS,MAchE"}