libram 0.7.6 → 0.7.7

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.
@@ -0,0 +1,99 @@
1
+ import { Effect } from "kolmafia";
2
+ import { Tuple } from "../../utils";
3
+ export declare const item: import("kolmafia").Item;
4
+ export declare function installed(): boolean;
5
+ export declare function have(): boolean;
6
+ export declare enum Station {
7
+ /**
8
+ * Unknown station
9
+ */
10
+ UNKNOWN = "",
11
+ /**
12
+ * Empty station
13
+ */
14
+ EMPTY = "empty",
15
+ /**
16
+ * Gain 800 meat
17
+ */
18
+ GAIN_MEAT = "meat_mine",
19
+ /**
20
+ * Effect: Regenerate MP
21
+ */
22
+ TOWER_FIZZY = "tower_fizzy",
23
+ /**
24
+ * Gain mus, mys, mox stats
25
+ */
26
+ VIEWING_PLATFORM = "viewing_platform",
27
+ /**
28
+ * Effect: Hot resist, cold damage
29
+ */
30
+ TOWER_FROZEN = "tower_frozen",
31
+ /**
32
+ * Effect: Stench resist, spooky damage
33
+ */
34
+ SPOOKY_GRAVEYARD = "spooky_graveyard",
35
+ /**
36
+ * Get smut bridge part, or stats
37
+ */
38
+ LOGGING_MILL = "logging_mill",
39
+ /**
40
+ * Get some candy
41
+ */
42
+ CANDY_FACTORY = "candy_factory",
43
+ /**
44
+ * Double strength of next station
45
+ */
46
+ COAL_HOPPER = "coal_hopper",
47
+ /**
48
+ * Effect: Cold resist, stench damage
49
+ */
50
+ TOWER_SEWAGE = "tower_sewage",
51
+ /**
52
+ * Effect: Spooky resist, sleaze damage
53
+ */
54
+ OIL_REFINERY = "oil_refinery",
55
+ /**
56
+ * Effect: Sleaze resist, hot damage
57
+ */
58
+ OIL_BRIDGE = "oil_bridge",
59
+ /**
60
+ * Effect: Increased Monster Level
61
+ */
62
+ WATER_BRIDGE = "water_bridge",
63
+ /**
64
+ * Get moxie stats
65
+ */
66
+ GROIN_SILO = "groin_silo",
67
+ /**
68
+ * Get random booze
69
+ */
70
+ GRAIN_SILO = "grain_silo",
71
+ /**
72
+ * Get mys stats
73
+ */
74
+ BRAIN_SILO = "brain_silo",
75
+ /**
76
+ * Get muscle stats
77
+ */
78
+ BRAWN_SILO = "brawn_silo",
79
+ /**
80
+ * Effect: 50% food drop
81
+ */
82
+ PRAWN_SILO = "prawn_silo",
83
+ /**
84
+ * Dupe last food dropped, or gain random food
85
+ */
86
+ TRACKSIDE_DINER = "trackside_diner",
87
+ /**
88
+ * Drop random ore, or trapper ore if known
89
+ */
90
+ ORE_HOPPER = "ore_hopper"
91
+ }
92
+ export declare function effect(station: Station): Effect | null;
93
+ export declare function doubledEffect(station: Station): Effect | null;
94
+ export declare type Cycle = Tuple<Station, 8>;
95
+ export declare function cycle(): Cycle;
96
+ export declare function nextConfigurable(): number;
97
+ export declare function canConfigure(): boolean;
98
+ export declare function setConfiguration(configuration: Cycle): boolean;
99
+ export declare function next(): Station;
@@ -0,0 +1,172 @@
1
+ import { Effect, getWorkshed, runChoice, visitUrl } from "kolmafia";
2
+ import { have as have_ } from "../../lib";
3
+ import { get } from "../../property";
4
+ import { $item } from "../../template-string";
5
+ import { clamp } from "../../utils";
6
+ export const item = $item `model train set`;
7
+ export function installed() {
8
+ return getWorkshed() === item;
9
+ }
10
+ export function have() {
11
+ return installed() || have_(item);
12
+ }
13
+ export var Station;
14
+ (function (Station) {
15
+ /**
16
+ * Unknown station
17
+ */
18
+ Station["UNKNOWN"] = "";
19
+ /**
20
+ * Empty station
21
+ */
22
+ Station["EMPTY"] = "empty";
23
+ /**
24
+ * Gain 800 meat
25
+ */
26
+ Station["GAIN_MEAT"] = "meat_mine";
27
+ /**
28
+ * Effect: Regenerate MP
29
+ */
30
+ Station["TOWER_FIZZY"] = "tower_fizzy";
31
+ /**
32
+ * Gain mus, mys, mox stats
33
+ */
34
+ Station["VIEWING_PLATFORM"] = "viewing_platform";
35
+ /**
36
+ * Effect: Hot resist, cold damage
37
+ */
38
+ Station["TOWER_FROZEN"] = "tower_frozen";
39
+ /**
40
+ * Effect: Stench resist, spooky damage
41
+ */
42
+ Station["SPOOKY_GRAVEYARD"] = "spooky_graveyard";
43
+ /**
44
+ * Get smut bridge part, or stats
45
+ */
46
+ Station["LOGGING_MILL"] = "logging_mill";
47
+ /**
48
+ * Get some candy
49
+ */
50
+ Station["CANDY_FACTORY"] = "candy_factory";
51
+ /**
52
+ * Double strength of next station
53
+ */
54
+ Station["COAL_HOPPER"] = "coal_hopper";
55
+ /**
56
+ * Effect: Cold resist, stench damage
57
+ */
58
+ Station["TOWER_SEWAGE"] = "tower_sewage";
59
+ /**
60
+ * Effect: Spooky resist, sleaze damage
61
+ */
62
+ Station["OIL_REFINERY"] = "oil_refinery";
63
+ /**
64
+ * Effect: Sleaze resist, hot damage
65
+ */
66
+ Station["OIL_BRIDGE"] = "oil_bridge";
67
+ /**
68
+ * Effect: Increased Monster Level
69
+ */
70
+ Station["WATER_BRIDGE"] = "water_bridge";
71
+ /**
72
+ * Get moxie stats
73
+ */
74
+ Station["GROIN_SILO"] = "groin_silo";
75
+ /**
76
+ * Get random booze
77
+ */
78
+ Station["GRAIN_SILO"] = "grain_silo";
79
+ /**
80
+ * Get mys stats
81
+ */
82
+ Station["BRAIN_SILO"] = "brain_silo";
83
+ /**
84
+ * Get muscle stats
85
+ */
86
+ Station["BRAWN_SILO"] = "brawn_silo";
87
+ /**
88
+ * Effect: 50% food drop
89
+ */
90
+ Station["PRAWN_SILO"] = "prawn_silo";
91
+ /**
92
+ * Dupe last food dropped, or gain random food
93
+ */
94
+ Station["TRACKSIDE_DINER"] = "trackside_diner";
95
+ /**
96
+ * Drop random ore, or trapper ore if known
97
+ */
98
+ Station["ORE_HOPPER"] = "ore_hopper";
99
+ })(Station || (Station = {}));
100
+ const trainsetEffects = new Map([
101
+ [Station.TOWER_FIZZY, Effect.get("Carbonated")],
102
+ [Station.TOWER_FROZEN, Effect.get("Frozen")],
103
+ [Station.SPOOKY_GRAVEYARD, Effect.get("Shivering Spine")],
104
+ [Station.TOWER_SEWAGE, Effect.get("Hot Soupy Garbage")],
105
+ [Station.OIL_BRIDGE, Effect.get("Burningly Oiled")],
106
+ [Station.OIL_REFINERY, Effect.get("Spookily Greasy")],
107
+ [Station.WATER_BRIDGE, Effect.get("Troubled Waters")],
108
+ [Station.PRAWN_SILO, Effect.get("Craving Prawns")],
109
+ ]);
110
+ const trainsetEffectsDoubled = new Map([
111
+ [Station.TOWER_FIZZY, Effect.get("Double Carbonated")],
112
+ [Station.TOWER_FROZEN, Effect.get("Double Frozen")],
113
+ [Station.SPOOKY_GRAVEYARD, Effect.get("Doubly Shivering Spine")],
114
+ [Station.TOWER_SEWAGE, Effect.get("Double Hot Soupy Garbage")],
115
+ [Station.OIL_BRIDGE, Effect.get("Doubly Burningly Oiled")],
116
+ [Station.OIL_REFINERY, Effect.get("Doubly Spookily Greasy")],
117
+ [Station.WATER_BRIDGE, Effect.get("Doubly Troubled Waters")],
118
+ [Station.PRAWN_SILO, Effect.get("Doubly Craving Prawns")],
119
+ ]);
120
+ export function effect(station) {
121
+ return trainsetEffects.get(station) ?? null;
122
+ }
123
+ export function doubledEffect(station) {
124
+ return trainsetEffectsDoubled.get(station) ?? null;
125
+ }
126
+ export function cycle() {
127
+ return get("trainsetConfiguration").split(",");
128
+ }
129
+ export function nextConfigurable() {
130
+ return clamp(get("trainsetPosition", 0) - get("lastTrainsetConfiguration", 0), 0, 40);
131
+ }
132
+ export function canConfigure() {
133
+ return installed() && !nextConfigurable();
134
+ }
135
+ const pieces = [
136
+ Station.EMPTY,
137
+ Station.GAIN_MEAT,
138
+ Station.TOWER_FIZZY,
139
+ Station.VIEWING_PLATFORM,
140
+ Station.TOWER_FROZEN,
141
+ Station.SPOOKY_GRAVEYARD,
142
+ Station.LOGGING_MILL,
143
+ Station.CANDY_FACTORY,
144
+ Station.COAL_HOPPER,
145
+ Station.TOWER_SEWAGE,
146
+ Station.UNKNOWN,
147
+ Station.OIL_REFINERY,
148
+ Station.OIL_BRIDGE,
149
+ Station.WATER_BRIDGE,
150
+ Station.GROIN_SILO,
151
+ Station.GRAIN_SILO,
152
+ Station.BRAIN_SILO,
153
+ Station.BRAWN_SILO,
154
+ Station.PRAWN_SILO,
155
+ Station.TRACKSIDE_DINER,
156
+ Station.ORE_HOPPER,
157
+ ];
158
+ function stationToInt(station) {
159
+ return pieces.indexOf(station);
160
+ }
161
+ export function setConfiguration(configuration) {
162
+ if (!canConfigure())
163
+ return false;
164
+ visitUrl("campground.php?action=workshed");
165
+ runChoice(1, `forceoption=0${configuration.map((station, index) => `&slot[${index}]=${stationToInt(station)}`)}`);
166
+ visitUrl("main.php");
167
+ const currentConfiguration = cycle();
168
+ return configuration.every((station, index) => station === currentConfiguration[index]);
169
+ }
170
+ export function next() {
171
+ return cycle()[get("lastTrainsetConfiguration") % 8];
172
+ }
@@ -35,6 +35,7 @@ import * as AutumnAton from "./2022/AutumnAton";
35
35
  import * as CombatLoversLocket from "./2022/CombatLoversLocket";
