ETStats Gathering

ETStats Script for gathering drop information from eternitytower.net, see drops at etstats.com/debug.html

  1. // ==UserScript==
  2. // @name ETStats Gathering
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.3
  5. // @description ETStats Script for gathering drop information from eternitytower.net, see drops at etstats.com/debug.html
  6. // @author You
  7. // @match http://eternitytower.net/combat
  8. // @match https://eternitytower.net/combat
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. var msgCount = 0;
  16.  
  17. Meteor.connection._stream.on('message', function (message)
  18. {
  19. var msg = JSON.parse(message);
  20. if(msg.collection == "battles")
  21. {
  22. if(msg.fields != null && msg.fields.finalTickEvents != null)
  23. {
  24. if(msgCount >= 25 && msg.fields.win)
  25. {
  26. ETStatsLog(msg);
  27. }
  28. msgCount++;
  29. }
  30. }
  31. });
  32.  
  33. function ETStatsLog(data)
  34. {
  35. var https = (document.location.protocol == "https:");
  36. var socket = null;
  37. if(https)
  38. socket = new WebSocket("wss://ws.etstats.com");
  39. else
  40. socket = new WebSocket("ws://ws.etstats.com");
  41. socket.addEventListener('open', function (event) {
  42. socket.send(JSON.stringify(data));
  43. socket.close();
  44. });
  45. }
  46. })();