Senatus Populus Que Romanus Ansaerys - Uni5: forum de l'alliance SPQR |
| | Nouvelle gestion de la flotte | |
| | Auteur | Message |
---|
Djus Admin
Messages : 151 Date d'inscription : 19/01/2008 Age : 42 Localisation : Val-de-Marne (94)
| Sujet: Re: Nouvelle gestion de la flotte Lun 26 Mai - 8:12 | |
| Ave, J'ai réussi à organiser l'envoi des flottes sur la base du code de Bad bird utilisé pour l'alarme. Je stocke la page dans un buffer et je cherche les données, bingo, ça me permet d'avoir les ressources à quai. Faut beta tester mais le résultat a l'air pas mal. Voici le log du compilateur: - Citation :
- **************--- Démarrage du cycle.
Envoi des extracteurs de [46:80:5] vers [46:80:2]... Envoi des extracteurs de [46:80:5] vers [46:80:10]... Envoi des extracteurs de [46:80:5] vers [46:80:1]... Stationnement de flotte de [46:80:5] vers [46:80:5]... Transport de Titane: 1277484744 Carbone: 662149956 Trtium: 54710327 Envoi des extracteurs de [44:73:4] vers [44:73:2]... Stationnement de flotte de [44:73:4] vers [44:73:4]... Transport de Titane: 248934828 Carbone: 48196688 Trtium: 33788972 Envoi des extracteurs de [48:83:5] vers [48:83:2]... Stationnement de flotte de [48:83:5] vers [48:83:5]... Transport de Titane: 101149987 Carbone: 53272956 Trtium: 43204485 Prochain tour dans 58 minutes. Putain j'y ai passé la nuit lol, maintenant une bonne journée de taf en perspective malheur aux geeks. J'ai beaucoup hésité à vous attaquer dans la nuit lol. | |
| | | Starbuck
Messages : 13 Date d'inscription : 03/02/2008 Age : 47 Localisation : Château Thierry (02)
| Sujet: Re: Nouvelle gestion de la flotte Lun 26 Mai - 9:41 | |
| Ave Djus,
Bon c pas mal tout ca maintenant faut balancer le code... Mais le code sur le forum on se débrouillera !!!
@+ | |
| | | Djus Admin
Messages : 151 Date d'inscription : 19/01/2008 Age : 42 Localisation : Val-de-Marne (94)
| Sujet: Re: Nouvelle gestion de la flotte Lun 26 Mai - 12:06 | |
| Relou, je viens d'installer tout le matos au bureau. Pas moyen que le bot se connecte (oui j'ai bien mis le bon PHPSESSID). Le firewall doit bien brutaliser.
Bon mon code:
La fonction exploiter:
public void FunctionExploiter(String PHPSESSID, String thePath, int theGalaxie, int theSystem, int thePlanet, int relativePTarget, int nbExtra, String theSpeed){ try { //FonctionKeepActiveTheConnection(PHPSESSID, thePath);
//String NbOfExtra = "50000"; String data = URLEncoder.encode("galaxie_dep", "UTF-8") + "=" + theGalaxie; data += "&" + URLEncoder.encode("systeme_dep", "UTF-8") + "=" + theSystem; data += "&" + URLEncoder.encode("planete_dep", "UTF-8") + "=" + thePlanet; data += "&" + URLEncoder.encode("categorie", "UTF-8") + "=1"; data += "&" + URLEncoder.encode("facteurvitesse", "UTF-8") + "=10"; data += "&" + URLEncoder.encode("categorie_arr", "UTF-8") + "=1"; data += "&" + URLEncoder.encode("vaisseau14", "UTF-8") + "=" + nbExtra; data += "&" + URLEncoder.encode("conso14", "UTF-8") + "=1000"; data += "&" + URLEncoder.encode("vitesse14", "UTF-8") + "=950"; data += "&" + URLEncoder.encode("capacite14", "UTF-8") + "=5000"; data += "&" + URLEncoder.encode("galaxie_arr", "UTF-8") + "=" + theGalaxie; data += "&" + URLEncoder.encode("systeme_arr", "UTF-8") + "=" + theSystem; data += "&" + URLEncoder.encode("planete_arr", "UTF-8") + "=" + (thePlanet + relativePTarget ); data += "&" + URLEncoder.encode("vitesse", "UTF-8") + "=" + theSpeed ; data += "&" + URLEncoder.encode("ordre", "UTF-8") + "=exploiter";
String myTrame; myTrame = FormatHTTPTrame("POST", PHPSESSID, "/index.php?categorie=flotte4"); myTrame += "Content-Type: application/x-www-form-urlencoded\r\n"; myTrame += "Content-Length: " + data.length() + "\r\n"; myTrame += "\r\n"; myTrame += data;
SocketSendData(myTrame);
System.out.println("Envoi des extracteurs de ["+theGalaxie+":"+theSystem+":"+thePlanet+ "] vers ["+theGalaxie+":"+theSystem+":"+(thePlanet + relativePTarget )+ "]..."); } catch (UnsupportedEncodingException ex) { Logger.getLogger(Threading.class.getName()).log(Level.SEVERE, null, ex); System.out.println("Error in FunctionExploiter! " + ex); } } | |
| | | Djus Admin
Messages : 151 Date d'inscription : 19/01/2008 Age : 42 Localisation : Val-de-Marne (94)
| Sujet: Re: Nouvelle gestion de la flotte Lun 26 Mai - 12:06 | |
| La fonction Stationnement:
public void FunctionSaveOres(String PHPSESSID, String thePath, int theGalaxie, int theSystem, int thePlanet, int relativeSTarget, int relativePTarget, long nbTL, String theSpeed){ try{ //FonctionKeepActiveTheConnection("Cookie: PHPSESSID=" + PHPSESSID + "\r\n", thePath); String oreTab[] = {"","",""}; String data = URLEncoder.encode("galaxie_dep", "UTF-8") + "=" + theGalaxie; data += "&" + URLEncoder.encode("systeme_dep", "UTF-8") + "=" + theSystem; data += "&" + URLEncoder.encode("planete_dep", "UTF-8") + "=" + thePlanet; data += "&" + URLEncoder.encode("categorie", "UTF-8") + "=1"; data += "&" + URLEncoder.encode("facteurvitesse", "UTF-8") + "=10"; data += "&" + URLEncoder.encode("categorie_arr", "UTF-8") + "=1";
//**********************Transporteur Lourd************************** data += "&" + URLEncoder.encode("vaisseau2", "UTF-8") + "=" + nbTL; data += "&" + URLEncoder.encode("conso2", "UTF-8") + "=200"; data += "&" + URLEncoder.encode("vitesse2", "UTF-8") + "=20000"; data += "&" + URLEncoder.encode("capacite2", "UTF-8") + "=50000"; //****************************************************************** //*************************Colonisateur******************************** data += "&" + URLEncoder.encode("vaisseau13", "UTF-8") + "=1"; data += "&" + URLEncoder.encode("conso13", "UTF-8") + "=1000"; data += "&" + URLEncoder.encode("vitesse13", "UTF-8") + "=6000"; data += "&" + URLEncoder.encode("capacite13", "UTF-8") + "=7500"; //****************************************************************** data += "&" + URLEncoder.encode("galaxie_arr", "UTF-8") + "=" + theGalaxie; data += "&" + URLEncoder.encode("systeme_arr", "UTF-8") + "=" + (theSystem+relativeSTarget); data += "&" + URLEncoder.encode("planete_arr", "UTF-8") + "=" + (thePlanet+relativePTarget); data += "&" + URLEncoder.encode("vitesse", "UTF-8") + "=" + theSpeed; data += "&" + URLEncoder.encode("ordre", "UTF-8") + "=stationnement"; oreTab = FunctionReadOres(PHPSESSID, thePath); data += "&" + URLEncoder.encode("ressource1_aff", "UTF-8") + "=" + oreTab[0]; data += "&" + URLEncoder.encode("ressource2_aff", "UTF-8") + "=" + oreTab[1]; data += "&" + URLEncoder.encode("ressource3_aff", "UTF-8") + "=" + oreTab[2];
String myTrame; myTrame = FormatHTTPTrame("POST", "Cookie: PHPSESSID=" + PHPSESSID + "\r\n", "/index.php?categorie=flotte4"); myTrame += "Content-Type: application/x-www-form-urlencoded\r\n"; myTrame += "Content-Length: "+data.length()+"\r\n"; myTrame += "\r\n"; myTrame += data; SocketSendData(myTrame); System.out.println("Stationnement de flotte de ["+theGalaxie+":"+theSystem+":"+thePlanet+ "] vers ["+theGalaxie+":"+(theSystem+relativeSTarget)+":"+(thePlanet+relativePTarget)+"]..."); System.out.println("\tTransport de Titane: "+ oreTab[0]+"\tCarbone: "+ oreTab[1] +"\tTrtium: " +oreTab[2] );
}catch (IOException ex) { System.out.println("Error in FunctionSaveOres! " + ex); } } // ************************************************************************** // Date : 08/05/2008 // Author : Djus // Name : FunctionReadOres // Description : Read ores to save on Ansaerys page // ************************************************************************** public String[] FunctionReadOres(String thePHPSESSID, String thePath){ String oreTab[]={"","",""}; try { String myLine = ""; boolean IsInAlerte = false; //connection URL targetURL = new URL("http://uni5.ansaerys.fr" + thePath); HttpURLConnection targetConnection = (HttpURLConnection) targetURL.openConnection();
targetConnection.setDoOutput(true); targetConnection.setDoInput(true); targetConnection.setRequestMethod("GET"); targetConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11"); targetConnection.setRequestProperty("Accept", "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"); targetConnection.setRequestProperty("Accept-Language", "fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3"); targetConnection.setRequestProperty("Accept-Encoding", "gzip,deflate"); targetConnection.setRequestProperty("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"); targetConnection.setRequestProperty("Keep-Alive", "300"); targetConnection.setRequestProperty("Connection", "keep-alive"); targetConnection.setRequestProperty("Referer", "http://uni5.ansaerys.fr" + thePath); targetConnection.setRequestProperty("Cookie", "PHPSESSID=" + thePHPSESSID);
BufferedReader myBuffer = new BufferedReader(new InputStreamReader(targetConnection.getInputStream())); while ((myLine = myBuffer.readLine()) != null && IsInAlerte == false) { if (myLine.indexOf("<i><b>Titane</b></i><br>") != -1) { myLine = myLine.replace("<i><b>Titane</b></i><br>",""); myLine = myLine.replace(" ",""); myLine = myLine.replace("<font color=red>",""); myLine = myLine.replace("</font>",""); oreTab[0] = myLine.trim(); long temp = Long.valueOf(oreTab[0]).longValue() ; temp = temp - 15000; oreTab[0] = Long.toString(temp); http://System.out.println(oreTab[0]); } if (myLine.indexOf("<i><b>Carbone</b></i><br>") != -1) { myLine = myLine.replace("<i><b>Carbone</b></i><br>",""); myLine = myLine.replace(" ",""); myLine = myLine.replace("<font color=red>",""); myLine = myLine.replace("</font>",""); oreTab[1] = myLine.trim(); long temp = Long.valueOf(oreTab[1]).longValue() ; temp = temp - 15000; oreTab[1] = Long.toString(temp); http://System.out.println(oreTab[1]); } if (myLine.indexOf("<i><b>Tritium</b></i><br>") != -1) { myLine = myLine.replace("<i><b>Tritium</b></i><br>",""); myLine = myLine.replace(" ",""); myLine = myLine.replace("<font color=red>",""); myLine = myLine.replace("</font>",""); oreTab[2] = myLine.trim(); long temp = Long.valueOf(oreTab[2]).longValue() ; temp = temp - 400000; oreTab[2] = Long.toString(temp); http://System.out.println(oreTab[2]); IsInAlerte = true; } } } catch (IOException ex) { Logger.getLogger(CheckingAttack.class.getName()).log(Level.SEVERE, null, ex); } return oreTab; }
Enfin, la routine que j'ai commencé à mettr een place:
String thePHPSESSID = "b5e009bc0dc701b42e1b5c040f8f9c2e"; String PHPSESSID = "Cookie: PHPSESSID=" + thePHPSESSID + "\r\n"; String PATH = "/index.php?categorie=accueil¤tplanete=54124"; String PATHCarthagena = "/index.php?categorie=accueil¤tplanete=143129"; String PATHSineQuaNon = "/index.php?categorie=accueil¤tplanete=101275"; String PATHPompei = "/index.php?categorie=accueil¤tplanete=142378"; //String PATHMassilia = "/index.php?categorie=accueil¤tplanete=101275"; //String PATHTuQuoque = "/index.php?categorie=accueil¤tplanete=142378"; //String PATHDebian = "/index.php?categorie=accueil¤tplanete=53849"; //String PATHKnoppix = "/index.php?categorie=accueil¤tplanete=54151"; //String PATHOpenSuse = "/index.php?categorie=accueil¤tplanete=70309"; String speed = "100"; //********************************************************************** // DJUS try { System.out.println("**************--- Démarrage du cycle."); // Envoi des extracteurs de 46:80:5 FonctionKeepActiveTheConnection(PHPSESSID, PATH); Threading.sleep(1*5*1000); FunctionExploiter(PHPSESSID, PATH, 46, 80, 5, -3,25000, speed); Threading.sleep(1*5*1000); FunctionExploiter(PHPSESSID, PATH, 46, 80, 5, +5,25000, speed); Threading.sleep(1*5*1000); FunctionExploiter(PHPSESSID, PATH, 46, 80, 5, -4,25000, speed); Threading.sleep(1*5*1000); // Envoi des ressources FunctionSaveOres(thePHPSESSID, PATH, 46, 80, 5, 0, 0, 1000000, "1"); Threading.sleep(1*10*1000); // Envoi des extracteurs de 44:73:4 FonctionKeepActiveTheConnection(PHPSESSID, PATHCarthagena); Threading.sleep(1*5*1000); FunctionExploiter(PHPSESSID, PATHCarthagena, 44, 73, 4, -2,25000, speed); Threading.sleep(1*5*1000); // Envoi des ressources FunctionSaveOres(thePHPSESSID, PATHCarthagena, 44, 73, 4, 0, 0, 10000, "1"); Threading.sleep(1*10*1000); // Envoi des extracteurs de 48:83:5 FonctionKeepActiveTheConnection(PHPSESSID, PATHPompei); Threading.sleep(1*5*1000); FunctionExploiter(PHPSESSID, PATHPompei, 48, 83, 5, -3,25000,speed); Threading.sleep(1*5*1000); // Envoi des ressources FunctionSaveOres(thePHPSESSID, PATHPompei, 48, 83, 5, 0, 0, 10000, "1"); Threading.sleep(1*10*1000); //tempo for(int i=0; i<26; i++){ FonctionKeepActiveTheConnection(PHPSESSID, PATH); System.out.println("Prochain tour dans " + (56-i*2) + " minutes."); Threading.sleep(2*60*1000); } // Envoi des ressources FonctionKeepActiveTheConnection(PHPSESSID, PATH); Threading.sleep(1*5*1000); FunctionSaveOres(thePHPSESSID, PATH, 46, 80, 5, 0, 0, 1000000, "10"); Threading.sleep(1*10*1000); FonctionKeepActiveTheConnection(PHPSESSID, PATHCarthagena); Threading.sleep(1*5*1000); FunctionSaveOres(thePHPSESSID, PATHCarthagena, 44, 73, 4, 0, 0, 10000, "10"); Threading.sleep(1*10*1000); FonctionKeepActiveTheConnection(PHPSESSID, PATHPompei); Threading.sleep(1*5*1000); FunctionSaveOres(thePHPSESSID, PATHPompei, 48, 83, 5, 0, 0, 10000, "10"); Threading.sleep(1*10*1000); FonctionKeepActiveTheConnection(PHPSESSID, PATH); System.out.println("Prochain tour dans 5 minutes."); Threading.sleep(2*60*1000); FonctionKeepActiveTheConnection(PHPSESSID, PATH); System.out.println("Prochain tour dans 3 minutes."); Threading.sleep(2*60*1000); System.out.println("Prochain tour dans 1 minute."); Threading.sleep(1*60*1000); System.out.println("**************--- Cycle terminé."); } catch (InterruptedException ex) { Logger.getLogger(Threading.class.getName()).log(Level.SEVERE, null, ex); }
Dernière édition par Djus le Mer 4 Juin - 19:47, édité 1 fois | |
| | | Djus Admin
Messages : 151 Date d'inscription : 19/01/2008 Age : 42 Localisation : Val-de-Marne (94)
| Sujet: Re: Nouvelle gestion de la flotte Lun 26 Mai - 20:41 | |
| Waou efficace! aucun vaisseaux ne reste plus de 30sec à quai! | |
| | | BenIsBack
Messages : 86 Date d'inscription : 20/01/2008 Age : 37 Localisation : Château-Thierry (02)
| Sujet: Re: Nouvelle gestion de la flotte Ven 30 Mai - 19:46 | |
| C'est vrai que c'edst efficace, chez moi ca reste moins de 10 secondes. ^^
Je test et je vous donnerais la mise à jour de cette routine de base. | |
| | | Djus Admin
Messages : 151 Date d'inscription : 19/01/2008 Age : 42 Localisation : Val-de-Marne (94)
| Sujet: Re: Nouvelle gestion de la flotte Mer 4 Juin - 19:46 | |
| Amélioration du code: FunctionReadOres()
Il faut remplacer le type int par long car int vous limite à 2.x G de ressources.
long temp = Long.valueOf(oreTab[0]).longValue() ; temp = temp - 15000; oreTab[0] = Long.toString(temp);
Le code ci-dessus a été corrigé. | |
| | | Contenu sponsorisé
| Sujet: Re: Nouvelle gestion de la flotte | |
| |
| | | | Nouvelle gestion de la flotte | |
|
| Permission de ce forum: | Vous ne pouvez pas répondre aux sujets dans ce forum
| |
| |
| |
|