GobZilla

Décoche par défaut la case active dla et le vestaire. Affiche des icones dans la vue. Affiche le nombre d'entrainements restants. Récup des attributs (mes sais pas quoi en faire^^)

Version vom 19.09.2022. Aktuellste Version

// ==UserScript==
// @name           GobZilla
// @namespace      Gobland
// @description    Décoche par défaut la case active dla et le vestaire. Affiche des icones dans la vue. Affiche le nombre d'entrainements restants. Récup des attributs (mes sais pas quoi en faire^^)
// @include        http://games.gobland.fr/jeuC.html
// @include        https://games.gobland.fr
// @include        http://games.gobland.fr/Vue.php
// @include        http://games.gobland.fr/ProfilPerso.php
// @include        http:/games.gobland.fr/ProfilMonster.php
// @match          http://games.gobland.fr/index.php*
// @match          https://games.gobland.fr/index.php*
// @match          http://games.gobland.fr/playActions.php?todo=52
// @require        https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
// @require        https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js
// @copyright      lordslair, Seishin et Death Métal
// @license        https://creativecommons.org/licenses/by-sa/4.0/
// @version        0.0.1.0
 // Heavily inspired by http://userscripts-mirror.org/scripts/show/41369
// ==/UserScript==

/// INFO BULLES TALENTS (pas encore fonctionnel, trouver le moyen d'extraire les carac pure (et pas les carac + bonus)

$( document ).ready(function() {
    $('a:contains("Afflux Sanguin")').prop('title', 'En totale connaissance de leurs corps, les gobelins savent faire cicatriser habilement la moindre plaie, faire régénérer leurs tissus organiques.' +
                                           ' Apprenti ' + Math.floor((skills.PV/30) *2) +
                                           ' Compagnon ' + Math.floor((skills.PV/25) *2) +
                                           ' Maître ' + Math.floor((skills.PV/20) *2) +
                                           ' Grand Maître ' + Math.floor((skills.PV/15) *2)
                                                                                            );
});

$( document ).ready(function() {
    $('a:contains("Appel des Ombres")').prop('title', 'Appel aux Forces de la Nature' + skills.MT);

});

const str = 'infoATT';

(str.substring(1, 3));https://violentmonkey.github.io/posts/how-to-edit-scripts-with-your-favorite-editor/
// expected output: "oz"

$( document ).ready(function() {
    $('a:contains("Connaissance des Monstres")').prop('title', 'portée : ' + skills.PER);
});

$( document ).ready(function() {
    $('a:contains("Projectile")').prop('title', 'Att : ' + skills.ARMM);
});

$( document ).ready(function() {
    $('a:contains("Baratin")').prop('title',  skills.ATT);
});

/// INFO BULLES TALENTS (fin)

/// Décocher par défaut la case activer sa DLA sur la page de Log-In piqué a Seishin
(function() {
    'use strict';

 $('input[type=checkbox][name=aDLA]').prop( "checked", false);
})();
/// Décocher par défaut la case activer sa DLA sur la page de Log-In piqué a Seishin (fin)

// Décocher par défaut le vestaire
(function() {
    'use strict';

    $('input[type=checkbox][name=VESTIAIRE]').prop( "checked", false );
})();
// Décocher par défaut le vestaire (fin)