36
36
  import * as GreyGoose from "./2022/GreyGoose";
37
37
  import * as JuneCleaver from "./2022/JuneCleaver";
38
- export { AutumnAton, AsdonMartin, Bandersnatch, BarrelShrine, BeachComb, Cartography, ChateauMantegna, CombatLoversLocket, CrimboShrub, CrownOfThrones, CrystalBall, DaylightShavings, Dinseylandfill, DNALab, FloristFriar, GreyGoose, Guzzlr, JuneCleaver, Latte, MayoClinic, MummingTrunk, ObtuseAngel, Pantogram, RainDoh, ReagnimatedGnome, RetroCape, Robortender, Snapper, SongBoom, SourceTerminal, Spacegate, SpookyPutty, Stickers, StompingBoots, TunnelOfLove, WinterGarden, Witchess, };
38
+ import * as TrainSet from "./2022/TrainSet";
39
+ export { AutumnAton, AsdonMartin, Bandersnatch, BarrelShrine, BeachComb, Cartography, ChateauMantegna, CombatLoversLocket, CrimboShrub, CrownOfThrones, CrystalBall, DaylightShavings, Dinseylandfill, DNALab, FloristFriar, GreyGoose, Guzzlr, JuneCleaver, Latte, MayoClinic, MummingTrunk, ObtuseAngel, Pantogram, RainDoh, ReagnimatedGnome, RetroCape, Robortender, Snapper, SongBoom, SourceTerminal, Spacegate, SpookyPutty, Stickers, StompingBoots, TrainSet, TunnelOfLove, WinterGarden, Witchess, };
39
40
  export * from "./putty-likes";
