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/maximize.js
CHANGED
|
@@ -1,105 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
exports.setDefaultMaximizeOptions = setDefaultMaximizeOptions;
|
|
15
|
-
exports.maximizeCached = maximizeCached;
|
|
16
|
-
exports.maximizeRequirementsCached = maximizeRequirementsCached;
|
|
17
|
-
exports.Requirement = void 0;
|
|
18
|
-
|
|
19
|
-
require("core-js/modules/es.array.iterator.js");
|
|
20
|
-
|
|
21
|
-
require("core-js/modules/es.object.to-string.js");
|
|
22
|
-
|
|
23
|
-
require("core-js/modules/es.object.assign.js");
|
|
24
|
-
|
|
25
|
-
require("core-js/modules/es.array.map.js");
|
|
26
|
-
|
|
27
|
-
require("core-js/modules/es.array.filter.js");
|
|
28
|
-
|
|
29
|
-
require("core-js/modules/es.array.concat.js");
|
|
30
|
-
|
|
31
|
-
require("core-js/modules/es.array.includes.js");
|
|
32
|
-
|
|
33
|
-
require("core-js/modules/es.string.includes.js");
|
|
34
|
-
|
|
35
|
-
require("core-js/modules/es.array.sort.js");
|
|
36
|
-
|
|
37
|
-
var _kolmafia = require("kolmafia");
|
|
38
|
-
|
|
39
|
-
var _templateString = require("./template-string");
|
|
40
|
-
|
|
41
|
-
var _logger = _interopRequireDefault(require("./logger"));
|
|
42
|
-
|
|
43
|
-
var _merge2 = _interopRequireDefault(require("lodash/merge"));
|
|
44
|
-
|
|
45
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35, _templateObject36, _templateObject37;
|
|
46
|
-
|
|
47
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
48
|
-
|
|
49
|
-
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); } }
|
|
50
|
-
|
|
51
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
52
|
-
|
|
53
|
-
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
|
54
|
-
|
|
55
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
56
|
-
|
|
57
|
-
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
|
58
|
-
|
|
59
|
-
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
|
60
|
-
|
|
61
|
-
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
|
62
|
-
|
|
63
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
64
|
-
|
|
65
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
66
|
-
|
|
67
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
68
|
-
|
|
69
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
70
|
-
|
|
71
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
72
|
-
|
|
73
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
74
|
-
|
|
75
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
76
|
-
|
|
77
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
78
|
-
|
|
79
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
80
|
-
|
|
81
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
82
|
-
|
|
83
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
84
|
-
|
|
85
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
86
|
-
|
|
87
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
88
|
-
|
|
89
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
90
|
-
|
|
91
|
-
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; }
|
|
92
|
-
|
|
93
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
94
|
-
|
|
95
|
-
var defaultMaximizeOptions = {
|
|
96
|
-
updateOnFamiliarChange: true,
|
|
97
|
-
updateOnCanEquipChanged: true,
|
|
98
|
-
forceEquip: [],
|
|
99
|
-
preventEquip: [],
|
|
100
|
-
bonusEquip: new Map(),
|
|
101
|
-
onlySlot: [],
|
|
102
|
-
preventSlot: []
|
|
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";
|
|
3
|
+
import logger from "./logger";
|
|
4
|
+
import { setEqual } from "./utils";
|
|
5
|
+
const defaultMaximizeOptions = {
|
|
6
|
+
updateOnFamiliarChange: true,
|
|
7
|
+
updateOnCanEquipChanged: true,
|
|
8
|
+
useOutfitCaching: true,
|
|
9
|
+
forceEquip: [],
|
|
10
|
+
preventEquip: [],
|
|
11
|
+
bonusEquip: new Map(),
|
|
12
|
+
onlySlot: [],
|
|
13
|
+
preventSlot: [],
|
|
103
14
|
};
|
|
104
15
|
/**
|
|
105
16
|
*
|
|
@@ -110,51 +21,96 @@ var defaultMaximizeOptions = {
|
|
|
110
21
|
* @param options.preventEquip Equipment to prevent equipping ("-equip X").
|
|
111
22
|
* @param options.bonusEquip Equipment to apply a bonus to ("200 bonus X").
|
|
112
23
|
*/
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
24
|
+
export function setDefaultMaximizeOptions(options) {
|
|
25
|
+
Object.assign(defaultMaximizeOptions, options);
|
|
26
|
+
}
|
|
27
|
+
// Subset of slots that are valid for caching.
|
|
28
|
+
const cachedSlots = $slots `hat, weapon, off-hand, back, shirt, pants, acc1, acc2, acc3, familiar`;
|
|
29
|
+
class CacheEntry {
|
|
30
|
+
constructor(equipment, rider, familiar, canEquipItemCount) {
|
|
31
|
+
this.equipment = equipment;
|
|
32
|
+
this.rider = rider;
|
|
33
|
+
this.familiar = familiar;
|
|
34
|
+
this.canEquipItemCount = canEquipItemCount;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
class OutfitLRUCache {
|
|
38
|
+
constructor(maxSize) {
|
|
39
|
+
// Current outfits allocated
|
|
40
|
+
this.#outfitSlots = [];
|
|
41
|
+
// Array of indices into #outfitSlots in order of use. Most recent at the front.
|
|
42
|
+
this.#useHistory = [];
|
|
43
|
+
this.#maxSize = maxSize;
|
|
44
|
+
}
|
|
45
|
+
// Current outfits allocated
|
|
46
|
+
#outfitSlots;
|
|
47
|
+
// Array of indices into #outfitSlots in order of use. Most recent at the front.
|
|
48
|
+
#useHistory;
|
|
49
|
+
#maxSize;
|
|
50
|
+
checkConsistent() {
|
|
51
|
+
if (this.#useHistory.length !== this.#outfitSlots.length ||
|
|
52
|
+
![...this.#useHistory].sort().every((value, index) => value === index)) {
|
|
53
|
+
throw new Error("Outfit cache consistency failed.");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
promote(index) {
|
|
57
|
+
this.#useHistory = [index, ...this.#useHistory.filter((i) => i !== index)];
|
|
58
|
+
this.checkConsistent();
|
|
59
|
+
}
|
|
60
|
+
get(key) {
|
|
61
|
+
const index = this.#outfitSlots.indexOf(key);
|
|
62
|
+
if (index < 0)
|
|
63
|
+
return undefined;
|
|
64
|
+
this.promote(index);
|
|
65
|
+
return `${OutfitLRUCache.OUTFIT_PREFIX} ${index}`;
|
|
66
|
+
}
|
|
67
|
+
insert(key) {
|
|
68
|
+
let lastUseIndex = undefined;
|
|
69
|
+
if (this.#outfitSlots.length >= this.#maxSize) {
|
|
70
|
+
lastUseIndex = this.#useHistory.pop();
|
|
71
|
+
if (lastUseIndex === undefined) {
|
|
72
|
+
throw new Error("Outfit cache consistency failed.");
|
|
73
|
+
}
|
|
74
|
+
this.#useHistory.splice(0, 0, lastUseIndex);
|
|
75
|
+
this.#outfitSlots[lastUseIndex] = key;
|
|
76
|
+
this.checkConsistent();
|
|
77
|
+
return `${OutfitLRUCache.OUTFIT_PREFIX} ${lastUseIndex}`;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
const index = this.#outfitSlots.push(key) - 1;
|
|
81
|
+
this.#useHistory.splice(0, 0, index);
|
|
82
|
+
this.checkConsistent();
|
|
83
|
+
return `${OutfitLRUCache.OUTFIT_PREFIX} ${index}`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
OutfitLRUCache.OUTFIT_PREFIX = "Script Outfit";
|
|
88
|
+
/**
|
|
89
|
+
* Save current equipment as KoL-native outfit.
|
|
90
|
+
* @param name Name of new outfit.
|
|
91
|
+
*/
|
|
92
|
+
function saveOutfit(name) {
|
|
93
|
+
cliExecute(`outfit save ${name}`);
|
|
94
|
+
}
|
|
95
|
+
// Objective cache entries.
|
|
96
|
+
const cachedObjectives = {};
|
|
97
|
+
// Outfit cache entries. Keep 6 by default to avoid cluttering list.
|
|
98
|
+
const outfitCache = new OutfitLRUCache(6);
|
|
99
|
+
// Cache to prevent rescanning all items unnecessarily
|
|
100
|
+
let cachedStats = [0, 0, 0];
|
|
101
|
+
let cachedCanEquipItemCount = 0;
|
|
143
102
|
/**
|
|
144
103
|
* Count the number of unique items that can be equipped.
|
|
145
104
|
* @returns The count of unique items.
|
|
146
105
|
*/
|
|
147
|
-
|
|
148
106
|
function canEquipItemCount() {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
107
|
+
const stats = $stats `Muscle, Mysticality, Moxie`.map((stat) => Math.min(myBasestat(stat), 300));
|
|
108
|
+
if (stats.every((value, index) => value === cachedStats[index])) {
|
|
109
|
+
return cachedCanEquipItemCount;
|
|
110
|
+
}
|
|
111
|
+
cachedStats = stats;
|
|
112
|
+
cachedCanEquipItemCount = Item.all().filter((item) => canEquip(item)).length;
|
|
152
113
|
return cachedCanEquipItemCount;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
cachedStats = stats;
|
|
156
|
-
cachedCanEquipItemCount = Item.all().filter(item => (0, _kolmafia.canEquip)(item)).length;
|
|
157
|
-
return cachedCanEquipItemCount;
|
|
158
114
|
}
|
|
159
115
|
/**
|
|
160
116
|
* Checks the objective cache for a valid entry.
|
|
@@ -163,200 +119,149 @@ function canEquipItemCount() {
|
|
|
163
119
|
* @param updateOnCanEquipChanged Ignore cache if stats have changed what can be equipped.
|
|
164
120
|
* @returns A valid CacheEntry or null.
|
|
165
121
|
*/
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if (updateOnCanEquipChanged && entry.canEquipItemCount !== canEquipItemCount()) {
|
|
182
|
-
_logger.default.warning("Equipment found in maximize cache but equippable item list is out of date.");
|
|
183
|
-
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return entry;
|
|
122
|
+
function checkCache(cacheKey, options) {
|
|
123
|
+
const entry = cachedObjectives[cacheKey];
|
|
124
|
+
if (!entry) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
if (options.updateOnFamiliarChange && myFamiliar() !== entry.familiar) {
|
|
128
|
+
logger.warning("Equipment found in maximize cache but familiar is different.");
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
if (options.updateOnCanEquipChanged &&
|
|
132
|
+
entry.canEquipItemCount !== canEquipItemCount()) {
|
|
133
|
+
logger.warning("Equipment found in maximize cache but equippable item list is out of date.");
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
return entry;
|
|
188
137
|
}
|
|
189
138
|
/**
|
|
190
139
|
* Applies equipment that was found in the cache.
|
|
191
140
|
* @param entry The CacheEntry to apply
|
|
192
141
|
*/
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
(
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
142
|
+
function applyCached(entry, options) {
|
|
143
|
+
const outfitName = options.useOutfitCaching
|
|
144
|
+
? outfitCache.get(entry)
|
|
145
|
+
: undefined;
|
|
146
|
+
if (outfitName) {
|
|
147
|
+
if (!isWearingOutfit(outfitName)) {
|
|
148
|
+
outfit(outfitName);
|
|
149
|
+
}
|
|
150
|
+
const familiarEquip = entry.equipment.get($slot `familiar`);
|
|
151
|
+
if (familiarEquip)
|
|
152
|
+
equip(familiarEquip);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
for (const [slot, item] of entry.equipment) {
|
|
156
|
+
if (equippedItem(slot) !== item && availableAmount(item) > 0) {
|
|
157
|
+
equip(slot, item);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (verifyCached(entry) && options.useOutfitCaching) {
|
|
161
|
+
const outfitName = outfitCache.insert(entry);
|
|
162
|
+
logger.info(`Saving equipment to outfit ${outfitName}.`);
|
|
163
|
+
saveOutfit(outfitName);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (equippedAmount($item `Crown of Thrones`) > 0 &&
|
|
167
|
+
entry.rider.get($item `Crown of Thrones`)) {
|
|
168
|
+
enthroneFamiliar(entry.rider.get($item `Crown of Thrones`) || $familiar `none`);
|
|
169
|
+
}
|
|
170
|
+
if (equippedAmount($item `Buddy Bjorn`) > 0 &&
|
|
171
|
+
entry.rider.get($item `Buddy Bjorn`)) {
|
|
172
|
+
bjornifyFamiliar(entry.rider.get($item `Buddy Bjorn`) || $familiar `none`);
|
|
173
|
+
}
|
|
222
174
|
}
|
|
175
|
+
const slotStructure = [
|
|
176
|
+
$slots `hat`,
|
|
177
|
+
$slots `back`,
|
|
178
|
+
$slots `shirt`,
|
|
179
|
+
$slots `weapon, off-hand`,
|
|
180
|
+
$slots `pants`,
|
|
181
|
+
$slots `acc1, acc2, acc3`,
|
|
182
|
+
$slots `familiar`,
|
|
183
|
+
];
|
|
223
184
|
/**
|
|
224
185
|
* Verifies that a CacheEntry was applied successfully.
|
|
225
186
|
* @param entry The CacheEntry to verify
|
|
226
187
|
* @returns If all desired equipment was appliedn in the correct slots.
|
|
227
188
|
*/
|
|
228
|
-
|
|
229
|
-
|
|
230
189
|
function verifyCached(entry) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
if (entry.rider.get((0, _templateString.$item)(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["Crown of Thrones"])))) !== (0, _kolmafia.myEnthronedFamiliar)()) {
|
|
256
|
-
_logger.default.warning("Failed to apply ".concat(entry.rider.get((0, _templateString.$item)(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["Crown of Thrones"])))), " in ").concat((0, _templateString.$item)(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["Crown of Thrones"]))), "."));
|
|
257
|
-
|
|
258
|
-
success = false;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
if ((0, _kolmafia.equippedAmount)((0, _templateString.$item)(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["Buddy Bjorn"])))) > 0 && entry.rider.get((0, _templateString.$item)(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["Buddy Bjorn"]))))) {
|
|
263
|
-
if (entry.rider.get((0, _templateString.$item)(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["Buddy Bjorn"])))) !== (0, _kolmafia.myBjornedFamiliar)()) {
|
|
264
|
-
_logger.default.warning("Failed to apply".concat(entry.rider.get((0, _templateString.$item)(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["Buddy Bjorn"])))), " in ").concat((0, _templateString.$item)(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["Buddy Bjorn"]))), "."));
|
|
265
|
-
|
|
266
|
-
success = false;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
return success;
|
|
190
|
+
let success = true;
|
|
191
|
+
for (const slotGroup of slotStructure) {
|
|
192
|
+
const desiredSet = slotGroup.map((slot) => entry.equipment.get(slot) ?? $item `none`);
|
|
193
|
+
const equippedSet = slotGroup.map((slot) => equippedItem(slot));
|
|
194
|
+
if (!setEqual(desiredSet, equippedSet)) {
|
|
195
|
+
logger.warning(`Failed to apply cached ${desiredSet.join(", ")} in ${slotGroup.join(", ")}.`);
|
|
196
|
+
success = false;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (equippedAmount($item `Crown of Thrones`) > 0 &&
|
|
200
|
+
entry.rider.get($item `Crown of Thrones`)) {
|
|
201
|
+
if (entry.rider.get($item `Crown of Thrones`) !== myEnthronedFamiliar()) {
|
|
202
|
+
logger.warning(`Failed to apply ${entry.rider.get($item `Crown of Thrones`)} in ${$item `Crown of Thrones`}.`);
|
|
203
|
+
success = false;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (equippedAmount($item `Buddy Bjorn`) > 0 &&
|
|
207
|
+
entry.rider.get($item `Buddy Bjorn`)) {
|
|
208
|
+
if (entry.rider.get($item `Buddy Bjorn`) !== myBjornedFamiliar()) {
|
|
209
|
+
logger.warning(`Failed to apply${entry.rider.get($item `Buddy Bjorn`)} in ${$item `Buddy Bjorn`}.`);
|
|
210
|
+
success = false;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return success;
|
|
271
214
|
}
|
|
272
215
|
/**
|
|
273
216
|
* Save current equipment to the objective cache.
|
|
274
217
|
* @param cacheKey The cache key to save.
|
|
275
218
|
*/
|
|
276
|
-
|
|
277
|
-
|
|
278
219
|
function saveCached(cacheKey, options) {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
try {
|
|
313
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
314
|
-
var slot = _step4.value;
|
|
315
|
-
equipment.delete(slot);
|
|
316
|
-
}
|
|
317
|
-
} catch (err) {
|
|
318
|
-
_iterator4.e(err);
|
|
319
|
-
} finally {
|
|
320
|
-
_iterator4.f();
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
if (options.preventSlot.includes((0, _templateString.$slot)(_templateObject28 || (_templateObject28 = _taggedTemplateLiteral(["buddy-bjorn"]))))) {
|
|
324
|
-
rider.delete((0, _templateString.$item)(_templateObject29 || (_templateObject29 = _taggedTemplateLiteral(["Buddy Bjorn"]))));
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
if (options.preventSlot.includes((0, _templateString.$slot)(_templateObject30 || (_templateObject30 = _taggedTemplateLiteral(["crown-of-thrones"]))))) {
|
|
328
|
-
rider.delete((0, _templateString.$item)(_templateObject31 || (_templateObject31 = _taggedTemplateLiteral(["Crown of Thrones"]))));
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
if (options.onlySlot && options.onlySlot.length > 0) {
|
|
333
|
-
var _iterator5 = _createForOfIteratorHelper(Slot.all()),
|
|
334
|
-
_step5;
|
|
335
|
-
|
|
336
|
-
try {
|
|
337
|
-
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
338
|
-
var _slot = _step5.value;
|
|
339
|
-
|
|
340
|
-
if (!options.onlySlot.includes(_slot)) {
|
|
341
|
-
equipment.delete(_slot);
|
|
220
|
+
const equipment = new Map();
|
|
221
|
+
const rider = new Map();
|
|
222
|
+
for (const slot of cachedSlots) {
|
|
223
|
+
equipment.set(slot, equippedItem(slot));
|
|
224
|
+
}
|
|
225
|
+
if (equippedAmount($item `card sleeve`) > 0) {
|
|
226
|
+
equipment.set($slot `card-sleeve`, equippedItem($slot `card-sleeve`));
|
|
227
|
+
}
|
|
228
|
+
if (equippedAmount($item `Crown of Thrones`) > 0) {
|
|
229
|
+
rider.set($item `Crown of Thrones`, myEnthronedFamiliar());
|
|
230
|
+
}
|
|
231
|
+
if (equippedAmount($item `Buddy Bjorn`) > 0) {
|
|
232
|
+
rider.set($item `Buddy Bjorn`, myBjornedFamiliar());
|
|
233
|
+
}
|
|
234
|
+
if (options.preventSlot && options.preventSlot.length > 0) {
|
|
235
|
+
for (const slot of options.preventSlot) {
|
|
236
|
+
equipment.delete(slot);
|
|
237
|
+
}
|
|
238
|
+
if (options.preventSlot.includes($slot `buddy-bjorn`)) {
|
|
239
|
+
rider.delete($item `Buddy Bjorn`);
|
|
240
|
+
}
|
|
241
|
+
if (options.preventSlot.includes($slot `crown-of-thrones`)) {
|
|
242
|
+
rider.delete($item `Crown of Thrones`);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (options.onlySlot && options.onlySlot.length > 0) {
|
|
246
|
+
for (const slot of Slot.all()) {
|
|
247
|
+
if (!options.onlySlot.includes(slot)) {
|
|
248
|
+
equipment.delete(slot);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (!options.onlySlot.includes($slot `buddy-bjorn`)) {
|
|
252
|
+
rider.delete($item `Buddy Bjorn`);
|
|
342
253
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
if (!options.onlySlot.includes((0, _templateString.$slot)(_templateObject34 || (_templateObject34 = _taggedTemplateLiteral(["crown-of-thrones"]))))) {
|
|
355
|
-
rider.delete((0, _templateString.$item)(_templateObject35 || (_templateObject35 = _taggedTemplateLiteral(["Crown of Thrones"]))));
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
cachedObjectives[cacheKey] = new CacheEntry(equipment, rider, (0, _kolmafia.myFamiliar)(), canEquipItemCount());
|
|
254
|
+
if (!options.onlySlot.includes($slot `crown-of-thrones`)) {
|
|
255
|
+
rider.delete($item `Crown of Thrones`);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
const entry = new CacheEntry(equipment, rider, myFamiliar(), canEquipItemCount());
|
|
259
|
+
cachedObjectives[cacheKey] = entry;
|
|
260
|
+
if (options.useOutfitCaching) {
|
|
261
|
+
const outfitName = outfitCache.insert(entry);
|
|
262
|
+
logger.info(`Saving equipment to outfit ${outfitName}.`);
|
|
263
|
+
saveOutfit(outfitName);
|
|
264
|
+
}
|
|
360
265
|
}
|
|
361
266
|
/**
|
|
362
267
|
* Run the maximizer, but only if the objective and certain pieces of game state haven't changed since it was last run.
|
|
@@ -368,109 +273,101 @@ function saveCached(cacheKey, options) {
|
|
|
368
273
|
* @param options.preventEquip Equipment to prevent equipping ("-equip X").
|
|
369
274
|
* @param options.bonusEquip Equipment to apply a bonus to ("200 bonus X").
|
|
370
275
|
*/
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
276
|
+
export function maximizeCached(objectives, options = {}) {
|
|
277
|
+
const fullOptions = { ...defaultMaximizeOptions, ...options };
|
|
278
|
+
const { forceEquip, preventEquip, bonusEquip, onlySlot, preventSlot, } = fullOptions;
|
|
279
|
+
// Sort each group in objective to ensure consistent ordering in string
|
|
280
|
+
const objective = [
|
|
281
|
+
...objectives.sort(),
|
|
282
|
+
...forceEquip.map((item) => `equip ${item}`).sort(),
|
|
283
|
+
...preventEquip.map((item) => `-equip ${item}`).sort(),
|
|
284
|
+
...onlySlot.map((slot) => `${slot}`).sort(),
|
|
285
|
+
...preventSlot.map((slot) => `-${slot}`).sort(),
|
|
286
|
+
...Array.from(bonusEquip.entries())
|
|
287
|
+
.filter(([, bonus]) => bonus !== 0)
|
|
288
|
+
.map(([item, bonus]) => `${Math.round(bonus * 100) / 100} bonus ${item}`)
|
|
289
|
+
.sort(),
|
|
290
|
+
].join(", ");
|
|
291
|
+
const cacheEntry = checkCache(objective, fullOptions);
|
|
292
|
+
if (cacheEntry) {
|
|
293
|
+
logger.info("Equipment found in maximize cache, equipping...");
|
|
294
|
+
applyCached(cacheEntry, fullOptions);
|
|
295
|
+
if (verifyCached(cacheEntry)) {
|
|
296
|
+
logger.info(`Equipped cached ${objective}`);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
logger.warning("Maximize cache application failed, maximizing...");
|
|
300
|
+
}
|
|
301
|
+
maximize(objective, false);
|
|
302
|
+
saveCached(objective, fullOptions);
|
|
303
|
+
}
|
|
304
|
+
export class Requirement {
|
|
305
|
+
/**
|
|
306
|
+
* A convenient way of combining maximization parameters and options
|
|
307
|
+
* @param maximizeParameters Parameters you're attempting to maximize
|
|
308
|
+
* @param maximizeOptions Object potentially containing forceEquips, bonusEquips, preventEquips, and preventSlots
|
|
309
|
+
*/
|
|
310
|
+
constructor(maximizeParameters, maximizeOptions) {
|
|
311
|
+
this.#maximizeParameters = maximizeParameters;
|
|
312
|
+
this.#maximizeOptions = maximizeOptions;
|
|
313
|
+
}
|
|
314
|
+
#maximizeParameters;
|
|
315
|
+
#maximizeOptions;
|
|
316
|
+
get maximizeParameters() {
|
|
317
|
+
return this.#maximizeParameters;
|
|
318
|
+
}
|
|
319
|
+
get maximizeOptions() {
|
|
320
|
+
return this.#maximizeOptions;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Merges two requirements, concanating relevant arrays. Typically used in static form.
|
|
324
|
+
* @param other Requirement to merge with.
|
|
325
|
+
*/
|
|
326
|
+
merge(other) {
|
|
327
|
+
const optionsA = this.maximizeOptions;
|
|
328
|
+
const optionsB = other.maximizeOptions;
|
|
329
|
+
return new Requirement([...this.maximizeParameters, ...other.maximizeParameters], {
|
|
330
|
+
updateOnFamiliarChange: optionsA.updateOnFamiliarChange ||
|
|
331
|
+
other.maximizeOptions.updateOnFamiliarChange,
|
|
332
|
+
updateOnCanEquipChanged: optionsA.updateOnCanEquipChanged ||
|
|
333
|
+
other.maximizeOptions.updateOnCanEquipChanged,
|
|
334
|
+
forceEquip: [
|
|
335
|
+
...(optionsA.forceEquip ?? []),
|
|
336
|
+
...(other.maximizeOptions.forceEquip ?? []),
|
|
337
|
+
],
|
|
338
|
+
preventEquip: [
|
|
339
|
+
...(optionsA.preventEquip ?? []),
|
|
340
|
+
...(other.maximizeOptions.preventEquip ?? []),
|
|
341
|
+
],
|
|
342
|
+
bonusEquip: new Map([
|
|
343
|
+
...(optionsA.bonusEquip?.entries() ?? []),
|
|
344
|
+
...(optionsB.bonusEquip?.entries() ?? []),
|
|
345
|
+
]),
|
|
346
|
+
onlySlot: [...(optionsA.onlySlot ?? []), ...(optionsB.onlySlot ?? [])],
|
|
347
|
+
preventSlot: [
|
|
348
|
+
...(optionsA.preventSlot ?? []),
|
|
349
|
+
...(optionsB.preventSlot ?? []),
|
|
350
|
+
],
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Merges a set of requirements together, starting with an empty requirement.
|
|
355
|
+
* @param allRequirements Requirements to merge
|
|
356
|
+
*/
|
|
357
|
+
static merge(allRequirements) {
|
|
358
|
+
return allRequirements.reduce((x, y) => x.merge(y), new Requirement([], {}));
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Runs maximizeCached, using the maximizeParameters and maximizeOptions contained by this requirement.
|
|
362
|
+
*/
|
|
363
|
+
maximize() {
|
|
364
|
+
maximizeCached(this.maximizeParameters, this.maximizeOptions);
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Merges requirements, and then runs maximizeCached on the combined requirement.
|
|
368
|
+
* @param requirements Requirements to maximize on
|
|
369
|
+
*/
|
|
370
|
+
static maximize(...requirements) {
|
|
371
|
+
Requirement.merge(requirements).maximize();
|
|
372
|
+
}
|
|
416
373
|
}
|
|
417
|
-
|
|
418
|
-
var _maximizeParameters = /*#__PURE__*/new WeakMap();
|
|
419
|
-
|
|
420
|
-
var _maximizeOptions = /*#__PURE__*/new WeakMap();
|
|
421
|
-
|
|
422
|
-
var Requirement = /*#__PURE__*/function () {
|
|
423
|
-
/**
|
|
424
|
-
* A convenient way of combining maximization parameters and options
|
|
425
|
-
* @param maximizeParameters Parameters you're attempting to maximize
|
|
426
|
-
* @param maximizeOptions Object potentially containing forceEquips, bonusEquips, preventEquips, and preventSlots
|
|
427
|
-
*/
|
|
428
|
-
function Requirement(maximizeParameters, maximizeOptions) {
|
|
429
|
-
_classCallCheck(this, Requirement);
|
|
430
|
-
|
|
431
|
-
_maximizeParameters.set(this, {
|
|
432
|
-
writable: true,
|
|
433
|
-
value: void 0
|
|
434
|
-
});
|
|
435
|
-
|
|
436
|
-
_maximizeOptions.set(this, {
|
|
437
|
-
writable: true,
|
|
438
|
-
value: void 0
|
|
439
|
-
});
|
|
440
|
-
|
|
441
|
-
_classPrivateFieldSet(this, _maximizeParameters, maximizeParameters);
|
|
442
|
-
|
|
443
|
-
_classPrivateFieldSet(this, _maximizeOptions, maximizeOptions);
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
_createClass(Requirement, [{
|
|
447
|
-
key: "maximizeParameters",
|
|
448
|
-
get: function get() {
|
|
449
|
-
return _classPrivateFieldGet(this, _maximizeParameters);
|
|
450
|
-
}
|
|
451
|
-
}, {
|
|
452
|
-
key: "maximizeOptions",
|
|
453
|
-
get: function get() {
|
|
454
|
-
return _classPrivateFieldGet(this, _maximizeOptions);
|
|
455
|
-
}
|
|
456
|
-
}, {
|
|
457
|
-
key: "merge",
|
|
458
|
-
value: function merge(other) {
|
|
459
|
-
return (0, _merge2.default)(this, other);
|
|
460
|
-
}
|
|
461
|
-
}], [{
|
|
462
|
-
key: "merge",
|
|
463
|
-
value: function merge(allRequirements) {
|
|
464
|
-
return allRequirements.reduce((x, y) => x.merge(y), new Requirement([], {}));
|
|
465
|
-
}
|
|
466
|
-
}]);
|
|
467
|
-
|
|
468
|
-
return Requirement;
|
|
469
|
-
}();
|
|
470
|
-
|
|
471
|
-
exports.Requirement = Requirement;
|
|
472
|
-
|
|
473
|
-
function maximizeRequirementsCached(requirements) {
|
|
474
|
-
var compiledRequirements = Requirement.merge(requirements);
|
|
475
|
-
maximizeCached(compiledRequirements.maximizeParameters, compiledRequirements.maximizeOptions);
|
|
476
|
-
}
|