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/ascend.js
CHANGED
|
@@ -1,114 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
8
|
-
exports.ascend = ascend;
|
|
9
|
-
exports.prepareAscension = prepareAscension;
|
|
10
|
-
exports.Lifestyle = void 0;
|
|
11
|
-
|
|
12
|
-
require("core-js/modules/es.array.includes.js");
|
|
13
|
-
|
|
14
|
-
require("core-js/modules/es.string.includes.js");
|
|
15
|
-
|
|
16
|
-
require("core-js/modules/es.array.concat.js");
|
|
17
|
-
|
|
18
|
-
require("core-js/modules/es.object.to-string.js");
|
|
19
|
-
|
|
20
|
-
require("core-js/modules/es.regexp.to-string.js");
|
|
21
|
-
|
|
22
|
-
var _kolmafia = require("kolmafia");
|
|
23
|
-
|
|
24
|
-
var _templateString = require("./template-string");
|
|
25
|
-
|
|
26
|
-
var _property = require("./property");
|
|
27
|
-
|
|
28
|
-
var _resources = require("./resources");
|
|
29
|
-
|
|
30
|
-
var _lib = require("./lib");
|
|
31
|
-
|
|
32
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
|
|
33
|
-
|
|
34
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
35
|
-
|
|
36
|
-
var Lifestyle;
|
|
37
|
-
exports.Lifestyle = Lifestyle;
|
|
38
|
-
|
|
1
|
+
import { containsText, eudoraItem, getCampground, getWorkshed, toInt, use, visitUrl, xpath, } from "kolmafia";
|
|
2
|
+
import { $item, $items, $stat } from "./template-string";
|
|
3
|
+
import { get } from "./property";
|
|
4
|
+
import { ChateauMantegna } from "./resources";
|
|
5
|
+
import { have } from "./lib";
|
|
6
|
+
export var Lifestyle;
|
|
39
7
|
(function (Lifestyle) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
})(Lifestyle || (
|
|
45
|
-
|
|
8
|
+
Lifestyle[Lifestyle["casual"] = 1] = "casual";
|
|
9
|
+
Lifestyle[Lifestyle["softcore"] = 2] = "softcore";
|
|
10
|
+
Lifestyle[Lifestyle["normal"] = 2] = "normal";
|
|
11
|
+
Lifestyle[Lifestyle["hardcore"] = 3] = "hardcore";
|
|
12
|
+
})(Lifestyle || (Lifestyle = {}));
|
|
46
13
|
function toMoonId(moon, playerClass) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
14
|
+
if (typeof moon === "number")
|
|
15
|
+
return moon;
|
|
16
|
+
const offset = () => {
|
|
17
|
+
switch (playerClass.primestat) {
|
|
18
|
+
case $stat `Muscle`:
|
|
19
|
+
return 0;
|
|
20
|
+
case $stat `Mysticality`:
|
|
21
|
+
return 1;
|
|
22
|
+
case $stat `Moxie`:
|
|
23
|
+
return 2;
|
|
24
|
+
default:
|
|
25
|
+
throw `unknown prime stat for ${playerClass}`;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
switch (moon.toLowerCase()) {
|
|
29
|
+
case "mongoose":
|
|
30
|
+
return 1;
|
|
31
|
+
case "wallaby":
|
|
32
|
+
return 2;
|
|
33
|
+
case "vole":
|
|
34
|
+
return 3;
|
|
35
|
+
case "platypus":
|
|
36
|
+
return 4;
|
|
37
|
+
case "opossum":
|
|
38
|
+
return 5;
|
|
39
|
+
case "marmot":
|
|
40
|
+
return 6;
|
|
41
|
+
case "wombat":
|
|
42
|
+
return 7;
|
|
43
|
+
case "blender":
|
|
44
|
+
return 8;
|
|
45
|
+
case "packrat":
|
|
46
|
+
return 9;
|
|
47
|
+
case "degrassi":
|
|
48
|
+
case "degrassi knoll":
|
|
49
|
+
case "friendly degrassi knoll":
|
|
50
|
+
case "knoll":
|
|
51
|
+
return 1 + offset();
|
|
52
|
+
case "canada":
|
|
53
|
+
case "canadia":
|
|
54
|
+
case "little canadia":
|
|
55
|
+
return 4 + offset();
|
|
56
|
+
case "gnomads":
|
|
57
|
+
case "gnomish":
|
|
58
|
+
case "gnomish gnomads camp":
|
|
59
|
+
return 7 + offset();
|
|
60
|
+
default:
|
|
61
|
+
return -1;
|
|
62
62
|
}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
switch (moon.toLowerCase()) {
|
|
66
|
-
case "mongoose":
|
|
67
|
-
return 1;
|
|
68
|
-
|
|
69
|
-
case "wallaby":
|
|
70
|
-
return 2;
|
|
71
|
-
|
|
72
|
-
case "vole":
|
|
73
|
-
return 3;
|
|
74
|
-
|
|
75
|
-
case "platypus":
|
|
76
|
-
return 4;
|
|
77
|
-
|
|
78
|
-
case "opossum":
|
|
79
|
-
return 5;
|
|
80
|
-
|
|
81
|
-
case "marmot":
|
|
82
|
-
return 6;
|
|
83
|
-
|
|
84
|
-
case "wombat":
|
|
85
|
-
return 7;
|
|
86
|
-
|
|
87
|
-
case "blender":
|
|
88
|
-
return 8;
|
|
89
|
-
|
|
90
|
-
case "packrat":
|
|
91
|
-
return 9;
|
|
92
|
-
|
|
93
|
-
case "degrassi":
|
|
94
|
-
case "degrassi knoll":
|
|
95
|
-
case "friendly degrassi knoll":
|
|
96
|
-
case "knoll":
|
|
97
|
-
return 1 + offset();
|
|
98
|
-
|
|
99
|
-
case "canada":
|
|
100
|
-
case "canadia":
|
|
101
|
-
case "little canadia":
|
|
102
|
-
return 4 + offset();
|
|
103
|
-
|
|
104
|
-
case "gnomads":
|
|
105
|
-
case "gnomish":
|
|
106
|
-
case "gnomish gnomads camp":
|
|
107
|
-
return 7 + offset();
|
|
108
|
-
|
|
109
|
-
default:
|
|
110
|
-
return -1;
|
|
111
|
-
}
|
|
112
63
|
}
|
|
113
64
|
/**
|
|
114
65
|
* Hops the gash, perming no skills
|
|
@@ -119,76 +70,106 @@ function toMoonId(moon, playerClass) {
|
|
|
119
70
|
* @param consumable From the astral deli. Pick the container item, not the product.
|
|
120
71
|
* @param pet From the astral pet store.
|
|
121
72
|
*/
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
73
|
+
export function ascend(path, playerClass, lifestyle, moon, consumable = $item `astral six-pack`, pet = undefined) {
|
|
74
|
+
if (!containsText(visitUrl("charpane.php"), "Astral Spirit")) {
|
|
75
|
+
visitUrl("ascend.php?action=ascend&confirm=on&confirm2=on");
|
|
76
|
+
}
|
|
77
|
+
if (!containsText(visitUrl("charpane.php"), "Astral Spirit"))
|
|
78
|
+
throw "Failed to ascend.";
|
|
79
|
+
if (!path.classes.includes(playerClass))
|
|
80
|
+
throw `Invalid class ${playerClass} for this path`;
|
|
81
|
+
if (path.id < 0)
|
|
82
|
+
throw `Invalid path ID ${path.id}`;
|
|
83
|
+
const moonId = toMoonId(moon, playerClass);
|
|
84
|
+
if (moonId < 1 || moonId > 9)
|
|
85
|
+
throw `Invalid moon ${moon}`;
|
|
86
|
+
if (consumable &&
|
|
87
|
+
!$items `astral six-pack, astral hot dog dinner`.includes(consumable))
|
|
88
|
+
throw `Invalid consumable ${consumable}`;
|
|
89
|
+
if (pet &&
|
|
90
|
+
!$items `astral bludgeon, astral shield, astral chapeau, astral bracer, astral longbow, astral shorts, astral mace, astral ring, astral statuette, astral pistol, astral mask, astral pet sweater, astral shirt, astral belt`.includes(pet))
|
|
91
|
+
throw `Invalid astral item ${pet}`;
|
|
92
|
+
visitUrl("afterlife.php?action=pearlygates");
|
|
93
|
+
if (consumable)
|
|
94
|
+
visitUrl(`afterlife.php?action=buydeli&whichitem=${toInt(consumable)}`);
|
|
95
|
+
if (pet)
|
|
96
|
+
visitUrl(`afterlife.php?action=buyarmory&whichitem=${toInt(pet)}`);
|
|
97
|
+
visitUrl(`afterlife.php?action=ascend&confirmascend=1&whichsign=${moonId}&gender=2&whichclass=${toInt(playerClass)}&whichpath=${path.id}&asctype=${lifestyle}&nopetok=1&noskillsok=1&lamepathok=1&pwd`, true);
|
|
143
98
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
var nightstands = (0, _templateString.$items)(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["foreign language tapes, bowl of potpourri, electric muscle stimulator"])));
|
|
99
|
+
const worksheds = $items `warbear LP-ROM burner, warbear jackhammer drill press, warbear induction oven, warbear high-efficiency still, warbear chemistry lab, warbear auto-anvil, spinning wheel, snow machine, Little Geneticist DNA-Splicing Lab, portable Mayo Clinic, Asdon Martin keyfob, diabolic pizza cube`;
|
|
100
|
+
const gardens = $items `packet of pumpkin seeds, Peppermint Pip Packet, packet of dragon's teeth, packet of beer seeds, packet of winter seeds, packet of thanksgarden seeds, packet of tall grass seeds, packet of mushroom spores`;
|
|
101
|
+
// eslint-disable-next-line libram/verify-constants
|
|
102
|
+
const eudorae = $items `My Own Pen Pal kit, GameInformPowerDailyPro subscription card, Xi Receiver Unit, New-You Club Membership Form, Our Daily Candles™ order form`;
|
|
103
|
+
const desks = $items `fancy stationery set, Swiss piggy bank, continental juice bar`;
|
|
104
|
+
const ceilings = $items `antler chandelier, ceiling fan, artificial skylight`;
|
|
105
|
+
const nightstands = $items `foreign language tapes, bowl of potpourri, electric muscle stimulator`;
|
|
152
106
|
/**
|
|
153
107
|
* Sets up various iotms you may want to use in the coming ascension
|
|
154
108
|
* @param ascensionItems An object potentially containing your workshed, garden, and eudora, all as items
|
|
155
109
|
* @param chateauItems An object potentially containing your chateau desk, ceiling, and nightstand, all as items
|
|
156
110
|
* @param throwOnFail If true, this will throw an error when it fails to switch something
|
|
157
111
|
*/
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
112
|
+
export function prepareAscension(ascensionItems, chateauItems, throwOnFail = true) {
|
|
113
|
+
if (ascensionItems) {
|
|
114
|
+
if (ascensionItems.workshed && getWorkshed() !== ascensionItems.workshed) {
|
|
115
|
+
if (!worksheds.includes(ascensionItems.workshed) && throwOnFail)
|
|
116
|
+
throw `Invalid workshed: ${ascensionItems.workshed}!`;
|
|
117
|
+
else if (!have(ascensionItems.workshed) && throwOnFail)
|
|
118
|
+
throw `I'm sorry buddy, but you don't seem to own a ${ascensionItems.workshed}. Which makes it REALLY hard for us to plop one into your workshed.`;
|
|
119
|
+
else if (get("_workshedItemUsed") && throwOnFail)
|
|
120
|
+
throw `Seems like you've already swapped your workshed, buddy.`;
|
|
121
|
+
else
|
|
122
|
+
use(ascensionItems.workshed);
|
|
123
|
+
if (getWorkshed() !== ascensionItems.workshed && throwOnFail)
|
|
124
|
+
throw `We really thought we changed your workshed to a ${ascensionItems.workshed}, but Mafia is saying otherwise.`;
|
|
125
|
+
}
|
|
126
|
+
if (ascensionItems.garden &&
|
|
127
|
+
!Object.getOwnPropertyNames(getCampground()).includes(ascensionItems.garden.name)) {
|
|
128
|
+
if (!gardens.includes(ascensionItems.garden) && throwOnFail)
|
|
129
|
+
throw `Invalid garden: ${ascensionItems.garden}!`;
|
|
130
|
+
else if (!have(ascensionItems.garden) && throwOnFail)
|
|
131
|
+
throw `I'm sorry buddy, but you don't seem to own a ${ascensionItems.garden}. Which makes it REALLY hard for us to plant one into your garden.`;
|
|
132
|
+
else
|
|
133
|
+
use(ascensionItems.garden);
|
|
134
|
+
if (!Object.getOwnPropertyNames(getCampground()).includes(ascensionItems.garden.name) &&
|
|
135
|
+
throwOnFail)
|
|
136
|
+
throw `We really thought we changed your garden to a ${ascensionItems.garden}, but Mafia is saying otherwise.`;
|
|
137
|
+
}
|
|
138
|
+
if (ascensionItems.eudora && eudoraItem() !== ascensionItems.eudora) {
|
|
139
|
+
if (!eudorae.includes(ascensionItems.eudora) && throwOnFail)
|
|
140
|
+
throw `Invalid eudora: ${ascensionItems.eudora}!`;
|
|
141
|
+
const eudoraNumber = 1 + eudorae.indexOf(ascensionItems.eudora);
|
|
142
|
+
if (!xpath(visitUrl("account.php?tab=correspondence"), `//select[@name="whichpenpal"]/option/@value`).includes(eudoraNumber.toString()) &&
|
|
143
|
+
throwOnFail)
|
|
144
|
+
throw `I'm sorry buddy, but you don't seem to be subscribed to ${ascensionItems.eudora}. Which makes it REALLY hard to correspond with them.`;
|
|
145
|
+
else
|
|
146
|
+
visitUrl(`account.php?actions[]=whichpenpal&whichpenpal=${eudoraNumber}&action=Update`, true);
|
|
147
|
+
if (eudoraItem() !== ascensionItems.eudora && throwOnFail)
|
|
148
|
+
throw `We really thought we chaned your eudora to a ${ascensionItems.eudora}, but Mafia is saying otherwise.`;
|
|
149
|
+
}
|
|
178
150
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
151
|
+
if (chateauItems && ChateauMantegna.have()) {
|
|
152
|
+
if (chateauItems.ceiling &&
|
|
153
|
+
ChateauMantegna.getCeiling() !== chateauItems.ceiling) {
|
|
154
|
+
if (!ceilings.includes(chateauItems.ceiling) && throwOnFail)
|
|
155
|
+
throw `Invalid chateau ceiling: ${chateauItems.ceiling}!`;
|
|
156
|
+
else if (!ChateauMantegna.changeCeiling(chateauItems.ceiling) &&
|
|
157
|
+
throwOnFail)
|
|
158
|
+
throw `We tried, but were unable to change your chateau ceiling to ${chateauItems.ceiling}. Probably.`;
|
|
159
|
+
}
|
|
160
|
+
if (chateauItems.desk && ChateauMantegna.getDesk() !== chateauItems.desk) {
|
|
161
|
+
if (!desks.includes(chateauItems.desk) && throwOnFail)
|
|
162
|
+
throw `Invalid chateau desk: ${chateauItems.desk}!`;
|
|
163
|
+
else if (!ChateauMantegna.changeDesk(chateauItems.desk) && throwOnFail)
|
|
164
|
+
throw `We tried, but were unable to change your chateau desk to ${chateauItems.desk}. Probably.`;
|
|
165
|
+
}
|
|
166
|
+
if (chateauItems.nightstand &&
|
|
167
|
+
ChateauMantegna.getNightstand() !== chateauItems.nightstand) {
|
|
168
|
+
if (!nightstands.includes(chateauItems.nightstand) && throwOnFail)
|
|
169
|
+
throw `Invalid chateau nightstand: ${chateauItems.nightstand}!`;
|
|
170
|
+
else if (!ChateauMantegna.changeNightstand(chateauItems.nightstand) &&
|
|
171
|
+
throwOnFail)
|
|
172
|
+
throw `We tried, but were unable to change your chateau nightstand to ${chateauItems.nightstand}. Probably.`;
|
|
173
|
+
}
|
|
184
174
|
}
|
|
185
|
-
|
|
186
|
-
if (chateauItems.desk && _resources.ChateauMantegna.getDesk() !== chateauItems.desk) {
|
|
187
|
-
if (!desks.includes(chateauItems.desk) && throwOnFail) throw "Invalid chateau desk: ".concat(chateauItems.desk, "!");else if (!_resources.ChateauMantegna.changeDesk(chateauItems.desk) && throwOnFail) throw "We tried, but were unable to change your chateau desk to ".concat(chateauItems.desk, ". Probably.");
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (chateauItems.nightstand && _resources.ChateauMantegna.getNightstand() !== chateauItems.nightstand) {
|
|
191
|
-
if (!nightstands.includes(chateauItems.nightstand) && throwOnFail) throw "Invalid chateau nightstand: ".concat(chateauItems.nightstand, "!");else if (!_resources.ChateauMantegna.changeNightstand(chateauItems.nightstand) && throwOnFail) throw "We tried, but were unable to change your chateau nightstand to ".concat(chateauItems.nightstand, ". Probably.");
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
175
|
+
}
|
package/dist/combat.d.ts
CHANGED
|
@@ -68,6 +68,16 @@ export declare class Macro {
|
|
|
68
68
|
* @returns {Macro} This object itself.
|
|
69
69
|
*/
|
|
70
70
|
static abort<T extends Macro>(this: Constructor<T>): T;
|
|
71
|
+
/**
|
|
72
|
+
* Add a "runaway" step to this macro.
|
|
73
|
+
* @returns {Macro} This object itself.
|
|
74
|
+
*/
|
|
75
|
+
runaway(): this;
|
|
76
|
+
/**
|
|
77
|
+
* Create a new macro with an "runaway" step.
|
|
78
|
+
* @returns {Macro} This object itself.
|
|
79
|
+
*/
|
|
80
|
+
static runaway<T extends Macro>(this: Constructor<T>): T;
|
|
71
81
|
/**
|
|
72
82
|
* Add an "if" statement to this macro.
|
|
73
83
|
* @param condition The BALLS condition for the if statement.
|
|
@@ -100,9 +110,10 @@ export declare class Macro {
|
|
|
100
110
|
* Conditionally add a step to a macro based on a condition evaluated at the time of building the macro.
|
|
101
111
|
* @param condition The JS condition.
|
|
102
112
|
* @param ifTrue Continuation to add if the condition is true.
|
|
113
|
+
* @param ifFalse Optional input to turn this into an if...else statement.
|
|
103
114
|
* @returns {Macro} This object itself.
|
|
104
115
|
*/
|
|
105
|
-
externalIf(condition: boolean, ifTrue: string | Macro): this;
|
|
116
|
+
externalIf(condition: boolean, ifTrue: string | Macro, ifFalse?: string | Macro): this;
|
|
106
117
|
/**
|
|
107
118
|
* Create a new macro with a condition evaluated at the time of building the macro.
|
|
108
119
|
* @param condition The JS condition.
|
|
@@ -185,6 +196,18 @@ export declare class Macro {
|
|
|
185
196
|
* @returns {Macro} This object itself.
|
|
186
197
|
*/
|
|
187
198
|
static attack<T extends Macro>(this: Constructor<T>): T;
|
|
199
|
+
/**
|
|
200
|
+
* Create an if_ statement that triggers only against a particular monster
|
|
201
|
+
* @param monster The monster in question
|
|
202
|
+
* @param macro The macro to trigger when the monster is found
|
|
203
|
+
*/
|
|
204
|
+
ifMonster(monster: Monster, macro: Macro): Macro;
|
|
205
|
+
/**
|
|
206
|
+
* Create a new macro with an if_ statement that triggers only against a particular monster
|
|
207
|
+
* @param monster The monster in question
|
|
208
|
+
* @param macro The macro to trigger when the monster is found
|
|
209
|
+
*/
|
|
210
|
+
static ifMonster(monster: Monster, macro: Macro): Macro;
|
|
188
211
|
}
|
|
189
212
|
/**
|
|
190
213
|
* Adventure in a location and handle all combats with a given macro.
|
|
@@ -207,4 +230,66 @@ export declare function adventureMacro(loc: Location, macro: Macro): void;
|
|
|
207
230
|
* @param nextMacro Macro to execute manually after autoattack completes.
|
|
208
231
|
*/
|
|
209
232
|
export declare function adventureMacroAuto(loc: Location, autoMacro: Macro, nextMacro?: Macro | null): void;
|
|
233
|
+
export declare class StrictMacro extends Macro {
|
|
234
|
+
/**
|
|
235
|
+
* Add one or more skill cast steps to the macro.
|
|
236
|
+
* @param skills Skills to cast.
|
|
237
|
+
* @returns {StrictMacro} This object itself.
|
|
238
|
+
*/
|
|
239
|
+
skill(...skills: Skill[]): this;
|
|
240
|
+
/**
|
|
241
|
+
* Create a new macro with one or more skill cast steps.
|
|
242
|
+
* @param skills Skills to cast.
|
|
243
|
+
* @returns {StrictMacro} This object itself.
|
|
244
|
+
*/
|
|
245
|
+
static skill<T extends StrictMacro>(this: Constructor<T>, ...skills: Skill[]): T;
|
|
246
|
+
/**
|
|
247
|
+
* Add one or more item steps to the macro.
|
|
248
|
+
* @param items Items to use. Pass a tuple [item1, item2] to funksling.
|
|
249
|
+
* @returns {StrictMacro} This object itself.
|
|
250
|
+
*/
|
|
251
|
+
item(...items: (Item | [Item, Item])[]): this;
|
|
252
|
+
/**
|
|
253
|
+
* Create a new macro with one or more item steps.
|
|
254
|
+
* @param items Items to use. Pass a tuple [item1, item2] to funksling.
|
|
255
|
+
* @returns {StrictMacro} This object itself.
|
|
256
|
+
*/
|
|
257
|
+
static item<T extends StrictMacro>(this: Constructor<T>, ...items: (Item | [Item, Item])[]): T;
|
|
258
|
+
/**
|
|
259
|
+
* Add one or more skill cast steps to the macro, where each step checks if you have the skill first.
|
|
260
|
+
* @param skills Skills to try casting.
|
|
261
|
+
* @returns {StrictMacro} This object itself.
|
|
262
|
+
*/
|
|
263
|
+
trySkill(...skills: Skill[]): this;
|
|
264
|
+
/**
|
|
265
|
+
* Create a new macro with one or more skill cast steps, where each step checks if you have the skill first.
|
|
266
|
+
* @param skills Skills to try casting.
|
|
267
|
+
* @returns {StrictMacro} This object itself.
|
|
268
|
+
*/
|
|
269
|
+
static trySkill<T extends StrictMacro>(this: Constructor<T>, ...skills: Skill[]): T;
|
|
270
|
+
/**
|
|
271
|
+
* Add one or more item steps to the macro, where each step checks to see if you have the item first.
|
|
272
|
+
* @param items Items to try using. Pass a tuple [item1, item2] to funksling.
|
|
273
|
+
* @returns {StrictMacro} This object itself.
|
|
274
|
+
*/
|
|
275
|
+
tryItem(...items: (Item | [Item, Item])[]): this;
|
|
276
|
+
/**
|
|
277
|
+
* Create a new macro with one or more item steps, where each step checks to see if you have the item first.
|
|
278
|
+
* @param items Items to try using. Pass a tuple [item1, item2] to funksling.
|
|
279
|
+
* @returns {StrictMacro} This object itself.
|
|
280
|
+
*/
|
|
281
|
+
static tryItem<T extends StrictMacro>(this: Constructor<T>, ...items: (Item | [Item, Item])[]): T;
|
|
282
|
+
/**
|
|
283
|
+
* Add one or more skill-cast-and-repeat steps to the macro, where each step checks if you have the skill first.
|
|
284
|
+
* @param skills Skills to try repeatedly casting.
|
|
285
|
+
* @returns {StrictMacro} This object itself.
|
|
286
|
+
*/
|
|
287
|
+
trySkillRepeat(...skills: Skill[]): this;
|
|
288
|
+
/**
|
|
289
|
+
* Create a new macro with one or more skill-cast-and-repeat steps, where each step checks if you have the skill first.
|
|
290
|
+
* @param skills Skills to try repeatedly casting.
|
|
291
|
+
* @returns {StrictMacro} This object itself.
|
|
292
|
+
*/
|
|
293
|
+
static trySkillRepeat<T extends StrictMacro>(this: Constructor<T>, ...skills: Skill[]): T;
|
|
294
|
+
}
|
|
210
295
|
export {};
|