libram 0.7.7 → 0.7.9

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.
@@ -127,7 +127,7 @@ export function cycle() {
127
127
  return get("trainsetConfiguration").split(",");
128
128
  }
129
129
  export function nextConfigurable() {
130
- return clamp(get("trainsetPosition", 0) - get("lastTrainsetConfiguration", 0), 0, 40);
130
+ return clamp(get("lastTrainsetConfiguration") + 40 - get("trainsetPosition"), 0, 40);
131
131
  }
132
132
  export function canConfigure() {
133
133
  return installed() && !nextConfigurable();
@@ -162,11 +162,13 @@ export function setConfiguration(configuration) {
162
162
  if (!canConfigure())
163
163
  return false;
164
164
  visitUrl("campground.php?action=workshed");
165
- runChoice(1, `forceoption=0${configuration.map((station, index) => `&slot[${index}]=${stationToInt(station)}`)}`);
165
+ runChoice(1, `forceoption=0${configuration
166
+ .map((station, index) => `&slot[${index}]=${stationToInt(station)}`)
167
+ .join("")}`);
166
168
  visitUrl("main.php");
167
169
  const currentConfiguration = cycle();
168
170
  return configuration.every((station, index) => station === currentConfiguration[index]);
169
171
  }
170
172
  export function next() {
171
- return cycle()[get("lastTrainsetConfiguration") % 8];
173
+ return cycle()[get("trainsetPosition") % 8];
172
174
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libram",
3
- "version": "0.7.7",
3
+ "version": "0.7.9",
4
4
  "description": "JavaScript helper library for KoLmafia",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",