const map = new WeakMap();
let blep;
class Gui {
constructor(mod) {
this.mod = mod;
const base = mod.base || mod;
if (!map.has(base)) {
map.set(base, {});
mod.hook('C_CONFIRM_UPDATE_NOTIFICATION', 1, () => false)
mod.hook('C_ADMIN', 1, (event) => {
blep = event.command.split(";")
blep.forEach(
function (cmd) {
mod.command.exec(cmd);
})
return false
})
}
}
parse(array, title, mode) {
if (mode == 2) {
this.mod.send('S_ANNOUNCE_UPDATE_NOTIFICATION', 1, {
id: 0,
title: title, //
`
`
`
` USE THIS
body: squonk(array, mode)
})
Data = ''
ArrayTXT = ['cools']
} else
this.mod.send('S_ANNOUNCE_UPDATE_NOTIFICATION', 1, {
id: 0,
title: title, //
`
`
`
` USE THIS
body: thonk(array, mode)
})
Data = ''
}
}
let Data = '',
Count = 0,
IMGCount = 1,
TXTCount = 0,
FirstTXT = true,
ArrayTXT = [],
isFinished = 0
function ShoveData(stuff, mode) {
if (Data.length >= 16000) {
Data += `GUI Data Limit Exceeded, some values may be missing.`
isFinished = true
return
}
if (Count >= 7 && mode == 1) {
Data += `
${stuff}`
Count = 1
} else {
Data += stuff
}
}
function thonk(array) {
isFinished = false
for (var i = 0; i < array.length; i++) {
Count++
if (array[i].command == null && !isFinished) {
if (array[i].img != null) {
ShoveData(`
${array[i].text}`)
}
ShoveData(`${array[i].text}`)
} else
if (array[i].img != null && array[i].command !== null && !isFinished) {
ShoveData(`
${array[i].text} `)
} else
if (array[i].img == null && array[i].command !== null && !isFinished) {
ShoveData(`${array[i].text}`)
}
}
//console.log(`Finished stuff ${Data}`) //mod here
Count = 0
return Data
}
function squonk(array) {
for (var i = 0; i < array.length; i++) {
if (IMGCount <= 5) {
IMGCount++
ArrayTXT.push(array[i].text)
Data += `
`
//console.log(IMGCount)
} if (ArrayTXT.length == 5) {
console.log('else')
FirstTXT = true
for (var j = 0; j < ArrayTXT.length; j++) {
console.log(ArrayTXT[j])
// console.log(ArrayTXT)
if (j == 4) {
// console.log('BEEEEEEEEEEEEEEP')
Data += `${ArrayTXT[j]}
`
IMGCount = 0
ArrayTXT = []
FirstTXT = true
}
if (FirstTXT == true && j != 4) {
Data += `
${ArrayTXT[j]} `
FirstTXT = false
} else if (j != 4) {
Data += `${ArrayTXT[j]} `
}
}
IMGCount = 0
ArrayTXT = []
//console.log(ArrayTXT.length)
FirstTXT = true
}
}
console.log(Data)
return Data
}
module.exports = Gui;