NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @author Sundava // @name Sundava's RaidsTable // @description Tableau de raids // @description:en Raids table // @namespace Sundava // @include http://*.ogame.gameforge.com/game/index.php?page=messages* // @include http://*.ogame.gameforge.com/game/index.php?page=fleet1* // @include http://*.ogame.gameforge.com/game/index.php?page=research* // @include https://*.ogame.gameforge.com/game/index.php?page=messages* // @include https://*.ogame.gameforge.com/game/index.php?page=fleet1* // @include https://*.ogame.gameforge.com/game/index.php?page=research* // @exclude http://*.ogame.gameforge.com/game/index.php?page=messages*messageId* // @version 1.0.2 // @grant GM_getValue // @grant GM_setValue // ==/UserScript== // A few tweaks I made on Xana's RaidTables to better suits my needs // Original script available at https://openuserjs.org/scripts/vulca/OGame_RaidsTable // Ogame Thread (French) : http://board.fr.ogame.gameforge.com/board1474-ogame-le-jeu/board641-les-cr-ations-ogamiennes/board642-logiciels-tableurs/1119190-raidstable-v6-0-8-a-reprendre/#post13235007 // Compatibility OGame 6.0.12 // app (function() { "use strict"; Element.prototype.hasClass = function(className) { return this.className && new RegExp("(^|\\s)" + className + "(\\s|$)").test(this.className); }; // images var more_infos = '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1z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/Jm8pzskS+iTAy1nGzdo8RA5UqtPlIj4+naGMiVCnLQTorIV8HBiNiajXhUFIzMoTvj/DwB/AKdf8pfHNHsiAAAAAElFTkSuQmCC"; function Vu_getValue(key,defaultVal) { try { return GM_getValue(key,defaultVal); } catch( err ) { console.log("Vu_getValue(" + key + ") failed : " + err); console.log("Setting value to : " + defaultVal); return defaultVal; } } function Vu_setValue(key,value) { try { GM_setValue(key,value); } catch( err ) { console.log("Vu_setValue(" + key + "," + value + ") failed : " + err); } } function trim(string) {return string.replace(/(^\s*)|(\s*$)/g,'');} function numberWithCommas(x) { var suffix = ""; if (x >= 1000) { x = x / 1000; suffix = "K"; } x = Math.round(x * 10) / 10; return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + suffix; } function removeElement(node) { node.parentNode.removeChild(node); } function extractRess(res) { if(/:/.test(res.textContent)) { res =trim(res.textContent.split(':')[1]); } else { res=trim(res.textContent); } if(/^[0-9]{1,3}\.[0-9]{3}$/.test(res)) res=res.replace(/\./g,''); else if (/^[0-9]{1,3}(\.|,)[0-9]{1,3}Md/.test(res)) res=res.replace(/,/g,'.').replace(/Md/g,'')*1000000000; else if (/^[0-9]{1,3}(\.|,)[0-9]{1,3}M/.test(res)) res=res.replace(/,/g,'.').replace(/M/g,'')*1000000; return parseInt(res); } function raidsTable_init() { var uiid20_ul; if(document.querySelector('#chatBar')) { uiid20_ul = document.querySelector("#ui-id-20 .tab_inner:first-child"); } else { uiid20_ul = document.querySelector("#ui-id-14 .tab_inner:first-child"); } var raidsTable = document.querySelector("#raidsTable_container"); // on affiche le tableau s'il n'existe pas déjà if (uiid20_ul && !raidsTable) { // on récupère tous les messages var computed_messages = []; var age = 0; var total_resources = 0; var total_pt = 0; var total_gt = 0; var raw_messages = uiid20_ul.querySelectorAll('li.msg'), i; var idPlayer =document.getElementsByName('ogame-player-id')[0].content; var serveur = document.getElementsByName('ogame-universe')[0].content; var listeRC=Vu_getValue('listeRc'+serveur+idPlayer, '1||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||'); for(i = 0; i < raw_messages.length; i++) { var current_raw_message = raw_messages[i]; var computed_message_built = {}; if(current_raw_message.querySelectorAll('.espionageDefText').length === 0) { // message id computed_message_built.id = current_raw_message.getAttribute('data-msg-id'); // joueur var player = current_raw_message.querySelectorAll('.msg_content')[0].querySelectorAll('div')[0]; var player_html_nodes = player.children; var player_html = "", k = 0; for(k = 1; k < player_html_nodes.length-1; k++) { if(k > 1) { player_html += ' '; } player_html += player_html_nodes[k].innerHTML; } computed_message_built.player = player_html; //anciennté var raw_date = current_raw_message.getElementsByClassName('msg_date fright')[0].innerHTML.split(' '); // Format : 09.02.2016 19:51:50 var eu_date = raw_date[0]; var parts = eu_date.split('.'); var us_date = parts[2]+'-'+parts[1]+'-'+parts[0]; // America, you are so stupid var date = new Date(Date.parse(us_date + " " + raw_date[1])); computed_message_built.age = (Date.now() - date.getTime()) / 1000; // coordonnées var coordinates_node = current_raw_message.querySelectorAll('.msg_head')[0].querySelectorAll('.msg_title')[0].querySelectorAll('a')[0]; computed_message_built.coordinates_url = coordinates_node.getAttribute('href'); var planetIcon = ''; if(coordinates_node.querySelectorAll('figure')[0].hasClass('moon')) { planetIcon = ' <figure class="planetIcon moon tooltip js_hideTipOnMobile" title=""></figure>'; } computed_message_built.coordinates = coordinates_node.innerHTML.match(/\[.+\]/)[0] + planetIcon; var obsolete = false; for (var n = 0; n < computed_messages.length; n++) { if (computed_messages[n].coordinates == computed_message_built.coordinates) if (computed_messages[n].age < computed_message_built.age) obsolete = true; } if (obsolete === true) { continue; } // activité var activity_node = current_raw_message.querySelectorAll('.msg_content')[0].querySelectorAll('.compacting')[0].querySelectorAll('.fright')[0]; computed_message_built.activity_min = ""; computed_message_built.activity_color = 'inherit'; if(activity_node.querySelectorAll('font')[0]) { computed_message_built.activity_min = activity_node.querySelectorAll('font')[0].innerHTML.match(/\d+/)[0] + 'm.'; computed_message_built.activity_color = activity_node.querySelectorAll('font')[0].getAttribute('color'); computed_message_built.player += ' <span style="color:'+computed_message_built.activity_color+'">'+computed_message_built.activity_min+'</span>'; } // pourcentage butin var booty; try { booty = current_raw_message.querySelectorAll('.msg_content')[0].querySelectorAll('div')[2].querySelectorAll('span')[0]; booty = booty.innerHTML; var regex = /[\d\.]+/g; booty = booty.match(regex)[0]; booty = parseInt(booty); //booty = current_raw_message.getElementsByClassName('ctn ctn4')[3].textContent.replace(/[^0-9]/g,''); computed_message_built.booty = booty; } catch(err) { booty = 100; computed_message_built.booty = booty; } // ressources var ress = current_raw_message.getElementsByClassName('resspan'); var metal = extractRess(ress[0]); var crystal = extractRess(ress[1]); var deut = extractRess(ress[2]); var resources = parseInt(booty/100*(metal+crystal+deut)); total_resources += resources; var fret = parseInt(resources*1.1); computed_message_built.raw_resources = resources; computed_message_built.resources = numberWithCommas(resources); computed_message_built.raw_metal = booty / 100 * metal; computed_message_built.raw_crystal = booty / 100 * crystal; computed_message_built.raw_deut = booty / 100 * deut; computed_message_built.metal = numberWithCommas(booty / 100 * metal); computed_message_built.crystal = numberWithCommas(booty / 100 * crystal); computed_message_built.deut = numberWithCommas(booty / 100 * deut); // gt computed_message_built.gt = Math.ceil(fret/25000); total_gt += computed_message_built.gt; // pt computed_message_built.pt = Math.ceil(fret/5000); total_pt += computed_message_built.pt; // liens transporteurs var link=current_raw_message.getElementsByClassName('msg_actions clearfix')[0].getElementsByTagName('a')[3].href; var APIkey = /(sr-[a-z]{2}-[0-9]+-[0-9a-z]+)/.exec(current_raw_message.getElementsByClassName('icon_apikey')[0].title)[0].split('-')[3]; computed_message_built.linkGT = link+'&am203='+computed_message_built.gt+'&addGT='+APIkey; computed_message_built.linkPT = link+'&am202='+computed_message_built.pt+'&addGT='+APIkey; computed_message_built.colorAtt=''; // flotte try { var fleet = current_raw_message.querySelectorAll('.msg_content')[0].querySelectorAll('div')[3].querySelectorAll('span')[0].getAttribute('title'); //recycleurs computed_message_built.raw_fleet = parseInt(fleet.replace(/\./g , '')); var recycler = computed_message_built.raw_fleet /20000; computed_message_built.recycler = Math.ceil(recycler*0.3); if (fleet !== "0") fleet = fleet.slice(0,-4) + 'K'; computed_message_built.fleet = fleet; } catch(err) { var fleet = undefined; computed_message_built.fleet = fleet; computed_message_built.raw_fleet = -1; } // défense try { var defense = current_raw_message.querySelectorAll('.msg_content')[0].querySelectorAll('div')[3].querySelectorAll('span')[1].getAttribute('title'); computed_message_built.raw_defense = parseInt(defense.replace(/\./g , '')); if (defense !== "0") defense = defense.slice(0,-4) + 'K'; computed_message_built.defense = defense; } catch(err) { var defense = undefined; computed_message_built.defense = defense; computed_message_built.raw_defense = -1; } // bouton d'attaque var attack_button = current_raw_message.querySelectorAll('.msg_actions')[0].querySelectorAll('a')[3].getAttribute('href'); computed_message_built.attack_button = attack_button; // Simulateur var api = /(sr-[a-z]{2}-[0-9]+-[0-9a-z]+)/.exec(current_raw_message.getElementsByClassName('icon_apikey ')[0].title)[0]; computed_message_built.simu_button = 'http://topraider.eu/index.php?SR_KEY='+api+'&speed='+document.getElementsByName('ogame-universe-speed-fleet')[0].content; var techs = Vu_getValue("techs", "0|0|0|0|0|0").split('|'); computed_message_built.simu_button += "&arme=" + techs[0] + "&bouclier=" + techs[1] + "&protect=" + techs[2] + "&combu=" + techs[3] + "&impu=" + techs[4] + "&prop=" + techs[5]; // détails var more_button; try { more_button = current_raw_message.querySelectorAll('.msg_actions')[0].querySelectorAll('a'); more_button = more_button[more_button.length-1].getAttribute('href'); computed_message_built.more_button = more_button; } catch (err) { console.log("Fail more button : " + err); } if(i%2 === 0) { current_raw_message.style.backgroundColor = '#111'; } current_raw_message.setAttribute('id', 'anchor'+computed_message_built.id); computed_messages.push(computed_message_built); } } if(computed_messages.length > 0) { // re-ordonnement function updateCol(sortFunction) { console.log("updateCol called"); computed_messages.sort(sortFunction); var tableObject = document.getElementById("raidsTable"); tableObject.replaceChild(createTBody(), tableObject.tBodies[0]); } function orderByAge(a, b) { if (a.age < b.age) return -1; else if (a.age > b.age) return 1; return 0; } function orderByResources(a, b) { var a_res = a.raw_metal + a.raw_crystal * 2 + a.raw_deut * 3; var b_res = b.raw_metal + b.raw_crystal * 2 + b.raw_deut * 3; if(a_res > b_res) { return -1; } else if (a_res < b_res) { return 1; } return 0; } function orderByMetal(a,b) { if (a.raw_metal > b.raw_metal) { return -1; } else if (a.raw_metal < b.raw_metal) { return 1; } return 0; } function orderByCrystal(a,b) { if (a.raw_crystal > b.raw_crystal) { return -1; } else if (a.raw_crystal < b.raw_crystal) { return 1; } return 0; } function orderByDeut(a,b) { if (a.raw_deut > b.raw_deut) { return -1; } else if (a.raw_deut < b.raw_deut) { return 1; } return 0; } function orderByDef(a,b) { if (a.raw_defense > b.raw_defense) { return -1; } else if (a.raw_defense < b.raw_defense) { return 1; } return 0; } function orderByFleet(a,b) { if (a.raw_fleet > b.raw_fleet) { return -1; } else if (a.raw_fleet < b.raw_fleet) { return 1; } return 0; } computed_messages.sort(orderByResources); var table = '<div style="text-align: center">Pillage : '+numberWithCommas(total_resources)+' | PT : '+numberWithCommas(total_pt)+' | GT : '+numberWithCommas(total_gt)+'</div>'; table += '<table id="raidsTable" class="content_table">'; table += '<thead class="ct_head_row">'; table += '<th class="ct_th"><button id="ageCol">Age</button></th>'; table += '<th class="ct_th">Joueur</th>'; table += '<th class="ct_th">Position</th>'; table += '<th class="ct_th"><button id="fleetCol">Flotte</button></th>'; table += '<th class="ct_th"><button id="defCol">Déf</button></th>'; table += '<th class="ct_th"><button id="metalCol">M</button></th>'; table += '<th class="ct_th"><button id="cystalCol">C</button></th>'; table += '<th class="ct_th"><button id="deutCol">D</button></th>'; table += '<th class="ct_th"><button id="lootCol">%</button></th>'; table += '<th class="ct_th">GT</th>'; table += '<th class="ct_th">PT</th>'; table += '<th class="ct_th"></th>'; table += '<th class="ct_th"></th>'; table += '<th class="ct_th"></th>'; table += '<th class="ct_th"></th>'; table += '</thead>'; table += '<tbody></tbody>'; table += '</table>'; var containerElement = document.createElement("div"); containerElement.innerHTML = table; containerElement.id ='raidsTable_container'; containerElement.style.clear = 'both'; uiid20_ul.insertBefore(containerElement, uiid20_ul.firstChild); var tableObject = document.getElementById("raidsTable"); // construction du tableau function createTBody() { var content = document.createElement("tbody"); var j; for(j = 0; j < computed_messages.length; j++) { var tr_class = j%2 === 0 ? 'odd' : 'even'; var tr_row = j+1; var current_computed_message = computed_messages[j]; var attack = '<a href="'+current_computed_message.attack_button+'">'; attack += '<span class="icon_nf icon_attack"></span>'; attack += '</a>'; var del_button = '<li class="msg" data-msg-id="' + current_computed_message.id + '">'; del_button += '<a class="fright" onclick="this.parentNode.parentNode.parentNode.style.display=\'none\';document.querySelector(\'#anchor' + current_computed_message.id + '\').style.display=\'none\'" href="javascript:void(0);">'; // del_button += '<span title="" class="icon_nf icon_refuse js_actionKill tooltip js_hideTipOnMobile"></span>'; del_button += '</a></li>'; var more_button = '<a class="fright txt_link overlay" data-overlay-title="Plus de détails" href="'+current_computed_message.more_button+'">'+more_infos+'</a>'; var simulator = '<a title="SpeedSim" target="_blank" href="'+current_computed_message.simu_button+'"><img src="'+imgSpeedSim+'" /></a>'; var recycler_title = "Aucune info."; var fleet_title = "NaN"; if(current_computed_message.fleet !== undefined) { recycler_title = "<b>Recycleurs nécessaires : " + current_computed_message.recycler + "</b>"; fleet_title = current_computed_message.fleet; } var defense_title = "NaN"; if(current_computed_message.defense !== undefined) { defense_title = current_computed_message.defense; } var age = current_computed_message.age; var formated_age = ""; var seconds = Math.floor(age % 60); var minutes = Math.floor((age / 60) % 60); var hours = Math.floor((age / (60 * 60))); var days = Math.floor(age / (60 * 60 * 24)); if (days >= 2) formated_age = days + " Jours"; else { if (hours > 0) formated_age += hours + "h"; if (minutes > 0) formated_age += minutes + "m"; if (hours <= 0) formated_age += seconds % 60 + "s"; } var coord = current_computed_message.coordinates.replace(/[\[\]]/g, "").replace(/:/g, ","); var row = content.insertRow(-1); row.className = tr_class; row.id = "msg_" + current_computed_message.id; //row.attr("data-id") = current_computed_message.id; //rowHTML += '<tr '+current_computed_message.colorAtt+' class="' + tr_class + '" id="msg_'+current_computed_message.id+'" data-id="'+current_computed_message.id+'">'; var rowHTML = ""; //rowHTML += '<tr '+current_computed_message.colorAtt+' class="' + tr_class + '" id="msg_'+current_computed_message.id+'" data-id="'+current_computed_message.id+'">'; if (age > (60 * 60 * 12)) { rowHTML += '<td class="ct_td" style="color:red">' + formated_age + '</td>'; } else if (age > 600) rowHTML += '<td class="ct_td">' + formated_age + '</td>'; else if (age > 120) rowHTML += '<td class="ct_td" style="color:yellow">' + formated_age + '</td>'; else rowHTML += '<td class="ct_td" style="color:green">' + formated_age + '</td>'; rowHTML += '<td class="ct_td">' + current_computed_message.player + '</td>'; rowHTML += '<td class="ct_td"><a href="' + current_computed_message.coordinates_url + '">' + current_computed_message.coordinates + '</a></td>'; rowHTML += '<td class="ct_td tooltipLeft" title="'+recycler_title+'">' + fleet_title + '</td>'; if (defense_title == "0") rowHTML += '<td class="ct_td" style="color:red">' + defense_title + '</td>'; else rowHTML += '<td class="ct_td">' + defense_title + '</td>'; rowHTML += '<td class="ct_td" style="color:lightgrey">' + current_computed_message.metal + '</td>'; rowHTML += '<td class="ct_td" style="color:lightblue">' + current_computed_message.crystal + '</td>'; rowHTML += '<td class="ct_td" style="color:cyan">' + current_computed_message.deut + '</td>'; rowHTML += '<td class="ct_td">' + current_computed_message.booty+'%' + '</td>'; rowHTML += '<td style="color:'+current_computed_message.colorAtt+';" class="ct_td"><a href="'+current_computed_message.linkGT+'">' + current_computed_message.gt + '</a></td>'; rowHTML += '<td style="color:'+current_computed_message.colorAtt+';" class="ct_td"><a href="'+current_computed_message.linkPT+'">' + current_computed_message.pt + '</a></td>'; rowHTML += '<td class="ct_td">'+simulator+'</td>'; rowHTML += '<td class="ct_td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x0CYDB40SXuB/8kfTVD4TzTWBR8ZqJb42+SVTJPmF1BuDdMWbL7NkjSfS8NOqfbH4+4g8+w15FoZ5Tjvew8eiNjYxXVLJWqIGqjrLAtty3ggAaH+y8NMr7+fkjrNRSmloJzHPruZh2motyO97u1uNVjbfSNMVjdlxThuYx47SPxgLV7mm6w8ij+hlpLPjRjNdsXPv733Y+iXAANc0GruC56fxAAAAAElFTkSuQmCC\'" ; rowHTML += '<td class="ct_td"><button style="background-color: Transparent;" onClick="sendShips(6,'+ coord + ',1,2)"><img src=' + probeImage + '/> </button> </td>'; row.innerHTML = rowHTML; } return content; } tableObject.replaceChild(createTBody(), tableObject.tBodies[0]); document.getElementById("ageCol").addEventListener ("click", function() {updateCol(orderByAge)}, false); document.getElementById("fleetCol").addEventListener ("click", function() {updateCol(orderByFleet)}, false); document.getElementById("defCol").addEventListener ("click", function() {updateCol(orderByDef)}, false); document.getElementById("lootCol").addEventListener ("click", function() {updateCol(orderByResources)}, false); document.getElementById("metalCol").addEventListener ("click", function() {updateCol(orderByMetal)}, false); document.getElementById("cystalCol").addEventListener ("click", function() {updateCol(orderByCrystal)}, false); document.getElementById("deutCol").addEventListener ("click", function() {updateCol(orderByDeut)}, false); } } } if(/page=fleet1/.test(location.href) && /addGT=/.test(location.href) ) { var idPlayer =document.getElementsByName('ogame-player-id')[0].content; var serveur = document.getElementsByName('ogame-universe')[0].content; var listeRC=Vu_getValue('listeRc'+serveur+idPlayer, '1||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||').split('|'); listeRC[parseInt(listeRC[0])+1]=location.href.split(/addGT=/g)[1]; listeRC[0]=(parseInt(listeRC[0])+1)%250; Vu_setValue('listeRc'+serveur+idPlayer, listeRC.join('|')); } else if (/page=research/.test(location.href)) { var techs = ""; try { techs += document.getElementById("details109").getElementsByClassName("level")[0].innerHTML.replace(/[^0-9]/g, '') + "|"; techs += document.getElementById("details110").getElementsByClassName("level")[0].innerHTML.replace(/[^0-9]/g, '') + "|"; techs += document.getElementById("details111").getElementsByClassName("level")[0].innerHTML.replace(/[^0-9]/g, '') + "|"; techs += document.getElementById("details115").getElementsByClassName("level")[0].innerHTML.replace(/[^0-9]/g, '') + "|"; techs += document.getElementById("details117").getElementsByClassName("level")[0].innerHTML.replace(/[^0-9]/g, '') + "|"; techs += document.getElementById("details118").getElementsByClassName("level")[0].innerHTML.replace(/[^0-9]/g, ''); } catch (err) { console.log("Failed to get techs : " + err); techs = "0|0|0|0|0|0"; } Vu_setValue("techs", techs); } else setInterval(raidsTable_init, 150); })();