libram 0.9.5 → 0.9.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/challengePaths/2015/CommunityService.js +11 -11
- package/dist/lib.d.ts +35 -1
- package/dist/lib.js +109 -2
- package/dist/propertyTypes.d.ts +3 -3
- package/dist/propertyTypes.js +3 -3
- package/dist/resources/2009/Bandersnatch.js +3 -4
- package/dist/resources/2011/StompingBoots.js +3 -4
- package/dist/resources/2014/ConspiracyIsland.d.ts +47 -0
- package/dist/resources/2014/ConspiracyIsland.js +128 -0
- package/dist/resources/2019/PocketProfessor.d.ts +26 -0
- package/dist/resources/2019/PocketProfessor.js +41 -0
- package/dist/resources/2024/TearawayPants.d.ts +22 -0
- package/dist/resources/2024/TearawayPants.js +52 -0
- package/dist/resources/index.d.ts +4 -1
- package/dist/resources/index.js +4 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { equippedItem,
|
|
2
|
-
import { have } from "../../lib.js";
|
|
1
|
+
import { equippedItem, getPower, haveEquipped, myAdventures, myBasestat, myBuffedstat, myFamiliar, myMaxhp, myThrall, myTurncount, numericModifier, print, runChoice, toSlot, visitUrl, } from "kolmafia";
|
|
2
|
+
import { have, totalFamiliarWeight } from "../../lib.js";
|
|
3
3
|
import { Requirement } from "../../maximize.js";
|
|
4
4
|
import { get } from "../../property.js";
|
|
5
5
|
import { MummingTrunk } from "../../resources/index.js";
|
|
@@ -18,7 +18,6 @@ const statCommunityServicePredictor = (stat) => {
|
|
|
18
18
|
: stat)));
|
|
19
19
|
};
|
|
20
20
|
const visitCouncil = () => visitUrl("council.php");
|
|
21
|
-
const baseWeight = () => have($effect `Fidoxene`) ? 20 : familiarWeight(myFamiliar());
|
|
22
21
|
function hypotheticalModifier(modifier, ...effects) {
|
|
23
22
|
const newEffects = effects.filter((e) => !have(e));
|
|
24
23
|
return (numericModifier(modifier) +
|
|
@@ -240,7 +239,8 @@ export default class CommunityService {
|
|
|
240
239
|
static Mysticality = new CommunityService(3, "Mysticality", "Build Playground Mazes", statCommunityServicePredictor($stat `Mysticality`), new Requirement(["Mysticality"], {}));
|
|
241
240
|
static Moxie = new CommunityService(4, "Moxie", "Feed Conspirators", statCommunityServicePredictor($stat `Moxie`), new Requirement(["Moxie"], {}));
|
|
242
241
|
static FamiliarWeight = new CommunityService(5, "Familiar Weight", "Breed More Collies", (...effects) => 60 -
|
|
243
|
-
Math.floor((
|
|
242
|
+
Math.floor((totalFamiliarWeight(myFamiliar(), false) +
|
|
243
|
+
hypotheticalModifier("Familiar Weight", ...effects)) /
|
|
244
244
|
5), new Requirement(["Familiar Weight"], {}));
|
|
245
245
|
static WeaponDamage = new CommunityService(6, "Weapon Damage", "Reduce Gazelle Population", (...effects) => {
|
|
246
246
|
const weaponPower = getPower(equippedItem($slot `weapon`));
|
|
@@ -266,7 +266,7 @@ export default class CommunityService {
|
|
|
266
266
|
}, new Requirement(["Weapon Damage", "Weapon Damage Percent"], {}));
|
|
267
267
|
static SpellDamage = new CommunityService(7, "Spell Damage", "Make Sausage", (...effects) => {
|
|
268
268
|
const dragonfishDamage = myFamiliar() === $familiar `Magic Dragonfish`
|
|
269
|
-
? numericModifier($familiar `Magic Dragonfish`, "Spell Damage Percent",
|
|
269
|
+
? numericModifier($familiar `Magic Dragonfish`, "Spell Damage Percent", totalFamiliarWeight(), $item.none)
|
|
270
270
|
: 0;
|
|
271
271
|
// We add 0.001 because the floor function sometimes introduces weird rounding errors
|
|
272
272
|
return (60 -
|
|
@@ -280,9 +280,9 @@ export default class CommunityService {
|
|
|
280
280
|
const noncombatRate = -1 * hypotheticalModifier("Combat Rate", ...effects);
|
|
281
281
|
const unsoftcappedRate = (rate) => rate > 25 ? 25 + (rate - 25) * 5 : rate;
|
|
282
282
|
const currentFamiliarModifier = -1 *
|
|
283
|
-
numericModifier(myFamiliar(), "Combat Rate",
|
|
283
|
+
numericModifier(myFamiliar(), "Combat Rate", totalFamiliarWeight(), equippedItem($slot `familiar`));
|
|
284
284
|
const newFamiliarModifier = -1 *
|
|
285
|
-
numericModifier(myFamiliar(), "Combat Rate",
|
|
285
|
+
numericModifier(myFamiliar(), "Combat Rate", totalFamiliarWeight(myFamiliar(), false) +
|
|
286
286
|
hypotheticalModifier("Familiar Weight", ...effects), equippedItem($slot `familiar`));
|
|
287
287
|
const adjustedRate = unsoftcappedRate(noncombatRate) -
|
|
288
288
|
unsoftcappedRate(currentFamiliarModifier) +
|
|
@@ -294,10 +294,10 @@ export default class CommunityService {
|
|
|
294
294
|
const mummingBuff = mummingCostume && mummingCostume[0] === "Item Drop"
|
|
295
295
|
? mummingCostume[1]
|
|
296
296
|
: 0;
|
|
297
|
-
const familiarItemDrop = numericModifier(myFamiliar(), "Item Drop",
|
|
297
|
+
const familiarItemDrop = numericModifier(myFamiliar(), "Item Drop", totalFamiliarWeight(), equippedItem($slot `familiar`)) +
|
|
298
298
|
mummingBuff -
|
|
299
299
|
numericModifier(equippedItem($slot `familiar`), "Item Drop");
|
|
300
|
-
const familiarBoozeDrop = numericModifier(myFamiliar(), "Booze Drop",
|
|
300
|
+
const familiarBoozeDrop = numericModifier(myFamiliar(), "Booze Drop", totalFamiliarWeight(), equippedItem($slot `familiar`)) - numericModifier(equippedItem($slot `familiar`), "Booze Drop");
|
|
301
301
|
// Champagne doubling does NOT count for CS, so we undouble
|
|
302
302
|
const multiplier = haveEquipped($item `broken champagne bottle`) &&
|
|
303
303
|
get("garbageChampagneCharge") > 0
|
|
@@ -318,8 +318,8 @@ export default class CommunityService {
|
|
|
318
318
|
preventEquip: $items `broken champagne bottle`,
|
|
319
319
|
}));
|
|
320
320
|
static HotRes = new CommunityService(10, "Hot Resistance", "Clean Steam Tunnels", (...effects) => {
|
|
321
|
-
const currentFamiliarModifier = numericModifier(myFamiliar(), "Hot Resistance",
|
|
322
|
-
const newFamiliarModifier = numericModifier(myFamiliar(), "Hot Resistance",
|
|
321
|
+
const currentFamiliarModifier = numericModifier(myFamiliar(), "Hot Resistance", totalFamiliarWeight(), equippedItem($slot `familiar`));
|
|
322
|
+
const newFamiliarModifier = numericModifier(myFamiliar(), "Hot Resistance", totalFamiliarWeight(myFamiliar(), false) +
|
|
323
323
|
hypotheticalModifier("Familiar Weight", ...effects), equippedItem($slot `familiar`));
|
|
324
324
|
return (60 -
|
|
325
325
|
(hypotheticalModifier("Hot Resistance", ...effects) -
|
package/dist/lib.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @module GeneralLibrary */
|
|
2
|
-
import { Effect, Element, Familiar, Item, Location, Monster, runCombat, Servant, Skill, Slot, Stat, Thrall } from "kolmafia";
|
|
2
|
+
import { Effect, Element, Familiar, Item, Location, Monster, runCombat, Servant, Skill, Slot, Stat, Thrall, Coinmaster } from "kolmafia";
|
|
3
3
|
/**
|
|
4
4
|
* Determines the current maximum Accordion Thief songs the player can have in their head
|
|
5
5
|
*
|
|
@@ -519,4 +519,38 @@ export declare const getScalingRate: (monster: Monster) => number;
|
|
|
519
519
|
* @returns The current scaling cap of the monster, based on your current in-game state
|
|
520
520
|
*/
|
|
521
521
|
export declare const getScalingCap: (monster: Monster) => number;
|
|
522
|
+
/**
|
|
523
|
+
* Wrap a specified action in mafia's `batchOpen` and `batchClose`
|
|
524
|
+
*
|
|
525
|
+
* @param action Action to perform while using mafia's batching feature
|
|
526
|
+
* @returns The return value of the action
|
|
527
|
+
*/
|
|
528
|
+
export declare function withBatch<T>(action: () => T): T;
|
|
529
|
+
export declare const bulkAutosell: (items: Map<Item, number>) => boolean;
|
|
530
|
+
export declare const bulkPutCloset: (items: Map<Item, number>) => boolean;
|
|
531
|
+
export declare const bulkPutDisplay: (items: Map<Item, number>) => boolean;
|
|
532
|
+
export declare const bulkPutStash: (items: Map<Item, number>) => boolean;
|
|
533
|
+
export declare const bulkTakeCloset: (items: Map<Item, number>) => boolean;
|
|
534
|
+
export declare const bulkTakeDisplay: (items: Map<Item, number>) => boolean;
|
|
535
|
+
export declare const bulkTakeShop: (items: Map<Item, number>) => boolean;
|
|
536
|
+
export declare const bulkTakeStash: (items: Map<Item, number>) => boolean;
|
|
537
|
+
export declare const bulkTakeStorage: (items: Map<Item, number>) => boolean;
|
|
538
|
+
export declare const bulkPutShop: (items: Map<Item, {
|
|
539
|
+
quantity?: number;
|
|
540
|
+
limit?: number;
|
|
541
|
+
price: number;
|
|
542
|
+
}>) => boolean;
|
|
543
|
+
export declare const bulkSell: (coinmaster: Coinmaster, items: Map<Item, number>) => boolean;
|
|
544
|
+
export declare const bulkRepriceShop: (items: Map<Item, {
|
|
545
|
+
quantity?: number;
|
|
546
|
+
limit?: number;
|
|
547
|
+
price: number;
|
|
548
|
+
}>) => boolean;
|
|
549
|
+
/**
|
|
550
|
+
* Calculate the total weight of a given familiar, including soup & modifiers
|
|
551
|
+
* @param familiar The familiar to use--defaults to your current one
|
|
552
|
+
* @param considerAdjustment Whether to include your `weightAdjustment` in the calculation
|
|
553
|
+
* @returns The total weight of the given familiar
|
|
554
|
+
*/
|
|
555
|
+
export declare function totalFamiliarWeight(familiar?: Familiar, considerAdjustment?: boolean): number;
|
|
522
556
|
export {};
|
package/dist/lib.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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, Monster, myClass, myEffects, myFamiliar, myFullness, myInebriety, myPath, myPrimestat, mySpleenUse, myThrall, myTurncount, numericModifier, Path, Servant, Skill, Slot, spleenLimit, Thrall, todayToString, toItem, toSkill, totalTurnsPlayed, visitUrl, xpath, monsterEval, } 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, Monster, 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, } 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";
|
|
6
|
-
import { makeByXFunction, chunk, notNull } from "./utils.js";
|
|
6
|
+
import { makeByXFunction, chunk, notNull, clamp } from "./utils.js";
|
|
7
7
|
/**
|
|
8
8
|
* Determines the current maximum Accordion Thief songs the player can have in their head
|
|
9
9
|
*
|
|
@@ -623,6 +623,10 @@ export function findFairyMultiplier(familiar) {
|
|
|
623
623
|
const itemBonus = numericModifier(familiar, "Item Drop", 1, $item.none);
|
|
624
624
|
if (itemBonus === 0)
|
|
625
625
|
return 0;
|
|
626
|
+
// Assumes you're using LED candle; returns effective weight multiplier
|
|
627
|
+
if (familiar === $familiar `Jill-of-All-Trades`)
|
|
628
|
+
return 1.5;
|
|
629
|
+
// Working out the multiplier based on the Item Drop at 1lb
|
|
626
630
|
return Math.pow(Math.sqrt(itemBonus + 55 / 4 + 3) - Math.sqrt(55) / 2, 2);
|
|
627
631
|
}
|
|
628
632
|
export const holidayWanderers = new Map([
|
|
@@ -996,3 +1000,106 @@ export const getScalingRate = makeScalerCalcFunction(scalerRates, SCALE_RATE_PAT
|
|
|
996
1000
|
* @returns The current scaling cap of the monster, based on your current in-game state
|
|
997
1001
|
*/
|
|
998
1002
|
export const getScalingCap = makeScalerCalcFunction(scalerCaps, SCALE_CAP_PATTERN);
|
|
1003
|
+
/**
|
|
1004
|
+
* Wrap a specified action in mafia's `batchOpen` and `batchClose`
|
|
1005
|
+
*
|
|
1006
|
+
* @param action Action to perform while using mafia's batching feature
|
|
1007
|
+
* @returns The return value of the action
|
|
1008
|
+
*/
|
|
1009
|
+
export function withBatch(action) {
|
|
1010
|
+
batchOpen();
|
|
1011
|
+
try {
|
|
1012
|
+
return action();
|
|
1013
|
+
}
|
|
1014
|
+
finally {
|
|
1015
|
+
batchClose();
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
const makeBulkFunction = (action) => (items) => {
|
|
1019
|
+
batchOpen();
|
|
1020
|
+
for (const [item, quantity] of items.entries())
|
|
1021
|
+
action(quantity, item);
|
|
1022
|
+
return batchClose();
|
|
1023
|
+
};
|
|
1024
|
+
/*
|
|
1025
|
+
* Autosell items in bulk
|
|
1026
|
+
*/
|
|
1027
|
+
export const bulkAutosell = makeBulkFunction(autosell);
|
|
1028
|
+
/*
|
|
1029
|
+
* Closet items in bulk
|
|
1030
|
+
* Note: each item transfer will still consume one request
|
|
1031
|
+
*/
|
|
1032
|
+
export const bulkPutCloset = makeBulkFunction(putCloset);
|
|
1033
|
+
/*
|
|
1034
|
+
* Display items in bulk
|
|
1035
|
+
*/
|
|
1036
|
+
export const bulkPutDisplay = makeBulkFunction(putDisplay);
|
|
1037
|
+
/*
|
|
1038
|
+
* Deposit items into your clan stash in bulk
|
|
1039
|
+
*/
|
|
1040
|
+
export const bulkPutStash = makeBulkFunction(putStash);
|
|
1041
|
+
/*
|
|
1042
|
+
* Remove items from your closet in bulk
|
|
1043
|
+
* Note: each item transfer will still consume one request
|
|
1044
|
+
*/
|
|
1045
|
+
export const bulkTakeCloset = makeBulkFunction(takeCloset);
|
|
1046
|
+
/*
|
|
1047
|
+
* Remove items from your display case in bulk
|
|
1048
|
+
*/
|
|
1049
|
+
export const bulkTakeDisplay = makeBulkFunction(takeDisplay);
|
|
1050
|
+
/*
|
|
1051
|
+
* Remove items from your shop in bulk
|
|
1052
|
+
*/
|
|
1053
|
+
export const bulkTakeShop = makeBulkFunction(takeShop);
|
|
1054
|
+
/*
|
|
1055
|
+
* Withdraw items from your clan stash in bulk
|
|
1056
|
+
* Note: each item transfer will still consume one request
|
|
1057
|
+
*/
|
|
1058
|
+
export const bulkTakeStash = makeBulkFunction(takeStash);
|
|
1059
|
+
/*
|
|
1060
|
+
* Remove items from your Hagnk's in bulk
|
|
1061
|
+
*/
|
|
1062
|
+
export const bulkTakeStorage = makeBulkFunction(takeStorage);
|
|
1063
|
+
/*
|
|
1064
|
+
* Mallsell items in bulk
|
|
1065
|
+
*/
|
|
1066
|
+
export const bulkPutShop = (items) => {
|
|
1067
|
+
batchOpen();
|
|
1068
|
+
for (const [item, { quantity, limit, price }] of items.entries()) {
|
|
1069
|
+
quantity
|
|
1070
|
+
? putShop(price, limit ?? 0, quantity, item)
|
|
1071
|
+
: putShop(price, limit ?? 0, item);
|
|
1072
|
+
}
|
|
1073
|
+
return batchClose();
|
|
1074
|
+
};
|
|
1075
|
+
/*
|
|
1076
|
+
* Coinmaster-sell items to the same coinmaster in bulk
|
|
1077
|
+
*/
|
|
1078
|
+
export const bulkSell = (coinmaster, items) => {
|
|
1079
|
+
batchOpen();
|
|
1080
|
+
for (const [item, quantity] of items.entries())
|
|
1081
|
+
sell(coinmaster, quantity, item);
|
|
1082
|
+
return batchClose();
|
|
1083
|
+
};
|
|
1084
|
+
/*
|
|
1085
|
+
* Reprice items in your mallstore in bulk
|
|
1086
|
+
*/
|
|
1087
|
+
export const bulkRepriceShop = (items) => {
|
|
1088
|
+
batchOpen();
|
|
1089
|
+
for (const [item, { limit, price }] of items.entries()) {
|
|
1090
|
+
limit ? repriceShop(price, limit, item) : repriceShop(price, item);
|
|
1091
|
+
}
|
|
1092
|
+
return batchClose();
|
|
1093
|
+
};
|
|
1094
|
+
/**
|
|
1095
|
+
* Calculate the total weight of a given familiar, including soup & modifiers
|
|
1096
|
+
* @param familiar The familiar to use--defaults to your current one
|
|
1097
|
+
* @param considerAdjustment Whether to include your `weightAdjustment` in the calculation
|
|
1098
|
+
* @returns The total weight of the given familiar
|
|
1099
|
+
*/
|
|
1100
|
+
export function totalFamiliarWeight(familiar = myFamiliar(), considerAdjustment = true) {
|
|
1101
|
+
return (clamp(familiarWeight(myFamiliar()), have($effect `Fidoxene`) ? 20 : 0, Infinity) +
|
|
1102
|
+
familiar.soupWeight +
|
|
1103
|
+
(considerAdjustment ? weightAdjustment() : 0) +
|
|
1104
|
+
(familiar.feasted ? 10 : 0));
|
|
1105
|
+
}
|