-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqr_inverter.js
More file actions
86 lines (74 loc) · 3.02 KB
/
Copy pathqr_inverter.js
File metadata and controls
86 lines (74 loc) · 3.02 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// ________ _________
// \________\--------___ ___ ____----------/_________/
// \_______\----\\\\\\ //_ _ \\ //////-------/________/
// \______\----\\|| (( ~|~ ))) ||//------/________/
// \_____\---\\ ((\ = / ))) //----/_____/
// \____\--\_))) \ _)))---/____/
// \__/ ((( (((_/
// ヾღ彡 | -))) - ))
// =================================================================
// qr_inverter.js
// -----------------------------------------------------------------
// author: @archangel
// SEC LVL: 4
// Chars: 834
// Descr: Inverts the order QR codes of T2 NPCs.
// Syntax: qr_inverter{t:#s.NPC.loc, u:"username", c:"command"}
// Syntax: qr_inverter{qr:"QR_code_as_String"}
// =================================================================
function (context, args)
{
// t:#s.NPC.loc, u:"username", c:"command"
// we'll wrap the analytics in a try-catch, so that a failure during recording doesn't break the rest of the script
try
{
if (#s.scripts.get_level({name:"soron.arch_data"}) == 4 && #s.scripts.get_level({name:"ada.haxfax"}) == 4) //check SEC LVL
{
// Those calls are for logging purposes. Check dtr.man{page:"soron.arch_data"} and dtr.man{page:"ada.haxfax"} in-game for more info.
#s.soron.arch_data({log:{c:context}});
#s.ada.haxfax({log:{c:context}});
}
}
catch (e)
{
// oh well, we can live with this. Congrats, user-who-is-not-tracked!
}
if((!args.t || !args.u || !args.c) && !args.qr && #s.scripts.get_level({name:"dtr.man"}) == 4)
return #s.dtr.man({page:"lib.qr_inverter"});
var qrs = (args.qr) ? args.qr : args.t.call({username:args.u, [args.c]:"order_qrs"});
var inv = "";
for (var i=0; i<qrs.length; i++)
{
if(qrs[i][0] != '█' && qrs[i][0] != '▄' && qrs[i][0] != '▀' && qrs[i][0] != ' ')
continue;
var s = qrs[i].split("\n");
for (var y=0; y<s[0].length+1; y++)
inv += "█";
inv += "█\n█";
for (var j=0; j<qrs[i].length; j++)
{
switch(qrs[i][j])
{
case '█': //fullblock -> "█"
inv += " ";
break;
case ' ': //white space -> " "
inv += "█";
break;
case '▄': //lower half -> "▄"
inv += "▀";
break;
case '▀': //upper half -> "▀"
inv += "▄";
break;
case '\n': //new line -> "\n"
inv += "█\n█";
break;
default:
inv += qrs[i][j];
}
}
inv = inv.slice(0, -1) +"\n\n";
}
return inv;
}