///les mots a changer/améliorer+icones
(function () {
    'use strict';

    var words = {

'((286|386|387|393|46237|95720|130171|46237|47717|95720|130171|53|101759|101|50127|95982|108284|100794|94082|108|121|129|141|180|48520|66516|69423|119472|32954|))' : '🥰', // Clan et CM
'Champi-Glouton' : 'Champi-Glouton 👾', // Monstres manque CdM
'Basilic': 'Basilic 👾',
'Gnu Sauvage': 'Gnu Sauvage 👾',
'Mille-pattes géant': 'Mille-pattes géant 👾',
'Erinyes': 'Erinyes 👾',
'Gnoll': 'Gnoll 👾',
'Halfelin': 'Halfelin 👾',
'Momie': 'Momie 👾',
'Monstre Rouilleur': 'Monstre Rouilleur 👾',
'Galopin': 'Galopin 👾',
'Gargouille': 'Gargouille 👾',
'Incube': 'Incube 👾',
'Succube': 'Succube 👾',
'Ankheg': 'Ankheg 👾',
'Babélien': 'Babélien 👾',
'Boggart': 'Boggart 👾',
'Golem de Chair': 'Golem de Chair 👾',
'Gowap Sauvage': 'Gowap Sauvage 👾',
'Homme-Lézard': 'Homme-Lézard 👾',
'Méphite de Feu': 'Méphite de Feu 👾',
'Naga': 'Naga 👾',
'Ogre': 'Ogre 👾',
'Ondine': 'Ondine 👾',
'Rat-garou': 'Rat-garou 👾',
'Scorpion Géant': 'Scorpion Géant 👾',

'Oni': 'Oni 🎯', //gros monstres
'Marid': 'Marid 🎯',
'Vampire': 'Vampire 🎯',
'Megantereon': 'Megantereon 🎯',
'Automate': 'Automate 🎯',
'Viverne': 'Viverne 🎯',
'Homothérium': 'Homothérium 🎯',
'Horreur chasseresse': 'Horreur chasseresse 🎯',
'Behemoth': 'Behemoth🎯',
'Sphinx': 'Sphinx 🎯',
'Cerbère': 'Cerbère 🎯',

'Potion' : 'Potion 🧪', //icones équipement
'Parchemin' : 'Parchemin 📜',
'CT| Canines de Trõll' : ' CT 💰',
'Anneau' : 'Anneau 💍 ',
'Bouclier' : "Bouclier 🛡️",
'Corps' : 'Corps ☠️',
'Arme 1 Main' : 'Arme 1 main 🗡️',

'Baguette' : 'Baguette 🪄 ',
'Parchemin' : 'Parchemin 📜 ',

//Mon Profil

//'Perception' :    'PER 👁️' ,
'Santé' : 'Santé ❤️',
'Echéance du Tour' : 'Echéance du Tour⏱️',
'Combat' : 'Combat ⚔️',
'Affinités' : 'Affinités ✨',

///'Apprenti':   'Apprenti 1️⃣',
///'Compagnon':'Compagnon 2️⃣',
///'Grand Maître':'Grand Maître 4️⃣',
///'Maître':'Maître 3️⃣',

'':''};
///les mots a changer/améliorer (fin)

///fonction pour remplacer le texte dans Gobland
var regexs = [], replacements = [],
        tagsWhitelist = ['PRE', 'BLOCKQUOTE', 'CODE', 'INPUT', 'BUTTON', 'TEXTAREA'],
        rIsRegexp = /^\/(.+)\/([gim]+)?$/,
        word, text, texts, i, userRegexp;

    function prepareRegex(string) {
        return string.replace(/(\({2}|([\[\]\^\&\$\.\?\/\\\+\{\}])|\)$)/g, '\\$1');
    }

    function isTagOk(tag) {
        return tagsWhitelist.indexOf(tag) === -1;
    }

    for (word in words) {
        if ( typeof word === 'string' && words.hasOwnProperty(word) ) {
            userRegexp = word.match(rIsRegexp);

            // add the search/needle/query
            if (userRegexp) {
                regexs.push(new RegExp(userRegexp[1], 'g'));
            } else {
                regexs.push(
                    new RegExp(prepareRegex(word).replace(/\\?\*/g, function (fullMatch) {
                        return fullMatch === '\\*' ? '*' : '[^ ]*';
                    }), 'g')
                );
            }

            replacements.push(words[word]);
        }
    }

    texts = document.evaluate('//body//text()[ normalize-space(.) != "" ]', document, null, 6, null);
    for (i = 0; text = texts.snapshotItem(i); i += 1) {
        if ( tagsWhitelist.indexOf(text.parentNode.tagName) ) {
            regexs.forEach(function (value, index) {
                text.data = text.data.replace( value, replacements[index] );
            });
        }
    }

}());

///fonction pour remplaceer le texte dans Gobland(fin)

//============================================================================================
//
// P R O F I L   P A G E (tout marche pas la dedans)
//
//============================================================================================

/// RECUP DE SKILLS (en cours, pas facile)

	var skills = {};

	// Get Position and Perception
	var gobPosition = $('th:contains("Position")').parent().closest('tr').text();
	var pos = gobPosition.match(/X = ([-]*\d+) \| Y = ([-]*\d+) \| N = ([-]*\d+)/);
	skills.X = pos[1];
	skills.Y = pos[2];
	skills.N = pos[3];
	//var res = gobPosition.match(/: (\d+)\ ([-]*\d+));
  //skills.PER = res[1];

  var res = gobPosition.match(/: (\d+)/);
	skills.PER = res[1];

