EpicFriend

By Babaorum Last update Dec 1, 2008 — Installed 183 times.

There are 23 previous versions of this script.

Add Syntax Highlighting (this will take a few seconds, probably freezing your browser while it works)

//# -*- coding: utf-8 -*-

// ==UserScript==

// @namespace     http://epicwar.baba0rum.com

// @name          EpicFriend

// @version       1.01

// @author        Babaorum

// @description   Informations stratégiques supplémentaires pour le jeu EpicWar

// @include       http://*.epic-war.net/map_user.php

// @include       http://*.epic-war.net/inventaire.php

// @include       http://*.epic-war.net/princ.php

// @include       http://*.epic-war.net/esc_frame.php?x=0

// ==/UserScript==

EpicFriend = {

	

	

	/***********************************************************************

	 *  Initialisation des variables de classe

	 ***********************************************************************/

	 

	 // OPTIONS QUE L'UTILISATEUR PEUT MODIFIER

	 

	Options : {

		MesEscouades : {

			venice : "",

			xaeno : "",

			babel : ""

		},

		Vue : {

			BordureMemeEscouade : {

				couleur : "lime",

				epaisseur : "1px",

				style : "dotted"

			},

			BordureDieu : {

				couleur : "blue",

				epaisseur : "1px",

				style : "solid"

			},

			TransparenceAnnotations : 0.75,

			SeparateurCodesAbregesEnchantements : " ",

			TaillePoliceEnchantements : 8,   //valeur de pixels

			EpaisseurPoliceEnchantements : "normal",

			TailleMiniPoliceNiveauRace : 8,   //valeur de pixels

			EpaisseurPoliceNiveauRace : "normal",

			TailleMiniPolicePV : 8,   //valeur de pixels

			EpaisseurPolicePV : "normal"

		},

		Rapport : {

			CouleurDieu : "orangered",

			CouleurMemeEscouade : "maroon"

		},

		CodesRaces : {

			1 : ["Humain", "blue"],

			2 : ["Elfe", "red"],

			3 : ["Mort-vivant", "black"],

			4 : ["Orque", "#015F00"]

		},

		CodesAbregesEnchantements : {

			"Bénédiction du guerrier" : "B",

			"Résistance" : "R",

			"Dextérité féline" : "D",

			"Altération vers perforant" : "Ap",

			"Altération vers enchantement" : "Aen",

			"Aura" : "A",

			"Surpuissance" : "S",

			"Furtivité" : "F",

			"Garde du corps" : "G",

			"Arme salvatrice" : "As",

			"Entrave psychique" : "E*",

			"Poison" : "P*"

		}

	},

	

	// Autres variables de classe: ne pas modifier

	Joueurs : [],

	RapportVue : [],

	RapportVueBBCode : [],

	RapportVueCoolForum : [],

	RapportVueLesForums : [],

	

	Inventaire : {

		horsCape : [],

		dansCape : [],	

		poidsTotalHorsCape : 0,

		poidsTotalDansCape : 0,

		rapport : ""

	},

	

	CodesAlignements : {

		"0" : "Aventurier",

		"1" : "Combattant",

		"10" : "Magicien",

		"11" :  "Enchanteur",

		"12" : "Invocateur",

		"13" : "Berserk",

		"14" : "Fou de guerre",

		"15" : "Hussard",

		"16" : "Garde impérial",

		"17" : "Paladin",

		"18" : "Chevalier noir",

		"19" : "Bandit",

		"2" : "Rôdeur",

		"22" : "Ménestrel",

		"25" : "Mage de guerre",

		"26" : "Sorcier",

		"27" : "Illusionniste",

		"28" : "Elémentaliste",

		"29" : "Nécromant",

		"3" : "Apprenti",

		"30" : "Conjurateur",

		"31" : "Dieu (Berserk)",

		"32" : "Dieu (Fou de guerre)",

		"33" : "Dieu (Hussard)",

		"34" : "Dieu (Garde impérial)",

		"35" : "Dieu (Paladin)",

		"36" : "Dieu (Chevalier noir)",

		"37" : "Dieu (Bandit)",

		"38" : "Dieu (Hors-la-loi)",

		"39" : "Dieu (Troubadour)",

		"4" : "Barbare",

		"40" : "Dieu (Ménestrel)",

		"41" : "Dieu (Assassin)",

		"42" : "Dieu (Pisteur) (ceci n'est PAS un canular ^^)",

		"43" : "Dieu (Mage de guerre)",

		"44" : "Dieu (Sorcier)",

		"45" : "Dieu (Illusionniste)",

		"46" : "Dieu (Elémentaliste)",

		"47" : "Dieu (Nécromant)",

		"48" : "Dieu (Conjurateur)",

		"49" : "Enfant",

		"5" : "Soldat",

		"7" : "Brigand",

		"8" : "Barde",

		"9" : "Prédateur",

		"6" : "Chevalier",

		"9" : "Prédateur",

		"20" : "Hors-la-loi",

		"21" : "Troubadour",

		"23" : "Assassin",

		"24" : "Pisteur"

	},

	

	CodesEnchantements : {

		"bene" : "Bénédiction du guerrier",

		"resist" : "Résistance",

		"feline" : "Dextérité féline",

		"a12" : "Altération vers perforant",

		"a16" : "Altération vers enchantement",

		"aura" : "Aura",

		"surpuissance" : "Surpuissance",

		"immo" : "Entrave psychique",

		"furtif" : "Furtivité",

		"gardecorps2" : "Garde du corps",

		"salvatrice" : "Arme salvatrice"

	},

	

	AnnotationsConstruites : false,

	

	

	

	/***********************************************************************

	 *  Méthodes et fonctions

	 ***********************************************************************/

	

	

	// Amélioration de l'interface utilisateur de la vue/carte

	

	AmeliorerInterfaceVue : function()

	{

		var oDernierItemMenu;

		for(var n = 0, oLien; oLien = document.getElementsByTagName("a")[n]; n++)

		{

			oLien.style.fontSize = "11px";

			oLien.style.margin = "0 1px";

			if(oLien.className == "pp" && /D.co\./.test(oLien.firstChild.nodeValue))

			{

				oCenterMenu = oLien.parentNode;

				oCenterMenu.style.width = "100%";

				oCenterMenu.setAttribute("id", "epicvision_center_menu_carte");

			}

		}

		EpicFriend.AjouterLienMenu("Esc.", "esc_frame.php?x=0", "Menu escouade", "f2");

		EpicFriend.AjouterLienMenu("I./C.", "show_stats_rp.php", "Info/Carte", "f2");

		//EpicFriend.AjouterLienMenu("TLJ", "javascript:(function() {top.frames['f2'].location.href='msg_frame.php?x=2'; window.prompt('Liste des joueurs de votre race dans la vue :', '" + EpicFriend.JoueursMaRace() + "');})()", "Obtenir une liste de destinataires de tous les joueurs de même race dans votre vue (copier-coller la sélection)", "");

		EpicFriend.AjouterLienMenu("Qui?", "javascript:(function() {window.open('http://" + serveur + ".epic-war.net/index.php?x=2&uni=" + (serveur == "venice" ? "1" : serveur == "xaeno" ? "2" : serveur == "babel" ? "3" : "") + "&race=0&align=0&order=xp&pj=' + window.prompt('Qui?') + '&escouade=&x=2');})()", "Voir le profil d'un joueur dans le classement", "");

		if(document.getElementById("map")) EpicFriend.AjouterLienMenu("VueEpic", "javascript:evRapport();", "Afficher le rapport de vue", "");

		EpicFriend.AjouterLienMenu("MobilEpic", "http://epicwar.baba0rum.com/mobilepic.php", "Calculateur de rush", "_blank");

		EpicFriend.AjouterLienMenu("EquipEpic", "http://epicwar.baba0rum.com/equip_ew_court.htm", "Tout l'équipement du jeu", "_blank");

		EpicFriend.AjouterLienMenu("ADP", "http://www.aidedespics.net/index.php?version=" + (serveur == "venice" ? "1" : serveur == "xaeno" ? "2" : serveur == "babel" ? "3" : ""), "Aide des Pics", "_blank");

		EpicFriend.AjouterLienMenu("Actu.", "http://" + serveur + ".epic-war.net/map_user.php", "Actualiser la vue", "f1");

		oCenterMenu.innerHTML = oCenterMenu.innerHTML.replace(/Inventaire/, "Inv.").replace(/Messagerie/, "Msg").replace(/Options/, "Opt.").replace(/Message allié/, "MA");

		oCenterMenu.innerHTML = oCenterMenu.innerHTML.replace(/ *\|\| */g, "<span style='font-size:8px'> </span>|<span style='font-size:8px;'> </span>");

	},

	AjouterLienMenu : function(sTexte, sHref, sTitre, sCible)

	{

		var oConteneur = document.getElementById("epicvision_center_menu_carte");

		var oLien = document.createElement("a");

		oLien.className = "pp";

		oLien.href = sHref;

		oLien.style.fontSize = "11px";

		oLien.style.margin = "0 1px";

		oLien.setAttribute("title", sTitre);

		if(sCible != "") oLien.target = sCible;

		oLien.appendChild(document.createTextNode(sTexte));

		oConteneur.insertBefore(oLien, oConteneur.lastChild);

		var oTexteSeparateur = document.createTextNode(" || ");

		oConteneur.insertBefore(oTexteSeparateur, oConteneur.lastChild);

	},

	

	

	// Générateur de rapport textuel des créatures sur la carte (joueurs alliés et ennemis, ainsi que les familiers; pas les monstres)

	

	ParserEnchantements : function(sChaine)

	{

		var aListe = sChaine.match(/img\/s\/.+?\.gif/g);

		var aA = [];

		for(var n in aListe)

		{

			var sCode = aListe[n].match(/img\/s\/(.+?)\.gif/)[1];

			if(EpicFriend.CodesEnchantements[sCode] != "" && EpicFriend.CodesEnchantements[sCode] != null)

			{

				aA.push(EpicFriend.CodesEnchantements[sCode]);

			}

		}

		return aA;

	},

	

	ConstruireRapportVue : function()

	{

		var aA = [];

		var aHumains = EpicFriend.Joueurs.filter(function(element, indice, array) { return element.race == "Humain"; });

		var aElfes = EpicFriend.Joueurs.filter(function(element, indice, array) { return element.race == "Elfe"; });

		var aOrques = EpicFriend.Joueurs.filter(function(element, indice, array) { return element.race == "Orque"; });

		var aMortsVivants = EpicFriend.Joueurs.filter(function(element, indice, array) { return element.race == "Mort-vivant"; });

		var aTousLesDestinataires = [];

		var aDestinatairesHorsEscouade = [];

		var aProprietairesFamiliers = [];

		for(var n = 0, aMetaListe; aMetaListe = [[aHumains, "HUMAINS"], [aElfes, "ELFES"], [aOrques, "ORQUES"], [aMortsVivants, "MORTS-VIVANTS"]][n]; n++)

		{

			var aListe = aMetaListe[0];

			var sRace = aMetaListe[1];

			if(aListe.length > 0)

			{

				if(aA.length > 0) aA.push("");

				aA.push(sRace + " (" + aListe.length + ")");

				aA.push("");

				for(var p = 0, oJoueur; oJoueur = aListe[p]; p++)

				{

					aEnchantementsAbreges = oJoueur.enchantements.map(function(element) { return EpicFriend.Options.CodesAbregesEnchantements[element]; });

					if(oJoueur.creature == "joueur")

					{

						aA.push(oJoueur.x+"/"+oJoueur.y+" <b>"+(oJoueur.alignement.indexOf("Dieu") > -1? "<span style='color:"+EpicFriend.Options.Rapport.CouleurDieu+";'>" : oJoueur.escouade == monEscouade && monEscouade != ""? "<span style='color:"+EpicFriend.Options.Rapport.CouleurMemeEscouade+";'>" : "")+oJoueur.nom+((oJoueur.alignement.indexOf("Dieu") > -1 || (oJoueur.escouade == monEscouade && monEscouade != ""))? "</span>" : "")+"</b> : <span style='color:"+(EpicFriend.AlignementPrimitif(oJoueur.alignement) == "Combattant"? "blue" : EpicFriend.AlignementPrimitif(oJoueur.alignement) == "Rôdeur"? "green" : EpicFriend.AlignementPrimitif(oJoueur.alignement) == "Apprenti"? "purple" : "black")+";'>"+oJoueur.alignement+"</span> "+oJoueur.race+" "+oJoueur.niveau+(oJoueur.escouade.length != ""? " <i>("+oJoueur.escouade+")</i>":"")+" - PV <b>"+oJoueur.PV+"</b>/"+oJoueur.PVMax+(aEnchantementsAbreges.length > 0 ? " ("+aEnchantementsAbreges.join(", ")+")":""));

					}

					if(oJoueur.creature == "familier")

					{

						aA.push(oJoueur.x+"/"+oJoueur.y+" "+oJoueur.nom+" : familier "+oJoueur.race+" "+oJoueur.niveau+" de "+oJoueur.proprio+" - PV <b>"+oJoueur.PV+"</b>/"+oJoueur.PVMax+ (aEnchantementsAbreges.length > 0 ? " ("+aEnchantementsAbreges.join(", ")+")":""));

					}

					if(oJoueur.creature == "squelette")

					{

						aA.push(oJoueur.x+"/"+oJoueur.y+" Squelette : "+oJoueur.alignement+" "+oJoueur.race+" "+oJoueur.niveau+" - PV <b>"+oJoueur.PV+"</b>/"+oJoueur.PVMax);

					}

					if(oJoueur.race == maRace)

					{

						if(oJoueur.creature == "joueur")

						{

							if(aTousLesDestinataires.indexOf(oJoueur.nom) == -1) aTousLesDestinataires.push(oJoueur.nom);

							if(oJoueur.escouade != monEscouade && aDestinatairesHorsEscouade.indexOf(oJoueur.nom) == -1) aDestinatairesHorsEscouade.push(oJoueur.nom);

						}

						else

						{

							if(aProprietairesFamiliers.indexOf(oJoueur.proprio) == -1) aProprietairesFamiliers.push(oJoueur.proprio);

						}

					}

				}

			}

		}

		aA.push("");

		aA.push("<b>MESSAGERIE</b> ("+maRace.toUpperCase()+") :");

		aA.push("- <u>Tous</u>:");

		aA.push(aTousLesDestinataires.join("; "));

		aA.push("- <u>Hors escouade</u>:");

		if(aDestinatairesHorsEscouade.length > 0) aA.push(aDestinatairesHorsEscouade.join("; "));

		aA.push("- <u>Propriétaires de familiers</u>:");

		if(aProprietairesFamiliers.length > 0) aA.push(aProprietairesFamiliers.join("; "));

		EpicFriend.RapportVue = aA;

		EpicFriend.RapportVueBBCode = aA.map(function(element) { return element.replace(/</g, "[").replace(/>/g, "]").replace(/span style=\'color:(.+?);\'/g, "color=$1").replace(/\[\/span\]/g, "[/color]"); });

		EpicFriend.RapportVueLesForums = aA.map(function(element) { return element.replace(/</g, "[").replace(/>/g, "]").replace(/span style=\'color:(.+?);\'/g, "c $1").replace(/\[\/span\]/g, "[/c]"); });	

		EpicFriend.RapportVueCoolForum = aA.map(function(element) { return element.replace(/<b>(.+?)<\/b>/g, "[bold]$1[/bold]").replace(/<i>(.+?)<\/i>/g, "[ita]$1[/ita]").replace(/<u>(.+?)<\/u>/g, "[under]$1[/under]").replace(/<span style=\'color:(.+?);\'>(.+?)<\/span>/g, "[color=$1]$2[/color]"); });		

	},

	

	

	// Annotation de la carte du joueur: niveau, race, PV et enchantements

	

	AnnoterVue : function()

	{

		if(EpicFriend.AnnotationsConstruites)

		{

			for(var n = 0, oDiv; oDiv = document.getElementById("map").getElementsByTagName("div")[n]; n++)

			{

				if(oDiv.className.indexOf("epicvision_") > -1)

				{

					oDiv.style.display = "block";

				}

			}

		}

		else

		{

			var iCompteur = 0;

			for(var n = 0, oLien; oLien = document.getElementById("map").getElementsByTagName("a")[n]; n++)

			{

				if(/(?:<u>Niveau(?: Divin)? :<\/u>)|(?:<u>lvl :<\/u>)|(?:Cliquez pour visualiser le menu\.)/.test(oLien.getAttribute("onmouseover")) && ! /Monstre :/.test(oLien.getAttribute("onmouseover")))

				{

					iCompteur++;

					var oJoueur = EpicFriend.Joueurs[iCompteur - 1];

					var oDivEpicFriend = document.createElement("div");

					with(oDivEpicFriend)

					{

						setAttribute("class", "epicvision_annotation");

						setAttribute("id", "epicvision_" + oJoueur.x + "_" + oJoueur.y);

						style.position = "absolute";

						style.top = "0px";

						style.left = "0px";

						style.width = "40px";

						style.height = "40px";

						style.zIndex = "999";

						style.backgroundColor = "none";

						style.opacity = EpicFriend.Options.Vue.TransparenceAnnotations;

						setAttribute("onmouseover", "this.style.opacity = 1.0");

						setAttribute("onmouseout", "this.style.opacity = " + EpicFriend.Options.Vue.TransparenceAnnotations);

						if(oJoueur.creature == "joueur")

						{

							if(oJoueur.escouade == monEscouade && monEscouade != "")

							{

								//~ style.outlineColor = EpicFriend.Options.Vue.BordureMemeEscouade.couleur;

								//~ style.outlineWidth = EpicFriend.Options.Vue.BordureMemeEscouade.epaisseur;

								//~ style.outlineStyle = EpicFriend.Options.Vue.BordureMemeEscouade.style;

								style.borderColor = EpicFriend.Options.Vue.BordureMemeEscouade.couleur;

								style.borderWidth = EpicFriend.Options.Vue.BordureMemeEscouade.epaisseur;

								style.borderStyle = EpicFriend.Options.Vue.BordureMemeEscouade.style;

							}

							if(oJoueur.alignement.indexOf("Dieu") > -1)

							{

								//~ style.outlineColor = EpicFriend.Options.Vue.BordureDieu.couleur;

								//~ style.outlineWidth = EpicFriend.Options.Vue.BordureDieu.epaisseur;

								//~ style.outlineStyle = EpicFriend.Options.Vue.BordureDieu.style;

								style.borderColor = EpicFriend.Options.Vue.BordureDieu.couleur;

								style.borderWidth = EpicFriend.Options.Vue.BordureDieu.epaisseur;

								style.borderStyle = EpicFriend.Options.Vue.BordureDieu.style;

							}

						}

						appendChild(document.createTextNode(" "));

					}

					var oDivNivRace = document.createElement("div");

					with(oDivNivRace)

					{

						setAttribute("class", "epicvision_niveau_race");

						style.position = "absolute";

						style.top = "1px";

						style.left = "1px";

						style.width = "auto";

						style.margin = 0;

						style.padding = 0;

						style.fontFamily = "Arial";

						style.fontSize = (parseInt(oJoueur.niveau) >= 25) ? ((EpicFriend.Options.Vue.TailleMiniPoliceNiveauRace+4)+"px") : (parseInt(oJoueur.niveau) <25 && parseInt(oJoueur.niveau) >= 20) ? ((EpicFriend.Options.Vue.TailleMiniPoliceNiveauRace+3)+"px") : (parseInt(oJoueur.niveau) <20 && parseInt(oJoueur.niveau) >= 15) ? ((EpicFriend.Options.Vue.TailleMiniPoliceNiveauRace+2)+"px") : (parseInt(oJoueur.niveau) <15 && parseInt(oJoueur.niveau) >= 10) ? ((EpicFriend.Options.Vue.TailleMiniPoliceNiveauRace+1)+"px") : (EpicFriend.Options.Vue.TailleMiniPoliceNiveauRace+"px");

						style.fontWeight = EpicFriend.Options.Vue.EpaisseurPoliceNiveauRace;

						style.backgroundColor = oJoueur.couleurRace;

						style.color = "white";

						style.opacity = 0.75;

						appendChild(document.createTextNode(oJoueur.niveau));

					}

					oDivEpicFriend.appendChild(oDivNivRace);

					if(oJoueur.PV != "?")

					{

						var nRapportPV = parseInt(oJoueur.PV) / parseInt(oJoueur.PVMax);

						var oDivPV = document.createElement("div");

						with(oDivPV)

						{

							setAttribute("class", "epicvision_pv");

							style.position = "absolute	";

							style.top = "1px";

							style.right = "1px";

							style.width = "auto";

							style.margin = 0;

							style.padding = 0;

							//~ style.fontFamily = "Arial Narrow";

							style.fontFamily = "Arial";

							style.fontSize = (nRapportPV < 0.2 || parseInt(oJoueur.PV) < 50)? ((EpicFriend.Options.Vue.TailleMiniPolicePV+4)+"px"): (nRapportPV < 0.5 && nRapportPV >= 0.2)? ((EpicFriend.Options.Vue.TailleMiniPolicePV+3)+"px") : (nRapportPV < 0.8 && nRapportPV >= 0.5)? ((EpicFriend.Options.Vue.TailleMiniPolicePV+2)+"px") : (nRapportPV >= 0.8 && nRapportPV < 1 && (oJoueur.PVMax - oJoueur.PV) >= 20)? ((EpicFriend.Options.Vue.TailleMiniPolicePV+1)+"px") : (EpicFriend.Options.Vue.TailleMiniPolicePV+"px");

							style.fontWeight = EpicFriend.Options.Vue.EpaisseurPolicePV;

							style.backgroundColor = "yellow";

							style.color = "black";

							appendChild(document.createTextNode(oJoueur.PV));

						}

						oDivEpicFriend.appendChild(oDivPV);

					}

					if(oJoueur.enchantements.length>0)

					{

						var oDivEnchantements = document.createElement("div");

						with(oDivEnchantements)

						{

							setAttribute("class", "epicvision_enchantements");

							style.position = "absolute";

							style.bottom = "1px";

							style.left = "1px";

							//~ style.width = "38px";

							style.width = "auto";

							style.margin = 0;

							style.padding = "0 1px 0 0";

							style.fontFamily = "Arial Narrow";

							style.fontSize = EpicFriend.Options.Vue.TaillePoliceEnchantements;

							style.fontWeight = EpicFriend.Options.Vue.EpaisseurPoliceEnchantements + "px";

							style.lineHeight = "1em";

							style.backgroundColor = "white";

							style.color = "black";

							//~ style.opacity = 0.9;

							var aEnchantements = oJoueur.enchantements.map(function(element) { return EpicFriend.Options.CodesAbregesEnchantements[element]; });

							//~ appendChild(document.createTextNode(aEnchantements.join(",")));

						}

						for(var p = 0, sEnchantement; sEnchantement = aEnchantements[p]; p++)

						{

							var oSpan = document.createElement("span");

							if(sEnchantement.indexOf("*") > -1)

							{

								oSpan.style.color = "#ee4444";

								sEnchantement = sEnchantement.replace(/\*/, "");

							}

							oSpan.appendChild(document.createTextNode(sEnchantement));

							oDivEnchantements.appendChild(oSpan);

							if(aEnchantements[p+1] != null) oDivEnchantements.appendChild(document.createTextNode(EpicFriend.Options.Vue.SeparateurCodesAbregesEnchantements));

						}

						oDivEpicFriend.appendChild(oDivEnchantements);

					}

					oLien.appendChild(oDivEpicFriend);

				}

			}

			EpicFriend.AnnotationsConstruites = true;

		}

	},

	

	EnleverAnnotations : function()

	{

		for(var n = 0, oDiv; oDiv = document.getElementById("map").getElementsByTagName("div")[n]; n++)

		{

			if(oDiv.className == "epicvision_annotation")

			{

				oDiv.style.display = "none";

			}

		}

	},

	

	

	// Peuplement de la base de donnée JSON des créatures de la carte

	

	AnalyserJoueurs : function()

	{

		var aImages = document.getElementById("map").getElementsByTagName("img");

		for(var n=0; n<aImages.length; n++)

		{

			var sRace, sCouleurRace, sAlignement, sX, sY, sPV = "?", sPVMax = "?", sNiveau, sNom, aEnchantements = [], sEscouade = "", sCreature; 

			if(/\/img\/p\/\d\/\d/.test(aImages[n].src))

			{

				sCreature = "joueur";

				var aA = /\/img\/p\/\d\/(\d)\/\d_(\d+)\.gif/.exec(aImages[n].src);

				sRace = EpicFriend.Options.CodesRaces[aA[1]][0];

				sCouleurRace = EpicFriend.Options.CodesRaces[aA[1]][1];

				sAlignement = EpicFriend.CodesAlignements[aA[2]];

				var sOmo = aImages[n].parentNode.getAttribute("onmouseover").match(/return overlib\('(.+?)'/)[1];

				if(/Cliquez pour visualiser le menu/.test(sOmo))

				{

					sEscouade = monEscouade;

					[, sX, sY] = /<b>(\d+) \/ (\d+) <\/b>/.exec(sOmo);

					[, sPV, sPVMax] = /Pv : (\d+) \/ (\d+)/.exec(document.getElementById("regeneration").firstChild.nodeValue);

					[, sNiveau] = /Niveau : (\d+)/.exec(document.getElementById("lvl_or").previousSibling.nodeValue);

					sNom = document.getElementsByTagName("a")[0].firstChild.firstChild.nodeValue;

					if(/img\/s\/.+?\.gif/.test(document.getElementById("lvl_or").parentNode.parentNode.nextSibling.firstChild.innerHTML))

					{

						aEnchantements = EpicFriend.ParserEnchantements(document.getElementById("lvl_or").parentNode.parentNode.nextSibling.firstChild.innerHTML);

					}

				}

				else

				{

					var sData = "";

					[, sX, sY, sNom, sNiveau, sData] = /<b>(\d+) \/ (\d+).+?<b>(.+?)<\/b>.+?<u>Niveau(?: Divin)? :<\/u> <b>(\d+)<\/b>(.*)/.exec(sOmo);

					if(/<u>Escouade :<\/u>/.test(sData)) [, sEscouade] = /<u>Escouade :<\/u> (?:<img src=.+?> )?([^<>]+)/.exec(sData);



					if(/<u>Pv :<\/u>/.test(sData)) [, sPV, sPVMax] = /<u>Pv :<\/u> (\d+) \/ (\d+)/.exec(sData);

					if(/<u>Enchantement\(s\) actif\(s\) :<\/u>/.test(sData))

					{

						aEnchantements = EpicFriend.ParserEnchantements(sData);

					}

				}

				EpicFriend.Joueurs.push({

					x : sX,

					y : sY,

					nom : sNom,

					creature : sCreature,

					race : sRace,

					couleurRace : sCouleurRace,

					alignement : sAlignement,

					niveau : sNiveau,

					escouade : sEscouade,

					PV : sPV,

					PVMax : sPVMax,

					enchantements : aEnchantements			

				});

			}

			if(/\/img\/a\/\d\/\d\d*\.gif/.test(aImages[n].src))

			{

				sCreature = "familier";

				var aA = /\/img\/a\/\d\/(\d)\d*/.exec(aImages[n].src);

				sRace = EpicFriend.Options.CodesRaces[aA[1]][0];

				sCouleurRace = EpicFriend.Options.CodesRaces[aA[1]][1];

				sAlignement = "Familier";

				var sOmo = aImages[n].parentNode.getAttribute("onmouseover").match(/return overlib\('(.+?)'/)[1];

				var sData = "", sProprio;

				[, sX, sY, sNom, sProprio, sNiveau, sData] = /<b>(\d+) \/ (\d+).+?<b>Familier : <\/b>(.+?) \(.+?\)<br><u>Proprio :<\/u> (.+?)<br><u>lvl :<\/u> (\d+)(.*)/.exec(sOmo);

				if(/<u>Pv :<\/u>/.test(sData)) [, sPV, sPVMax] = /<u>Pv :<\/u> (\d+) \/ (\d+)/.exec(sData);

				if(/<u>Enchantement\(s\) actif\(s\) :<\/u>/.test(sData))

				{

					aEnchantements = EpicFriend.ParserEnchantements(sData);

				}

				EpicFriend.Joueurs.push({

					x : sX,

					y : sY,

					nom : sNom,

					creature : sCreature,

					race : sRace,

					couleurRace : sCouleurRace,

					alignement : sAlignement,

					niveau : sNiveau,

					proprio : sProprio,

					PV : sPV,

					PVMax : sPVMax,

					enchantements : aEnchantements			

				});				

			}

			if(/\/img\/q\/\d\/\d*\.gif/.test(aImages[n].src))

			{

				sCreature = "squelette";

				var sOmo = aImages[n].parentNode.getAttribute("onmouseover").match(/return overlib\('(.+?)'/)[1];

				var sData = "";

				[, sX, sY, sAlignement, sRace, sNiveau, sData] = /<b>(\d+) \/ (\d+).+?<b>Squelette : <\/b>(.+?) ((?:Elfe)|(?:Humain)|(?:Orque)|(?:Mort-vivant))<br><u>lvl :<\/u> (\d+)(.*)/.exec(sOmo);

				if(/<u>Pv :<\/u>/.test(sData)) [, sPV, sPVMax] = /<u>Pv :<\/u> (\d+) \/ (\d+)/.exec(sData);

				EpicFriend.Joueurs.push({

					x : sX,

					y : sY,

					nom : "",

					creature : sCreature,

					race : sRace,

					couleurRace : (sRace == "Humain"? EpicFriend.Options.CodesRaces[1][1] : sRace == "Elfe"? EpicFriend.Options.CodesRaces[2][1] : sRace == "Mort-vivant"? EpicFriend.Options.CodesRaces[3][1] : EpicFriend.Options.CodesRaces[4][1]),

					alignement : sAlignement,

					niveau : sNiveau,

					proprio : "",

					PV : sPV,

					PVMax : sPVMax,

					enchantements : []

				});

			}

		}

	},

	

	

	// Peuplement de la base de données des objets de l'inventaire

	

	AnalyserObjets : function()

	{

		var oTableN1 = document.getElementsByTagName("table")[1];

		var oTablesN2 = oTableN1.getElementsByTagName("table");

		var aCategories = ["arme", "protection", "sort", "enchantement", "divers"];

		for(var n = 0, oTN2; oTN2 = oTablesN2[n]; n++)

		{

			var sCategorie = aCategories[n];

			var oLiensN2 = oTN2.getElementsByTagName("a");

			for(var p = 0, oLN2; oLN2 = oLiensN2[p]; p++)

			{

				var oObjet = { nom: "", alignementMini: "", niveau: 0, poids: 0, coutPA: 0, typeDegats: "", portee: 0, categorie: sCategorie };

				var sOmo = oLN2.getAttribute("onmouseover");

				[, sOmo] = /return overlib\('(.+)'/.exec(sOmo);

				var aA = /<b>(.+?)<\/b>.*?<li>Niveau requis : (\d+)<li>Alignement minimum : (.+?)<li>Poids : (.+?)(<li>.*)/.exec(sOmo);

				[oObjet.nom, oObjet.niveau, oObjet.alignementMini, oObjet.poids, sOmo] = [aA[1], parseInt(aA[2]), aA[3], parseFloat(aA[4]), aA[5]];

				if(/<li>Coût PA/.test(sOmo))

				{

					[, sCoutPA, sOmo] = /<li>Coût PA : (\d+)(.*)/.exec(sOmo);

					oObjet.coutPA = parseInt(sCoutPA);

				}

				if(sCategorie == "arme" || sCategorie == "sort")

				{

					[, oObjet.typeDegats, sOmo] = /<li><u>Type de dégâts :<\/u>(.+?)(<li>.*)/.exec(sOmo);

					if(/<li><u>Type d\\'arme :<\/u> Corps à [cC]orps/.test(sOmo))

					{

						//Arme/sort de corps-à-corps (seul cas où le type d'arme est mentionné)

						oObjet.categorie += "CAC";

						[, sOmo] = /<li><u>Type d\\'arme :<\/u> Corps à [Cc]orps(.*)/.exec(sOmo);

					}

					else

					{

						//Arme/sort à distance (pas de mention du type d'arme et à la place: distance d'attaque)

						oObjet.categorie += "Distance";

						[, sPortee, sOmo] = /<li><u>Distance d\\'attaque :<\/u> ?(\d)(.*)/.exec(sOmo);

						oObjet.portee = parseInt(sPortee);

					}

				}

				if(sCategorie == "protection")

				{

					[, sOmo] = /<li>Equipé : Oui|Non(.*)/.exec(sOmo);

				}

				if(/<li>Dans la cape : Oui/.test(sOmo))

				{

					EpicFriend.Inventaire.dansCape.push(oObjet);

					EpicFriend.Inventaire.poidsTotalDansCape += oObjet.poids;

				}

				else

				{

					EpicFriend.Inventaire.horsCape.push(oObjet);

					EpicFriend.Inventaire.poidsTotalHorsCape += oObjet.poids;

				}

			}

		}

	},

	

	

	// Construction du rapport d'inventaire

	

	ConstruireRapportInventaire : function()

	{

		aTousLesObjets = EpicFriend.Inventaire.horsCape;

		for(var n in EpicFriend.Inventaire.dansCape) { aTousLesObjets.push(EpicFriend.Inventaire.dansCape[n]); }

		var s =  "";

		for(var n = 0, sCategorie; sCategorie = ["armeCAC", "armeDistance", "protection", "sortCAC", "sortDistance", "enchantement", "divers"][n]; n++)

		{

			if(s.length > 0) s += "<br/>";

			var aObjets = aTousLesObjets.filter(function(element) { return element.categorie == sCategorie; });

			for(var p = 0, oO; oO = aObjets[p]; p++)

			{

				s += "- " + oO.nom + " (" + oO.alignementMini + " " + oO.niveau + ", " + oO.poids + "kg)<br/>";

			}

		}

		EpicFriend.Inventaire.rapport = s;

	},

	

	

	// Affichage d'informations supplémentaires concernant le poids total de l'inventaire

	

	AmeliorerInterfaceInventaire : function()

	{

		var oI = document.getElementsByTagName("table")[1].nextSibling.nextSibling;

		var aA = /Poids total : ([\d\.]+?) \/ ([\d\.]+?) kg/.exec(oI.innerHTML);

		var [nPoidsActuel, nPoidsTotal] = [parseFloat(aA[1]), parseFloat(aA[2])];

		var nRapportPoids = nPoidsActuel / nPoidsTotal;

		oI.innerHTML = "Poids actuel : <span" + ((nRapportPoids <= 0.10 || (nPoidsTotal - nPoidsActuel) <= 2)? " style='color:red'" : "") + ">" + nPoidsActuel + " / " + nPoidsTotal + " kg (libre: " + (nPoidsTotal - nPoidsActuel) + " kg)" + ((EpicFriend.Inventaire.dansCape.length > 0)? "<br/>(dans la cape: "+EpicFriend.TotalPoidsDansCape()+" kg; hors de la cape: "+EpicFriend.TotalPoidsHorsCape()+" kg)" : "");

		var oH1 = document.getElementsByTagName("h1")[0];

		var oDiv = document.createElement("div");

		with(oDiv)

		{

			setAttribute("style", "width: 100%; text-align: center;");

			innerHTML = "<a href='javascript:evInventaire();'>Résumé de l'inventaire</a>";

		}

		oH1.parentNode.insertBefore(oDiv, oH1.nextSibling);

	},

	

	InsererScriptInventaire : function()

	{

		var oHead = document.getElementsByTagName("head")[0];

		var oScript = document.createElement("script");

		with(oScript)

		{

			setAttribute("type", "text/javascript");

			setAttribute("language", "Javascript");

			setAttribute("id", "epicvision_inventaire");

		}

		var sCode = "function evInventaire() { var popupEVInventaire = window.open(); popupEVInventaire.document.write(\"<html><body style='margin:0;padding:1em;'><div style='width:100%;height:100%;border:none;'>\"+\"" + EpicFriend.Inventaire.rapport + "\"+\"</div></body></html>\"); popupEVInventaire.document.close(); }";

		oScript.appendChild(document.createTextNode(sCode));

		oHead.appendChild(oScript);

	},

	// Poids total dans ou hors de la cape

	

	TotalPoidsDansCape : function()

	{

		var n = 0;

		for(var i in EpicFriend.Inventaire.dansCape)

		{

			n += EpicFriend.Inventaire.dansCape[i].poids;

		}

		if(n.toString().indexOf(".") > -1) n = parseFloat(n.toString().match(/(\d+\.\d)\d*/)[1]);

		return n;

	},

	

	TotalPoidsHorsCape : function()

	{

		var n = 0;

		for(var i in EpicFriend.Inventaire.horsCape)

		{

			n += EpicFriend.Inventaire.horsCape[i].poids;

		}

		if(n.toString().indexOf(".") > -1) n = parseFloat(n.toString().match(/(\d+\.\d)\d*/)[1]);

		return n;

	},

	

	

	// Coloration des alignements de la page d'escouade

	

	ColorerAlignementsEscouade : function()

	{

		var oTable = document.getElementsByTagName("table")[4];

		for(var n = 1, oLigne; oLigne = oTable.getElementsByTagName("tr")[n]; n++)

		{

			var oCellule = oLigne.childNodes[1];

			var sAlignement = oCellule.firstChild.nodeValue;

			oCellule.innerHTML = "<span style=\"color: " + (EpicFriend.AlignementPrimitif(sAlignement) == "Combattant"? "navy" : EpicFriend.AlignementPrimitif(sAlignement) == "Rôdeur"? "green" : EpicFriend.AlignementPrimitif(sAlignement) == "Apprenti"? "purple" : "black") + ";\">" + sAlignement + "</span>";

		}

	},

	

	AlignementPrimitif : function(sAlignement)

	{

		if(/Fou de guerre|Berserk|Chevalier noir|Paladin|Garde impérial|Hussard|Barbare|Chevalier|Soldat|Combattant/.test(sAlignement)) return "Combattant";

		if(/Troubadour|Ménestrel|Assassin|Pisteur|Bandit|Hors-la-loi|Barde|Prédateur|Brigand|R[oô]deur/.test(sAlignement)) return "Rôdeur";

		if(/Illusionniste|Elémentaliste|Conjurateur|Nécromant|Mage de guerre|Sorcier|Enchanteur|Invocateur|Magicien|Apprenti/.test(sAlignement)) return "Apprenti";

		return "Aventurier";

	},

	// Fonctions annexes

	

	JoueursMaRace : function()

	{

		//~ sMaRace = "";

		//~ for(var n = 0, oDiv; oDiv = document.getElementsByTagName("div")[n]; n++)

		//~ {

			//~ if(oDiv.className == "ttt")

			//~ {

				//~ sMaRace = oDiv.firstChild.nodeValue.match(/(Humain|Elfe|Orque|Mort\-vivant)/)[1];

				//~ break;

			//~ }

		//~ }

		var aMemeRace = EpicFriend.Joueurs.filter(function(element) { return element.race == maRace && element.creature == "joueur"; });

		var aNoms = aMemeRace.map(function(element) { return element.nom; });

		return aNoms.join(";");

	},

	

	MaRace : function()

	{

		sMaRace = "";

		for(var n = 0, oDiv; oDiv = document.getElementsByTagName("div")[n]; n++)

		{

			if(oDiv.className == "ttt")

			{

				sMaRace = oDiv.firstChild.nodeValue.match(/(Humain|Elfe|Orque|Mort\-vivant)/)[1];

				break;

			}

		}

		return sMaRace;

	},

	

	InsererScriptRapport : function()

	{

		var oHead = document.getElementsByTagName("head")[0];

		var oScript = document.createElement("script");

		with(oScript)

		{

			setAttribute("type", "text/javascript");

			setAttribute("language", "Javascript");

			setAttribute("id", "epicvision_vue");

		}

		var sCode = "function evRapport() { var popupEVVue = window.open(); popupEVVue.document.write(\"<html><body style='margin:0;padding:1em;'><div>\"+\"" + EpicFriend.RapportVue.join("<br/>") + "\"+\"</div><h3>BBCode</h3><textarea onclick='this.select();' style='width:98%;height:15em;font-size:x-small;'>\"+\"" + EpicFriend.RapportVueBBCode.join("\\n") + "\"+\"</textarea><h3>CoolForum (forum officiel)</h3><textarea onclick='this.select();' style='width:98%;height:15em;font-size:x-small;'>\"+\"" + EpicFriend.RapportVueCoolForum.join("\\n") + "\"+\"</textarea><h3>Les-forums</h3><textarea onclick='this.select();' style='width:98%;height:15em;font-size:x-small;'>\"+\"" + EpicFriend.RapportVueLesForums.join("\\n") + "\"+\"</textarea></body></html>\"); popupEVVue.document.close(); }";

		oScript.appendChild(document.createTextNode(sCode));

		oHead.appendChild(oScript);

	},

	// Initialisation

	

	Load : function()

	{

		serveur = window.location.href.match(/http:\/\/(.+?)\.epic\-war\.net/)[1];

		monEscouade = EpicFriend.Options.MesEscouades[serveur];

		if(location.href.indexOf("map_user.php") > -1)

		{

			maRace = EpicFriend.MaRace();

			EpicFriend.AmeliorerInterfaceVue();

			if(document.getElementById("map"))

			{

				EpicFriend.AnalyserJoueurs();

				EpicFriend.AnnoterVue();

				EpicFriend.ConstruireRapportVue();

				EpicFriend.InsererScriptRapport();

			}

		}

		if(location.href.indexOf("inventaire.php") > -1)

		{

			EpicFriend.AnalyserObjets();

			EpicFriend.AmeliorerInterfaceInventaire();

			EpicFriend.ConstruireRapportInventaire();

			EpicFriend.InsererScriptInventaire();

		}

		if(location.href.indexOf("esc_frame.php?x=0") > -1)

		{

			EpicFriend.ColorerAlignementsEscouade();

		}

		//~ GM_registerMenuCommand("EpicFriend : Annoter carte", EpicFriend.Annoter);

		//~ GM_registerMenuCommand("EpicFriend : Enlever les annotations", EpicFriend.EnleverAnnotations);

	}

	

}

EpicFriend.Load();

//.user.js