wsmud_plugins_extends

武神传说 MUD

Versione datata 11/09/2022. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         wsmud_plugins_extends
// @namespace    cqv
// @version      0.0.3.4
// @date         09/04/2021
// @modified     11/09/2022
// @homepage     网站链接
// @description  武神传说 MUD
// @author       sasamila
// @match        http://game.wsmud.com/*
// @match        http://www.wsmud.com/*
// @match        http://game.wamud.com/*
// @match        http://www.wamud.com/*
// @run-at       document-end
// @grant        unsafeWindow
// @grant        GM_getValue
// @grant        GM_setValue
// @license      MIT


// ==/UserScript==

(function () {
    'use strict';

    var WG = undefined;
    var T = undefined;
    var G = undefined;
    var messageAppend = undefined;
    var messageClear = undefined;
    $(document).ready(function () {
        WG = unsafeWindow.WG;
        T = unsafeWindow.T;
        G = unsafeWindow.G;

        G.SKILL={"unarmed":"none","force":"none","parry":"none","dodge":"none","sword":"none","throwing":"none","blade":"none","whip":"none","club":"none","staff":"none"};
        G.XLStatus = false;
        G.performSkills=[];
        WG.add_hook("status", function (data) {
                if (data.id == G.id && data.action == "add" && data.sid=='food' && data.name=="玄灵丹") {
                    G.XLStatus=true;
                }else if (data.id == G.id && data.action == "remove"&& data.sid=='food'){
                    G.XLStatus=false;
                }
            });
        WG.add_hook("perform", function (data) {
                G.performSkills=[];
                for (var skill of G.skills){
                    G.performSkills.push(skill.id);
                }
            });
        WG.add_hook("dialog", function (data) {
                if (data.dialog == "skills") {
                    if (data.items) {
                        console.log(data.items)
                        for (let item of data.items) {
                            if (item.name.indexOf("基本") >= 0) {
                               G.SKILL[item.id]=item.enable_skill
                            }
                        }
                    }
                    if (data.enable != undefined) {
                        for (let item of G.enable_skills) {
                            if (item.type == data.id) {
                                item.name = data.enable
                                break;
                            }
                        }
                    }
                }


            });
        messageAppend = unsafeWindow.messageAppend;
        messageClear = unsafeWindow.messageClear;
        T.perform=async function (idx = 0, n, cmds) {
            if(G.in_fight){
                cmds = T.recmd(idx, cmds);
                WG.SendCmd("perform "+n+";"+cmds);
            }
        };
        T.skillPerform=async function (idx = 0, n, cmds) {
            if(G.in_fight){
                var sksp=n.split(".")
                cmds = T.recmd(idx, cmds);
                if (sksp[0]==G.SKILL[sksp[1]]){
                     WG.SendCmd("perform "+sksp[1]+"."+sksp[2]+";"+cmds);
                }else{
                     WG.SendCmd(cmds);
                }
            }
        };
        T.xperform=async function (idx = 0, n, cmds) {
            if(G.in_fight){
                cmds = T.recmd(idx, cmds);
                var inde=G.performSkills.indexOf(n);
                if (inde>=0){
                    WG.SendCmd("perform "+n+";"+cmds);
                }
            }
        };
        T.xuanling=async function (idx = 0, n, cmds) {
            while (!G.XLStatus){
                WG.SendCmd("use "+ n);
                await WG.sleep(2*G.wsdelay);
            }
        };
    });
})();