40
41
  export * from "./LibramSummon";
@@ -35,6 +35,7 @@ import * as AutumnAton from "./2022/AutumnAton";
35
35
  import * as CombatLoversLocket from "./2022/CombatLoversLocket";
36
36
  import * as GreyGoose from "./2022/GreyGoose";
37
37
  import * as JuneCleaver from "./2022/JuneCleaver";
38
- export { AutumnAton, AsdonMartin, Bandersnatch, BarrelShrine, BeachComb, Cartography, ChateauMantegna, CombatLoversLocket, CrimboShrub, CrownOfThrones, CrystalBall, DaylightShavings, Dinseylandfill, DNALab, FloristFriar, GreyGoose, Guzzlr, JuneCleaver, Latte, MayoClinic, MummingTrunk, ObtuseAngel, Pantogram, RainDoh, ReagnimatedGnome, RetroCape, Robortender, Snapper, SongBoom, SourceTerminal, Spacegate, SpookyPutty, Stickers, StompingBoots, TunnelOfLove, WinterGarden, Witchess, };
38
+ import * as TrainSet from "./2022/TrainSet";
39
+ export { AutumnAton, AsdonMartin, Bandersnatch, BarrelShrine, BeachComb, Cartography, ChateauMantegna, CombatLoversLocket, CrimboShrub, CrownOfThrones, CrystalBall, DaylightShavings, Dinseylandfill, DNALab, FloristFriar, GreyGoose, Guzzlr, JuneCleaver, Latte, MayoClinic, MummingTrunk, ObtuseAngel, Pantogram, RainDoh, ReagnimatedGnome, RetroCape, Robortender, Snapper, SongBoom, SourceTerminal, Spacegate, SpookyPutty, Stickers, StompingBoots, TrainSet, TunnelOfLove, WinterGarden, Witchess, };
39
40
  export * from "./putty-likes";
