사용자:Hd219134/common.js

리버티게임, 모두가 만들어가는 자유로운 게임

참고: 설정을 저장한 후에 바뀐 점을 확인하기 위해서는 브라우저의 캐시를 새로 고쳐야 합니다.

  • 파이어폭스 / 사파리: Shift 키를 누르면서 새로 고침을 클릭하거나, Ctrl-F5 또는 Ctrl-R을 입력 (Mac에서는 ⌘-R)
  • 구글 크롬: Ctrl-Shift-R키를 입력 (Mac에서는 ⌘-Shift-R)
  • 인터넷 익스플로러 / 엣지: Ctrl 키를 누르면서 새로 고침을 클릭하거나, Ctrl-F5를 입력.
  • 오페라: Ctrl-F5를 입력.
/** 플러그인 haircut***************************
* 게임 진행에 필요합니다.
* 버전 => 2.0
* 작성자 : [[사용자:Lemminkäinen|Lemminkäinen]] 
* JSON => haircut = {"name":"haircut","descript":"게임 진행에 필요합니다.","version":"2.0","local":true,"creat":"Lemminkäinen","state":"머리 자르기/js","executable":true}; 
*/ 
function plugin_haircut(){
  if($("[data-name='haircut']").length >= 1){
		  // 이부분에 코드 입력 //
/*Elements Load 시작*/
var cut_res_container=document.getElementById("cut_res_container");
var cut_container=document.getElementById("cut_container");
var cut_linehair=document.getElementById("cut_line");
var cuthair=document.getElementById("cuthair");
/*Load 끝*/
var rand=function(r1,r2){
  return Math.floor(Math.random()*r1)+r2;
}
var cut_now=rand(400,600);
var cut_line=rand(200,300);
var cut_initial=cut_now-cut_line;
var cdf=document.getElementById("cut_diff").innerHTML;
var cut_diff=(cdf<=0 || isNaN(cdf) || cdf>2)?(0.5):(Number(cdf));
var cut_speed=cut_now/cut_diff;
var cut_result1=0; var cut_result2=0;
cut_res_container.style.display="none";
cut_container.style.height=cut_now+"px";
cut_linehair.style.height=cut_line+"px";
if(cut_initial<=0) { alert('머리가 너무 짧아 자를 수 없습니다!'); throw("WTF your hair is already short"); }
function cut_again(){
$('#scissors').animate({ top:"100%" },cut_speed,'linear',function(){ $('#scissors').animate({ top:0 },cut_speed,'linear',function(){ cut_again() }); });
}//animate는 자스로 대체하려니 setInterval이나 setTimeout 등으로 해야 하는데 여어어엉 귀찮아서..
cut_again();
function cut_calc(pos){
	if(pos<cut_line){
		cut_rescalc(pos);
		return;
	}
	cut_now=pos;
	cut_speed=cut_now/cut_diff;
	cut_container.style.height=cut_now+"px";
	cuthair.innerHTML=cut_now;
}
function cut_rescalc(pos){
        document.getElementById("cuthair_info").style.display="none";
		cut_container.style.display="none";
		document.getElementById("cut").style.display="none";
		cut_res_container.style.display="block";
		cut_result1=(100*(1-(cut_now-cut_line)/cut_initial));
		cut_result2=(100*(pos/cut_line));
		document.getElementById("cut_result1").innerHTML=cut_result1;
		document.getElementById("cut_result2").innerHTML=cut_result2;
		var cut_stories1=document.getElementsByClassName("cut_story");
		var cut_stories2=document.getElementsByClassName("cuts_story");
		if(cut_result1===0){	cut_stories1[0].style.display="block"; document.getElementById('cuts_story').style.display="none";		}
		else if(cut_result1<90){			cut_stories1[1].style.display="block";		}
		else if(cut_result1<95){			cut_stories1[2].style.display="block";		}
		else if(cut_result1<98){			cut_stories1[3].style.display="block";		}
		else if(cut_result1<=100){			cut_stories1[4].style.display="block";		}
		/* story2 (cut_result2, cuts) */
		if(cut_result2<90){			cut_stories2[0].style.display="block";		}
		else if(cut_result2<95){		cut_stories2[1].style.display="block";		}
		else if(cut_result2<98){		cut_stories2[2].style.display="block";		}
		else if(cut_result2<=100){		cut_stories2[3].style.display="block";		}
}
$('#cut').click(function(){ cut_calc($('#scissors').position().top ); });//addEventListener...그냥 생각하길 관두고
 // 여기까지 코드 입력 //

		
  }

}
$( plugin_haircut );
/* haircut 끝 */


/** 플러그인 RankingSystem***************************
* 랭킹시스템 라이브러리
* 버전 => 1.0.7
* 작성자 : [[사용자:BANIP|BANIP]] 
* JSON => RankingSystem = {"name":"RankingSystem","descript":"랭킹시스템 라이브러리","version":"1.0.7","local":true,"creat":"BANIP","state":"사용자:BANIP/플러그인/랭킹시스템","executable":false}; 
*/ 
function plugin_RankingSystem(){
  if($("[data-name='RankingSystem']").length >= 1){
		 // 이부부분에 코드 입력 //

/**
  * @param 
  		{string} documentTitle 랭킹정보가 있는 문서의 제목.
  		{function} sortCallback 랭킹을 정렬할때 기준으로 사용하는 함수
  		    {any} prev 랭킹 정렬 기준으로 사용할 왼쪽의 값
  		   	{any} next 랭킹 정렬 기준으로 사용할 오른쪽의 값
  		{object} api MediaWikiapi의 인스턴스, 없어도 됨.

  	@return {Object}
  		{function} get 랭킹정보를 object형태로 획득
  		{function} update 랭킹정보 업데이트
  			{object} updateInfo 업데이트할 사용자 정보
  			{function} updateCriteria 사용자정보의 업데이트 기준
  			@param {any} rankingScore 랭킹에서 사용중인 스코어
  				   {any} thisScore 사용자 스코어
  			@return{bool} true가 반환되면 업데이트
  			{object} alternateKeys 랭킹에서 보여지는 대체 키
*/
return function(documentTitle, sortCallback, api) {
    function forEach(object, callback) {
        for (var key in object) {
            var variable = object[key];
            callback(variable, key);
        }
    }

    function getRankingJSON(rankingDoc) {
        console.log(rankingDoc)
        if (!rankingDoc) return {};
        var regexp = /\<includeonly\>(.*)\<\/includeonly\>/;
        var stringRanking = regexp.exec(rankingDoc)[1];
        return JSON.parse(stringRanking);
    }

    function updateDoc(rankingJSON, api, alternateKeys) {
        //alternateKeys가 반영된 개개인의 랭킹정보 획득
        function getOutputJSON(json) {
            var result = {};
            forEach(json, function(value, key) {
                key = alternateKeys[key] || key;
                result[key] = value;
            })
            return result;
        }

        //보여지는 형태의 랭킹정보 획득
        function getOutputString(json) {
            var name = json.name;
            var result = "* '''" + name + "''' : ";
            forEach(json, function(value, key) {
                if (key === "name") return;
                key = alternateKeys[key] || key;
                result += key + ": " + value + ", ";
            })
            result += "\n"
            return result
        }

        var stringRanking = JSON.stringify(rankingJSON);
        var result = "<includ" + "eonly>" + stringRanking + "</inclu" + "deonly>\n";
        result += "<onlyin" + "clude>\n";

        var rankingList = Object.entries(rankingJSON).sort(function(prev,next){
          return sortCallback(prev[1],next[1])
        }).map(function(value){
          return value[0]
        });

        rankingList.forEach(function(key) {
            var json = rankingJSON[key];
            var outputJSON = getOutputJSON(json);
            result += getOutputString(outputJSON)
        });

        result += "</only" + "include>";
        var reply = documentTitle.replace(new RegExp("\/.*"),"") + " 점수 갱신";
        api.changeDocument(documentTitle, reply, result, true);
        return result;
    }

    function updateUserScore(rankingJSON, thisScore, updateCriteria) {
        updateCriteria = updateCriteria || function(rankingScore, thisScore) {
            return rankingScore.score < thisScore.score;
        }

        var userName = thisScore.name;
        var rankingScore = rankingJSON[userName];

        if (!rankingScore || updateCriteria(rankingScore, thisScore)) {
            rankingJSON[userName] = thisScore;
        }
    }

    api = api || MediaWikiAPI();
    var userName = mw.config.get("wgUserName");
    var rankingDoc = api.getDocument(documentTitle);
    var rankingJSON = getRankingJSON(rankingDoc);

    var actions = {
        get: function() {
            return rankingJSON;
        },
        update: function(updateInfo, updateCriteria, alternateKeys) {
            rankingJSON = actions.get();
            updateUserScore(rankingJSON, updateInfo, updateCriteria);
            updateDoc(rankingJSON, api, alternateKeys);
        }
    }
    return actions;
}

		
  }

}
/* RankingSystem 끝 */


/** 플러그인 numbase***************************
* 숫자야구 remake
* 버전 => 1.41
* 작성자 : [[사용자:Riemann|Riemann]] 
* JSON => numbase = {"name":"numbase","descript":"숫자야구 remake","version":"1.41","local":true,"creat":"Riemann","state":"사용자:Riemann/numbase","executable":true}; 
*/ 
function plugin_numbase(){
  if($("[data-name='numbase']").length >= 1){
		 
var title = mw.config.get('wgPageName');
if (title.slice( -1 ) == "4") {
    var no = 4
    }
else {
    var no = 3
}

var trial = 0;
var d = new Date();
$("#sBtn").click(function(){
    $("#description").css("display", "none");
    $("#sBtn").css("display", "none");
    $("#res").css("display", "table");
    cpuNum = initNumbase();
    document.getElementById('count').innerHTML = "시도 횟수: " + trial;
    var bDate = d.getTime();
    numGuess(bDate);
});

function initNumbase() {
var choice = "";
var initArray = [0,1,2,3,4,5,6,7,8,9];
var i, j;
for (i = 0; i < no; i++) {
    j = Math.floor(Math.random() * initArray.length);
    choice += initArray[j];
    initArray.splice(j,1);
}
return choice;
}

function numGuess(bDate) {
document.getElementById('disp').style.display = 'table';
document.getElementById('numList').style.display = 'block';
var numb = document.getElementById('numList');
var numBlocks = "";
var disp = "";
document.getElementById('disp').innerHTML = disp;
for (i = 0; i < 10; i++) {
    numBlocks += "<div id=\"numBlock" + i + "\" class=\"numBlock\">" + i + "</div>";
}
numBlocks += "<div id=\"numBlockC\" class=\"numBlockC\">C</div>";
numBlocks += "<div id=\"numBlockX\" class=\"numBlockC\">입력</div>";
numb.innerHTML = numBlocks;

function restrictLen(l,n) {
   if (l.length < no) {
        l += n;
   } else {
        alert(no + " 자리로 입력하세요.");
   }
   return l;
}

$("#numBlock0").click(function(){
    disp = restrictLen(disp,0);
    document.getElementById('disp').innerHTML = disp;
    $("#numBlock0").css("display", "none");
});
$("#numBlock1").click(function(){
    disp = restrictLen(disp,1);
    document.getElementById('disp').innerHTML = disp;
    $("#numBlock1").css("display", "none");
});
$("#numBlock2").click(function(){
    disp = restrictLen(disp,2);
    document.getElementById('disp').innerHTML = disp;
    $("#numBlock2").css("display", "none");
});
$("#numBlock3").click(function(){
    disp = restrictLen(disp,3);
    document.getElementById('disp').innerHTML = disp;
    $("#numBlock3").css("display", "none");
});
$("#numBlock4").click(function(){
    disp = restrictLen(disp,4);
    document.getElementById('disp').innerHTML = disp;
    $("#numBlock4").css("display", "none");
});
$("#numBlock5").click(function(){
    disp = restrictLen(disp,5);
    document.getElementById('disp').innerHTML = disp;
    $("#numBlock5").css("display", "none");
});
$("#numBlock6").click(function(){
    disp = restrictLen(disp,6);
    document.getElementById('disp').innerHTML = disp;
    $("#numBlock6").css("display", "none");
});
$("#numBlock7").click(function(){
    disp = restrictLen(disp,7);
    document.getElementById('disp').innerHTML = disp;
    $("#numBlock7").css("display", "none");
});
$("#numBlock8").click(function(){
    disp = restrictLen(disp,8);
    document.getElementById('disp').innerHTML = disp;
    $("#numBlock8").css("display", "none");
});
$("#numBlock9").click(function(){
    disp = restrictLen(disp,9);
    document.getElementById('disp').innerHTML = disp;
    $("#numBlock9").css("display", "none");
});
$("#numBlockC").click(function(){
    disp = "";
    document.getElementById('disp').innerHTML = disp;
    $(".numBlock").css("display", "inline-flex");
});
$("#numBlockX").click(function(){
    if (disp.length < no) {
        alert(no + " 자리로 입력하세요.")
    } else {
        trial += 1
        document.getElementById('count').innerHTML = "시도 횟수: " + trial;
        v = valid(disp,cpuNum);
        $("#res").append("<tr><td>" + trial + "</td><td>" + disp + "</td><td>" + v + "</td></tr>");
        disp = "";
        document.getElementById('disp').innerHTML = disp;
        $(".numBlock").css("display", "inline-flex");
        if ((v == "0B 3S" && no == 3) || (v == "0B 4S" && no == 4)) {
            var dd = new Date();
            var duration = Math.floor((dd.getTime() - bDate) / 1000);
            document.getElementById('end').innerHTML = "축하합니다. 정수를 맞히셨습니다. " + trial + "회, " + duration + "초가 소비되었습니다. 이용해주셔서 감사합니다.";
            $("#disp").css("display", "none");
            $("#numList").css("display", "none");
            $("#end").css("display", "inline");
            return 0;
        }
    }
});
}

function valid(u,c) {
    var b = 0;
    var s = 0;
    var bs;
    for (i = 0; i < no; i++) {
        for (j = 0; j < no; j++) {
            if (u[i] == c[j]) {
                if (i == j) {
                    s += 1;
                }
                else {
                    b += 1;
                }
            }
        }
    }
    bs = "" + b + "B " + s + "S"
    return bs;
}

		
  }

}
$( plugin_numbase );
/* numbase 끝 */


