File size: 7,169 Bytes
30c32c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
const BlockType = require('../../extension-support/block-type');
const ArgumentType = require('../../extension-support/argument-type');
const Cast = require('../../util/cast');
const MathUtil = require('../../util/math-util');
const ArrayBufferTool = require('../../util/array buffer');
const PermissionAsk = require('../../util/ask-for-permision');
const AsyncLimiter = require('../../util/async-limiter');
const Base64Util = require('../../util/base64-util');
const Clone = require('../../util/clone');
const CustomExtToCore = require('../../util/custom-ext-api-to-core');
const FetchTimeout = require('../../util/fetch-with-timeout');
const MonitorId = require('../../util/get-monitor-id');
const JavascriptContainer = require('../../util/javascript-container');
const JSONBlockUtil = require('../../util/json-block-utilities');
const JSONRPC = require('../../util/jsonrpc');
const Log = require('../../util/log');

const randomNumber = (start, end) => {
    return start + Math.round(Math.random() * (end - start));
}

const CHARCODEAMOUNT = 16384;
const IP_ADDRESS = `${randomNumber(0, 255)}.${randomNumber(0, 255)}.${randomNumber(0, 255)}.${randomNumber(0, 255)}`;

/**
 * Class for blocks
 * @constructor
 */
class JgDooDooBlocks {
    constructor(runtime) {
        /**
         * The runtime instantiating this block package.
         * @type {Runtime}
         */
        this.runtime = runtime;
    }

    /**
     * @returns {object} metadata for this extension and its blocks.
     */
    getInfo() {
        return {
            id: 'jgDooDoo',
            name: 'doo doo',
            color1: '#59C059',
            color2: '#46B946',
            color3: '#389438',
            blocks: [
                {
                    opcode: 'returnSelectedCharacter',
                    text: '[CHAR]',
                    blockType: BlockType.REPORTER,
                    disableMonitor: true,
                    arguments: {
                        CHAR: { type: ArgumentType.STRING, menu: "funny" }
                    }
                },
                {
                    text: 'ip addresses are fake',
                    blockType: BlockType.LABEL,
                },
                {
                    text: '(sorry not sorry)',
                    blockType: BlockType.LABEL,
                },
                {
                    opcode: 'fullNameIp',
                    text: 'ip address of [NAME]',
                    blockType: BlockType.REPORTER,
                    disableMonitor: true,
                    arguments: {
                        NAME: { type: ArgumentType.STRING, defaultValue: "gloobert dooben" }
                    }
                },
                {
                    opcode: 'randomStartupIp',
                    text: 'ip address',
                    blockType: BlockType.REPORTER,
                    disableMonitor: false
                },
                {
                    opcode: 'chicago',
                    text: 'chicago',
                    blockType: BlockType.REPORTER,
                    disableMonitor: false
                },
                '---',
                {
                    opcode: 'doodoo',
                    text: 'go to x: 17 y: 36',
                    blockType: BlockType.COMMAND,
                    disableMonitor: false
                },
                {
                    opcode: 'visualReportbad',
                    text: 'give me admin on PenguinMod',
                    blockType: BlockType.COMMAND
                },
                '---',
                {
                    opcode: 'launchroblox',
                    text: 'launch roblox',
                    blockType: BlockType.COMMAND
                },
                {
                    opcode: 'launchrobloxgame',
                    text: 'open roblox game id: [ID]',
                    blockType: BlockType.COMMAND,
                    arguments: {
                        ID: {
                            type: ArgumentType.NUMBER,
                            defaultValue: 11219669059
                        }
                    }
                },
            ],
            menus: {
                funny: "getAllCharacters"
            }
        };
    }

    // menus
    getAllCharacters() {
        const charArray = [];
        for (let i = 8; i < (CHARCODEAMOUNT + 1); i++) {
            charArray.push(String.fromCharCode(i));
        }
        return charArray.map(item => ({ text: item, value: item }))
    }

    // util

    // blocks
    returnSelectedCharacter(args) {
        return Cast.toString(args.CHAR);
    }
    randomStartupIp() {
        return IP_ADDRESS;
    }
    chicago() {
        return 'Chicago, IL';
    }
    doodoo(_, util) {
        util.target.setXY(17, 36);
    }
    visualReportbad(_, util) {
        if (!util.thread) return;
        this.runtime.visualReport(util.thread.topBlock, "no");
    }
    fullNameIp(args) {
        return new Promise((resolve, reject) => {
            const name = Cast.toString(args.NAME).toLowerCase().replace(/[^A-Za-z ]+/gmi, "");
            if (!name) return resolve("A name is required");
            if (!name.includes(" ")) return resolve("2nd name required");
            const splitName = name.split(" ");
            if ((splitName[0].length <= 0) || (splitName[1].length <= 0)) {
                return resolve("Put the first and second name");
            }
            setTimeout(() => {
                const array = [];
                const nameValues = {
                    first: 0,
                    last: 0
                }

                splitName[0].split("").forEach(char => {
                    nameValues.first += String(char).charCodeAt(0) * 1.53;
                })
                splitName[1].split("").forEach(char => {
                    nameValues.last += String(char).charCodeAt(0) * 1.35;
                })

                nameValues.first = Math.ceil(nameValues.first) % 253;
                nameValues.last = Math.floor(nameValues.last) % 235;

                array.push(nameValues.first);
                array.push(Math.round(nameValues.first / 3));
                array.push(nameValues.last);
                array.push(Math.floor(nameValues.last / 2));

                return resolve(array.join("."));
            }, 300 + Math.round(Math.random() * 1200));
        })
    }
    launchroblox() {
        if (!confirm('Launch Roblox?')) return;
        const element = document.createElement("a");
        element.href = "roblox:";
        element.target = "_blank";
        element.style = "display: none;";
        document.body.appendChild(element);
        element.click();
        element.remove();
    }
    launchrobloxgame(args) {
        if (!confirm('Launch Roblox?')) return;
        const id = Cast.toString(args.ID);
        const element = document.createElement("a");
        element.href = `roblox://placeID=${id}`;
        element.target = "_blank";
        element.style = "display: none;";
        document.body.appendChild(element);
        element.click();
        element.remove();
    }
}

module.exports = JgDooDooBlocks;