40
41
  export * from "./LibramSummon";
package/dist/utils.d.ts CHANGED
@@ -54,3 +54,6 @@ export declare function createStringUnionTypeGuardFunction<T extends string>(arr
54
54
  * @returns List of tokens
55
55
  */
56
56
  export declare function splitByCommasWithEscapes(str: string): string[];
57
+ export declare type Tuple<T, N extends number> = N extends N ? number extends N ? T[] : _tupleOf<T, N, []> : never;
58
+ declare type _tupleOf<T, N extends number, R extends unknown[]> = R["length"] extends N ? R : _tupleOf<T, N, [T, ...R]>;
59
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libram",
3
- "version": "0.7.6",
3
+ "version": "0.7.7",
4
4
  "description": "JavaScript helper library for KoLmafia",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -45,11 +45,11 @@
45
45
  "eslint-import-resolver-typescript": "^2.5.0",
46
46
  "eslint-plugin-import": "^2.25.4",
47
47
  "eslint-plugin-jest": "^25.2.3",
48
- "eslint-plugin-libram": "^0.2.18",
48
+ "eslint-plugin-libram": "^0.2.25",
49
49
  "husky": "^4.3.6",
50
50
  "java-parser": "^1.4.0",
51
51
  "jest": "^27.1.0",
52
- "kolmafia": "^5.26781.0",
52
+ "kolmafia": "^5.27075.0",
53
53
  "lint-staged": ">=10",
54
54
  "node-fetch": "^2.6.1",
55
55
  "prettier": "^2.1.2",