libram 0.7.5 → 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.
- package/dist/ascend.d.ts +1 -5
- package/dist/ascend.js +9 -30
- package/dist/maximize.d.ts +4 -0
- package/dist/maximize.js +15 -1
- package/dist/propertyTypes.d.ts +4 -4
- package/dist/propertyTypes.js +4 -4
- package/dist/resources/2012/ReagnimatedGnome.d.ts +13 -0
- package/dist/resources/2012/ReagnimatedGnome.js +28 -0
- package/dist/resources/2017/AsdonMartin.js +5 -2
- package/dist/resources/2017/Robortender.js +6 -1
- package/dist/resources/2022/AutumnAton.d.ts +5 -0
- package/dist/resources/2022/AutumnAton.js +34 -3
- package/dist/resources/2022/TrainSet.d.ts +99 -0
- package/dist/resources/2022/TrainSet.js +172 -0
- package/dist/resources/index.d.ts +3 -1
- package/dist/resources/index.js +3 -1
- package/dist/utils.d.ts +3 -0
- package/package.json +3 -3
package/dist/ascend.d.ts
CHANGED
|
@@ -11,8 +11,6 @@ export declare class AscendError extends Error {
|
|
|
11
11
|
cause?: Skill | Item | Class | Path | string;
|
|
12
12
|
constructor(cause?: Skill | Item | Class | Path | string);
|
|
13
13
|
}
|
|
14
|
-
declare const worksheds: readonly ["warbear LP-ROM burner", "warbear jackhammer drill press", "warbear induction oven", "warbear high-efficiency still", "warbear chemistry lab", "warbear auto-anvil", "spinning wheel", "snow machine", "Little Geneticist DNA-Splicing Lab", "portable Mayo Clinic", "Asdon Martin keyfob", "diabolic pizza cube", "cold medicine cabinet"];
|
|
15
|
-
declare type Workshed = typeof worksheds[number];
|
|
16
14
|
declare const gardens: readonly ["packet of pumpkin seeds", "Peppermint Pip Packet", "packet of dragon's teeth", "packet of beer seeds", "packet of winter seeds", "packet of thanksgarden seeds", "packet of tall grass seeds", "packet of mushroom spores"];
|
|
17
15
|
declare type Garden = typeof gardens[number];
|
|
18
16
|
declare const eudorae: readonly ["My Own Pen Pal kit", "GameInformPowerDailyPro subscription card", "Xi Receiver Unit", "New-You Club Membership Form", "Our Daily Candles™ order form"];
|
|
@@ -38,13 +36,11 @@ export declare function ascend(path: Path, playerClass: Class, lifestyle: Lifest
|
|
|
38
36
|
}): void;
|
|
39
37
|
/**
|
|
40
38
|
* Sets up various iotms you may want to use in the coming ascension
|
|
41
|
-
* @param ascensionItems.workshed Workshed to switch to.
|
|
42
39
|
* @param ascensionItems.garden Garden to switch to.
|
|
43
40
|
* @param ascensionItems An object potentially containing your workshed, garden, chateau, and eudora, all as strings
|
|
44
41
|
* @param throwOnFail If true, this will throw an error when it fails to switch something
|
|
45
42
|
*/
|
|
46
|
-
export declare function prepareAscension({
|
|
47
|
-
workshed?: Workshed;
|
|
43
|
+
export declare function prepareAscension({ garden, eudora, chateau, throwOnFail, }?: {
|
|
48
44
|
garden?: Garden;
|
|
49
45
|
eudora?: Eudora;
|
|
50
46
|
chateau?: {
|
package/dist/ascend.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Skill, Class,
|
|
1
|
+
import { Skill, Class, eudoraItem, getCampground, Item, Path, toInt, use, visitUrl, xpath, haveSkill, getPermedSkills, toSkill, } from "kolmafia";
|
|
2
2
|
import { get } from "./property";
|
|
3
3
|
import { ChateauMantegna } from "./resources";
|
|
4
4
|
import { $item, $items, $stat } from "./template-string";
|
|
@@ -44,21 +44,6 @@ export class AscendError extends Error {
|
|
|
44
44
|
this.cause = cause;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
const worksheds = [
|
|
48
|
-
"warbear LP-ROM burner",
|
|
49
|
-
"warbear jackhammer drill press",
|
|
50
|
-
"warbear induction oven",
|
|
51
|
-
"warbear high-efficiency still",
|
|
52
|
-
"warbear chemistry lab",
|
|
53
|
-
"warbear auto-anvil",
|
|
54
|
-
"spinning wheel",
|
|
55
|
-
"snow machine",
|
|
56
|
-
"Little Geneticist DNA-Splicing Lab",
|
|
57
|
-
"portable Mayo Clinic",
|
|
58
|
-
"Asdon Martin keyfob",
|
|
59
|
-
"diabolic pizza cube",
|
|
60
|
-
"cold medicine cabinet",
|
|
61
|
-
];
|
|
62
47
|
const gardens = [
|
|
63
48
|
"packet of pumpkin seeds",
|
|
64
49
|
"Peppermint Pip Packet",
|
|
@@ -76,7 +61,6 @@ const eudorae = [
|
|
|
76
61
|
"New-You Club Membership Form",
|
|
77
62
|
"Our Daily Candles™ order form",
|
|
78
63
|
];
|
|
79
|
-
const isWorkshed = createStringUnionTypeGuardFunction(worksheds);
|
|
80
64
|
const isGarden = createStringUnionTypeGuardFunction(gardens);
|
|
81
65
|
const isEudora = createStringUnionTypeGuardFunction(eudorae);
|
|
82
66
|
const isDesk = createStringUnionTypeGuardFunction(ChateauMantegna.desks);
|
|
@@ -85,10 +69,7 @@ const isCeiling = createStringUnionTypeGuardFunction(ChateauMantegna.ceilings);
|
|
|
85
69
|
export class AscensionPrepError extends Error {
|
|
86
70
|
cause;
|
|
87
71
|
constructor(cause, original) {
|
|
88
|
-
if (
|
|
89
|
-
super(`Unable to swap workshed to ${cause}; workshed is currently ${original}.`);
|
|
90
|
-
}
|
|
91
|
-
else if (isGarden(cause)) {
|
|
72
|
+
if (isGarden(cause)) {
|
|
92
73
|
super(`Unable to swap garden to ${cause}; garden is currently ${original}.`);
|
|
93
74
|
}
|
|
94
75
|
else if (isEudora(cause)) {
|
|
@@ -160,7 +141,12 @@ function toMoonId(moon, playerClass) {
|
|
|
160
141
|
}
|
|
161
142
|
}
|
|
162
143
|
function isInValhalla() {
|
|
163
|
-
|
|
144
|
+
const charPaneText = visitUrl("charpane.php");
|
|
145
|
+
// Match the infinity images (inf_small.gif, inf_large.gif)
|
|
146
|
+
// At time of writing, the full img tag used is:
|
|
147
|
+
// <img src="https://d2uyhvukfffg5a.cloudfront.net/otherimages/inf_small.gif">
|
|
148
|
+
const matches = charPaneText.match(/<img src="[^"]*\/otherimages\/inf_\w+\.gif">/);
|
|
149
|
+
return matches !== null;
|
|
164
150
|
}
|
|
165
151
|
/**
|
|
166
152
|
* Hops the gash, perming no skills
|
|
@@ -229,19 +215,12 @@ export function ascend(path, playerClass, lifestyle, moon, consumable = $item `a
|
|
|
229
215
|
}
|
|
230
216
|
/**
|
|
231
217
|
* Sets up various iotms you may want to use in the coming ascension
|
|
232
|
-
* @param ascensionItems.workshed Workshed to switch to.
|
|
233
218
|
* @param ascensionItems.garden Garden to switch to.
|
|
234
219
|
* @param ascensionItems An object potentially containing your workshed, garden, chateau, and eudora, all as strings
|
|
235
220
|
* @param throwOnFail If true, this will throw an error when it fails to switch something
|
|
236
221
|
*/
|
|
237
|
-
export function prepareAscension({
|
|
222
|
+
export function prepareAscension({ garden, eudora, chateau, throwOnFail, } = {}) {
|
|
238
223
|
throwOnFail = throwOnFail ?? true;
|
|
239
|
-
if (workshed && getWorkshed() !== Item.get(workshed)) {
|
|
240
|
-
use(Item.get(workshed));
|
|
241
|
-
if (getWorkshed().name !== workshed && throwOnFail) {
|
|
242
|
-
throw new AscensionPrepError(workshed, getWorkshed());
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
224
|
if (garden && !Object.getOwnPropertyNames(getCampground()).includes(garden)) {
|
|
246
225
|
use(Item.get(garden));
|
|
247
226
|
const gardenName = Object.getOwnPropertyNames(getCampground()).find(isGarden);
|
package/dist/maximize.d.ts
CHANGED
package/dist/maximize.js
CHANGED
|
@@ -93,7 +93,7 @@ export function getCurrentModes() {
|
|
|
93
93
|
}
|
|
94
94
|
export function applyModes(modes) {
|
|
95
95
|
for (const command of modeableCommands) {
|
|
96
|
-
if (haveEquipped(modeableItems[command])) {
|
|
96
|
+
if (haveEquipped(modeableItems[command]) && modes[command] !== undefined) {
|
|
97
97
|
if (modeableState[command]() !== modes[command]) {
|
|
98
98
|
cliExecute(command + " " + modes[command]);
|
|
99
99
|
}
|
|
@@ -162,6 +162,10 @@ class OutfitLRUCache {
|
|
|
162
162
|
return `${OutfitLRUCache.OUTFIT_PREFIX} ${index}`;
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
+
clear() {
|
|
166
|
+
this.#outfitSlots = [];
|
|
167
|
+
this.#useHistory = [];
|
|
168
|
+
}
|
|
165
169
|
}
|
|
166
170
|
/**
|
|
167
171
|
* Save current equipment as KoL-native outfit.
|
|
@@ -384,6 +388,8 @@ export function maximizeCached(objectives, options = {}) {
|
|
|
384
388
|
].join("; ");
|
|
385
389
|
const cacheEntry = checkCache(cacheKey, fullOptions);
|
|
386
390
|
if (cacheEntry && !forceUpdate) {
|
|
391
|
+
if (verifyCached(cacheEntry))
|
|
392
|
+
return true;
|
|
387
393
|
logger.info("Equipment found in maximize cache, equipping...");
|
|
388
394
|
applyCached(cacheEntry, fullOptions);
|
|
389
395
|
if (verifyCached(cacheEntry)) {
|
|
@@ -468,3 +474,11 @@ export class Requirement {
|
|
|
468
474
|
Requirement.merge(requirements).maximize();
|
|
469
475
|
}
|
|
470
476
|
}
|
|
477
|
+
/**
|
|
478
|
+
* Clear all outfits cached by the maximizer.
|
|
479
|
+
*/
|
|
480
|
+
export function clearMaximizerCache() {
|
|
481
|
+
outfitCache.clear();
|
|
482
|
+
for (const member in cachedObjectives)
|
|
483
|
+
delete cachedObjectives[member];
|
|
484
|
+
}
|