libram 0.9.4 → 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/Macro.test.js +1 -1
- package/dist/actions/ActionSource.js +2 -2
- package/dist/challengePaths/2015/CommunityService.js +11 -11
- package/dist/combat.js +1 -3
- package/dist/lib.d.ts +47 -1
- package/dist/lib.js +139 -6
- 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/2023/CursedMonkeyPaw.js +5 -5
- 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/dist/utils.d.ts +8 -0
- package/dist/utils.js +11 -0
- package/package.json +3 -3
package/dist/Macro.test.js
CHANGED
|
@@ -16,7 +16,7 @@ describe(Macro, () => {
|
|
|
16
16
|
expect(Macro.if_("mock", Macro.abort()).toString()).toEqual(`if mock;abort;endif;`);
|
|
17
17
|
});
|
|
18
18
|
it("ifNot", () => {
|
|
19
|
-
expect(Macro.ifNot("mock", Macro.abort()).toString()).toEqual(`if !
|
|
19
|
+
expect(Macro.ifNot("mock", Macro.abort()).toString()).toEqual(`if !mock;abort;endif;`);
|
|
20
20
|
});
|
|
21
21
|
it("while_", () => {
|
|
22
22
|
expect(Macro.while_("mock", Macro.abort()).toString()).toEqual(`while mock;abort;endwhile;`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mallPrice, useFamiliar } from "kolmafia";
|
|
2
2
|
import { Macro } from "../combat.js";
|
|
3
3
|
import { Requirement } from "../maximize.js";
|
|
4
|
-
import { sum
|
|
4
|
+
import { sum } from "../utils.js";
|
|
5
5
|
/**
|
|
6
6
|
* Merge a set of constraints into one
|
|
7
7
|
*
|
|
@@ -97,7 +97,7 @@ export class ActionSource {
|
|
|
97
97
|
// Inconsistent constraints - no path forward here.
|
|
98
98
|
return null;
|
|
99
99
|
}
|
|
100
|
-
return new ActionSource(
|
|
100
|
+
return new ActionSource(actions.flatMap((action) => action.source), () => sum(actions, (action) => action.potential()), Macro.step(...actions.map((action) => action.macro)), constraints);
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
103
103
|
* Perform all preparation necessary to make this action available.
|
|
@@ -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/combat.js
CHANGED
|
@@ -349,9 +349,7 @@ export class Macro {
|
|
|
349
349
|
* @returns {Macro} This object itself.
|
|
350
350
|
*/
|
|
351
351
|
ifNot(condition, ifTrue) {
|
|
352
|
-
return this.
|
|
353
|
-
.step(ifTrue)
|
|
354
|
-
.step("endif");
|
|
352
|
+
return this.if_(`!${Macro.makeBALLSPredicate(condition)}`, ifTrue);
|
|
355
353
|
}
|
|
356
354
|
/**
|
|
357
355
|
* Create a new macro with an "if" statement, inverting the condition.
|
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
|
*
|
|
@@ -507,4 +507,50 @@ export declare function haveIntrinsic(effect: Effect): boolean;
|
|
|
507
507
|
*/
|
|
508
508
|
export declare function extractItems(text: string): Map<Item, number>;
|
|
509
509
|
export type CombatParams = Parameters<typeof runCombat>;
|
|
510
|
+
/**
|
|
511
|
+
* Calculate & return the scaling rate of a monster--`0` for non-scalers.
|
|
512
|
+
* @param monster The monster to check
|
|
513
|
+
* @returns The current scaling rate of the monster, based on your current in-game state
|
|
514
|
+
*/
|
|
515
|
+
export declare const getScalingRate: (monster: Monster) => number;
|
|
516
|
+
/**
|
|
517
|
+
* Calculate & return the scaling cap of a monster--`0` for non-scalers.
|
|
518
|
+
* @param monster The monster to check
|
|
519
|
+
* @returns The current scaling cap of the monster, based on your current in-game state
|
|
520
|
+
*/
|
|
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;
|
|
510
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, } 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,
|
|
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([
|
|
@@ -645,9 +649,9 @@ export const holidayWanderers = new Map([
|
|
|
645
649
|
* @returns List of holiday wanderer Monsters
|
|
646
650
|
*/
|
|
647
651
|
export function getTodaysHolidayWanderers() {
|
|
648
|
-
return
|
|
652
|
+
return holiday()
|
|
649
653
|
.split("/")
|
|
650
|
-
.
|
|
654
|
+
.flatMap((holiday) => holidayWanderers.get(holiday) ?? []);
|
|
651
655
|
}
|
|
652
656
|
/**
|
|
653
657
|
* Determines whether or not we can safely call visitUrl(), based on whether we're in a fight, multi-fight, choice, etc
|
|
@@ -924,10 +928,10 @@ export function getCombatFlags(flags = [...ACCOUNT_COMBAT_FLAGS]) {
|
|
|
924
928
|
*/
|
|
925
929
|
export function setCombatFlags(...flags) {
|
|
926
930
|
return visitUrl(`account.php?${([
|
|
927
|
-
...
|
|
931
|
+
...flags.flatMap(({ flag, value }) => [
|
|
928
932
|
`actions[]=flag_${flag}`,
|
|
929
933
|
`flag_${flag}=${Number(value)}`,
|
|
930
|
-
])
|
|
934
|
+
]),
|
|
931
935
|
"action=Update",
|
|
932
936
|
"am=1",
|
|
933
937
|
"ajax=1",
|
|
@@ -970,3 +974,132 @@ export function haveIntrinsic(effect) {
|
|
|
970
974
|
export function extractItems(text) {
|
|
971
975
|
return new Map(Object.entries(kolmafiaExtractItems(text)).map(([itemName, quantity]) => [Item.get(itemName), quantity]));
|
|
972
976
|
}
|
|
977
|
+
function makeScalerCalcFunction(cache, pattern) {
|
|
978
|
+
return function (monster) {
|
|
979
|
+
const current = cache.get(monster);
|
|
980
|
+
if (current !== undefined)
|
|
981
|
+
return monsterEval(current);
|
|
982
|
+
const result = pattern.exec(monster.attributes)?.[1] ?? "0";
|
|
983
|
+
cache.set(monster, result);
|
|
984
|
+
return monsterEval(result);
|
|
985
|
+
};
|
|
986
|
+
}
|
|
987
|
+
const scalerRates = new Map();
|
|
988
|
+
const scalerCaps = new Map();
|
|
989
|
+
const SCALE_RATE_PATTERN = /Scale: (?:\[([^\]]*)\]|(\d*))/;
|
|
990
|
+
const SCALE_CAP_PATTERN = /Cap: (?:\[([^\]]*)\]|(\d*))/;
|
|
991
|
+
/**
|
|
992
|
+
* Calculate & return the scaling rate of a monster--`0` for non-scalers.
|
|
993
|
+
* @param monster The monster to check
|
|
994
|
+
* @returns The current scaling rate of the monster, based on your current in-game state
|
|
995
|
+
*/
|
|
996
|
+
export const getScalingRate = makeScalerCalcFunction(scalerRates, SCALE_RATE_PATTERN);
|
|
997
|
+
/**
|
|
998
|
+
* Calculate & return the scaling cap of a monster--`0` for non-scalers.
|
|
999
|
+
* @param monster The monster to check
|
|
1000
|
+
* @returns The current scaling cap of the monster, based on your current in-game state
|
|
1001
|
+
*/
|
|
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
|
+
}
|