libram 0.3.2 → 0.4.2
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/Clan.js +268 -485
- package/dist/Copier.js +11 -48
- package/dist/Dungeon.js +77 -157
- package/dist/Kmail.d.ts +13 -7
- package/dist/Kmail.js +92 -233
- package/dist/Path.js +68 -120
- package/dist/ascend.js +153 -172
- package/dist/combat.d.ts +86 -1
- package/dist/combat.js +295 -387
- package/dist/console.js +13 -36
- package/dist/diet/index.d.ts +31 -0
- package/dist/diet/index.js +333 -0
- package/dist/diet/knapsack.d.ts +7 -0
- package/dist/diet/knapsack.js +106 -0
- package/dist/dungeons/Dreadsylvania.d.ts +4 -0
- package/dist/dungeons/Dreadsylvania.js +14 -0
- package/dist/dungeons/Dungeon.d.ts +28 -0
- package/dist/dungeons/Dungeon.js +99 -0
- package/dist/dungeons/Hobopolis.d.ts +4 -0
- package/dist/dungeons/Hobopolis.js +14 -0
- package/dist/dungeons/SlimeTube.d.ts +4 -0
- package/dist/dungeons/SlimeTube.js +14 -0
- package/dist/freerun.d.ts +23 -0
- package/dist/freerun.js +92 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +21 -263
- package/dist/lib.d.ts +43 -0
- package/dist/lib.js +296 -405
- package/dist/logger.js +23 -63
- package/dist/maximize.d.ts +29 -12
- package/dist/maximize.js +318 -421
- package/dist/modifier.d.ts +13 -0
- package/dist/modifier.js +35 -0
- package/dist/modifierTypes.d.ts +16 -0
- package/dist/modifierTypes.js +9 -0
- package/dist/mood.js +220 -531
- package/dist/property.d.ts +2 -0
- package/dist/property.js +96 -242
- package/dist/propertyTypes.d.ts +9 -0
- package/dist/propertyTypes.js +1 -0
- package/dist/propertyTyping.d.ts +2 -9
- package/dist/propertyTyping.js +42 -53
- package/dist/resources/2007/CandyHearts.d.ts +9 -0
- package/dist/resources/2007/CandyHearts.js +24 -0
- package/dist/resources/2008/DivineFavors.d.ts +9 -0
- package/dist/resources/2008/DivineFavors.js +27 -0
- package/dist/resources/2009/Bandersnatch.js +37 -112
- package/dist/resources/2009/LoveSongs.d.ts +9 -0
- package/dist/resources/2009/LoveSongs.js +24 -0
- package/dist/resources/2009/SpookyPutty.js +20 -46
- package/dist/resources/2010/Brickos.d.ts +9 -0
- package/dist/resources/2010/Brickos.js +21 -0
- package/dist/resources/2010/CrownOfThrones.d.ts +18 -0
- package/dist/resources/2010/CrownOfThrones.js +550 -0
- package/dist/resources/2011/Gygaxian.d.ts +9 -0
- package/dist/resources/2011/Gygaxian.js +24 -0
- package/dist/resources/2011/ObtuseAngel.js +21 -63
- package/dist/resources/2012/RainDoh.js +14 -40
- package/dist/resources/2012/Resolutions.d.ts +9 -0
- package/dist/resources/2012/Resolutions.js +28 -0
- package/dist/resources/2013/Florist.d.ts +61 -0
- package/dist/resources/2013/Florist.js +149 -0
- package/dist/resources/2013/PulledTaffy.d.ts +9 -0
- package/dist/resources/2013/PulledTaffy.js +33 -0
- package/dist/resources/2014/WinterGarden.js +15 -43
- package/dist/resources/2015/ChateauMantegna.js +52 -86
- package/dist/resources/2015/MayoClinic.d.ts +13 -0
- package/dist/resources/2015/MayoClinic.js +36 -0
- package/dist/resources/2016/SourceTerminal.d.ts +1 -0
- package/dist/resources/2016/SourceTerminal.js +114 -237
- package/dist/resources/2016/Witchess.js +33 -59
- package/dist/resources/2017/TunnelOfLove.js +62 -111
- package/dist/resources/2018/SongBoom.js +32 -68
- package/dist/resources/2019/BeachComb.d.ts +2 -0
- package/dist/resources/2019/BeachComb.js +26 -0
- package/dist/resources/2019/Snapper.d.ts +28 -0
- package/dist/resources/2019/Snapper.js +70 -0
- package/dist/resources/2020/Guzzlr.js +79 -163
- package/dist/resources/LibramSummon.d.ts +12 -0
- package/dist/resources/LibramSummon.js +66 -0
- package/dist/resources/index.d.ts +18 -11
- package/dist/resources/index.js +19 -85
- package/dist/resources/putty-likes.js +15 -30
- package/dist/ring-buffer.d.ts +24 -0
- package/dist/ring-buffer.js +135 -0
- package/dist/since.d.ts +1 -0
- package/dist/since.js +56 -112
- package/dist/template-string.js +40 -132
- package/dist/utils.d.ts +14 -0
- package/dist/utils.js +50 -114
- package/package.json +5 -3
- package/dist/libram-example-briefcase.js +0 -16073
- package/dist/libram-example-clan.js +0 -8898
- package/dist/libram-example-consult.js +0 -6179
- package/dist/libram-example-item.js +0 -3248
- package/dist/libram-example-kmail.js +0 -2065
- package/dist/libram-example-lib.js +0 -7608
- package/dist/libram-example-props.js +0 -4770
- package/dist/libram-example-resources.js +0 -12226
package/dist/logger.js
CHANGED
|
@@ -1,69 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
})
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
require("core-js/modules/es.object.to-string.js");
|
|
9
|
-
|
|
10
|
-
require("core-js/modules/es.regexp.to-string.js");
|
|
11
|
-
|
|
12
|
-
var _kolmafia = require("kolmafia");
|
|
13
|
-
|
|
14
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
-
|
|
16
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
17
|
-
|
|
18
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
19
|
-
|
|
20
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
|
-
|
|
22
|
-
var defaultHandlers = {
|
|
23
|
-
info: message => (0, _kolmafia.printHtml)("<b>[Libram]</b> ".concat(message)),
|
|
24
|
-
warning: message => (0, _kolmafia.printHtml)("<span style=\"background: orange; color: white;\"><b>[Libram]</b> ".concat(message, "</span>")),
|
|
25
|
-
error: _error => (0, _kolmafia.printHtml)("<span style=\"background: red; color: white;\"><b>[Libram]</b> ".concat(_error.toString(), "</span>"))
|
|
1
|
+
import { printHtml } from "kolmafia";
|
|
2
|
+
const defaultHandlers = {
|
|
3
|
+
info: (message) => printHtml(`<b>[Libram]</b> ${message}`),
|
|
4
|
+
warning: (message) => printHtml(`<span style="background: orange; color: white;"><b>[Libram]</b> ${message}</span>`),
|
|
5
|
+
error: (error) => printHtml(`<span style="background: red; color: white;"><b>[Libram]</b> ${error.toString()}</span>`),
|
|
26
6
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
_classCallCheck(this, Logger);
|
|
31
|
-
|
|
32
|
-
_defineProperty(this, "handlers", defaultHandlers);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
_createClass(Logger, [{
|
|
36
|
-
key: "setHandler",
|
|
37
|
-
value: // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
-
function setHandler(level, callback) {
|
|
39
|
-
this.handlers[level] = callback;
|
|
7
|
+
class Logger {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.handlers = defaultHandlers;
|
|
40
10
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
function log(level, message) {
|
|
45
|
-
this.handlers[level](message);
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
+
setHandler(level, callback) {
|
|
13
|
+
this.handlers[level] = callback;
|
|
46
14
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
this.log("info", message);
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
+
log(level, message) {
|
|
17
|
+
this.handlers[level](message);
|
|
51
18
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
value: function warning(message) {
|
|
55
|
-
this.log("warning", message);
|
|
19
|
+
info(message) {
|
|
20
|
+
this.log("info", message);
|
|
56
21
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
value: function error(message) {
|
|
60
|
-
this.log("error", message);
|
|
22
|
+
warning(message) {
|
|
23
|
+
this.log("warning", message);
|
|
61
24
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
var _default = new Logger();
|
|
68
|
-
|
|
69
|
-
exports.default = _default;
|
|
25
|
+
error(message) {
|
|
26
|
+
this.log("error", message);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export default new Logger();
|
package/dist/maximize.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export declare type MaximizeOptions = {
|
|
2
|
-
updateOnFamiliarChange
|
|
3
|
-
updateOnCanEquipChanged
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
updateOnFamiliarChange: boolean;
|
|
3
|
+
updateOnCanEquipChanged: boolean;
|
|
4
|
+
useOutfitCaching: boolean;
|
|
5
|
+
forceEquip: Item[];
|
|
6
|
+
preventEquip: Item[];
|
|
7
|
+
bonusEquip: Map<Item, number>;
|
|
8
|
+
onlySlot: Slot[];
|
|
9
|
+
preventSlot: Slot[];
|
|
9
10
|
};
|
|
10
11
|
/**
|
|
11
12
|
*
|
|
@@ -16,7 +17,7 @@ export declare type MaximizeOptions = {
|
|
|
16
17
|
* @param options.preventEquip Equipment to prevent equipping ("-equip X").
|
|
17
18
|
* @param options.bonusEquip Equipment to apply a bonus to ("200 bonus X").
|
|
18
19
|
*/
|
|
19
|
-
export declare function setDefaultMaximizeOptions(options: MaximizeOptions): void;
|
|
20
|
+
export declare function setDefaultMaximizeOptions(options: Partial<MaximizeOptions>): void;
|
|
20
21
|
/**
|
|
21
22
|
* Run the maximizer, but only if the objective and certain pieces of game state haven't changed since it was last run.
|
|
22
23
|
* @param objectives Objectives to maximize for.
|
|
@@ -27,7 +28,7 @@ export declare function setDefaultMaximizeOptions(options: MaximizeOptions): voi
|
|
|
27
28
|
* @param options.preventEquip Equipment to prevent equipping ("-equip X").
|
|
28
29
|
* @param options.bonusEquip Equipment to apply a bonus to ("200 bonus X").
|
|
29
30
|
*/
|
|
30
|
-
export declare function maximizeCached(objectives: string[], options?: MaximizeOptions): void;
|
|
31
|
+
export declare function maximizeCached(objectives: string[], options?: Partial<MaximizeOptions>): void;
|
|
31
32
|
export declare class Requirement {
|
|
32
33
|
#private;
|
|
33
34
|
/**
|
|
@@ -35,10 +36,26 @@ export declare class Requirement {
|
|
|
35
36
|
* @param maximizeParameters Parameters you're attempting to maximize
|
|
36
37
|
* @param maximizeOptions Object potentially containing forceEquips, bonusEquips, preventEquips, and preventSlots
|
|
37
38
|
*/
|
|
38
|
-
constructor(maximizeParameters: string[], maximizeOptions: MaximizeOptions);
|
|
39
|
+
constructor(maximizeParameters: string[], maximizeOptions: Partial<MaximizeOptions>);
|
|
39
40
|
get maximizeParameters(): string[];
|
|
40
|
-
get maximizeOptions(): MaximizeOptions
|
|
41
|
+
get maximizeOptions(): Partial<MaximizeOptions>;
|
|
42
|
+
/**
|
|
43
|
+
* Merges two requirements, concanating relevant arrays. Typically used in static form.
|
|
44
|
+
* @param other Requirement to merge with.
|
|
45
|
+
*/
|
|
41
46
|
merge(other: Requirement): Requirement;
|
|
47
|
+
/**
|
|
48
|
+
* Merges a set of requirements together, starting with an empty requirement.
|
|
49
|
+
* @param allRequirements Requirements to merge
|
|
50
|
+
*/
|
|
42
51
|
static merge(allRequirements: Requirement[]): Requirement;
|
|
52
|
+
/**
|
|
53
|
+
* Runs maximizeCached, using the maximizeParameters and maximizeOptions contained by this requirement.
|
|
54
|
+
*/
|
|
55
|
+
maximize(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Merges requirements, and then runs maximizeCached on the combined requirement.
|
|
58
|
+
* @param requirements Requirements to maximize on
|
|
59
|
+
*/
|
|
60
|
+
static maximize(...requirements: Requirement[]): void;
|
|
43
61
|
}
|
|
44
|
-
export declare function maximizeRequirementsCached(requirements: Requirement[]): void;
|