libram 0.4.1 → 0.4.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.
- package/dist/Clan.js +271 -485
- package/dist/Copier.js +15 -48
- package/dist/Dungeon.js +77 -157
- package/dist/Kmail.d.ts +3 -1
- package/dist/Kmail.js +99 -244
- package/dist/Path.js +77 -120
- package/dist/ascend.js +153 -172
- package/dist/combat.d.ts +98 -3
- package/dist/combat.js +349 -387
- package/dist/console.js +13 -36
- package/dist/diet/index.d.ts +32 -8
- package/dist/diet/index.js +420 -426
- package/dist/diet/knapsack.d.ts +1 -1
- package/dist/diet/knapsack.js +104 -100
- 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 +16 -4
- package/dist/freerun.js +92 -99
- package/dist/index.d.ts +5 -1
- package/dist/index.js +22 -300
- package/dist/lib.d.ts +4 -0
- package/dist/lib.js +284 -515
- package/dist/logger.js +21 -63
- package/dist/maximize.js +289 -562
- package/dist/modifier.js +35 -46
- package/dist/modifierTypes.js +8 -22
- package/dist/mood.d.ts +5 -0
- package/dist/mood.js +268 -551
- package/dist/property.d.ts +2 -0
- package/dist/property.js +100 -242
- package/dist/propertyTypes.d.ts +5 -4
- package/dist/propertyTypes.js +1 -0
- package/dist/propertyTyping.d.ts +4 -3
- package/dist/propertyTyping.js +52 -59
- 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 +9 -0
- package/dist/resources/2010/CrownOfThrones.js +550 -374
- 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 +1 -0
- package/dist/resources/2013/Florist.js +142 -207
- package/dist/resources/2013/PulledTaffy.d.ts +9 -0
- package/dist/resources/2013/PulledTaffy.js +33 -0
- package/dist/resources/2014/DNALab.d.ts +47 -0
- package/dist/resources/2014/DNALab.js +154 -0
- package/dist/resources/2014/WinterGarden.js +15 -43
- package/dist/resources/2015/ChateauMantegna.js +52 -86
- package/dist/resources/2015/MayoClinic.d.ts +3 -0
- package/dist/resources/2015/MayoClinic.js +36 -65
- 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/AsdonMartin.d.ts +27 -0
- package/dist/resources/2017/AsdonMartin.js +80 -0
- package/dist/resources/2017/TunnelOfLove.js +62 -111
- package/dist/resources/2018/SongBoom.js +32 -68
- package/dist/resources/2019/BeachComb.js +26 -44
- package/dist/resources/2019/Snapper.d.ts +28 -0
- package/dist/resources/2019/Snapper.js +69 -0
- package/dist/resources/2020/Guzzlr.d.ts +3 -0
- package/dist/resources/2020/Guzzlr.js +92 -163
- package/dist/resources/LibramSummon.d.ts +12 -0
- package/dist/resources/LibramSummon.js +66 -0
- package/dist/resources/index.d.ts +5 -1
- package/dist/resources/index.js +21 -105
- package/dist/resources/putty-likes.js +15 -30
- 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 +5 -0
- package/dist/utils.js +47 -134
- package/package.json +15 -9
package/dist/property.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "core-js/modules/es.object.entries";
|
|
2
|
+
import "core-js/modules/es.object.from-entries";
|
|
1
3
|
import { KnownProperty, PropertyValue } from "./propertyTyping";
|
|
2
4
|
export declare const getString: (property: string, default_?: string | undefined) => string;
|
|
3
5
|
export declare const getCommaSeparated: (property: string, default_?: string[] | undefined) => string[];
|
package/dist/property.js
CHANGED
|
@@ -1,255 +1,113 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
});
|
|
12
|
-
exports.get = get;
|
|
13
|
-
exports.set = _set;
|
|
14
|
-
exports.setProperties = setProperties;
|
|
15
|
-
exports.withProperties = withProperties;
|
|
16
|
-
exports.withProperty = withProperty;
|
|
17
|
-
exports.withChoices = withChoices;
|
|
18
|
-
exports.withChoice = withChoice;
|
|
19
|
-
exports.PropertiesManager = exports.getThrall = exports.getStat = exports.getSlot = exports.getSkill = exports.getServant = exports.getPhylum = exports.getMonster = exports.getLocation = exports.getItem = exports.getFamiliar = exports.getElement = exports.getEffect = exports.getCoinmaster = exports.getClass = exports.getBounty = exports.getNumber = exports.getBoolean = exports.getCommaSeparated = exports.getString = void 0;
|
|
20
|
-
|
|
21
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
22
|
-
|
|
23
|
-
require("core-js/modules/es.string.split.js");
|
|
24
|
-
|
|
25
|
-
require("core-js/modules/es.object.to-string.js");
|
|
26
|
-
|
|
27
|
-
require("core-js/modules/es.regexp.to-string.js");
|
|
28
|
-
|
|
29
|
-
require("core-js/modules/es.object.entries.js");
|
|
30
|
-
|
|
31
|
-
require("core-js/modules/es.array.iterator.js");
|
|
32
|
-
|
|
33
|
-
require("core-js/modules/es.object.from-entries.js");
|
|
34
|
-
|
|
35
|
-
require("core-js/modules/es.array.map.js");
|
|
36
|
-
|
|
37
|
-
var _kolmafia = require("kolmafia");
|
|
38
|
-
|
|
39
|
-
var _propertyTyping = require("./propertyTyping");
|
|
40
|
-
|
|
41
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
42
|
-
|
|
43
|
-
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); } }
|
|
44
|
-
|
|
45
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
46
|
-
|
|
47
|
-
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; }
|
|
48
|
-
|
|
49
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
50
|
-
|
|
51
|
-
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."); }
|
|
52
|
-
|
|
53
|
-
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); }
|
|
54
|
-
|
|
55
|
-
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; }
|
|
56
|
-
|
|
57
|
-
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; }
|
|
58
|
-
|
|
59
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
60
|
-
|
|
61
|
-
var createPropertyGetter = transform => (property, default_) => {
|
|
62
|
-
var value = (0, _kolmafia.getProperty)(property);
|
|
63
|
-
|
|
64
|
-
if (default_ !== undefined && value === "") {
|
|
65
|
-
return default_;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return transform(value, property);
|
|
1
|
+
import "core-js/modules/es.object.entries";
|
|
2
|
+
import "core-js/modules/es.object.from-entries";
|
|
3
|
+
import { getProperty, setProperty } from "kolmafia";
|
|
4
|
+
import { isBooleanProperty, isLocationProperty, isMonsterProperty, isNumericProperty, isPhylumProperty, } from "./propertyTyping";
|
|
5
|
+
const createPropertyGetter = (transform) => (property, default_) => {
|
|
6
|
+
const value = getProperty(property);
|
|
7
|
+
if (default_ !== undefined && value === "") {
|
|
8
|
+
return default_;
|
|
9
|
+
}
|
|
10
|
+
return transform(value, property);
|
|
69
11
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
12
|
+
const createMafiaClassPropertyGetter = (Type) => createPropertyGetter((value) => {
|
|
13
|
+
if (value === "")
|
|
14
|
+
return null;
|
|
15
|
+
const v = Type.get(value);
|
|
16
|
+
return v === Type.get("none") ? null : v;
|
|
75
17
|
});
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
* @param property Name of the property
|
|
117
|
-
* @param _default Default value for the property to take if not set
|
|
118
|
-
*/
|
|
119
|
-
|
|
120
|
-
exports.getThrall = getThrall;
|
|
121
|
-
|
|
122
|
-
function get(property, _default) {
|
|
123
|
-
var value = getString(property);
|
|
124
|
-
|
|
125
|
-
if ((0, _propertyTyping.isMonsterProperty)(property)) {
|
|
126
|
-
return getMonster(property, _default);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if ((0, _propertyTyping.isLocationProperty)(property)) {
|
|
130
|
-
return getLocation(property, _default);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (value === "") {
|
|
134
|
-
return _default === undefined ? "" : _default;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if ((0, _propertyTyping.isBooleanProperty)(property, value)) {
|
|
138
|
-
return getBoolean(property, _default);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if ((0, _propertyTyping.isNumericProperty)(property, value)) {
|
|
142
|
-
return getNumber(property, _default);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return value;
|
|
18
|
+
export const getString = createPropertyGetter((value) => value);
|
|
19
|
+
export const getCommaSeparated = createPropertyGetter((value) => value.split(/, ?/));
|
|
20
|
+
export const getBoolean = createPropertyGetter((value) => value === "true");
|
|
21
|
+
export const getNumber = createPropertyGetter((value) => Number(value));
|
|
22
|
+
export const getBounty = createMafiaClassPropertyGetter(Bounty);
|
|
23
|
+
export const getClass = createMafiaClassPropertyGetter(Class);
|
|
24
|
+
export const getCoinmaster = createMafiaClassPropertyGetter(Coinmaster);
|
|
25
|
+
export const getEffect = createMafiaClassPropertyGetter(Effect);
|
|
26
|
+
export const getElement = createMafiaClassPropertyGetter(Element);
|
|
27
|
+
export const getFamiliar = createMafiaClassPropertyGetter(Familiar);
|
|
28
|
+
export const getItem = createMafiaClassPropertyGetter(Item);
|
|
29
|
+
export const getLocation = createMafiaClassPropertyGetter(Location);
|
|
30
|
+
export const getMonster = createMafiaClassPropertyGetter(Monster);
|
|
31
|
+
export const getPhylum = createMafiaClassPropertyGetter(Phylum);
|
|
32
|
+
export const getServant = createMafiaClassPropertyGetter(Servant);
|
|
33
|
+
export const getSkill = createMafiaClassPropertyGetter(Skill);
|
|
34
|
+
export const getSlot = createMafiaClassPropertyGetter(Slot);
|
|
35
|
+
export const getStat = createMafiaClassPropertyGetter(Stat);
|
|
36
|
+
export const getThrall = createMafiaClassPropertyGetter(Thrall);
|
|
37
|
+
export function get(property, _default) {
|
|
38
|
+
const value = getString(property);
|
|
39
|
+
if (isMonsterProperty(property)) {
|
|
40
|
+
return getMonster(property, _default);
|
|
41
|
+
}
|
|
42
|
+
if (isLocationProperty(property)) {
|
|
43
|
+
return getLocation(property, _default);
|
|
44
|
+
}
|
|
45
|
+
if (value === "") {
|
|
46
|
+
return _default === undefined ? "" : _default;
|
|
47
|
+
}
|
|
48
|
+
if (isBooleanProperty(property, value)) {
|
|
49
|
+
return getBoolean(property, _default);
|
|
50
|
+
}
|
|
51
|
+
if (isNumericProperty(property, value)) {
|
|
52
|
+
return getNumber(property, _default);
|
|
53
|
+
}
|
|
54
|
+
if (isPhylumProperty(property)) {
|
|
55
|
+
return getPhylum(property);
|
|
56
|
+
}
|
|
57
|
+
return value;
|
|
146
58
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
* @param value Value to give the property
|
|
151
|
-
*/
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
function _set(property, value) {
|
|
155
|
-
var stringValue = value === null ? "" : value.toString();
|
|
156
|
-
(0, _kolmafia.setProperty)(property, stringValue);
|
|
59
|
+
export function set(property, value) {
|
|
60
|
+
const stringValue = value === null ? "" : value.toString();
|
|
61
|
+
setProperty(property, stringValue);
|
|
157
62
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
prop = _Object$entries$_i[0],
|
|
163
|
-
_value = _Object$entries$_i[1];
|
|
164
|
-
|
|
165
|
-
_set(prop, _value);
|
|
166
|
-
}
|
|
63
|
+
export function setProperties(properties) {
|
|
64
|
+
for (const [prop, value] of Object.entries(properties)) {
|
|
65
|
+
set(prop, value);
|
|
66
|
+
}
|
|
167
67
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
try {
|
|
179
|
-
callback();
|
|
180
|
-
} finally {
|
|
181
|
-
setProperties(propertiesBackup);
|
|
182
|
-
}
|
|
68
|
+
export function withProperties(properties, callback) {
|
|
69
|
+
const propertiesBackup = Object.fromEntries(Object.entries(properties).map(([prop]) => [prop, get(prop)]));
|
|
70
|
+
setProperties(properties);
|
|
71
|
+
try {
|
|
72
|
+
callback();
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
setProperties(propertiesBackup);
|
|
76
|
+
}
|
|
183
77
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
withProperties(_defineProperty({}, property, value), callback);
|
|
78
|
+
export function withProperty(property, value, callback) {
|
|
79
|
+
withProperties({ [property]: value }, callback);
|
|
187
80
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
return ["choiceAdventure".concat(choice), option];
|
|
196
|
-
}));
|
|
197
|
-
withProperties(properties, callback);
|
|
81
|
+
export function withChoices(choices, callback) {
|
|
82
|
+
const properties = Object.fromEntries(Object.entries(choices).map(([choice, option]) => [
|
|
83
|
+
`choiceAdventure${choice}`,
|
|
84
|
+
option,
|
|
85
|
+
]));
|
|
86
|
+
withProperties(properties, callback);
|
|
198
87
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
withChoices(_defineProperty({}, choice, value), callback);
|
|
88
|
+
export function withChoice(choice, value, callback) {
|
|
89
|
+
withChoices({ [choice]: value }, callback);
|
|
202
90
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
key: "set",
|
|
215
|
-
value: function set(propertiesToSet) {
|
|
216
|
-
for (var _i2 = 0, _Object$entries2 = Object.entries(propertiesToSet); _i2 < _Object$entries2.length; _i2++) {
|
|
217
|
-
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
|
|
218
|
-
propertyName = _Object$entries2$_i[0],
|
|
219
|
-
propertyValue = _Object$entries2$_i[1];
|
|
220
|
-
|
|
221
|
-
if (this.properties[propertyName] === undefined) {
|
|
222
|
-
this.properties[propertyName] = get(propertyName);
|
|
91
|
+
export class PropertiesManager {
|
|
92
|
+
properties;
|
|
93
|
+
constructor() {
|
|
94
|
+
this.properties = {};
|
|
95
|
+
}
|
|
96
|
+
set(propertiesToSet) {
|
|
97
|
+
for (const [propertyName, propertyValue] of Object.entries(propertiesToSet)) {
|
|
98
|
+
if (this.properties[propertyName] === undefined) {
|
|
99
|
+
this.properties[propertyName] = get(propertyName);
|
|
100
|
+
}
|
|
101
|
+
set(propertyName, propertyValue);
|
|
223
102
|
}
|
|
224
|
-
|
|
225
|
-
_set(propertyName, propertyValue);
|
|
226
|
-
}
|
|
227
103
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
choiceNumber = _ref6[0],
|
|
234
|
-
choiceValue = _ref6[1];
|
|
235
|
-
|
|
236
|
-
return ["choiceAdventure".concat(choiceNumber), choiceValue];
|
|
237
|
-
})));
|
|
104
|
+
setChoices(choicesToSet) {
|
|
105
|
+
this.set(Object.fromEntries(Object.entries(choicesToSet).map(([choiceNumber, choiceValue]) => [
|
|
106
|
+
`choiceAdventure${choiceNumber}`,
|
|
107
|
+
choiceValue,
|
|
108
|
+
])));
|
|
238
109
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
value: function resetAll() {
|
|
242
|
-
Object.entries(this.properties).forEach(_ref7 => {
|
|
243
|
-
var _ref8 = _slicedToArray(_ref7, 2),
|
|
244
|
-
propertyName = _ref8[0],
|
|
245
|
-
propertyValue = _ref8[1];
|
|
246
|
-
|
|
247
|
-
return _set(propertyName, propertyValue);
|
|
248
|
-
});
|
|
110
|
+
resetAll() {
|
|
111
|
+
Object.entries(this.properties).forEach(([propertyName, propertyValue]) => set(propertyName, propertyValue));
|
|
249
112
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
return PropertiesManager;
|
|
253
|
-
}();
|
|
254
|
-
|
|
255
|
-
exports.PropertiesManager = PropertiesManager;
|
|
113
|
+
}
|