libram 0.6.2 → 0.6.6
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/Clan.d.ts +1 -0
- package/dist/Clan.js +1 -1
- package/dist/Copier.d.ts +1 -0
- package/dist/Kmail.d.ts +1 -0
- package/dist/Kmail.js +1 -1
- package/dist/Path.d.ts +1 -0
- package/dist/actions/ActionSource.d.ts +4 -3
- package/dist/actions/ActionSource.js +2 -2
- package/dist/actions/FreeKill.js +1 -1
- package/dist/actions/FreeRun.js +2 -2
- package/dist/ascend.d.ts +1 -0
- package/dist/ascend.js +2 -2
- package/dist/challengePaths/2015/CommunityService.d.ts +3 -1
- package/dist/challengePaths/2015/CommunityService.js +40 -24
- package/dist/combat.d.ts +2 -1
- package/dist/combat.js +8 -7
- package/dist/diet/index.d.ts +1 -0
- package/dist/diet/index.js +2 -2
- package/dist/dungeons/Dreadsylvania.d.ts +1 -0
- package/dist/dungeons/Dungeon.d.ts +1 -0
- package/dist/dungeons/Dungeon.js +1 -1
- package/dist/dungeons/Hobopolis.d.ts +1 -0
- package/dist/dungeons/SlimeTube.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/lib.d.ts +1 -0
- package/dist/lib.js +2 -2
- package/dist/maximize.d.ts +1 -0
- package/dist/maximize.js +2 -2
- package/dist/modifier.d.ts +1 -0
- package/dist/modifier.js +1 -1
- package/dist/mood.d.ts +1 -0
- package/dist/mood.js +9 -8
- package/dist/property.d.ts +56 -23
- package/dist/property.js +71 -33
- package/dist/propertyTypes.d.ts +18 -9
- package/dist/propertyTypes.js +10 -1
- package/dist/propertyTyping.d.ts +3 -3
- package/dist/propertyTyping.js +26 -41
- package/dist/resources/2007/CandyHearts.d.ts +2 -1
- package/dist/resources/2007/CandyHearts.js +1 -1
- package/dist/resources/2008/DivineFavors.d.ts +2 -1
- package/dist/resources/2008/DivineFavors.js +1 -1
- package/dist/resources/2009/Bandersnatch.d.ts +2 -1
- package/dist/resources/2009/Bandersnatch.js +1 -1
- package/dist/resources/2009/LoveSongs.d.ts +2 -1
- package/dist/resources/2009/LoveSongs.js +1 -1
- package/dist/resources/2009/SpookyPutty.d.ts +2 -1
- package/dist/resources/2010/Brickos.d.ts +2 -1
- package/dist/resources/2010/Brickos.js +1 -1
- package/dist/resources/2010/CrownOfThrones.d.ts +1 -0
- package/dist/resources/2010/LookingGlass.d.ts +25 -0
- package/dist/resources/2010/LookingGlass.js +85 -0
- package/dist/resources/2011/Gygaxian.d.ts +2 -1
- package/dist/resources/2011/Gygaxian.js +1 -1
- package/dist/resources/2011/ObtuseAngel.d.ts +2 -1
- package/dist/resources/2011/StompingBoots.d.ts +1 -1
- package/dist/resources/2011/StompingBoots.js +1 -1
- package/dist/resources/2012/RainDoh.d.ts +2 -1
- package/dist/resources/2012/Resolutions.d.ts +2 -1
- package/dist/resources/2012/Resolutions.js +1 -1
- package/dist/resources/2013/Florist.d.ts +1 -0
- package/dist/resources/2013/PulledTaffy.d.ts +2 -1
- package/dist/resources/2013/PulledTaffy.js +1 -1
- package/dist/resources/2014/DNALab.d.ts +1 -0
- package/dist/resources/2014/DNALab.js +3 -3
- package/dist/resources/2014/WinterGarden.d.ts +1 -0
- package/dist/resources/2014/WinterGarden.js +1 -1
- package/dist/resources/2015/ChateauMantegna.d.ts +1 -0
- package/dist/resources/2015/ChateauMantegna.js +1 -1
- package/dist/resources/2015/MayoClinic.d.ts +1 -0
- package/dist/resources/2016/SourceTerminal.d.ts +1 -0
- package/dist/resources/2016/SourceTerminal.js +1 -1
- package/dist/resources/2016/Witchess.d.ts +2 -1
- package/dist/resources/2016/Witchess.js +1 -1
- package/dist/resources/2017/AsdonMartin.d.ts +12 -4
- package/dist/resources/2017/AsdonMartin.js +39 -6
- package/dist/resources/2017/MummingTrunk.d.ts +7 -0
- package/dist/resources/2017/MummingTrunk.js +26 -0
- package/dist/resources/2017/Pantogram.d.ts +1 -0
- package/dist/resources/2017/Pantogram.js +1 -1
- package/dist/resources/2017/TunnelOfLove.d.ts +1 -0
- package/dist/resources/2018/LatteLoversMembersMug.d.ts +1 -0
- package/dist/resources/2018/SongBoom.d.ts +1 -1
- package/dist/resources/2019/BeachComb.d.ts +1 -0
- package/dist/resources/2019/Snapper.d.ts +1 -0
- package/dist/resources/2019/Snapper.js +1 -1
- package/dist/resources/2020/Guzzlr.d.ts +1 -0
- package/dist/resources/2020/Guzzlr.js +1 -1
- package/dist/resources/2021/CrystalBall.d.ts +1 -0
- package/dist/resources/2021/CrystalBall.js +1 -1
- package/dist/resources/2021/DaylightShavings.d.ts +3 -2
- package/dist/resources/2022/CombatLoversLocket.d.ts +36 -0
- package/dist/resources/2022/CombatLoversLocket.js +72 -0
- package/dist/resources/LibramSummon.d.ts +1 -0
- package/dist/resources/index.d.ts +20 -17
- package/dist/resources/index.js +20 -17
- package/dist/session.d.ts +1 -0
- package/dist/template-string.d.ts +1 -0
- package/dist/template-string.js +1 -0
- package/package.json +4 -3
package/dist/Clan.d.ts
CHANGED
package/dist/Clan.js
CHANGED
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { availableAmount, cliExecute, getClanId, getClanName, getPlayerId, putStash, refreshStash, retrieveItem, stashAmount, takeStash, visitUrl, xpath, } from "kolmafia";
|
|
7
|
+
import { availableAmount, cliExecute, getClanId, getClanName, getPlayerId, Monster, putStash, refreshStash, retrieveItem, stashAmount, takeStash, visitUrl, xpath, } from "kolmafia";
|
|
8
8
|
import { getFoldGroup } from "./lib";
|
|
9
9
|
import logger from "./logger";
|
|
10
10
|
import { arrayToCountedMap, countedMapToArray, countedMapToString, notNull, parseNumber, } from "./utils";
|
package/dist/Copier.d.ts
CHANGED
package/dist/Kmail.d.ts
CHANGED
package/dist/Kmail.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "core-js/modules/es.object.entries";
|
|
2
|
-
import { extractItems, extractMeat, isGiftable, toInt, visitUrl, } from "kolmafia";
|
|
2
|
+
import { extractItems, extractMeat, isGiftable, Item, toInt, visitUrl, } from "kolmafia";
|
|
3
3
|
import { arrayToCountedMap, chunk } from "./utils";
|
|
4
4
|
export default class Kmail {
|
|
5
5
|
id;
|
package/dist/Path.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Familiar, Item, Skill } from "kolmafia";
|
|
1
2
|
import { Macro } from "../combat";
|
|
2
3
|
import { Requirement } from "../maximize";
|
|
3
4
|
export declare type FindActionSourceConstraints = {
|
|
@@ -57,17 +58,17 @@ export declare type ActionConstraints = {
|
|
|
57
58
|
* A combat-based action resource in the game (e.g. a free run or free kill).
|
|
58
59
|
*/
|
|
59
60
|
export declare class ActionSource {
|
|
60
|
-
source: Item | Skill | Familiar
|
|
61
|
+
source: Item | Skill | Familiar | Array<Item | Skill | Familiar>;
|
|
61
62
|
potential: () => number;
|
|
62
63
|
macro: Macro;
|
|
63
64
|
constraints: ActionConstraints;
|
|
64
65
|
/**
|
|
65
|
-
* @param source Source of the action (e.g. item or
|
|
66
|
+
* @param source Source(s) of the action (e.g. item, skill, or familiar needed).
|
|
66
67
|
* @param potential Function returning how many times this action can be used.
|
|
67
68
|
* @param macro Macro to execute this action in combat.
|
|
68
69
|
* @param constraints Constraints required for this action to be available.
|
|
69
70
|
*/
|
|
70
|
-
constructor(source: Item | Skill | Familiar
|
|
71
|
+
constructor(source: Item | Skill | Familiar | Array<Item | Skill | Familiar>, potential: () => number, macro: Macro, constraints?: ActionConstraints);
|
|
71
72
|
/**
|
|
72
73
|
* @returns Name of the action source.
|
|
73
74
|
*/
|
|
@@ -35,7 +35,7 @@ export class ActionSource {
|
|
|
35
35
|
macro;
|
|
36
36
|
constraints;
|
|
37
37
|
/**
|
|
38
|
-
* @param source Source of the action (e.g. item or
|
|
38
|
+
* @param source Source(s) of the action (e.g. item, skill, or familiar needed).
|
|
39
39
|
* @param potential Function returning how many times this action can be used.
|
|
40
40
|
* @param macro Macro to execute this action in combat.
|
|
41
41
|
* @param constraints Constraints required for this action to be available.
|
|
@@ -88,7 +88,7 @@ export class ActionSource {
|
|
|
88
88
|
// Inconsistent constraints - no path forward here.
|
|
89
89
|
return null;
|
|
90
90
|
}
|
|
91
|
-
return new ActionSource(
|
|
91
|
+
return new ActionSource([...actions.map((action) => action.source).flat()], () => sum(actions, (action) => action.potential()), Macro.step(...actions.map((action) => action.macro)), constraints);
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
94
|
* Perform all preparation necessary to make this action available.
|
package/dist/actions/FreeKill.js
CHANGED
|
@@ -3,9 +3,9 @@ import { Macro } from "../combat";
|
|
|
3
3
|
import { have } from "../lib";
|
|
4
4
|
import { Requirement } from "../maximize";
|
|
5
5
|
import { get } from "../property";
|
|
6
|
+
import * as AsdonMartin from "../resources/2017/AsdonMartin";
|
|
6
7
|
import { $familiar, $item, $items, $skill } from "../template-string";
|
|
7
8
|
import { ActionSource, findActionSource, } from "./ActionSource";
|
|
8
|
-
import * as AsdonMartin from "../resources/2017/AsdonMartin";
|
|
9
9
|
const freeKillSources = [
|
|
10
10
|
// Free limited sources
|
|
11
11
|
new ActionSource($skill `Gingerbread Mob Hit`, () => !get("_gingerbreadMobHitUsed") && have($skill `Gingerbread Mob Hit`)
|
package/dist/actions/FreeRun.js
CHANGED
|
@@ -3,11 +3,11 @@ import { Macro } from "../combat";
|
|
|
3
3
|
import { ensureEffect, getFoldGroup, getSongCount, getSongLimit, have, } from "../lib";
|
|
4
4
|
import { Requirement } from "../maximize";
|
|
5
5
|
import { get } from "../property";
|
|
6
|
-
import { $effect, $item, $items, $skill } from "../template-string";
|
|
7
|
-
import { ActionSource, findActionSource, } from "./ActionSource";
|
|
8
6
|
import * as Bandersnatch from "../resources/2009/Bandersnatch";
|
|
9
7
|
import * as StompingBoots from "../resources/2011/StompingBoots";
|
|
10
8
|
import * as AsdonMartin from "../resources/2017/AsdonMartin";
|
|
9
|
+
import { $effect, $item, $items, $skill } from "../template-string";
|
|
10
|
+
import { ActionSource, findActionSource, } from "./ActionSource";
|
|
11
11
|
// Value of _lastCombatStarted the last time we updated scrapbook charges.
|
|
12
12
|
let scrapbookChargesLastUpdated = get("_lastCombatStarted");
|
|
13
13
|
// Free unlimited source every 30 turns.
|
package/dist/ascend.d.ts
CHANGED
package/dist/ascend.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { containsText, eudoraItem, getCampground, getWorkshed, toInt, toItem, use, visitUrl, xpath, } from "kolmafia";
|
|
2
|
-
import { $item, $items, $stat } from "./template-string";
|
|
1
|
+
import { containsText, eudoraItem, getCampground, getWorkshed, Item, toInt, toItem, use, visitUrl, xpath, } from "kolmafia";
|
|
3
2
|
import { ChateauMantegna } from "./resources";
|
|
3
|
+
import { $item, $items, $stat } from "./template-string";
|
|
4
4
|
export var Lifestyle;
|
|
5
5
|
(function (Lifestyle) {
|
|
6
6
|
Lifestyle[Lifestyle["casual"] = 1] = "casual";
|
|
@@ -56,9 +56,10 @@ declare class Test {
|
|
|
56
56
|
* Wrapper function that prepares for a test and then completes it, adding time and turn details to the log.
|
|
57
57
|
* @param prepare A function that does all necessary preparations for this CS test, including choosing your outfit.
|
|
58
58
|
* @param beCertain Whether we should check council.php instead of mafia to determine whether the test is complete.
|
|
59
|
+
* @param maxTurns We will run the test iff the predicted turns is less than or equal to this parameter.
|
|
59
60
|
* @returns The output of the prepare function given, or null if the test is already complete.
|
|
60
61
|
*/
|
|
61
|
-
run
|
|
62
|
+
run(prepare: () => void, beCertain?: boolean, maxTurns?: number): boolean;
|
|
62
63
|
/**
|
|
63
64
|
* Checks council.php to verify that a test is complete; more reliable than isDone, but requires an additional pagehit.
|
|
64
65
|
* @returns Whether council.php suggests that the test is complete.
|
|
@@ -81,4 +82,5 @@ export declare const CoilWire: Test;
|
|
|
81
82
|
* @param colour The colour (or color) you'd like the log to be printed in.
|
|
82
83
|
*/
|
|
83
84
|
export declare function printLog(colour?: string): void;
|
|
85
|
+
export declare const donate: () => void;
|
|
84
86
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { equippedItem, familiarWeight, getPower, haveEquipped, myBasestat, myBuffedstat,
|
|
2
|
-
import {
|
|
1
|
+
import { equippedItem, familiarWeight, getPower, haveEquipped, myBasestat, myBuffedstat, myFamiliar, myLevel, myMaxhp, myThrall, myTurncount, numericModifier, print, runChoice, toSlot, visitUrl, weightAdjustment, } from "kolmafia";
|
|
2
|
+
import { have } from "../../lib";
|
|
3
3
|
import { Requirement } from "../../maximize";
|
|
4
|
-
import { $class, $effect, $familiar, $item, $items, $slot, $stat, $thrall, } from "../../template-string";
|
|
5
4
|
import { get as getModifier } from "../../modifier";
|
|
6
|
-
import {
|
|
7
|
-
import { SongBoom } from "../../resources";
|
|
5
|
+
import { get } from "../../property";
|
|
6
|
+
import { MummingTrunk, SongBoom } from "../../resources";
|
|
7
|
+
import { $effect, $familiar, $item, $items, $slot, $stat, $thrall, } from "../../template-string";
|
|
8
8
|
import { sum } from "../../utils";
|
|
9
9
|
/**
|
|
10
10
|
* A log of the predicted turns, actual turns, and duration of each CS test performed.
|
|
@@ -79,29 +79,34 @@ class Test {
|
|
|
79
79
|
* Wrapper function that prepares for a test and then completes it, adding time and turn details to the log.
|
|
80
80
|
* @param prepare A function that does all necessary preparations for this CS test, including choosing your outfit.
|
|
81
81
|
* @param beCertain Whether we should check council.php instead of mafia to determine whether the test is complete.
|
|
82
|
+
* @param maxTurns We will run the test iff the predicted turns is less than or equal to this parameter.
|
|
82
83
|
* @returns The output of the prepare function given, or null if the test is already complete.
|
|
83
84
|
*/
|
|
84
|
-
run(prepare, beCertain = false) {
|
|
85
|
-
const finishedFunction = beCertain ? this.verifyIsDone : this.isDone;
|
|
85
|
+
run(prepare, beCertain = false, maxTurns = Infinity) {
|
|
86
|
+
const finishedFunction = () => beCertain ? this.verifyIsDone() : this.isDone();
|
|
86
87
|
if (finishedFunction())
|
|
87
|
-
return
|
|
88
|
+
return false;
|
|
88
89
|
const startTime = Date.now();
|
|
89
90
|
const startTurns = myTurncount();
|
|
90
91
|
try {
|
|
91
|
-
|
|
92
|
+
prepare();
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return false;
|
|
92
96
|
}
|
|
93
|
-
|
|
94
|
-
|
|
97
|
+
const prediction = this.predictor();
|
|
98
|
+
if (prediction <= maxTurns) {
|
|
95
99
|
this.do();
|
|
96
|
-
|
|
100
|
+
}
|
|
101
|
+
if (finishedFunction()) {
|
|
102
|
+
log[this.property] = {
|
|
97
103
|
predictedTurns: prediction,
|
|
98
104
|
turnCost: myTurncount() - startTurns,
|
|
99
105
|
seconds: (Date.now() - startTime) / 1000,
|
|
100
106
|
};
|
|
101
|
-
|
|
102
|
-
log[this.property] = loggedTest;
|
|
103
|
-
}
|
|
107
|
+
return true;
|
|
104
108
|
}
|
|
109
|
+
return false;
|
|
105
110
|
}
|
|
106
111
|
/**
|
|
107
112
|
* Checks council.php to verify that a test is complete; more reliable than isDone, but requires an additional pagehit.
|
|
@@ -116,13 +121,10 @@ const thralls = new Map([
|
|
|
116
121
|
[$stat `moxie`, $thrall `Penne Dreadful`],
|
|
117
122
|
]);
|
|
118
123
|
const statTestPredictor = (stat) => {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
baseStat = $stat `mysticality`;
|
|
124
|
-
}
|
|
125
|
-
return () => 60 - Math.floor((1 / 30) * (myBuffedstat(stat) - myBasestat(baseStat)));
|
|
124
|
+
return () => 60 -
|
|
125
|
+
Math.floor((1 / 30) *
|
|
126
|
+
(myBuffedstat(stat) -
|
|
127
|
+
myBasestat(thralls.get(myThrall()) === stat ? $stat `mysticality` : stat)));
|
|
126
128
|
};
|
|
127
129
|
export const HP = new Test(1, "Donate Blood", () => 60 - Math.floor((myMaxhp() - myBuffedstat($stat `muscle`) - 3) / 30), new Requirement(["HP"], {}));
|
|
128
130
|
export const Muscle = new Test(2, "Feed The Children", statTestPredictor($stat `Muscle`), new Requirement(["Muscle"], {}));
|
|
@@ -140,6 +142,7 @@ export const WeaponDamage = new Test(6, "Reduce Gazelle Population", () => {
|
|
|
140
142
|
const songDamage = SongBoom.song() === "These Fists Were Made for Punchin'" ? myLevel() : 0;
|
|
141
143
|
// mafia does not currently count swagger
|
|
142
144
|
const multiplier = have($effect `Bow-Legged Swagger`) ? 2 : 1;
|
|
145
|
+
// We add 0.001 because the floor function sometimes introduces weird rounding errors
|
|
143
146
|
return (60 -
|
|
144
147
|
Math.floor((multiplier *
|
|
145
148
|
(getModifier("Weapon Damage") -
|
|
@@ -153,6 +156,7 @@ export const SpellDamage = new Test(7, "Make Sausage", () => {
|
|
|
153
156
|
const dragonfishDamage = myFamiliar() === $familiar `Magic Dragonfish`
|
|
154
157
|
? numericModifier($familiar `Magic Dragonfish`, "Spell Damage Percent", familiarWeight($familiar `Magic Dragonfish`) + weightAdjustment(), $item `none`)
|
|
155
158
|
: 0;
|
|
159
|
+
// We add 0.001 because the floor function sometimes introduces weird rounding errors
|
|
156
160
|
return (60 -
|
|
157
161
|
Math.floor(getModifier("Spell Damage") / 50 + 0.001) -
|
|
158
162
|
Math.floor((getModifier("Spell Damage Percent") - dragonfishDamage) / 50 + 0.001));
|
|
@@ -163,16 +167,24 @@ export const Noncombat = new Test(8, "Be a Living Statue", () => {
|
|
|
163
167
|
return 60 - 3 * Math.floor(unsoftcappedRate / 5);
|
|
164
168
|
}, new Requirement(["-combat"], {}));
|
|
165
169
|
export const BoozeDrop = new Test(9, "Make Margaritas", () => {
|
|
166
|
-
const
|
|
170
|
+
const mummingCostume = MummingTrunk.currentCostumes().get(myFamiliar());
|
|
171
|
+
const mummingBuff = mummingCostume && mummingCostume[0] === "Item Drop"
|
|
172
|
+
? mummingCostume[1]
|
|
173
|
+
: 0;
|
|
174
|
+
const familiarItemDrop = numericModifier(myFamiliar(), "Item Drop", familiarWeight(myFamiliar()) + weightAdjustment(), equippedItem($slot `familiar`)) +
|
|
175
|
+
mummingBuff -
|
|
176
|
+
numericModifier(equippedItem($slot `familiar`), "Item Drop");
|
|
177
|
+
const familiarBoozeDrop = numericModifier(myFamiliar(), "Booze Drop", familiarWeight(myFamiliar()) + weightAdjustment(), equippedItem($slot `familiar`)) - numericModifier(equippedItem($slot `familiar`), "Booze Drop");
|
|
167
178
|
//Champagne doubling does NOT count for CS, so we undouble
|
|
168
179
|
const multiplier = haveEquipped($item `broken champagne bottle`) &&
|
|
169
180
|
get("garbageChampagneCharge") > 0
|
|
170
181
|
? 0.5
|
|
171
182
|
: 1;
|
|
183
|
+
// We add 0.001 because the floor function sometimes introduces weird rounding errors
|
|
172
184
|
return (60 -
|
|
173
185
|
multiplier *
|
|
174
186
|
Math.floor((getModifier("Item Drop") - familiarItemDrop) / 30 + 0.001) -
|
|
175
|
-
Math.floor(getModifier("Booze Drop") / 15 + 0.001));
|
|
187
|
+
Math.floor((getModifier("Booze Drop") - familiarBoozeDrop) / 15 + 0.001));
|
|
176
188
|
}, new Requirement(["Item Drop", "2 Booze Drop"], {
|
|
177
189
|
preventEquip: $items `broken champagne bottle`,
|
|
178
190
|
}));
|
|
@@ -191,3 +203,7 @@ export function printLog(colour = "blue") {
|
|
|
191
203
|
}
|
|
192
204
|
print(`All together, you have spent ${sum(logEntries, ([, testEntry]) => testEntry.seconds)} seconds during this Community Service run`, colour);
|
|
193
205
|
}
|
|
206
|
+
export const donate = () => {
|
|
207
|
+
visitUrl("council.php");
|
|
208
|
+
runChoice(30);
|
|
209
|
+
};
|
package/dist/combat.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { Class, Effect, Item, Location, Monster, Skill, Stat } from "kolmafia";
|
|
1
2
|
/**
|
|
2
|
-
* Get the KoL native ID of the macro with name
|
|
3
|
+
* Get the KoL native ID of the macro with name name.
|
|
3
4
|
*
|
|
4
5
|
* @category Combat
|
|
5
6
|
* @returns {number} The macro ID.
|
package/dist/combat.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { adv1, choiceFollowsFight, getAutoAttack, inMultiFight, removeProperty, runCombat, setAutoAttack, toInt, urlEncode, visitUrl, xpath, } from "kolmafia";
|
|
2
|
-
import { $items, $skills } from "./template-string";
|
|
3
|
-
import { get, set } from "./property";
|
|
1
|
+
import { adv1, choiceFollowsFight, Class, Effect, getAutoAttack, inMultiFight, Item, Location, Monster, removeProperty, runCombat, setAutoAttack, Skill, Stat, toInt, urlEncode, visitUrl, xpath, } from "kolmafia";
|
|
4
2
|
import { getTodaysHolidayWanderers } from "./lib";
|
|
3
|
+
import { get, set } from "./property";
|
|
4
|
+
import { $items, $skills } from "./template-string";
|
|
5
5
|
const MACRO_NAME = "Script Autoattack Macro";
|
|
6
6
|
/**
|
|
7
|
-
* Get the KoL native ID of the macro with name
|
|
7
|
+
* Get the KoL native ID of the macro with name name.
|
|
8
8
|
*
|
|
9
9
|
* @category Combat
|
|
10
10
|
* @returns {number} The macro ID.
|
|
@@ -141,9 +141,10 @@ export class Macro {
|
|
|
141
141
|
*/
|
|
142
142
|
setAutoAttack() {
|
|
143
143
|
let id = Macro.cachedMacroIds.get(this.name);
|
|
144
|
-
if (id === undefined)
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
if (id === undefined) {
|
|
145
|
+
id = getMacroId(this.name);
|
|
146
|
+
Macro.cachedMacroIds.set(this.name, id);
|
|
147
|
+
}
|
|
147
148
|
if (getAutoAttack() === 99000000 + id &&
|
|
148
149
|
this.toString() === Macro.cachedAutoAttacks.get(this.name)) {
|
|
149
150
|
// This macro is already set. Don"t make the server request.
|
package/dist/diet/index.d.ts
CHANGED
package/dist/diet/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { canEquip, fullnessLimit, historicalAge, historicalPrice, inebrietyLimit, itemType, mallPrice, mallPrices, myFullness, myInebriety, myLevel, myPrimestat, mySpleenUse, npcPrice, spleenLimit, } from "kolmafia";
|
|
2
|
-
import { knapsack } from "./knapsack";
|
|
3
2
|
import { have } from "../lib";
|
|
4
3
|
import { get as getModifier } from "../modifier";
|
|
5
4
|
import { get } from "../property";
|
|
5
|
+
import { Mayo, installed as mayoInstalled } from "../resources/2015/MayoClinic";
|
|
6
6
|
import { $effect, $item, $items, $skill, $stat } from "../template-string";
|
|
7
7
|
import { sum, sumNumbers } from "../utils";
|
|
8
|
-
import {
|
|
8
|
+
import { knapsack } from "./knapsack";
|
|
9
9
|
function isMonday() {
|
|
10
10
|
// Checking Tuesday's ruby is a hack to see if it's Monday in Arizona.
|
|
11
11
|
return getModifier("Muscle Percent", $item `Tuesday's ruby`) > 0;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Item } from "kolmafia";
|
|
1
2
|
export declare function close(): boolean;
|
|
2
3
|
export declare function open(paymentPolicy?: "None" | "All" | "Difference"): boolean;
|
|
3
4
|
export declare function distribute(idOrName?: number | string, loot?: Item | Item[] | Map<Item, number>, distributeAllOfAGivenItem?: boolean): void;
|
package/dist/dungeons/Dungeon.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getClanName, myId, toItem, visitUrl, xpath } from "kolmafia";
|
|
2
|
-
import { $items } from "../template-string";
|
|
3
2
|
import { Clan } from "../Clan";
|
|
4
3
|
import { getPlayerFromIdOrName } from "../lib";
|
|
4
|
+
import { $items } from "../template-string";
|
|
5
5
|
import { countedMapToArray } from "../utils";
|
|
6
6
|
/**
|
|
7
7
|
* Distributes loot from given dungeon
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Item } from "kolmafia";
|
|
1
2
|
export declare function close(): boolean;
|
|
2
3
|
export declare function open(paymentPolicy?: "None" | "All" | "Difference"): boolean;
|
|
3
4
|
export declare function distribute(idOrName?: number | string, loot?: Item | Item[] | Map<Item, number>, distributeAllOfAGivenItem?: boolean): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Item } from "kolmafia";
|
|
1
2
|
export declare function close(): boolean;
|
|
2
3
|
export declare function open(paymentPolicy?: "None" | "All" | "Difference"): boolean;
|
|
3
4
|
export declare function distribute(idOrName?: number | string, loot?: Item | Item[] | Map<Item, number>, distributeAllOfAGivenItem?: boolean): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./diet";
|
|
|
8
8
|
export * from "./lib";
|
|
9
9
|
export * from "./maximize";
|
|
10
10
|
export * from "./mood";
|
|
11
|
+
export * from "./propertyTyping";
|
|
11
12
|
export * from "./resources";
|
|
12
13
|
export * from "./since";
|
|
13
14
|
export * from "./template-string";
|
|
@@ -16,6 +17,7 @@ export * from "./Path";
|
|
|
16
17
|
export { default as logger, LogLevel } from "./logger";
|
|
17
18
|
export * as console from "./console";
|
|
18
19
|
export * as property from "./property";
|
|
20
|
+
export * as propertyTypes from "./propertyTypes";
|
|
19
21
|
export * from "./utils";
|
|
20
22
|
export { get, PropertiesManager, set, setProperties, withProperties, withProperty, withChoices, withChoice, } from "./property";
|
|
21
23
|
export { get as getModifier } from "./modifier";
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./diet";
|
|
|
8
8
|
export * from "./lib";
|
|
9
9
|
export * from "./maximize";
|
|
10
10
|
export * from "./mood";
|
|
11
|
+
export * from "./propertyTyping";
|
|
11
12
|
export * from "./resources";
|
|
12
13
|
export * from "./since";
|
|
13
14
|
export * from "./template-string";
|
|
@@ -16,6 +17,7 @@ export * from "./Path";
|
|
|
16
17
|
export { default as logger } from "./logger";
|
|
17
18
|
export * as console from "./console";
|
|
18
19
|
export * as property from "./property";
|
|
20
|
+
export * as propertyTypes from "./propertyTypes";
|
|
19
21
|
export * from "./utils";
|
|
20
22
|
export { get, PropertiesManager, set, setProperties, withProperties, withProperty, withChoices, withChoice, } from "./property";
|
|
21
23
|
export { get as getModifier } from "./modifier";
|
package/dist/lib.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @module GeneralLibrary */
|
|
2
2
|
import "core-js/modules/es.object.entries";
|
|
3
3
|
import "core-js/features/array/flat";
|
|
4
|
+
import { Effect, Familiar, Item, Location, Monster, Servant, Skill, Thrall } from "kolmafia";
|
|
4
5
|
/**
|
|
5
6
|
* Returns the current maximum Accordion Thief songs the player can have in their head
|
|
6
7
|
*
|
package/dist/lib.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @module GeneralLibrary */
|
|
2
2
|
import "core-js/modules/es.object.entries";
|
|
3
3
|
import "core-js/features/array/flat";
|
|
4
|
-
import { appearanceRates, autosellPrice, availableAmount, booleanModifier, cliExecute, fullnessLimit, getCampground, getCounters, getPlayerId, getPlayerName, getRelated, haveEffect, haveFamiliar, haveServant, haveSkill, holiday, inebrietyLimit, mallPrice, myEffects, myFamiliar, myFullness, myInebriety, myPath, mySpleenUse, myThrall, myTurncount, numericModifier, spleenLimit, toItem, toSkill, totalTurnsPlayed, } from "kolmafia";
|
|
5
|
-
import { $class, $familiar, $item, $items, $monsters } from "./template-string";
|
|
4
|
+
import { appearanceRates, autosellPrice, availableAmount, booleanModifier, cliExecute, Effect, Familiar, fullnessLimit, getCampground, getCounters, getPlayerId, getPlayerName, getRelated, haveEffect, haveFamiliar, haveServant, haveSkill, holiday, inebrietyLimit, Item, Location, mallPrice, Monster, myEffects, myFamiliar, myFullness, myInebriety, myPath, mySpleenUse, myThrall, myTurncount, numericModifier, Servant, Skill, spleenLimit, Thrall, toItem, toSkill, totalTurnsPlayed, } from "kolmafia";
|
|
6
5
|
import { get } from "./property";
|
|
6
|
+
import { $class, $familiar, $item, $items, $monsters } from "./template-string";
|
|
7
7
|
import { chunk } from "./utils";
|
|
8
8
|
/**
|
|
9
9
|
* Returns the current maximum Accordion Thief songs the player can have in their head
|
package/dist/maximize.d.ts
CHANGED
package/dist/maximize.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { availableAmount, bjornifyFamiliar, canEquip, cliExecute, enthroneFamiliar, equip, equippedAmount, equippedItem, isWearingOutfit, maximize, myBasestat, myBjornedFamiliar, myEnthronedFamiliar, myFamiliar, outfit, } from "kolmafia";
|
|
2
|
-
import { $familiar, $item, $slot, $slots, $stats } from "./template-string";
|
|
1
|
+
import { availableAmount, bjornifyFamiliar, canEquip, cliExecute, enthroneFamiliar, equip, equippedAmount, equippedItem, isWearingOutfit, Item, maximize, myBasestat, myBjornedFamiliar, myEnthronedFamiliar, myFamiliar, outfit, Slot, } from "kolmafia";
|
|
3
2
|
import logger from "./logger";
|
|
3
|
+
import { $familiar, $item, $slot, $slots, $stats } from "./template-string";
|
|
4
4
|
import { setEqual } from "./utils";
|
|
5
5
|
/**
|
|
6
6
|
* Merges a Partial<MaximizeOptions> onto a MaximizeOptions. We merge via overriding for all boolean properties and for onlySlot, and concat all other array properties.
|
package/dist/modifier.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "core-js/modules/es.object.values";
|
|
2
|
+
import { Class, Effect, Familiar, Item, Monster, Skill, Stat } from "kolmafia";
|
|
2
3
|
import { BooleanModifier, ClassModifier, EffectModifier, MonsterModifier, NumericModifier, SkillModifier, StatModifier, StringModifier } from "./modifierTypes";
|
|
3
4
|
export declare function get(name: BooleanModifier, subject?: string | Item | Effect): boolean;
|
|
4
5
|
export declare function get(name: ClassModifier, subject: string | Item): Class;
|
package/dist/modifier.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "core-js/modules/es.object.values";
|
|
2
2
|
import { booleanModifier, classModifier, effectModifier, monsterModifier, numericModifier, skillModifier, statModifier, stringModifier, } from "kolmafia";
|
|
3
|
-
import { arrayContains } from "./utils";
|
|
4
3
|
import { booleanModifiers, classModifiers, effectModifiers, monsterModifiers, numericModifiers, skillModifiers, statModifiers, stringModifiers, } from "./modifierTypes";
|
|
4
|
+
import { arrayContains } from "./utils";
|
|
5
5
|
export function get(name, subject) {
|
|
6
6
|
if (arrayContains(name, booleanModifiers)) {
|
|
7
7
|
return subject === undefined
|
package/dist/mood.d.ts
CHANGED
package/dist/mood.js
CHANGED
|
@@ -131,7 +131,7 @@ class PotionMoodElement extends MoodElement {
|
|
|
131
131
|
if (mallPrice(this.potion) > this.maxPricePerTurn * turnsPerUse) {
|
|
132
132
|
return false;
|
|
133
133
|
}
|
|
134
|
-
//integer part
|
|
134
|
+
// integer part
|
|
135
135
|
if (effectTurns < ensureTurns) {
|
|
136
136
|
const uses = Math.floor((ensureTurns - effectTurns) / turnsPerUse);
|
|
137
137
|
const quantityToBuy = clamp(uses - availableAmount(this.potion), 0, 100);
|
|
@@ -139,13 +139,12 @@ class PotionMoodElement extends MoodElement {
|
|
|
139
139
|
const quantityToUse = clamp(uses, 0, availableAmount(this.potion));
|
|
140
140
|
use(quantityToUse, this.potion);
|
|
141
141
|
}
|
|
142
|
-
//fractional part
|
|
142
|
+
// fractional part
|
|
143
143
|
const remainingDifference = ensureTurns - haveEffect(effect);
|
|
144
144
|
if (remainingDifference > 0) {
|
|
145
|
-
const price = this.maxPricePerTurn * remainingDifference;
|
|
146
|
-
if (price
|
|
147
|
-
if (availableAmount(this.potion) ||
|
|
148
|
-
buy(1, this.potion, Math.floor(price))) {
|
|
145
|
+
const price = Math.floor(this.maxPricePerTurn * remainingDifference);
|
|
146
|
+
if (price >= mallPrice(this.potion)) {
|
|
147
|
+
if (availableAmount(this.potion) || buy(1, this.potion, price)) {
|
|
149
148
|
use(1, this.potion);
|
|
150
149
|
}
|
|
151
150
|
}
|
|
@@ -193,12 +192,14 @@ class CustomMoodElement extends MoodElement {
|
|
|
193
192
|
}
|
|
194
193
|
class AsdonMoodElement extends MoodElement {
|
|
195
194
|
effect;
|
|
196
|
-
|
|
195
|
+
preferInventory;
|
|
196
|
+
constructor(effect, preferInventory = false) {
|
|
197
197
|
super();
|
|
198
198
|
this.effect = effect;
|
|
199
|
+
this.preferInventory = preferInventory;
|
|
199
200
|
}
|
|
200
201
|
execute(mood, ensureTurns) {
|
|
201
|
-
return AsdonMartin.drive(this.effect, ensureTurns);
|
|
202
|
+
return AsdonMartin.drive(this.effect, ensureTurns, this.preferInventory);
|
|
202
203
|
}
|
|
203
204
|
}
|
|
204
205
|
/**
|
package/dist/property.d.ts
CHANGED
|
@@ -1,46 +1,79 @@
|
|
|
1
1
|
import "core-js/modules/es.object.entries";
|
|
2
2
|
import "core-js/modules/es.object.from-entries";
|
|
3
|
-
import {
|
|
4
|
-
import { NumericProperty } from "./propertyTypes";
|
|
3
|
+
import { Bounty, Class, Coinmaster, Effect, Element, Familiar, Item, Location, Monster, Phylum, Servant, Skill, Slot, Stat, Thrall } from "kolmafia";
|
|
4
|
+
import { BooleanProperty, FamiliarProperty, LocationProperty, MonsterProperty, NumericOrStringProperty, NumericProperty, PhylumProperty, StatProperty, StringProperty } from "./propertyTypes";
|
|
5
|
+
import { KnownProperty } from "./propertyTyping";
|
|
5
6
|
export declare const getString: (property: string, default_?: string | undefined) => string;
|
|
6
7
|
export declare const getCommaSeparated: (property: string, default_?: string[] | undefined) => string[];
|
|
7
8
|
export declare const getBoolean: (property: string, default_?: boolean | undefined) => boolean;
|
|
8
9
|
export declare const getNumber: (property: string, default_?: number | undefined) => number;
|
|
9
|
-
export declare const getBounty: (property: string, default_?: Bounty |
|
|
10
|
-
export declare const getClass: (property: string, default_?: Class |
|
|
11
|
-
export declare const getCoinmaster: (property: string, default_?: Coinmaster |
|
|
12
|
-
export declare const getEffect: (property: string, default_?: Effect |
|
|
13
|
-
export declare const getElement: (property: string, default_?: Element |
|
|
14
|
-
export declare const getFamiliar: (property: string, default_?: Familiar |
|
|
15
|
-
export declare const getItem: (property: string, default_?: Item |
|
|
16
|
-
export declare const getLocation: (property: string, default_?: Location |
|
|
17
|
-
export declare const getMonster: (property: string, default_?: Monster |
|
|
18
|
-
export declare const getPhylum: (property: string, default_?: Phylum |
|
|
19
|
-
export declare const getServant: (property: string, default_?: Servant |
|
|
20
|
-
export declare const getSkill: (property: string, default_?: Skill |
|
|
21
|
-
export declare const getSlot: (property: string, default_?: Slot |
|
|
22
|
-
export declare const getStat: (property: string, default_?: Stat |
|
|
23
|
-
export declare const getThrall: (property: string, default_?: Thrall |
|
|
10
|
+
export declare const getBounty: (property: string, default_?: Bounty | undefined) => Bounty | null;
|
|
11
|
+
export declare const getClass: (property: string, default_?: Class | undefined) => Class | null;
|
|
12
|
+
export declare const getCoinmaster: (property: string, default_?: Coinmaster | undefined) => Coinmaster | null;
|
|
13
|
+
export declare const getEffect: (property: string, default_?: Effect | undefined) => Effect | null;
|
|
14
|
+
export declare const getElement: (property: string, default_?: Element | undefined) => Element | null;
|
|
15
|
+
export declare const getFamiliar: (property: string, default_?: Familiar | undefined) => Familiar | null;
|
|
16
|
+
export declare const getItem: (property: string, default_?: Item | undefined) => Item | null;
|
|
17
|
+
export declare const getLocation: (property: string, default_?: Location | undefined) => Location | null;
|
|
18
|
+
export declare const getMonster: (property: string, default_?: Monster | undefined) => Monster | null;
|
|
19
|
+
export declare const getPhylum: (property: string, default_?: Phylum | undefined) => Phylum | null;
|
|
20
|
+
export declare const getServant: (property: string, default_?: Servant | undefined) => Servant | null;
|
|
21
|
+
export declare const getSkill: (property: string, default_?: Skill | undefined) => Skill | null;
|
|
22
|
+
export declare const getSlot: (property: string, default_?: Slot | undefined) => Slot | null;
|
|
23
|
+
export declare const getStat: (property: string, default_?: Stat | undefined) => Stat | null;
|
|
24
|
+
export declare const getThrall: (property: string, default_?: Thrall | undefined) => Thrall | null;
|
|
24
25
|
/**
|
|
25
26
|
* Returns the value of a mafia property, either built in or custom
|
|
26
27
|
* @param property Name of the property
|
|
27
28
|
* @param _default Default value for the property to take if not set
|
|
28
29
|
*/
|
|
29
|
-
export declare function get
|
|
30
|
-
export declare function get
|
|
30
|
+
export declare function get(property: BooleanProperty): boolean;
|
|
31
|
+
export declare function get(property: BooleanProperty, _default: boolean): boolean;
|
|
32
|
+
export declare function get(property: NumericProperty): number;
|
|
33
|
+
export declare function get(property: NumericProperty, _default: number): number;
|
|
34
|
+
export declare function get(property: NumericOrStringProperty): number | string;
|
|
35
|
+
export declare function get(property: NumericOrStringProperty, _default: number | string): number | string;
|
|
36
|
+
export declare function get(property: StringProperty): string;
|
|
37
|
+
export declare function get(property: StringProperty, _default: string): string;
|
|
38
|
+
export declare function get(property: LocationProperty): Location | null;
|
|
39
|
+
export declare function get(property: LocationProperty, _default: Location): Location;
|
|
40
|
+
export declare function get(property: MonsterProperty): Monster | null;
|
|
41
|
+
export declare function get(property: MonsterProperty, _default: Monster): Monster;
|
|
42
|
+
export declare function get(property: FamiliarProperty): Familiar | null;
|
|
43
|
+
export declare function get(property: FamiliarProperty, _default: Familiar): Familiar;
|
|
44
|
+
export declare function get(property: StatProperty): Stat | null;
|
|
45
|
+
export declare function get(property: StatProperty, _default: Stat): Stat;
|
|
46
|
+
export declare function get(property: PhylumProperty): Phylum | null;
|
|
47
|
+
export declare function get(property: PhylumProperty, _default: Phylum): Phylum;
|
|
48
|
+
export declare function get(property: string, _default: Location): Location | null;
|
|
49
|
+
export declare function get(property: string, _default: Monster): Monster | null;
|
|
50
|
+
export declare function get(property: string, _default: Familiar): Familiar | null;
|
|
51
|
+
export declare function get(property: string, _default: boolean): boolean;
|
|
52
|
+
export declare function get(property: string, _default: number): number;
|
|
53
|
+
export declare function get(property: string, _default?: string): string;
|
|
31
54
|
/**
|
|
32
55
|
* Sets the value of a mafia property, either built in or custom
|
|
33
56
|
* @param property Name of the property
|
|
34
57
|
* @param value Value to give the property
|
|
35
58
|
*/
|
|
36
|
-
export declare function set
|
|
37
|
-
export declare function set
|
|
59
|
+
export declare function set(property: BooleanProperty, value: boolean): void;
|
|
60
|
+
export declare function set(property: NumericProperty, value: number): void;
|
|
61
|
+
export declare function set(property: NumericOrStringProperty, value: number | string): void;
|
|
62
|
+
export declare function set(property: StringProperty, value: string): void;
|
|
63
|
+
export declare function set(property: LocationProperty, value: Location): void;
|
|
64
|
+
export declare function set(property: MonsterProperty, value: Monster): void;
|
|
65
|
+
export declare function set(property: FamiliarProperty, value: Familiar): void;
|
|
66
|
+
export declare function set(property: StatProperty, value: Stat): void;
|
|
67
|
+
export declare function set(property: PhylumProperty, value: Phylum): void;
|
|
68
|
+
export declare function set<D extends {
|
|
69
|
+
toString(): string;
|
|
70
|
+
}>(property: string, value: D): void;
|
|
38
71
|
declare type Properties = Partial<{
|
|
39
|
-
[P in KnownProperty]:
|
|
72
|
+
[P in KnownProperty]: unknown;
|
|
40
73
|
}>;
|
|
41
74
|
export declare function setProperties(properties: Properties): void;
|
|
42
75
|
export declare function withProperties(properties: Properties, callback: () => void): void;
|
|
43
|
-
export declare function withProperty<P extends KnownProperty>(property: P, value:
|
|
76
|
+
export declare function withProperty<P extends KnownProperty>(property: P, value: unknown, callback: () => void): void;
|
|
44
77
|
export declare function withChoices(choices: {
|
|
45
78
|
[choice: number]: number | string;
|
|
46
79
|
}, callback: () => void): void;
|