Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Heath123 committed Nov 28, 2020
1 parent 183a881 commit 2b0ad99
Show file tree
Hide file tree
Showing 5 changed files with 451 additions and 420 deletions.
4 changes: 2 additions & 2 deletions html/mainPage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ <h3>Filtering</h3>
<h3>Scripting (beta)</h3>
Scripting allows you to modify and inject packets on-the-fly
<br><br>
<input type="checkbox" id="enableScripting" name="enableScripting" onchange="updateScript(true)">
<input type="checkbox" id="enableScripting" name="enableScripting" onchange="scripting.updateScript(true)">
<label for="enableScripting">Enable scripting</label>
<br><br>
<textarea id="scriptEditor">
Expand Down Expand Up @@ -112,6 +112,6 @@ <h3>Scripting (beta)</h3>
</div>
</div>
<script src="../js/jsonTree.js"></script>
<script src="script.js"></script>
<script src="js/main.js"></script>
</body>
</html>
30 changes: 30 additions & 0 deletions html/mainPage/js/ipcHandler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
exports.setup = function (ipcRenderer, allPackets, proxyCapabilities) {
ipcRenderer.on('copyPacketData', (event, arg) => {
console.log(allPackets)
const ipcMessage = JSON.parse(arg)
let data = allPackets[ipcMessage.id].data
data = proxyCapabilities.jsonData ? JSON.stringify(data, null, 2) : data.data
ipcRenderer.send('copyToClipboard', data)
})

ipcRenderer.on('copyTeleportCommand', (event, arg) => {
console.log(allPackets)
const ipcMessage = JSON.parse(arg)
let data = allPackets[ipcMessage.id].data

let clipData = 'test'
debugger
clipData = '/tp @p ' + ((data.flags & 0x01) ? '~' : '') + ((data.x === 0 && (data.flags & 0x01)) ? '' : data.x)
+ ((data.flags & 0x02) ? ' ~' : ' ') + ((data.y === 0 && (data.flags & 0x03)) ? '' : data.y)
+ ((data.flags & 0x04) ? ' ~' : ' ') + ((data.z === 0 && (data.flags & 0x04)) ? '' : data.z)
debugger

if (!(data.flags & 0x10) || !(data.flags & 0x08) || data.pitch != 0 || data.yaw !== 0) {
clipData += ((data.flags & 0x10) ? ' ~' : ' ') + data.pitch
+ ((data.flags & 0x08) ? ' ~' : ' ') + data.yaw
}
debugger
console.log('Sending', clipData)
ipcRenderer.send('copyToClipboard', clipData)
})
}
Loading

0 comments on commit 2b0ad99

Please sign in to comment.