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^^)

2022-09-17 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

// ==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
// @copyright      lordslair, Seishin et Death Métal
// @license        https://creativecommons.org/licenses/by-sa/4.0/
// @version        0.0.0.2
 // Heavily inspired by http://userscripts-mirror.org/scripts/show/41369
// ==/UserScript==




/// 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
(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 👾', // Monstre manque CdM
'Basilic': 'Basilic 👾',
'Gnu Sauvage': 'Gnu Sauvage 👾',
'Mille-pattes géant': 'Mille-pattes géant 👾',
'Molosse Satanique': 'Molosse Satanique 👾',
'Sprigan': 'Sprigan 👾',
'Caillouteux': 'Caillouteux 👾',
'Erinyes': 'Erinyes 👾',
'Gnoll': 'Gnoll 👾',
'Halfelin': 'Halfelin 👾',
'Hellrot': 'Hellrot 👾',
'Kappa': 'Kappa 👾',
'Momie': 'Momie 👾',
'Monstre Rouilleur': 'Monstre Rouilleur 👾',
'Titan': 'Titan 👾',
'Fungus Géant': 'Fungus Géant 👾',
'Galopin': 'Galopin 👾',
'Gargouille': 'Gargouille 👾',
'Incube': 'Incube 👾',
'Succube': 'Succube 👾',
'Ankheg': 'Ankheg 👾',
'Babélien': 'Babélien 👾',
'Boggart': 'Boggart 👾',
'Cattis': 'Cattis 👾',
'Golem de Chair': 'Golem de Chair 👾',
'Gowap Sauvage': 'Gowap Sauvage 👾',
'Homme-Lézard': 'Homme-Lézard 👾',
'Manticore': 'Manticore 👾',
'Méphite de Feu': 'Méphite de Feu 👾',
'Méphite Sulfureux': 'Méphite Sulfureux 👾',
'Naga': 'Naga 👾',
'Nuée de Vermines': 'Nuée de Vermines 👾',
'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)
//
//============================================================================================

	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(/: (.*)/);
	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.ARM = res[1].match(/: (.+)/)[1];
	skills.ATT = $('span#ATT').html();
	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];

	// Compute number of train before next level...
	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 tNiveaux = { "(Apprenti)" : 1,
	                 "(Compagnon)" : 2,
	                 "(Maître)" : 3,
	                 "(Grand Maître)" : 4 };


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