libram 0.10.0 → 0.10.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/lib.d.ts +21 -5
- package/dist/lib.js +43 -6
- package/dist/modifier.d.ts +11 -0
- package/dist/modifier.js +25 -9
- package/dist/modifierTypes.d.ts +1 -1
- package/dist/overlappingNames.js +2 -0
- package/dist/property.js +18 -9
- package/dist/propertyTypes.d.ts +10 -4
- package/dist/propertyTypes.js +7 -4
- package/dist/resources/2006/CommaChameleon.js +1 -1
- package/dist/resources/2018/BoxingDaycare.d.ts +71 -0
- package/dist/resources/2018/BoxingDaycare.js +150 -0
- package/dist/resources/2022/Stillsuit.d.ts +2 -4
- package/dist/resources/2022/Stillsuit.js +3 -6
- package/dist/resources/index.d.ts +2 -1
- package/dist/resources/index.js +2 -1
- package/dist/utils.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { cliExecute, Effect, handlingChoice, lastChoice, myMeat, retrieveItem, runChoice, Stat, visitUrl, } from "kolmafia";
|
|
2
|
+
import { get } from "../../property.js";
|
|
3
|
+
/**
|
|
4
|
+
* @returns Whether you own the Boxing Daycare
|
|
5
|
+
*/
|
|
6
|
+
export function have() {
|
|
7
|
+
return get("daycareOpen");
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @returns Whether we can currently have a Boxing Daydream
|
|
11
|
+
*/
|
|
12
|
+
export function canDaydream() {
|
|
13
|
+
return have() && !get("_daycareNap");
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Have a Boxing Daydream, retrieving an item from the daycare
|
|
17
|
+
* @returns Whether we succeeded in our endeavor
|
|
18
|
+
*/
|
|
19
|
+
export function daydream() {
|
|
20
|
+
if (!canDaydream())
|
|
21
|
+
return false;
|
|
22
|
+
return cliExecute("daycare item");
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @returns Whether we can currently visit the Boxing Day Spa
|
|
26
|
+
*/
|
|
27
|
+
export function canVisitSpa() {
|
|
28
|
+
return have() && !get("_daycareSpa");
|
|
29
|
+
}
|
|
30
|
+
const SPA_PACKAGES = {
|
|
31
|
+
"Mud Bath": "Muddled",
|
|
32
|
+
"Mani-pedi": "Ten out of Ten",
|
|
33
|
+
"Cucumber Eye Treatment": "Uncucumbered",
|
|
34
|
+
"Thermal Spring Aromatherapy": "Flagrantly Fragrant",
|
|
35
|
+
};
|
|
36
|
+
const SPA_PACKAGE_COMMANDS = ["mus", "mys", "mox", "regen"];
|
|
37
|
+
/**
|
|
38
|
+
* Visit the Boxing Day Spa, getting a buff of your choice
|
|
39
|
+
* @param target What spa package to request
|
|
40
|
+
* @returns Whether we succeeded in our endeavor
|
|
41
|
+
*/
|
|
42
|
+
export function visitSpa(target) {
|
|
43
|
+
if (!canVisitSpa())
|
|
44
|
+
return false;
|
|
45
|
+
if (target instanceof Stat) {
|
|
46
|
+
const command = target === Stat.none
|
|
47
|
+
? "regen"
|
|
48
|
+
: target.toString().toLowerCase().slice(0, 3);
|
|
49
|
+
return cliExecute(`daycare ${command}`);
|
|
50
|
+
}
|
|
51
|
+
const targetString = target instanceof Effect ? target.name : target;
|
|
52
|
+
const command = SPA_PACKAGE_COMMANDS[Object.entries(SPA_PACKAGES).findIndex((entry) => entry.includes(targetString))];
|
|
53
|
+
if (!command)
|
|
54
|
+
return false;
|
|
55
|
+
return cliExecute(`daycare ${command}`);
|
|
56
|
+
}
|
|
57
|
+
const visit = () => visitUrl("place.php?whichplace=town_wrong&action=townwrong_boxingdaycare");
|
|
58
|
+
const visitDaycare = () => {
|
|
59
|
+
visit();
|
|
60
|
+
runChoice(3);
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Hire an instructor for your boxing daycare
|
|
64
|
+
* @param shouldHire Function to determine if, given a particular item/quantity pair, we should actually attempt to hire an instructor
|
|
65
|
+
* @returns Whether or not we successfully hired a new instructor
|
|
66
|
+
*/
|
|
67
|
+
export function hireInstructor(shouldHire = () => true) {
|
|
68
|
+
if (!have())
|
|
69
|
+
return false;
|
|
70
|
+
try {
|
|
71
|
+
visitDaycare();
|
|
72
|
+
const item = get("daycareInstructorItem");
|
|
73
|
+
const quantity = get("daycareInstructorItemQuantity");
|
|
74
|
+
if (!item || !quantity)
|
|
75
|
+
return false;
|
|
76
|
+
const initial = get("daycareInstructors");
|
|
77
|
+
if (shouldHire(item, quantity)) {
|
|
78
|
+
retrieveItem(item, quantity);
|
|
79
|
+
if (!handlingChoice() || lastChoice() !== 1336)
|
|
80
|
+
visitDaycare();
|
|
81
|
+
runChoice(3);
|
|
82
|
+
return initial === get("daycareInstructors");
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
visitUrl("main.php");
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Attempt to reroll your boxing daycare instructor item cost
|
|
92
|
+
* @returns Whether we successfully rerolled the daycare instructor item
|
|
93
|
+
*/
|
|
94
|
+
export function rerollInstructor() {
|
|
95
|
+
if (!have())
|
|
96
|
+
return false;
|
|
97
|
+
try {
|
|
98
|
+
visitDaycare();
|
|
99
|
+
const initial = get("daycareInstructorItem");
|
|
100
|
+
if (!get("daycareInstructorItem"))
|
|
101
|
+
return false;
|
|
102
|
+
runChoice(7);
|
|
103
|
+
return initial === get("daycareInstructorItem");
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
visitUrl("main.php");
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
*
|
|
111
|
+
* @param number Number of recruits; defaults to the current value
|
|
112
|
+
* @returns The amount of meat it costs to recruit more toddlers
|
|
113
|
+
*/
|
|
114
|
+
export function recruitCost(number = get("_daycareRecruits")) {
|
|
115
|
+
return Math.pow(10, 2 + number);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Returns the lower and upper bound for the number of toddlers you can expect to recruit from the Boxing Daycare if you recruit
|
|
119
|
+
* @param options Optional object containing equipment and instructors
|
|
120
|
+
* @param options.equipment The amount of equipment you have; defaults to current value
|
|
121
|
+
* @param options.instructors The number of instructors you have; defaults to current value
|
|
122
|
+
* @returns A tuple consisting of the lower and upper bounds of how many toddlers you might get from recruiting toddlers
|
|
123
|
+
*/
|
|
124
|
+
export function expectedRecruits({ equipment = get("daycareEquipment"), instructors = get("daycareInstructors"), } = {}) {
|
|
125
|
+
return [(equipment * instructors ** 2) / 2, equipment * instructors ** 2];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Recruit toddlers for your Boxing Daycare
|
|
129
|
+
* @returns Whether we successfully recruited more toddlers
|
|
130
|
+
*/
|
|
131
|
+
export function recruit() {
|
|
132
|
+
if (!have())
|
|
133
|
+
return false;
|
|
134
|
+
if (myMeat() < recruitCost())
|
|
135
|
+
return false;
|
|
136
|
+
const initial = get("daycareToddlers");
|
|
137
|
+
visitDaycare();
|
|
138
|
+
runChoice(1);
|
|
139
|
+
visitUrl("main.php");
|
|
140
|
+
return initial === get("daycareToddlers");
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Scavenge in the boxing daycare
|
|
144
|
+
* @returns Whether we successfully scavenged
|
|
145
|
+
*/
|
|
146
|
+
export function scavenge() {
|
|
147
|
+
if (!have())
|
|
148
|
+
return false;
|
|
149
|
+
return cliExecute("daycare scavenge");
|
|
150
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Familiar } from "kolmafia";
|
|
2
|
-
import {
|
|
2
|
+
import { RegularFamiliarTag } from "../../lib.js";
|
|
3
3
|
import { NumericModifier } from "../../modifierTypes.js";
|
|
4
4
|
import { Modifiers } from "../../modifier.js";
|
|
5
5
|
/**
|
|
@@ -30,8 +30,7 @@ export declare function currentDistillateModifiers(): Modifiers<NumericModifier>
|
|
|
30
30
|
* @returns the modifier value for the given modifier
|
|
31
31
|
*/
|
|
32
32
|
export declare function distillateModifier(modifier: NumericModifier): number;
|
|
33
|
-
|
|
34
|
-
export declare const MODIFIER_TAGS: Record<StillsuitTag, NumericModifier>;
|
|
33
|
+
export declare const MODIFIER_TAGS: Record<RegularFamiliarTag, NumericModifier>;
|
|
35
34
|
/**
|
|
36
35
|
* Calculate the ratio of stillsuit modifiers for a particular familiar.
|
|
37
36
|
* @param familiar The familiar in question
|
|
@@ -44,4 +43,3 @@ export declare function modifierRatio(familiar: Familiar): Modifiers<NumericModi
|
|
|
44
43
|
* @returns The familiar you currently `have` that returns the best stillsuit distillate for that modifier.
|
|
45
44
|
*/
|
|
46
45
|
export declare function bestFamiliar(modifier: NumericModifier): Familiar;
|
|
47
|
-
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cliExecute, Familiar, splitModifiers, visitUrl } from "kolmafia";
|
|
2
|
-
import {
|
|
2
|
+
import { getAllFamiliarTags, have as have_, isRegularFamiliarTag, } from "../../lib.js";
|
|
3
3
|
import { get } from "../../property.js";
|
|
4
4
|
import { $item } from "../../template-string.js";
|
|
5
5
|
import { parseModifiers } from "../../modifier.js";
|
|
@@ -102,17 +102,14 @@ export const MODIFIER_TAGS = Object.freeze({
|
|
|
102
102
|
hasstinger: "Weapon Damage",
|
|
103
103
|
hard: "Weapon Damage",
|
|
104
104
|
});
|
|
105
|
-
function isStillsuitTag(tag) {
|
|
106
|
-
return tag in MODIFIER_TAGS;
|
|
107
|
-
}
|
|
108
105
|
/**
|
|
109
106
|
* Calculate the ratio of stillsuit modifiers for a particular familiar.
|
|
110
107
|
* @param familiar The familiar in question
|
|
111
108
|
* @returns An object whose keys are NumericModifiers potentially granted by the stillsuit distillate from this familiar, and whose values are the relative weights of those modifiers
|
|
112
109
|
*/
|
|
113
110
|
export function modifierRatio(familiar) {
|
|
114
|
-
const tags =
|
|
115
|
-
return tags.filter(
|
|
111
|
+
const tags = getAllFamiliarTags(familiar);
|
|
112
|
+
return tags.filter(isRegularFamiliarTag).reduce((acc, tag) => ({
|
|
116
113
|
...acc,
|
|
117
114
|
[MODIFIER_TAGS[tag]]: (acc[MODIFIER_TAGS[tag]] ?? 0) + 1 / tags.length,
|
|
118
115
|
}), {});
|
|
@@ -29,6 +29,7 @@ import * as Pantogram from "./2017/Pantogram.js";
|
|
|
29
29
|
import * as Robortender from "./2017/Robortender.js";
|
|
30
30
|
import * as Spacegate from "./2017/Spacegate.js";
|
|
31
31
|
import * as TunnelOfLove from "./2017/TunnelOfLove.js";
|
|
32
|
+
import * as BoxingDaycare from "./2018/BoxingDaycare.js";
|
|
32
33
|
import * as Latte from "./2018/LatteLoversMembersMug.js";
|
|
33
34
|
import * as SongBoom from "./2018/SongBoom.js";
|
|
34
35
|
import * as BeachComb from "./2019/BeachComb.js";
|
|
@@ -61,6 +62,6 @@ import * as TakerSpace from "./2024/TakerSpace.js";
|
|
|
61
62
|
import * as CrepeParachute from "./2025/CrepeParachute.js";
|
|
62
63
|
import * as ToyCupidBow from "./2025/ToyCupidBow.js";
|
|
63
64
|
import * as Raffle from "./evergreen/Raffle.js";
|
|
64
|
-
export { AprilingBandHelmet, AugustScepter, AutumnAton, AsdonMartin, Bandersnatch, BarrelShrine, BatWings, BeachComb, BurningLeaves, CampAway, Cartography, ChateauMantegna, ChestMimic, CinchoDeMayo, ClosedCircuitPayphone, CombatLoversLocket, CommaChameleon, ConspiracyIsland, CrepeParachute, CrimboShrub, CrownOfThrones, CrystalBall, CursedMonkeyPaw, DaylightShavings, DeckOfEveryCard, Dinseylandfill, DNALab, EverfullDarts, FloristFriar, GingerBread, GreyGoose, Guzzlr, Horsery, JuneCleaver, JungMan, Latte, LookingGlass, MayamCalendar, MayoClinic, MummingTrunk, ObtuseAngel, Pantogram, PocketProfessor, RainDoh, Raffle, ReagnimatedGnome, RetroCape, Robortender, Snapper, SongBoom, SourceTerminal, Spacegate, SpookyPutty, Stickers, StillSuit, StompingBoots, TakerSpace, TearawayPants, ToyCupidBow, TrainSet, TunnelOfLove, WinterGarden, Witchess, };
|
|
65
|
+
export { AprilingBandHelmet, AugustScepter, AutumnAton, AsdonMartin, Bandersnatch, BarrelShrine, BatWings, BeachComb, BoxingDaycare, BurningLeaves, CampAway, Cartography, ChateauMantegna, ChestMimic, CinchoDeMayo, ClosedCircuitPayphone, CombatLoversLocket, CommaChameleon, ConspiracyIsland, CrepeParachute, CrimboShrub, CrownOfThrones, CrystalBall, CursedMonkeyPaw, DaylightShavings, DeckOfEveryCard, Dinseylandfill, DNALab, EverfullDarts, FloristFriar, GingerBread, GreyGoose, Guzzlr, Horsery, JuneCleaver, JungMan, Latte, LookingGlass, MayamCalendar, MayoClinic, MummingTrunk, ObtuseAngel, Pantogram, PocketProfessor, RainDoh, Raffle, ReagnimatedGnome, RetroCape, Robortender, Snapper, SongBoom, SourceTerminal, Spacegate, SpookyPutty, Stickers, StillSuit, StompingBoots, TakerSpace, TearawayPants, ToyCupidBow, TrainSet, TunnelOfLove, WinterGarden, Witchess, };
|
|
65
66
|
export * from "./putty-likes.js";
|
|
66
67
|
export * from "./LibramSummon.js";
|
package/dist/resources/index.js
CHANGED
|
@@ -29,6 +29,7 @@ import * as Pantogram from "./2017/Pantogram.js";
|
|
|
29
29
|
import * as Robortender from "./2017/Robortender.js";
|
|
30
30
|
import * as Spacegate from "./2017/Spacegate.js";
|
|
31
31
|
import * as TunnelOfLove from "./2017/TunnelOfLove.js";
|
|
32
|
+
import * as BoxingDaycare from "./2018/BoxingDaycare.js";
|
|
32
33
|
import * as Latte from "./2018/LatteLoversMembersMug.js";
|
|
33
34
|
import * as SongBoom from "./2018/SongBoom.js";
|
|
34
35
|
import * as BeachComb from "./2019/BeachComb.js";
|
|
@@ -61,6 +62,6 @@ import * as TakerSpace from "./2024/TakerSpace.js";
|
|
|
61
62
|
import * as CrepeParachute from "./2025/CrepeParachute.js";
|
|
62
63
|
import * as ToyCupidBow from "./2025/ToyCupidBow.js";
|
|
63
64
|
import * as Raffle from "./evergreen/Raffle.js";
|
|
64
|
-
export { AprilingBandHelmet, AugustScepter, AutumnAton, AsdonMartin, Bandersnatch, BarrelShrine, BatWings, BeachComb, BurningLeaves, CampAway, Cartography, ChateauMantegna, ChestMimic, CinchoDeMayo, ClosedCircuitPayphone, CombatLoversLocket, CommaChameleon, ConspiracyIsland, CrepeParachute, CrimboShrub, CrownOfThrones, CrystalBall, CursedMonkeyPaw, DaylightShavings, DeckOfEveryCard, Dinseylandfill, DNALab, EverfullDarts, FloristFriar, GingerBread, GreyGoose, Guzzlr, Horsery, JuneCleaver, JungMan, Latte, LookingGlass, MayamCalendar, MayoClinic, MummingTrunk, ObtuseAngel, Pantogram, PocketProfessor, RainDoh, Raffle, ReagnimatedGnome, RetroCape, Robortender, Snapper, SongBoom, SourceTerminal, Spacegate, SpookyPutty, Stickers, StillSuit, StompingBoots, TakerSpace, TearawayPants, ToyCupidBow, TrainSet, TunnelOfLove, WinterGarden, Witchess, };
|
|
65
|
+
export { AprilingBandHelmet, AugustScepter, AutumnAton, AsdonMartin, Bandersnatch, BarrelShrine, BatWings, BeachComb, BoxingDaycare, BurningLeaves, CampAway, Cartography, ChateauMantegna, ChestMimic, CinchoDeMayo, ClosedCircuitPayphone, CombatLoversLocket, CommaChameleon, ConspiracyIsland, CrepeParachute, CrimboShrub, CrownOfThrones, CrystalBall, CursedMonkeyPaw, DaylightShavings, DeckOfEveryCard, Dinseylandfill, DNALab, EverfullDarts, FloristFriar, GingerBread, GreyGoose, Guzzlr, Horsery, JuneCleaver, JungMan, Latte, LookingGlass, MayamCalendar, MayoClinic, MummingTrunk, ObtuseAngel, Pantogram, PocketProfessor, RainDoh, Raffle, ReagnimatedGnome, RetroCape, Robortender, Snapper, SongBoom, SourceTerminal, Spacegate, SpookyPutty, Stickers, StillSuit, StompingBoots, TakerSpace, TearawayPants, ToyCupidBow, TrainSet, TunnelOfLove, WinterGarden, Witchess, };
|
|
65
66
|
export * from "./putty-likes.js";
|
|
66
67
|
export * from "./LibramSummon.js";
|
package/dist/utils.d.ts
CHANGED
|
@@ -190,4 +190,5 @@ type Enumerate<N extends number, A extends number[] = []> = A["length"] extends
|
|
|
190
190
|
* Integers on the interval [A, B).
|
|
191
191
|
*/
|
|
192
192
|
export type Range<A extends number, B extends number> = Exclude<Enumerate<B>, Enumerate<A>>;
|
|
193
|
+
export type ValueOf<T> = T[keyof T];
|
|
193
194
|
export {};
|