libram 0.10.1 → 0.10.3

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,203 @@
1
+ import { Effect, Item } from "kolmafia";
2
+ import { Tuple } from "../../utils.js";
3
+ /**
4
+ * @returns Whether you `have` the Leprecondo
5
+ */
6
+ export declare function have(): boolean;
7
+ export declare const NEEDS: readonly ["exercise", "mental stimulation", "dumb entertainment", "food", "booze", "sleep"];
8
+ export type Need = (typeof NEEDS)[number];
9
+ export declare const FURNITURE_PIECES: readonly ["empty", "buckets of concrete", "thrift store oil painting", "boxes of old comic books", "second-hand hot plate", "beer cooler", "free mattress", "gigantic chess set", "UltraDance karaoke machine", "cupcake treadmill", "beer pong table", "padded weight bench", "internet-connected laptop", "sous vide laboratory", "programmable blender", "sensory deprivation tank", "fruit-smashing robot", "ManCave™ sports bar set", "couch and flatscreen", "kegerator", "fine upholstered dining set", "whiskeybed", "high-end home workout system", "complete classics library", "ultimate retro game console", "Omnipot", "fully-stocked wet bar", "four-poster bed"];
10
+ export type FurniturePiece = (typeof FURNITURE_PIECES)[number];
11
+ type Result = Item | Item[] | {
12
+ effect: Effect;
13
+ duration: number;
14
+ };
15
+ type FurnitureStat = Partial<Record<Need, Result>>;
16
+ export declare const Furniture: Readonly<{
17
+ readonly empty: {};
18
+ readonly "beer cooler": {
19
+ readonly booze: Item[];
20
+ };
21
+ readonly "beer pong table": {
22
+ readonly booze: Item[];
23
+ readonly exercise: Item;
24
+ };
25
+ readonly "boxes of old comic books": {
26
+ readonly "dumb entertainment": {
27
+ readonly effect: Effect;
28
+ readonly duration: 10;
29
+ };
30
+ };
31
+ readonly "buckets of concrete": {
32
+ readonly exercise: {
33
+ readonly effect: Effect;
34
+ readonly duration: 10;
35
+ };
36
+ };
37
+ readonly "complete classics library": {
38
+ readonly "mental stimulation": Item;
39
+ };
40
+ readonly "couch and flatscreen": {
41
+ readonly "dumb entertainment": {
42
+ readonly effect: Effect;
43
+ readonly duration: 10;
44
+ };
45
+ readonly sleep: {
46
+ readonly effect: Effect;
47
+ readonly duration: 10;
48
+ };
49
+ };
50
+ readonly "cupcake treadmill": {
51
+ readonly exercise: {
52
+ readonly effect: Effect;
53
+ readonly duration: 10;
54
+ };
55
+ readonly food: Item;
56
+ };
57
+ readonly "fine upholstered dining set": {
58
+ readonly food: Item[];
59
+ readonly sleep: {
60
+ readonly effect: Effect;
61
+ readonly duration: 10;
62
+ };
63
+ };
64
+ readonly "four-poster bed": {
65
+ readonly sleep: {
66
+ readonly effect: Effect;
67
+ readonly duration: 10;
68
+ };
69
+ };
70
+ readonly "free mattress": {
71
+ readonly sleep: {
72
+ readonly effect: Effect;
73
+ readonly duration: 10;
74
+ };
75
+ };
76
+ readonly "fruit-smashing robot": {
77
+ readonly "dumb entertainment": {
78
+ readonly effect: Effect;
79
+ readonly duration: 10;
80
+ };
81
+ readonly food: Item[];
82
+ };
83
+ readonly "fully-stocked wet bar": {
84
+ readonly booze: Item[];
85
+ };
86
+ readonly "gigantic chess set": {
87
+ readonly exercise: {
88
+ readonly effect: Effect;
89
+ readonly duration: 10;
90
+ };
91
+ readonly "mental stimulation": {
92
+ readonly effect: Effect;
93
+ readonly duration: 10;
94
+ };
95
+ };
96
+ readonly "high-end home workout system": {
97
+ readonly exercise: Item;
98
+ };
99
+ readonly "internet-connected laptop": {
100
+ readonly "dumb entertainment": {
101
+ readonly effect: Effect;
102
+ readonly duration: 10;
103
+ };
104
+ readonly "mental stimulation": Item;
105
+ };
106
+ readonly kegerator: {
107
+ readonly booze: Item;
108
+ readonly food: Item[];
109
+ };
110
+ readonly "ManCave\u2122 sports bar set": {
111
+ readonly booze: Item[];
112
+ readonly "dumb entertainment": Item;
113
+ };
114
+ readonly Omnipot: {
115
+ readonly food: Item;
116
+ };
117
+ readonly "padded weight bench": {
118
+ readonly exercise: {
119
+ readonly effect: Effect;
120
+ readonly duration: 10;
121
+ };
122
+ readonly sleep: {
123
+ readonly effect: Effect;
124
+ readonly duration: 10;
125
+ };
126
+ };
127
+ readonly "programmable blender": {
128
+ readonly booze: Item[];
129
+ readonly "mental stimulation": {
130
+ readonly effect: Effect;
131
+ readonly duration: 10;
132
+ };
133
+ };
134
+ readonly "second-hand hot plate": {
135
+ readonly food: Item[];
136
+ };
137
+ readonly "sensory deprivation tank": {
138
+ readonly "mental stimulation": {
139
+ readonly effect: Effect;
140
+ readonly duration: 10;
141
+ };
142
+ readonly sleep: {
143
+ readonly effect: Effect;
144
+ readonly duration: 10;
145
+ };
146
+ };
147
+ readonly "sous vide laboratory": {
148
+ readonly food: Item[];
149
+ readonly "mental stimulation": {
150
+ readonly effect: Effect;
151
+ readonly duration: 10;
152
+ };
153
+ };
154
+ readonly "thrift store oil painting": {
155
+ readonly "mental stimulation": {
156
+ readonly effect: Effect;
157
+ readonly duration: 10;
158
+ };
159
+ };
160
+ readonly "ultimate retro game console": {
161
+ readonly "dumb entertainment": Item;
162
+ };
163
+ readonly "UltraDance karaoke machine": {
164
+ readonly "dumb entertainment": {
165
+ readonly effect: Effect;
166
+ readonly duration: 10;
167
+ };
168
+ readonly exercise: {
169
+ readonly effect: Effect;
170
+ readonly duration: 10;
171
+ };
172
+ };
173
+ readonly whiskeybed: {
174
+ readonly booze: Item[];
175
+ readonly sleep: {
176
+ readonly effect: Effect;
177
+ readonly duration: 10;
178
+ };
179
+ };
180
+ }>;
181
+ /**
182
+ * @returns How many more times you can rearrange today
183
+ */
184
+ export declare function rearrangesRemaining(): number;
185
+ /**
186
+ * @returns the Furniture elements you've discovered
187
+ */
188
+ export declare function discoveredFurniture(): FurniturePiece[];
189
+ /**
190
+ * @returns the Furniture elements you've installed, in descending order of importance (starting from bottom right and ending in top left)
191
+ */
192
+ export declare function installedFurniture(): Tuple<FurniturePiece, 4>;
193
+ /**
194
+ * @param furniture A spread array of furniture pieces to install, starting from bottom right and ending in top left
195
+ * @returns Whether or not you successfully installed the desired furniture
196
+ */
197
+ export declare function setFurniture(...furniture: Tuple<FurniturePiece, 4>): boolean;
198
+ /**
199
+ * @param furniture The set of furniture to examine; defaults to currently installed furniture. Reads furniture from most important (bottom right) to least important (top left)
200
+ * @returns The cumulative bonuses of all currently-installed furniture.
201
+ */
202
+ export declare function furnitureBonuses(furniture?: ["empty" | "buckets of concrete" | "thrift store oil painting" | "boxes of old comic books" | "second-hand hot plate" | "beer cooler" | "free mattress" | "gigantic chess set" | "UltraDance karaoke machine" | "cupcake treadmill" | "beer pong table" | "padded weight bench" | "internet-connected laptop" | "sous vide laboratory" | "programmable blender" | "sensory deprivation tank" | "fruit-smashing robot" | "ManCave™ sports bar set" | "couch and flatscreen" | "kegerator" | "fine upholstered dining set" | "whiskeybed" | "high-end home workout system" | "complete classics library" | "ultimate retro game console" | "Omnipot" | "fully-stocked wet bar" | "four-poster bed", "empty" | "buckets of concrete" | "thrift store oil painting" | "boxes of old comic books" | "second-hand hot plate" | "beer cooler" | "free mattress" | "gigantic chess set" | "UltraDance karaoke machine" | "cupcake treadmill" | "beer pong table" | "padded weight bench" | "internet-connected laptop" | "sous vide laboratory" | "programmable blender" | "sensory deprivation tank" | "fruit-smashing robot" | "ManCave™ sports bar set" | "couch and flatscreen" | "kegerator" | "fine upholstered dining set" | "whiskeybed" | "high-end home workout system" | "complete classics library" | "ultimate retro game console" | "Omnipot" | "fully-stocked wet bar" | "four-poster bed", "empty" | "buckets of concrete" | "thrift store oil painting" | "boxes of old comic books" | "second-hand hot plate" | "beer cooler" | "free mattress" | "gigantic chess set" | "UltraDance karaoke machine" | "cupcake treadmill" | "beer pong table" | "padded weight bench" | "internet-connected laptop" | "sous vide laboratory" | "programmable blender" | "sensory deprivation tank" | "fruit-smashing robot" | "ManCave™ sports bar set" | "couch and flatscreen" | "kegerator" | "fine upholstered dining set" | "whiskeybed" | "high-end home workout system" | "complete classics library" | "ultimate retro game console" | "Omnipot" | "fully-stocked wet bar" | "four-poster bed", "empty" | "buckets of concrete" | "thrift store oil painting" | "boxes of old comic books" | "second-hand hot plate" | "beer cooler" | "free mattress" | "gigantic chess set" | "UltraDance karaoke machine" | "cupcake treadmill" | "beer pong table" | "padded weight bench" | "internet-connected laptop" | "sous vide laboratory" | "programmable blender" | "sensory deprivation tank" | "fruit-smashing robot" | "ManCave™ sports bar set" | "couch and flatscreen" | "kegerator" | "fine upholstered dining set" | "whiskeybed" | "high-end home workout system" | "complete classics library" | "ultimate retro game console" | "Omnipot" | "fully-stocked wet bar" | "four-poster bed"]): FurnitureStat;
203
+ export {};
@@ -0,0 +1,218 @@
1
+ /* eslint-disable libram/verify-constants */
2
+ import { runChoice } from "kolmafia";
3
+ import { directlyUse, have as have_ } from "../../lib.js";
4
+ import { $effect, $item, $items } from "../../template-string.js";
5
+ import { arrayEquals, clamp } from "../../utils.js";
6
+ import { get } from "../../property.js";
7
+ /**
8
+ * @returns Whether you `have` the Leprecondo
9
+ */
10
+ export function have() {
11
+ return have_($item `Leprecondo`);
12
+ }
13
+ export const NEEDS = Object.freeze([
14
+ "exercise",
15
+ "mental stimulation",
16
+ "dumb entertainment",
17
+ "food",
18
+ "booze",
19
+ "sleep",
20
+ ]);
21
+ export const FURNITURE_PIECES = Object.freeze([
22
+ "empty",
23
+ "buckets of concrete",
24
+ "thrift store oil painting",
25
+ "boxes of old comic books",
26
+ "second-hand hot plate",
27
+ "beer cooler",
28
+ "free mattress",
29
+ "gigantic chess set",
30
+ "UltraDance karaoke machine",
31
+ "cupcake treadmill",
32
+ "beer pong table",
33
+ "padded weight bench",
34
+ "internet-connected laptop",
35
+ "sous vide laboratory",
36
+ "programmable blender",
37
+ "sensory deprivation tank",
38
+ "fruit-smashing robot",
39
+ "ManCave™ sports bar set",
40
+ "couch and flatscreen",
41
+ "kegerator",
42
+ "fine upholstered dining set",
43
+ "whiskeybed",
44
+ "high-end home workout system",
45
+ "complete classics library",
46
+ "ultimate retro game console",
47
+ "Omnipot",
48
+ "fully-stocked wet bar",
49
+ "four-poster bed",
50
+ ]);
51
+ export const Furniture = Object.freeze({
52
+ empty: {},
53
+ "beer cooler": {
54
+ booze: $items `beer bomb, bloody beer, ice-cold fotie, ice-cold Sir Schlitz, ice-cold Willer, overpriced "imported" beer, plain old beer`,
55
+ },
56
+ "beer pong table": {
57
+ booze: $items `beer bomb, bloody beer, ice-cold fotie, ice-cold Sir Schlitz, ice-cold Willer, overpriced "imported" beer, plain old beer`,
58
+ exercise: $item `table tennis ball`,
59
+ },
60
+ "boxes of old comic books": {
61
+ "dumb entertainment": { effect: $effect `Wasting Time`, duration: 10 },
62
+ },
63
+ "buckets of concrete": {
64
+ exercise: { effect: $effect `Gym Bros`, duration: 10 },
65
+ },
66
+ "complete classics library": {
67
+ "mental stimulation": $item `leprechaun antidepressant pill`,
68
+ },
69
+ "couch and flatscreen": {
70
+ "dumb entertainment": {
71
+ effect: $effect `Your Days Are Numbed`,
72
+ duration: 10,
73
+ },
74
+ sleep: { effect: $effect `Good Night's Sleep`, duration: 10 },
75
+ },
76
+ "cupcake treadmill": {
77
+ exercise: { effect: $effect `Your Days Are Numbed`, duration: 10 },
78
+ food: $item `standard-issue cupcake`,
79
+ },
80
+ "fine upholstered dining set": {
81
+ food: $items `boring spaghetti, delicious noodles, goat cheese pizza, sausage pizza, spicy bean burrito, spicy noodles`,
82
+ sleep: { effect: $effect `Sur La Table`, duration: 10 },
83
+ },
84
+ "four-poster bed": {
85
+ sleep: { effect: $effect `Spacious Night's Sleep`, duration: 10 },
86
+ },
87
+ "free mattress": {
88
+ sleep: { effect: $effect `Good Night's Sleep`, duration: 10 },
89
+ },
90
+ "fruit-smashing robot": {
91
+ "dumb entertainment": {
92
+ effect: $effect `You Might Have Gotten Wet`,
93
+ duration: 10,
94
+ },
95
+ food: $items `cherry, cranberries, grapefruit, grapes, kiwi, kumquat, lemon, lime, orange, papaya, raspberry, strawberry, tangerine`,
96
+ },
97
+ "fully-stocked wet bar": {
98
+ booze: $items `Divine Sidecar, prussian cathouse sidecar, tangarita sidecar`,
99
+ },
100
+ "gigantic chess set": {
101
+ exercise: { effect: $effect `Work Out Smarter, Not Harder`, duration: 10 },
102
+ "mental stimulation": { effect: $effect `Well Stimulated`, duration: 10 },
103
+ },
104
+ "high-end home workout system": {
105
+ exercise: $item `scoop of pre-workout powder`,
106
+ },
107
+ "internet-connected laptop": {
108
+ "dumb entertainment": { effect: $effect `Wasting Time`, duration: 10 },
109
+ "mental stimulation": $item `crafting plans`,
110
+ },
111
+ kegerator: {
112
+ booze: $item `pint of Leprechaun Stout`,
113
+ food: $items `bean burrito, plain pizza, spicy mushroom quesadilla, tofu casserole, Trollhouse cookies`,
114
+ },
115
+ "ManCave™ sports bar set": {
116
+ booze: $items `melted Jell-o shot, shot of blackberry schnapps, shot of nepenthe schnapps, shot of peach schnapps, shot of pear schnapps, shot of rotgut`,
117
+ "dumb entertainment": $item `bar dart`,
118
+ },
119
+ Omnipot: {
120
+ food: $item `Heck ramen, incredible mini-pizza, small beer brat, tiny burrito, tiny peach pie, savoy truffle, white chocolate chip brownies`,
121
+ },
122
+ "padded weight bench": {
123
+ exercise: { effect: $effect `Gym Bros`, duration: 10 },
124
+ sleep: { effect: $effect `Tired Muscles`, duration: 10 },
125
+ },
126
+ "programmable blender": {
127
+ booze: $items `eggnog, extra-spicy bloody mary, grog, white lightning`,
128
+ "mental stimulation": {
129
+ effect: $effect `Counter Intelligence`,
130
+ duration: 10,
131
+ },
132
+ },
133
+ "second-hand hot plate": {
134
+ food: $items `bean burrito, chorizo taco, plain pizza, spicy mushroom quesadilla, tofu casserole, Trollhouse cookies`,
135
+ },
136
+ "sensory deprivation tank": {
137
+ "mental stimulation": {
138
+ effect: $effect `Alone with Your Thoughts`,
139
+ duration: 10,
140
+ },
141
+ sleep: { effect: $effect `Quiet Night's Sleep`, duration: 10 },
142
+ },
143
+ "sous vide laboratory": {
144
+ food: $items `tiny burrito, black forest ham, fishy fish, ham steak, Knoll stir-fry, spooky stir-fry`,
145
+ "mental stimulation": {
146
+ effect: $effect `Counter Intelligence`,
147
+ duration: 10,
148
+ },
149
+ },
150
+ "thrift store oil painting": {
151
+ "mental stimulation": { effect: $effect `Well Stimulated`, duration: 10 },
152
+ },
153
+ "ultimate retro game console": {
154
+ "dumb entertainment": $item `phosphor traces`,
155
+ },
156
+ "UltraDance karaoke machine": {
157
+ "dumb entertainment": {
158
+ effect: $effect `Your Days Are Numbed`,
159
+ duration: 10,
160
+ },
161
+ exercise: { effect: $effect `Vicarious Sweat`, duration: 10 },
162
+ },
163
+ whiskeybed: {
164
+ booze: $items `Divine sidecar, lumbering jack, old-fashioned, whiskey and cola, whiskey and soda, whiskey bittersweet, whiskey sour`,
165
+ sleep: { effect: $effect `Moist Night's Sleep`, duration: 10 },
166
+ },
167
+ });
168
+ /**
169
+ * @returns How many more times you can rearrange today
170
+ */
171
+ export function rearrangesRemaining() {
172
+ return clamp(3 - get("_leprecondoRearrangements"), 0, 3);
173
+ }
174
+ /**
175
+ * @returns the Furniture elements you've discovered
176
+ */
177
+ export function discoveredFurniture() {
178
+ return get("leprecondoDiscovered")
179
+ .split(",")
180
+ .map((id) => FURNITURE_PIECES[Number(id)]);
181
+ }
182
+ /**
183
+ * @returns the Furniture elements you've installed, in descending order of importance (starting from bottom right and ending in top left)
184
+ */
185
+ export function installedFurniture() {
186
+ return get("leprecondoInstalled")
187
+ .split(",")
188
+ .map((id) => FURNITURE_PIECES[Number(id)])
189
+ .reverse();
190
+ }
191
+ /**
192
+ * @param furniture A spread array of furniture pieces to install, starting from bottom right and ending in top left
193
+ * @returns Whether or not you successfully installed the desired furniture
194
+ */
195
+ export function setFurniture(...furniture) {
196
+ if (rearrangesRemaining() < 0)
197
+ return false;
198
+ const nonemptyFurniture = furniture.filter((f) => f !== "empty");
199
+ if (nonemptyFurniture.some((piece) => !discoveredFurniture().includes(piece)))
200
+ return false;
201
+ if (new Set(nonemptyFurniture).size !== nonemptyFurniture.length)
202
+ return false;
203
+ directlyUse($item `Leprecondo`);
204
+ runChoice(1, furniture
205
+ .map((piece, index) => `r${3 - index}=${FURNITURE_PIECES.indexOf(piece)}`)
206
+ .join("&"));
207
+ return arrayEquals(installedFurniture(), furniture);
208
+ }
209
+ /**
210
+ * @param furniture The set of furniture to examine; defaults to currently installed furniture. Reads furniture from most important (bottom right) to least important (top left)
211
+ * @returns The cumulative bonuses of all currently-installed furniture.
212
+ */
213
+ export function furnitureBonuses(furniture = installedFurniture()) {
214
+ return furniture.reduce((acc, piece) => ({
215
+ ...Furniture[piece],
216
+ ...acc,
217
+ }), {});
218
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libram",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "description": "JavaScript helper library for KoLmafia",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -48,7 +48,7 @@
48
48
  "eslint-config-prettier": "^9.1.0",
49
49
  "eslint-import-resolver-typescript": "^3.6.3",
50
50
  "eslint-plugin-jsdoc": "^50.2.3",
51
- "eslint-plugin-libram": "^0.4.22",
51
+ "eslint-plugin-libram": "^0.4.24",
52
52
  "husky": "^9.1.6",
53
53
  "java-parser": "^2.3.2",
54
54
  "kolmafia": "^5.28047.0",