// ==UserScript== // @name DIO-TOOLS-David1327 // @name:fr DIO-TOOLS-David1327 // @namespace https://www.tuto-de-david1327.com/pages/info/dio-tools-david1327.html // @version 4.36 // @author DIONY and David1327 // @description Version 2024. DIO-Tools + Quack is a small extension for the browser game Grepolis. (counter, displays, smilies, trade options, changes to the layout) // @description:FR Version 2024. DIO-Tools + Quack est une petite extension du jeu par navigateur Grepolis. (compteur, affichages, smileys, options commerciales, modifications de la mise en page) // @match https://*.grepolis.com/game/* // @match https://*.forum.grepolis.com/* // @match https://dio-david1327.github.io/* // @require https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js // @resource clipboard https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js // @icon https://dio-david1327.github.io/img/smileys/bussi2.gif // @icon64 https://dio-david1327.github.io/img/dio/icon64_dio_tools.png // @copyright 2013+, DIONY and 2019+, David1327 // @grant GM_setValue // @grant GM_getValue // @grant GM_deleteValue // @grant GM_xmlhttpRequest // @grant GM_getResourceText // @license GPL-3.0-only // @downloadURL https://update.greasyfork.icu/scripts/450048/DIO-TOOLS-David1327.user.js // @updateURL https://update.greasyfork.icu/scripts/450048/DIO-TOOLS-David1327.meta.js // ==/UserScript== let dio_version = GM.info.script.version; /******************************************************************************************************************************* * Global stuff *******************************************************************************************************************************/ var uw = unsafeWindow || window, $ = uw.jQuery, DATA, GMM, url_dev; // GM-API? if (GM.info.scriptHandler == "Greasemonkey") GMM = false else GMM = (typeof GM_info === 'object'); if (uw.DIO_GAME) uw.HumanMessage.error('Activating DIO-TOOLS-David1327 multiple times =Info=> v' + dio_version + ' (' + GM.info.scriptHandler + ' v' + GM.info.version + ')') if (uw.DIO_GAME) return console.error('DIO_GAME => Activating DIO-TOOLS-David1327 multiple times =Info=> v' + dio_version + ' (' + GM.info.scriptHandler + ' v' + GM.info.version + ') [GMM ' + GMM + '] -> discord:https://discord.gg/Q7WXtmRNRW') //GMM = true; //GMM = false; //url_dev = true; console.log('%c|= ' + GM.info.script.name + ' is active v' + dio_version + ' (' + GM.info.scriptHandler + ' v' + GM.info.version + ') [GMM ' + GMM + '] =|', 'color: green; font-size: 1em; font-weight: bolder; ', 'Discord:https://discord.gg/Q7WXtmRNRW'); function loadValue(name, default_val) { var value; if (GMM) { value = GM_getValue(name, default_val); } else { value = localStorage.getItem(name) || default_val; } if (typeof (value) === "string") { value = JSON.parse(value) } return value; } // LOAD DATA if ((uw.location.pathname.indexOf("game") >= 0)) { var WID = uw.Game.world_id, MID = uw.Game.market_id, AID = uw.Game.alliance_id; DATA = { // GLOBAL options: loadValue("options", "{}"), test: loadValue("test", "{}"), user: loadValue("dio_user", "{}"), notification: loadValue('notif', '0'), update: loadValue('update', '0'), notiff: loadValue('notiff', '0'), error: loadValue('error', '{}'), // WORLD townTypes: loadValue(WID + "_townTypes", "{}"), townAuto: loadValue(WID + "_townAuto", "{}"), sentUnits: loadValue(WID + "_sentUnits", '{ "attack": {}, "support": {} }'), biremes: loadValue(WID + "_biremes", "{}"), //old bullseyeUnit: loadValue(WID + "_bullseyeUnit", '{ "current_group" : -1 }'), // new worldWonder: loadValue(WID + "_wonder", '{ "ratio": {}, "storage": {}, "map": {} }'), Overviews: loadValue("Overviews", '{ "Buildings": "", "Culture": "", "Gods": "" }'), wall: loadValue(WID + '_wall', '[]'), volumeControl: loadValue('volumeControl', '0.5'), URLAlarm: loadValue('URLAlarm', JSON.stringify("https://dio-david1327.github.io/audio/alarm.mp3")), // MARKET worldWonderTypes: loadValue(MID + "_wonderTypes", '{}'), radar: loadValue(WID + "_radar", '{ "default_timeCS":"06:00:00", "default_points":0}'), //radar: loadValue(MID + "_radar", '{}'), hotkeys: loadValue("hotkeys", "{}"), planNames: loadValue(WID + "planNames", '{"hotkeys_plan_1": null, "hotkeys_plan_2": null, "hotkeys_plan_3": null}'), }; if (!DATA.worldWonder.map) { DATA.worldWonder.map = {}; } // Temporary: if (typeof DATA.options.dio_trd == 'boolean') { DATA.options.dio_per = DATA.options.dio_rec = DATA.options.dio_trd; delete DATA.options.dio_trd; } if (typeof DATA.options.dio_mov == 'boolean') { DATA.options.dio_act = DATA.options.dio_mov; delete DATA.options.dio_mov; } if (typeof DATA.options.dio_twn == 'boolean') { DATA.options.dio_tic = DATA.options.dio_til = DATA.options.dio_tim = DATA.options.dio_twn; delete DATA.options.dio_twn; } if (GMM) GM_deleteValue("notification"); } // GM: EXPORT FUNCTIONS uw.saveValueGM = function (name, val) { setTimeout(() => { GM_setValue(name, val); }, 0); }; uw.deleteValueGM = function (name) { setTimeout(() => { GM_deleteValue(name); }, 0); }; var time_a, time_b; // APPEND SCRIPT function appendScript() { //console.log("GM-API: " + gm_bool); if (document.getElementsByTagName('body')[0]) { if (GMM) { const scriptclipboard = document.createElement("script"); scriptclipboard.textContent = GM_getResourceText("clipboard"); document.body.appendChild(scriptclipboard); } var dioscript = document.createElement('script'); dioscript.type = 'text/javascript'; dioscript.id = 'diotools'; time_a = uw.Timestamp.client(); dioscript.textContent = DIO_GAME.toString().replace(/uw\./g, "") + "\n DIO_GAME('" + dio_version + "', " + GMM + ", '" + JSON.stringify(DATA).replace(/'/g, "##") + "', " + time_a + ", " + url_dev + ");"; document.body.appendChild(dioscript); } else setTimeout(() => { appendScript(); }, 500); } if (location.host === "dio-david1327.github.io") { DIO_PAGE(); } // PAGE else if ((uw.location.pathname.indexOf("game") >= 0)) { try { $('').appendTo("head"); //$('').appendTo("head"); if (!GMM) $('').appendTo("head"); //$('').appendTo("head"); } catch (error) { console.log(error, '