libram 0.9.31 → 0.9.33
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/actions/ActionSource.js +3 -2
- package/dist/actions/Banish.js +1 -1
- package/dist/actions/FreeKill.js +1 -1
- package/dist/actions/FreeRun.js +1 -1
- package/dist/lib.d.ts +8 -0
- package/dist/lib.js +32 -1
- package/dist/property.d.ts +8 -4
- package/dist/property.js +4 -1
- package/dist/propertyTypes.d.ts +7 -5
- package/dist/propertyTypes.js +6 -5
- package/dist/propertyTyping.d.ts +9 -2
- package/dist/propertyTyping.js +11 -1
- package/dist/resources/2020/Guzzlr.js +2 -5
- package/dist/resources/2023/ClosedCircuitPayphone.js +1 -1
- package/dist/resources/2024/TakerSpace.js +1 -1
- package/dist/resources/2025/ToyCupidBow.d.ts +19 -0
- package/dist/resources/2025/ToyCupidBow.js +37 -0
- package/dist/resources/index.d.ts +2 -1
- package/dist/resources/index.js +2 -1
- package/package.json +2 -2
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useFamiliar } from "kolmafia";
|
|
2
2
|
import { Macro } from "../combat.js";
|
|
3
3
|
import { Requirement } from "../maximize.js";
|
|
4
4
|
import { sum } from "../utils.js";
|
|
5
|
+
import { getAcquirePrice } from "../lib.js";
|
|
5
6
|
/**
|
|
6
7
|
* Merge a set of constraints into one
|
|
7
8
|
*
|
|
@@ -37,7 +38,7 @@ function mergeConstraints(...allConstraints) {
|
|
|
37
38
|
* A combat-based action resource in the game (e.g. a free run or free kill).
|
|
38
39
|
*/
|
|
39
40
|
export class ActionSource {
|
|
40
|
-
static defaultPriceFunction = (item) =>
|
|
41
|
+
static defaultPriceFunction = (item) => getAcquirePrice(item) > 0 ? getAcquirePrice(item) : Infinity;
|
|
41
42
|
source;
|
|
42
43
|
potential; // Infinity: unlimited
|
|
43
44
|
macro;
|
package/dist/actions/Banish.js
CHANGED
|
@@ -85,7 +85,7 @@ const banishSources = [
|
|
|
85
85
|
cost: () => ActionSource.defaultPriceFunction($item `human musk`),
|
|
86
86
|
}),
|
|
87
87
|
// Expensive unlimited sources
|
|
88
|
-
...$items `Louder Than Bomb, divine champagne popper, tennis ball`.map((item) => new ActionSource(item, () => Infinity, Macro.item(item), {
|
|
88
|
+
...$items `Louder Than Bomb, divine champagne popper, tennis ball, stuffed yam stinkbomb, anchor bomb, handful of split pea soup`.map((item) => new ActionSource(item, () => Infinity, Macro.item(item), {
|
|
89
89
|
preparation: () => retrieveItem(item),
|
|
90
90
|
cost: () => ActionSource.defaultPriceFunction(item),
|
|
91
91
|
})),
|
package/dist/actions/FreeKill.js
CHANGED
|
@@ -62,7 +62,7 @@ const freeKillSources = [
|
|
|
62
62
|
}
|
|
63
63
|
return get("shockingLickCharges") > 0;
|
|
64
64
|
},
|
|
65
|
-
cost: () => ActionSource.defaultPriceFunction($item `battery (
|
|
65
|
+
cost: () => ActionSource.defaultPriceFunction($item `battery (9-Volt)`),
|
|
66
66
|
}),
|
|
67
67
|
...$items `Daily Affirmation: Think Win-Lose, superduperheated metal`.map((item) => new ActionSource(item, () => Infinity, Macro.item(item), {
|
|
68
68
|
preparation: () => retrieveItem(item),
|
package/dist/actions/FreeRun.js
CHANGED
|
@@ -41,7 +41,7 @@ const freeRunSources = [
|
|
|
41
41
|
}),
|
|
42
42
|
new ActionSource($item `peppermint parasol`, () => Math.max(0, 3 - get("_navelRunaways")), Macro.item($item `peppermint parasol`), {
|
|
43
43
|
preparation: () => retrieveItem($item `peppermint parasol`),
|
|
44
|
-
cost: () =>
|
|
44
|
+
cost: () => ActionSource.defaultPriceFunction($item `peppermint parasol`) / 10, // Breaks after 10 successful runaways.
|
|
45
45
|
}),
|
|
46
46
|
// unlimited items that trigger everything looks green
|
|
47
47
|
...$items `green smoke bomb, tattered scrap of paper, GOTO, T.U.R.D.S. Key`.map((item) => new ActionSource(item, everythingLooksGreen(), Macro.item(item), {
|
package/dist/lib.d.ts
CHANGED
|
@@ -580,4 +580,12 @@ export type FamiliarTag = (typeof familiarTags)[number];
|
|
|
580
580
|
* @returns An array of the familiar's tags
|
|
581
581
|
*/
|
|
582
582
|
export declare function getFamiliarTags(familiar: Familiar): FamiliarTag[];
|
|
583
|
+
/**
|
|
584
|
+
* Determines the cost of acquiring an item taking into account your valueOfInventory preference
|
|
585
|
+
*
|
|
586
|
+
* @param item The item to check the price of
|
|
587
|
+
* @param quantity the number of items to acquire
|
|
588
|
+
* @returns The total value of the items
|
|
589
|
+
*/
|
|
590
|
+
export declare function getAcquirePrice(item: Item, quantity?: number): number;
|
|
583
591
|
export {};
|
package/dist/lib.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @module GeneralLibrary */
|
|
2
|
-
import { appearanceRates, autosellPrice, availableAmount, booleanModifier, choiceFollowsFight, cliExecute, currentRound, Effect, elementalResistance, equip, equippedItem, extractItems as kolmafiaExtractItems, Familiar, fullnessLimit, getCampground, getCounters, getPlayerId, getPlayerName, getRelated, handlingChoice, haveEffect, haveFamiliar, haveServant, haveSkill, holiday, inebrietyLimit, inMultiFight, Item, Location, mallPrice, myClass, myEffects, myFamiliar, myFullness, myInebriety, myPath, myPrimestat, mySpleenUse, myThrall, myTurncount, numericModifier, Path, Servant, Skill, Slot, spleenLimit, Thrall, todayToString, toItem, toSkill, totalTurnsPlayed, visitUrl, xpath, monsterEval, batchOpen, batchClose, autosell, putCloset, putDisplay, putShop, putStash, sell, takeCloset, takeDisplay, takeShop, takeStash, takeStorage, repriceShop, familiarWeight, weightAdjustment, MafiaClasses, toMonster, } from "kolmafia";
|
|
2
|
+
import { appearanceRates, autosellPrice, availableAmount, booleanModifier, choiceFollowsFight, cliExecute, currentRound, Effect, elementalResistance, equip, equippedItem, extractItems as kolmafiaExtractItems, Familiar, fullnessLimit, getCampground, getCounters, getPlayerId, getPlayerName, getRelated, handlingChoice, haveEffect, haveFamiliar, haveServant, haveSkill, holiday, inebrietyLimit, inMultiFight, Item, Location, mallPrice, myClass, myEffects, myFamiliar, myFullness, myInebriety, myPath, myPrimestat, mySpleenUse, myThrall, myTurncount, numericModifier, Path, Servant, Skill, Slot, spleenLimit, Thrall, todayToString, toItem, toSkill, totalTurnsPlayed, visitUrl, xpath, monsterEval, batchOpen, batchClose, autosell, putCloset, putDisplay, putShop, putStash, sell, takeCloset, takeDisplay, takeShop, takeStash, takeStorage, repriceShop, familiarWeight, weightAdjustment, MafiaClasses, toMonster, retrievePrice, craftType, } from "kolmafia";
|
|
3
3
|
import logger from "./logger.js";
|
|
4
4
|
import { get } from "./property.js";
|
|
5
5
|
import { $class, $effect, $element, $familiar, $item, $items, $monsters, $skill, $stat, } from "./template-string.js";
|
|
@@ -1179,3 +1179,34 @@ export const familiarTags = Object.freeze([
|
|
|
1179
1179
|
export function getFamiliarTags(familiar) {
|
|
1180
1180
|
return familiar.attributes.split("; ").filter(Boolean);
|
|
1181
1181
|
}
|
|
1182
|
+
/**
|
|
1183
|
+
* Determines the cost of acquiring an item taking into account your valueOfInventory preference
|
|
1184
|
+
*
|
|
1185
|
+
* @param item The item to check the price of
|
|
1186
|
+
* @param quantity the number of items to acquire
|
|
1187
|
+
* @returns The total value of the items
|
|
1188
|
+
*/
|
|
1189
|
+
export function getAcquirePrice(item, quantity = 1) {
|
|
1190
|
+
if (quantity <= 0)
|
|
1191
|
+
return 0;
|
|
1192
|
+
const currentAmount = availableAmount(item);
|
|
1193
|
+
const amountNeeded = Math.max(0, quantity - currentAmount);
|
|
1194
|
+
const retrieveCost = retrievePrice(item, currentAmount + quantity) -
|
|
1195
|
+
retrievePrice(item, currentAmount);
|
|
1196
|
+
const mallMinPrice = Math.max(100, 2 * autosellPrice(item));
|
|
1197
|
+
if (craftType(item) === "Meatpasting" && retrieveCost > 0) {
|
|
1198
|
+
return retrieveCost;
|
|
1199
|
+
}
|
|
1200
|
+
if (item.tradeable && mallPrice(item) === mallMinPrice) {
|
|
1201
|
+
return currentAmount * autosellPrice(item) + amountNeeded * mallPrice(item);
|
|
1202
|
+
}
|
|
1203
|
+
if (item.tradeable && mallPrice(item) > mallMinPrice) {
|
|
1204
|
+
return quantity * mallPrice(item);
|
|
1205
|
+
}
|
|
1206
|
+
if (item.tradeable)
|
|
1207
|
+
return quantity * autosellPrice(item);
|
|
1208
|
+
if (item.discardable) {
|
|
1209
|
+
return have(item, quantity) ? quantity * autosellPrice(item) : Infinity;
|
|
1210
|
+
}
|
|
1211
|
+
return 0;
|
|
1212
|
+
}
|
package/dist/property.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Bounty, Class, Coinmaster, Effect, Element, Familiar, Item, Location, Monster, Phylum, Servant, Skill, Slot, Stat, Thrall } from "kolmafia";
|
|
2
|
-
import { BooleanProperty, FamiliarProperty, LocationProperty, MonsterProperty, NumericOrStringProperty, NumericProperty, PhylumProperty, StatProperty, StringProperty } from "./propertyTypes.js";
|
|
2
|
+
import { BooleanProperty, FamiliarProperty, ItemProperty, LocationProperty, MonsterProperty, NumericOrStringProperty, NumericProperty, PhylumProperty, StatProperty, StringProperty } from "./propertyTypes.js";
|
|
3
3
|
import { KnownProperty } from "./propertyTyping.js";
|
|
4
4
|
export declare const getString: (property: string, default_?: string | undefined) => string;
|
|
5
5
|
export declare const getCommaSeparated: (property: string, default_?: string[] | undefined) => string[];
|
|
@@ -38,9 +38,13 @@ export declare function get(property: StatProperty): Stat | null;
|
|
|
38
38
|
export declare function get(property: StatProperty, _default: Stat): Stat;
|
|
39
39
|
export declare function get(property: PhylumProperty): Phylum | null;
|
|
40
40
|
export declare function get(property: PhylumProperty, _default: Phylum): Phylum;
|
|
41
|
-
export declare function get(property:
|
|
42
|
-
export declare function get(property:
|
|
43
|
-
export declare function get(property: string, _default:
|
|
41
|
+
export declare function get(property: ItemProperty): Item | null;
|
|
42
|
+
export declare function get(property: ItemProperty, _default: Item): Item;
|
|
43
|
+
export declare function get(property: string, _default: Location): Location;
|
|
44
|
+
export declare function get(property: string, _default: Monster): Monster;
|
|
45
|
+
export declare function get(property: string, _default: Familiar): Familiar;
|
|
46
|
+
export declare function get(property: string, _default: Phylum): Phylum;
|
|
47
|
+
export declare function get(property: string, _default: Item): Item;
|
|
44
48
|
export declare function get(property: string, _default: boolean): boolean;
|
|
45
49
|
export declare function get(property: string, _default: number): number;
|
|
46
50
|
export declare function get(property: string, _default?: string): string;
|
package/dist/property.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Bounty, Class, Coinmaster, Effect, Element, Familiar, getProperty, Item, Location, Monster, Phylum, propertyExists, removeProperty, Servant, setProperty, Skill, Slot, Stat, Thrall, toBounty, toClass, toCoinmaster, toEffect, toElement, toFamiliar, toItem, toLocation, toMonster, toPhylum, toServant, toSkill, toSlot, toStat, toThrall, } from "kolmafia";
|
|
2
|
-
import { isBooleanProperty, isFamiliarProperty, isLocationProperty, isMonsterProperty, isNumericOrStringProperty, isNumericProperty, isPhylumProperty, isStatProperty, isStringProperty, } from "./propertyTyping.js";
|
|
2
|
+
import { isBooleanProperty, isFamiliarProperty, isItemProperty, isLocationProperty, isMonsterProperty, isNumericOrStringProperty, isNumericProperty, isPhylumProperty, isStatProperty, isStringProperty, } from "./propertyTyping.js";
|
|
3
3
|
const createPropertyGetter = (transform) => (property, default_) => {
|
|
4
4
|
const value = getProperty(property);
|
|
5
5
|
if (default_ !== undefined && value === "") {
|
|
@@ -66,6 +66,9 @@ export function get(property, _default) {
|
|
|
66
66
|
else if (isPhylumProperty(property)) {
|
|
67
67
|
return getPhylum(property, _default);
|
|
68
68
|
}
|
|
69
|
+
else if (isItemProperty(property)) {
|
|
70
|
+
return getItem(property, _default);
|
|
71
|
+
}
|
|
69
72
|
else if (isStringProperty(property)) {
|
|
70
73
|
return value === "" && _default !== undefined ? _default : value;
|
|
71
74
|
}
|