/** 플러그인 real369***************************
* real369 플레이
* 버전 => 1.1.7
* 작성자 : [[사용자:BANIP|BANIP]] 
* JSON => real369 = {"name":"real369","descript":"real369 플레이","version":"1.1.7","local":true,"creat":"BANIP","state":"Real 369/플러그인","executable":true}; 
*/ 
function plugin_real369(){
  if($("[data-name='real369']").length >= 1){
		 /**
 * 지금 박수를 쳐야되는지 숫자를 외쳐야 하는지 알아 냅니다
 * @param {number} number 지금 순서가 몇번째인지 넣는 칸.
 * @return {number|Array[number]} 박수를 쳐야되는 상황이면 배열 안에 숫자를 담아 반환하고 아니면 파라미터를 반환.
 */
function getAnswer(number) {
    var rawNumber = number + "";
    var targetNumber = rawNumber.replace(/3|6|9/g, "");
    var diff = rawNumber.length - targetNumber.length;
    if (diff === 0)
        return number + "";
    else
        return "짝!".repeat(diff);
}
function isMobile() {
    return !(navigator.userAgent.match(/Android|iPhone|iPad|iPod/i) === null);
}
var GUI = /** @class */ (function () {
    function GUI() {
        this.domList = {
            retry: document.querySelector("#gamewrap .gamelink .retry"),
            answer: document.querySelector("#gamewrap .answer"),
            dialog: document.querySelector("#gamewrap .dialog"),
            progress: document.querySelector("#gamewrap .progress"),
            gamelink: document.querySelector("#gamewrap .gamelink")
        };
        this.bindOtherEvent();
        //this.start();
    }
    GUI.prototype.start = function () {
        this.domList.answer.innerHTML = "시작!";
        this.domList.dialog.innerHTML = "";
        this.domList.gamelink.style.display = "none";
        createGame(gui);
        input.setGame(game);
    };
    GUI.prototype.bindOtherEvent = function () {
        var _this = this;
        this.domList.retry.addEventListener("click", function () {
            if (game !== null)
                game.gameOver();
            _this.start();
        });
    };
    GUI.prototype.message = function (message) {
        var dialogNode = this.domList.dialog;
        var messageNode = document.createElement("li");
        messageNode.innerHTML = message;
        dialogNode.appendChild(messageNode);
        dialogNode.scrollTop = dialogNode.scrollHeight;
    };
    GUI.prototype.initOrder = function (userCount, startUser) {
        var orderStringCount = 8;
        var orderString = new Array(orderStringCount).fill("1")
            .map(function (v, i) { return (startUser + i) % userCount === 0 ? username : "COM" + (startUser + i) % userCount; })
            .join(" => ");
        this.message("게임이 시작되었습니다!!!");
        this.message("게임순서 : " + orderString + "...");
    };
    GUI.prototype.getProgressColor = function (progress) {
        var interval = [30, 60, 100];
        var color = ["green", "yellow", "red"];
        var index = interval.indexOf(interval.filter(function (v) { return v > progress; })[0]);
        return color[index];
    };
    GUI.prototype.resetTime = function (duration) {
        var _this = this;
        clearInterval(this.timerInterval);
        var startTime = Date.now();
        this.timerInterval = setInterval(function () {
            var now = Date.now();
            var progress = (now - startTime) / duration * 100 - 1;
            var progressColor = _this.getProgressColor(progress);
            _this.domList.progress.style.background = "linear-gradient(to right," + progressColor + " " + (100 - progress) + "%,white " + (100 - progress + 0.1) + "%)";
        }, 10);
    };
    GUI.prototype.setEnemyTurn = function (order) {
        this.nextUser = "COM" + order;
    };
    GUI.prototype.setMyTurn = function () {
        this.nextUser = username;
    };
    GUI.prototype.gameOver = function (reason, lastCount) {
        this.domList.answer.innerHTML = reason;
        this.message("게임이 끝났습니다!!");
        this.message("최종 카운트: " + lastCount);
        input.setGame(null);
        this.domList.gamelink.style.display = "block";
        clearInterval(this.timerInterval);
    };
    GUI.prototype.setNumber = function (number) {
        this.domList.answer.innerHTML = number;
    };
    GUI.prototype.sayNumber = function (number, name) {
        if (name === void 0) { name = this.nextUser; }
        this.message(name + " : " + number);
    };
    GUI.prototype.setHandClab = function (clab) {
        this.domList.answer.innerHTML = clab;
    };
    return GUI;
}());
var Game = /** @class */ (function () {
    function Game(gui, playerCount, time) {
        if (playerCount === void 0) { playerCount = 3; }
        if (time === void 0) { time = 1000; }
        this.gui = gui;
        this.playerCount = playerCount;
        this.time = time;
        this.order = Math.floor(Math.random() * playerCount);
        this.number = 1;
        gui.initOrder(playerCount, this.order);
        this.turnStart();
    }
    Game.prototype.next = function () {
        var prevNumber = getAnswer(Number(this.number));
        this.gui.sayNumber(prevNumber);
        this.order = (this.order + 1) % this.playerCount;
        this.handClab = "";
        this.number++;
        this.turnStart();
    };
    Game.prototype.turnStart = function () {
        this.gui.resetTime(this.time);
        if (this.order === 0)
            this.myTurn();
        else
            this.enemyTurn();
    };
    Game.prototype.enemyTurn = function () {
        var _this = this;
        this.gui.setEnemyTurn(this.order);
        this.turnTimeout = setTimeout(function () {
            _this.shortenTime();
            _this.next();
        }, this.time * Math.random());
    };
    Game.prototype.myTurn = function () {
        var _this = this;
        this.gui.setMyTurn();
        this.turnTimeout = setTimeout(function () {
            if (getAnswer(_this.number) === _this.handClab)
                _this.next();
            else
                _this.gameOver("시간 초과!");
        }, this.time);
    };
    Game.prototype.sayNumber = function (answer) {
        clearTimeout(this.turnTimeout);
        var reasonGameOver = null;
        if (this.order > 0)
            reasonGameOver = "내 차례가 아닌데 말해버림!";
        else if (getAnswer(this.number) === answer)
            null;
        else
            reasonGameOver = "오답!";
        if (reasonGameOver === null)
            this.next();
        else {
            gui.sayNumber(answer, username);
            this.gameOver(reasonGameOver);
        }
    };
    Game.prototype.setHandClab = function (clab) {
        this.handClab = clab;
    };
    Game.prototype.gameOver = function (reason) {
        clearTimeout(this.turnTimeout);
        this.gui.gameOver(reason, this.number);
        game = null;
    };
    Game.prototype.shortenTime = function () {
        this.time *= 0.94;
    };
    return Game;
}());
var Input = /** @class */ (function () {
    function Input(game, gui) {
        this.game = game;
        this.gui = gui;
        this.clickEventType = isMobile() ? "touchstart" : "click";
        this.resetNumber();
        this.bindKeyBoardEvent();
        this.bindKeyPadEvent();
    }
    Input.prototype.setGame = function (game) {
        this.game = game;
    };
    Input.prototype.bindKeyBoardEvent = function () {
        var _this = this;
        document.addEventListener("keydown", function (e) {
            var key = e.key;
            if (["Enter", "Space"].some(function (v) { return v === key; }))
                return _this.pressEnter();
            else if (key === "BackSpace")
                _this.number = _this.number.slice(0, -1);
            else if (isNaN(parseInt(key)))
                return;
            else
                _this.number += key;
            _this.gui.setNumber(_this.number);
        });
    };
    Input.prototype.bindKeyPadEvent = function () {
        var _this = this;
        document.querySelectorAll(".keypad .key").forEach(function (node) {
            node.addEventListener(_this.clickEventType, function (e) {
                e.preventDefault();
                _this.number += e.target.dataset.num;
                _this.gui.setNumber(_this.number);
            });
        });
        document.querySelector(".keypad .enter").addEventListener(this.clickEventType, function (e) {
            e.preventDefault();
            _this.pressEnter();
        });
        document.querySelector(".keypad .reset").addEventListener(this.clickEventType, function (e) {
            e.preventDefault();
            _this.resetNumber();
            _this.gui.setNumber(_this.number);
        });
    };
    Input.prototype.pressEnter = function () {
        var _this = this;
        if (game == null || game == undefined)
            this.gui.message("아직 게임이 시작되지 않았어요.");
        clearTimeout(this.enterTimeout);
        if (this.number == "") {
            this.enterCount++;
            var answer_1 = "짝!".repeat(this.enterCount);
            this.gui.setHandClab(answer_1);
            this.game.setHandClab(answer_1);
            this.enterTimeout = setTimeout(function () {
                if (_this.game.order === 0) {
                    _this.game.sayNumber(answer_1);
                }
                _this.resetNumber();
            }, 800);
        }
        else {
            this.game.sayNumber(this.number);
            this.resetNumber();
        }
    };
    ;
    Input.prototype.resetNumber = function () {
        this.number = "";
        this.enterCount = 0;
        this.gui.setNumber(this.number);
    };
    return Input;
}());
var game = null;
var createGame = function (gui) { return game = new Game(gui, 4, 5000); };
var username = mw.config.values.wgUserName;
var gui = new GUI();
//createGame(gui);
var input = new Input(game, gui);

		
  }

}
$( plugin_real369 );
/* real369 끝 */


/** 플러그인 uncytick***************************
* 게임 실행용 플러그인
* 버전 => 1.0.0
* 작성자 : [[사용자:BANIP|BANIP]] 
* JSON => uncytick = {"name":"uncytick","descript":"게임 실행용 플러그인","version":"1.0.0","local":true,"creat":"BANIP","state":"사용자:BANIP/틱택토 live/플러그인","executable":true}; 
*/ 
function plugin_uncytick(){
  if($("[data-name='uncytick']").length >= 1){
		  // 이부분에 코드 입력 //

jQuery.getScript("https://socket-io-chat.now.sh/socket.io/socket.io.js")
.done(function(){
var Socket = /** @class */ (function () {
    function Socket(url, username) {
        if (username === void 0) { username = Math.random().toString(); }
        this.username = username;
        this.socket = io(url);
        this.defineJoin();
        this.bindSocketListener();
    }
    Socket.prototype.defineJoin = function () {
        this.socket.emit("join", { username: this.username });
    };
    Socket.prototype.bindSocketListener = function () {
        var _this = this;
        var socket = this.socket;
        socket.on("newuser", function (_a) {
            var username = _a.username;
            Chat.server(username + "\uB2D8\uC774 \uB4E4\uC5B4\uC654\uC5B4\uC694.");
        });
        socket.on("passuser", function (_a) {
            var username = _a.username;
            Chat.server(username + "\uB2D8\uC774 \uB098\uAC14\uC5B4\uC694.");
        });
        socket.on("getuserlist", function (data) {
            var buttonClickListener = function ($li, username, id) {
                socket.emit("requestjoin", { targetId: id });
                $(".activePull").removeClass();
                $li.addClass("activePull");
                Chat.server(username + "에게 게임신청을 했어요.");
            };
            var $lis = data
                .map(function (userData) {
                if (userData == null)
                    return;
                var username = userData.username, id = userData.id;
                var $li = $("<li />")
                    .text(username)
                    .data("id", id);
                if (username != _this.username) {
                    var $button = $("<button>").text("게임 신청").addClass("btn-request");
                    $button.click(function () { return buttonClickListener($li, username, id); });
                    $li.append($button);
                }
                return $li;
            });
            $("#userlist").html($lis);
        });
        socket.on("servermessage", function (data) {
            Chat.server(data.message);
        });
        socket.on("receivemessage", function (data) {
            Chat.client(data.username, data.message);
        });
        socket.on("gamestart", function (_a) {
            var enemyUsername = _a.enemyUsername;
            var canStartGame = _this.game == undefined || _this.game.isGameEnd == true;
            if (canStartGame) {
                _this.game = new Game(socket, _this.username, enemyUsername);
            }
            else {
                Chat.server(_this.game.enemyUsername + "\uACFC\uC758 \uAC8C\uC784\uC774 \uC544\uC9C1 \uB05D\uB098\uC9C0 \uC54A\uC558\uC5B4\uC694.");
            }
        });
    };
    return Socket;
}());
var Chat = /** @class */ (function () {
    function Chat() {
    }
    Chat.server = function (message) {
        var $li = $("<li></li>").text(message);
        $("#messages").append($li);
        Chat.moveBottom();
    };
    Chat.client = function (username, message) {
        var $li = $("\n            <li>\n                <span class='username' /> : <span class='message'>\n            </li>");
        $li.find(".username").text(username);
        $li.find(".message").text(message);
        $("#messages").append($li);
        Chat.moveBottom();
    };
    Chat.moveBottom = function () {
        $("#messages").scrollTop($("#messages")[0].scrollHeight);
    };
    return Chat;
}());
var Game = /** @class */ (function () {
    function Game(socket, username, ememyusername) {
        this.socket = socket;
        this.isGameEnd = false;
        this.enemyUsername = ememyusername;
        Chat.server(ememyusername + "과의 게임이 시작되었어요!");
        $(".btn-request").fadeOut();
        var bindClick = function ($target, axis) {
            var x = axis[0], y = axis[1];
            $target.text("H").click(function () {
                console.log([x, y]);
                socket.emit("draw", {
                    axis: [x, y]
                });
            });
        };
        $("#gamepan").slideDown().find("> div")
            .each(function (x) {
            $(this).find("> a").each(function (y) { bindClick($(this), [x, y]); });
        });
        this.bindSocketListener();
    }
    Game.prototype.bindSocketListener = function () {
        var socket = this.socket;
        var self = this;
        socket.on("renewgamepan", function (_a) {
            var gamepan = _a.gamepan;
            gamepan.forEach(function (hori, x) {
                return hori.forEach(function (cell, y) {
                    var textType = {
                        "1": "O",
                        "0": "H",
                        "-1": "X",
                    };
                    var text = textType[cell];
                    $("#gamepan").find("div").eq(x).find("a").eq(y)
                        .data("x", x).data("y", y)
                        .text(text);
                    console.log(x, y);
                });
            });
        });
        socket.on("gameend", function (_a) {
            var state = _a.state;
            var hideGamePan = function () { return $("#gamepan").slideUp(); };
            var messageType = {
                "win": "게임 승리!! 축하드려요!",
                "lose": "윽... 져버렸네요...",
                "draw": "비겼어요!",
            };
            var endMessage = messageType[state];
            Chat.server(endMessage);
            $(".btn-request").fadeIn();
            setTimeout(hideGamePan, 3000);
            self.isGameEnd = true;
            self.removesocketListener();
        });
    };
    Game.prototype.removesocketListener = function () {
        $("#gamepan").find("a").off("click");
        this.socket.off("gameend").off("renewgamepan");
    };
    return Game;
}());
var gamehtml = '<div id="gamepan"><div><a></a><a></a><a></a></div><div><a></a><a></a><a></a></div><div><a></a><a></a><a></a></div></div><div class="wrap"><ul id="userlist" class="scrollbox"></ul><ul id="messages" class="scrollbox"></ul><input id="chat" placeholder="메세지를 입력하세요..."/></div>';
$("#gamewindow").html(gamehtml);
var thisSocket = new Socket("https://banip.tk" + "/uncytt",mw.config.values.wgUserName);

$("#chat").keypress(function (e) {
    if (e.key === "Enter" && $(this).val() != "") {
        thisSocket.socket.emit("sendmessage", { message: $(this).val() });
        $(this).val("");
    }
});

});
 // 여기까지 코드 입력 //

		
  }

}
$( plugin_uncytick );
/* uncytick 끝 */


