libram 0.7.15 → 0.7.17
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 -1
- package/dist/ascend.js +1 -0
- package/dist/challengePaths/2015/CommunityService.js +2 -1
- package/dist/combat.js +3 -7
- package/dist/lib.d.ts +7 -0
- package/dist/lib.js +9 -0
- package/dist/overlappingNames.d.ts +3 -0
- package/dist/overlappingNames.js +39 -0
- package/dist/propertyTypes.d.ts +2 -2
- package/dist/propertyTypes.js +2 -2
- package/dist/resources/2014/CrimboShrub.js +3 -3
- package/dist/resources/2015/Dinseylandfill.d.ts +46 -2
- package/dist/resources/2015/Dinseylandfill.js +54 -3
- package/dist/resources/2017/Pantogram.js +2 -2
- package/dist/resources/2017/Spacegate.d.ts +71 -4
- package/dist/resources/2017/Spacegate.js +96 -9
- package/dist/resources/2022/AutumnAton.js +5 -5
- package/dist/resources/2022/GreyGoose.js +2 -2
- package/dist/resources/2023/ClosedCircuitPayphone.d.ts +6 -0
- package/dist/resources/2023/ClosedCircuitPayphone.js +15 -3
- package/dist/resources/2023/CursedMonkeyPaw.d.ts +34 -0
- package/dist/resources/2023/CursedMonkeyPaw.js +103 -0
- package/dist/resources/index.d.ts +2 -1
- package/dist/resources/index.js +2 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +2 -2
- package/package.json +6 -5
|
@@ -1,19 +1,86 @@
|
|
|
1
1
|
import { Item } from "kolmafia";
|
|
2
|
+
/**
|
|
3
|
+
* @returns Whether you have permanent Spacegate Access
|
|
4
|
+
*/
|
|
2
5
|
export declare function have(): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Refreshes the data from the Spacegate Terminal to determine current Spacegate Status
|
|
8
|
+
*/
|
|
3
9
|
export declare function updateStatus(): void;
|
|
10
|
+
/**
|
|
11
|
+
* @returns Whether you have dialled the spacegate today.
|
|
12
|
+
*/
|
|
4
13
|
export declare function dialled(): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* @returns A string containing a pipe-separated (|) list of all known hazards at the dialled planet
|
|
16
|
+
*/
|
|
5
17
|
export declare function hazards(): string;
|
|
18
|
+
/**
|
|
19
|
+
* @returns The name of the dialled planet
|
|
20
|
+
*/
|
|
6
21
|
export declare function planetName(): string;
|
|
22
|
+
/**
|
|
23
|
+
* @returns The 7-letter coordinates of the dialled planet
|
|
24
|
+
*/
|
|
7
25
|
export declare function planetCoords(): string;
|
|
26
|
+
/**
|
|
27
|
+
* @returns The level of plantlife expected on the dialled planet (none, primitive, advanced, anomalous)
|
|
28
|
+
*/
|
|
8
29
|
export declare function plantLife(): string;
|
|
30
|
+
/**
|
|
31
|
+
* @returns The level of animal life expected on the dialled planet (none, primitive, advanced, anomalous)
|
|
32
|
+
*/
|
|
9
33
|
export declare function animalLife(): string;
|
|
10
|
-
|
|
34
|
+
/**
|
|
35
|
+
* @returns Whether intelligent life is detected on the dialled planet
|
|
36
|
+
*/
|
|
37
|
+
export declare function intelligentLife(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* @returns Whether hostile life is detected on the dialled planet
|
|
40
|
+
*/
|
|
41
|
+
export declare function hostileLife(): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* @returns Whether alien ruins are detected on the dialled planet
|
|
44
|
+
*/
|
|
11
45
|
export declare function ruins(): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* @returns Whether Spants are detected on the dialled planet
|
|
48
|
+
*/
|
|
12
49
|
export declare function spants(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* @returns Whether muderbots are detected on the dialled planet
|
|
52
|
+
*/
|
|
13
53
|
export declare function murderBots(): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* @param hazards A string of the various hazard names
|
|
56
|
+
* @returns An array of the various required equipment to deal with those hazards
|
|
57
|
+
*/
|
|
14
58
|
export declare function hazardEquipment(hazards: string): Item[];
|
|
15
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Tries to acquire all necessary equipment for the stated hazards at the dialed planet
|
|
61
|
+
*
|
|
62
|
+
* @returns Whether you successfully acquired all necessary equipment
|
|
63
|
+
*/
|
|
64
|
+
export declare function getHazardEquipment(): boolean;
|
|
16
65
|
declare type Vaccine = "Rainbow" | "Broad-Spectrum" | "Emotional" | "Elemental Resistance" | "Stats" | "Monster Level";
|
|
17
|
-
|
|
18
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Gets the requested Spacegate Vaccine Buff
|
|
68
|
+
*
|
|
69
|
+
* @param choice Name of Vaccine or Buff type requested
|
|
70
|
+
* @returns Whether you successfully acquired a vaccine
|
|
71
|
+
*/
|
|
72
|
+
export declare function getVaccine(choice: Vaccine): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Dials the requested gate address
|
|
75
|
+
*
|
|
76
|
+
* @param address 7-letter string indicating the coordinates of the planet you wish to dial.
|
|
77
|
+
* @returns Whether you successfully dialled the requested planet.
|
|
78
|
+
*/
|
|
79
|
+
export declare function dial(address: string): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Dials a random gate address
|
|
82
|
+
*
|
|
83
|
+
* @returns Whether you successfully dialled a planet.
|
|
84
|
+
*/
|
|
85
|
+
export declare function dialRandom(): boolean;
|
|
19
86
|
export {};
|
|
@@ -1,44 +1,90 @@
|
|
|
1
|
-
|
|
2
|
-
import { cliExecute, toInt, visitUrl } from "kolmafia";
|
|
1
|
+
import { availableAmount, cliExecute, toInt, visitUrl } from "kolmafia";
|
|
3
2
|
import { get } from "../../property";
|
|
4
3
|
import { $item } from "../../template-string";
|
|
4
|
+
/**
|
|
5
|
+
* @returns Whether you have permanent Spacegate Access
|
|
6
|
+
*/
|
|
5
7
|
export function have() {
|
|
6
|
-
return get("spacegateAlways")
|
|
8
|
+
return get("spacegateAlways");
|
|
9
|
+
("");
|
|
7
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Refreshes the data from the Spacegate Terminal to determine current Spacegate Status
|
|
13
|
+
*/
|
|
8
14
|
export function updateStatus() {
|
|
9
15
|
visitUrl("place.php?whichplace=spacegate&action=sg_Terminal");
|
|
10
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* @returns Whether you have dialled the spacegate today.
|
|
19
|
+
*/
|
|
11
20
|
export function dialled() {
|
|
12
21
|
updateStatus();
|
|
13
|
-
return get("_spacegateCoordinates") !== "";
|
|
22
|
+
return get("_spacegateCoordinates") !== "" || get("_spacegateToday");
|
|
14
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* @returns A string containing a pipe-separated (|) list of all known hazards at the dialled planet
|
|
26
|
+
*/
|
|
15
27
|
export function hazards() {
|
|
16
28
|
return get("_spacegateHazards");
|
|
17
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* @returns The name of the dialled planet
|
|
32
|
+
*/
|
|
18
33
|
export function planetName() {
|
|
19
34
|
return get("_spacegatePlanetName");
|
|
20
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* @returns The 7-letter coordinates of the dialled planet
|
|
38
|
+
*/
|
|
21
39
|
export function planetCoords() {
|
|
22
40
|
return get("_spacegateCoordinates");
|
|
23
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* @returns The level of plantlife expected on the dialled planet (none, primitive, advanced, anomalous)
|
|
44
|
+
*/
|
|
24
45
|
export function plantLife() {
|
|
25
46
|
return get("_spacegatePlantLife");
|
|
26
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* @returns The level of animal life expected on the dialled planet (none, primitive, advanced, anomalous)
|
|
50
|
+
*/
|
|
27
51
|
export function animalLife() {
|
|
28
52
|
return get("_spacegateAnimalLife");
|
|
29
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* @returns Whether intelligent life is detected on the dialled planet
|
|
56
|
+
*/
|
|
30
57
|
export function intelligentLife() {
|
|
31
|
-
return get("_spacegateIntelligentLife");
|
|
58
|
+
return get("_spacegateIntelligentLife").includes("detected");
|
|
32
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* @returns Whether hostile life is detected on the dialled planet
|
|
62
|
+
*/
|
|
63
|
+
export function hostileLife() {
|
|
64
|
+
return get("_spacegateIntelligentLife").includes("hostile");
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* @returns Whether alien ruins are detected on the dialled planet
|
|
68
|
+
*/
|
|
33
69
|
export function ruins() {
|
|
34
70
|
return get("_spacegateRuins");
|
|
35
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* @returns Whether Spants are detected on the dialled planet
|
|
74
|
+
*/
|
|
36
75
|
export function spants() {
|
|
37
76
|
return get("_spacegateSpant");
|
|
38
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* @returns Whether muderbots are detected on the dialled planet
|
|
80
|
+
*/
|
|
39
81
|
export function murderBots() {
|
|
40
82
|
return get("_spacegateMurderbot");
|
|
41
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* @param hazards A string of the various hazard names
|
|
86
|
+
* @returns An array of the various required equipment to deal with those hazards
|
|
87
|
+
*/
|
|
42
88
|
export function hazardEquipment(hazards) {
|
|
43
89
|
const hazardEquipment = {
|
|
44
90
|
"toxic atmosphere": $item `filter helmet`,
|
|
@@ -51,17 +97,37 @@ export function hazardEquipment(hazards) {
|
|
|
51
97
|
.filter(([clue]) => hazards.includes(clue))
|
|
52
98
|
.map(([, item]) => item);
|
|
53
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Tries to acquire all necessary equipment for the stated hazards at the dialed planet
|
|
102
|
+
*
|
|
103
|
+
* @returns Whether you successfully acquired all necessary equipment
|
|
104
|
+
*/
|
|
54
105
|
export function getHazardEquipment() {
|
|
106
|
+
if (!have()) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
55
109
|
const equipment = hazardEquipment(hazards());
|
|
56
110
|
equipment.forEach((equip) => {
|
|
57
111
|
const num = toInt(equip) - 9404; //Equipment items are 9405 - 9409,
|
|
58
112
|
visitUrl("place.php?whichplace=spacegate&action=sg_requisition");
|
|
59
113
|
visitUrl(`choice.php?whichchoice=1233&option=${num}`);
|
|
60
114
|
});
|
|
61
|
-
|
|
115
|
+
equipment.forEach((equip) => {
|
|
116
|
+
if (availableAmount(equip) !== 1) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Gets the requested Spacegate Vaccine Buff
|
|
124
|
+
*
|
|
125
|
+
* @param choice Name of Vaccine or Buff type requested
|
|
126
|
+
* @returns Whether you successfully acquired a vaccine
|
|
127
|
+
*/
|
|
62
128
|
export function getVaccine(choice) {
|
|
63
129
|
if (get("_spacegateVaccine")) {
|
|
64
|
-
return;
|
|
130
|
+
return false;
|
|
65
131
|
}
|
|
66
132
|
const nums = {
|
|
67
133
|
Rainbow: 1,
|
|
@@ -76,11 +142,18 @@ export function getVaccine(choice) {
|
|
|
76
142
|
throw "You don't appear to have that Vaccine Unlocked!";
|
|
77
143
|
}
|
|
78
144
|
cliExecute(`spacegate vaccine ${num}`);
|
|
79
|
-
|
|
145
|
+
return get("_spacegateVaccine");
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Dials the requested gate address
|
|
149
|
+
*
|
|
150
|
+
* @param address 7-letter string indicating the coordinates of the planet you wish to dial.
|
|
151
|
+
* @returns Whether you successfully dialled the requested planet.
|
|
152
|
+
*/
|
|
80
153
|
export function dial(address) {
|
|
81
154
|
if (!have() || dialled()) {
|
|
82
155
|
//cannot dial if we already have or don't own it.
|
|
83
|
-
return;
|
|
156
|
+
return false;
|
|
84
157
|
}
|
|
85
158
|
if (!address.match(`^[[alpha]]+$`) || address.length !== 7) {
|
|
86
159
|
throw "Invalid Spacegate Address - must be exactly 7 alphabetic characters";
|
|
@@ -88,4 +161,18 @@ export function dial(address) {
|
|
|
88
161
|
else {
|
|
89
162
|
cliExecute(`spacegate destination ${address}`);
|
|
90
163
|
}
|
|
164
|
+
return dialled() && planetCoords() === address;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Dials a random gate address
|
|
168
|
+
*
|
|
169
|
+
* @returns Whether you successfully dialled a planet.
|
|
170
|
+
*/
|
|
171
|
+
export function dialRandom() {
|
|
172
|
+
if (!have() || dialled()) {
|
|
173
|
+
//cannot dial if we already have or don't own it.
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
cliExecute("spacegate destination random");
|
|
177
|
+
return dialled();
|
|
91
178
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { availableAmount, availableChoiceOptions, handlingChoice, Item, Location, runChoice, toLocation, totalTurnsPlayed, visitUrl, xpath, } from "kolmafia";
|
|
2
|
+
import { directlyUse } from "../../lib";
|
|
2
3
|
import { get } from "../../property";
|
|
3
4
|
import { $item } from "../../template-string";
|
|
4
5
|
import { arrayContains } from "../../utils";
|
|
@@ -28,7 +29,6 @@ export function have() {
|
|
|
28
29
|
function checkLocations(html) {
|
|
29
30
|
return xpath(html, '//select[@name="heythereprogrammer"]//option[position()>1]/text()').map((name) => toLocation(name));
|
|
30
31
|
}
|
|
31
|
-
const use = () => visitUrl("inv_use.php?pwd&whichitem=10954");
|
|
32
32
|
/**
|
|
33
33
|
* @returns The current location the autumn-aton is questing in; null if it is not on a quest.
|
|
34
34
|
*/
|
|
@@ -45,7 +45,7 @@ export function currentlyIn() {
|
|
|
45
45
|
export function sendTo(target, upgrade = true) {
|
|
46
46
|
if (!available())
|
|
47
47
|
return null;
|
|
48
|
-
const pageHtml =
|
|
48
|
+
const pageHtml = directlyUse(item);
|
|
49
49
|
if (upgrade && availableChoiceOptions()[1])
|
|
50
50
|
runChoice(1);
|
|
51
51
|
const locationsAvailable = checkLocations(pageHtml);
|
|
@@ -59,7 +59,7 @@ export function sendTo(target, upgrade = true) {
|
|
|
59
59
|
if (!locationsAvailable.includes(location))
|
|
60
60
|
return null;
|
|
61
61
|
if (!handlingChoice())
|
|
62
|
-
|
|
62
|
+
directlyUse(item);
|
|
63
63
|
runChoice(2, `heythereprogrammer=${location.id}`);
|
|
64
64
|
if (handlingChoice())
|
|
65
65
|
visitUrl("main.php");
|
|
@@ -71,7 +71,7 @@ export function sendTo(target, upgrade = true) {
|
|
|
71
71
|
* @returns Whether there were any upgrades to install.
|
|
72
72
|
*/
|
|
73
73
|
export function upgrade() {
|
|
74
|
-
|
|
74
|
+
directlyUse(item);
|
|
75
75
|
const canUpgrade = availableChoiceOptions()[1] !== undefined;
|
|
76
76
|
if (canUpgrade)
|
|
77
77
|
runChoice(1);
|
|
@@ -84,7 +84,7 @@ export function upgrade() {
|
|
|
84
84
|
export function availableLocations() {
|
|
85
85
|
if (!available())
|
|
86
86
|
return [];
|
|
87
|
-
const pageHtml =
|
|
87
|
+
const pageHtml = directlyUse(item);
|
|
88
88
|
visitUrl("main.php");
|
|
89
89
|
return checkLocations(pageHtml);
|
|
90
90
|
}
|
|
@@ -18,10 +18,10 @@ export function have() {
|
|
|
18
18
|
* @returns Your current expected Grey Goose experience, paying attention to potential experience from the Shorter-Order Cook
|
|
19
19
|
*/
|
|
20
20
|
export function currentExperience() {
|
|
21
|
-
|
|
22
|
-
(have_($familiar `Shorter-Order Cook`) && !get("gooseReprocessed"))
|
|
21
|
+
const postAscensionBaseExperience = have_($familiar `Shorter-Order Cook`) && !get("gooseReprocessed")
|
|
23
22
|
? 81 + (have_($item `blue plate`) ? 19 : 0)
|
|
24
23
|
: 0;
|
|
24
|
+
return goose.experience || postAscensionBaseExperience;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Determines the current expected weight of your goose, were you to make it your active familiar
|
|
@@ -72,4 +72,10 @@ export declare function rifts(): Location[];
|
|
|
72
72
|
* @returns The option corresponding to your current shadow rift ingress.
|
|
73
73
|
*/
|
|
74
74
|
export declare const byIngress: <S>(options: import("../../utils").Switch<Ingress, S>) => S;
|
|
75
|
+
/**
|
|
76
|
+
* Submit your Rufus quest
|
|
77
|
+
*
|
|
78
|
+
* @returns Whether we successfully submitted your Rufus quest
|
|
79
|
+
*/
|
|
80
|
+
export declare function submitQuest(): boolean;
|
|
75
81
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Monster, Item, getMonsters, itemDrops, canAdventure, runChoice, toItem, toMonster,
|
|
2
|
-
import { have as have_ } from "../../lib";
|
|
1
|
+
import { Monster, Item, getMonsters, itemDrops, canAdventure, runChoice, toItem, toMonster, use, } from "kolmafia";
|
|
2
|
+
import { directlyUse, have as have_, questStep } from "../../lib";
|
|
3
3
|
import { get, withChoice } from "../../property";
|
|
4
4
|
import { $item, $location } from "../../template-string";
|
|
5
5
|
import { makeByXFunction, maxBy } from "../../utils";
|
|
@@ -93,7 +93,7 @@ export function chooseQuest(chooser) {
|
|
|
93
93
|
if (!have())
|
|
94
94
|
return false;
|
|
95
95
|
withChoice(1497, "", () => {
|
|
96
|
-
|
|
96
|
+
directlyUse(item);
|
|
97
97
|
runChoice(chooser({
|
|
98
98
|
artifact: toItem(get("rufusDesiredArtifact")),
|
|
99
99
|
entity: toMonster(get("rufusDesiredEntity")),
|
|
@@ -115,3 +115,15 @@ export function rifts() {
|
|
|
115
115
|
* @returns The option corresponding to your current shadow rift ingress.
|
|
116
116
|
*/
|
|
117
117
|
export const byIngress = makeByXFunction(currentIngress);
|
|
118
|
+
/**
|
|
119
|
+
* Submit your Rufus quest
|
|
120
|
+
*
|
|
121
|
+
* @returns Whether we successfully submitted your Rufus quest
|
|
122
|
+
*/
|
|
123
|
+
export function submitQuest() {
|
|
124
|
+
if (questStep("questRufus") === 1) {
|
|
125
|
+
withChoice(1498, 1, () => use(item));
|
|
126
|
+
return questStep("questRufus") === -1;
|
|
127
|
+
}
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Item, Effect } from "kolmafia";
|
|
2
|
+
export declare const item: Item;
|
|
3
|
+
/**
|
|
4
|
+
* @returns Whether or not we currently `have` the cursed monkey's paw
|
|
5
|
+
*/
|
|
6
|
+
export declare function have(): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* @returns The number of monkey paw wishes we have remaining
|
|
9
|
+
*/
|
|
10
|
+
export declare function wishes(): number;
|
|
11
|
+
/**
|
|
12
|
+
* @returns A set of all items we expect to be able to wish; this doesn't actually constitute all items
|
|
13
|
+
*/
|
|
14
|
+
export declare function wishableItems(): Set<Item>;
|
|
15
|
+
/**
|
|
16
|
+
* @returns An Array consisting of all genie-wishable Effects that are not Monkey-wishable
|
|
17
|
+
*/
|
|
18
|
+
export declare function getUnwishableEffects(): Effect[];
|
|
19
|
+
/**
|
|
20
|
+
* Decides if we expect that a given Item or Effect can be wished for.
|
|
21
|
+
* May be slow for Effects;
|
|
22
|
+
*
|
|
23
|
+
* @param wish The Item or Effect in question
|
|
24
|
+
* @returns Whether we expect it can be wished for
|
|
25
|
+
*/
|
|
26
|
+
export declare function isWishable(wish: Effect | Item): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Wish for a given Item or Effect.
|
|
29
|
+
* If it's an item, will `prepareForAdventure`; if an item is available in multiple locations this will pick the first one.
|
|
30
|
+
*
|
|
31
|
+
* @param wish The Item or Effect to wish for
|
|
32
|
+
* @returns Whether we succeeded in this endeavor
|
|
33
|
+
*/
|
|
34
|
+
export declare function wishFor(wish: Effect | Item): boolean;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Item, Location, canAdventure, getMonsters, itemDropsArray, Effect, toEffect, monkeyPaw, prepareForAdventure, cliExecute, } from "kolmafia";
|
|
2
|
+
import { have as have_ } from "../../lib";
|
|
3
|
+
import { get } from "../../property";
|
|
4
|
+
import { $item } from "../../template-string";
|
|
5
|
+
import { clamp, flat } from "../../utils";
|
|
6
|
+
export const item = $item `cursed monkey's paw`;
|
|
7
|
+
/**
|
|
8
|
+
* @returns Whether or not we currently `have` the cursed monkey's paw
|
|
9
|
+
*/
|
|
10
|
+
export function have() {
|
|
11
|
+
return have_(item);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @returns The number of monkey paw wishes we have remaining
|
|
15
|
+
*/
|
|
16
|
+
export function wishes() {
|
|
17
|
+
return clamp(5 - get("_monkeyPawWishesUsed"), 0, 5);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @returns A set of all items we expect to be able to wish; this doesn't actually constitute all items
|
|
21
|
+
*/
|
|
22
|
+
export function wishableItems() {
|
|
23
|
+
return new Set(...flat(Location.all()
|
|
24
|
+
.filter((l) => canAdventure(l))
|
|
25
|
+
.map((l) => getMonsters(l)
|
|
26
|
+
.filter((m) => m.copyable)
|
|
27
|
+
.map((m) => itemDropsArray(m)
|
|
28
|
+
.filter(({ type, rate, drop }) => !drop.quest && (type !== "c" || rate >= 1) // Remove random roll drops
|
|
29
|
+
)
|
|
30
|
+
.map(({ drop }) => drop)))));
|
|
31
|
+
}
|
|
32
|
+
const INVALID_CHARACTERS = /[^a-z\d -]/g;
|
|
33
|
+
let _unwishableEffects;
|
|
34
|
+
function unwishableEffects() {
|
|
35
|
+
// This is the set of all names of genie-wishable effects, split into the maximal substrings we can actually submit
|
|
36
|
+
const names = Effect.all()
|
|
37
|
+
.filter((e) => !e.attributes.includes("nohookah"))
|
|
38
|
+
.map((e) => {
|
|
39
|
+
const name = e.name.toLowerCase();
|
|
40
|
+
return { name, splitName: name.split(INVALID_CHARACTERS) };
|
|
41
|
+
});
|
|
42
|
+
return names
|
|
43
|
+
.filter(({ name, splitName }) =>
|
|
44
|
+
// Any effect that doesn't contain an INVALID_CHARACTER is fine
|
|
45
|
+
splitName.length > 1 &&
|
|
46
|
+
// To be unwishable, there can't be any substrings that uniquely match a genie-wishable effect
|
|
47
|
+
splitName.every((s) =>
|
|
48
|
+
// So we check every maximal substring against every one of our genie-wishable effects, excluding the effect we're currently looking at
|
|
49
|
+
// if one of the substrings matches a substring associated with another effect, we're screwed.
|
|
50
|
+
names.some(({ name: n }) => n !== name && n.includes(s))))
|
|
51
|
+
.map(({ name }) => toEffect(name));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @returns An Array consisting of all genie-wishable Effects that are not Monkey-wishable
|
|
55
|
+
*/
|
|
56
|
+
export function getUnwishableEffects() {
|
|
57
|
+
return (_unwishableEffects ??= unwishableEffects());
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Decides if we expect that a given Item or Effect can be wished for.
|
|
61
|
+
* May be slow for Effects;
|
|
62
|
+
*
|
|
63
|
+
* @param wish The Item or Effect in question
|
|
64
|
+
* @returns Whether we expect it can be wished for
|
|
65
|
+
*/
|
|
66
|
+
export function isWishable(wish) {
|
|
67
|
+
if (wish instanceof Item) {
|
|
68
|
+
return wishableItems().has(wish);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
if (wish.attributes.includes("nohookah"))
|
|
72
|
+
return false;
|
|
73
|
+
if (!wish.name.match(/[.,']/))
|
|
74
|
+
return true;
|
|
75
|
+
return !getUnwishableEffects().includes(wish);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Wish for a given Item or Effect.
|
|
80
|
+
* If it's an item, will `prepareForAdventure`; if an item is available in multiple locations this will pick the first one.
|
|
81
|
+
*
|
|
82
|
+
* @param wish The Item or Effect to wish for
|
|
83
|
+
* @returns Whether we succeeded in this endeavor
|
|
84
|
+
*/
|
|
85
|
+
export function wishFor(wish) {
|
|
86
|
+
if (wishes() <= 0)
|
|
87
|
+
return false;
|
|
88
|
+
if (wish instanceof Effect)
|
|
89
|
+
return monkeyPaw(wish);
|
|
90
|
+
const locations = Location.all().filter((l) => canAdventure(l) &&
|
|
91
|
+
getMonsters(l).some((m) => m.copyable && itemDropsArray(m).some(({ drop }) => drop === wish)));
|
|
92
|
+
try {
|
|
93
|
+
if (locations.length) {
|
|
94
|
+
cliExecute("checkpoint");
|
|
95
|
+
prepareForAdventure(locations[0]);
|
|
96
|
+
}
|
|
97
|
+
return monkeyPaw(wish);
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
if (locations.length)
|
|
101
|
+
cliExecute("outfit checkpoint");
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -38,6 +38,7 @@ import * as GreyGoose from "./2022/GreyGoose";
|
|
|
38
38
|
import * as JuneCleaver from "./2022/JuneCleaver";
|
|
39
39
|
import * as TrainSet from "./2022/TrainSet";
|
|
40
40
|
import * as ClosedCircuitPayphone from "./2023/ClosedCircuitPayphone";
|
|
41
|
-
|
|
41
|
+
import * as CursedMonkeyPaw from "./2023/CursedMonkeyPaw";
|
|
42
|
+
export { AutumnAton, AsdonMartin, Bandersnatch, BarrelShrine, BeachComb, Cartography, ChateauMantegna, ClosedCircuitPayphone, CombatLoversLocket, CrimboShrub, CrownOfThrones, CrystalBall, CursedMonkeyPaw, DaylightShavings, DeckOfEveryCard, 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, };
|
|
42
43
|
export * from "./putty-likes";
|
|
43
44
|
export * from "./LibramSummon";
|
package/dist/resources/index.js
CHANGED
|
@@ -38,6 +38,7 @@ import * as GreyGoose from "./2022/GreyGoose";
|
|
|
38
38
|
import * as JuneCleaver from "./2022/JuneCleaver";
|
|
39
39
|
import * as TrainSet from "./2022/TrainSet";
|
|
40
40
|
import * as ClosedCircuitPayphone from "./2023/ClosedCircuitPayphone";
|
|
41
|
-
|
|
41
|
+
import * as CursedMonkeyPaw from "./2023/CursedMonkeyPaw";
|
|
42
|
+
export { AutumnAton, AsdonMartin, Bandersnatch, BarrelShrine, BeachComb, Cartography, ChateauMantegna, ClosedCircuitPayphone, CombatLoversLocket, CrimboShrub, CrownOfThrones, CrystalBall, CursedMonkeyPaw, DaylightShavings, DeckOfEveryCard, 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, };
|
|
42
43
|
export * from "./putty-likes";
|
|
43
44
|
export * from "./LibramSummon";
|
package/dist/utils.d.ts
CHANGED
|
@@ -151,7 +151,7 @@ export declare function makeByXFunction<T extends string>(source: Delayed<T>): <
|
|
|
151
151
|
* Flattens an array. Basically replacing Array.prototype.flat for which Rhino doesn't yet have an implementation
|
|
152
152
|
*
|
|
153
153
|
* @param arr Array to flatten
|
|
154
|
-
* @param depth
|
|
154
|
+
* @param depth Number of layers to flatten by; Infinity for a fully flat array
|
|
155
155
|
* @returns Flattened array
|
|
156
156
|
*/
|
|
157
157
|
export declare function flat<A extends any[], D extends number = 1>(arr: A, depth?: number): FlatArray<A, D>[];
|
package/dist/utils.js
CHANGED
|
@@ -219,11 +219,11 @@ export function makeByXFunction(source) {
|
|
|
219
219
|
* Flattens an array. Basically replacing Array.prototype.flat for which Rhino doesn't yet have an implementation
|
|
220
220
|
*
|
|
221
221
|
* @param arr Array to flatten
|
|
222
|
-
* @param depth
|
|
222
|
+
* @param depth Number of layers to flatten by; Infinity for a fully flat array
|
|
223
223
|
* @returns Flattened array
|
|
224
224
|
*/
|
|
225
225
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
226
|
-
export function flat(arr, depth =
|
|
226
|
+
export function flat(arr, depth = Infinity) {
|
|
227
227
|
let flatArray = [];
|
|
228
228
|
for (const item of arr) {
|
|
229
229
|
if (Array.isArray(item) && depth > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libram",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.17",
|
|
4
4
|
"description": "JavaScript helper library for KoLmafia",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"private": false,
|
|
11
11
|
"scripts": {
|
|
12
|
-
"build": "yarn run build:tsc && yarn run build:bundled",
|
|
12
|
+
"build": "yarn run updateOverlappingItemSkillNames && yarn run build:tsc && yarn run build:bundled",
|
|
13
13
|
"build:tsc": "tsc",
|
|
14
14
|
"build:bundled": "node build.mjs",
|
|
15
15
|
"clean": "rm -rf dist",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"format": "yarn run prettier --write .",
|
|
18
18
|
"lint": "yarn run eslint src tools --ext .ts && yarn run prettier --check .",
|
|
19
19
|
"prepublishOnly": "yarn run build",
|
|
20
|
-
"updateProps": "yarn run ts-node ./tools/parseDefaultProperties.ts"
|
|
20
|
+
"updateProps": "yarn run ts-node ./tools/parseDefaultProperties.ts",
|
|
21
|
+
"updateOverlappingItemSkillNames": "yarn run ts-node ./tools/parseItemSkillNames.ts"
|
|
21
22
|
},
|
|
22
23
|
"files": [
|
|
23
24
|
"dist/**/*.js",
|
|
@@ -45,11 +46,11 @@
|
|
|
45
46
|
"eslint-plugin-import": "^2.25.4",
|
|
46
47
|
"eslint-plugin-jest": "^25.2.3",
|
|
47
48
|
"eslint-plugin-jsdoc": "^40.0.1",
|
|
48
|
-
"eslint-plugin-libram": "^0.2.
|
|
49
|
+
"eslint-plugin-libram": "^0.2.30",
|
|
49
50
|
"husky": "^4.3.6",
|
|
50
51
|
"java-parser": "^1.4.0",
|
|
51
52
|
"jest": "^27.1.0",
|
|
52
|
-
"kolmafia": "^5.
|
|
53
|
+
"kolmafia": "^5.27321.0",
|
|
53
54
|
"lint-staged": ">=10",
|
|
54
55
|
"node-fetch": "^2.6.1",
|
|
55
56
|
"prettier": "^2.1.2",
|