Ostats: It create graphs

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Ostats: It create graphs

      Everything is open source

      The site:
      herexaam.be/Ostats/

      The code:
      github.com/Slober3/Ostats-Ogame

      The looks:
      prnt.sc/gkw2gh

      It uses the public API
      It's utilizing the high scores API and the players API
      After it received the data it will upload that data to a MysqlDB this data is then used for creating a graph.


      Nothing more nothing less the update interval is constant and is decided by the cronjob placed on the write.php

      Updated Look 14/09/2017:

      The post was edited 3 times, last by Takumi ().

    • Updated Look 14/09/2017


      Awesome now I can start Making it look more pretty :)

      • Added some Random text (positive when you gain points) (encouraging when you lose points)

      JavaScript Source Code

      1. var VerhaalPos = [
      2. ["Wauw wat een productieve dag is het voor jou!", "Je doet het goed Verder doen!", "Zo zo flink gestegen!", "Zie die puntjes maar rollen!"],
      3. ["Wat een vooruitgang we want more, more, much more!!!!.","Jackpot!! Je ontvangt iets heel speciaal."],
      4. ];
      5. var VerhaalNeg = [
      6. ["Auw dit kan beter!","Niet stoppen nu alles komt wel goed!","Nop dit ziet er niet goed uit!","Dit gaat zo niet lukken..."],
      7. ["Ga naar de gevangenis betaal 150 euro... Ga niet langs start *Monopoly.","Je bent Gedaald. AUWTCH!!!"]
      8. ];
      9. var quote = ["Stay positive and happy. Work hard and don't give up hope. Be open to criticism and keep learning. Surround yourself with happy, warm and genuine people.","I believe if you keep your faith, you keep your trust, you keep the right attitude, if you're grateful, you'll see God open up new doors.","Find a place inside where there's joy, and the joy will burn out the pain.","You cannot have a positive life and a negative mind.","Virtually nothing is impossible in this world if you just put your mind to it and maintain a positive attitude."];
      Display All


      • Added (random)Gifs if you fail (lose points) or win (gain points) all gifs are G-rated

      JavaScript Source Code

      1. var flickerAPIWin = "https://api.giphy.com/v1/gifs/random?api_key=[API_KEY]9&tag=win&rating=G";
      2. $.getJSON( flickerAPIWin, {
      3. format: "json"
      4. })
      5. .done(function( data ) {
      6. $( "<img class='displayed' style='display:block; margin:auto;'>" ).attr( "src", data.data.image_url ).appendTo( "#text" );
      7. });







      • Overall graphical improvements
      • Bugfix: writing data to db from the api implemented an extra "safety" mechanism limiting data bugs

      PHP Source Code

      1. //EXAMPLE
      2. /*
      3. Updates the latest record where the Player ID from in this example Economy is the same as the Player id from Total sometimes the data would shift randomly 1 place (2.4% of the time) this will counteract that this will hopefully decrease further DB data bugs due to slow Processing power
      4. */
      5. for($i = 0; $i < $maxE;$i++)
      6. {
      7. try{
      8. $stmt = $dbh->prepare("UPDATE highscores SET economy = :economy WHERE player_id = :player_id ORDER BY id DESC LIMIT 1");
      9. $stmt->bindParam(':player_id', $treese[$i]->attributes()->$id);
      10. $stmt->bindParam(':economy', $treese[$i]->attributes()->$score);
      11. // use exec() because no results are returned
      12. $stmt->execute();
      13. echo "New record created successfully";
      14. }
      15. catch(PDOException $e)
      16. {
      17. echo $stmt . "<br>" . $e->getMessage();
      18. }
      19. }
      Display All
      • Bugfix: graphics sopmtimes the graphs rendered a bit smaller then other graphs

      CSS Source Code

      1. .spacing
      2. {
      3. margin-bottom: 7px;
      4. width: 950px;
      5. height: 100%;
      6. display: block;
      7. margin-left: auto;
      8. margin-right: auto;
      9. }
      10. /* when you give a dedicated width it will force the draw function from google charts to use that specific width you cant hide the divs when you use the drawing function this will break the google charts. I learned it the hard way*/
      Display All

      ! No adds Never adds !


      If you want to help please contact me on --> IRC Takumi #Ogame.nl

      ! It will stay opensource forever Ostats is licensed under the Unlicense !


      Need help with:
      1. Graphical work
      2. Writer for text
      3. A lot JS work
      4. Small PHP work

      The post was edited 14 times, last by Takumi ().

    • Hey Takumi,

      nice project start. I have worked silently also on tool called ostats. The motivation was to request every public available api information and also store it.
      It's a dirt hack project so it's source code isn't announced in the public yet.
      Currently I'm started to work on it again due to the shutdown of ogniter. I have added you as an collaborator, and also try to publish the sources in the near future.

      Yours

      Imp
      OGame Tech
    • ImperatorMaximus wrote:

      Hey Takumi,

      nice project start. I have worked silently also on tool called ostats. The motivation was to request every public available api information and also store it.
      It's a dirt hack project so it's source code isn't announced in the public yet.
      Currently I'm started to work on it again due to the shutdown of ogniter. I have added you as an collaborator, and also try to publish the sources in the near future.

      Yours

      Imp
      You also have a nice project going on . Even with the same name :)
      The closure of Ogniter was my main reason to create a quick and fun alternative.
      I've opened notepad++ and just wrote the code. (it was done in 2 days I think).

      Which you can clearly see on my coding style.
      Now that my tool is Tolerated I can start cleaning things up making it more OO and making it look a lot cleaner.
      It'll prob last a bit longer as I'm going to college again in 4 days.