/** 플러그인 autosave***************************
* 자동저장 시스템을 위한 플러그인
* 버전 => 2.0.2
* 작성자 : [[사용자:Manymaster|Manymaster]] 
* JSON => autosave = {"name":"autosave","descript":"자동저장 시스템을 위한 플러그인","version":"2.0.2","local":false,"creat":"Manymaster","state":"틀:자동저장/플러그인","executable":true}; 
*/ 
function plugin_autosave(){
		 
/* 작동 가능한 네임스페이스 */
var safeNameSpace = [""];
/* autosave 편집모드가 아닐 경우 플러그인 종료 */
var searchParams = geturlSearch(location);
var isEditMode = searchParams.action === "edit";
var isAutosaveMode = searchParams.autosave === "1";
if (!(isEditMode && isAutosaveMode)) return "";

/* 자동 저장하기에 안전한 네임스페이스가 아닌 경우 플러그인 종료 */
var thisNamespaceNumber = mw.config.get("wgNamespaceNumber");
var nameSpaceIds = mw.config.get("wgNamespaceIds");
var isSafeNameSpace = safeNameSpace
    .map(function (namespace) { return nameSpaceIds[namespace]; })
    .some(function (nsNumber) { return nsNumber == thisNamespaceNumber; });
if (!(isSafeNameSpace)) return "";

/* 자동 인증된 사용자가 아닌 경우 플러그인 종료 */
var userGroups = mw.config.get('wgUserGroups');
var autocheck = 0;
if (userGroups) {
    for (var i = 0; i < userGroups.length; i++) {
        if (userGroups[i] === 'autoconfirmed') {
            autocheck++;
        }
    }
}
if (autocheck != 1) return "";

/* 지정된 단락에서 불러오기 */
var savetempDom = $(".game-autosave");
if ($(".game-autosave").length === 0)
    throw new Error("autosave => game-autosave를 클래스명으로 가진 돔을 찾을 수 없습니다.");
var savetemp = $(".game-autosave").html();

/* 문제가 되는 문자열 치환 */
savetemp = savetemp.replace(/(<([^>]+)>)/ig, "");
savetemp = savetemp.replace(/\n+/gi, "\n");
savetemp = savetemp.replace("\n", "");
savetemp = savetemp.replace(/&lt;/gi, "<");
savetemp = savetemp.replace(/&gt;/gi, ">");

/* 기록, 저장하고 빠져나오기 */
$("#wpTextbox1").val(savetemp);
$("#wpSave").click();
return;

/** 이 플러그인 제작을 도와주신 분들
 * Ver 2 제작자: [[사용자:BANIP|BANIP]]
 * 원 코드 작성자: [[사용자:*devunt]]
*/ 

		
}
$( plugin_autosave );
/* autosave 끝 */


/** 플러그인 msgame***************************
* 스톱워치 게임
* 버전 => 0.942
* 작성자 : [[사용자:Riemann|Riemann]] 
* JSON => msgame = {"name":"msgame","descript":"스톱워치 게임","version":"0.942","local":true,"creat":"Riemann","state":"사용자:Riemann/msgame","executable":true}; 
*/ 
function plugin_msgame(){
  if($("[data-name='msgame']").length >= 1){
		  // 이부분에 코드 입력 //
sc = 0
cb = 0

bl = false;
$(document.body).keydown(function() {
  if (bl == false) {
  	bl = true
    startF();
  } else {
    bl = false
    stopF();
  }
});

$("#msgame-start").click(function() {
  bl = true
	startF();
});

$("#msgame-stop").click(function() {
  bl = false
	stopF();
});

function startF() {
  obj = Math.floor(Math.random() * 10) + 5;
  $("#msgame-start").css("display", "none");
  $("#msgame-stop").css("display", "block");
  it = new Date();
  si = setInterval(clockUpdate, 20)
  $("#msgame-console").text(obj + " 초를 세세요.");
}

function stopF() {
  $("#msgame-clockText").css("display", "inline");
  $("#msgame-stop").css("display", "none");
  $("#msgame-start").css("display", "block");
  clearInterval(si);
  ie = new Date();
  ifin = ie - it;
  $("#msgame-clockText").text(toMilliSec(ifin));
  finished(obj, ifin);
}

function clockUpdate() {
  ic = new Date();
  id = ic - it;
  ii = toMilliSec(id);
  $("#msgame-clockText").text(ii);
  if (obj * 1000 - id < 500 * cb && cb > 4 ) {
    $("#msgame-clockText").fadeOut();
  }
}

function toMilliSec(d) {
  return (Math.floor(d / 1000) + "\"" + ("" + d % 1000).padStart(3, "0")).padStart(6, "0");
}

function finished(a, b) {
  ath = a * 1000
  if (ath == b) {
    cbm = Math.floor(Math.pow(800, (1 + cb / 10)))
    $("#msgame-console").text("정확하시군요. " + cbm + " 점 드리겠습니다.");
    sc += cbm
    cb += 1
  } else if (Math.abs(ath - b) < 100) {
    cbm = Math.floor(Math.pow((500 / Math.abs(ath - b)), (1 + cb / 10)))
    $("#msgame-console").text("정확하시군요. " + cbm + " 점 드리겠습니다.");
    sc += cbm
    cb += 1
  } else {
    $("#msgame-console").text("안타깝습니다. 조금 더 노력해 보세요!");
    cb = 0
  }
  $("#msgame-score").text(sc);
  $("#msgame-combo").text(cb);
}
 // 여기까지 코드 입력 //

		
  }

}
$( plugin_msgame );
/* msgame 끝 */


/** 플러그인 uncyslide***************************
* 백괴슬라이드 실행
* 버전 => 1.1.0
* 작성자 : [[사용자:BANIP|BANIP]] 
* JSON => uncyslide = {"name":"uncyslide","descript":"백괴슬라이드 실행","version":"1.1.0","local":true,"creat":"BANIP","state":"백괴슬라이드/플러그인","executable":true}; 
*/ 
function plugin_uncyslide(){
  if($("[data-name='uncyslide']").length >= 1){
		 // 이부부분에 코드 입력 //
var slideable = plugin_Slideable();
var create = slideable.create;
var execute = slideable.execute;
var dispose = slideable.dispose;

var rankingSystem = plugin_RankingSystem()("백괴슬라이드/랭킹", function(prev,next){ return Number(prev.time) - Number(next.time)});
var outputKeys = {time:"소요시간"};
var startMap = localStorage.getItem("uncySlide/startmap") || 0;
var game = {
    0: {
        center: "아래로 밀어주세요.",
        bottom: 1
    },
    1: {
        center: "오른쪽으로 밀어보세요.",
        right: 2
    },
    2: {
        center: "어디로 밀어보실래요?",
        top: 3,
        bottom: 3,
    },
    3: {
        center: "반갑습니다. <br>백괴슬라이드입니다.",
        bottom: 4,
    },
    4: {
        center: "어디로 당기고 미느냐에 따라, 게임의 결과가 달라집니다.",
        bottom: 5,
    },
    5: {
        center: "는 개뿔 이겜 시스템만든다고 그런 장황한거 만들 정신머리는 없었습니다",
        bottom: 5.1,
    },
    5.1: {
        center: "진심 힘들었습니다.",
        bottom: 5.2,
    },
    5.2: {
        center: "잘했죠?",
        bottom: 5.3,
    },
    5.3: {
        center: "위로 밀어서 칭찬하거나 아래로 밀어서 욕해주세요.",
        top: 5.4,
        bottom: 5.5,
    },
    5.4: {
        center: "감사합니다. 헤헤",
        bottom: 6,
    },
    5.5: {
        center: "흑흑.. 힘들었는데..",
        bottom: 6,
    },
    6: {
        center: "그래도 미디어위키의 틀에서 벗어난 겜인만큼 최대한 나은 경험을 선사하고자 노력했습니다. 잘부탁드립니다.",
        bottom: function(){
            localStorage.setItem("uncySlide/startmap","main");
            execute("main");
        },
    },
    main: {
        center: "<ul><li>아래: 게임시작</li><li>토론: 위</li><li>설명: 오른쪽</li></ul>",
        bottom: function(){ execute("start",{count:100,time:Date.now()}) },
        top: "debate",
        right: "i0",
    },
    i0: {
        center:"가장자리에 화살표 보이죠?",
        bottom:"i1"
    },
    i1: {
        center:"화면을 넘겨서 드래그해서 진행하는 게임이에요.",
        bottom:"i2"
    },
    i2: {
        center:"원래라면 좀 큰 스케일의 게임으로 만들고 싶었는데..",
        bottom:"i3"
    },
    i3: {
        center:"제 역량이 겜 크기에서 다 드러나네요...",
        bottom:"i4"
    },
    i4: {
        center:"아무쪼록 힘들게 만들었으니 재밌게 즐겨주세요.",
        right:"main"
    },
    debate: function(){
        location.href = "https://game.uncyclopedia.kr/wiki/%ED%86%A0%EB%A1%A0:%EB%B0%B1%EA%B4%B4%EC%8A%AC%EB%9D%BC%EC%9D%B4%EB%93%9C";
    },
    start: function(arg){
        function getRandomDirection(){
            switch( Math.ceil(Math.random() * 4) ){
                case 1: return "top"; break;
                case 2: return "bottom"; break;
                case 3: return "left"; break;
                case 4: return "right"; break;
            }
        }
        function getColorCode(count,maxcount){
            var code = "hsl(" + count / maxcount * 360 +",100%,70%)";
            console.log(code);
            return code
        }
        
        var count = arg.count;
        var maxcount = arg.maxcount || count;
        var time = arg.time;
        var $this = $(this);
        var timerInterval;
        var slideableItem = {
            center: function(){
                var $this = $(this);
                $this.css({
                    "background": getColorCode(count,maxcount)
                });
                
                timerInterval = setInterval(function(){
                    var overtime = (Date.now() - time) * 0.001;
                    var printableTime = overtime.toFixed(2);
                    $this.find(".counter").html(printableTime + "초");
                },5)
                
                return "<div class='counter' style='font-size:5vw;'></div><div style='font-size:20vw;'>" + count + "</div>";
            }
        };

        slideableItem[getRandomDirection()] = function(){
            clearInterval(timerInterval);
            if(count === 1) return execute("result",{count:count - 1,time:time,maxcount:maxcount});
            execute("start",{count:count - 1,time:time,maxcount:maxcount}) 
        };

        create(slideableItem);
    },
    result: function(arg){
        var maxcount = arg.maxcount || count;
        var time = ( (Date.now() - arg.time) / 1000 ).toFixed(2);
        var updateParam = {
        	time: time,
        	name: mw.config.get("wgUserName")
        };
        rankingSystem.update(updateParam,function(rankingScore,thisScore){ return rankingScore.time > thisScore.time},outputKeys);

        create({
            center: "갯수: " + maxcount + " <br/>시간: " + time + "<ul><li>왼쪽: 메인으로</li><li>오른쪽: 토론으로</li></ul>",
            left:"main",
            right:"debate",
        });
    }
}
dispose(game, startMap, {});
		
  }

}
$( plugin_uncyslide );
/* uncyslide 끝 */



