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.
Files changed (99) hide show
  1. package/dist/Clan.js +268 -485
  2. package/dist/Copier.js +11 -48
  3. package/dist/Dungeon.js +77 -157
  4. package/dist/Kmail.d.ts +13 -7
  5. package/dist/Kmail.js +92 -233
  6. package/dist/Path.js +68 -120
  7. package/dist/ascend.js +153 -172
  8. package/dist/combat.d.ts +86 -1
  9. package/dist/combat.js +295 -387
  10. package/dist/console.js +13 -36
  11. package/dist/diet/index.d.ts +31 -0
  12. package/dist/diet/index.js +333 -0
  13. package/dist/diet/knapsack.d.ts +7 -0
  14. package/dist/diet/knapsack.js +106 -0
  15. package/dist/dungeons/Dreadsylvania.d.ts +4 -0
  16. package/dist/dungeons/Dreadsylvania.js +14 -0
  17. package/dist/dungeons/Dungeon.d.ts +28 -0
  18. package/dist/dungeons/Dungeon.js +99 -0
  19. package/dist/dungeons/Hobopolis.d.ts +4 -0
  20. package/dist/dungeons/Hobopolis.js +14 -0
  21. package/dist/dungeons/SlimeTube.d.ts +4 -0
  22. package/dist/dungeons/SlimeTube.js +14 -0
  23. package/dist/freerun.d.ts +23 -0
  24. package/dist/freerun.js +92 -0
  25. package/dist/index.d.ts +6 -1
  26. package/dist/index.js +21 -263
  27. package/dist/lib.d.ts +43 -0
  28. package/dist/lib.js +296 -405
  29. package/dist/logger.js +23 -63
  30. package/dist/maximize.d.ts +29 -12
  31. package/dist/maximize.js +318 -421
  32. package/dist/modifier.d.ts +13 -0
  33. package/dist/modifier.js +35 -0
  34. package/dist/modifierTypes.d.ts +16 -0
  35. package/dist/modifierTypes.js +9 -0
  36. package/dist/mood.js +220 -531
  37. package/dist/property.d.ts +2 -0
  38. package/dist/property.js +96 -242
  39. package/dist/propertyTypes.d.ts +9 -0
  40. package/dist/propertyTypes.js +1 -0
  41. package/dist/propertyTyping.d.ts +2 -9
  42. package/dist/propertyTyping.js +42 -53
  43. package/dist/resources/2007/CandyHearts.d.ts +9 -0
  44. package/dist/resources/2007/CandyHearts.js +24 -0
  45. package/dist/resources/2008/DivineFavors.d.ts +9 -0
  46. package/dist/resources/2008/DivineFavors.js +27 -0
  47. package/dist/resources/2009/Bandersnatch.js +37 -112
  48. package/dist/resources/2009/LoveSongs.d.ts +9 -0
  49. package/dist/resources/2009/LoveSongs.js +24 -0
  50. package/dist/resources/2009/SpookyPutty.js +20 -46
  51. package/dist/resources/2010/Brickos.d.ts +9 -0
  52. package/dist/resources/2010/Brickos.js +21 -0
  53. package/dist/resources/2010/CrownOfThrones.d.ts +18 -0
  54. package/dist/resources/2010/CrownOfThrones.js +550 -0
  55. package/dist/resources/2011/Gygaxian.d.ts +9 -0
  56. package/dist/resources/2011/Gygaxian.js +24 -0
  57. package/dist/resources/2011/ObtuseAngel.js +21 -63
  58. package/dist/resources/2012/RainDoh.js +14 -40
  59. package/dist/resources/2012/Resolutions.d.ts +9 -0
  60. package/dist/resources/2012/Resolutions.js +28 -0
  61. package/dist/resources/2013/Florist.d.ts +61 -0
  62. package/dist/resources/2013/Florist.js +149 -0
  63. package/dist/resources/2013/PulledTaffy.d.ts +9 -0
  64. package/dist/resources/2013/PulledTaffy.js +33 -0
  65. package/dist/resources/2014/WinterGarden.js +15 -43
  66. package/dist/resources/2015/ChateauMantegna.js +52 -86
  67. package/dist/resources/2015/MayoClinic.d.ts +13 -0
  68. package/dist/resources/2015/MayoClinic.js +36 -0
  69. package/dist/resources/2016/SourceTerminal.d.ts +1 -0
  70. package/dist/resources/2016/SourceTerminal.js +114 -237
  71. package/dist/resources/2016/Witchess.js +33 -59
  72. package/dist/resources/2017/TunnelOfLove.js +62 -111
  73. package/dist/resources/2018/SongBoom.js +32 -68
  74. package/dist/resources/2019/BeachComb.d.ts +2 -0
  75. package/dist/resources/2019/BeachComb.js +26 -0
  76. package/dist/resources/2019/Snapper.d.ts +28 -0
  77. package/dist/resources/2019/Snapper.js +70 -0
  78. package/dist/resources/2020/Guzzlr.js +79 -163
  79. package/dist/resources/LibramSummon.d.ts +12 -0
  80. package/dist/resources/LibramSummon.js +66 -0
  81. package/dist/resources/index.d.ts +18 -11
  82. package/dist/resources/index.js +19 -85
  83. package/dist/resources/putty-likes.js +15 -30
  84. package/dist/ring-buffer.d.ts +24 -0
  85. package/dist/ring-buffer.js +135 -0
  86. package/dist/since.d.ts +1 -0
  87. package/dist/since.js +56 -112
  88. package/dist/template-string.js +40 -132
  89. package/dist/utils.d.ts +14 -0
  90. package/dist/utils.js +50 -114
  91. package/package.json +5 -3
  92. package/dist/libram-example-briefcase.js +0 -16073
  93. package/dist/libram-example-clan.js +0 -8898
  94. package/dist/libram-example-consult.js +0 -6179
  95. package/dist/libram-example-item.js +0 -3248
  96. package/dist/libram-example-kmail.js +0 -2065
  97. package/dist/libram-example-lib.js +0 -7608
  98. package/dist/libram-example-props.js +0 -4770
  99. package/dist/libram-example-resources.js +0 -12226