// Get PV, PVMax and REG
	var gobSante = $('th:contains("Santé")').parent().closest('tr');
	var tdSante = $('td:first', gobSante);
	res = tdSante.html().split(/<BR>/i); //gobSante.match(/: (\d+)([^:]+): (\d+)([^:]+): (\d+)/);
	skills.PV = res[0].match(/: (\d+)/)[1];
	skills.PVMax = res[1].match(/: (\d+)/)[1];
	skills.REG = $('span#reg').html();

	// Get DEG, ARM, ATT, ESQ
	var gobCombat = $('th:contains("Combat")').parent().closest('tr');
	var tdCombat = $('td:first', gobCombat);
	res = tdCombat.html().split(/<BR>/i);

	skills.DEG = $('span#DEG').html();
	skills.ARMM = res[6].match(/(\d+)/)[2];
  skills.ARMP = res[1].match(/(\d+)/)[1];
	skills.ATT = res[6].match(/(\d+)/)[0];
	skills.ESQ = $('span#ESQ').html();

	skills.RM = $('td.invisible:contains("(RM)")').next('td').text().match(/= ([-]*\d+)/)[1];
	skills.MM = $('td.invisible:contains("(MM)")').next('td').text().match(/= ([-]*\d+)/)[1];
	skills.RS = $('td.invisible:contains("(RS)")').next('td').text().match(/= ([-]*\d+)/)[1];
	skills.MS = $('td.invisible:contains("(MS)")').next('td').text().match(/= ([-]*\d+)/)[1];
	skills.RT = $('td.invisible:contains("(RT)")').next('td').text().match(/= ([-]*\d+)/)[1];
	skills.MT = $('td.invisible:contains("(MT)")').next('td').text().match(/= ([-]*\d+)/)[1];
	skills.RC = $('td.invisible:contains("(RC)")').next('td').text().match(/= ([-]*\d+)/)[1];
	skills.MC = $('td.invisible:contains("(MC)")').next('td').text().match(/= ([-]*\d+)/)[1];
	skills.RP = $('td.invisible:contains("(RP)")').next('td').text().match(/= ([-]*\d+)/)[1];
	skills.MP = $('td.invisible:contains("(MP)")').next('td').text().match(/= ([-]*\d+)/)[1];
	skills.RR = $('td.invisible:contains("(RR)")').next('td').text().match(/= ([-]*\d+)/)[1];
	skills.MR = $('td.invisible:contains("(MR)")').next('td').text().match(/= ([-]*\d+)/)[1];

	// Calculer le nombre d'entrainement avant changement de niveau
	var gobExperience = $('th:contains("Expérience")').parent().closest('tr');
	var tdExp = $('td:first', gobExperience);
	var sExp = tdExp.html();
	//sExp.substr(,sExp.indexOf(":")
	res = sExp.match(/: (\d+) \((\d+) PI \| Niveau (\d+) : (\d+)/);
	var nbTrain = Math.ceil((res[4].valueOf() - res[2].valueOf())/( 2 * res[1].valueOf()));
	var pExp = sExp.indexOf(")");
	var sTrain = (nbTrain > 1) ? " entraînements" : " entraînement";

	tdExp.html(sExp.substr(0, pExp + 1 ) + " ---> Il te reste " + nbTrain + sTrain + sExp.substr(pExp + 1));

  var attmoy = $('th:contains("Combat")').parent().closest('tr');
	var tdattmoy = $('td:first', attmoy);
	var sattmoy = tdattmoy.html();

  res = sattmoy.match(/: (\d+)/);
	var nbatt = Math.ceil(res[1].valueOf()*3,5);
	var patt = sattmoy.indexOf(")");

	tdattmoy.html(sattmoy.substr(0, patt + 1 ) + " att " + nbatt +  sattmoy.substr(patt + 1));

  var esqmoy = $('th:contains("Combat")').parent().closest('tr');
	var tdesqmoy = $('span#ESQ', esqmoy);
	var sesqmoy = tdesqmoy.html();

  res = sesqmoy.match(/ (\d+)/);
	var nbesq = Math.ceil(res[1].valueOf()*3,5);
	var pesq = sesqmoy.indexOf(")");

	tdesqmoy.html(sesqmoy.substr(0, pesq + 1 ) + " esq " + nbesq +  sesqmoy.substr(pesq + 1));

 	var tNiveaux = { "(Apprenti)" : 1,
	                 "(Compagnon)" : 2,
	                 "(Maître)" : 3,
	                 "(Grand Maître)" : 4 };

/// RECUP DE SKILLS (fin)

//============================================================================================
//
// P R O F I L   P A G E      E N D
//
//============================================================================================