/** 플러그인 Slideable***************************
* 슬라이드 플러그인 라이브러리
* 버전 => 1.0.0
* 작성자 : [[사용자:BANIP|BANIP]] 
* JSON => Slideable = {"name":"Slideable","descript":"슬라이드 플러그인 라이브러리","version":"1.0.0","local":true,"creat":"BANIP","state":"사용자:BANIP/플러그인/슬라이드","executable":false}; 
*/ 
function plugin_Slideable(){
  if($("[data-name='Slideable']").length >= 1){
		 // 이부부분에 코드 입력 //
    //모든 키 순회
    function forEach(object, callback) {
        for (var key in object) {
            var variable = object[key];
            callback(variable, key);
        }
    }

function create(directionData) {
    function initClassName($target, data) {
        forEach(data, function(value, direction) {
            $target.find("." + direction).addClass("on");
        })
    }

    function initDOM($target, data) {
        $target[0].data = data;
        $target.find(".center").html(data.center);
        $target.find(".top.on").css("background","url('https://upload.wikimedia.org/wikipedia/commons/8/85/Arrow_top_svg.svg') no-repeat center");
        $target.find(".bottom.on").css("background","url('https://upload.wikimedia.org/wikipedia/commons/f/f2/Arrow_bottom_svg.svg') no-repeat center");
        $target.find(".left.on").css("background","url('https://upload.wikimedia.org/wikipedia/commons/4/40/Arrowleft_svg.svg') no-repeat center");
        $target.find(".right.on").css("background","url('https://upload.wikimedia.org/wikipedia/commons/9/96/Arrow2right_svg.svg') no-repeat center");
    }

    var slideUtil = {
        moveObject: function($this, axis) {
            var x = axis[0], y = axis[1];

            var data = $this[0].data;
            if (!data.right && x > 0) x = 0;
            if (!data.left && x < 0) x = 0;
            if (!data.top && y < 0) y = 0;
            if (!data.bottom && y > 0) y = 0;
            $this.css("transform", "translate(" + x + "px," + y + "px)");
        },
        isHideable: function($this, axis, limit) {
            var x = axis[0], y = axis[1];
            var data = $this[0].data;
            if (data.right && x > limit) return "right";
            if (data.left && x < limit * -1) return "left";
            if (data.bottom && y > limit) return "bottom";
            if (data.top && y < limit * -1) return "top";
        },
        hide: function(direction, $this) {
            function getCss(direction) {
                var css = {
                    opacity: 0.01
                };
                var interval = 50;
                switch (direction) {
                    case "left":
                        css.left = -1 * interval + "vw";
                        break;
                    case "right":
                        css.left = interval + "vw";
                        break;
                    case "bottom":
                        css.top = interval + "vh";
                        break;
                    case "top":
                        css.top = -1 * interval + "vh";
                        break;
                }

                return css;
            }

            var self = $this[0];
            var data = self.data;
            if (self.isHide === true) {
                return;
            }
            self.isHide = true;
            $this.animate(getCss(direction), {
                duration: 300,
                easing: "swing",
                start: data[direction],
                complete: function() {
                    $this.remove();
                }
            });
        }
    }

    function setEvent($target, data) {
        var util = slideUtil;
        var moveLimit = 50;

        $(".slideable").mousedown(function(e) {
            this.isMouseDown = true;
            this.startAxis = [e.clientX, e.clientY];
        })

        $(".slideable").mousemove(function(e) {
            if (this.isMouseDown) {
                event.preventDefault()
                var axis = [e.clientX, e.clientY];
                var startAxis = this.startAxis;
                var moveInterval = [axis[0] - startAxis[0], axis[1] - startAxis[1]]
                util.moveObject($(this), moveInterval);
                var hideDirection = util.isHideable($(this), moveInterval, moveLimit);
                console.log(hideDirection)
                if (hideDirection) util.hide(hideDirection, $(this));
            }
        })

        $(".slideable").mouseup(function(e) {
            this.isMouseDown = false;
        })

        function getTouchEvent(e) {
            return e.originalEvent.touches[0]
        }

        $(".slideable").on("touchstart", function(e) {
            var touch = getTouchEvent(e);

            this.isMouseDown = true;
            this.startAxis = [touch.clientX, touch.clientY];
        })

        $(".slideable").on("touchmove", function(e) {
            event.preventDefault()
            if (this.isMouseDown) {
                event.preventDefault()
                var touch = getTouchEvent(e);
                var axis = [touch.clientX, touch.clientY];
                var startAxis = this.startAxis;
                var moveInterval = [axis[0] - startAxis[0], axis[1] - startAxis[1]]
                util.moveObject($(this), moveInterval);
                var hideDirection = util.isHideable($(this), moveInterval, moveLimit);
                console.log(hideDirection)
                if (hideDirection) util.hide(hideDirection, $(this));
            }
        })

        $(".slideable").on("touchend", function(e) {
            this.isMouseDown = false;
        })

    }

    //슬라이드아이템의 방향키로 숫자 혹은 문자로 지정된 경우
    //함수로 변환
    function setExecutable(target, item){
        forEach(item,function(value,direction){
            new Promise(function(resolve, reject){
                 if(direction === "center"){
                    switch( typeof value ){
                    case "function":
                        resolve( value.bind(target)() );
                    break;
                  }
              } else {
                switch( typeof value ){
                    case "string": case "number":
                        resolve(function(){ execute(value); }.bind(target));
                    break;
                }
              }
            }).then(function(result){
                 item[direction] = result;
            })

        })
    }
    
    var $target = $(".slideable.cloneable").clone().removeClass("cloneable");
    $("body").prepend($target);
    setExecutable($target[0], directionData);
    initClassName($target, directionData);
    initDOM($target, directionData);
    setEvent($target, directionData);
}

// create는 다른 함수들에 의존하지 않음 //
var game;

function execute(number, argument) {
    dispose(game, number, argument);
}

function dispose(slideableArray, start, argument) {
    game = slideableArray;
    
    var slideableItem = slideableArray[start];
    console.log(slideableItem);
    switch (typeof slideableItem) {
        case "function":
            slideableItem(argument);
            break;
        case "object":
            create(slideableItem);
            break;
    }
}

//모바일 전체화면으로 수정
var setFullScreen = (function(){
    //window.scrollTo(0,1);
})();

return {
    create: create,
    execute: execute,
    dispose: dispose
}
		
  }

}
/* Slideable 끝 */


