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/combat.js
CHANGED
|
@@ -1,128 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.symbol.description.js");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.array.iterator.js");
|
|
10
|
-
|
|
11
|
-
Object.defineProperty(exports, "__esModule", {
|
|
12
|
-
value: true
|
|
13
|
-
});
|
|
14
|
-
exports.getMacroId = getMacroId;
|
|
15
|
-
exports.adventureMacro = adventureMacro;
|
|
16
|
-
exports.adventureMacroAuto = adventureMacroAuto;
|
|
17
|
-
exports.Macro = void 0;
|
|
18
|
-
|
|
19
|
-
require("core-js/modules/es.array.map.js");
|
|
20
|
-
|
|
21
|
-
require("core-js/modules/es.array.includes.js");
|
|
22
|
-
|
|
23
|
-
require("core-js/modules/es.string.includes.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.regexp.exec.js");
|
|
30
|
-
|
|
31
|
-
require("core-js/modules/es.string.match.js");
|
|
32
|
-
|
|
33
|
-
require("core-js/modules/es.array.concat.js");
|
|
34
|
-
|
|
35
|
-
require("core-js/modules/es.array.filter.js");
|
|
36
|
-
|
|
37
|
-
require("core-js/modules/es.string.split.js");
|
|
38
|
-
|
|
39
|
-
var _kolmafia = require("kolmafia");
|
|
40
|
-
|
|
41
|
-
var _templateString = require("./template-string");
|
|
42
|
-
|
|
43
|
-
var _property = require("./property");
|
|
44
|
-
|
|
45
|
-
var _templateObject, _templateObject2;
|
|
46
|
-
|
|
47
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
48
|
-
|
|
49
|
-
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."); }
|
|
50
|
-
|
|
51
|
-
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); }
|
|
52
|
-
|
|
53
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
54
|
-
|
|
55
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
56
|
-
|
|
57
|
-
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; }
|
|
58
|
-
|
|
59
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
60
|
-
|
|
61
|
-
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); } }
|
|
62
|
-
|
|
63
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
64
|
-
|
|
65
|
-
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; }
|
|
66
|
-
|
|
67
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
68
|
-
|
|
69
|
-
var MACRO_NAME = "Script Autoattack Macro";
|
|
1
|
+
import { adv1, choiceFollowsFight, getAutoAttack, inMultiFight, removeProperty, runCombat, setAutoAttack, toInt, urlEncode, visitUrl, xpath, } from "kolmafia";
|
|
2
|
+
import { $items, $skills } from "./template-string";
|
|
3
|
+
import { get, set } from "./property";
|
|
4
|
+
import { getTodaysHolidayWanderers } from "./lib";
|
|
5
|
+
const MACRO_NAME = "Script Autoattack Macro";
|
|
70
6
|
/**
|
|
71
7
|
* Get the KoL native ID of the macro with name Script Autoattack Macro.
|
|
72
8
|
*
|
|
73
9
|
* @category Combat
|
|
74
10
|
* @returns {number} The macro ID.
|
|
75
11
|
*/
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
12
|
+
export function getMacroId() {
|
|
13
|
+
const macroMatches = xpath(visitUrl("account_combatmacros.php"), `//select[@name="macroid"]/option[text()="${MACRO_NAME}"]/@value`);
|
|
14
|
+
if (macroMatches.length === 0) {
|
|
15
|
+
visitUrl("account_combatmacros.php?action=new");
|
|
16
|
+
const newMacroText = visitUrl(`account_combatmacros.php?macroid=0&name=${MACRO_NAME}¯otext=abort&action=save`);
|
|
17
|
+
return parseInt(xpath(newMacroText, "//input[@name=macroid]/@value")[0], 10);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return parseInt(macroMatches[0], 10);
|
|
21
|
+
}
|
|
87
22
|
}
|
|
88
|
-
|
|
89
23
|
function itemOrNameToItem(itemOrName) {
|
|
90
|
-
|
|
24
|
+
return typeof itemOrName === "string" ? Item.get(itemOrName) : itemOrName;
|
|
91
25
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
var substringCombatSkills = (0, _templateString.$skills)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["Shoot, Thrust-Smack, Headbutt, Toss, Sing, Disarm, LIGHT, BURN, Extract, Meteor Shower, Cleave, Boil, Slice, Rainbow"])));
|
|
95
|
-
|
|
26
|
+
const substringCombatItems = $items `spider web, really sticky spider web, dictionary, NG, Cloaca-Cola, yo-yo, top, ball, kite, yo, red potion, blue potion, adder, red button, pile of sand, mushroom, deluxe mushroom`;
|
|
27
|
+
const substringCombatSkills = $skills `Shoot, Thrust-Smack, Headbutt, Toss, Sing, Disarm, LIGHT, BURN, Extract, Meteor Shower, Cleave, Boil, Slice, Rainbow`;
|
|
96
28
|
function itemOrItemsBallsMacroName(itemOrItems) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
29
|
+
if (Array.isArray(itemOrItems)) {
|
|
30
|
+
return itemOrItems.map(itemOrItemsBallsMacroName).join(", ");
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
const item = itemOrNameToItem(itemOrItems);
|
|
34
|
+
return !substringCombatItems.includes(item)
|
|
35
|
+
? item.name
|
|
36
|
+
: toInt(item).toString();
|
|
37
|
+
}
|
|
103
38
|
}
|
|
104
|
-
|
|
105
39
|
function itemOrItemsBallsMacroPredicate(itemOrItems) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
40
|
+
if (Array.isArray(itemOrItems)) {
|
|
41
|
+
return itemOrItems.map(itemOrItemsBallsMacroPredicate).join(" && ");
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return `hascombatitem ${itemOrItems}`;
|
|
45
|
+
}
|
|
111
46
|
}
|
|
112
|
-
|
|
113
47
|
function skillOrNameToSkill(skillOrName) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
48
|
+
if (typeof skillOrName === "string") {
|
|
49
|
+
return Skill.get(skillOrName);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return skillOrName;
|
|
53
|
+
}
|
|
119
54
|
}
|
|
120
|
-
|
|
121
55
|
function skillBallsMacroName(skillOrName) {
|
|
122
|
-
|
|
123
|
-
|
|
56
|
+
const skill = skillOrNameToSkill(skillOrName);
|
|
57
|
+
return skill.name.match(/^[A-Za-z ]+$/) &&
|
|
58
|
+
!substringCombatSkills.includes(skill)
|
|
59
|
+
? skill.name
|
|
60
|
+
: toInt(skill);
|
|
61
|
+
}
|
|
62
|
+
export class InvalidMacroError extends Error {
|
|
124
63
|
}
|
|
125
|
-
|
|
126
64
|
/**
|
|
127
65
|
* BALLS macro builder for direct submission to KoL.
|
|
128
66
|
* Create a new macro with `new Macro()` and add steps using the instance methods.
|
|
@@ -130,115 +68,149 @@ function skillBallsMacroName(skillOrName) {
|
|
|
130
68
|
* Each method is also defined as a static method that creates a new Macro with only that step.
|
|
131
69
|
* For example, you can do `Macro.skill('Saucestorm').attack()`.
|
|
132
70
|
*/
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
_createClass(Macro, [{
|
|
141
|
-
key: "toString",
|
|
142
|
-
value:
|
|
71
|
+
export class Macro {
|
|
72
|
+
static SAVED_MACRO_PROPERTY = "libram_savedMacro";
|
|
73
|
+
static cachedMacroId = null;
|
|
74
|
+
static cachedAutoAttack = null;
|
|
75
|
+
components = [];
|
|
143
76
|
/**
|
|
144
77
|
* Convert macro to string.
|
|
145
78
|
*/
|
|
146
|
-
|
|
147
|
-
|
|
79
|
+
toString() {
|
|
80
|
+
return this.components.join(";");
|
|
148
81
|
}
|
|
149
82
|
/**
|
|
150
83
|
* Save a macro to a Mafia property for use in a consult script.
|
|
151
84
|
*/
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
key: "save",
|
|
155
|
-
value: function save() {
|
|
156
|
-
(0, _property.set)(Macro.SAVED_MACRO_PROPERTY, this.toString());
|
|
85
|
+
save() {
|
|
86
|
+
set(Macro.SAVED_MACRO_PROPERTY, this.toString());
|
|
157
87
|
}
|
|
158
88
|
/**
|
|
159
89
|
* Load a saved macro from the Mafia property.
|
|
160
90
|
*/
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
91
|
+
static load() {
|
|
92
|
+
return new this().step(...get(Macro.SAVED_MACRO_PROPERTY).split(";"));
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Clear the saved macro in the Mafia property.
|
|
96
|
+
*/
|
|
97
|
+
static clearSaved() {
|
|
98
|
+
removeProperty(Macro.SAVED_MACRO_PROPERTY);
|
|
99
|
+
}
|
|
165
100
|
/**
|
|
166
101
|
* Statefully add one or several steps to a macro.
|
|
167
102
|
* @param nextSteps The steps to add to the macro.
|
|
168
103
|
* @returns {Macro} This object itself.
|
|
169
104
|
*/
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
var nextStepsStrings = (_ref = []).concat.apply(_ref, _toConsumableArray(nextSteps.map(x => x instanceof Macro ? x.components : [x])));
|
|
178
|
-
|
|
179
|
-
this.components = [].concat(_toConsumableArray(this.components), _toConsumableArray(nextStepsStrings.filter(s => s.length > 0)));
|
|
180
|
-
return this;
|
|
105
|
+
step(...nextSteps) {
|
|
106
|
+
const nextStepsStrings = [].concat(...nextSteps.map((x) => (x instanceof Macro ? x.components : [x])));
|
|
107
|
+
this.components = [
|
|
108
|
+
...this.components,
|
|
109
|
+
...nextStepsStrings.filter((s) => s.length > 0),
|
|
110
|
+
];
|
|
111
|
+
return this;
|
|
181
112
|
}
|
|
182
113
|
/**
|
|
183
114
|
* Statefully add one or several steps to a macro.
|
|
184
115
|
* @param nextSteps The steps to add to the macro.
|
|
185
116
|
* @returns {Macro} This object itself.
|
|
186
117
|
*/
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
value:
|
|
118
|
+
static step(...nextSteps) {
|
|
119
|
+
return new this().step(...nextSteps);
|
|
120
|
+
}
|
|
191
121
|
/**
|
|
192
122
|
* Submit the built macro to KoL. Only works inside combat.
|
|
193
123
|
*/
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
124
|
+
submit() {
|
|
125
|
+
const final = this.toString();
|
|
126
|
+
return visitUrl(`fight.php?action=macro¯otext=${urlEncode(final)}`, true, true);
|
|
197
127
|
}
|
|
198
128
|
/**
|
|
199
129
|
* Set this macro as a KoL native autoattack.
|
|
200
130
|
*/
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
(0, _kolmafia.visitUrl)("account_combatmacros.php?macroid=".concat(Macro.cachedMacroId, "&name=").concat((0, _kolmafia.urlEncode)(MACRO_NAME), "¯otext=").concat((0, _kolmafia.urlEncode)(this.toString()), "&action=save"), true, true);
|
|
213
|
-
(0, _kolmafia.visitUrl)("account.php?am=1&action=autoattack&value=".concat(99000000 + Macro.cachedMacroId, "&ajax=1"));
|
|
214
|
-
Macro.cachedAutoAttack = this.toString();
|
|
131
|
+
setAutoAttack() {
|
|
132
|
+
if (Macro.cachedMacroId === null)
|
|
133
|
+
Macro.cachedMacroId = getMacroId();
|
|
134
|
+
if (getAutoAttack() === 99000000 + Macro.cachedMacroId &&
|
|
135
|
+
this.toString() === Macro.cachedAutoAttack) {
|
|
136
|
+
// This macro is already set. Don"t make the server request.
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
visitUrl(`account_combatmacros.php?macroid=${Macro.cachedMacroId}&name=${urlEncode(MACRO_NAME)}¯otext=${urlEncode(this.toString())}&action=save`, true, true);
|
|
140
|
+
visitUrl(`account.php?am=1&action=autoattack&value=${99000000 + Macro.cachedMacroId}&ajax=1`);
|
|
141
|
+
Macro.cachedAutoAttack = this.toString();
|
|
215
142
|
}
|
|
216
143
|
/**
|
|
217
144
|
* Add an "abort" step to this macro.
|
|
218
145
|
* @returns {Macro} This object itself.
|
|
219
146
|
*/
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
key: "abort",
|
|
223
|
-
value: function abort() {
|
|
224
|
-
return this.step("abort");
|
|
147
|
+
abort() {
|
|
148
|
+
return this.step("abort");
|
|
225
149
|
}
|
|
226
150
|
/**
|
|
227
151
|
* Create a new macro with an "abort" step.
|
|
228
152
|
* @returns {Macro} This object itself.
|
|
229
153
|
*/
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
154
|
+
static abort() {
|
|
155
|
+
return new this().abort();
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Add a "runaway" step to this macro.
|
|
159
|
+
* @returns {Macro} This object itself.
|
|
160
|
+
*/
|
|
161
|
+
runaway() {
|
|
162
|
+
return this.step("runaway");
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Create a new macro with an "runaway" step.
|
|
166
|
+
* @returns {Macro} This object itself.
|
|
167
|
+
*/
|
|
168
|
+
static runaway() {
|
|
169
|
+
return new this().runaway();
|
|
170
|
+
}
|
|
234
171
|
/**
|
|
235
172
|
* Add an "if" statement to this macro.
|
|
236
173
|
* @param condition The BALLS condition for the if statement.
|
|
237
174
|
* @param ifTrue Continuation if the condition is true.
|
|
238
175
|
* @returns {Macro} This object itself.
|
|
239
176
|
*/
|
|
240
|
-
|
|
241
|
-
|
|
177
|
+
if_(condition, ifTrue) {
|
|
178
|
+
let ballsCondition = "";
|
|
179
|
+
if (condition instanceof Monster) {
|
|
180
|
+
ballsCondition = `monsterid ${condition.id}`;
|
|
181
|
+
}
|
|
182
|
+
else if (condition instanceof Effect) {
|
|
183
|
+
ballsCondition = `haseffect ${toInt(condition)}`;
|
|
184
|
+
}
|
|
185
|
+
else if (condition instanceof Skill) {
|
|
186
|
+
ballsCondition = `hasskill ${skillBallsMacroName(condition)}`;
|
|
187
|
+
}
|
|
188
|
+
else if (condition instanceof Item) {
|
|
189
|
+
if (!condition.combat) {
|
|
190
|
+
throw new InvalidMacroError(`Item ${condition} cannot be made a valid BALLS predicate (it is not combat-usable)`);
|
|
191
|
+
}
|
|
192
|
+
ballsCondition = `hascombatitem ${itemOrItemsBallsMacroName(condition)}`;
|
|
193
|
+
}
|
|
194
|
+
else if (condition instanceof Location) {
|
|
195
|
+
const snarfblat = condition.id;
|
|
196
|
+
if (snarfblat < 1) {
|
|
197
|
+
throw new InvalidMacroError(`Location ${condition} cannot be made a valid BALLS predicate (it has no location id)`);
|
|
198
|
+
}
|
|
199
|
+
ballsCondition = `snarfblat ${snarfblat}`;
|
|
200
|
+
}
|
|
201
|
+
else if (condition instanceof Class) {
|
|
202
|
+
if (toInt(condition) > 6) {
|
|
203
|
+
throw new InvalidMacroError(`Class ${condition} cannot be made a valid BALLS predicate (it is not a standard class)`);
|
|
204
|
+
}
|
|
205
|
+
ballsCondition = condition.toString().replaceAll(" ", "").toLowerCase();
|
|
206
|
+
}
|
|
207
|
+
else if (condition instanceof Stat) {
|
|
208
|
+
ballsCondition = `${condition.toString().toLowerCase()}class`;
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
ballsCondition = condition;
|
|
212
|
+
}
|
|
213
|
+
return this.step(`if ${ballsCondition}`).step(ifTrue).step("endif");
|
|
242
214
|
}
|
|
243
215
|
/**
|
|
244
216
|
* Create a new macro with an "if" statement.
|
|
@@ -246,18 +218,17 @@ var Macro = /*#__PURE__*/function () {
|
|
|
246
218
|
* @param ifTrue Continuation if the condition is true.
|
|
247
219
|
* @returns {Macro} This object itself.
|
|
248
220
|
*/
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
value:
|
|
221
|
+
static if_(condition, ifTrue) {
|
|
222
|
+
return new this().if_(condition, ifTrue);
|
|
223
|
+
}
|
|
253
224
|
/**
|
|
254
225
|
* Add a "while" statement to this macro.
|
|
255
226
|
* @param condition The BALLS condition for the if statement.
|
|
256
227
|
* @param contents Loop to repeat while the condition is true.
|
|
257
228
|
* @returns {Macro} This object itself.
|
|
258
229
|
*/
|
|
259
|
-
|
|
260
|
-
|
|
230
|
+
while_(condition, contents) {
|
|
231
|
+
return this.step(`while ${condition}`).step(contents).step("endwhile");
|
|
261
232
|
}
|
|
262
233
|
/**
|
|
263
234
|
* Create a new macro with a "while" statement.
|
|
@@ -265,10 +236,9 @@ var Macro = /*#__PURE__*/function () {
|
|
|
265
236
|
* @param contents Loop to repeat while the condition is true.
|
|
266
237
|
* @returns {Macro} This object itself.
|
|
267
238
|
*/
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
value:
|
|
239
|
+
static while_(condition, contents) {
|
|
240
|
+
return new this().while_(condition, contents);
|
|
241
|
+
}
|
|
272
242
|
/**
|
|
273
243
|
* Conditionally add a step to a macro based on a condition evaluated at the time of building the macro.
|
|
274
244
|
* @param condition The JS condition.
|
|
@@ -276,243 +246,170 @@ var Macro = /*#__PURE__*/function () {
|
|
|
276
246
|
* @param ifFalse Optional input to turn this into an if...else statement.
|
|
277
247
|
* @returns {Macro} This object itself.
|
|
278
248
|
*/
|
|
279
|
-
|
|
280
|
-
|
|
249
|
+
externalIf(condition, ifTrue, ifFalse) {
|
|
250
|
+
if (condition)
|
|
251
|
+
return this.step(ifTrue);
|
|
252
|
+
else if (ifFalse)
|
|
253
|
+
return this.step(ifFalse);
|
|
254
|
+
else
|
|
255
|
+
return this;
|
|
281
256
|
}
|
|
282
257
|
/**
|
|
283
258
|
* Create a new macro with a condition evaluated at the time of building the macro.
|
|
284
259
|
* @param condition The JS condition.
|
|
285
260
|
* @param ifTrue Continuation to add if the condition is true.
|
|
261
|
+
* @param ifFalse Optional input to turn this into an if...else statement.
|
|
286
262
|
* @returns {Macro} This object itself.
|
|
287
263
|
*/
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
value:
|
|
264
|
+
static externalIf(condition, ifTrue, ifFalse) {
|
|
265
|
+
return new this().externalIf(condition, ifTrue, ifFalse);
|
|
266
|
+
}
|
|
292
267
|
/**
|
|
293
268
|
* Add a repeat step to the macro.
|
|
294
269
|
* @returns {Macro} This object itself.
|
|
295
270
|
*/
|
|
296
|
-
|
|
297
|
-
|
|
271
|
+
repeat() {
|
|
272
|
+
return this.step("repeat");
|
|
298
273
|
}
|
|
299
274
|
/**
|
|
300
275
|
* Add one or more skill cast steps to the macro.
|
|
301
276
|
* @param skills Skills to cast.
|
|
302
277
|
* @returns {Macro} This object itself.
|
|
303
278
|
*/
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
for (var _len2 = arguments.length, skills = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
309
|
-
skills[_key2] = arguments[_key2];
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
return this.step.apply(this, _toConsumableArray(skills.map(skill => {
|
|
313
|
-
return "skill ".concat(skillBallsMacroName(skill));
|
|
314
|
-
})));
|
|
279
|
+
skill(...skills) {
|
|
280
|
+
return this.step(...skills.map((skill) => {
|
|
281
|
+
return `skill ${skillBallsMacroName(skill)}`;
|
|
282
|
+
}));
|
|
315
283
|
}
|
|
316
284
|
/**
|
|
317
285
|
* Create a new macro with one or more skill cast steps.
|
|
318
286
|
* @param skills Skills to cast.
|
|
319
287
|
* @returns {Macro} This object itself.
|
|
320
288
|
*/
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
value:
|
|
289
|
+
static skill(...skills) {
|
|
290
|
+
return new this().skill(...skills);
|
|
291
|
+
}
|
|
325
292
|
/**
|
|
326
293
|
* Add one or more skill cast steps to the macro, where each step checks if you have the skill first.
|
|
327
294
|
* @param skills Skills to try casting.
|
|
328
295
|
* @returns {Macro} This object itself.
|
|
329
296
|
*/
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
return this.step.apply(this, _toConsumableArray(skills.map(skill => {
|
|
336
|
-
return Macro.if_("hasskill ".concat(skillBallsMacroName(skill)), Macro.skill(skill));
|
|
337
|
-
})));
|
|
297
|
+
trySkill(...skills) {
|
|
298
|
+
return this.step(...skills.map((skill) => {
|
|
299
|
+
return Macro.if_(`hasskill ${skillBallsMacroName(skill)}`, Macro.skill(skill));
|
|
300
|
+
}));
|
|
338
301
|
}
|
|
339
302
|
/**
|
|
340
303
|
* Create a new macro with one or more skill cast steps, where each step checks if you have the skill first.
|
|
341
304
|
* @param skills Skills to try casting.
|
|
342
305
|
* @returns {Macro} This object itself.
|
|
343
306
|
*/
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
value:
|
|
307
|
+
static trySkill(...skills) {
|
|
308
|
+
return new this().trySkill(...skills);
|
|
309
|
+
}
|
|
348
310
|
/**
|
|
349
311
|
* Add one or more skill-cast-and-repeat steps to the macro, where each step checks if you have the skill first.
|
|
350
312
|
* @param skills Skills to try repeatedly casting.
|
|
351
313
|
* @returns {Macro} This object itself.
|
|
352
314
|
*/
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
return this.step.apply(this, _toConsumableArray(skills.map(skill => {
|
|
359
|
-
return Macro.if_("hasskill ".concat(skillBallsMacroName(skill)), Macro.skill(skill).repeat());
|
|
360
|
-
})));
|
|
315
|
+
trySkillRepeat(...skills) {
|
|
316
|
+
return this.step(...skills.map((skill) => {
|
|
317
|
+
return Macro.if_(`hasskill ${skillBallsMacroName(skill)}`, Macro.skill(skill).repeat());
|
|
318
|
+
}));
|
|
361
319
|
}
|
|
362
320
|
/**
|
|
363
321
|
* Create a new macro with one or more skill-cast-and-repeat steps, where each step checks if you have the skill first.
|
|
364
322
|
* @param skills Skills to try repeatedly casting.
|
|
365
323
|
* @returns {Macro} This object itself.
|
|
366
324
|
*/
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
value:
|
|
325
|
+
static trySkillRepeat(...skills) {
|
|
326
|
+
return new this().trySkillRepeat(...skills);
|
|
327
|
+
}
|
|
371
328
|
/**
|
|
372
329
|
* Add one or more item steps to the macro.
|
|
373
330
|
* @param items Items to use. Pass a tuple [item1, item2] to funksling.
|
|
374
331
|
* @returns {Macro} This object itself.
|
|
375
332
|
*/
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
return this.step.apply(this, _toConsumableArray(items.map(itemOrItems => {
|
|
382
|
-
return "use ".concat(itemOrItemsBallsMacroName(itemOrItems));
|
|
383
|
-
})));
|
|
333
|
+
item(...items) {
|
|
334
|
+
return this.step(...items.map((itemOrItems) => {
|
|
335
|
+
return `use ${itemOrItemsBallsMacroName(itemOrItems)}`;
|
|
336
|
+
}));
|
|
384
337
|
}
|
|
385
338
|
/**
|
|
386
339
|
* Create a new macro with one or more item steps.
|
|
387
340
|
* @param items Items to use. Pass a tuple [item1, item2] to funksling.
|
|
388
341
|
* @returns {Macro} This object itself.
|
|
389
342
|
*/
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
value:
|
|
343
|
+
static item(...items) {
|
|
344
|
+
return new this().item(...items);
|
|
345
|
+
}
|
|
394
346
|
/**
|
|
395
347
|
* Add one or more item steps to the macro, where each step checks to see if you have the item first.
|
|
396
348
|
* @param items Items to try using. Pass a tuple [item1, item2] to funksling.
|
|
397
349
|
* @returns {Macro} This object itself.
|
|
398
350
|
*/
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
return this.step.apply(this, _toConsumableArray(items.map(item => {
|
|
405
|
-
return Macro.if_(itemOrItemsBallsMacroPredicate(item), "use ".concat(itemOrItemsBallsMacroName(item)));
|
|
406
|
-
})));
|
|
351
|
+
tryItem(...items) {
|
|
352
|
+
return this.step(...items.map((item) => {
|
|
353
|
+
return Macro.if_(itemOrItemsBallsMacroPredicate(item), `use ${itemOrItemsBallsMacroName(item)}`);
|
|
354
|
+
}));
|
|
407
355
|
}
|
|
408
356
|
/**
|
|
409
357
|
* Create a new macro with one or more item steps, where each step checks to see if you have the item first.
|
|
410
358
|
* @param items Items to try using. Pass a tuple [item1, item2] to funksling.
|
|
411
359
|
* @returns {Macro} This object itself.
|
|
412
360
|
*/
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
value:
|
|
361
|
+
static tryItem(...items) {
|
|
362
|
+
return new this().tryItem(...items);
|
|
363
|
+
}
|
|
417
364
|
/**
|
|
418
365
|
* Add an attack step to the macro.
|
|
419
366
|
* @returns {Macro} This object itself.
|
|
420
367
|
*/
|
|
421
|
-
|
|
422
|
-
|
|
368
|
+
attack() {
|
|
369
|
+
return this.step("attack");
|
|
423
370
|
}
|
|
424
371
|
/**
|
|
425
372
|
* Create a new macro with an attack step.
|
|
426
373
|
* @returns {Macro} This object itself.
|
|
427
374
|
*/
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
key: "load",
|
|
431
|
-
value: function load() {
|
|
432
|
-
var _this;
|
|
433
|
-
|
|
434
|
-
return (_this = new this()).step.apply(_this, _toConsumableArray((0, _property.get)(Macro.SAVED_MACRO_PROPERTY).split(";")));
|
|
375
|
+
static attack() {
|
|
376
|
+
return new this().attack();
|
|
435
377
|
}
|
|
436
378
|
/**
|
|
437
|
-
*
|
|
379
|
+
* Create an if_ statement based on what holiday of loathing it currently is. On non-holidays, returns the original macro, unmutated.
|
|
380
|
+
* @param macro The macro to place in the if_ statement
|
|
381
|
+
*/
|
|
382
|
+
ifHolidayWanderer(macro) {
|
|
383
|
+
const todaysWanderers = getTodaysHolidayWanderers();
|
|
384
|
+
if (todaysWanderers.length === 0)
|
|
385
|
+
return this;
|
|
386
|
+
return this.if_(todaysWanderers.map((monster) => `monsterid ${monster.id}`).join(" || "), macro);
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Create a new macro starting with an ifHolidayWanderer step.
|
|
390
|
+
* @param macro The macro to place inside the if_ statement
|
|
438
391
|
*/
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
return new this().if_(condition, ifTrue);
|
|
461
|
-
}
|
|
462
|
-
}, {
|
|
463
|
-
key: "while_",
|
|
464
|
-
value: function while_(condition, contents) {
|
|
465
|
-
return new this().while_(condition, contents);
|
|
466
|
-
}
|
|
467
|
-
}, {
|
|
468
|
-
key: "externalIf",
|
|
469
|
-
value: function externalIf(condition, ifTrue) {
|
|
470
|
-
return new this().externalIf(condition, ifTrue);
|
|
471
|
-
}
|
|
472
|
-
}, {
|
|
473
|
-
key: "skill",
|
|
474
|
-
value: function skill() {
|
|
475
|
-
var _this3;
|
|
476
|
-
|
|
477
|
-
return (_this3 = new this()).skill.apply(_this3, arguments);
|
|
478
|
-
}
|
|
479
|
-
}, {
|
|
480
|
-
key: "trySkill",
|
|
481
|
-
value: function trySkill() {
|
|
482
|
-
var _this4;
|
|
483
|
-
|
|
484
|
-
return (_this4 = new this()).trySkill.apply(_this4, arguments);
|
|
485
|
-
}
|
|
486
|
-
}, {
|
|
487
|
-
key: "trySkillRepeat",
|
|
488
|
-
value: function trySkillRepeat() {
|
|
489
|
-
var _this5;
|
|
490
|
-
|
|
491
|
-
return (_this5 = new this()).trySkillRepeat.apply(_this5, arguments);
|
|
492
|
-
}
|
|
493
|
-
}, {
|
|
494
|
-
key: "item",
|
|
495
|
-
value: function item() {
|
|
496
|
-
var _this6;
|
|
497
|
-
|
|
498
|
-
return (_this6 = new this()).item.apply(_this6, arguments);
|
|
499
|
-
}
|
|
500
|
-
}, {
|
|
501
|
-
key: "tryItem",
|
|
502
|
-
value: function tryItem() {
|
|
503
|
-
var _this7;
|
|
504
|
-
|
|
505
|
-
return (_this7 = new this()).tryItem.apply(_this7, arguments);
|
|
506
|
-
}
|
|
507
|
-
}, {
|
|
508
|
-
key: "attack",
|
|
509
|
-
value: function attack() {
|
|
510
|
-
return new this().attack();
|
|
511
|
-
}
|
|
512
|
-
}]);
|
|
513
|
-
|
|
514
|
-
return Macro;
|
|
515
|
-
}();
|
|
392
|
+
static ifHolidayWanderer(macro) {
|
|
393
|
+
return new this().ifHolidayWanderer(macro);
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Create an if_ statement based on what holiday of loathing it currently is. On non-holidays, returns the original macro, with the input macro appended.
|
|
397
|
+
* @param macro The macro to place in the if_ statement.
|
|
398
|
+
*/
|
|
399
|
+
ifNotHolidayWanderer(macro) {
|
|
400
|
+
const todaysWanderers = getTodaysHolidayWanderers();
|
|
401
|
+
if (todaysWanderers.length === 0)
|
|
402
|
+
return this.step(macro);
|
|
403
|
+
return this.if_(todaysWanderers.map((monster) => `!monsterid ${monster.id}`).join(" && "), macro);
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Create a new macro starting with an ifNotHolidayWanderer step.
|
|
407
|
+
* @param macro The macro to place inside the if_ statement
|
|
408
|
+
*/
|
|
409
|
+
static ifNotHolidayWanderer(macro) {
|
|
410
|
+
return new this().ifNotHolidayWanderer(macro);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
516
413
|
/**
|
|
517
414
|
* Adventure in a location and handle all combats with a given macro.
|
|
518
415
|
* To use this function you will need to create a consult script that runs Macro.load().submit() and a CCS that calls that consult script.
|
|
@@ -522,31 +419,19 @@ var Macro = /*#__PURE__*/function () {
|
|
|
522
419
|
* @param loc Location to adventure in.
|
|
523
420
|
* @param macro Macro to execute.
|
|
524
421
|
*/
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
try {
|
|
540
|
-
(0, _kolmafia.adv1)(loc, 0, "");
|
|
541
|
-
|
|
542
|
-
while ((0, _kolmafia.inMultiFight)()) {
|
|
543
|
-
(0, _kolmafia.runCombat)();
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
if ((0, _kolmafia.choiceFollowsFight)()) (0, _kolmafia.visitUrl)("choice.php");
|
|
547
|
-
} finally {
|
|
548
|
-
Macro.clearSaved();
|
|
549
|
-
}
|
|
422
|
+
export function adventureMacro(loc, macro) {
|
|
423
|
+
macro.save();
|
|
424
|
+
setAutoAttack(0);
|
|
425
|
+
try {
|
|
426
|
+
adv1(loc, 0, "");
|
|
427
|
+
while (inMultiFight())
|
|
428
|
+
runCombat();
|
|
429
|
+
if (choiceFollowsFight())
|
|
430
|
+
visitUrl("choice.php");
|
|
431
|
+
}
|
|
432
|
+
finally {
|
|
433
|
+
Macro.clearSaved();
|
|
434
|
+
}
|
|
550
435
|
}
|
|
551
436
|
/**
|
|
552
437
|
* Adventure in a location and handle all combats with a given autoattack and manual macro.
|
|
@@ -558,25 +443,102 @@ function adventureMacro(loc, macro) {
|
|
|
558
443
|
* @param autoMacro Macro to execute via KoL autoattack.
|
|
559
444
|
* @param nextMacro Macro to execute manually after autoattack completes.
|
|
560
445
|
*/
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
446
|
+
export function adventureMacroAuto(loc, autoMacro, nextMacro = null) {
|
|
447
|
+
nextMacro = nextMacro ?? Macro.abort();
|
|
448
|
+
autoMacro.setAutoAttack();
|
|
449
|
+
nextMacro.save();
|
|
450
|
+
try {
|
|
451
|
+
adv1(loc, 0, "");
|
|
452
|
+
while (inMultiFight())
|
|
453
|
+
runCombat();
|
|
454
|
+
if (choiceFollowsFight())
|
|
455
|
+
visitUrl("choice.php");
|
|
456
|
+
}
|
|
457
|
+
finally {
|
|
458
|
+
Macro.clearSaved();
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
export class StrictMacro extends Macro {
|
|
462
|
+
/**
|
|
463
|
+
* Add one or more skill cast steps to the macro.
|
|
464
|
+
* @param skills Skills to cast.
|
|
465
|
+
* @returns {StrictMacro} This object itself.
|
|
466
|
+
*/
|
|
467
|
+
skill(...skills) {
|
|
468
|
+
return super.skill(...skills);
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Create a new macro with one or more skill cast steps.
|
|
472
|
+
* @param skills Skills to cast.
|
|
473
|
+
* @returns {StrictMacro} This object itself.
|
|
474
|
+
*/
|
|
475
|
+
static skill(...skills) {
|
|
476
|
+
return new this().skill(...skills);
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Add one or more item steps to the macro.
|
|
480
|
+
* @param items Items to use. Pass a tuple [item1, item2] to funksling.
|
|
481
|
+
* @returns {StrictMacro} This object itself.
|
|
482
|
+
*/
|
|
483
|
+
item(...items) {
|
|
484
|
+
return super.item(...items);
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Create a new macro with one or more item steps.
|
|
488
|
+
* @param items Items to use. Pass a tuple [item1, item2] to funksling.
|
|
489
|
+
* @returns {StrictMacro} This object itself.
|
|
490
|
+
*/
|
|
491
|
+
static item(...items) {
|
|
492
|
+
return new this().item(...items);
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Add one or more skill cast steps to the macro, where each step checks if you have the skill first.
|
|
496
|
+
* @param skills Skills to try casting.
|
|
497
|
+
* @returns {StrictMacro} This object itself.
|
|
498
|
+
*/
|
|
499
|
+
trySkill(...skills) {
|
|
500
|
+
return super.trySkill(...skills);
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Create a new macro with one or more skill cast steps, where each step checks if you have the skill first.
|
|
504
|
+
* @param skills Skills to try casting.
|
|
505
|
+
* @returns {StrictMacro} This object itself.
|
|
506
|
+
*/
|
|
507
|
+
static trySkill(...skills) {
|
|
508
|
+
return new this().trySkill(...skills);
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Add one or more item steps to the macro, where each step checks to see if you have the item first.
|
|
512
|
+
* @param items Items to try using. Pass a tuple [item1, item2] to funksling.
|
|
513
|
+
* @returns {StrictMacro} This object itself.
|
|
514
|
+
*/
|
|
515
|
+
tryItem(...items) {
|
|
516
|
+
return super.tryItem(...items);
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Create a new macro with one or more item steps, where each step checks to see if you have the item first.
|
|
520
|
+
* @param items Items to try using. Pass a tuple [item1, item2] to funksling.
|
|
521
|
+
* @returns {StrictMacro} This object itself.
|
|
522
|
+
*/
|
|
523
|
+
static tryItem(...items) {
|
|
524
|
+
return new this().tryItem(...items);
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Add one or more skill-cast-and-repeat steps to the macro, where each step checks if you have the skill first.
|
|
528
|
+
* @param skills Skills to try repeatedly casting.
|
|
529
|
+
* @returns {StrictMacro} This object itself.
|
|
530
|
+
*/
|
|
531
|
+
trySkillRepeat(...skills) {
|
|
532
|
+
return this.step(...skills.map((skill) => {
|
|
533
|
+
return StrictMacro.if_(`hasskill ${skillBallsMacroName(skill)}`, StrictMacro.skill(skill).repeat());
|
|
534
|
+
}));
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Create a new macro with one or more skill-cast-and-repeat steps, where each step checks if you have the skill first.
|
|
538
|
+
* @param skills Skills to try repeatedly casting.
|
|
539
|
+
* @returns {StrictMacro} This object itself.
|
|
540
|
+
*/
|
|
541
|
+
static trySkillRepeat(...skills) {
|
|
542
|
+
return new this().trySkillRepeat(...skills);
|
|
543
|
+
}
|
|
544
|
+
}
|