Kirka.IO Enhanced

Wallhack, adblock and more for Kirka.IO.

当前为 2022-11-22 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name Kirka.IO Enhanced
// @namespace -
// @version 1.0.0
// @description Wallhack, adblock and more for Kirka.IO.
// @author NotYou
// @match *://kirka.io/*
// @run-at document-end
// @license GPL-3.0-or-later
// @grant none
// ==/UserScript==

(function() {
    let wallhackEnabled = false

    // Styling

    let css = `
    .notification {
      position: absolute;
      background: var(--secondary-5);
      border: 4px solid rgb(62, 77, 124);
      border-bottom: solid 4px var(--secondary-6);
      border-top: 4px solid rgb(77, 92, 139);
      width: 250px;
      height: 100px;
      right: 15px;
      bottom: 15px;
      z-index: 100;
      color: rgb(255, 255, 255);
      transition: .3s;
      opacity: 0.85;
      pointer-events: none;
    }

    .notification-title {
      font-size: x-large;
      text-align: center;
      margin: 2px;
    }

    .notification-body {
      margin: 3px;
      font-size: medium;
    }

    .highlight-disabled::after {
      content: 'disabled';
      color: rgb(210, 50, 50);
    }

    .highlight-enabled::after {
      content: 'enabled';
      color: rgb(50, 210, 50);
    }`

    // Ad Block

    let adBlockCss = '.ad-left, .ad-bottom, #ad-left, #ad-bottom { display: none !important }'

    window.show_rewarded = _
    window.show_preroll = _

    // No Logs

    console.log2 = console.log
    console.log = _
    console.info = _
    console.warn = _
    console.error = _


    window.addEventListener('keydown', e => {
        let chat = document.querySelector('.chat')

        // Hide chat

        if(chat && e.code === 'KeyV') {
            chat.style.transition = '.3s opacity'
            toggleVisibility(chat)
        }

        // Wallhack

        if(e.code === 'KeyF') {
            wallhackEnabled = !wallhackEnabled

            notify('Wallhack', 'Wallhack is ', wallhackEnabled)
        }
    })

    function getWeapon(query) {
        return Array.from(document.querySelectorAll('.gun-name')).find(e => e.textContent.toLowerCase() === query.toLowerCase())
    }

    // Wallhack (Actual)

    (function() {
        Object.defineProperty(Object.prototype, 'material', {
            set(value) {
                this._material = value

                if (this._material && this._material.name && this._material.name.indexOf('player') !== -1 && wallhackEnabled) {
                    value.alphaTest = 0.99
                    value.fog = false
                    value.depthTest = false
                }
            },

            get() {
                return this._material
            }
        })
    })()

    let styleNode = document.createElement('style')
    styleNode.appendChild(document.createTextNode(css + adBlockCss))
    document.querySelector('head').appendChild(styleNode)

    function notify(title, body, highlight) {
        let notifClass = 'notification'
        let notif = document.createElement('div')
        let notifTitle = document.createElement('h3')
        let notifBody = document.createElement('p')

        notifTitle.className = notifClass + '-title'
        notifBody.className = notifClass + '-body'
        notif.className = notifClass

        notifTitle.textContent = title ?? 'Kirka.IO Enchanced'
        notifBody.innerHTML = (body ?? '') + (`<span class="highlight-${highlight === true ? 'enabled' : highlight === false ? 'disabled' : ''}"></span>`)

        notif.style.right = '100vw'

        notif.appendChild(notifTitle)
        notif.appendChild(notifBody)
        document.body.appendChild(notif)

        setTimeout(() => {
            notif.style.right = ''
        }, 300)

        setTimeout(() => {
            notif.style.right = '100vw'

            setTimeout(() => {
                notif.remove()
            }, 300)
        }, 1600)
    }

    function toggleVisibility(el) {
        if(el.style.opacity === '0') {
            el.style.opacity = '1'
            el.style.pointerEvents = 'none'
        } else {
            el.style.opacity = '0'
            el.style.pointerEvents = 'auto'
        }
    }

    function _() {}
})()