/** 플러그인 uncyrhythm***************************
* 플러그인 전체적 테스트. 리듬게임
* 버전 => 1.7.3.4
* 작성자 : [[사용자:BANIP|BANIP]] 
* JSON => uncyrhythm = {"name":"uncyrhythm","descript":"플러그인 전체적 테스트. 리듬게임","version":"1.7.3.4","local":true,"creat":"BANIP","state":"백괴리겜/플레이/uncyrhythm","executable":true}; 
*/ 
function plugin_uncyrhythm(){
  if($("[data-name='uncyrhythm']").length >= 1){
		 $("#mw-content-text").prepend("<audio controls class='gameaudio hide'><source src='https://s0.vocaroo.com/media/download_temp/Vocaroo_s0OAXRN8eUas.mp3'></audio>");
$("#mw-content-text").prepend("<svg class='note cloneable' width='50px' height='50px'><circle cx=25 cy=25 r=25 /></svg>");
var rankingSystem = plugin_RankingSystem()("백괴리겜/랭킹", function(prev, next) {
    return Number(next.score) - Number(prev.score)
});

var noteInfo = [[2088,0],[2156,2],[2223,1],[2291,2],[2358,3],[2426,2],[2493,1],[2561,0],[2628,1],[2696,2],[2763,1],[2831,2],[2898,3],[2966,2],[3033,1],[3101,0],[3168,1],[3236,2],[3303,1],[3371,2],[3438,3],[3506,2],[3573,1],[3641,0],[3708,1],[3776,2],[3843,1],[3911,2],[3978,3],[4046,2],[4113,1],[4181,0],[4248,1],[4248,3],[4316,2],[4383,1],[4451,2],[4518,3],[4586,2],[4653,1],[4721,0],[4788,1],[4856,2],[4923,1],[4991,2],[5059,3],[5126,2],[5195,1],[5261,0],[5329,1],[5396,2],[5464,1],[5531,2],[5599,3],[5666,2],[5734,1],[5801,0],[5869,1],[5936,2],[6004,3],[6071,1],[6139,2],[6206,3],[6274,1],[6341,2],[6409,1],[6409,0],[6476,2],[6544,1],[6611,2],[6679,3],[6746,2],[6814,1],[6881,0],[6949,1],[7016,2],[7084,1],[7151,2],[7219,3],[7286,2],[7354,1],[7421,0],[7489,1],[7556,2],[7624,1],[7691,2],[7759,3],[7826,2],[7894,1],[7961,0],[8029,1],[8096,2],[8164,1],[8231,2],[8299,3],[8366,2],[8434,1],[8501,0],[8569,1],[8569,3],[8636,2],[8704,1],[8771,2],[8839,3],[8906,2],[8974,1],[9041,0],[9109,1],[9109,3],[9176,2],[9244,1],[9311,2],[9379,3],[9446,2],[9514,1],[9581,0],[9649,1],[9649,3],[9716,2],[9784,1],[9851,2],[9919,3],[9919,0],[9986,2],[10054,1],[10121,2],[10189,0],[10256,3],[10324,0],[10391,3],[10459,1],[10526,2],[10594,1],[10661,2],[10729,1],[10729,0],[10796,2],[10864,1],[10931,3],[10999,1],[10999,0],[11066,2],[11134,1],[11201,3],[11269,0],[11336,2],[11404,1],[11471,3],[11539,1],[11539,0],[11606,3],[11674,1],[11741,2],[11809,0],[11876,2],[11944,1],[12011,3],[12079,0],[12079,1],[12146,2],[12214,1],[12281,3],[12349,0],[12416,3],[12484,1],[12551,2],[12619,0],[12619,1],[12686,2],[12754,1],[12821,3],[12889,1],[12889,0],[12956,3],[13024,2],[13091,0],[13159,1],[13226,3],[13294,2],[13361,0],[13429,1],[13496,2],[13564,1],[13631,3],[13699,1],[13699,0],[13766,2],[13834,1],[13901,3],[13969,0],[14036,2],[14104,1],[14171,3],[14239,1],[14239,0],[14306,2],[14374,1],[14441,3],[14509,1],[14509,0],[14576,3],[14644,1],[14711,0],[14711,2],[14779,1],[14846,3],[14914,1],[14914,0],[14981,2],[15049,1],[15049,0],[15116,3],[15184,1],[15251,2],[15319,0],[15319,1],[15386,2],[15454,1],[15521,3],[15589,0],[15656,2],[15724,1],[15791,3],[15859,0],[15859,1],[15926,2],[15994,1],[15994,0],[16061,3],[16129,0],[16196,2],[16264,1],[16264,0],[16331,3],[16399,1],[16399,0],[16466,3],[16534,1],[16601,2],[16669,1],[16669,0],[16736,3],[16804,2],[16804,1],[16871,0],[16939,2],[16939,3],[17006,1],[17074,3],[17141,2],[17209,0],[17209,1],[17276,3],[17344,1],[17411,2],[17479,0],[17546,2],[17614,1],[17681,3],[17749,0],[17749,1],[17816,3],[17884,1],[17951,2],[18019,0],[18086,2],[18154,1],[18221,3],[18289,1],[18289,0],[18356,2],[18424,3],[18491,2],[18559,1],[18559,0],[18626,3],[18694,2],[18761,1],[18829,2],[18829,3],[18896,1],[18964,0],[19031,1],[19099,2],[19166,1],[19234,0],[19301,1],[19369,2],[19369,3],[19436,0],[19504,3],[19571,1],[19639,2],[19639,3],[19706,1],[19774,2],[19841,0],[19909,2],[19976,1],[20044,3],[20111,0],[20179,2],[20179,3],[20246,0],[20314,2],[20381,1],[20449,3],[20516,0],[20584,2],[20651,0],[20719,2],[20719,3],[20786,0],[20854,3],[20921,1],[20989,3],[21056,0],[21124,2],[21191,1],[21259,2],[21259,3],[21326,0],[21394,2],[21461,1],[21529,3],[21529,0],[21596,1],[21664,2],[21731,1],[21799,2],[21799,3],[21866,1],[21934,2],[22001,0],[22069,2],[22136,1],[22204,3],[22271,0],[22339,3],[22339,2],[22406,0],[22474,2],[22541,1],[22609,3],[22676,1],[22744,2],[22811,0],[22879,2],[22879,3],[22946,0],[23014,2],[23081,1],[23149,2],[23149,3],[23216,0],[23284,1],[23351,2],[23351,3],[23419,1],[23486,0],[23554,2],[23554,3],[23621,1],[23689,2],[23689,3],[23756,0],[23824,3],[23891,1],[23959,2],[23959,3],[24026,1],[24094,2],[24161,0],[24229,3],[24296,1],[24364,2],[24431,0],[24499,2],[24499,3],[24566,1],[24634,2],[24634,3],[24701,0],[24769,3],[24836,1],[24904,2],[24904,3],[24971,0],[25039,2],[25039,3],[25106,1],[25174,2],[25241,0],[25309,2],[25309,3],[25376,0],[25444,1],[25444,2],[25511,3],[25579,1],[25579,0],[25646,2],[25714,3],[25781,2],[25849,0],[25916,1],[25984,2],[26051,3],[26119,0],[26186,1],[26254,2],[26321,3],[26389,0],[26456,1],[26524,2],[26591,3],[26659,0],[26726,1],[26794,2],[26861,3],[26929,0],[26996,3],[27064,1],[27131,2],[27199,0],[27266,3],[27334,1],[27401,2],[27469,0],[27536,3],[27604,1],[27671,2],[27739,0],[27806,3],[27874,1],[27941,2],[28009,1],[28009,0],[28549,2],[29089,1],[29629,0],[30169,3],[30709,2],[31249,0],[31519,0],[31789,1],[31924,2],[32059,2],[32194,3],[32329,3],[32869,1],[33139,2],[33409,3],[33679,2],[33949,1],[34219,0],[34489,3],[34759,2],[35029,1],[35299,2],[35569,1],[36109,0],[36649,0],[36649,2],[36649,3],[36919,1],[37189,2],[37459,3],[37729,2],[37819,3],[37909,2],[37999,1],[38269,2],[38539,1],[38809,3],[38809,2],[38809,0],[39079,1],[39349,2],[39619,0],[39889,3],[40159,2],[40429,1],[40699,2],[40969,3],[40969,1],[40969,0],[41509,1],[41711,1],[41914,2],[42049,0],[42049,1],[42049,3],[42319,2],[42589,3],[42589,2],[42589,0],[42791,1],[42926,2],[43129,0],[43129,3],[43129,2],[43669,0],[43669,1],[43804,3],[43939,1],[43939,0],[44074,2],[44209,1],[44209,2],[44209,3],[44209,0],[44479,1],[44479,0],[44479,2],[44479,3],[44749,1],[44749,0],[44749,3],[44749,2],[45019,1],[45019,2],[45019,3],[45019,0],[45289,0],[45356,1],[45424,2],[45491,3],[45559,0],[45626,1],[45694,2],[45761,3],[45829,0],[45896,1],[45964,2],[46031,3],[46099,0],[46166,1],[46234,2],[46301,3],[46369,0],[46436,3],[46504,1],[46571,2],[46639,0],[46706,3],[46774,1],[46841,2],[46909,0],[46976,3],[47044,1],[47111,2],[47179,0],[47246,3],[47314,1],[47381,2],[47449,1],[47449,0],[47516,2],[47584,1],[47651,0],[47719,2],[47719,3],[47786,1],[47854,2],[47921,0],[47989,2],[47989,3],[48058,1],[48125,3],[48193,0],[48260,3],[48260,2],[48328,0],[48395,2],[48463,1],[48530,2],[48530,3],[48598,1],[48665,3],[48733,0],[48800,2],[48800,3],[48868,1],[48935,2],[49003,1],[49070,0],[49070,3],[49138,1],[49205,2],[49273,1],[49340,2],[49340,3],[49408,0],[49475,1],[49543,0],[49610,2],[49610,3],[49678,1],[49745,2],[49813,0],[49880,1],[49880,2],[49948,0],[50015,3],[50083,0],[50150,2],[50150,3],[50218,0],[50285,2],[50353,1],[50420,2],[50420,3],[50488,0],[50555,3],[50623,1],[50690,3],[50690,2],[50758,1],[50825,2],[50893,0],[50960,1],[50960,3],[51028,0],[51095,2],[51163,0],[51230,1],[51230,2],[51298,0],[51365,3],[51433,0],[51500,3],[51500,2],[51568,0],[51635,2],[51703,1],[51770,2],[51770,3],[51838,1],[51905,2],[51973,0],[52040,1],[52108,0],[52175,3],[52243,1],[52310,2],[52310,3],[52378,0],[52445,3],[52513,1],[52580,2],[52580,3],[52648,0],[52715,1],[52783,0],[52850,2],[52850,3],[52918,0],[52985,2],[53053,1],[53120,2],[53120,3],[53188,0],[53255,1],[53323,2],[53390,3],[53390,1],[53458,0],[53525,2],[53593,0],[53660,2],[53660,3],[53728,1],[53795,2],[53863,1],[53930,2],[53930,3],[53998,0],[54065,2],[54133,1],[54200,2],[54200,3],[54268,0],[54335,2],[54403,3],[54470,2],[54470,1],[54538,0],[54605,2],[54673,1],[54740,2],[54740,3],[54808,1],[54875,3],[54943,0],[55010,3],[55078,1],[55145,2],[55213,0],[55280,2],[55280,3],[55348,1],[55415,0],[55483,1],[55550,2],[55550,3],[55618,0],[55685,1],[55753,0],[55820,2],[55820,3],[55888,0],[55955,1],[56023,2],[56023,3],[56090,1],[56090,0],[56158,3],[56225,1],[56293,2],[56360,0],[56428,3],[56495,1],[56563,2],[56630,1],[56630,0],[56698,3],[56765,2],[56833,1],[56900,2],[56900,0],[56968,3],[57035,1],[57103,2],[57170,1],[57170,0],[57238,2],[57305,1],[57373,3],[57440,2],[57440,1],[57508,3],[57575,2],[57643,3],[57710,1],[57710,0],[57778,3],[57845,1],[57913,2],[57980,1],[57980,0],[58048,2],[58115,0],[58183,3],[58250,2],[58250,1],[58318,3],[58385,0],[58453,2],[58520,1],[58520,0],[58588,3],[58655,2],[58723,3],[58790,1],[58790,0],[58858,3],[58925,1],[58993,2],[59060,1],[59060,0],[59128,2],[59195,0],[59263,3],[59330,1],[59330,0],[59398,2],[59465,1],[59533,3],[59600,2],[59600,0],[59668,3],[59735,1],[59803,2],[59870,1],[59870,0],[59938,2],[60005,1],[60073,3],[60140,2],[60140,1],[60208,3],[60275,0],[60343,1],[60410,2],[60410,3],[60478,1],[60545,0],[60613,3],[60680,1],[60680,2],[60748,3],[60815,2],[60883,3],[60950,0],[60950,1],[61018,3],[61085,2],[61153,0],[61220,1],[61220,2],[61288,3],[61355,0],[61423,2],[61490,0],[61490,1],[61558,2],[61625,1],[61693,3],[61760,2],[61760,0],[61828,3],[61895,1],[61963,2],[62030,1],[62030,0],[62098,3],[62165,0],[62233,1],[62300,3],[62300,2],[62368,1],[62435,0],[62503,3],[62570,1],[62570,0],[62705,1],[62705,2],[62840,2],[62840,3],[62975,2],[62975,1],[63110,1],[63110,0],[63245,1],[63245,2],[63380,2],[63380,3],[63515,2],[63515,1],[63650,0],[63650,1],[63785,2],[63785,3],[63920,1],[63920,0],[64055,2],[64055,3],[64190,0],[64190,2],[64325,3],[64325,0],[64460,3],[64460,1],[64595,3],[64595,0],[64730,0],[64730,1],[64798,2],[64865,3],[64933,1],[64933,0],[65000,2],[65068,1],[65135,2],[65135,3],[65203,0],[65270,1],[65338,2],[65338,3],[65405,1],[65473,2],[65540,1],[65540,0],[65675,2],[65675,3],[65810,1],[65810,2],[65878,3],[65945,0],[66013,2],[66013,3],[66080,1],[66148,2],[66215,1],[66215,0],[66283,2],[66350,1],[66418,2],[66418,3],[66485,0],[66553,2],[66620,1],[66620,0],[66755,2],[66755,1],[66890,2],[66890,3],[66958,1],[67025,2],[67093,1],[67093,0],[67160,2],[67228,1],[67295,2],[67295,3],[67363,0],[67430,2],[67498,1],[67498,0],[67565,3],[67633,1],[67700,2],[67700,3],[67835,0],[67835,1],[67970,3],[67970,2],[68038,0],[68105,2],[68173,1],[68173,0],[68240,2],[68308,3],[68375,0],[68375,1],[68510,1],[68510,2],[68645,2],[68645,3],[68780,1],[68780,0],[68915,2],[68915,3],[69050,1],[69050,0],[69118,2],[69185,1],[69253,2],[69253,3],[69320,1],[69388,3],[69455,2],[69455,1],[69523,3],[69590,1],[69590,0],[69658,2],[69725,1],[69725,0],[69860,3],[69860,2],[69928,1],[69995,2],[69995,3],[70131,0],[70131,2],[70198,1],[70266,2],[70266,0],[70401,3],[70401,1],[70468,2],[70536,1],[70536,3],[70671,1],[70671,2],[70738,0],[70806,1],[70806,2],[70941,2],[70941,1],[71008,3],[71076,2],[71076,1],[71211,0],[71211,2],[71278,1],[71346,0],[71346,2],[71481,3],[71481,1],[71548,2],[71616,3],[71616,1],[71751,1],[71751,0],[71818,2],[71886,1],[71886,0],[72021,3],[72021,2],[72088,1],[72156,2],[72156,3],[72291,2],[72291,1],[72358,0],[72426,3],[72493,2],[72493,1],[72561,3],[72628,0],[72696,2],[72696,3],[72763,1],[72831,2],[72898,1],[72898,0],[72966,3],[73033,1],[73101,2],[73101,3],[73236,2],[73236,1],[73371,0],[73371,2],[73506,2],[73506,0],[73641,3],[73641,0],[73776,3],[73776,0],[73911,3],[73911,1],[74046,3],[74046,1],[74181,3],[74181,0],[74316,3],[74316,0],[74451,0],[74451,1],[74541,2],[74541,3],[74631,1],[74631,0],[74721,2],[74721,3],[74856,2],[74991,3],[75058,2],[75126,0],[75193,3],[75261,2],[75328,0],[75396,3],[75531,1],[75531,0],[75531,2],[75666,1],[75666,2],[75801,2],[75801,3],[75936,3],[75936,2],[76071,2],[76071,3],[76206,2],[76206,3],[76341,2],[76341,0],[76476,2],[76476,0],[76611,2],[76611,2],[76611,0],[76746,2],[76746,2],[76881,2],[76881,3],[76881,2],[77016,3],[77016,2],[77151,0],[77151,2],[77151,2],[77286,2],[77286,0],[77421,2],[77421,3],[77421,2],[77556,3],[77556,2],[77691,3],[77691,2],[77758,0],[77826,3],[77893,2],[77893,0],[77961,2],[78028,2],[78096,3],[78096,2],[78163,2],[78231,3],[78298,2],[78298,0],[78366,2],[78501,2],[78501,0],[78636,2],[78636,2],[78771,2],[78771,3],[78838,0],[78906,2],[78906,2],[78973,3],[79041,2],[79041,0],[79108,3],[79176,2],[79176,2],[79243,3],[79311,2],[79311,0],[79378,2],[79446,0],[79513,2],[79513,3],[79581,2],[79648,2],[79716,2],[79716,0],[79851,2],[79851,3],[79918,0],[79986,3],[80053,0],[80053,2],[80121,2],[80188,3],[80256,2],[80256,0],[80323,3],[80391,2],[80458,2],[80458,3],[80526,0],[80593,2],[80661,2],[80661,3],[80796,2],[80796,2],[80931,2],[80931,3],[80931,2],[81066,2],[81066,2],[81201,2],[81201,3],[81201,0],[81336,0],[81336,2],[81471,0],[81471,2],[81471,2],[81606,2],[81606,0],[81741,3],[81741,2],[81741,0],[81876,2],[81876,0],[81876,3],[82011,3],[82011,2],[82011,2],[82011,0],[82146,0],[82281,1],[82416,2],[82551,2],[82686,2],[82821,2],[82956,1],[83091,2],[83226,2],[83361,2],[83496,1],[83631,3],[83766,3],[83901,3],[84036,1],[84171,2],[84306,1],[84441,0],[84576,1],[84711,2],[84846,1],[84981,2],[85116,3],[85251,0],[85386,1],[85521,2],[85656,3],[85791,3],[85926,3],[86061,2],[86196,1],[86331,0],[86466,0],[86601,1],[86736,2],[86871,2],[87006,2],[87141,2],[87276,1],[87411,2],[87546,3],[87681,3],[87816,3],[87951,3],[88086,2],[88221,1],[88356,0],[88491,0],[88626,0],[88761,1],[88896,2],[89031,2],[89166,3],[89301,3],[89436,3],[89571,0],[89706,2],[89841,2],[89976,3],[90111,2],[90111,2],[90111,0],[90381,2],[90381,3],[90381,2],[90651,0],[90651,2],[90651,2],[90651,3],[90786,0],[90921,2],[91056,2],[91191,2],[91326,2],[91461,2],[91596,2],[91731,2],[91866,2],[92001,2],[92136,3],[92271,3],[92406,3],[92541,3],[92676,2],[92811,2],[92811,3],[92811,0],[92946,2],[93081,0],[93216,2],[93351,2],[93486,2],[93621,2],[93756,3],[93891,0],[94026,1],[94161,2],[94296,3],[94431,3],[94566,3],[94701,2],[94836,1],[94971,0],[94971,2],[94971,3],[95106,0],[95241,1],[95376,2],[95511,2],[95646,2],[95781,2],[95916,1],[96051,2],[96051,3],[96051,0],[96186,2],[96321,2],[96456,3],[96591,1],[96591,2],[96591,0],[96726,3],[96861,3],[96861,0],[96996,2],[97131,1],[97131,3],[97266,0],[97401,0],[97401,3],[97536,0],[97671,1],[97671,3],[97806,2],[97941,2],[97941,3],[98076,3],[98211,3],[98211,2],[98211,1],[98211,0],[98346,0],[98481,0],[98616,0],[98751,0],[98886,0],[99021,0],[99156,0],[99291,0],[99291,1],[99291,2],[99291,3],[99426,0],[99426,1],[99561,1],[99561,0],[99696,1],[99696,0],[99831,1],[99831,0],[99966,1],[99966,0],[100101,1],[100101,0],[100236,1],[100236,0],[100371,1],[100371,2],[100371,0],[100371,3],[100506,1],[100506,2],[100506,0],[100641,2],[100641,1],[100641,0],[100776,2],[100776,1],[100776,0],[100911,2],[100911,1],[100911,0],[101046,2],[101046,1],[101046,0],[101181,2],[101181,1],[101181,0],[101316,2],[101316,1],[101316,0],[101451,2],[101451,1],[101451,0],[101451,3],[101586,1],[101586,2],[101586,0],[101586,3],[101721,2],[101721,3],[101721,1],[101721,0],[101856,2],[101856,3],[101856,1],[101856,0],[101991,2],[101991,3],[101991,1],[101991,0],[102126,2],[102126,3],[102126,1],[102126,0],[102261,2],[102261,3],[102261,1],[102261,0],[102396,2],[102396,3],[102396,1],[102396,0],[102531,0],[102531,2],[102531,3],[102666,0],[102801,0],[102936,0],[103071,0],[103206,0],[103341,0],[103476,0],[103611,0],[103611,2],[103611,3],[103746,2],[103746,0],[103881,2],[103881,0],[104016,2],[104016,0],[104151,2],[104151,0],[104286,2],[104286,0],[104421,2],[104421,0],[104556,2],[104556,0],[104691,2],[104691,3],[104691,0],[104826,0],[104826,2],[104826,3],[104961,0],[104961,2],[104961,3],[105096,0],[105096,2],[105096,3],[105231,0],[105231,2],[105231,3],[105366,2],[105366,0],[105366,3],[105501,0],[105501,2],[105501,3],[105636,0],[105636,2],[105636,3],[105771,3],[105771,0],[105838,2],[105838,1],[105906,0],[105906,3],[105973,2],[105973,1],[106041,3],[106041,0],[106108,2],[106108,1],[106176,3],[106176,0],[106243,2],[106243,1],[106311,3],[106311,0],[106378,2],[106378,1],[106446,3],[106446,0],[106513,2],[106513,1],[106581,3],[106581,0],[106648,2],[106648,1],[106716,3],[106716,0],[106783,2],[106783,1],[106851,3],[106851,0],[106918,2],[106986,0],[107053,2],[107121,3],[107188,2],[107256,0],[107323,2],[107391,3],[107458,2],[107526,0],[107593,2],[107661,3],[107661,0],[107931,2],[107931,3],[107931,0],[107998,1],[108066,2],[108133,1],[108133,0],[108201,3],[108268,1],[108336,2],[108403,3],[108403,0],[108471,2],[108538,1],[108538,0],[108606,2],[108673,0],[108741,1],[108741,3],[108876,1],[108876,0],[109011,2],[109011,3],[109078,0],[109146,1],[109213,2],[109213,3],[109281,0],[109348,3],[109416,1],[109416,0],[109483,2],[109551,0],[109618,1],[109618,2],[109686,0],[109753,3],[109821,1],[109821,0],[109956,3],[109956,2],[110091,0],[110091,1],[110158,2],[110226,0],[110293,1],[110293,3],[110361,0],[110428,2],[110496,1],[110496,0],[110563,3],[110631,1],[110698,2],[110698,3],[110766,0],[110833,3],[110901,1],[110901,0],[111036,3],[111036,2],[111171,0],[111171,1],[111238,2],[111306,0],[111373,2],[111373,3],[111441,1],[111508,2],[111576,1],[111576,0],[111711,1],[111711,2],[111846,2],[111846,3],[111981,1],[111981,0],[112116,3],[112116,2],[112251,0],[112251,1],[112318,3],[112386,1],[112453,2],[112453,3],[112521,0],[112588,3],[112656,2],[112656,1],[112723,0],[112791,2],[112791,3],[112858,1],[112926,2],[112926,3],[113061,0],[113061,1],[113128,2],[113196,1],[113196,0],[113331,3],[113331,1],[113398,2],[113466,3],[113466,1],[113601,0],[113601,2],[113668,1],[113736,2],[113736,0],[113871,2],[113871,1],[113938,3],[114006,2],[114006,1],[114141,1],[114141,2],[114208,0],[114276,1],[114276,2],[114411,3],[114411,1],[114478,2],[114546,1],[114546,3],[114681,0],[114681,2],[114748,1],[114816,0],[114816,2],[114951,2],[114951,3],[115018,1],[115086,2],[115086,3],[115221,0],[115221,1],[115288,2],[115356,1],[115356,0],[115491,3],[115491,2],[115558,0],[115626,3],[115693,1],[115693,0],[115761,2],[115828,0],[115896,2],[115896,3],[115963,0],[116031,1],[116098,2],[116098,3],[116166,0],[116233,3],[116301,1],[116301,0],[116436,3],[116436,2],[116571,1],[116571,2],[116571,0],[116706,2],[116706,1],[116841,2],[116841,3],[116841,0],[116976,3],[116976,2],[117111,2],[117111,3],[117111,1],[117246,2],[117246,3],[117381,2],[117381,3],[117381,0],[117516,3],[117516,2],[117651,0],[117651,1],[117741,2],[117741,3],[117831,1],[117831,0],[117921,2],[117921,3],[118056,2],[118191,3],[118258,2],[118326,0],[118393,3],[118461,2],[118528,0],[118596,3],[118731,0],[118731,1],[118731,2],[118866,2],[118866,1],[119001,2],[119001,3],[119001,0],[119136,3],[119136,2],[119271,2],[119271,3],[119271,1],[119406,2],[119406,3],[119541,2],[119541,1],[119541,0],[119676,2],[119676,1],[119811,2],[119811,1],[119811,3],[119946,3],[119946,2],[120081,0],[120081,1],[120081,2],[120216,0],[120216,1],[120351,2],[120351,3],[120351,1],[120486,1],[120486,2],[120621,0],[120621,1],[120621,2],[120756,2],[120756,1],[120891,3],[121431,0],[121634,0],[121836,1],[121971,2],[122511,2],[122714,3],[123051,2],[123726,2],[123861,3],[123996,2],[124131,0],[124131,1],[124131,3],[124401,1],[124401,0],[124401,3],[124671,1],[124671,0],[124671,2],[124941,1],[124941,0],[124941,2],[125211,0],[125211,2],[125211,3],[125279,1],[125346,3],[125414,1],[125414,0],[125481,2],[125549,0],[125616,1],[125616,3],[125684,2],[125751,1],[125819,3],[125819,0],[125886,1],[125954,0],[126021,1],[126021,3],[126021,2],[126156,1],[126156,2],[126291,3],[126291,0],[126291,2],[126359,1],[126426,0],[126494,2],[126494,3],[126561,1],[126629,2],[126696,3],[126696,0],[126764,1],[126831,2],[126899,3],[126899,0],[126966,1],[126966,2],[127034,0],[127101,1],[127101,3],[127101,2],[127236,2],[127236,0],[127371,3],[127371,1],[127371,0],[127439,2],[127506,0],[127574,1],[127574,3],[127641,0],[127709,2],[127776,1],[127776,0],[127844,3],[127844,2],[127911,0],[127979,1],[127979,2],[128046,3],[128114,0],[128181,2],[128181,3],[128316,0],[128316,1],[128451,3],[128451,2],[128451,0],[128519,1],[128586,3],[128654,2],[128654,0],[128721,3],[128789,0],[128856,2],[128856,1],[128991,1],[128991,0],[128991,2],[129126,3],[129126,2],[129126,0],[129261,3],[129261,2],[129261,1],[129396,2],[129396,3],[129396,0],[129531,2],[129531,1],[129531,3],[129599,0],[129666,2],[129734,0],[129734,1],[129801,2],[129869,3],[129936,2],[129936,1],[130004,0],[130071,1],[130071,2],[130071,3],[130139,0],[130206,1],[130206,2],[130206,3],[130341,1],[130341,0],[130341,2],[130409,3],[130476,2],[130476,1],[130476,0],[130611,3],[130611,1],[130611,0],[130679,2],[130746,3],[130746,1],[130746,0],[130881,2],[130881,0],[130881,3],[130949,1],[131016,2],[131016,3],[131016,0],[131151,3],[131151,2],[131219,1],[131219,0],[131286,3],[131286,2],[131421,0],[131421,1],[131489,2],[131489,3],[131556,1],[131556,0],[131691,3],[131691,1],[131759,2],[131759,0],[131826,1],[131826,3],[131961,0],[131961,2],[132029,1],[132029,3],[132096,2],[132096,0],[132231,0],[132231,3],[132299,2],[132299,1],[132366,3],[132366,0],[132501,2],[132501,1],[132569,0],[132569,3],[132636,1],[132636,2],[132771,2],[132771,3],[132771,1],[132839,0],[132906,2],[132974,1],[132974,0],[133041,3],[133109,2],[133176,1],[133176,0],[133244,2],[133311,0],[133379,1],[133379,2],[133446,3],[133514,0],[133581,1],[133581,2],[133581,3],[133716,2],[133716,3],[133851,3],[133851,0],[133851,2],[133986,2],[133986,3],[134121,0],[134121,1],[134121,2],[134256,2],[134256,1],[134391,2],[134391,3],[134391,0],[134526,2],[134526,3],[134661,3],[134661,2],[134661,1],[134796,2],[134796,3],[134931,1],[134931,0],[135021,2],[135021,3],[135111,1],[135111,0],[135201,2],[135201,3],[135336,2],[135336,1],[135471,3],[135539,2],[135606,0],[135674,3],[135741,2],[135809,0],[135876,3],[136011,0],[136011,1],[136011,2],[136146,1],[136146,0],[136281,2],[136281,3],[136281,0],[136416,2],[136416,0],[136551,3],[136551,2],[136551,1],[136686,1],[136686,2],[136821,1],[136821,0],[136821,2],[136956,1],[136956,0],[137091,3],[137091,1],[137091,2],[137226,1],[137226,2],[137226,3],[137361,3],[137361,2],[137361,0],[137496,2],[137496,3],[137496,0],[137631,0],[137631,1],[137631,2],[137766,2],[137766,1],[137766,0],[137901,2],[137901,0],[137901,3],[138036,2],[138036,3],[138036,0],[138171,3],[138171,2],[138171,0],[138239,1],[138306,0],[138374,2],[138374,1],[138441,3],[138509,2],[138576,1],[138576,0],[138644,2],[138711,1],[138779,0],[138779,2],[138779,3],[138846,1],[138914,0],[138981,1],[138981,2],[139049,3],[139116,2],[139116,1],[139184,0],[139251,1],[139251,2],[139319,3],[139386,1],[139386,0],[139454,3],[139521,2],[139521,1],[139589,0],[139656,1],[139656,3],[139724,2],[139791,1],[139791,3],[139791,0],[139859,2],[139926,0],[139994,1],[139994,3],[140061,2],[140129,0],[140196,1],[140196,2],[140331,2],[140331,3],[140331,0],[140399,1],[140466,0],[140534,1],[140534,2],[140601,3],[140669,0],[140736,1],[140736,2],[140804,3],[140871,0],[140939,1],[140939,3],[141006,2],[141074,1],[141141,2],[141141,3],[141141,0],[141209,1],[141276,2],[141276,3],[141344,0],[141411,1],[141411,3],[141411,2],[141546,2],[141546,3],[141546,1],[141681,3],[141681,2],[141681,0],[141816,3],[141816,2],[141816,0],[141951,2],[141951,0],[141951,1],[142086,2],[142086,1],[142086,0],[142221,2],[142221,3],[142221,0],[142356,3],[142356,2],[142356,0],[142491,1],[142491,0],[142559,3],[142626,2],[142694,3],[142761,0],[142829,2],[142896,1],[142964,3],[143031,1],[143099,3],[143166,0],[143234,2],[143301,1],[143369,3],[143436,2],[143504,3],[143571,0],[143571,1],[143639,2],[143706,0],[143774,1],[143841,3],[143841,2],[143909,0],[143976,1],[144044,3],[144111,1],[144111,0],[144179,2],[144246,1],[144314,0],[144381,2],[144381,3],[144449,1],[144516,2],[144584,3],[144651,1],[144651,0],[144719,3],[144786,1],[144786,2],[144854,3],[144921,2],[144921,0],[144989,1],[145056,0],[145056,3],[145124,1],[145191,2],[145191,0],[145191,3],[145259,1],[145326,2],[145326,3],[145326,0],[145394,1],[145461,0],[145461,2],[145529,3],[145596,2],[145596,1],[145664,3],[145731,1],[145731,0],[145799,2],[145799,3],[145866,1],[145866,0],[145934,2],[145934,3],[146001,1],[146001,0],[146069,2],[146069,3],[146136,1],[146136,0],[146204,2],[146204,3],[146271,1],[146271,0],[146339,2],[146339,3],[146406,1],[146406,0],[146474,2],[146474,3],[146541,1],[146541,0],[146609,2],[146609,3],[146676,1],[146676,0],[146744,2],[146744,3],[146811,1],[146811,0]]; 
var nowTime = 0,
    interval = 1000,
    offset = 1350,
    perpectTop = 465,
    speed = 600;
var playInterval;

function showMessage(pclass, descript) {
    var mes = $(".cloneable.message").clone();
    mes.text(descript);
    mes[0].classList.remove("cloneable");
    mes[0].classList.add(pclass);
    mes.appendTo("#display");
    mes.animate({
        "top": "350px",
        "opacity": "0"
    }, "slow", "swing", function() {
        $(this).remove();
    });
}

function pushnote(pclass) {
    $(pclass + ".key-intro")[0].classList.add("push");
    var note = $(pclass + ".note:first")
    var timing = note.css("top").toString().replace("px", "");
    /*
	$(pclass+".note").each(function(){
		var thisTimeing = $(this).css("top").toString().replace("px","");
		if(thisTimeing > timing && thisTimeing < perpectTop+100){
			note = $(this);
			timing = thisTimeing;
		}
	})
*/

    if (timing == undefined) return;
    pclass = pclass.substring(1);
    if (perpectTop - 30 < timing && perpectTop + 30 > timing) {
        $(".n-great").text(function(i, v) {
            return parseInt(v) + 1
        });
        $(".n-score").text(function(i, v) {
            return parseInt(v) + 2
        });
        addCombo(true);
        showMessage(pclass, "따봉!!");

        note[0].classList.add("pushed");
        note.remove();
    } else if (perpectTop - 130 < timing && perpectTop + 130 > timing) {
        $(".n-good").text(function(i, v) {
            return parseInt(v) + 1
        });
        $(".n-score").text(function(i, v) {
            return parseInt(v) + 1
        });
        addCombo(true);
        showMessage(pclass, "굿잡!!");

        note[0].classList.add("pushed");
        note.remove();
    } else if (perpectTop - 170 < timing && perpectTop + 170 > timing) {
        $(".n-miss").text(function(i, v) {
            return parseInt(v) + 1
        });
        addCombo(false);
        showMessage(pclass, "이런..");

        note[0].classList.add("pushed");
        note.remove();
    }
}

function addCombo(status) {
    if (status == true) {
        $(".combo").text(function(i, v) {
            return parseInt(v) + 1
        });
        var combo = parseInt($(".combo").text());
        $(".n-maxcombo").text(function(i, v) {
            var maxcombo;
            if (parseInt(v) < combo) {
                maxcombo = combo;
            } else {
                maxcombo = parseInt(v);
            }
            return maxcombo;
        });
    } else {
        $(".combo").text(0);
    }
}
$("bo" + "dy").on("keydown", function(e) {
    switch (e.keyCode) {
        case 90:
            pushnote(".position-0");
            break;
        case 88:
            pushnote(".position-1");
            break;
        case 190:
            pushnote(".position-2");
            break;
        case 191:
            pushnote(".position-3");
            break;
    }
});

$("bo" + "dy").on("keyup", function(e) {
    switch (e.keyCode) {
        case 90:
            $(".position-0.key-intro")[0].classList.remove("push");
            break;
        case 88:
            $(".position-1.key-intro")[0].classList.remove("push");
            break;
        case 190:
            $(".position-2.key-intro")[0].classList.remove("push");
            break;
        case 191:
            $(".position-3.key-intro")[0].classList.remove("push");
            break;
    }
});


$("audio").on("canplaythrough", function() {
    setTimeout(function() {
        $("audio")[0].play();
    }, offset);
    playInterval = setInterval(function() {
        var isNoteZero = noteInfo.length == 0;
        if (isNoteZero == false) {
            //겜중
            while (noteInfo[0][0] < nowTime + interval) {
                (function() {
                    var notearr = noteInfo.shift();
                    setTimeout(function() {
                        var note = $(".note.cloneable").clone();
                        var noteHorizon = "position-" + notearr[1];
                        note[0].classList.remove("cloneable");
                        note[0].classList.add(noteHorizon);
                        note.appendTo("#display")
                            .animate({
                                top: "550px"
                            }, speed, "linear", function() {
                                if (this.classList.contains("pushed") == false) {
                                    showMessage(noteHorizon, "이런...")
                                    addCombo(false);
                                    $(".n-miss").text(function(i, v) {
                                        return parseInt(v) + 1
                                    });
                                    $(this).remove();
                                }
                            });
                    }, notearr[0] - nowTime);
                })()
            }
        } else {
            // 겜끝
            var allScore = 2 * (parseInt($(".n-great").text()) + parseInt($(".n-good").text()) + parseInt($(".n-miss").text()));
            var percent = parseInt($(".n-score").text()) * 100 / allScore;
            var rank = "";
            if (percent > 95) {
                rank = "S";
            } else if (percent > 90) {
                rank = "AAA";
            } else if (percent > 80) {
                rank = "AA";
            } else if (percent > 70) {
                rank = "A";
            } else if (percent > 60) {
                rank = "B";
            } else if (percent > 50) {
                rank = "C";
            }
            $(".result").removeClass("hide");
            $(".score").html(rank + "랭크 축하드려용!!");
            clearInterval(playInterval);
        }
        nowTime += interval;
    }, interval);

    $(".moveDebate").click(function() {
        //플러그인의 모든 키 순회
        function forEach(object, callback) {
            for (var key in object) {
                var variable = object[key];
                callback(variable, key);
            }
        }

        function getValue(selector) {
            return parseInt($(selector).text());
        }

        function getRankingJSON(rankingDoc) {
            var regexp = /\<includeonly\>(.*)\<\/includeonly\>/;
            var stringRanking = regexp.exec(rankingDoc)[1];
            return JSON.parse(stringRanking);
        }

        var userName = mw.config.get("wgUserName");
        var thisScore = {
            name: userName,
            great: getValue(".n-great"),
            good: getValue(".n-good"),
            miss: getValue(".n-miss"),
            score: getValue(".n-score"),
            combo: getValue(".n-maxcombo"),
        }


        rankingSystem.update(
            thisScore,
            function(rankingScore, thisScore) {
                return rankingScore.score < thisScore.score
            }, {
                score: "점수",
                combo: "콤보",
                great: "따봉!",
                good: "굿잡!",
                miss: "이런.."
            });
    })
});
		
  }

}
$( plugin_uncyrhythm );
/* uncyrhythm 끝 */


