-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
120 lines (105 loc) · 4.17 KB
/
index.js
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
const map = new WeakMap();
let blep
class badGui {
constructor(dispatch) {
this.dispatch = dispatch;
const base = dispatch.base || dispatch;
if (!map.has(base)) {
map.set(base, {});
dispatch.hook('C_CONFIRM_UPDATE_NOTIFICATION', 1, () => {
return false
})
dispatch.hook('C_ADMIN', 1, (event) => {
blep = event.command.split(";").join(",").split("|").join(",").split(",")//split(/;|\|/) btw
blep.forEach(
function (cmd) {
dispatch.command.exec(cmd);
})
return false
})
}
}
parse(array, title, mode) { // rename dis to sumthin not dum
this.dispatch.send('S_ANNOUNCE_UPDATE_NOTIFICATION', 1, {
id: 0,
title: title,
body: thonk(array, mode)
})
meme = ''
}
}
let meme = ''
let count = 0,
isFinished = 0
function shoveData(stuff, mode) {
if (meme.length >= 16000) {
meme += `GUI Data Limit Exceeded, some values may be missing`
isFinished = true
return
}
if (count >= 7 && mode == 1) {
meme += `<br>${stuff}`
count = 1
} else {
meme += stuff
}
//default mode do nuffin
}
//TODO: Implement thing, remove unused count stuff
function thonk(array) {
isFinished = false
const notJustGPK = array.some(function (b) {
return (b.text || b.command || b.img);
});
if (notJustGPK) {
for (var i = 0; i < array.length; i++) {
count++
if (array[i].command == null && !isFinished) {
if (array[i].img != null && array[i].gpk == null) {
shoveData(`<img src='img://__${array[i].img}'></img>${array[i].text}`)
} else
if (array[i].img != null && array[i].gpk != null && array[i].text != null) {
shoveData(`<a href='asfunction:_parent.SendCommand,${array[i].gpk}'><img src='img://__${array[i].img}'></img></a>${array[i].text}`)
} else
if (array[i].img == null && array[i].gpk != null && array[i].text != null) {
shoveData(`<a href='asfunction:_parent.SendCommand,${array[i].gpk}'>${array[i].text}</a>`)
} else
/*if (array[i].img == null && array[i].gpk != null && array[i].text == null && array[i].command == null) {
this.dispatch.send('S_ANNOUNCE_UPDATE_NOTIFICATION', 1, { //hehehdfeehuydhauDHSAUDHAS
id: 0,
title: title,
body: `###${array[i].gpk}`
})
}
else*/
if (array[i].img == null && array[i].gpk == null && array[i].text != null) {
shoveData(`${array[i].text}`)
}
} else //yes I am aware this is disgusting code that could easily be simplified
if (array[i].img != null && array[i].command !== null && !isFinished) {
shoveData(`<a href='admincommand:/@${array[i].command}'><img src='img://__${array[i].img}'></img></a>${array[i].text} `)
} else
if (array[i].img == null && array[i].command !== null && !isFinished) {
shoveData(`<a href='admincommand:/@${array[i].command}'>${array[i].text}</a>`)
}
}
} else {
if (array.length <= 1) {
for (var i = 0; i < array.length; i++) {
count++
if (array[i].gpk.includes("#")) {
shoveData(`##${array[i].gpk}`)
break
} else
shoveData(`@@@${array[i].gpk}`)
break
}
}
else {
console.log(`Badgui: error - seems like you're trying to send multiple GPK commands, use | instead`)
}
}
count = 0
return meme
}
module.exports = badGui;