package/dist/Kmail.js CHANGED
@@ -1,171 +1,36 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.symbol.js");
4
-
5
- require("core-js/modules/es.symbol.description.js");
6
-
7
- require("core-js/modules/es.array.slice.js");
8
-
9
- Object.defineProperty(exports, "__esModule", {
10
- value: true
11
- });
12
- exports.default = void 0;
13
-
14
- require("core-js/modules/es.array.iterator.js");
15
-
16
- require("core-js/modules/es.object.to-string.js");
17
-
18
- require("core-js/modules/es.array.map.js");
19
-
20
- require("core-js/modules/es.object.entries.js");
21
-
22
- require("core-js/modules/es.regexp.exec.js");
23
-
24
- require("core-js/modules/es.string.match.js");
25
-
26
- require("core-js/modules/es.array.filter.js");
27
-
28
- require("core-js/modules/es.array.concat.js");
29
-
30
- require("core-js/modules/es.array.includes.js");
31
-
32
- require("core-js/modules/es.string.includes.js");
33
-
34
- var _kolmafia = require("kolmafia");
35
-
36
- var _utils = require("./utils");
37
-
38
- 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; } } }; }
39
-
40
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
41
-
42
- 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."); }
43
-
44
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
45
-
46
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
47
-
48
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
49
-
50
- 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."); }
51
-
52
- 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); }
53
-
54
- 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; }
55
-
56
- 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; }
57
-
58
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
59
-
60
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
61
-
62
- 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); } }
63
-
64
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
65
-
66
- 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; }
67
-
68
- var Kmail = /*#__PURE__*/function () {
69
- function Kmail(rawKmail) {
70
- _classCallCheck(this, Kmail);
71
-
72
- _defineProperty(this, "id", void 0);
73
-
74
- _defineProperty(this, "date", void 0);
75
-
76
- _defineProperty(this, "type", void 0);
77
-
78
- _defineProperty(this, "senderId", void 0);
79
-
80
- _defineProperty(this, "senderName", void 0);
81
-
82
- _defineProperty(this, "message", void 0);
83
-
84
- this.id = Number(rawKmail.id);
85
- this.date = new Date(rawKmail.localtime);
86
- this.type = rawKmail.type;
87
- this.senderId = Number(rawKmail.fromid);
88
- this.senderName = rawKmail.fromname;
89
- this.message = rawKmail.message;
90
- }
91
- /**
92
- * Delete the kmail
93
- *
94
- * @returns Whether the kmail was deleted
95
- */
96
-
97
-
98
- _createClass(Kmail, [{
99
- key: "delete",
100
- value: function _delete() {
101
- return Kmail.delete([this]) === 1;
1
+ import "core-js/modules/es.object.entries";
2
+ import { extractItems, extractMeat, isGiftable, toInt, visitUrl, } from "kolmafia";
3
+ import { arrayToCountedMap, chunk } from "./utils";
4
+ export default class Kmail {
5
+ constructor(rawKmail) {
6
+ const date = new Date(rawKmail.localtime);
7
+ // Date come from KoL formatted with YY and so will be parsed 19YY, which is wrong.
8
+ // We can safely add 100 because if 19YY was a leap year, 20YY will be too!
9
+ date.setFullYear(date.getFullYear() + 100);
10
+ this.id = Number(rawKmail.id);
11
+ this.date = date;
12
+ this.type = rawKmail.type;
13
+ this.senderId = Number(rawKmail.fromid);
14
+ this.senderName = rawKmail.fromname;
15
+ this.rawMessage = rawKmail.message;
102
16
  }
103
- /**
104
- * Get items attached to the kmail
105
- *
106
- * @returns Map of items attached to the kmail and their quantities
107
- */
108
-
109
- }, {
110
- key: "items",
111
- value: function items() {
112
- return new Map(Object.entries((0, _kolmafia.extractItems)(this.message)).map(_ref => {
113
- var _ref2 = _slicedToArray(_ref, 2),
114
- itemName = _ref2[0],
115
- quantity = _ref2[1];
116
-
117
- return [Item.get(itemName), quantity];
118
- }));
119
- }
120
- /**
121
- * Get meat attached to the kmail
122
- *
123
- * @returns Meat attached to the kmail
124
- */
125
-
126
- }, {
127
- key: "meat",
128
- value: function meat() {
129
- return (0, _kolmafia.extractMeat)(this.message);
130
- }
131
- /**
132
- * Reply to kmail
133
- *
134
- * @see Kmail.send
135
- *
136
- * @returns True if the kmail was successfully sent
137
- */
138
-
139
- }, {
140
- key: "reply",
141
- value: function reply() {
142
- var message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
143
- var items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
144
- var meat = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
145
- return Kmail.send(this.senderId, message, items, meat);
146
- }
147
- }], [{
148
- key: "parse",
149
- value:
150
17
  /**
151
18
  * Parses a kmail from KoL's native format
152
19
  *
153
20
  * @param rawKmail Kmail in the format supplies by api.php
154
21
  * @returns Parsed kmail
155
22
  */
156
- function parse(rawKmail) {
157
- return new Kmail(rawKmail);
23
+ static parse(rawKmail) {
24
+ return new Kmail(rawKmail);
158
25
  }
159
26
  /**
160
27
  * Returns all of the player's kmails
161
28
  *
29
+ * @param count Number of kmails to fetch
162
30
  * @returns Parsed kmails
163
31
  */
164
-
165
- }, {
166
- key: "inbox",
167
- value: function inbox() {
168
- return JSON.parse((0, _kolmafia.visitUrl)("api.php?what=kmail&for=ASSistant")).map(Kmail.parse);
32
+ static inbox(count = 100) {
33
+ return JSON.parse(visitUrl(`api.php?what=kmail&for=libram&count=${count}`)).map(Kmail.parse);
169
34
  }
170
35
  /**
171
36
  * Bulk delete kmails
@@ -173,62 +38,33 @@ var Kmail = /*#__PURE__*/function () {
173
38
  * @param kmails Kmails to delete
174
39
  * @returns Number of kmails deleted
175
40
  */
176
-
177
- }, {
178
- key: "delete",
179
- value: function _delete(kmails) {
180
- var _results$match$, _results$match;
181
-
182
- var results = (0, _kolmafia.visitUrl)("messages.php?the_action=delete&box=Inbox&pwd&".concat(kmails.map(k => "sel".concat(k.id, "=on")).join("&")));
183
- return Number((_results$match$ = (_results$match = results.match(/<td>(\d) messages? deleted.<\/td>/)) === null || _results$match === void 0 ? void 0 : _results$match[1]) !== null && _results$match$ !== void 0 ? _results$match$ : 0);
41
+ static delete(kmails) {
42
+ const results = visitUrl(`messages.php?the_action=delete&box=Inbox&pwd&${kmails
43
+ .map((k) => `sel${k.id}=on`)
44
+ .join("&")}`);
45
+ return Number(results.match(/<td>(\d) messages? deleted.<\/td>/)?.[1] ?? 0);
184
46
  }
185
- }, {
186
- key: "_genericSend",
187
- value: function _genericSend(to, message, items, meat, chunkSize, constructUrl, successString) {
188
- var m = meat;
189
-
190
- var sendableItems = _toConsumableArray((0, _utils.arrayToCountedMap)(items).entries()).filter(_ref3 => {
191
- var _ref4 = _slicedToArray(_ref3, 1),
192
- item = _ref4[0];
193
-
194
- return (0, _kolmafia.isGiftable)(item);
195
- });
196
-
197
- var result = true;
198
- var chunks = (0, _utils.chunk)(sendableItems, chunkSize); // Split the items to be sent into chunks of max 11 item types
199
-
200
- var _iterator = _createForOfIteratorHelper(chunks.length > 0 ? chunks : [null]),
201
- _step;
202
-
203
- try {
204
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
205
- var c = _step.value;
206
-
207
- var _itemsQuery = c === null ? [] : c.map((_ref5, index) => {
208
- var _ref6 = _slicedToArray(_ref5, 2),
209
- item = _ref6[0],
210
- quantity = _ref6[1];
211
-
212
- return "whichitem".concat(index + 1, "=").concat((0, _kolmafia.toInt)(item), "&howmany").concat(index + 1, "=").concat(quantity);
213
- });
214
-
215
- var r = (0, _kolmafia.visitUrl)(constructUrl(m, _itemsQuery.join("&"), _itemsQuery.length));
216
-
217
- if (r.includes("That player cannot receive Meat or items")) {
218
- return Kmail.gift(to, message, items, meat);
219
- } // Make sure we don't send the same batch of meat with every chunk
220
-
221
-
222
- m = 0;
223
- result && (result = r.includes(successString));
47
+ static _genericSend(to, message, items, meat, chunkSize, constructUrl, successString) {
48
+ let m = meat;
49
+ const sendableItems = [
50
+ ...arrayToCountedMap(items).entries(),
51
+ ].filter(([item]) => isGiftable(item));
52
+ let result = true;
53
+ const chunks = chunk(sendableItems, chunkSize);
54
+ // Split the items to be sent into chunks of max 11 item types
55
+ for (const c of chunks.length > 0 ? chunks : [null]) {
56
+ const itemsQuery = c === null
57
+ ? []
58
+ : c.map(([item, quantity], index) => `whichitem${index + 1}=${toInt(item)}&howmany${index + 1}=${quantity}`);
59
+ const r = visitUrl(constructUrl(m, itemsQuery.join("&"), itemsQuery.length));
60
+ if (r.includes("That player cannot receive Meat or items")) {
61
+ return Kmail.gift(to, message, items, meat);
62
+ }
63
+ // Make sure we don't send the same batch of meat with every chunk
64
+ m = 0;
65
+ result &&= r.includes(successString);
224
66
  }
225
- } catch (err) {
226
- _iterator.e(err);
227
- } finally {
228
- _iterator.f();
229
- }
230
-
231
- return result;
67
+ return result;
232
68
  }
233
69
  /**
234
70
  * Sends a kmail to a player
@@ -243,14 +79,8 @@ var Kmail = /*#__PURE__*/function () {
243
79
  * @param meat The quantity of meat to be attached
244
80
  * @returns True if the kmail was successfully sent
245
81
  */
246
-
247
- }, {
248
- key: "send",
249
- value: function send(to) {
250
- var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
251
- var items = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
252
- var meat = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
253
- return Kmail._genericSend(to, message, items, meat, 11, (meat, itemsQuery) => "sendmessage.php?action=send&pwd&towho=".concat(to, "&message=").concat(message).concat(itemsQuery ? "&".concat(itemsQuery) : "", "&sendmeat=").concat(meat), ">Message sent.</");
82
+ static send(to, message = "", items = [], meat = 0) {
83
+ return Kmail._genericSend(to, message, items, meat, 11, (meat, itemsQuery) => `sendmessage.php?action=send&pwd&towho=${to}&message=${message}${itemsQuery ? `&${itemsQuery}` : ""}&sendmeat=${meat}`, ">Message sent.</");
254
84
  }
255
85
  /**
256
86
  * Sends a gift to a player
@@ -265,20 +95,49 @@ var Kmail = /*#__PURE__*/function () {
265
95
  * @param insideNode The note on the inside of the gift
266
96
  * @returns True if the gift was successfully sent
267
97
  */
268
-
269
- }, {
270
- key: "gift",
271
- value: function gift(to) {
272
- var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
273
- var items = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
274
- var meat = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
275
- var insideNote = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "";
276
- var baseUrl = "town_sendgift.php?action=Yep.&pwd&fromwhere=0&note=".concat(message, "&insidenote=").concat(insideNote, "&towho=").concat(to);
277
- return Kmail._genericSend(to, message, items, meat, 3, (m, itemsQuery, chunkSize) => "".concat(baseUrl, "&whichpackage=").concat(chunkSize).concat(itemsQuery ? "&".concat(itemsQuery) : "", "&sendmeat=").concat(m), ">Package sent.</");
98
+ static gift(to, message = "", items = [], meat = 0, insideNote = "") {
99
+ const baseUrl = `town_sendgift.php?action=Yep.&pwd&fromwhere=0&note=${message}&insidenote=${insideNote}&towho=${to}`;
100
+ return Kmail._genericSend(to, message, items, meat, 3, (m, itemsQuery, chunkSize) => `${baseUrl}&whichpackage=${chunkSize}${itemsQuery ? `&${itemsQuery}` : ""}&sendmeat=${m}`, ">Package sent.</");
101
+ }
102
+ /**
103
+ * Delete the kmail
104
+ *
105
+ * @returns Whether the kmail was deleted
106
+ */
107
+ delete() {
108
+ return Kmail.delete([this]) === 1;
109
+ }
110
+ /**
111
+ * Message contents without any HTML from items or meat
112
+ */
113
+ get message() {
114
+ const match = this.rawMessage.match(/^(.*?)</s);
115
+ return match ? match[1] : this.rawMessage;
116
+ }
117
+ /**
118
+ * Get items attached to the kmail
119
+ *
120
+ * @returns Map of items attached to the kmail and their quantities
121
+ */
122
+ items() {
123
+ return new Map(Object.entries(extractItems(this.rawMessage)).map(([itemName, quantity]) => [Item.get(itemName), quantity]));
124
+ }
125
+ /**
126
+ * Get meat attached to the kmail
127
+ *
128
+ * @returns Meat attached to the kmail
129
+ */
130
+ meat() {
131
+ return extractMeat(this.rawMessage);
132
+ }
133
+ /**
134
+ * Reply to kmail
135
+ *
136
+ * @see Kmail.send
137
+ *
138
+ * @returns True if the kmail was successfully sent
139
+ */
140
+ reply(message = "", items = [], meat = 0) {
141
+ return Kmail.send(this.senderId, message, items, meat);
278
142
  }
279
- }]);
280
-
281
- return Kmail;
282
- }();
283
-
284
- exports.default = Kmail;
143
+ }
package/dist/Path.js CHANGED
@@ -1,121 +1,69 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.array.slice.js");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.Paths = exports.Path = void 0;
9
-
10
- var _templateString = require("./template-string");
11
-
12
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
13
-
14
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
15
-
16
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
-
18
- 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; }
19
-
20
- var Path = //here, we define avatar-ness around being its own class
21
- //Defined as the lowest inebriety that makes you unable to drink more, just to make it fifteens across the board
22
-
23
- /**
24
- *
25
- * @param name Name of path
26
- * @param id Path ID
27
- * @param hasAllPerms Does the player have immediate access to all permed skills>
28
- * @param hasCampground Does the player have access to the campground?
29
- * @param hasTerrarium Does the player have access to terrarium.php
30
- * @param stomachSize Maximum fullness achievable at turn 0
31
- * @param liverSize The lowest inebriety that makes you unable to drink more
32
- * @param spleenSize Maximum spleen achievable at turn 0
33
- * @param classes Classes available in this path
34
- */
35
- function Path(name, id) {
36
- var hasAllPerms = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
37
- var hasCampground = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
38
- var hasTerrarium = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
39
- var stomachSize = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 15;
40
- var liverSize = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 15;
41
- var spleenSize = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 15;
42
- var classes = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : (0, _templateString.$classes)(_templateObject || (_templateObject = _taggedTemplateLiteral(["Seal Clubber, Turtle Tamer, Sauceror, Pastamancer, Disco Bandit, Accordion Thief"])));
43
-
44
- _classCallCheck(this, Path);
45
-
46
- _defineProperty(this, "name", void 0);
47
-
48
- _defineProperty(this, "id", void 0);
49
-
50
- _defineProperty(this, "hasAllPerms", void 0);
51
-
52
- _defineProperty(this, "hasCampground", void 0);
53
-
54
- _defineProperty(this, "hasTerrarium", void 0);
55
-
56
- _defineProperty(this, "stomachSize", void 0);
57
-
58
- _defineProperty(this, "liverSize", void 0);
59
-
60
- _defineProperty(this, "spleenSize", void 0);
61
-
62
- _defineProperty(this, "classes", void 0);
63
-
64
- this.name = name;
65
- this.id = id;
66
- this.hasAllPerms = hasAllPerms;
67
- this.hasCampground = hasCampground;
68
- this.hasTerrarium = hasTerrarium;
69
- this.stomachSize = stomachSize;
70
- this.liverSize = liverSize;
71
- this.spleenSize = spleenSize;
72
- this.classes = classes;
1
+ import { $classes } from "./template-string";
2
+ export class Path {
3
+ /**
4
+ *
5
+ * @param name Name of path
6
+ * @param id Path ID
7
+ * @param hasAllPerms Does the player have immediate access to all permed skills>
8
+ * @param hasCampground Does the player have access to the campground?
9
+ * @param hasTerrarium Does the player have access to terrarium.php
10
+ * @param stomachSize Maximum fullness achievable at turn 0
11
+ * @param liverSize The lowest inebriety that makes you unable to drink more
12
+ * @param spleenSize Maximum spleen achievable at turn 0
13
+ * @param classes Classes available in this path
14
+ */
15
+ constructor(name, id, hasAllPerms = true, hasCampground = true, hasTerrarium = true, stomachSize = 15, liverSize = 15, spleenSize = 15, classes = $classes `Seal Clubber, Turtle Tamer, Sauceror, Pastamancer, Disco Bandit, Accordion Thief`) {
16
+ this.name = name;
17
+ this.id = id;
18
+ this.hasAllPerms = hasAllPerms;
19
+ this.hasCampground = hasCampground;
20
+ this.hasTerrarium = hasTerrarium;
21
+ this.stomachSize = stomachSize;
22
+ this.liverSize = liverSize;
23
+ this.spleenSize = spleenSize;
24
+ this.classes = classes;
25
+ }
26
+ }
27
+ export const Paths = {
28
+ Unrestricted: new Path("Unrestricted", 0),
29
+ Boozetafarian: new Path("Boozetafarian", 1, false, true, true, 0),
30
+ Teetotaler: new Path("Teetotaler", 2, false, true, true, 15, 0),
31
+ Oxygenarian: new Path("Oxygenarian", 3, false, true, true, 0, 0),
32
+ BeesHateYou: new Path("Bees Hate You", 4),
33
+ WayOfTheSurprisingFist: new Path("Way of the Surprising Fist", 6),
34
+ Trendy: new Path("Trendy", 6),
35
+ AvatarOfBoris: new Path("Avatar of Boris", 8, false, true, false, 20, 5, 15, $classes `Avatar of Boris`),
36
+ BugbearInvasion: new Path("Bugbear Invasion", 9),
37
+ ZombieSlayer: new Path("Zombie Slayer", 10, false, true, true, 15, 5, 15, $classes `Zombie Master`),
38
+ ClassAct: new Path("Class Act", 11, false),
39
+ AvatarofJarlsberg: new Path("Avatar of Jarlsberg", 12, false, true, false, 10, 10, 15, $classes `Avatar of Jarlsberg`),
40
+ Big: new Path("BIG!", 14),
41
+ KolHs: new Path("KOLHS", 15),
42
+ ClassAct2: new Path("Class Act II: A Class For Pigs", 16, false),
43
+ AvatarofSneakyPete: new Path("Avatar of Sneaky Pete", 17, false, true, false, 5, 20, 15, $classes `Avatar of Sneaky Pete`),
44
+ SlowAndSteady: new Path("Slow and Steady", 18),
45
+ HeavyRains: new Path("Heavy Rains", 19),
46
+ Picky: new Path("Picky", 21, false),
47
+ Standard: new Path("Standard", 22),
48
+ ActuallyEdTheUndying: new Path("Actually Ed the Undying", 23, false, false, false, 0, 0, 5, $classes `Ed`),
49
+ OneCrazyRandomSummer: new Path("One Crazy Random Summer", 24),
50
+ CommunityService: new Path("Community Service", 25),
51
+ AvatarOfWestOfLoathing: new Path("Avatar of West of Loathing", 26, false, true, true, 10, 10, 10, $classes `Cow Puncher, Snake Oiler, Beanslinger`),
52
+ TheSource: new Path("The Source", 27),
53
+ NuclearAutumn: new Path("Nuclear Autumn", 28, false, false, true, 3, 3, 3),
54
+ GelatinousNoob: new Path("Gelatinous Noob", 29, false, true, true, 0, 0, 0, $classes `Gelatinous Noob`),
55
+ LicenseToAdventure: new Path("License to Adventure", 30, true, true, false, 0, 2, 15),
56
+ LiveAscendRepeat: new Path("Live. Ascend. Repeat.", 31),
57
+ PocketFamiliars: new Path("Pocket Familiars", 32, false, true, false),
58
+ GLover: new Path("G-Lover", 33),
59
+ DisguisesDelimit: new Path("Disguises Delimit", 34),
60
+ DarkGyffte: new Path("Dark Gyffte", 35, false, true, false, 5, 5, 15, $classes `Vampyre`),
61
+ TwoCrazyRandomSummer: new Path("Two Crazy Random Summer", 36),
62
+ KingdomOfExploathing: new Path("Kingdom of Exploathing", 37),
63
+ PathOfThePlumber: new Path("Path of the Plumber", 38, false, true, true, 20, 0, 5, $classes `Plumber`),
64
+ LowKeySummer: new Path("Low Key Summer", 40),
65
+ GreyGoo: new Path("Grey Goo", 40),
66
+ YouRobot: new Path("You, Robot", 41, false, false, true, 0, 0, 0),
67
+ QuantumTerrarium: new Path("Quantum Terrarium", 42, true, true, false),
68
+ Wildfire: new Path("Wildfire", 43),
73
69
  };
74
-
75
- exports.Path = Path;
76
- var Paths = {
77
- Unrestricted: new Path("Unrestricted", 0),
78
- Boozetafarian: new Path("Boozetafarian", 1, false, true, true, 0),
79
- Teetotaler: new Path("Teetotaler", 2, false, true, true, 15, 0),
80
- Oxygenarian: new Path("Oxygenarian", 3, false, true, true, 0, 0),
81
- BeesHateYou: new Path("Bees Hate You", 4),
82
- WayOfTheSurprisingFist: new Path("Way of the Surprising Fist", 6),
83
- Trendy: new Path("Trendy", 6),
84
- AvatarOfBoris: new Path("Avatar of Boris", 8, false, true, false, 20, 5, 15, (0, _templateString.$classes)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["Avatar of Boris"])))),
85
- BugbearInvasion: new Path("Bugbear Invasion", 9),
86
- ZombieSlayer: new Path("Zombie Slayer", 10, false, true, true, 15, 5, 15, (0, _templateString.$classes)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["Zombie Master"])))),
87
- ClassAct: new Path("Class Act", 11, false),
88
- AvatarofJarlsberg: new Path("Avatar of Jarlsberg", 12, false, true, false, 10, 10, 15, (0, _templateString.$classes)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["Avatar of Jarlsberg"])))),
89
- Big: new Path("BIG!", 14),
90
- KolHs: new Path("KOLHS", 15),
91
- ClassAct2: new Path("Class Act II: A Class For Pigs", 16, false),
92
- AvatarofSneakyPete: new Path("Avatar of Sneaky Pete", 17, false, true, false, 5, 20, 15, (0, _templateString.$classes)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["Avatar of Sneaky Pete"])))),
93
- SlowAndSteady: new Path("Slow and Steady", 18),
94
- HeavyRains: new Path("Heavy Rains", 19),
95
- Picky: new Path("Picky", 21, false),
96
- Standard: new Path("Standard", 22),
97
- ActuallyEdTheUndying: new Path("Actually Ed the Undying", 23, false, false, false, 0, 0, 5, (0, _templateString.$classes)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["Ed"])))),
98
- OneCrazyRandomSummer: new Path("One Crazy Random Summer", 24),
99
- CommunityService: new Path("Community Service", 25),
100
- AvatarOfWestOfLoathing: new Path("Avatar of West of Loathing", 26, false, true, true, 10, 10, 10, (0, _templateString.$classes)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["Cow Puncher, Snake Oiler, Beanslinger"])))),
101
- TheSource: new Path("The Source", 27),
102
- NuclearAutumn: new Path("Nuclear Autumn", 28, false, false, true, 3, 3, 3),
103
- GelatinousNoob: new Path("Gelatinous Noob", 29, false, true, true, 0, 0, 0, (0, _templateString.$classes)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["Gelatinous Noob"])))),
104
- LicenseToAdventure: new Path("License to Adventure", 30, true, true, false, 0, 2, 15),
105
- //Unsure how to log liver size here
106
- LiveAscendRepeat: new Path("Live. Ascend. Repeat.", 31),
107
- PocketFamiliars: new Path("Pocket Familiars", 32, false, true, false),
108
- //This is my opinion on the matter
109
- GLover: new Path("G-Lover", 33),
110
- DisguisesDelimit: new Path("Disguises Delimit", 34),
111
- DarkGyffte: new Path("Dark Gyffte", 35, false, true, false, 5, 5, 15, (0, _templateString.$classes)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["Vampyre"])))),
112
- TwoCrazyRandomSummer: new Path("Two Crazy Random Summer", 36),
113
- KingdomOfExploathing: new Path("Kingdom of Exploathing", 37),
114
- PathOfThePlumber: new Path("Path of the Plumber", 38, false, true, true, 20, 0, 5, (0, _templateString.$classes)(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["Plumber"])))),
115
- LowKeySummer: new Path("Low Key Summer", 40),
116
- GreyGoo: new Path("Grey Goo", 40),
117
- YouRobot: new Path("You, Robot", 41, false, false, true, 0, 0, 0),
118
- QuantumTerrarium: new Path("Quantum Terrarium", 42, true, true, false),
119
- Wildfire: new Path("Wildfire", 43)
120
- };
121
- exports.Paths = Paths;