No Maj-soul CV Voice

Disable CV voice without influncing any other stuffs.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name                No Maj-soul CV Voice
// @name:zh-CN          禁止报菜名
// @namespace           NoMajsoulCVVoice
// @license             AGPL-3.0-only
// @version             0.0.1
// @description         Disable CV voice without influncing any other stuffs.
// @description:zh-CN   再报菜名就让你风风光光 / 禁用角色报菜名但不影响吃碰杠
// @author              FurryR
// @match               https://game.maj-soul.com/1/
// @match               https://game.mahjongsoul.com/index.html
// @match               https://game.mahjongsoul.com/
// @icon                https://www.google.com/s2/favicons?sz=64&domain=maj-soul.com
// @grant               none
// @run-at              document-start
// ==/UserScript==

;(function() {
    'use strict'
    function makeSafe(obj) {
        return new Proxy(obj, {
            get(target, p) {
                const _some = Array.prototype.some
                Array.prototype.some = () => false
                const res = Reflect.get(target, p)
                Array.prototype.some = _some
                return res
            },
            set(target, p, value) {
                const _some = Array.prototype.some
                Array.prototype.some = () => false
                const res = Reflect.set(target, p, value)
                Array.prototype.some = _some
                return res
            }
        })
    }
    window.onerror = null
    let view = undefined
    Object.defineProperty(window, 'view', {
        get: () => view,
        set: (v) => {
            v = makeSafe(v)
            if (v.DesktopMgr) {
                const _initRoom = v.DesktopMgr.prototype.initRoom
                v.DesktopMgr.prototype.initRoom = function (w, k, B, t, f) {
                    _initRoom.call(this, w, k, B, t, f)
                    console.log(this.player_datas)
                    for (const player_data of this.player_datas) {
                        player_data.character.level = 0
                        player_data.character.exp = 0
                    }
                }
                v.DesktopMgr.prototype.playMindVoice = function () {}
            }
            console.log(v)
            view = v
        }
    })
})()