libram 0.7.1 → 0.7.2
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 +6 -1
- package/dist/ascend.js +27 -9
- package/dist/challengePaths/2016/NuclearAutumn.d.ts +12 -0
- package/dist/challengePaths/2016/NuclearAutumn.js +19 -0
- package/dist/challengePaths/index.d.ts +2 -1
- package/dist/challengePaths/index.js +2 -1
- package/dist/diet/index.js +18 -8
- package/dist/lib.js +3 -0
- package/dist/maximize.js +50 -3
- package/dist/propertyTypes.d.ts +4 -4
- package/dist/propertyTypes.js +4 -4
- package/dist/resources/2008/Stickers.d.ts +21 -0
- package/dist/resources/2008/Stickers.js +57 -0
- package/dist/resources/2013/Florist.d.ts +1 -0
- package/dist/resources/2013/Florist.js +8 -3
- package/dist/resources/2015/BarrelShrine.d.ts +2 -0
- package/dist/resources/2015/BarrelShrine.js +18 -0
- package/dist/resources/2015/Dinseylandfill.d.ts +44 -0
- package/dist/resources/2015/Dinseylandfill.js +152 -0
- package/dist/resources/2017/AsdonMartin.js +18 -11
- package/dist/resources/2017/Spacegate.d.ts +19 -0
- package/dist/resources/2017/Spacegate.js +90 -0
- package/dist/resources/2022/AutumnAton.d.ts +59 -0
- package/dist/resources/2022/AutumnAton.js +128 -0
- package/dist/resources/index.d.ts +7 -1
- package/dist/resources/index.js +7 -1
- package/package.json +4 -4
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { indexOf, myAdventures, myAscensions, runChoice, visitUrl, } from "kolmafia";
|
|
2
|
+
import { getRemainingLiver, have as haveItem } from "../../lib";
|
|
3
|
+
import { get, set } from "../../property";
|
|
4
|
+
import { $item, $location } from "../../template-string";
|
|
5
|
+
export function have() {
|
|
6
|
+
return get("stenchAirportAlways");
|
|
7
|
+
}
|
|
8
|
+
export function available() {
|
|
9
|
+
return have() || get("_stenchAirportToday");
|
|
10
|
+
}
|
|
11
|
+
class QuestData {
|
|
12
|
+
name;
|
|
13
|
+
priority;
|
|
14
|
+
questNameKiosk;
|
|
15
|
+
questNameQuestLog;
|
|
16
|
+
questStateProperty;
|
|
17
|
+
questProgressProperty;
|
|
18
|
+
questProgressLimit;
|
|
19
|
+
canUseWanderers;
|
|
20
|
+
requiredItem;
|
|
21
|
+
questLocation;
|
|
22
|
+
/**
|
|
23
|
+
* Process for determining where to put a wanderer to extract additional value from it
|
|
24
|
+
* @param name easy to refer to name of the quest
|
|
25
|
+
* @param priority ranked preference of quests
|
|
26
|
+
* @param questNameKiosk returns the name of the quest as found at the dinseylandfill Job Kiosk
|
|
27
|
+
* @param questNameQuestLog returns the name of the quest as found in the quest log
|
|
28
|
+
* @param questStateProperty name of the mafia property tracing the current state of the quest (e.g. unstarted, step[x], finished)
|
|
29
|
+
* @param questProgressProperty name of the mafia property that tracks progress of the current quest state
|
|
30
|
+
* @param questProgressLimit Maximum questProgressProperty can reach
|
|
31
|
+
* @param canUseWanderers whether wandering monsters can be used to progress the quest
|
|
32
|
+
* @param requiredItem the required item (if any) needed to be equipped to progress the quest
|
|
33
|
+
* @param questLocation where to adventure to progress the quest
|
|
34
|
+
*/
|
|
35
|
+
constructor(name, priority, questNameKiosk, questNameQuestLog, questStateProperty, questProgressProperty, questProgressLimit, canUseWanderers, requiredItem, questLocation) {
|
|
36
|
+
this.name = name;
|
|
37
|
+
this.priority = priority;
|
|
38
|
+
this.questNameKiosk = questNameKiosk;
|
|
39
|
+
this.questNameQuestLog = questNameQuestLog;
|
|
40
|
+
this.questStateProperty = questStateProperty;
|
|
41
|
+
this.questProgressProperty = questProgressProperty;
|
|
42
|
+
this.questProgressLimit = questProgressLimit;
|
|
43
|
+
this.canUseWanderers = canUseWanderers;
|
|
44
|
+
this.requiredItem = requiredItem;
|
|
45
|
+
this.questLocation = questLocation;
|
|
46
|
+
}
|
|
47
|
+
currentQuest() {
|
|
48
|
+
return get(this.questStateProperty) !== "unstarted";
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const kioskUrl = "place.php?whichplace=airport_stench&action=airport3_kiosk";
|
|
52
|
+
const maintUrl = "place.php?whichplace=airport_stench&action=airport3_tunnels";
|
|
53
|
+
export const quests = [
|
|
54
|
+
new QuestData("lube", 1, "Track Maintenance", "Super Luber", "questEStSuperLuber", "", 0, false, $item `lube-shoes`, $location `Barf Mountain`),
|
|
55
|
+
new QuestData("fuel", 0, "Electrical Maintenance", "Give Me Fuel", "questEStGiveMeFuel", "", 0, false, $item `none`, $location `The Toxic Teacups`),
|
|
56
|
+
new QuestData("sexism", 2, "Sexism Reduction", "Social Justice Adventurer I", "questEStSocialJusticeI", "dinseySocialJusticeIProgress", 15, true, $item `none`, $location `Pirates of the Garbage Barges`),
|
|
57
|
+
new QuestData("racism", 3, "Racism Reduction", "Social Justice Adventurer II", "questEStSocialJusticeII", "dinseySocialJusticeIIProgress", 15, true, $item `none`, $location `Uncle Gator's Country Fun-Time Liquid Waste Sluice`),
|
|
58
|
+
new QuestData("fun", 4, "Compulsory Fun", "Whistling Zippity-Doo-Dah", "questEStZippityDooDah", "dinseyFunProgress", 15, true, $item `Dinsey mascot mask`, $location `The Toxic Teacups`),
|
|
59
|
+
new QuestData("trash", 6, "Waterway Debris Removal", "Teach a Man to Fish Trash", "questEStFishTrash", "dinseyFilthLevel", 0, true, $item `trash net`, $location `Pirates of the Garbage Barges`),
|
|
60
|
+
new QuestData("bear", 5, "Bear Removal", "Nasty, Nasty Bears", "questEStNastyBears", "dinseyNastyBearsDefeated", 8, false, $item `none`, $location `Uncle Gator's Country Fun-Time Liquid Waste Sluice`),
|
|
61
|
+
new QuestData("food", 7, "Guest Sustenance Assurance", "Will Work With Food", "questEStWorkWithFood", "dinseyTouristsFed", 30, false, $item `none`, $location `Barf Mountain`),
|
|
62
|
+
];
|
|
63
|
+
export function disposeGarbage() {
|
|
64
|
+
if (!get("_dinseyGarbageDisposed") && haveItem($item `bag of park garbage`)) {
|
|
65
|
+
visitUrl(maintUrl);
|
|
66
|
+
runChoice(6);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export function hasQuest() {
|
|
70
|
+
return quests.some((q) => q.currentQuest());
|
|
71
|
+
}
|
|
72
|
+
const BLANK_QUEST = new QuestData("", -1, "", "", "", "", -1, false, $item `none`, $location `none`);
|
|
73
|
+
export function activeQuest() {
|
|
74
|
+
return quests.find((q) => q.currentQuest()) || BLANK_QUEST;
|
|
75
|
+
}
|
|
76
|
+
export function questComplete() {
|
|
77
|
+
const quest = activeQuest();
|
|
78
|
+
return quest !== BLANK_QUEST && get(quest.questStateProperty) === "finished";
|
|
79
|
+
}
|
|
80
|
+
export function hasActiveQuest() {
|
|
81
|
+
return hasQuest() && !questComplete();
|
|
82
|
+
}
|
|
83
|
+
export function acceptQuest(priority) {
|
|
84
|
+
const page = visitUrl(kioskUrl);
|
|
85
|
+
let choice = 6;
|
|
86
|
+
const at = indexOf(page, "Available Assignments");
|
|
87
|
+
if (at == -1) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const jobs = [];
|
|
91
|
+
quests.forEach((quest) => {
|
|
92
|
+
jobs.push(quest.name);
|
|
93
|
+
});
|
|
94
|
+
const priorityNum = typeof priority === "string"
|
|
95
|
+
? quests.find((q) => q.name === priority)?.priority ?? 7
|
|
96
|
+
: priority;
|
|
97
|
+
const availableJobs = [];
|
|
98
|
+
const jobChoices = [["none", 999]];
|
|
99
|
+
for (const quest of quests) {
|
|
100
|
+
const job = quest.name;
|
|
101
|
+
const jobAt = indexOf(page, job, at);
|
|
102
|
+
if (jobAt != -1) {
|
|
103
|
+
availableJobs.push(quest);
|
|
104
|
+
jobChoices.push([job, jobAt]);
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const bestJob = availableJobs.sort((a, b) => a.priority - b.priority)[0];
|
|
109
|
+
const sortedChoices = jobChoices.sort((a, b) => a[1] - b[1]);
|
|
110
|
+
if (bestJob.priority <= priorityNum) {
|
|
111
|
+
for (const index in sortedChoices) {
|
|
112
|
+
const jobName = sortedChoices[index][0];
|
|
113
|
+
if (jobName === bestJob.name) {
|
|
114
|
+
choice = parseInt(index) + 1;
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
runChoice(choice);
|
|
120
|
+
}
|
|
121
|
+
export function turnInQuest() {
|
|
122
|
+
if (questComplete()) {
|
|
123
|
+
if (activeQuest().name === "racism")
|
|
124
|
+
set("questEStSocialJusticeI", "unstarted");
|
|
125
|
+
visitUrl(kioskUrl);
|
|
126
|
+
runChoice(3);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
export const keyCardsLocations = new Map([
|
|
130
|
+
[$item `keycard α`, $location `Barf Mountain`],
|
|
131
|
+
[$item `keycard β`, $location `Pirates of the Garbage Barges`],
|
|
132
|
+
[$item `keycard γ`, $location `The Toxic Teacups`],
|
|
133
|
+
[
|
|
134
|
+
$item `keycard δ`,
|
|
135
|
+
$location `Uncle Gator's Country Fun-Time Liquid Waste Sluice`,
|
|
136
|
+
],
|
|
137
|
+
]);
|
|
138
|
+
export function canFightWartDinsey() {
|
|
139
|
+
return (Array.from(keyCardsLocations.keys()).every((keycard) => haveItem(keycard)) &&
|
|
140
|
+
!foughtWartDinseyThisLife() &&
|
|
141
|
+
getRemainingLiver() >= 0 &&
|
|
142
|
+
myAdventures() > 0);
|
|
143
|
+
}
|
|
144
|
+
export function coasterNextTurn() {
|
|
145
|
+
return get("dinseyRollercoasterNext");
|
|
146
|
+
}
|
|
147
|
+
export function foughtWartDinseyThisLife() {
|
|
148
|
+
return get("lastWartDinseyDefeated") === myAscensions();
|
|
149
|
+
}
|
|
150
|
+
export function hasDisposedGarbage() {
|
|
151
|
+
return get("_dinseyGarbageDisposed");
|
|
152
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "core-js/modules/es.object.values";
|
|
2
2
|
import { autosellPrice, canInteract, cliExecute, getFuel, getWorkshed, haveEffect, historicalAge, historicalPrice, isNpcItem, Item, itemAmount, mallPrice, mallPrices, retrieveItem, toInt, visitUrl, } from "kolmafia";
|
|
3
3
|
import { getAverageAdventures, have as haveItem } from "../../lib";
|
|
4
|
+
import { PropertiesManager } from "../../property";
|
|
4
5
|
import { $effect, $item, $items } from "../../template-string";
|
|
5
6
|
import { clamp } from "../../utils";
|
|
6
7
|
var PriceAge;
|
|
@@ -68,10 +69,10 @@ function isFuelItem(it) {
|
|
|
68
69
|
it.discardable &&
|
|
69
70
|
!fuelSkiplist.includes(it));
|
|
70
71
|
}
|
|
71
|
-
function
|
|
72
|
+
function getBestFuels(targetUnits) {
|
|
72
73
|
// Three stages.
|
|
73
74
|
// 1. Filter to reasonable items using historical cost (within 5x of historical best).
|
|
74
|
-
const allFuel =
|
|
75
|
+
const allFuel = Item.all().filter(isFuelItem);
|
|
75
76
|
if (allFuel.filter((item) => historicalPrice(item) === 0).length > 100) {
|
|
76
77
|
mallPrices("food");
|
|
77
78
|
mallPrices("booze");
|
|
@@ -98,7 +99,7 @@ function getBestFuel(targetUnits) {
|
|
|
98
99
|
throw new Error("Could not identify any fuel with efficiency better than 100 meat per fuel. " +
|
|
99
100
|
"This means something went wrong.");
|
|
100
101
|
}
|
|
101
|
-
return candidates
|
|
102
|
+
return candidates;
|
|
102
103
|
}
|
|
103
104
|
/**
|
|
104
105
|
* Fuel your Asdon Martin with a given quantity of a given item
|
|
@@ -118,20 +119,26 @@ export function insertFuel(it, quantity = 1) {
|
|
|
118
119
|
export function fillTo(targetUnits) {
|
|
119
120
|
if (!installed())
|
|
120
121
|
return false;
|
|
122
|
+
const manager = new PropertiesManager();
|
|
121
123
|
while (getFuel() < targetUnits) {
|
|
122
124
|
const remaining = targetUnits - getFuel();
|
|
123
125
|
// if in Hardcore/ronin, skip the price calculation and just use soda bread
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
126
|
+
const [bestFuel, secondBest] = canInteract()
|
|
127
|
+
? getBestFuels(remaining)
|
|
128
|
+
: [$item `loaf of soda bread`, undefined];
|
|
129
|
+
const count = Math.ceil(targetUnits / getAverageAdventures(bestFuel));
|
|
130
|
+
if (secondBest) {
|
|
131
|
+
const efficiencyOfSecondBest = mallPrice(secondBest) / getAverageAdventures(secondBest);
|
|
132
|
+
const ceiling = Math.ceil(efficiencyOfSecondBest * getAverageAdventures(bestFuel));
|
|
133
|
+
manager.setMaximumValue("autoBuyPriceLimit", ceiling);
|
|
134
|
+
}
|
|
135
|
+
retrieveItem(count, bestFuel);
|
|
136
|
+
if (!insertFuel(bestFuel, Math.min(itemAmount(bestFuel), count))) {
|
|
137
|
+
manager.resetAll();
|
|
132
138
|
throw new Error("Failed to fuel Asdon Martin.");
|
|
133
139
|
}
|
|
134
140
|
}
|
|
141
|
+
manager.resetAll();
|
|
135
142
|
return getFuel() >= targetUnits;
|
|
136
143
|
}
|
|
137
144
|
function fillWithBestInventoryItem(targetUnits) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Item } from "kolmafia";
|
|
2
|
+
export declare function have(): boolean;
|
|
3
|
+
export declare function updateStatus(): void;
|
|
4
|
+
export declare function dialled(): boolean;
|
|
5
|
+
export declare function hazards(): string;
|
|
6
|
+
export declare function planetName(): string;
|
|
7
|
+
export declare function planetCoords(): string;
|
|
8
|
+
export declare function plantLife(): string;
|
|
9
|
+
export declare function animalLife(): string;
|
|
10
|
+
export declare function intelligentLife(): string;
|
|
11
|
+
export declare function ruins(): boolean;
|
|
12
|
+
export declare function spants(): boolean;
|
|
13
|
+
export declare function murderBots(): boolean;
|
|
14
|
+
export declare function hazardEquipment(hazards: string): Item[];
|
|
15
|
+
export declare function getHazardEquipment(): void;
|
|
16
|
+
declare type Vaccine = "Rainbow" | "Broad-Spectrum" | "Emotional" | "Elemental Resistance" | "Stats" | "Monster Level";
|
|
17
|
+
export declare function getVaccine(choice: Vaccine): void;
|
|
18
|
+
export declare function dial(address: string): void;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { cliExecute, toInt, visitUrl } from "kolmafia";
|
|
2
|
+
import { get } from "../../property";
|
|
3
|
+
import { $item } from "../../template-string";
|
|
4
|
+
export function have() {
|
|
5
|
+
return get("spacegateAlways") || get("_spacegateToday");
|
|
6
|
+
}
|
|
7
|
+
export function updateStatus() {
|
|
8
|
+
visitUrl("place.php?whichplace=spacegate&action=sg_Terminal");
|
|
9
|
+
}
|
|
10
|
+
export function dialled() {
|
|
11
|
+
updateStatus();
|
|
12
|
+
return get("_spacegateCoordinates") !== "";
|
|
13
|
+
}
|
|
14
|
+
export function hazards() {
|
|
15
|
+
return get("_spacegateHazards");
|
|
16
|
+
}
|
|
17
|
+
export function planetName() {
|
|
18
|
+
return get("_spacegatePlanetName");
|
|
19
|
+
}
|
|
20
|
+
export function planetCoords() {
|
|
21
|
+
return get("_spacegateCoordinates");
|
|
22
|
+
}
|
|
23
|
+
export function plantLife() {
|
|
24
|
+
return get("_spacegatePlantLife");
|
|
25
|
+
}
|
|
26
|
+
export function animalLife() {
|
|
27
|
+
return get("_spacegateAnimalLife");
|
|
28
|
+
}
|
|
29
|
+
export function intelligentLife() {
|
|
30
|
+
return get("_spacegateIntelligentLife");
|
|
31
|
+
}
|
|
32
|
+
export function ruins() {
|
|
33
|
+
return get("_spacegateRuins");
|
|
34
|
+
}
|
|
35
|
+
export function spants() {
|
|
36
|
+
return get("_spacegateSpant");
|
|
37
|
+
}
|
|
38
|
+
export function murderBots() {
|
|
39
|
+
return get("_spacegateMurderbot");
|
|
40
|
+
}
|
|
41
|
+
export function hazardEquipment(hazards) {
|
|
42
|
+
const hazardEquipment = {
|
|
43
|
+
"toxic atmosphere": $item `filter helmet`,
|
|
44
|
+
"high gravity": $item `exo-servo leg braces`,
|
|
45
|
+
irradiated: $item `rad cloak`,
|
|
46
|
+
"magnetic storms": $item `gate transceiver`,
|
|
47
|
+
"high winds": $item `high-friction boots`,
|
|
48
|
+
};
|
|
49
|
+
return Object.entries(hazardEquipment)
|
|
50
|
+
.filter(([clue]) => hazards.includes(clue))
|
|
51
|
+
.map(([, item]) => item);
|
|
52
|
+
}
|
|
53
|
+
export function getHazardEquipment() {
|
|
54
|
+
const equipment = hazardEquipment(hazards());
|
|
55
|
+
equipment.forEach((equip) => {
|
|
56
|
+
const num = toInt(equip) - 9404; //Equipment items are 9405 - 9409,
|
|
57
|
+
visitUrl("place.php?whichplace=spacegate&action=sg_requisition");
|
|
58
|
+
visitUrl(`choice.php?whichchoice=1233&option=${num}`);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
export function getVaccine(choice) {
|
|
62
|
+
if (get("_spacegateVaccine")) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const nums = {
|
|
66
|
+
Rainbow: 1,
|
|
67
|
+
"Elemental Resistance": 1,
|
|
68
|
+
"Broad-Spectrum": 2,
|
|
69
|
+
Stats: 2,
|
|
70
|
+
Emotional: 3,
|
|
71
|
+
"Monster Level": 3,
|
|
72
|
+
};
|
|
73
|
+
const num = nums[choice];
|
|
74
|
+
if (!get(`spacegateVaccine${num}`)) {
|
|
75
|
+
throw "You don't appear to have that Vaccine Unlocked!";
|
|
76
|
+
}
|
|
77
|
+
cliExecute(`spacegate vaccine ${num}`);
|
|
78
|
+
}
|
|
79
|
+
export function dial(address) {
|
|
80
|
+
if (!have() || dialled()) {
|
|
81
|
+
//cannot dial if we already have or don't own it.
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (!address.match(`^[[alpha]]+$`) || address.length !== 7) {
|
|
85
|
+
throw "Invalid Spacegate Address - must be exactly 7 alphabetic characters";
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
cliExecute(`spacegate destination ${address}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Item, Location } from "kolmafia";
|
|
2
|
+
export declare const item: Item;
|
|
3
|
+
/**
|
|
4
|
+
* Is the autumn-aton currently in your inventory, available to deploy?
|
|
5
|
+
*/
|
|
6
|
+
export declare function available(): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Do you own the autumn-aton?
|
|
9
|
+
*/
|
|
10
|
+
export declare function have(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* @returns The current location the autumn-aton is questing in; null if it is not on a quest.
|
|
13
|
+
*/
|
|
14
|
+
export declare function currentlyIn(): Location | null;
|
|
15
|
+
/**
|
|
16
|
+
* Deploy the autumn-aton to a location of your choosing.
|
|
17
|
+
* @param target A location to send the autumn-aton to, or a prioritized list of locations to send it to, or a function to pick which location to send it to.
|
|
18
|
+
* @param upgrade Should we apply any upgrades we see available?
|
|
19
|
+
* @returns Where we ended up sending the autumn-aton; null if we didn't send it off.
|
|
20
|
+
*/
|
|
21
|
+
export declare function sendTo(target: Location | Location[] | ((locations: Location[]) => Location), upgrade?: boolean): Location | null;
|
|
22
|
+
/**
|
|
23
|
+
* Install any available upgrades for the autumn-aton.
|
|
24
|
+
* @returns Whether there were any upgrades to install.
|
|
25
|
+
*/
|
|
26
|
+
export declare function upgrade(): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* @returns A list of all locations you can send your autumn-aton to right now. Empty if you are unable to send it anywhere.
|
|
29
|
+
*/
|
|
30
|
+
export declare function availableLocations(): Location[];
|
|
31
|
+
/**
|
|
32
|
+
* The mafia names for the autumn-aton upgrades
|
|
33
|
+
*/
|
|
34
|
+
export declare const possibleUpgrades: readonly ["leftarm1", "leftleg1", "rightarm1", "rightleg1", "base_blackhat", "cowcatcher", "periscope", "radardish", "dualexhaust"];
|
|
35
|
+
export declare type Upgrade = typeof possibleUpgrades[number];
|
|
36
|
+
/**
|
|
37
|
+
* @returns An array containing the upgrades that you currently have on your autumn-aton.
|
|
38
|
+
*/
|
|
39
|
+
export declare function currentUpgrades(): Upgrade[];
|
|
40
|
+
/**
|
|
41
|
+
* @returns The number of turns remaining in your current autumn-aton quest. This number may be negative for any number of reasons.
|
|
42
|
+
*/
|
|
43
|
+
export declare function turnsLeft(): number;
|
|
44
|
+
/**
|
|
45
|
+
* @returns The number of turns we expect your next autumn-aton quest to take.
|
|
46
|
+
*/
|
|
47
|
+
export declare function turnsForQuest(): number;
|
|
48
|
+
/**
|
|
49
|
+
* @returns The current visual acuity level of your autumn-aton as determined by the current upgrade-state.
|
|
50
|
+
*/
|
|
51
|
+
export declare function visualAcuity(): 1 | 2 | 3;
|
|
52
|
+
/**
|
|
53
|
+
* @returns The number of items from a zone we expect the autumn-aton to steal based on the current upgrade-state. It may not succeed in stealing every item it can.
|
|
54
|
+
*/
|
|
55
|
+
export declare function zoneItems(): 3 | 4 | 5;
|
|
56
|
+
/**
|
|
57
|
+
* @returns The number of seasonal items we expect the autumn-aton to return with given its current upgrade-state.
|
|
58
|
+
*/
|
|
59
|
+
export declare function seasonalItems(): 1 | 2;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { availableAmount, availableChoiceOptions, handlingChoice, Item, Location, runChoice, toLocation, totalTurnsPlayed, visitUrl, xpath, } from "kolmafia";
|
|
2
|
+
import { get } from "../../property";
|
|
3
|
+
export const item = Item.get("autumn-aton");
|
|
4
|
+
/**
|
|
5
|
+
* Is the autumn-aton currently in your inventory, available to deploy?
|
|
6
|
+
*/
|
|
7
|
+
export function available() {
|
|
8
|
+
return availableAmount(item) > 0;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Do you own the autumn-aton?
|
|
12
|
+
*/
|
|
13
|
+
export function have() {
|
|
14
|
+
return get("hasAutumnaton") || available();
|
|
15
|
+
}
|
|
16
|
+
function checkLocations(html) {
|
|
17
|
+
return xpath(html, '//select[@name="heythereprogrammer"]//option[position()>1]/text()').map((name) => toLocation(name));
|
|
18
|
+
}
|
|
19
|
+
const use = () => visitUrl("inv_use.php?pwd&whichitem=10954");
|
|
20
|
+
/**
|
|
21
|
+
* @returns The current location the autumn-aton is questing in; null if it is not on a quest.
|
|
22
|
+
*/
|
|
23
|
+
export function currentlyIn() {
|
|
24
|
+
return get("autumnatonQuestLocation");
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Deploy the autumn-aton to a location of your choosing.
|
|
28
|
+
* @param target A location to send the autumn-aton to, or a prioritized list of locations to send it to, or a function to pick which location to send it to.
|
|
29
|
+
* @param upgrade Should we apply any upgrades we see available?
|
|
30
|
+
* @returns Where we ended up sending the autumn-aton; null if we didn't send it off.
|
|
31
|
+
*/
|
|
32
|
+
export function sendTo(target, upgrade = true) {
|
|
33
|
+
if (!available())
|
|
34
|
+
return null;
|
|
35
|
+
const pageHtml = use();
|
|
36
|
+
if (upgrade && availableChoiceOptions()[1])
|
|
37
|
+
runChoice(1);
|
|
38
|
+
const locationsAvailable = checkLocations(pageHtml);
|
|
39
|
+
const location = target instanceof Location
|
|
40
|
+
? target
|
|
41
|
+
: Array.isArray(target)
|
|
42
|
+
? target.find((l) => locationsAvailable.includes(l))
|
|
43
|
+
: target(locationsAvailable);
|
|
44
|
+
if (!location)
|
|
45
|
+
return null;
|
|
46
|
+
if (!locationsAvailable.includes(location))
|
|
47
|
+
return null;
|
|
48
|
+
runChoice(2, `heythereprogrammer=${location.id}`);
|
|
49
|
+
if (handlingChoice())
|
|
50
|
+
runChoice(3);
|
|
51
|
+
return location;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Install any available upgrades for the autumn-aton.
|
|
55
|
+
* @returns Whether there were any upgrades to install.
|
|
56
|
+
*/
|
|
57
|
+
export function upgrade() {
|
|
58
|
+
use();
|
|
59
|
+
const canUpgrade = availableChoiceOptions()[1] !== undefined;
|
|
60
|
+
if (canUpgrade)
|
|
61
|
+
runChoice(1);
|
|
62
|
+
runChoice(3);
|
|
63
|
+
return canUpgrade;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @returns A list of all locations you can send your autumn-aton to right now. Empty if you are unable to send it anywhere.
|
|
67
|
+
*/
|
|
68
|
+
export function availableLocations() {
|
|
69
|
+
if (!available())
|
|
70
|
+
return [];
|
|
71
|
+
const pageHtml = use();
|
|
72
|
+
runChoice(3);
|
|
73
|
+
return checkLocations(pageHtml);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The mafia names for the autumn-aton upgrades
|
|
77
|
+
*/
|
|
78
|
+
export const possibleUpgrades = [
|
|
79
|
+
"leftarm1",
|
|
80
|
+
"leftleg1",
|
|
81
|
+
"rightarm1",
|
|
82
|
+
"rightleg1",
|
|
83
|
+
"base_blackhat",
|
|
84
|
+
"cowcatcher",
|
|
85
|
+
"periscope",
|
|
86
|
+
"radardish",
|
|
87
|
+
"dualexhaust",
|
|
88
|
+
];
|
|
89
|
+
/**
|
|
90
|
+
* @returns An array containing the upgrades that you currently have on your autumn-aton.
|
|
91
|
+
*/
|
|
92
|
+
export function currentUpgrades() {
|
|
93
|
+
return get("autumnatonUpgrades").split(",");
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* @returns The number of turns remaining in your current autumn-aton quest. This number may be negative for any number of reasons.
|
|
97
|
+
*/
|
|
98
|
+
export function turnsLeft() {
|
|
99
|
+
return get("autumnatonQuestTurn") - totalTurnsPlayed();
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* @returns The number of turns we expect your next autumn-aton quest to take.
|
|
103
|
+
*/
|
|
104
|
+
export function turnsForQuest() {
|
|
105
|
+
return (11 *
|
|
106
|
+
Math.max(1, get("_autumnatonQuests") -
|
|
107
|
+
currentUpgrades().filter((u) => u.includes("leg")).length));
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* @returns The current visual acuity level of your autumn-aton as determined by the current upgrade-state.
|
|
111
|
+
*/
|
|
112
|
+
export function visualAcuity() {
|
|
113
|
+
const visualUpgrades = ["periscope", "radardish"];
|
|
114
|
+
return (1 +
|
|
115
|
+
currentUpgrades().filter((u) => visualUpgrades.includes(u)).length);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* @returns The number of items from a zone we expect the autumn-aton to steal based on the current upgrade-state. It may not succeed in stealing every item it can.
|
|
119
|
+
*/
|
|
120
|
+
export function zoneItems() {
|
|
121
|
+
return (3 + currentUpgrades().filter((u) => u.includes("arm")).length);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* @returns The number of seasonal items we expect the autumn-aton to return with given its current upgrade-state.
|
|
125
|
+
*/
|
|
126
|
+
export function seasonalItems() {
|
|
127
|
+
return currentUpgrades().includes("cowcatcher") ? 2 : 1;
|
|
128
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as Stickers from "./2008/Stickers";
|
|
1
2
|
import * as Bandersnatch from "./2009/Bandersnatch";
|
|
2
3
|
import * as SpookyPutty from "./2009/SpookyPutty";
|
|
3
4
|
import * as CrownOfThrones from "./2010/CrownOfThrones";
|
|
@@ -8,7 +9,9 @@ import * as FloristFriar from "./2013/Florist";
|
|
|
8
9
|
import * as CrimboShrub from "./2014/CrimboShrub";
|
|
9
10
|
import * as DNALab from "./2014/DNALab";
|
|
10
11
|
import * as WinterGarden from "./2014/WinterGarden";
|
|
12
|
+
import * as BarrelShrine from "./2015/BarrelShrine";
|
|
11
13
|
import * as ChateauMantegna from "./2015/ChateauMantegna";
|
|
14
|
+
import * as Dinseylandfill from "./2015/Dinseylandfill";
|
|
12
15
|
import * as MayoClinic from "./2015/MayoClinic";
|
|
13
16
|
import * as SourceTerminal from "./2016/SourceTerminal";
|
|
14
17
|
import * as Witchess from "./2016/Witchess";
|
|
@@ -16,18 +19,21 @@ import * as AsdonMartin from "./2017/AsdonMartin";
|
|
|
16
19
|
import * as MummingTrunk from "./2017/MummingTrunk";
|
|
17
20
|
import * as Pantogram from "./2017/Pantogram";
|
|
18
21
|
import * as Robortender from "./2017/Robortender";
|
|
22
|
+
import * as Spacegate from "./2017/Spacegate";
|
|
19
23
|
import * as TunnelOfLove from "./2017/TunnelOfLove";
|
|
20
24
|
import * as Latte from "./2018/LatteLoversMembersMug";
|
|
21
25
|
import * as SongBoom from "./2018/SongBoom";
|
|
22
26
|
import * as BeachComb from "./2019/BeachComb";
|
|
23
27
|
import * as Snapper from "./2019/Snapper";
|
|
28
|
+
import * as Cartography from "./2020/Cartography";
|
|
24
29
|
import * as Guzzlr from "./2020/Guzzlr";
|
|
25
30
|
import * as RetroCape from "./2020/RetroCape";
|
|
26
31
|
import * as CrystalBall from "./2021/CrystalBall";
|
|
27
32
|
import * as DaylightShavings from "./2021/DaylightShavings";
|
|
33
|
+
import * as AutumnAton from "./2022/AutumnAton";
|
|
28
34
|
import * as CombatLoversLocket from "./2022/CombatLoversLocket";
|
|
29
35
|
import * as GreyGoose from "./2022/GreyGoose";
|
|
30
36
|
import * as JuneCleaver from "./2022/JuneCleaver";
|
|
31
|
-
export { AsdonMartin, Bandersnatch, BeachComb, ChateauMantegna, CombatLoversLocket, CrimboShrub, CrownOfThrones, CrystalBall, DaylightShavings, DNALab, FloristFriar, GreyGoose, Guzzlr, JuneCleaver, Latte, MayoClinic, MummingTrunk, ObtuseAngel, Pantogram, RainDoh, RetroCape, Robortender, Snapper, SongBoom, SourceTerminal, SpookyPutty, StompingBoots, TunnelOfLove, WinterGarden, Witchess, };
|
|
37
|
+
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, RetroCape, Robortender, Snapper, SongBoom, SourceTerminal, Spacegate, SpookyPutty, Stickers, StompingBoots, TunnelOfLove, WinterGarden, Witchess, };
|
|
32
38
|
export * from "./putty-likes";
|
|
33
39
|
export * from "./LibramSummon";
|
package/dist/resources/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as Stickers from "./2008/Stickers";
|
|
1
2
|
import * as Bandersnatch from "./2009/Bandersnatch";
|
|
2
3
|
import * as SpookyPutty from "./2009/SpookyPutty";
|
|
3
4
|
import * as CrownOfThrones from "./2010/CrownOfThrones";
|
|
@@ -8,7 +9,9 @@ import * as FloristFriar from "./2013/Florist";
|
|
|
8
9
|
import * as CrimboShrub from "./2014/CrimboShrub";
|
|
9
10
|
import * as DNALab from "./2014/DNALab";
|
|
10
11
|
import * as WinterGarden from "./2014/WinterGarden";
|
|
12
|
+
import * as BarrelShrine from "./2015/BarrelShrine";
|
|
11
13
|
import * as ChateauMantegna from "./2015/ChateauMantegna";
|
|
14
|
+
import * as Dinseylandfill from "./2015/Dinseylandfill";
|
|
12
15
|
import * as MayoClinic from "./2015/MayoClinic";
|
|
13
16
|
import * as SourceTerminal from "./2016/SourceTerminal";
|
|
14
17
|
import * as Witchess from "./2016/Witchess";
|
|
@@ -16,18 +19,21 @@ import * as AsdonMartin from "./2017/AsdonMartin";
|
|
|
16
19
|
import * as MummingTrunk from "./2017/MummingTrunk";
|
|
17
20
|
import * as Pantogram from "./2017/Pantogram";
|
|
18
21
|
import * as Robortender from "./2017/Robortender";
|
|
22
|
+
import * as Spacegate from "./2017/Spacegate";
|
|
19
23
|
import * as TunnelOfLove from "./2017/TunnelOfLove";
|
|
20
24
|
import * as Latte from "./2018/LatteLoversMembersMug";
|
|
21
25
|
import * as SongBoom from "./2018/SongBoom";
|
|
22
26
|
import * as BeachComb from "./2019/BeachComb";
|
|
23
27
|
import * as Snapper from "./2019/Snapper";
|
|
28
|
+
import * as Cartography from "./2020/Cartography";
|
|
24
29
|
import * as Guzzlr from "./2020/Guzzlr";
|
|
25
30
|
import * as RetroCape from "./2020/RetroCape";
|
|
26
31
|
import * as CrystalBall from "./2021/CrystalBall";
|
|
27
32
|
import * as DaylightShavings from "./2021/DaylightShavings";
|
|
33
|
+
import * as AutumnAton from "./2022/AutumnAton";
|
|
28
34
|
import * as CombatLoversLocket from "./2022/CombatLoversLocket";
|
|
29
35
|
import * as GreyGoose from "./2022/GreyGoose";
|
|
30
36
|
import * as JuneCleaver from "./2022/JuneCleaver";
|
|
31
|
-
export { AsdonMartin, Bandersnatch, BeachComb, ChateauMantegna, CombatLoversLocket, CrimboShrub, CrownOfThrones, CrystalBall, DaylightShavings, DNALab, FloristFriar, GreyGoose, Guzzlr, JuneCleaver, Latte, MayoClinic, MummingTrunk, ObtuseAngel, Pantogram, RainDoh, RetroCape, Robortender, Snapper, SongBoom, SourceTerminal, SpookyPutty, StompingBoots, TunnelOfLove, WinterGarden, Witchess, };
|
|
37
|
+
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, RetroCape, Robortender, Snapper, SongBoom, SourceTerminal, Spacegate, SpookyPutty, Stickers, StompingBoots, TunnelOfLove, WinterGarden, Witchess, };
|
|
32
38
|
export * from "./putty-likes";
|
|
33
39
|
export * from "./LibramSummon";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libram",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
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.
|
|
48
|
+
"eslint-plugin-libram": "^0.2.18",
|
|
49
49
|
"husky": "^4.3.6",
|
|
50
50
|
"java-parser": "^1.4.0",
|
|
51
51
|
"jest": "^27.1.0",
|
|
52
|
-
"kolmafia": "^
|
|
52
|
+
"kolmafia": "^5.26781.0",
|
|
53
53
|
"lint-staged": ">=10",
|
|
54
54
|
"node-fetch": "^2.6.1",
|
|
55
55
|
"prettier": "^2.1.2",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"lodash": "^4.17.21"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"kolmafia": "^
|
|
69
|
+
"kolmafia": "^5.26781.0"
|
|
70
70
|
},
|
|
71
71
|
"husky": {
|
|
72
72
|
"hooks": {
|