libram 0.6.4 → 0.6.5

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.
Files changed (93) hide show
  1. package/dist/Clan.d.ts +1 -0
  2. package/dist/Clan.js +1 -1
  3. package/dist/Copier.d.ts +1 -0
  4. package/dist/Kmail.d.ts +1 -0
  5. package/dist/Kmail.js +1 -1
  6. package/dist/Path.d.ts +1 -0
  7. package/dist/actions/ActionSource.d.ts +4 -3
  8. package/dist/actions/ActionSource.js +2 -2
  9. package/dist/actions/FreeKill.js +1 -1
  10. package/dist/actions/FreeRun.js +2 -2
  11. package/dist/ascend.d.ts +1 -0
  12. package/dist/ascend.js +2 -2
  13. package/dist/challengePaths/2015/CommunityService.js +4 -4
  14. package/dist/combat.d.ts +1 -0
  15. package/dist/combat.js +3 -3
  16. package/dist/diet/index.d.ts +1 -0
  17. package/dist/diet/index.js +2 -2
  18. package/dist/dungeons/Dreadsylvania.d.ts +1 -0
  19. package/dist/dungeons/Dungeon.d.ts +1 -0
  20. package/dist/dungeons/Dungeon.js +1 -1
  21. package/dist/dungeons/Hobopolis.d.ts +1 -0
  22. package/dist/dungeons/SlimeTube.d.ts +1 -0
  23. package/dist/index.d.ts +2 -0
  24. package/dist/index.js +2 -0
  25. package/dist/lib.d.ts +1 -0
  26. package/dist/lib.js +2 -2
  27. package/dist/maximize.d.ts +1 -0
  28. package/dist/maximize.js +2 -2
  29. package/dist/modifier.d.ts +1 -0
  30. package/dist/modifier.js +1 -1
  31. package/dist/mood.d.ts +1 -0
  32. package/dist/mood.js +5 -6
  33. package/dist/property.d.ts +8 -3
  34. package/dist/property.js +7 -1
  35. package/dist/propertyTypes.d.ts +2 -2
  36. package/dist/propertyTypes.js +2 -2
  37. package/dist/resources/2007/CandyHearts.d.ts +2 -1
  38. package/dist/resources/2007/CandyHearts.js +1 -1
  39. package/dist/resources/2008/DivineFavors.d.ts +2 -1
  40. package/dist/resources/2008/DivineFavors.js +1 -1
  41. package/dist/resources/2009/Bandersnatch.d.ts +2 -1
  42. package/dist/resources/2009/Bandersnatch.js +1 -1
  43. package/dist/resources/2009/LoveSongs.d.ts +2 -1
  44. package/dist/resources/2009/LoveSongs.js +1 -1
  45. package/dist/resources/2009/SpookyPutty.d.ts +2 -1
  46. package/dist/resources/2010/Brickos.d.ts +2 -1
  47. package/dist/resources/2010/Brickos.js +1 -1
  48. package/dist/resources/2010/CrownOfThrones.d.ts +1 -0
  49. package/dist/resources/2010/LookingGlass.d.ts +25 -0
  50. package/dist/resources/2010/LookingGlass.js +85 -0
  51. package/dist/resources/2011/Gygaxian.d.ts +2 -1
  52. package/dist/resources/2011/Gygaxian.js +1 -1
  53. package/dist/resources/2011/ObtuseAngel.d.ts +2 -1
  54. package/dist/resources/2011/StompingBoots.d.ts +1 -1
  55. package/dist/resources/2011/StompingBoots.js +1 -1
  56. package/dist/resources/2012/RainDoh.d.ts +2 -1
  57. package/dist/resources/2012/Resolutions.d.ts +2 -1
  58. package/dist/resources/2012/Resolutions.js +1 -1
  59. package/dist/resources/2013/Florist.d.ts +1 -0
  60. package/dist/resources/2013/PulledTaffy.d.ts +2 -1
  61. package/dist/resources/2013/PulledTaffy.js +1 -1
  62. package/dist/resources/2014/DNALab.d.ts +1 -0
  63. package/dist/resources/2014/DNALab.js +3 -3
  64. package/dist/resources/2014/WinterGarden.d.ts +1 -0
  65. package/dist/resources/2014/WinterGarden.js +1 -1
  66. package/dist/resources/2015/ChateauMantegna.d.ts +1 -0
  67. package/dist/resources/2015/ChateauMantegna.js +1 -1
  68. package/dist/resources/2015/MayoClinic.d.ts +1 -0
  69. package/dist/resources/2016/SourceTerminal.d.ts +1 -0
  70. package/dist/resources/2016/SourceTerminal.js +1 -1
  71. package/dist/resources/2016/Witchess.d.ts +2 -1
  72. package/dist/resources/2016/Witchess.js +1 -1
  73. package/dist/resources/2017/AsdonMartin.d.ts +1 -0
  74. package/dist/resources/2017/Pantogram.d.ts +1 -0
  75. package/dist/resources/2017/Pantogram.js +1 -1
  76. package/dist/resources/2017/TunnelOfLove.d.ts +1 -0
  77. package/dist/resources/2018/LatteLoversMembersMug.d.ts +1 -0
  78. package/dist/resources/2018/SongBoom.d.ts +1 -1
  79. package/dist/resources/2019/BeachComb.d.ts +1 -0
  80. package/dist/resources/2019/Snapper.d.ts +1 -0
  81. package/dist/resources/2019/Snapper.js +1 -1
  82. package/dist/resources/2020/Guzzlr.d.ts +1 -0
  83. package/dist/resources/2020/Guzzlr.js +1 -1
  84. package/dist/resources/2021/CrystalBall.d.ts +1 -0
  85. package/dist/resources/2021/CrystalBall.js +1 -1
  86. package/dist/resources/2021/DaylightShavings.d.ts +3 -2
  87. package/dist/resources/LibramSummon.d.ts +1 -0
  88. package/dist/resources/index.d.ts +17 -17
  89. package/dist/resources/index.js +17 -17
  90. package/dist/session.d.ts +1 -0
  91. package/dist/template-string.d.ts +1 -0
  92. package/dist/template-string.js +1 -0
  93. package/package.json +4 -3
