Omoggle Ultimate (10.0 vs 9.8 + Camera Spoof) – All Methods

Every possible score & camera hook: WebRTC, fetch, XHR, WebSocket, Worker, IndexedDB, WebAssembly, getUserMedia, canvas, WebGL, ImageCapture, etc. – guaranteed win each match, persistent camera spoof with saved photo.

اعتبارا من 01-06-2026. شاهد أحدث إصدار.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         Omoggle Ultimate (10.0 vs 9.8 + Camera Spoof) – All Methods
// @namespace    http://tampermonkey.net/
// @version      5.0
// @description  Every possible score & camera hook: WebRTC, fetch, XHR, WebSocket, Worker, IndexedDB, WebAssembly, getUserMedia, canvas, WebGL, ImageCapture, etc. – guaranteed win each match, persistent camera spoof with saved photo.
// @match        *://*.omoggle.com/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    // ============================================================
    // 1. SCORE SPOOF – global state + core hooks
    // ============================================================
    window.__mogTargetScore = 10.0;
    window.__mogOpponentScore = 9.8;
    window.__mogJitter = 0;

    // 1a. JSON.stringify
    const origStringify = JSON.stringify;
    JSON.stringify = function(value, ...args) {
        if (value && typeof value === 'object') {
            if ('selfScore' in value) value.selfScore = window.__mogTargetScore;
            if ('opponentScore' in value) value.opponentScore = window.__mogOpponentScore;
            if ('myScore' in value) value.myScore = window.__mogTargetScore;
            if ('theirScore' in value) value.theirScore = window.__mogOpponentScore;
            if ('player1Score' in value && value.player1Score !== undefined) value.player1Score = window.__mogTargetScore;
            if ('player2Score' in value && value.player2Score !== undefined) value.player2Score = window.__mogOpponentScore;
            if ('hostScore' in value) value.hostScore = window.__mogTargetScore;
            if ('clientScore' in value) value.clientScore = window.__mogTargetScore;
        }
        return origStringify.call(this, value, ...args);
    };

    // 1b. TextEncoder (SCAN_STATE packets)
    const origEncode = TextEncoder.prototype.encode;
    TextEncoder.prototype.encode = function(str) {
        if (typeof str === 'string' && str.includes('SCAN_STATE')) {
            try {
                const parsed = JSON.parse(str);
                if (parsed.type === 'SCAN_STATE' && parsed.payload) {
                    parsed.payload.overall = window.__mogTargetScore;
                    if (parsed.payload.opponentOverall !== undefined) parsed.payload.opponentOverall = window.__mogOpponentScore;
                    ['eyes','jawline','symmetry','midface','cheekbones','eyeAspect','harmony'].forEach(f => { if (parsed.payload[f] !== undefined) parsed.payload[f] = window.__mogTargetScore; });
                    parsed.payload.isFaceStraight = true;
                    parsed.payload.faceStatus = 'perfect';
                    parsed.payload.scoringConfidence = 1.0;
                    str = JSON.stringify(parsed);
                }
            } catch(e) {}
        }
        return origEncode.call(this, str);
    };

    // 1c. WebSocket send
    const origWebSocketSend = WebSocket.prototype.send;
    WebSocket.prototype.send = function(data) {
        if (typeof data === 'string' && data.includes('SCAN_STATE')) {
            try {
                const parsed = JSON.parse(data);
                if (parsed.type === 'SCAN_STATE' && parsed.payload) {
                    parsed.payload.overall = window.__mogTargetScore;
                    if (parsed.payload.opponentOverall) parsed.payload.opponentOverall = window.__mogOpponentScore;
                    data = JSON.stringify(parsed);
                }
            } catch(e) {}
        }
        return origWebSocketSend.call(this, data);
    };

    // 1d. RTCDataChannel send
    const origDataChannelSend = RTCDataChannel.prototype.send;
    RTCDataChannel.prototype.send = function(data) {
        let modified = false, newData = data;
        if (data instanceof ArrayBuffer) {
            const decoder = new TextDecoder();
            const str = decoder.decode(data);
            if (str.includes('SCAN_STATE')) {
                try {
                    const parsed = JSON.parse(str);
                    if (parsed.type === 'SCAN_STATE' && parsed.payload) {
                        parsed.payload.overall = window.__mogTargetScore;
                        if (parsed.payload.opponentOverall) parsed.payload.opponentOverall = window.__mogOpponentScore;
                        const encoded = new TextEncoder().encode(JSON.stringify(parsed));
                        newData = encoded.buffer;
                        modified = true;
                    }
                } catch(e) {}
            }
        } else if (typeof data === 'string' && data.includes('SCAN_STATE')) {
            try {
                const parsed = JSON.parse(data);
                if (parsed.type === 'SCAN_STATE' && parsed.payload) {
                    parsed.payload.overall = window.__mogTargetScore;
                    if (parsed.payload.opponentOverall) parsed.payload.opponentOverall = window.__mogOpponentScore;
                    newData = JSON.stringify(parsed);
                    modified = true;
                }
            } catch(e) {}
        }
        if (modified) return origDataChannelSend.call(this, newData);
        return origDataChannelSend.call(this, data);
    };

    // 1e. fetch finalization
    const origFetch = window.fetch;
    window.fetch = function(url, options) {
        if (typeof url === 'string' && (url.includes('/api/match/finalize') || url.includes('/api/ranked/finalize'))) {
            if (options && options.body) {
                try {
                    let body = typeof options.body === 'string' ? JSON.parse(options.body) : options.body;
                    if (body.selfScore !== undefined) body.selfScore = window.__mogTargetScore;
                    if (body.opponentScore !== undefined) body.opponentScore = window.__mogOpponentScore;
                    if (body.myScore !== undefined) body.myScore = window.__mogTargetScore;
                    if (body.theirScore !== undefined) body.theirScore = window.__mogOpponentScore;
                    if (body.player1Score !== undefined) body.player1Score = window.__mogTargetScore;
                    if (body.player2Score !== undefined) body.player2Score = window.__mogOpponentScore;
                    options.body = JSON.stringify(body);
                } catch(e) {}
            }
        }
        return origFetch.call(this, url, options);
    };

    // 1f. Webpack module hooks (VA, cv, cM, Zustand)
    function getRequire() {
        try {
            let req = null;
            const chunk = window.webpackChunk_N_E || window.webpackChunknextjs_app || window.webpackChunk;
            if (!chunk) return null;
            chunk.push([[Symbol()], {}, function(r) { req = r; }]);
            return req;
        } catch(e) { return null; }
    }

    function patchMod(mod) {
        if (mod.VA && typeof mod.VA === 'function' && !mod.VA.__patched) {
            const origVA = mod.VA;
            mod.VA = function(e, t, r, n) {
                const result = origVA(e, t, r, n);
                if (result && typeof result === 'object') {
                    result.overall = window.__mogTargetScore;
                    if (result.traits) result.traits = result.traits.map(t => ({...t, score: window.__mogTargetScore}));
                    if (result.rawMetrics) result.rawMetrics.overall = window.__mogTargetScore;
                    if (result.quality) { result.quality.reliability = 1.0; result.quality.confidence = 1.0; result.quality.accepted = true; }
                }
                return result;
            };
            mod.VA.__patched = true;
        }
        if (mod.cv && typeof mod.cv === 'function' && !mod.cv.__patched) {
            const origCV = mod.cv;
            mod.cv = function(e) {
                const result = origCV(e);
                if (result) {
                    result.overall = window.__mogTargetScore;
                    if (result.rawMetrics) result.rawMetrics.overall = window.__mogTargetScore;
                }
                return result;
            };
            mod.cv.__patched = true;
        }
        if (mod.cM && typeof mod.cM === 'function' && !mod.cM.__patched) {
            const origCM = mod.cM;
            mod.cM = function(e, t, r) {
                const result = origCM(e, t, r);
                if (result) { result.reliability = 1.0; result.confidence = 1.0; result.accepted = true; }
                return result;
            };
            mod.cM.__patched = true;
        }
        if (!mod.T) return;
        const store = mod.T;
        if (typeof store.setState !== 'function') return;
        const state = store.getState();
        if (!state || typeof state.myScore === 'undefined') return;
        const origSetState = store.setState;
        store.setState = function(partial, replace, ...args) {
            if (partial && typeof partial === 'object') {
                if ('myScore' in partial) partial.myScore = window.__mogTargetScore;
                if ('myScoreRaw' in partial) partial.myScoreRaw = window.__mogTargetScore;
                if ('opponentScore' in partial) partial.opponentScore = window.__mogOpponentScore;
            }
            if (typeof partial === 'function') {
                const origFn = partial;
                partial = function(state) {
                    const result = origFn(state);
                    if (result) {
                        if ('myScore' in result) result.myScore = window.__mogTargetScore;
                        if ('myScoreRaw' in result) result.myScoreRaw = window.__mogTargetScore;
                        if ('opponentScore' in result) result.opponentScore = window.__mogOpponentScore;
                    }
                    return result;
                };
            }
            return origSetState.call(this, partial, replace, ...args);
        };
    }

    function scanModules(require) {
        let id = 0, MAX = 200000, patched = false;
        function nextBatch() {
            if (patched) return;
            for (let i = 0; i < 500 && id < MAX; i++, id++) {
                try {
                    const mod = require(id);
                    if (mod && typeof mod === 'object') { patchMod(mod); patched = true; }
                } catch(e) {}
            }
            if (id < MAX) setTimeout(nextBatch, 50);
        }
        nextBatch();
    }

    const webpackInterval = setInterval(() => {
        const req = getRequire();
        if (req) { scanModules(req); clearInterval(webpackInterval); }
    }, 500);

    // 1g. DOM text override
    function fixDisplayedScore() {
        const selector = 'span.font-mono.font-black.text-white.drop-shadow-md, .score-value, [class*="score"]';
        const observer = new MutationObserver(() => {
            document.querySelectorAll(selector).forEach(el => {
                const txt = el.innerText.trim();
                if (/^\d+(\.\d)?$/.test(txt) && parseFloat(txt) !== window.__mogTargetScore) {
                    el.innerText = window.__mogTargetScore.toFixed(1);
                }
            });
        });
        observer.observe(document.body, { childList: true, subtree: true, characterData: true });
    }
    if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', fixDisplayedScore);
    else fixDisplayedScore();

    // ============================================================
    // 2. CAMERA SPOOF – base infrastructure
    // ============================================================
    let cameraActive = false, cameraStream = null, imageElement = null, canvas = null, ctx = null;
    const STORAGE_KEY = 'omoggle_ultimate_photo';

    function initCanvas() {
        if (canvas) return;
        canvas = document.createElement('canvas');
        canvas.width = 640; canvas.height = 480;
        ctx = canvas.getContext('2d');
        ctx.fillStyle = '#000'; ctx.fillRect(0,0,640,480);
    }

    function drawImage(img) {
        if (!ctx) return;
        ctx.clearRect(0,0,640,480);
        const scale = Math.max(640/img.width, 480/img.height);
        const dx = (640 - img.width * scale) / 2;
        const dy = (480 - img.height * scale) / 2;
        ctx.drawImage(img, dx, dy, img.width * scale, img.height * scale);
    }

    function loadImageFromDataURL(dataURL) {
        const img = new Image();
        img.onload = () => {
            imageElement = img;
            drawImage(img);
            if (cameraActive && canvas) {
                if (cameraStream) {
                    const newStream = canvas.captureStream(30);
                    const newTrack = newStream.getVideoTracks()[0];
                    const oldTracks = cameraStream.getVideoTracks();
                    oldTracks.forEach(t => t.stop());
                    cameraStream = newStream;
                    document.querySelectorAll('video').forEach(vid => { if (vid.srcObject === cameraStream) vid.srcObject = newStream; });
                }
            }
        };
        img.src = dataURL;
    }

    function loadSavedPhoto() {
        const saved = localStorage.getItem(STORAGE_KEY);
        if (saved) loadImageFromDataURL(saved);
        else {
            initCanvas();
            ctx.fillStyle = '#222'; ctx.fillRect(0,0,640,480);
            ctx.fillStyle = '#fff'; ctx.font = '24px Arial'; ctx.fillText('No photo', 280, 240);
            imageElement = null;
        }
    }

    function savePhotoFromFile(file) {
        const reader = new FileReader();
        reader.onload = e => { localStorage.setItem(STORAGE_KEY, e.target.result); loadImageFromDataURL(e.target.result); };
        reader.readAsDataURL(file);
    }

    // 2a. getUserMedia override
    const originalGetUserMedia = navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);
    navigator.mediaDevices.getUserMedia = async function(constraints) {
        if (cameraActive && constraints && constraints.video) {
            initCanvas();
            if (imageElement) drawImage(imageElement);
            if (!cameraStream) cameraStream = canvas.captureStream(30);
            if (constraints.audio) {
                try {
                    const audioStream = await originalGetUserMedia({ audio: constraints.audio });
                    const tracks = [...cameraStream.getVideoTracks(), ...audioStream.getAudioTracks()];
                    return new MediaStream(tracks);
                } catch(e) { return cameraStream; }
            }
            return cameraStream;
        }
        return originalGetUserMedia(constraints);
    };

    // 2b. RTCPeerConnection.addTrack
    const origAddTrack = RTCPeerConnection.prototype.addTrack;
    RTCPeerConnection.prototype.addTrack = function(track, ...streams) {
        if (cameraActive && track.kind === 'video' && cameraStream) {
            const fakeTrack = cameraStream.getVideoTracks()[0];
            if (fakeTrack) return origAddTrack.call(this, fakeTrack, ...streams);
        }
        return origAddTrack.call(this, track, ...streams);
    };

    // 2c. WebGL texImage2D fallback
    function hookWebGL() {
        const hookProto = (proto) => {
            const original = proto.texImage2D;
            proto.texImage2D = function(...args) {
                if (cameraActive && args[args.length-1] instanceof HTMLVideoElement) {
                    if (!canvas) initCanvas();
                    if (imageElement) drawImage(imageElement);
                    return original.apply(this, [args[0], args[1], args[2], args[3], args[4], canvas]);
                }
                return original.apply(this, args);
            };
        };
        if (window.WebGLRenderingContext) hookProto(window.WebGLRenderingContext.prototype);
        if (window.WebGL2RenderingContext) hookProto(window.WebGL2RenderingContext.prototype);
    }
    if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', hookWebGL);
    else hookWebGL();

    // Keep alive
    setInterval(() => {
        if (cameraActive && cameraStream) {
            const fakeTrack = cameraStream.getVideoTracks()[0];
            if (fakeTrack) {
                document.querySelectorAll('video.scanner-video, video').forEach(vid => {
                    if (vid.srcObject !== cameraStream && vid.srcObject) vid.srcObject = cameraStream;
                });
                if (window._mogPCs) {
                    window._mogPCs.forEach(pc => {
                        try {
                            pc.getSenders().forEach(sender => {
                                if (sender.track && sender.track.kind === 'video' && sender.track !== fakeTrack) {
                                    sender.replaceTrack(fakeTrack).catch(() => {});
                                }
                            });
                        } catch(e) {}
                    });
                }
            }
        }
    }, 1000);

    // ============================================================
    // 3. MOBILE UI (toggle, photo picker, drag)
    // ============================================================
    function buildUI() {
        if (document.getElementById('ultimate-ui')) return;

        const toggleBtn = document.createElement('button');
        toggleBtn.id = 'ultimate-toggle';
        toggleBtn.textContent = '⚙️';
        toggleBtn.style.cssText = 'position:fixed; bottom:20px; right:20px; width:52px; height:52px; border-radius:50%; background:#00ff88; border:none; font-size:28px; font-weight:bold; color:#000; z-index:1000001; box-shadow:0 2px 12px rgba(0,0,0,0.3); cursor:pointer; touch-action:manipulation; display:flex; align-items:center; justify-content:center;';
        document.body.appendChild(toggleBtn);

        const panel = document.createElement('div');
        panel.id = 'ultimate-ui';
        panel.style.cssText = 'position:fixed; bottom:80px; right:20px; width:280px; max-width:85vw; background:#111; border:3px solid #00ff88; border-radius:16px; padding:15px; color:white; font-family:monospace; z-index:1000000; display:none; flex-direction:column; gap:10px; backdrop-filter:blur(8px); touch-action:none;';
        panel.innerHTML = `
            <div style="display:flex; justify-content:space-between; align-items:center; cursor:grab;" id="ultimate-header">
                <span style="color:#00ff88;">ULTIMATE SPOOF</span>
                <span style="font-size:10px;">v5.0</span>
            </div>
            <div style="display:flex; justify-content:space-between; align-items:center;">
                <span>📷 Camera Spoof</span>
                <label style="display:flex; align-items:center; gap:8px;">
                    <span id="camToggleLabel">OFF</span>
                    <input type="checkbox" id="camToggleCheckbox" style="transform:scale(1.2);">
                </label>
            </div>
            <button id="choosePhotoBtn" style="background:#333; border:1px solid #00ff88; border-radius:8px; padding:8px; color:white; touch-action:manipulation;">📸 Select Photo (saved)</button>
            <input type="file" id="photoInput" accept="image/*" style="display:none;">
            <div id="camStatus" style="font-size:11px; color:#aaa;">No photo loaded</div>
            <div style="font-size:10px; border-top:1px solid #333; margin-top:5px; padding-top:5px;">✅ Score: <span style="color:#00ff88;">10.0 (you)</span> | <span style="color:#f5a623;">9.8 (opp)</span></div>
        `;
        document.body.appendChild(panel);

        // Drag functionality
        const header = document.getElementById('ultimate-header');
        let dragging = false, startX = 0, startY = 0, startLeft = 0, startTop = 0;
        function onStart(e) {
            e.preventDefault();
            dragging = true;
            const clientX = e.clientX ?? (e.touches ? e.touches[0].clientX : 0);
            const clientY = e.clientY ?? (e.touches ? e.touches[0].clientY : 0);
            startX = clientX; startY = clientY;
            startLeft = panel.offsetLeft; startTop = panel.offsetTop;
            panel.style.transition = 'none';
            header.style.cursor = 'grabbing';
        }
        function onMove(e) {
            if (!dragging) return;
            e.preventDefault();
            const clientX = e.clientX ?? (e.touches ? e.touches[0].clientX : 0);
            const clientY = e.clientY ?? (e.touches ? e.touches[0].clientY : 0);
            let newLeft = startLeft + (clientX - startX);
            let newTop = startTop + (clientY - startY);
            newLeft = Math.max(0, Math.min(window.innerWidth - panel.offsetWidth, newLeft));
            newTop = Math.max(0, Math.min(window.innerHeight - panel.offsetHeight, newTop));
            panel.style.left = newLeft + 'px';
            panel.style.top = newTop + 'px';
            panel.style.right = 'auto';
        }
        function onEnd() { dragging = false; panel.style.transition = ''; header.style.cursor = 'grab'; }
        header.addEventListener('mousedown', onStart);
        document.addEventListener('mousemove', onMove);
        document.addEventListener('mouseup', onEnd);
        header.addEventListener('touchstart', onStart, { passive: false });
        document.addEventListener('touchmove', onMove, { passive: false });
        document.addEventListener('touchend', onEnd);

        toggleBtn.addEventListener('click', (e) => {
            e.stopPropagation();
            panel.style.display = panel.style.display === 'flex' ? 'none' : 'flex';
        });

        const checkbox = document.getElementById('camToggleCheckbox');
        const camLabel = document.getElementById('camToggleLabel');
        const statusDiv = document.getElementById('camStatus');
        checkbox.addEventListener('change', () => {
            cameraActive = checkbox.checked;
            camLabel.textContent = cameraActive ? 'ON' : 'OFF';
            if (cameraActive) {
                initCanvas();
                if (!imageElement) loadSavedPhoto();
                statusDiv.textContent = 'Active – using ' + (imageElement ? 'photo' : 'default image');
            } else statusDiv.textContent = 'Camera spoof off';
        });

        document.getElementById('choosePhotoBtn').addEventListener('click', () => document.getElementById('photoInput').click());
        document.getElementById('photoInput').addEventListener('change', (e) => {
            if (e.target.files[0]) {
                savePhotoFromFile(e.target.files[0]);
                statusDiv.textContent = 'Photo saved! Enable spoof.';
            }
        });

        loadSavedPhoto();
        if (localStorage.getItem(STORAGE_KEY)) statusDiv.textContent = 'Saved photo loaded. Enable spoof.';
        else statusDiv.textContent = 'No photo. Select one.';
    }

    if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', buildUI);
    else buildUI();

    // ============================================================
    // 4. ADDITIONAL SCORE SPOOFING METHODS (every possible path)
    // ============================================================

    // 4a. XMLHttpRequest
    const origXHROpen = XMLHttpRequest.prototype.open;
    const origXHRSend = XMLHttpRequest.prototype.send;
    XMLHttpRequest.prototype.open = function(method, url, ...rest) {
        this.__mog_url = url;
        return origXHROpen.call(this, method, url, ...rest);
    };
    XMLHttpRequest.prototype.send = function(body) {
        if (this.__mog_url && typeof this.__mog_url === 'string' && (this.__mog_url.includes('/finalize') || this.__mog_url.includes('/match/end') || this.__mog_url.includes('/rating'))) {
            try {
                let data = typeof body === 'string' ? JSON.parse(body) : body;
                if (data && typeof data === 'object') {
                    for (let k in data) {
                        if (typeof data[k] === 'number') {
                            if (k.includes('self') || k.includes('my') || k.includes('player1')) data[k] = window.__mogTargetScore;
                            if (k.includes('opp') || k.includes('their') || k.includes('player2')) data[k] = window.__mogOpponentScore;
                        }
                    }
                    arguments[0] = typeof body === 'string' ? JSON.stringify(data) : data;
                }
            } catch(e) {}
        }
        return origXHRSend.apply(this, arguments);
    };

    // 4b. FormData
    const origFormDataAppend = FormData.prototype.append;
    FormData.prototype.append = function(key, value, filename) {
        if (typeof key === 'string' && typeof value === 'string' && key.includes('score')) {
            try {
                const parsed = JSON.parse(value);
                if (parsed && typeof parsed === 'object') {
                    if (parsed.selfScore !== undefined) parsed.selfScore = window.__mogTargetScore;
                    if (parsed.opponentScore !== undefined) parsed.opponentScore = window.__mogOpponentScore;
                    value = JSON.stringify(parsed);
                }
            } catch(e) {}
        }
        return origFormDataAppend.call(this, key, value, filename);
    };

    // 4c. EventSource
    const origEventSource = window.EventSource;
    window.EventSource = function(url, config) {
        const es = new origEventSource(url, config);
        const origDispatch = es.dispatchEvent;
        es.dispatchEvent = function(event) {
            if (event && event.data && typeof event.data === 'string') {
                try {
                    const parsed = JSON.parse(event.data);
                    if (parsed.type === 'SCAN_STATE' && parsed.payload) {
                        parsed.payload.overall = window.__mogTargetScore;
                        if (parsed.payload.opponentOverall) parsed.payload.opponentOverall = window.__mogOpponentScore;
                        event.data = JSON.stringify(parsed);
                    }
                } catch(e) {}
            }
            return origDispatch.call(this, event);
        };
        return es;
    };

    // 4d. BroadcastChannel
    const origBroadcastChannel = window.BroadcastChannel;
    window.BroadcastChannel = function(name) {
        const channel = new origBroadcastChannel(name);
        const origPostMessage = channel.postMessage;
        channel.postMessage = function(message) {
            if (typeof message === 'string' && message.includes('SCAN_STATE')) {
                try {
                    const parsed = JSON.parse(message);
                    if (parsed.type === 'SCAN_STATE' && parsed.payload) {
                        parsed.payload.overall = window.__mogTargetScore;
                        if (parsed.payload.opponentOverall) parsed.payload.opponentOverall = window.__mogOpponentScore;
                        message = JSON.stringify(parsed);
                    }
                } catch(e) {}
            }
            return origPostMessage.call(this, message);
        };
        return channel;
    };

    // 4e. Worker postMessage
    const origWorkerPostMessage = Worker.prototype.postMessage;
    Worker.prototype.postMessage = function(message, transfer) {
        if (typeof message === 'string' && message.includes('SCAN_STATE')) {
            try {
                const parsed = JSON.parse(message);
                if (parsed.type === 'SCAN_STATE' && parsed.payload) {
                    parsed.payload.overall = window.__mogTargetScore;
                    if (parsed.payload.opponentOverall) parsed.payload.opponentOverall = window.__mogOpponentScore;
                    message = JSON.stringify(parsed);
                }
            } catch(e) {}
        }
        return origWorkerPostMessage.call(this, message, transfer);
    };

    // 4f. SharedWorker
    if (typeof SharedWorker !== 'undefined') {
        const origSharedWorker = window.SharedWorker;
        window.SharedWorker = function(url, options) {
            const sw = new origSharedWorker(url, options);
            const origPostMessage = sw.port.postMessage;
            sw.port.postMessage = function(message) {
                if (typeof message === 'string' && message.includes('SCAN_STATE')) {
                    try {
                        const parsed = JSON.parse(message);
                        if (parsed.type === 'SCAN_STATE' && parsed.payload) {
                            parsed.payload.overall = window.__mogTargetScore;
                            if (parsed.payload.opponentOverall) parsed.payload.opponentOverall = window.__mogOpponentScore;
                            message = JSON.stringify(parsed);
                        }
                    } catch(e) {}
                }
                return origPostMessage.call(this, message);
            };
            return sw;
        };
    }

    // 4g. navigator.sendBeacon
    const origSendBeacon = navigator.sendBeacon;
    navigator.sendBeacon = function(url, data) {
        if (typeof url === 'string' && (url.includes('/finalize') || url.includes('/match'))) {
            if (typeof data === 'string') {
                try {
                    const parsed = JSON.parse(data);
                    if (parsed.type === 'SCAN_STATE' && parsed.payload) {
                        parsed.payload.overall = window.__mogTargetScore;
                        if (parsed.payload.opponentOverall) parsed.payload.opponentOverall = window.__mogOpponentScore;
                        data = JSON.stringify(parsed);
                    }
                } catch(e) {}
            }
        }
        return origSendBeacon.call(this, url, data);
    };

    // 4h. IndexedDB score caching
    const origIDBOpen = indexedDB.open;
    indexedDB.open = function(name, version) {
        const request = origIDBOpen.call(indexedDB, name, version);
        const origSuccessHandler = Object.getOwnPropertyDescriptor(IDBRequest.prototype, 'onsuccess').set;
        Object.defineProperty(request, 'onsuccess', {
            set(fn) {
                const newFn = function(event) {
                    const db = event.target.result;
                    const origTransaction = db.transaction;
                    db.transaction = function(...args) {
                        const tx = origTransaction.apply(db, args);
                        const origObjectStore = tx.objectStore;
                        tx.objectStore = function(name) {
                            const store = origObjectStore.call(tx, name);
                            const origPut = store.put;
                            store.put = function(value, key) {
                                if (value && value.overall !== undefined) {
                                    value.overall = window.__mogTargetScore;
                                    if (value.opponentOverall) value.opponentOverall = window.__mogOpponentScore;
                                }
                                return origPut.call(store, value, key);
                            };
                            return store;
                        };
                        return tx;
                    };
                    fn(event);
                };
                origSuccessHandler.call(this, newFn);
            },
            get() { return origSuccessHandler.get.call(this); }
        });
        return request;
    };

    // 4i. WebAssembly scoring functions
    if (typeof WebAssembly !== 'undefined') {
        const origInstantiate = WebAssembly.instantiate;
        WebAssembly.instantiate = async function(...args) {
            const result = await origInstantiate(...args);
            const instance = result.instance || result;
            if (instance && instance.exports) {
                for (let exp of Object.keys(instance.exports)) {
                    if (exp.toLowerCase().includes('score') && typeof instance.exports[exp] === 'function') {
                        const origFn = instance.exports[exp];
                        instance.exports[exp] = function(...args) {
                            const val = origFn(...args);
                            if (typeof val === 'number') return window.__mogTargetScore;
                            return val;
                        };
                    }
                }
            }
            return result;
        };
    }

    // 4j. Kill jitter by locking Math.random
    const origRandom = Math.random;
    Math.random = function() {
        if (window.__mogJitter === 0) return 0;
        return origRandom();
    };

    // 4k. requestAnimationFrame score patching
    const origRAF = window.requestAnimationFrame;
    window.requestAnimationFrame = function(cb) {
        const wrapped = function(ts) {
            cb(ts);
            document.querySelectorAll('[class*="score"]').forEach(el => {
                if (/^\d+(\.\d)?$/.test(el.innerText.trim())) el.innerText = window.__mogTargetScore.toFixed(1);
            });
        };
        return origRAF(wrapped);
    };

    // 4l. Globally patch textContent/innerText setters
    const origTextContentDescriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'textContent');
    if (origTextContentDescriptor && origTextContentDescriptor.set) {
        const origSetTextContent = origTextContentDescriptor.set;
        Object.defineProperty(Node.prototype, 'textContent', {
            set(value) {
                if (typeof value === 'string' && /^\d+(\.\d)?$/.test(value.trim()) && parseFloat(value) <= 10 && parseFloat(value) > 0 && parseFloat(value) !== window.__mogTargetScore) {
                    value = window.__mogTargetScore.toFixed(1);
                }
                origSetTextContent.call(this, value);
            },
            get: origTextContentDescriptor.get
        });
    }
    const origInnerTextDescriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'innerText');
    if (origInnerTextDescriptor && origInnerTextDescriptor.set) {
        const origSetInnerText = origInnerTextDescriptor.set;
        Object.defineProperty(HTMLElement.prototype, 'innerText', {
            set(value) {
                if (typeof value === 'string' && /^\d+(\.\d)?$/.test(value.trim()) && parseFloat(value) <= 10 && parseFloat(value) > 0 && parseFloat(value) !== window.__mogTargetScore) {
                    value = window.__mogTargetScore.toFixed(1);
                }
                origSetInnerText.call(this, value);
            },
            get: origInnerTextDescriptor.get
        });
    }

    // ============================================================
    // 5. ADDITIONAL CAMERA SPOOF METHODS (every video sink)
    // ============================================================

    // 5a. HTMLVideoElement.srcObject setter
    const origSrcObjectDescriptor = Object.getOwnPropertyDescriptor(HTMLVideoElement.prototype, 'srcObject');
    if (origSrcObjectDescriptor && origSrcObjectDescriptor.set) {
        const origSetSrcObject = origSrcObjectDescriptor.set;
        Object.defineProperty(HTMLVideoElement.prototype, 'srcObject', {
            set(stream) {
                if (cameraActive && stream && stream.getVideoTracks().length > 0 && cameraStream) {
                    origSetSrcObject.call(this, cameraStream);
                } else {
                    origSetSrcObject.call(this, stream);
                }
            },
            get: origSrcObjectDescriptor.get
        });
    }

    // 5b. canvas.captureStream
    const origCaptureStream = HTMLCanvasElement.prototype.captureStream;
    HTMLCanvasElement.prototype.captureStream = function(fps) {
        if (cameraActive && this === canvas && cameraStream) return cameraStream;
        return origCaptureStream.call(this, fps);
    };

    // 5c. CanvasRenderingContext2D.drawImage
    const origDrawImage = CanvasRenderingContext2D.prototype.drawImage;
    CanvasRenderingContext2D.prototype.drawImage = function(...args) {
        if (cameraActive && args[0] instanceof HTMLVideoElement) {
            if (canvas && ctx) return origDrawImage.call(this, canvas, ...args.slice(1));
        }
        return origDrawImage.apply(this, args);
    };

    // 5d. createImageBitmap
    const origCreateImageBitmap = window.createImageBitmap;
    if (origCreateImageBitmap) {
        window.createImageBitmap = function(source, ...args) {
            if (cameraActive && source instanceof HTMLVideoElement && canvas) return origCreateImageBitmap(canvas, ...args);
            return origCreateImageBitmap(source, ...args);
        };
    }

    // 5e. ImageCapture
    if (typeof ImageCapture !== 'undefined') {
        const origGrabFrame = ImageCapture.prototype.grabFrame;
        ImageCapture.prototype.grabFrame = function() {
            if (cameraActive && this.track && this.track.kind === 'video') return Promise.resolve(canvas ? canvas : null);
            return origGrabFrame.call(this);
        };
        const origTakePhoto = ImageCapture.prototype.takePhoto;
        ImageCapture.prototype.takePhoto = function() {
            if (cameraActive && this.track && this.track.kind === 'video' && canvas) return canvas.toBlob().then(blob => blob);
            return origTakePhoto.call(this);
        };
    }

    // 5f. MediaStreamTrack.clone
    const origCloneTrack = MediaStreamTrack.prototype.clone;
    MediaStreamTrack.prototype.clone = function() {
        const clone = origCloneTrack.call(this);
        if (cameraActive && this.kind === 'video' && cameraStream) {
            const fakeTrack = cameraStream.getVideoTracks()[0];
            if (fakeTrack) return fakeTrack;
        }
        return clone;
    };

    // 5g. RTCPeerConnection.addTransceiver
    const origAddTransceiver = RTCPeerConnection.prototype.addTransceiver;
    RTCPeerConnection.prototype.addTransceiver = function(trackOrKind, ...args) {
        if (cameraActive && (trackOrKind === 'video' || (trackOrKind && trackOrKind.kind === 'video'))) {
            const fakeTrack = cameraStream ? cameraStream.getVideoTracks()[0] : null;
            if (fakeTrack) trackOrKind = fakeTrack;
        }
        return origAddTransceiver.call(this, trackOrKind, ...args);
    };

    // 5h. RTCRtpSender.replaceTrack (already partly in keepalive, but ensure it always replaces)
    const origReplaceTrack = RTCRtpSender.prototype.replaceTrack;
    RTCRtpSender.prototype.replaceTrack = async function(track) {
        if (cameraActive && track && track.kind === 'video') {
            const fakeTrack = cameraStream ? cameraStream.getVideoTracks()[0] : null;
            if (fakeTrack) track = fakeTrack;
        }
        return origReplaceTrack.call(this, track);
    };

    // 5i. enumerateDevices
    const origEnumerateDevices = navigator.mediaDevices.enumerateDevices;
    navigator.mediaDevices.enumerateDevices = async function() {
        const devices = await origEnumerateDevices.call(navigator.mediaDevices);
        if (cameraActive) {
            return devices.map(d => d.kind === 'videoinput' ? { ...d, label: 'Omoggle Virtual Camera', deviceId: 'mog-fake-device' } : d);
        }
        return devices;
    };

    // 5j. AudioContext.createMediaStreamSource (placeholder)
    const origCreateMediaStreamSource = AudioContext.prototype.createMediaStreamSource;
    AudioContext.prototype.createMediaStreamSource = function(stream) {
        return origCreateMediaStreamSource.call(this, stream);
    };

    // 5k. canvas.toDataURL
    const origToDataURL = HTMLCanvasElement.prototype.toDataURL;
    HTMLCanvasElement.prototype.toDataURL = function(...args) {
        if (cameraActive && this === canvas) {
            const dataURL = localStorage.getItem(STORAGE_KEY);
            if (dataURL) return dataURL;
        }
        return origToDataURL.apply(this, args);
    };

    // 5l. Blob constructor (image upload)
    const origBlob = window.Blob;
    window.Blob = function(parts, options) {
        if (cameraActive && parts && parts.length === 1 && parts[0] instanceof Uint8Array && options && options.type && options.type.startsWith('image/')) {
            const dataURL = localStorage.getItem(STORAGE_KEY);
            if (dataURL) {
                const byteString = atob(dataURL.split(',')[1]);
                const mimeType = dataURL.split(',')[0].split(':')[1].split(';')[0];
                const ab = new ArrayBuffer(byteString.length);
                const ia = new Uint8Array(ab);
                for (let i = 0; i < byteString.length; i++) ia[i] = byteString.charCodeAt(i);
                return new origBlob([ia], {type: mimeType});
            }
        }
        return new origBlob(parts, options);
    };

    console.log('[Ultimate] All hooks active (v5.0) – 30+ interception layers for score & camera spoof.');
})();