libram 0.8.28 → 0.8.30

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 (195) hide show
  1. package/dist/Clan.d.ts +128 -0
  2. package/dist/Clan.js +300 -0
  3. package/dist/Copier.d.ts +9 -0
  4. package/dist/Copier.js +15 -0
  5. package/dist/Dungeon.d.ts +45 -0
  6. package/dist/Dungeon.js +115 -0
  7. package/dist/Kmail.d.ts +133 -0
  8. package/dist/Kmail.js +259 -0
  9. package/dist/actions/ActionSource.d.ts +131 -0
  10. package/dist/actions/ActionSource.js +178 -0
  11. package/dist/actions/Banish.d.ts +16 -0
  12. package/dist/actions/Banish.js +121 -0
  13. package/dist/actions/FreeKill.d.ts +16 -0
  14. package/dist/actions/FreeKill.js +94 -0
  15. package/dist/actions/FreeRun.d.ts +16 -0
  16. package/dist/actions/FreeRun.js +81 -0
  17. package/dist/actions/index.d.ts +4 -0
  18. package/dist/actions/index.js +4 -0
  19. package/dist/ascend.d.ts +83 -0
  20. package/dist/ascend.js +268 -0
  21. package/dist/challengePaths/2014/HeavyRains.d.ts +22 -0
  22. package/dist/challengePaths/2014/HeavyRains.js +75 -0
  23. package/dist/challengePaths/2015/CommunityService.d.ts +125 -0
  24. package/dist/challengePaths/2015/CommunityService.js +334 -0
  25. package/dist/challengePaths/2016/NuclearAutumn.d.ts +13 -0
  26. package/dist/challengePaths/2016/NuclearAutumn.js +21 -0
  27. package/dist/challengePaths/index.d.ts +4 -0
  28. package/dist/challengePaths/index.js +4 -0
  29. package/dist/combat.d.ts +414 -0
  30. package/dist/combat.js +711 -0
  31. package/dist/console.d.ts +12 -0
  32. package/dist/console.js +14 -0
  33. package/dist/counter.d.ts +22 -0
  34. package/dist/counter.js +37 -0
  35. package/dist/diet/index.d.ts +80 -0
  36. package/dist/diet/index.js +682 -0
  37. package/dist/diet/knapsack.d.ts +8 -0
  38. package/dist/diet/knapsack.js +128 -0
  39. package/dist/index.d.ts +29 -0
  40. package/dist/index.js +26 -0
  41. package/dist/lib.d.ts +508 -0
  42. package/dist/lib.js +970 -0
  43. package/dist/logger.d.ts +35 -0
  44. package/dist/logger.js +62 -0
  45. package/dist/maximize.d.ts +122 -0
  46. package/dist/maximize.js +531 -0
  47. package/dist/modifier.d.ts +41 -0
  48. package/dist/modifier.js +160 -0
  49. package/dist/modifierTypes.d.ts +16 -0
  50. package/dist/modifierTypes.js +9 -0
  51. package/dist/mood.d.ts +105 -0
  52. package/dist/mood.js +349 -0
  53. package/dist/moonSign.d.ts +13 -0
  54. package/dist/moonSign.js +25 -0
  55. package/dist/overlappingNames.d.ts +3 -0
  56. package/dist/overlappingNames.js +42 -0
  57. package/dist/property.d.ts +222 -0
  58. package/dist/property.js +385 -0
  59. package/dist/propertyTypes.d.ts +19 -0
  60. package/dist/propertyTypes.js +10 -0
  61. package/dist/propertyTyping.d.ts +65 -0
  62. package/dist/propertyTyping.js +91 -0
  63. package/dist/resources/2007/CandyHearts.d.ts +9 -0
  64. package/dist/resources/2007/CandyHearts.js +24 -0
  65. package/dist/resources/2008/DivineFavors.d.ts +9 -0
  66. package/dist/resources/2008/DivineFavors.js +27 -0
  67. package/dist/resources/2008/Stickers.d.ts +49 -0
  68. package/dist/resources/2008/Stickers.js +84 -0
  69. package/dist/resources/2009/Bandersnatch.d.ts +56 -0
  70. package/dist/resources/2009/Bandersnatch.js +93 -0
  71. package/dist/resources/2009/LoveSongs.d.ts +9 -0
  72. package/dist/resources/2009/LoveSongs.js +24 -0
  73. package/dist/resources/2009/SpookyPutty.d.ts +31 -0
  74. package/dist/resources/2009/SpookyPutty.js +49 -0
  75. package/dist/resources/2010/Brickos.d.ts +9 -0
  76. package/dist/resources/2010/Brickos.js +21 -0
  77. package/dist/resources/2010/CrownOfThrones.d.ts +68 -0
  78. package/dist/resources/2010/CrownOfThrones.js +418 -0
  79. package/dist/resources/2010/LookingGlass.d.ts +29 -0
  80. package/dist/resources/2010/LookingGlass.js +89 -0
  81. package/dist/resources/2011/Gygaxian.d.ts +9 -0
  82. package/dist/resources/2011/Gygaxian.js +24 -0
  83. package/dist/resources/2011/ObtuseAngel.d.ts +33 -0
  84. package/dist/resources/2011/ObtuseAngel.js +51 -0
  85. package/dist/resources/2011/StompingBoots.d.ts +37 -0
  86. package/dist/resources/2011/StompingBoots.js +57 -0
  87. package/dist/resources/2012/RainDoh.d.ts +25 -0
  88. package/dist/resources/2012/RainDoh.js +37 -0
  89. package/dist/resources/2012/ReagnimatedGnome.d.ts +31 -0
  90. package/dist/resources/2012/ReagnimatedGnome.js +46 -0
  91. package/dist/resources/2012/Resolutions.d.ts +9 -0
  92. package/dist/resources/2012/Resolutions.js +28 -0
  93. package/dist/resources/2013/Florist.d.ts +81 -0
  94. package/dist/resources/2013/Florist.js +245 -0
  95. package/dist/resources/2013/JungMan.d.ts +33 -0
  96. package/dist/resources/2013/JungMan.js +69 -0
  97. package/dist/resources/2013/PulledTaffy.d.ts +9 -0
  98. package/dist/resources/2013/PulledTaffy.js +33 -0
  99. package/dist/resources/2014/CrimboShrub.d.ts +42 -0
  100. package/dist/resources/2014/CrimboShrub.js +89 -0
  101. package/dist/resources/2014/DNALab.d.ts +56 -0
  102. package/dist/resources/2014/DNALab.js +162 -0
  103. package/dist/resources/2014/WinterGarden.d.ts +23 -0
  104. package/dist/resources/2014/WinterGarden.js +35 -0
  105. package/dist/resources/2015/BarrelShrine.d.ts +8 -0
  106. package/dist/resources/2015/BarrelShrine.js +25 -0
  107. package/dist/resources/2015/ChateauMantegna.d.ts +54 -0
  108. package/dist/resources/2015/ChateauMantegna.js +100 -0
  109. package/dist/resources/2015/DeckOfEveryCard.d.ts +29 -0
  110. package/dist/resources/2015/DeckOfEveryCard.js +122 -0
  111. package/dist/resources/2015/Dinseylandfill.d.ts +89 -0
  112. package/dist/resources/2015/Dinseylandfill.js +205 -0
  113. package/dist/resources/2015/MayoClinic.d.ts +23 -0
  114. package/dist/resources/2015/MayoClinic.js +49 -0
  115. package/dist/resources/2016/GingerBread.d.ts +32 -0
  116. package/dist/resources/2016/GingerBread.js +73 -0
  117. package/dist/resources/2016/SourceTerminal.d.ts +181 -0
  118. package/dist/resources/2016/SourceTerminal.js +275 -0
  119. package/dist/resources/2016/Witchess.d.ts +19 -0
  120. package/dist/resources/2016/Witchess.js +48 -0
  121. package/dist/resources/2017/AsdonMartin.d.ts +59 -0
  122. package/dist/resources/2017/AsdonMartin.js +238 -0
  123. package/dist/resources/2017/Horsery.d.ts +19 -0
  124. package/dist/resources/2017/Horsery.js +42 -0
  125. package/dist/resources/2017/MummingTrunk.d.ts +8 -0
  126. package/dist/resources/2017/MummingTrunk.js +33 -0
  127. package/dist/resources/2017/Pantogram.d.ts +92 -0
  128. package/dist/resources/2017/Pantogram.js +174 -0
  129. package/dist/resources/2017/Robortender.d.ts +30 -0
  130. package/dist/resources/2017/Robortender.js +90 -0
  131. package/dist/resources/2017/Spacegate.d.ts +86 -0
  132. package/dist/resources/2017/Spacegate.js +178 -0
  133. package/dist/resources/2017/TunnelOfLove.d.ts +39 -0
  134. package/dist/resources/2017/TunnelOfLove.js +120 -0
  135. package/dist/resources/2018/LatteLoversMembersMug.d.ts +392 -0
  136. package/dist/resources/2018/LatteLoversMembersMug.js +303 -0
  137. package/dist/resources/2018/SongBoom.d.ts +33 -0
  138. package/dist/resources/2018/SongBoom.js +55 -0
  139. package/dist/resources/2019/BeachComb.d.ts +72 -0
  140. package/dist/resources/2019/BeachComb.js +118 -0
  141. package/dist/resources/2019/CampAway.d.ts +39 -0
  142. package/dist/resources/2019/CampAway.js +72 -0
  143. package/dist/resources/2019/Snapper.d.ts +33 -0
  144. package/dist/resources/2019/Snapper.js +73 -0
  145. package/dist/resources/2020/Cartography.d.ts +16 -0
  146. package/dist/resources/2020/Cartography.js +48 -0
  147. package/dist/resources/2020/Guzzlr.d.ts +160 -0
  148. package/dist/resources/2020/Guzzlr.js +275 -0
  149. package/dist/resources/2020/RetroCape.d.ts +51 -0
  150. package/dist/resources/2020/RetroCape.js +115 -0
  151. package/dist/resources/2021/CrystalBall.d.ts +14 -0
  152. package/dist/resources/2021/CrystalBall.js +41 -0
  153. package/dist/resources/2021/DaylightShavings.d.ts +40 -0
  154. package/dist/resources/2021/DaylightShavings.js +74 -0
  155. package/dist/resources/2022/AutumnAton.d.ts +78 -0
  156. package/dist/resources/2022/AutumnAton.js +182 -0
  157. package/dist/resources/2022/CombatLoversLocket.d.ts +46 -0
  158. package/dist/resources/2022/CombatLoversLocket.js +83 -0
  159. package/dist/resources/2022/GreyGoose.d.ts +59 -0
  160. package/dist/resources/2022/GreyGoose.js +90 -0
  161. package/dist/resources/2022/JuneCleaver.d.ts +47 -0
  162. package/dist/resources/2022/JuneCleaver.js +69 -0
  163. package/dist/resources/2022/TrainSet.d.ts +146 -0
  164. package/dist/resources/2022/TrainSet.js +228 -0
  165. package/dist/resources/2023/AugustScepter.d.ts +25 -0
  166. package/dist/resources/2023/AugustScepter.js +40 -0
  167. package/dist/resources/2023/BurningLeaves.d.ts +25 -0
  168. package/dist/resources/2023/BurningLeaves.js +74 -0
  169. package/dist/resources/2023/CinchoDeMayo.d.ts +25 -0
  170. package/dist/resources/2023/CinchoDeMayo.js +45 -0
  171. package/dist/resources/2023/ClosedCircuitPayphone.d.ts +80 -0
  172. package/dist/resources/2023/ClosedCircuitPayphone.js +129 -0
  173. package/dist/resources/2023/CursedMonkeyPaw.d.ts +46 -0
  174. package/dist/resources/2023/CursedMonkeyPaw.js +113 -0
  175. package/dist/resources/2024/AprilingBandHelmet.d.ts +57 -0
  176. package/dist/resources/2024/AprilingBandHelmet.js +118 -0
  177. package/dist/resources/2024/ChestMimic.d.ts +43 -0
  178. package/dist/resources/2024/ChestMimic.js +125 -0
  179. package/dist/resources/LibramSummon.d.ts +18 -0
  180. package/dist/resources/LibramSummon.js +74 -0
  181. package/dist/resources/index.d.ts +54 -0
  182. package/dist/resources/index.js +54 -0
  183. package/dist/resources/putty-likes.d.ts +21 -0
  184. package/dist/resources/putty-likes.js +33 -0
  185. package/dist/session.d.ts +169 -0
  186. package/dist/session.js +284 -0
  187. package/dist/since.d.ts +51 -0
  188. package/dist/since.js +108 -0
  189. package/dist/template-string.d.ts +324 -0
  190. package/dist/template-string.js +265 -0
  191. package/dist/url.d.ts +35 -0
  192. package/dist/url.js +67 -0
  193. package/dist/utils.d.ts +185 -0
  194. package/dist/utils.js +264 -0
  195. package/package.json +2 -2