/** 플러그인 SimMD5***************************
* 마법의 MD-5 시뮬레이터 게임에 사용되는 스크립트로, 인터페이스와 배틀시스템을 구현합니다.
* 버전 => 1.3.1
* 작성자 : [[사용자:Gustmd7410|Gustmd7410]] 
* JSON => SimMD5 = {"name":"SimMD5","descript":"마법의 MD-5 시뮬레이터 게임에 사용되는 스크립트로, 인터페이스와 배틀시스템을 구현합니다.","version":"1.3.1","local":true,"creat":"Gustmd7410","state":"마법의 MD-5 시뮬레이터/플러그인","executable":true}; 
*/ 
function plugin_SimMD5(){
  if($("[data-name='SimMD5']").length >= 1){
		  // 이부분에 코드 입력 //
mw.loader.using('oojs-ui-widgets').done(function() {
	function prepare() {
		function responsible(event) {
			var button = $('#input-time .oo-ui-numberInputWidget-plusButton, #input-time .oo-ui-numberInputWidget-minusButton');
			
			if(event.matches) {
				button.css('display', 'none');
				input.time.$label.css('margin-right', null);
			} else {
				button.css('display', 'null');
				input.time.$label.css('margin-right', '30px');
			}
		}
		
		function encode(string) {
			return string
			.replace(/&/g, '&#38;')
			.replace(/</g, '&#60;')
			.replace(/>/g, '&#62;')
			.replace(/{/g, '&#123;')
			.replace(/\|/g, '&#124;')
			.replace(/=/g, '&#61;')
			.replace(/}/g, '&#125;')
			.replace(/\[/g, '&#91;')
			.replace(/\]/g, '&#93;')
			.replace(/_/g, '&#95;');
		}
		
		function cancel(btn) {
			if(stat.length) {
				battle.done = null;
				battle.turn = 0;
				battle.attack = null;
				battle.sequence = null;
				battle.combo = null;
				battle.temp = null;
				
				bar = [];
				bar[0] = new OO.ui.ProgressBarWidget({
					progress: 100
				});
				bar[1] = new OO.ui.ProgressBarWidget({
					progress: 100
				});
				
				bar[0].$bar.css({
					background: '#3366CC'
				});
				bar[0].$element.css({
					'border-right': 'none',
					'border-top-right-radius': 0,
					'border-bottom-right-radius': 0
				});
				bar[1].$bar.css({
					background: '#FF5500'
				});
				bar[1].$element.css({
					'border-left': 'none',
					'border-top-left-radius': 0,
					'border-bottom-left-radius': 0
				});
				
				input.start.setLabel('재시작');
				input.reset.setLabel('초기화');
				$('#stat-turn').text(0);
				$('.stat-0.stat-currentHP').data('value', stat[0].HP).text(stat[0].HP.toFixed(2)).css('color', '#3366CC');
				$('.stat-1.stat-currentHP').data('value', stat[1].HP).text(stat[1].HP.toFixed(2)).css('color', '#FF5500');
				$('.stat-0.stat-HPbar').html(bar[0].$element);
				$('.stat-1.stat-HPbar').html(bar[1].$element);
				if(btn) $('#log')[0].innerText += '\n다시 시작하려면 재시작 버튼을 눌러주세요.';
			}
		}
		
		function stop() {
			clearInterval(battle.work);
			
			$('#input-stop').hide();
			$('#input-start').show();
			input.reset.setDisabled(false);
			input[0].setDisabled(false);
			input[1].setDisabled(false);
			input.time.setDisabled(false);
			input.swap.setDisabled(false);
		}
		
		var input = {};
		input[0] = new OO.ui.TextInputWidget({
			placeholder: '선',
			title: '후',
			value: new URLSearchParams(location.search).get('p0') || ''
		});
		input.start = new OO.ui.ButtonInputWidget({
			type: 'submit',
			flags: ['primary', 'progressive'],
			label: '시작'
		});
		input.stop = new OO.ui.ButtonInputWidget({
			flags: ['primary', 'destructive'],
			label: '정지'
		});
		input[1] = new OO.ui.TextInputWidget({
			placeholder: '후',
			title: '후',
			value: new URLSearchParams(location.search).get('p1') || ''
		});
		input.time = new OO.ui.NumberInputWidget({
			value: 1,
			min: 0,
			label: '초 간격'
		});
		input.reset = new OO.ui.ButtonInputWidget({
			type: 'reset',
			flags: ['destructive'],
			label: '초기화'
		});
		input.swap = new OO.ui.ButtonInputWidget({
			label: $('<div />').css({
				height: '20px',
				width: '20px',
				'background-image': 'url("/wiki/Special:Redirect/file/Ambox_move_black.svg")',
				'background-size': 'cover'
			}),
			title: '교체',
			framed: false
		});
		input.table = new OO.ui.ToggleSwitchWidget({
			value: true
		});
		input.icon = new OO.ui.ButtonWidget({
			framed: false,
			icon: $('#mw-customcollapsible-input-option').hasClass('mw-collapsed')? 'expand' : 'collapse'
		});
		input.log = new OO.ui.ButtonWidget({
			label: '기록 복사'
		});
		input.url = new OO.ui.ButtonWidget({
			label: 'URL 복사'
		});
		input.box = new OO.ui.MultilineTextInputWidget();
		var media = matchMedia('(max-width: 800px)');
		var stat = [];
		var bar = [];
		var battle = {
			turn: 0,
			attack: null,
			done: null,
			work: null,
			sequence: null,
			combo: null,
			temp: null
		};
		
		$('#input').wrap('<form />');
		$('#input-0').html(input[0].$element);
		$('#input-start').html(input.start.$element);
		$('#input-stop').html(input.stop.$element);
		$('#input-1').html(input[1].$element);
		$('#input-time').html(input.time.$element);
		$('#input-reset').html(input.reset.$element);
		$('#input-swap').html(input.swap.$element);
		$('#input-table').html(input.table.$element).append(' 스탯');
		$('#input-icon').html(input.icon.$element);
		$('#stat-load').html(new OO.ui.ProgressBarWidget().$element);
		$('#log').text('시작하시려면 상단에 대결할 상대의 이름을 입력해 주세요. (1.3)');
		$('#share-log').html(input.log.$element);
		$('#share-url').html(input.url.$element);
		$('#share-cvbox').html(input.box.$element);
		
		input.box.$input.attr('readonly', '').css('height', '2.5em');
		
		$('#stat-bar').hide();
		$('#share').hide();
		
		responsible(media);
		media.addListener(responsible);
		
		new MutationObserver(function(mutation) {
			input.icon.setIcon($(mutation[0].target).hasClass('mw-collapsed')? 'expand' : 'collapse');
		}).observe($('#mw-customcollapsible-input-option')[0], {
			attributes: true,
			attributeFilter: ['class']
		});
		
		input.swap.$element.click(function() {
			if(!input.swap.disabled) {
				var val = [input[1].value, input[0].value];
				input[0].setValue(val[0]);
				input[1].setValue(val[1]);
				
				if(stat.length) {
					stat = [stat[1], stat[0]];
					
					$('#stat-turn').text(0);
					$('.stat-0').each(function() {
						if($(this).hasClass('stat-name')) $(this).text(stat[0].name);
						else if($(this).hasClass('stat-attack')) $(this).text(stat[0].attack);
						else if($(this).hasClass('stat-quick')) $(this).text(stat[0].quick);
						else if($(this).hasClass('stat-defense')) $(this).text(stat[0].defense);
						else if($(this).hasClass('stat-hit')) $(this).text(stat[0].hit);
						else if($(this).hasClass('stat-luck')) $(this).text(stat[0].luck);
						else if($(this).hasClass('stat-fullHP')) $(this).text(stat[0].HP);
						else if($(this).hasClass('stat-currentHP')) $(this).data('value', stat[0].HP).text(stat[0].HP.toFixed(2));
						else if($(this).hasClass('stat-HPbar')) $(this).html(bar[0].$element);
					});
					$('.stat-1').each(function() {
						if($(this).hasClass('stat-name')) $(this).text(stat[1].name);
						else if($(this).hasClass('stat-attack')) $(this).text(stat[1].attack);
						else if($(this).hasClass('stat-quick')) $(this).text(stat[1].quick);
						else if($(this).hasClass('stat-defense')) $(this).text(stat[1].defense);
						else if($(this).hasClass('stat-hit')) $(this).text(stat[1].hit);
						else if($(this).hasClass('stat-luck')) $(this).text(stat[1].luck);
						else if($(this).hasClass('stat-fullHP')) $(this).text(stat[1].HP);
						else if($(this).hasClass('stat-currentHP')) $(this).data('value', stat[1].HP).text(stat[1].HP.toFixed(2));
						else if($(this).hasClass('stat-HPbar')) $(this).html(bar[1].$element);
					});
					
					var url = new URL(location);
					url.searchParams.set('p0', input[0].value);
					url.searchParams.set('p1', input[1].value);
					history.replaceState(null, '', url);
					
					cancel();
					
					input.start.setLabel('시작');
				}
			}
		});
		input.table.$element.click(function() {
			if(input.table.value) {
				if($('#stat-turn').text()) $('#stat-table').show(500);
			} else {
				$('#stat-table').hide(500);
			}
		});
		input.reset.$button[0].form.addEventListener('reset', function(event) {
			event.preventDefault();
			
			if(!input.reset.disabled) {
				if(battle.done || battle.done === null) {
					var url = new URL(location);
					url.searchParams['delete']('p0');
					url.searchParams['delete']('p1');
					history.replaceState(null, '', url);
					stat = [];
					input[0].setValue();
					input[1].setValue();
					input.time.setValue(1);
					input.table.setValue(true);
					input.start.setLabel('시작');
					$('#share').hide();
					$('#share-cvbox').hide();
					$('#stat-table').hide(500);
					$('#stat-bar').hide(500);
					$('#stat-turn, .stat-0, .stat-1').text('');
					$('#log-time').hide();
					$('#log').show();
					$('#log').text('시작하시려면 상단에 대결할 상대의 이름을 입력해 주세요.');
					$('.stat-HPbar').html('');
				} else cancel(true);
			}
		});
		input.start.$button[0].form.addEventListener('submit', function(event) {
			function last() {
				$('#input-stop').show();
				$('#input-start').hide();
				input.reset.setLabel('취소');
				input[0].setDisabled(true);
				input[1].setDisabled(true);
				input.time.setDisabled(true);
				input.reset.setDisabled(true);
				input.swap.setDisabled(true);
				input.start.setLabel('재개');
				
				battle.work = start(battle, stat.map(function(obj, index) {
					return new Proxy(obj, {
						get: function(target, key, receiver) {
							if(key === 'HP') return +$('.stat-' + index + '.stat-currentHP').data('value');
							else return Reflect.get(target, key, receiver);
						},
						set: function(target, key, value) {
							if(key === 'HP') {
								if(value < 0) {
									value = 0;
									$('.stat-' + index + '.stat-currentHP').css('color', '#000000');
								}
								$('.stat-' + index + '.stat-currentHP').data('value', value).text(value.toFixed(2));
								bar[index].setProgress(value / target.HP * 100);
							}
						}
					});
				}), input.time.value * 1000, function(msg) {
					$('#log')[0].innerText += msg;
					$('#log').scrollTop($('#log')[0].scrollHeight);
					
					if(battle.sequence === 0) {
						$('#stat-turn').text(battle.turn);
						$('.stat-' + battle.attack + '.stat-name').css({
							background: battle.attack? '#FF5500' : '#3366CC',
							color: '#FFFFFF'
						});
						$('.stat-' + (battle.attack ^ 1) + '.stat-name').css({
							background: '#EAECF0',
							color: battle.attack? '#3366CC' : '#FF5500'
						});
					}
				}, function(msg) {
					$('#log')[0].innerText += msg;
					$('#log')[0].innerText += '\n\n백괴스러운 MD-5 시뮬레이터 [https://game.uncyclopedia.kr/wiki/마법의_MD-5_시뮬레이터]';
					$('#log').scrollTop($('#log')[0].scrollHeight);
					
					$('#share').show();
					
					stop();
					
					battle.done = true;
					battle.turn = 0;
					battle.attack = null;
					battle.sequence = null;
					battle.combo = null;
					battle.temp = null;
					
					input.start.setLabel('재시작');
					input.reset.setLabel('초기화');
				});
			}
			
			event.preventDefault();
			
			if(!input.start.disabled) {
				$('#share').hide();
				$('#share-cvbox').hide();
				
				if(input.time.value >= 0) {
					$('#log-time').hide();
					$('#log').show();
					
					if(!stat.length) $.get({
						url: '/w/api.php',
						data: {
							action: 'parse',
							format: 'json',
							title: '마법의 MD-5 시뮬레이터',
							text: '[{{#invoke:SimMD5|stat|' + encode(input[0].value) + '|AJAX}},{{#invoke:SimMD5|stat|' + encode(input[1].value) + '|AJAX}}]',
							prop: 'text',
							disablelimitreport: true,
							formatversion: 2
						},
						beforeSend: function() {
							if($('#stat-bar').html()) {
								$('#stat-bar').hide();
								$('#stat-load').show();
							} else $('#stat-load').show(500);
							$('#log').text('스탯 계산중입니다. 잠시만 기다려 주세요.');
							
							var url = new URL(location);
							url.searchParams.set('p0', input[0].value);
							url.searchParams.set('p1', input[1].value);
							history.replaceState(null, '', url);
						},
						success: function(callback) {
							stat = JSON.parse($(callback.parse.text).text());
							
							bar = [];
							bar[0] = new OO.ui.ProgressBarWidget({
								progress: 100
							});
							bar[1] = new OO.ui.ProgressBarWidget({
								progress: 100
							});
							
							bar[0].$bar.css({
								background: '#3366CC'
							});
							bar[0].$element.css({
								'border-right': 'none',
								'border-top-right-radius': 0,
								'border-bottom-right-radius': 0
							});
							bar[1].$bar.css({
								background: '#FF5500'
							});
							bar[1].$element.css({
								'border-left': 'none',
								'border-top-left-radius': 0,
								'border-bottom-left-radius': 0
							});
							
							$('#stat-turn').text(0);
							$('.stat-0').each(function() {
								if($(this).hasClass('stat-name')) $(this).text(stat[0].name);
								else if($(this).hasClass('stat-attack')) $(this).text(stat[0].attack);
								else if($(this).hasClass('stat-quick')) $(this).text(stat[0].quick);
								else if($(this).hasClass('stat-defense')) $(this).text(stat[0].defense);
								else if($(this).hasClass('stat-hit')) $(this).text(stat[0].hit);
								else if($(this).hasClass('stat-luck')) $(this).text(stat[0].luck);
								else if($(this).hasClass('stat-fullHP')) $(this).text(stat[0].HP);
								else if($(this).hasClass('stat-currentHP')) $(this).data('value', stat[0].HP).text(stat[0].HP.toFixed(2));
								else if($(this).hasClass('stat-HPbar')) $(this).html(bar[0].$element);
							});
							$('.stat-1').each(function() {
								if($(this).hasClass('stat-name')) $(this).text(stat[1].name);
								else if($(this).hasClass('stat-attack')) $(this).text(stat[1].attack);
								else if($(this).hasClass('stat-quick')) $(this).text(stat[1].quick);
								else if($(this).hasClass('stat-defense')) $(this).text(stat[1].defense);
								else if($(this).hasClass('stat-hit')) $(this).text(stat[1].hit);
								else if($(this).hasClass('stat-luck')) $(this).text(stat[1].luck);
								else if($(this).hasClass('stat-fullHP')) $(this).text(stat[1].HP);
								else if($(this).hasClass('stat-currentHP')) $(this).data('value', stat[1].HP).text(stat[1].HP.toFixed(2));
								else if($(this).hasClass('stat-HPbar')) $(this).html(bar[1].$element);
							});
							
							$('.stat-0.stat-currentHP').css('color', '#3366CC');
							$('.stat-1.stat-currentHP').css('color', '#FF5500');
							
							$('#stat-load').hide();
							if(input.table.value) $('#stat-table').show(500);
							$('#stat-bar').show();
							$('#log').text('');
							$('#log')[0].innerText += '[' + stat[0].name + '] 공격력: ' + stat[0].attack + ' / 방어력: ' + stat[0].defense + ' / 민첩: ' + stat[0].quick + ' / 명중: ' + stat[0].quick + ' / 운: ' + stat[0].luck + ' / HP: ' + stat[0].HP + '\n';
							$('#log')[0].innerText += '[' + stat[1].name + '] 공격력: ' + stat[1].attack + ' / 방어력: ' + stat[1].defense + ' / 민첩: ' + stat[1].quick + ' / 명중: ' + stat[1].quick + ' / 운: ' + stat[1].luck + ' / HP: ' + stat[1].HP + '\n';
							$('#log')[0].innerText += '\n';
							
							battle.turn = 1;
							battle.done = false;
							battle.attack = 0;
							battle.sequence = 0;
							battle.combo = [0, 0];
							battle.temp = {};
							
							last();
						},
						error: function(error) {
							$('#stat-load').hide(500);
							$('#log').text('스탯 계산에 오류가 발생하였습니다. 다시 시도해 주십시오. (' + error.status + ')');
						}
					});
					else if(battle.done || battle.done === null) {
						if(battle.done) cancel();
						
						$('#log').text('');
						$('#log')[0].innerText += '[' + stat[0].name + '] 공격력: ' + stat[0].attack + ' / 방어력: ' + stat[0].defense + ' / 민첩: ' + stat[0].quick + ' / 명중: ' + stat[0].hit + ' / 운: ' + stat[0].luck + ' / HP: ' + stat[0].HP + '\n';
						$('#log')[0].innerText += '[' + stat[1].name + '] 공격력: ' + stat[1].attack + ' / 방어력: ' + stat[1].defense + ' / 민첩: ' + stat[1].quick + ' / 명중: ' + stat[1].hit + ' / 운: ' + stat[1].luck + ' / HP: ' + stat[1].HP + '\n';
						$('#log')[0].innerText += '\n';
						
						battle.turn = 1;
						battle.done = false;
						battle.attack = 0;
						battle.sequence = 0;
						battle.combo = [0, 0];
						battle.temp = {};
						
						last();
					} else last();
				} else {
					$('#log-time').show();
					$('#log').hide();
				}
			}
		});
		input.stop.$element.click(function() {
			if(!input.stop.disabled) stop();
		});
		input[0].$input.focus(function() {
			cancel();
			stat = [];
			input.start.setLabel('시작');
			$(this).select();
		});
		input[1].$input.focus(function() {
			cancel();
			stat = [];
			input.start.setLabel('시작');
			$(this).select();
		});
		input.log.$button.click(function() {
			input.box.setValue($('#log').text());
			$('#share-cvbox').show();
			input.box.$input.select();
			document.execCommand('copy');
		});
		input.url.$button.click(function() {
			var url = new URL('/wiki/마법의_MD-5_시뮬레이터', location);
			var search = new URLSearchParams(location.search);
			url.searchParams.set('p0', search.get('p0'));
			url.searchParams.set('p1', search.get('p1'));
			input.box.setValue(url);
			$('#share-cvbox').show();
			input.box.$input.select();
			document.execCommand('copy');
		});
		input.box.$input.click(function() {
			$(this).select();
		});
	}
	
	function start(battle, stat, time, each, last) {
		function rand(min, max) {
		    return Math.floor(Math.random() * (max - min + 1)) + min;
		}
		
		function range(weight) {
	        var range = [-0.5, -0.25, 0, 0.25, 0.5].map(function(ratio, index) {
	        	return 20 + (weight - 50) * ratio;
	        });
	        range.reduce(function(acc, current, index, prob) {
	        	return prob[index] += acc;
	        });
	        return range;
		}
		
	    function rank(range, val) {
	        return range.findIndex(function(current, index) {
	        	return (index === 0 || range[index - 1] < val) && val <= current;
	        });
	    }
	    
		function power(stat, rank) {
		    return stat * (((rank === 0)? 0 : rand(1 + 25 * (rank - 1), 25 * rank)) / 100);
		}
		
		function bonus(plus, minus, rank) {
			rank -= 2;
			if(rank === 0) return 0;
		    return ((rank > 0)? plus : minus) * (rand(1 + 50 * (rank - 1), 50 * rank) / 100);
		}
		
		function josa(text, exist, not, only) {
			text = text.normalize('NFD');
			var code = text.charCodeAt(text.length - 1);
			
			if(0x1161 <= code && code <= 0x11A7) return ((only)? '' : text) + not;
			else if(0x11A8 <= code && code <= 0x11FF) return ((only)? '' : text) + exist;
			else return ((only)? '' : text) + exist + '(' + not + ')';
		}
		
		return setInterval(function() {
			var attacker = battle.attack;
			var defender = attacker ^ 1;
			
			if(stat[0].HP > 0 && stat[1].HP > 0) {
				switch(battle.sequence) {
					case 0:
						var scale = range(stat[attacker].luck);
						var adv = bonus(stat[attacker].hit, stat[defender].quick, rank(range(50), 50 + ((battle.combo[defender])? 0 : battle.combo[defender]) - ((battle.combo[attacker])? 0: battle.combo[attacker])));
						var grade = {
							attack: rank(scale, rand(1, 100)),
							defense: rank(range(stat[defender].luck), rand(1, 100)),
						};
						var damage = power(stat[attacker].attack, grade.attack) - power(stat[defender].defense, grade.defense) + adv;
						battle.temp = {
							rank: rank(scale, damage),
							damage: (damage > 0)? damage : 0
						};
						
						if(battle.temp.damage > stat[attacker].attack) battle.temp.rank = 5;
						if(battle.temp.damage) {
							if(!battle.temp.rank) battle.temp.rank = 1;
							if(battle.combo[attacker] < 0) battle.combo[attacker] = 0;
							battle.combo[attacker]++;
						} else {
							battle.temp.rank = 0;
							if(battle.combo[attacker] > 0) battle.combo[attacker] = 0;
							battle.combo[attacker]--;
						}
						
						each('[' + stat[attacker].name + ']의 공격 ');
						battle.sequence++;
					break;
					case 1:
						var rankText = ['MISS', 'HIT', 'GOOD', 'NICE', 'PERFECT', 'CRITICAL'][battle.temp.rank];
						each(rankText + '! ');
						battle.sequence++;
					break;
					case 2:
						stat[defender].HP -= battle.temp.damage;
						var msg = (battle.temp.rank === 0)? '공격을 피했다. (' : (+battle.temp.damage.toFixed(2)) + '의 대미지를 받았다. (' + ((battle.combo[attacker] > 0)? battle.combo[attacker] : 0) + ' COMBO, ';
						each('[' + stat[defender].name + ']' + josa(stat[defender].name, '은', '는', true) + ' ' + msg + '남은 HP: ' + (+stat[defender].HP.toFixed(2)) + ')\n');
						if(attacker === 1) battle.turn++;
						battle.sequence = 0;
						battle.attack = defender;
					break;
				}
			} else last('\n[' + stat[defender].name + '] 승! (' + battle.turn + '턴)');
		}, time);
	}
	
	$(prepare);
});
 // 여기까지 코드 입력 //

		
  }

}
$( plugin_SimMD5 );
/* SimMD5 끝 */