SkinSilhouette

Voir des silhouettes personnalisées

目前為 2023-05-24 提交的版本,檢視 最新版本

// ==UserScript==
// @name    SkinSilhouette
// @namespace   InGame
// @author  Odul, Lorkah, DarkKobalt
// @date 24/05/2023
// @version 1.6.1
// @license DBAD - https://raw.githubusercontent.com/philsturgeon/dbad/master/translations/LICENSE-fr.md
// @include https://www.dreadcast.net/Main
// @include https://www.dreadcast.eu/Main
// @description Voir des silhouettes personnalisées
// @connect docs.google.com
// @connect googleusercontent.com
// @grant GM_xmlhttpRequest
// ==/UserScript==

var silhouettesId = new Array();
var silhouettesNom = new Array();
var urlSilhouettes = "https://docs.google.com/uc?export=download&id=0ByK4ISi_fO8uUFRjRnh1RWhILVU"

const reqLog = function (response) {
    console.log(response);
    };

var getSilhouettes = function (urlSilhouettes) {
    GM_xmlhttpRequest({
        method: 'GET',
        url: urlSilhouettes,
        headers: {
            "Content-Type": "application/json"
          },
        responseType : 'json',
        onload: function(response) {
            var e = response.response;
            for (var i=0 ; i < e.personnage.length ; i++)
            {
                silhouettesId[e.personnage[i][0]] = e.personnage[i][1];
                if(e.personnage[i].length >= 3)
                silhouettesNom[(e.personnage[i][2]).toLowerCase()] = e.personnage[i][1];
            }
            console.log("Silhouettes chargées")

            var pseudo = $("#txt_pseudo").text().toLowerCase();
            if(silhouettesNom[pseudo]) {
                $('.personnage_image').css('background-image','url('+silhouettesNom[pseudo]+')').css('background-position','0px 0px');
            }
            console.log("Silhouette perso appliquée")
        },
        onerror: reqLog,
    });
};

Engine.prototype.openPersoBox = function (a, b) {

    var c = this;
    return $("#zone_infoBoxFixed #ib_persoBox_" + a).length ? ($("#zone_infoBoxFixed #ib_persoBox_" + a).remove(), !0) : void $.post("./Main/FixedBox/PersoBox", {
        id: a
    }, function (d) {
        if ("ERROR1" != d) {
            $("#zone_infoBoxFixed").prepend(d);

            var e = nav.getInventaire();
            $("#zone_infoBoxFixed #ib_persoBox_" + a + " .case_objet").each(function () {
                e.updateEffectsCaseObjet($(this))
            });
            $("#zone_infoBoxFixed #ib_persoBox_" + a).hide().fadeIn("fast").draggable(), setOnTop("#zone_infoBoxFixed #ib_persoBox_" + a, "infoBoxFixed"), $("#zone_infoBoxFixed #ib_persoBox_" + a).click(function () {
                $(this).hasClass("onTop") || setOnTop(this, "infoBoxFixed")
            }), centrageBox(b, "#zone_infoBoxFixed #ib_persoBox_" + a, 30, 15), c.updateToolTip(".info1, .link_info1"), c.updateToolTip(".info2, .link_info2", 2);
            var f = parseFloat($("#stat_6_entier").text() + $("#stat_6_decimal").text());
            0 == f && $("#ib_persoBox_" + a + " .interaction_3").addClass("np").attr("onClick", "");

            if(silhouettesId[a])
            $("#zone_infoBoxFixed #ib_persoBox_" + a +" .personnage_image").css('background-image','url('+silhouettesId[a]+')').css('background-position','0px 0px');
        }
    })
}

$(document).ready(function() {
    $.ajaxSetup({async: false});
    getSilhouettes(urlSilhouettes);
    $.ajaxSetup({async: true});
});