@@ -0,0 +1,128 @@
1
+ import { sum } from "../utils";
2
+ class Not {
3
+ thing;
4
+ constructor(thing) {
5
+ this.thing = thing;
6
+ }
7
+ }
8
+ /**
9
+ * Assuming list is already sorted, count adjacent items.
10
+ * Effectively run-length encoding.
11
+ *
12
+ * @param list List to count
13
+ * @param isEqual Function that determines item equality
14
+ * @returns List of 2-tuples relating item to count
15
+ */
16
+ function aggregate(list, isEqual) {
17
+ const aggregatedList = [];
18
+ for (const item of list) {
19
+ if (aggregatedList.length === 0) {
20
+ aggregatedList.push([item, 1]);
21
+ }
22
+ else {
23
+ const last = aggregatedList[aggregatedList.length - 1];
24
+ const [lastItem] = last;
25
+ if (isEqual ? isEqual(item, lastItem) : item === lastItem) {
26
+ last[1]++;
27
+ }
28
+ else {
29
+ aggregatedList.push([item, 1]);
30
+ }
31
+ }
32
+ }
33
+ return aggregatedList;
34
+ }
35
+ /**
36
+ * Solve the knapsack problem.
37
+ *
38
+ * @param values Array of {[item, value, weight, maximum]} tuples for knapsack parameter.
39
+ * @param capacity Capacity of knapsack.
40
+ * @returns Tuple {[totalValue, items]} of selected items and total value of those items.
41
+ */
42
+ export function knapsack(values, capacity) {
43
+ if (!Number.isFinite(capacity)) {
44
+ throw new Error("Invalid capacity.");
45
+ }
46
+ // Invert negative values into a fake value for not using it.
47
+ const valuesInverted = values.map(([thing, value, weight, maximum]) => (weight < 0 && maximum !== undefined
48
+ ? [new Not(thing), -value, -weight, maximum]
49
+ : [thing, value, weight, maximum]));
50
+ const capacityAdjustment = sum(values, ([, , weight, maximum]) => weight < 0 && maximum !== undefined ? -weight * maximum : 0);
51
+ const adjustedCapacity = capacity + capacityAdjustment;
52
+ if (adjustedCapacity < 0) {
53
+ // We don't have enough cleaners to create any space, so can't fit anything.
54
+ return [-Infinity, []];
55
+ }
56
+ // Sort values by weight.
57
+ const valuesSorted = [...valuesInverted].sort((x, y) => x[2] - y[2]);
58
+ // Convert the problem into 0/1 knapsack - just include as many copies as possible of each item.
59
+ const values01 = [].concat(...valuesSorted.map(([thing, value, weight, maximum]) => {
60
+ if (!Number.isFinite(weight) || weight < 0) {
61
+ throw new Error(`Invalid weight ${weight} for ${thing instanceof Not ? `not ${thing.thing}` : thing}`);
62
+ }
63
+ const maxQuantity = Math.floor(maximum ?? adjustedCapacity / weight);
64
+ if (maxQuantity < 0) {
65
+ throw new Error(`Invalid max quantity ${maxQuantity} for ${thing instanceof Not ? `not ${thing.thing}` : thing}`);
66
+ }
67
+ return new Array(maxQuantity).fill([
68
+ thing,
69
+ value,
70
+ weight,
71
+ ]);
72
+ }));
73
+ const memoizationTable = new Array(values01.length);
74
+ for (let i = 0; i < values01.length; i++) {
75
+ memoizationTable[i] = new Array(adjustedCapacity).fill(null);
76
+ }
77
+ const [value, invertedSolution] = bestSolution(memoizationTable, values01, values01.length - 1, adjustedCapacity);
78
+ // Still need to replace Not<T>s with right quantity of T's.
79
+ const aggregatedSolution = aggregate(invertedSolution);
80
+ const countMap = new Map(aggregatedSolution);
81
+ let valueAdjustment = 0;
82
+ const solution = aggregatedSolution.filter(([thingOrNot]) => !(thingOrNot instanceof Not));
83
+ for (const [thingOrNot, value, , maximum] of valuesSorted) {
84
+ if (thingOrNot instanceof Not) {
85
+ const notCount = countMap.get(thingOrNot) ?? 0;
86
+ if (maximum === undefined) {
87
+ throw new Error(`Cannot find maximum for item ${thingOrNot.thing}.`);
88
+ }
89
+ if (notCount > maximum) {
90
+ throw new Error(`Somehow picked ${notCount} more than the maximum ${notCount} for item ${thingOrNot.thing}.`);
91
+ }
92
+ if (notCount < maximum) {
93
+ solution.push([thingOrNot.thing, maximum - notCount]);
94
+ }
95
+ valueAdjustment -= maximum * value;
96
+ }
97
+ }
98
+ return [value + valueAdjustment, solution];
99
+ }
100
+ /**
101
+ * Find the best solution to a knapsack subproblem.
102
+ *
103
+ * @param memoizationTable Memoization table for dynamic programming approach.
104
+ * @param values Array of {[item, value, weight, maximum]} tuples for knapsack parameter.
105
+ * @param currentIndex Current index into values array - only add items before this index.
106
+ * @param remainingCapacity Remaining capacity of knapsack.
107
+ * @returns Tuple of value to item
108
+ */
109
+ function bestSolution(memoizationTable, values, currentIndex, remainingCapacity) {
110
+ // If we've used all our capacity, this solution is no good.
111
+ if (remainingCapacity < 0)
112
+ return [-Infinity, []];
113
+ if (remainingCapacity === 0 || currentIndex < 0)
114
+ return [0, []];
115
+ const memoized = memoizationTable[currentIndex][remainingCapacity - 1];
116
+ if (memoized !== null)
117
+ return memoized;
118
+ const [item, value, weight] = values[currentIndex];
119
+ const [valueIncludeRest, itemsInclude] = bestSolution(memoizationTable, values, currentIndex - 1, remainingCapacity - weight);
120
+ const valueInclude = valueIncludeRest + value;
121
+ const [valueExclude, itemsExclude] = bestSolution(memoizationTable, values, currentIndex - 1, remainingCapacity);
122
+ // Pick the better of the two options between including/excluding.
123
+ const result = valueInclude > valueExclude
124
+ ? [valueInclude, [...itemsInclude, item]]
125
+ : [valueExclude, itemsExclude];
126
+ memoizationTable[currentIndex][remainingCapacity - 1] = result;
127
+ return result;
128
+ }
@@ -0,0 +1,29 @@
1
+ export * from "./actions";
2
+ export * from "./ascend";
3
+ export * from "./Clan";
4
+ export * from "./challengePaths";
5
+ export * from "./combat";
6
+ export * as Counter from "./counter";
7
+ export * from "./diet";
8
+ export * from "./Dungeon";
9
+ export * from "./lib";
10
+ export * from "./maximize";
11
+ export { numericModifiers, statModifiers, booleanModifiers, classModifiers, monsterModifiers, effectModifiers, skillModifiers, } from "./modifierTypes";
12
+ export * from "./mood";
13
+ export * from "./moonSign";
14
+ export * from "./propertyTyping";
15
+ export * from "./resources";
16
+ export * from "./since";
17
+ export * from "./template-string";
18
+ export { default as Kmail } from "./Kmail";
19
+ export { default as logger } from "./logger";
20
+ export * as console from "./console";
21
+ export * as property from "./property";
22
+ export * as propertyTypes from "./propertyTypes";
23
+ export * from "./utils";
24
+ export { get, PropertiesManager, set, setProperties, withProperties, withProperty, withChoices, withChoice, } from "./property";
25
+ export { get as getModifier, getTotalModifier } from "./modifier";
26
+ export { Session } from "./session";
27
+ export type { LogLevels } from "./logger";
28
+ export type { Modifiers } from "./modifier";
29
+ export type { NumericModifier, StringModifier, ClassModifier, StatModifier, BooleanModifier, EffectModifier, SkillModifier, } from "./modifierTypes";
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ export * from "./actions";
2
+ export * from "./ascend";
3
+ export * from "./Clan";
4
+ export * from "./challengePaths";
5
+ export * from "./combat";
6
+ export * as Counter from "./counter";
7
+ export * from "./diet";
8
+ export * from "./Dungeon";
9
+ export * from "./lib";
10
+ export * from "./maximize";
11
+ export { numericModifiers, statModifiers, booleanModifiers, classModifiers, monsterModifiers, effectModifiers, skillModifiers, } from "./modifierTypes";
12
+ export * from "./mood";
13
+ export * from "./moonSign";
14
+ export * from "./propertyTyping";
15
+ export * from "./resources";
16
+ export * from "./since";
17
+ export * from "./template-string";
18
+ export { default as Kmail } from "./Kmail";
19
+ export { default as logger } from "./logger";
20
+ export * as console from "./console";
21
+ export * as property from "./property";
22
+ export * as propertyTypes from "./propertyTypes";
23
+ export * from "./utils";
24
+ export { get, PropertiesManager, set, setProperties, withProperties, withProperty, withChoices, withChoice, } from "./property";
25
+ export { get as getModifier, getTotalModifier } from "./modifier";
26
+ export { Session } from "./session";
package/dist/lib.d.ts ADDED
@@ -0,0 +1,508 @@
1
+ /** @module GeneralLibrary */
2
+ import { Effect, Element, Familiar, Item, Location, Monster, runCombat, Servant, Skill, Slot, Stat, Thrall } from "kolmafia";
3
+ /**
4
+ * Determines the current maximum Accordion Thief songs the player can have in their head
5
+ *
6
+ * @category General
7
+ * @returns Maximum number of songs for player
8
+ */
9
+ export declare function getSongLimit(): number;
10
+ /**
11
+ * Determine whether the Skill or Effect provided is an Accordion Thief song
12
+ *
13
+ * @category General
14
+ * @param skillOrEffect The Skill or Effect
15
+ * @returns Whether it's a song
16
+ */
17
+ export declare function isSong(skillOrEffect: Skill | Effect): boolean;
18
+ /**
19
+ * List all active Effects
20
+ *
21
+ * @category General
22
+ * @returns List of Effects
23
+ */
24
+ export declare function getActiveEffects(): Effect[];
25
+ /**
26
+ * List currently active Accordion Thief songs
27
+ *
28
+ * @category General
29
+ * @returns List of song Effects
30
+ */
31
+ export declare function getActiveSongs(): Effect[];
32
+ /**
33
+ * List number of active Accordion Thief songs
34
+ *
35
+ * @category General
36
+ * @returns Number of songs
37
+ */
38
+ export declare function getSongCount(): number;
39
+ /**
40
+ * Determine whether player can remember another Accordion Thief song
41
+ *
42
+ * @category General
43
+ * @param quantity Number of songs to test the space for
44
+ * @returns Whether player can remember another song
45
+ */
46
+ export declare function canRememberSong(quantity?: number): boolean;
47
+ /**
48
+ * Determine the locations in which the given monster can be encountered naturally
49
+ *
50
+ * @category General
51
+ * @param monster Monster to find
52
+ * @returns Locations for monster
53
+ */
54
+ export declare function getMonsterLocations(monster: Monster): Location[];
55
+ /**
56
+ * Determine the player's remaining liver space
57
+ *
58
+ * @category General
59
+ * @returns Remaining liver space
60
+ */
61
+ export declare function getRemainingLiver(): number;
62
+ /**
63
+ * Determine the player's remaining stomach space
64
+ *
65
+ * @category General
66
+ * @returns Remaining stomach space
67
+ */
68
+ export declare function getRemainingStomach(): number;
69
+ /**
70
+ * Determine the player's remaining spleen space
71
+ *
72
+ * @category General
73
+ * @returns Remaining spleen space
74
+ */
75
+ export declare function getRemainingSpleen(): number;
76
+ /**
77
+ * Determine whether the player "has" any entity which one could feasibly "have".
78
+ *
79
+ * @category General
80
+ * @param thing Thing to check
81
+ * @param quantity Minimum quantity the player must have to pass
82
+ * @returns Whether the player meets the requirements of owning the supplied thing
83
+ */
84
+ export declare function have(thing: Effect | Familiar | Item | Servant | Skill | Thrall, quantity?: number): boolean;
85
+ /**
86
+ * Determine whether a given item is in the player's campground
87
+ *
88
+ * @category General
89
+ * @param item The Item KoLmafia uses to represent the campground item
90
+ * @returns Whether the item is in the campground
91
+ */
92
+ export declare function haveInCampground(item: Item): boolean;
93
+ export declare enum Wanderer {
94
+ Digitize = "Digitize Monster",
95
+ Enamorang = "Enamorang Monster",
96
+ Familiar = "Familiar",
97
+ Holiday = "Holiday Monster",
98
+ Kramco = "Kramco",
99
+ Nemesis = "Nemesis Assassin",
100
+ Portscan = "portscan.edu",
101
+ Romantic = "Romantic Monster",
102
+ Vote = "Vote Monster"
103
+ }
104
+ /**
105
+ * Determine whether the player has the specified counter
106
+ *
107
+ * @param counterName Name of the counter
108
+ * @param minTurns Minimum turns the counter is set to
109
+ * @param maxTurns Maximum turns the counter is set to
110
+ * @category General
111
+ * @returns Whether player has the counter
112
+ */
113
+ export declare function haveCounter(counterName: string, minTurns?: number, maxTurns?: number): boolean;
114
+ /**
115
+ * Determine whether the player has the specified wanderer's counter
116
+ *
117
+ * @param wanderer Wanderer to check
118
+ * @category Wanderers
119
+ * @returns Whether player has the wanderer counter
120
+ */
121
+ export declare function haveWandererCounter(wanderer: Wanderer): boolean;
122
+ /**
123
+ * Determine whether the player will encounter a vote wanderer on the next turn,
124
+ * providing an "I Voted!" sticker is equipped.
125
+ *
126
+ * @category Wanderers
127
+ * @returns Whether the vote wanderer is due
128
+ */
129
+ export declare function isVoteWandererNow(): boolean;
130
+ /**
131
+ * Tells us whether we can expect a given wanderer now. Behaves differently
132
+ * for different types of wanderer.
133
+ *
134
+ * - For deterministic wanderers, return whether the player will encounter
135
+ * the queried wanderer on the next turn
136
+ *
137
+ * - For variable wanderers (window), return whether the player is within
138
+ * an encounter window for the queried wanderer
139
+ *
140
+ * - For variable wanderers (chance per turn), returns true unless the player
141
+ * has exhausted the number of wanderers possible
142
+ *
143
+ * @category Wanderers
144
+ * @param wanderer Wanderer to check
145
+ * @returns Whether the wanderer is due
146
+ */
147
+ export declare function isWandererNow(wanderer: Wanderer): boolean;
148
+ /**
149
+ * Determines the chance the player will encounter a sausage goblin on the
150
+ * next turn, providing the Kramco Sausage-o-Matic is equipped.
151
+ *
152
+ * @category Wanderers
153
+ * @returns Chance that the sausage goblin is due (as a number between 0 and 1)
154
+ */
155
+ export declare function getKramcoWandererChance(): number;
156
+ /**
157
+ * Determines the chance the player will encounter an Artistic Goth Kid or
158
+ * Mini-Hipster wanderer on the next turn, providing a familiar is equipped.
159
+ *
160
+ * NOTE: You must complete one combat with the Artistic Goth Kid before you
161
+ * can encounter any wanderers. Consequently,ƒ the first combat with the
162
+ * Artist Goth Kid is effectively 0% chance to encounter a wanderer.
163
+ *
164
+ * @category Wanderers
165
+ * @returns Chance that the familiar wanderer is due (as a number between 0 and 1)
166
+ */
167
+ export declare function getFamiliarWandererChance(): number;
168
+ /**
169
+ * Determines the chance the player will encounter the specified wanderer
170
+ * on the next turn.
171
+ *
172
+ * @category Wanderers
173
+ * @param wanderer Wanderer to check
174
+ * @returns Chance that the specified wanderer is due (as a number between 0 and 1)
175
+ */
176
+ export declare function getWandererChance(wanderer: Wanderer): number;
177
+ /**
178
+ * Determines whether the player's current familiar is equal to the one supplied
179
+ *
180
+ * @category General
181
+ * @param familiar Familiar to check
182
+ * @returns Whether it is the player's current familiar
183
+ */
184
+ export declare function isCurrentFamiliar(familiar: Familiar): boolean;
185
+ /**
186
+ * Determines the fold group (if any) of which the given item is a part
187
+ *
188
+ * @category General
189
+ * @param item Item that is part of the required fold group
190
+ * @returns List of items in the fold group
191
+ */
192
+ export declare function getFoldGroup(item: Item): Item[];
193
+ /**
194
+ * Determines the zap group (if any) of which the given item is a part
195
+ *
196
+ * @category General
197
+ * @param item Item that is part of the required zap group
198
+ * @returns List of items in the zap group
199
+ */
200
+ export declare function getZapGroup(item: Item): Item[];
201
+ /**
202
+ * Get a map of banished monsters keyed by what banished them
203
+ *
204
+ * @category General
205
+ * @returns Map of banished monsters
206
+ */
207
+ export declare function getBanishedMonsters(): Map<Item | Skill, Monster>;
208
+ /**
209
+ * Determines whether the item is usable
210
+ *
211
+ * This function will be an ongoing work in progress
212
+ *
213
+ * @param item Item to check
214
+ * @returns Whether item is usable
215
+ */
216
+ export declare function canUse(item: Item): boolean;
217
+ /**
218
+ * Turn KoLmafia `none`s to JavaScript `null`s
219
+ *
220
+ * @param thing Thing that can have a mafia "none" value
221
+ * @returns The thing specified or `null`
222
+ */
223
+ export declare function noneToNull<T>(thing: T): T | null;
224
+ /**
225
+ * Determine the average value from the sort of range that KoLmafia encodes as a string
226
+ *
227
+ * @param range KoLmafia-style range string
228
+ * @returns Average value fo range
229
+ */
230
+ export declare function getAverage(range: string): number;
231
+ /**
232
+ * Deternube tge average adventures expected from consuming an Item
233
+ *
234
+ * If item is not a consumable, will just return "0".
235
+ *
236
+ * @param item Consumable item
237
+ * @returns Average aventures from consumable
238
+ */
239
+ export declare function getAverageAdventures(item: Item): number;
240
+ /**
241
+ * Remove an effect
242
+ *
243
+ * @category General
244
+ * @param effect Effect to remove
245
+ * @returns Success
246
+ */
247
+ export declare function uneffect(effect: Effect): boolean;
248
+ /**
249
+ * Get the player id from a player name
250
+ * @param name the name of the player
251
+ * @param onMissing Pass "throw" or omit to throw an error if the player is not found
252
+ * @returns the player id, or throws if no such player exists
253
+ */
254
+ export declare function getPlayerIdFromName(name: string, onMissing?: "throw"): number;
255
+ /**
256
+ * Get the player id from a player name (if it exists)
257
+ * @param name the name of the player
258
+ * @param onMissing Pass "throw" to throw an error if the player is not found, or "return-null" to return null
259
+ * @returns the player id if the player exists, or handles according to onMissing
260
+ */
261
+ export declare function getPlayerIdFromName(name: string, onMissing: "throw" | "return-null"): number | null;
262
+ /**
263
+ * Get the player id from a player name
264
+ * @param id the id of the player
265
+ * @param onMissing Pass "throw" or omit to throw an error if the player is not found
266
+ * @returns the player id, or throws if no such player exists
267
+ */
268
+ export declare function getPlayerNameFromId(id: number, onMissing?: "throw"): string;
269
+ /**
270
+ * Get the player id from a player name (if it exists)
271
+ * @param id the id of the player
272
+ * @param onMissing Pass "throw" to throw an error if the player is not found, or "return-null" to return null * @returns the player id, or null if no such player exists
273
+ * @returns the player id if the player exists, or handles according to onMissing
274
+ */
275
+ export declare function getPlayerNameFromId(id: number, onMissing: "throw" | "return-null"): string | null;
276
+ export declare type Player = {
277
+ name: string;
278
+ id: number;
279
+ };
280
+ /**
281
+ * Get both the name and id of a player from either their name or id
282
+ *
283
+ * @param idOrName Id or name of player
284
+ * @param onMissing Pass "throw" or omit to throw an error if the player is not found
285
+ * @returns Object containing id and name of player
286
+ * @throws {Error} Throws an error if the player is not found
287
+ */
288
+ export declare function getPlayerFromIdOrName(idOrName: number | string, onMissing?: "throw"): Player;
289
+ /**
290
+ * Get both the name and id of a player from either their name or id
291
+ *
292
+ * @param idOrName Id or name of player
293
+ * @param onMissing Pass "return-null" to return null if the player is not found
294
+ * @returns Object containing id and name of player if it exists, or handles according to onMissing
295
+ */
296
+ export declare function getPlayerFromIdOrName(idOrName: number | string, onMissing: "throw" | "return-null"): Player | null;
297
+ /**
298
+ * Determine the step as a number for a given quest property.
299
+ *
300
+ * @param questName Name of quest property to check.
301
+ * @returns Quest step
302
+ */
303
+ export declare function questStep(questName: string): number;
304
+ export declare class EnsureError extends Error {
305
+ constructor(cause: Item | Familiar | Effect, reason?: string);
306
+ }
307
+ /**
308
+ * Tries to get an effect using the default method
309
+ *
310
+ * @param ef effect to try to get
311
+ * @param turns turns to aim for; default of 1
312
+ * @throws {EnsureError} Throws an error if the effect cannot be guaranteed
313
+ */
314
+ export declare function ensureEffect(ef: Effect, turns?: number): void;
315
+ /**
316
+ * Determiens the average value (based on mallprice and autosell) of a collection of items
317
+ *
318
+ * @param items items whose value you care about
319
+ * @returns Average value of items
320
+ */
321
+ export declare function getSaleValue(...items: Item[]): number;
322
+ export declare const Environment: {
323
+ readonly Outdoor: "outdoor";
324
+ readonly Indoor: "indoor";
325
+ readonly Underground: "underground";
326
+ readonly Underwater: "underwater";
327
+ };
328
+ export declare type EnvironmentType = typeof Environment[keyof typeof Environment];
329
+ /**
330
+ * Determines the weight-coefficient of any leprechaunning that this familiar may find itself doing
331
+ * Assumes the familiar is nude and thus fails for hatrack & pantsrack
332
+ * For the Mutant Cactus Bud, returns the efficacy-multiplier instead
333
+ *
334
+ * @param familiar The familiar whose leprechaun multiplier you're interested in
335
+ * @returns Weight-coefficient
336
+ */
337
+ export declare function findLeprechaunMultiplier(familiar: Familiar): number;
338
+ /**
339
+ * Determines the weight-coefficient of any baby gravy fairying that this familiar may find itself doing
340
+ * Assumes the familiar is nude and thus fails for hatrack & pantsrack
341
+ * For the Mutant Fire Ant, returns the efficacy-multiplier instead
342
+ *
343
+ * @param familiar The familiar whose fairy multiplier you're interested in
344
+ * @returns Weight-coefficient
345
+ */
346
+ export declare function findFairyMultiplier(familiar: Familiar): number;
347
+ export declare const holidayWanderers: Map<string, Monster[]>;
348
+ /**
349
+ * Get today's holiday wanderers
350
+ *
351
+ * @returns List of holiday wanderer Monsters
352
+ */
353
+ export declare function getTodaysHolidayWanderers(): Monster[];
354
+ /**
355
+ * Determines whether or not we can safely call visitUrl(), based on whether we're in a fight, multi-fight, choice, etc
356
+ *
357
+ * @returns Whether urls can be safely visited
358
+ */
359
+ export declare function canVisitUrl(): boolean;
360
+ /**
361
+ * Calculate damage taken from a specific element after factoring in resistance
362
+ *
363
+ * @param baseDamage Base damage
364
+ * @param element Element
365
+ * @returns damage after factoring in resistances
366
+ */
367
+ export declare function damageTakenByElement(baseDamage: number, element: Element): number;
368
+ /**
369
+ * Get information from telescope
370
+ *
371
+ * @returns An object with all information the telescope gives you about the sorceress's contests and maze
372
+ */
373
+ export declare function telescope(): {
374
+ statContest?: Stat;
375
+ elementContest?: Element;
376
+ hedge1?: Element;
377
+ hedge2?: Element;
378
+ hedge3?: Element;
379
+ };
380
+ /**
381
+ * Visit the desc_x.php page for a given thing
382
+ *
383
+ * @param thing Thing to examine
384
+ * @returns Contents of desc_x.php page
385
+ */
386
+ export declare function examine(thing: Item | Familiar | Effect | Skill): string;
387
+ /**
388
+ * Picks an option based on your primestat
389
+ *
390
+ * @param options An object keyed by stat; it must either contain all stats, or have a `default` parameter.
391
+ * @returns The option corresponding to your primestat.
392
+ */
393
+ export declare const byStat: <S>(options: import("./utils").Switch<import("kolmafia").StatType, S>) => S;
394
+ /**
395
+ * Picks an option based on your player class
396
+ *
397
+ * @param options An object keyed by player class; it must either contain all classes, or have a `default` parameter.
398
+ * @returns The option corresponding to your player class.
399
+ */
400
+ export declare const byClass: <S>(options: import("./utils").Switch<import("kolmafia").ClassType, S>) => S;
401
+ /**
402
+ * Use an item with visitUrl instead of `use`; this is sometimes useful
403
+ *
404
+ * @param item The item you want to use
405
+ * @returns The html of the resulting page
406
+ */
407
+ export declare function directlyUse(item: Item): string;
408
+ /**
409
+ * Unequip all instances of a given equipped item
410
+ *
411
+ * @param item The item in question
412
+ * @returns Whether we succeeded completely--`false` if we unequip some but not all instances of the item.
413
+ */
414
+ export declare function unequip(item: Item): boolean;
415
+ /**
416
+ * Empty a given slot.
417
+ *
418
+ * @param slot The slot in question
419
+ * @returns Whether we successfully emptied the slot
420
+ */
421
+ export declare function unequip(slot: Slot): boolean;
422
+ /**
423
+ * @returns a Date object corresponding to the current in-game day, at midnight
424
+ */
425
+ export declare function gameDay(): Date;
426
+ /**
427
+ * @param [type="all"] the type of crafting to check for free crafts
428
+ * @returns the number of free crafts available of that type
429
+ */
430
+ export declare function freeCrafts(type?: "food" | "smith" | "booze" | "all"): number;
431
+ export declare const realmTypes: readonly ["spooky", "stench", "hot", "cold", "sleaze", "fantasy", "pirate"];
432
+ export declare type RealmType = typeof realmTypes[number];
433
+ /**
434
+ * @param identifier which realm to check for
435
+ * @returns if that realm is available
436
+ */
437
+ export declare function realmAvailable(identifier: RealmType): boolean;
438
+ /**
439
+ * Compute the currently available Lucky Gold Ring Currencies
440
+ * @param realm the realm type to consider
441
+ * @returns The currency for the given zone
442
+ */
443
+ export declare function realmCurrency(realm: RealmType): Item | null;
444
+ /**
445
+ * Compute which Lucky Gold Ring currencies are currently available
446
+ * @returns a list of currently available currencies
447
+ */
448
+ export declare function lgrCurrencies(): Item[];
449
+ declare const ACCOUNT_COMBAT_FLAGS: readonly ["aabosses", "wowbar", "bothcombatinterf", "compactmanuel", "eternalmrj", "disablelovebugs", "boringdarts"];
450
+ /**
451
+ * Different flags you can set on your account for how to handle combat:
452
+ * aabosses refers to the flag that lets autoattack trigger against special monsters
453
+ * wowbar refers to the flag to use the Combat Action Bar
454
+ * bothcombatinterf refers to the flag to use both the CAB
455
+ * compactmanuel refers to the flag to display monster manuel data horizontally
456
+ * eternalmrg refers to the flag to enable endless factoid delight
457
+ * disablelovebugs disables love bugs
458
+ * boringdarts avoid rendering the dartboard in combat
459
+ */
460
+ export declare type AccountCombatFlag = typeof ACCOUNT_COMBAT_FLAGS[number];
461
+ /**
462
+ * Get the current value of all of your account's combat setting flags
463
+ * @param flags An array of the flags you want to get, defaults to all of them
464
+ * @returns An array of objects that contain the flags and their values as booleans
465
+ */
466
+ export declare function getCombatFlags(flags?: AccountCombatFlag[]): {
467
+ flag: AccountCombatFlag;
468
+ value: boolean;
469
+ }[];
470
+ /**
471
+ * Sets the given combat setting flags on your account
472
+ *
473
+ * @param flags A spread array of objects that contain a flag and its desired value; these look like the return value of `getCombatFlags`
474
+ * @returns the result of the associated `visitUrl` call
475
+ */
476
+ export declare function setCombatFlags(...flags: {
477
+ flag: AccountCombatFlag;
478
+ value: boolean;
479
+ }[]): string;
480
+ /**
481
+ * Perform a given action with certain combat setting flags set, returning them to their initial values if possible
482
+ *
483
+ * @param action The action you want to do with the given combat setting flags
484
+ * @param flags A spread array of objects that contain a combat setting flag and its desired value; these look like the return value of `getCombatFlags`
485
+ * @returns The result of the action
486
+ */
487
+ export declare function withCombatFlags<T>(action: () => T, ...flags: {
488
+ flag: AccountCombatFlag;
489
+ value: boolean;
490
+ }[]): T;
491
+ /**
492
+ * Determines whether you currently have an effect intrinsically
493
+ * @param effect The effect in question
494
+ * @returns Whether you have that effect as an intrinsic. Alternately you could just have over 2147483647 turns of that effect, but that seems unlikely.
495
+ */
496
+ export declare function haveIntrinsic(effect: Effect): boolean;
497
+ /**
498
+ * Extracts a map of gained items from a string, for example from the result
499
+ * of a combat.
500
+ *
501
+ * NOTE: Make sure you trust the source of that text.
502
+ *
503
+ * @param text The text to extract items from
504
+ * @returns A map of items and their quantities
505
+ */
506
+ export declare function extractItems(text: string): Map<Item, number>;
507
+ export declare type CombatParams = Parameters<typeof runCombat>;
508
+ export {};