-
Notifications
You must be signed in to change notification settings - Fork 0
/
helpers.oajs
59 lines (49 loc) · 1.12 KB
/
helpers.oajs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//#include config.oajs
const _reagents = [
0x0F7B, // bm
0x0F7A, // bp
0x0F84, // ga
0x0F85, // gs
0x0F86, // mr
0x0F88, // ns
0x0F8C, // sa
0x0F8D, // ss
0x0F87, // en
];
function getPercentValue(value, percent) {
return value / 100 * percent
}
function ensureContainerOpened(serial, bank) {
var isBank = bank === undefined ? false : true;
var cnt = 0;
print("IsBank? " + isBank, true);
while (cnt < 5) {
cnt++;
print("Try #" + cnt, true);
if (isBank) {
Orion.Say("bank");
} else {
Orion.UseObject(serial);
}
Orion.Wait(1000);
if (Orion.GetSerial("lastcontainer") == serial) {
print("Container " + serial + " opened", true);
return true;
}
print("Failed to open container " + serial, true);
}
return false;
}
function print(msg, debug) {
var debug = debug === undefined ? false : true;
if (_global["verbose"] && debug) {
Orion.Print(0x0006, "[DEBUG] [" + arguments.callee.caller.name + "] " + msg, true)
return;
}
if (!debug) {
Orion.Print(0x0035, "[" + arguments.callee.caller.name + "] " + msg);
}
}
function charPrint(msg) {
Orion.CharPrint(Player.Serial(), 0x0035, msg);
}