package/dist/Clan.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { Item, Monster } from "kolmafia";
1
2
  export interface Rank {
2
3
  name: string;
3
4
  degree: number;
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
@@ -1,3 +1,4 @@
1
+ import { Monster } from "kolmafia";
1
2
  export declare class Copier {
2
3
  private couldCopy;
3
4
  private prepare;
package/dist/Kmail.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import "core-js/modules/es.object.entries";
2
+ import { Item } from "kolmafia";
2
3
  declare type RawKmail = {
3
4
  id: string;
4
5
  type: string;
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 { Class } from "kolmafia";
1
2
  export declare class Path {
2
3
  name: string;
3
4
  id: number;
@@ -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 skill needed).
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, potential: () => number, macro: Macro, constraints?: ActionConstraints);
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 skill needed).
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(this.source, () => sum(actions, (action) => action.potential()), Macro.step(...actions.map((action) => action.macro)), constraints);
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.
@@ -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`)
@@ -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
@@ -1,3 +1,4 @@
1
+ import { Class, Item } from "kolmafia";
1
2
  import { Path } from "./Path";
2
3
  import { Ceiling, Desk, Nightstand } from "./resources/2015/ChateauMantegna";
3
4
  export declare enum Lifestyle {
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";
@@ -1,10 +1,10 @@
1
1
  import { equippedItem, familiarWeight, getPower, haveEquipped, myBasestat, myBuffedstat, myClass, myFamiliar, myLevel, myMaxhp, myThrall, myTurncount, numericModifier, print, runChoice, toSlot, visitUrl, weightAdjustment, } from "kolmafia";
2
- import { get } from "../../property";
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 { have } from "../../lib";
5
+ import { get } from "../../property";
7
6
  import { SongBoom } from "../../resources";
7
+ import { $class, $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.
@@ -82,7 +82,7 @@ class Test {
82
82
  * @returns The output of the prepare function given, or null if the test is already complete.
83
83
  */
84
84
  run(prepare, beCertain = false) {
85
- const finishedFunction = beCertain ? this.verifyIsDone : this.isDone;
85
+ const finishedFunction = () => beCertain ? this.verifyIsDone() : this.isDone();
86
86
  if (finishedFunction())
87
87
  return null;
88
88
  const startTime = Date.now();
package/dist/combat.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { Class, Effect, Item, Location, Monster, Skill, Stat } from "kolmafia";
1
2
  /**
2
3
  * Get the KoL native ID of the macro with name name.
3
4
  *
package/dist/combat.js CHANGED
@@ -1,7 +1,7 @@
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
7
  * Get the KoL native ID of the macro with name name.
@@ -1,3 +1,4 @@
1
+ import { Effect, Item } from "kolmafia";
1
2
  declare type RawDietEntry<T> = [MenuItem<T>[], number];
2
3
  declare type RawDiet<T> = RawDietEntry<T>[];
3
4
  declare type MenuItemOptions<T> = {
@@ -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 { Mayo, installed as mayoInstalled } from "../resources/2015/MayoClinic";
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;
@@ -1,3 +1,4 @@
1
+ import { Item } from "kolmafia";
1
2
  export declare type Dungeon = {
2
3
  name: string;
3
4
  loot: Item[];
@@ -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
@@ -1,3 +1,4 @@
1
+ import { Item, Slot } from "kolmafia";
1
2
  export declare type MaximizeOptions = {
2
3
  updateOnFamiliarChange: boolean;
3
4
  updateOnCanEquipChanged: boolean;
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.
@@ -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
@@ -1,4 +1,5 @@
1
1
  import "core-js/modules/es.object.values";
2
+ import { Effect, Item, Skill } from "kolmafia";
2
3
  export declare abstract class MpSource {
3
4
  usesRemaining(): number | null;
4
5
  abstract availableMpMin(): number;
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 <= mallPrice(this.potion)) {
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
  }
@@ -1,7 +1,8 @@
1
1
  import "core-js/modules/es.object.entries";
2
2
  import "core-js/modules/es.object.from-entries";
3
- import { KnownProperty } from "./propertyTyping";
3
+ import { Bounty, Class, Coinmaster, Effect, Element, Familiar, Item, Location, Monster, Phylum, Servant, Skill, Slot, Stat, Thrall } from "kolmafia";
4
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;
@@ -44,8 +45,12 @@ export declare function get(property: StatProperty): Stat | null;
44
45
  export declare function get(property: StatProperty, _default: Stat): Stat;
45
46
  export declare function get(property: PhylumProperty): Phylum | null;
46
47
  export declare function get(property: PhylumProperty, _default: Phylum): Phylum;
47
- export declare function get<D extends string | number | boolean>(property: string, _default: D): D;
48
- export declare function get(property: string): string;
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;
49
54
  /**
50
55
  * Sets the value of a mafia property, either built in or custom
51
56
  * @param property Name of the property
package/dist/property.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "core-js/modules/es.object.entries";
2
2
  import "core-js/modules/es.object.from-entries";
3
- import { getProperty, setProperty, toBounty, toClass, toCoinmaster, toEffect, toElement, toFamiliar, toItem, toLocation, toMonster, toPhylum, toServant, toSkill, toSlot, toStat, toThrall, } from "kolmafia";
3
+ import { Bounty, Class, Coinmaster, Effect, Element, Familiar, getProperty, Item, Location, Monster, Phylum, Servant, setProperty, Skill, Slot, Stat, Thrall, toBounty, toClass, toCoinmaster, toEffect, toElement, toFamiliar, toItem, toLocation, toMonster, toPhylum, toServant, toSkill, toSlot, toStat, toThrall, } from "kolmafia";
4
4
  import { isBooleanProperty, isFamiliarProperty, isLocationProperty, isMonsterProperty, isNumericOrStringProperty, isNumericProperty, isPhylumProperty, isStatProperty, isStringProperty, } from "./propertyTyping";
5
5
  const createPropertyGetter = (transform) => (property, default_) => {
6
6
  const value = getProperty(property);
@@ -80,6 +80,12 @@ export function get(property, _default) {
80
80
  else if (_default instanceof Phylum) {
81
81
  return getPhylum(property, _default);
82
82
  }
83
+ else if (typeof _default === "boolean") {
84
+ return value === "true" ? true : value === "false" ? false : _default;
85
+ }
86
+ else if (typeof _default === "number") {
87
+ return value === "" ? _default : parseInt(value);
88
+ }
83
89
  else if (value === "") {
84
90
  return _default === undefined ? "" : _default;
85
91
  }