// Plugin Command
Game_Interpreter.prototype.command357 = function(params) {
    console.log("IN Plugin Command [params]:   ");
    // 对象的输出为这个样子
    // 0: "WebViewerMZ2"
    // 1: "showWebViewer"
    // 2: "Show Web Viewer"
    // 3: {url: "https://hsp.lemonhall.me/cards/index.html"}
    console.log(params);


    //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    //我个人增加的逻辑:
    params[3]["eventCaller"] = $dataMap.events[this._eventId];
    //检查一下增加的eventCaller是否正确加入了args
    console.log("IN Plugin Command params[3][eventCaller]:   ");
    console.log(params[3]["eventCaller"]);
    //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    const pluginName = Utils.extractFileName(params[0]);
    // 这里是callCommand的具体实现:
    // PluginManager.callCommand = function(self, pluginName, commandName, args) {
    //     const key = pluginName + ":" + commandName;
    //     const func = this._commands[key];
    //     if (typeof func === "function") {
    //         func.bind(self)(args);
    //     }
    // };
    PluginManager.callCommand(this, pluginName, params[1], params[3]);
    console.log("IN Plugin Command [this]:   ");
    // 这个时候,this就是 Game_Interpreter 本身了
    // _branch: {}
    // _characterId: 0
    // _childInterpreter: null
    // _comments: ""
    // _depth: 0
    // _eventId: 21
    // _frameCount: 125
    // _freezeChecker: 1
    // _indent: 0
    // _index: 1
    // _list: (3) [{…}, {…}, {…}]
    // _mapId: 1
    // _waitCount: 0
    // _waitMode: ""
    console.log(this);
    // 输出是:IN Plugin Command params[1]:   showWebViewer
    console.log("IN Plugin Command params[1]:   "+params[1]);
    console.log("IN Plugin Command params[3]:   "+params[3]);
    //实际上就是这个:{url: "https://hsp.lemonhall.me/cards/index.html"}
    console.log(params[3]);

    //使用$dataMap.events[21].name,可以得到当前地图上21号event的name
    //所以更优雅的方式是,可以直接把$dataMap.events[21]这个对象,塞入params[3]里面去
    //这样
    
    return true;
};
    PluginManager.registerCommand(pluginName, "showWebViewer", args => {
        SceneManager.push(Scene_WebViewer);
        Scene_WebViewer.prototype.url = args.url;
        // 我修改了Game_Interpreter的Plugin Command后,添加了eventCaller后,让Plugin在被调用时
        // 能拿到正确的 event信息,方便在event里直接设置运行逻辑,或者让插件逻辑直接获取信息
        //=====================================================================
        // // Plugin Command
        // Game_Interpreter.prototype.command357 = function(params) {
        //     console.log("IN Plugin Command [params]:   ");
        //     // 对象的输出为这个样子
        //     // 0: "WebViewerMZ2"
        //     // 1: "showWebViewer"
        //     // 2: "Show Web Viewer"
        //     // 3: {url: "https://hsp.lemonhall.me/cards/index.html"}
        //     console.log(params);


        //     //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        //     //我个人增加的逻辑:
        //     params[3]["eventCaller"] = $dataMap.events[this._eventId];
        //     //检查一下增加的eventCaller是否正确加入了args
        //     console.log("IN Plugin Command params[3][eventCaller]:   ");
        //     console.log(params[3]["eventCaller"]);
        //     //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        //=====================================================================

        Scene_WebViewer.prototype.eventCaller = args.eventCaller;
    });

我写完了以后才意识到,其实吧。。。。。搞不好直接调用Game_Interpreter就行了

但那样写确实不够优雅,先这样,算是又读了一些代码,写了一些注释,不好吗?