Greasy Fork is available in English.

find_dmg

find_dmg_otebis

// ==UserScript==
// @name         find_dmg
// @namespace    http://tampermonkey.net/
// @version      2024-08-22
// @description  find_dmg_otebis
// @author       You
// @match        https://www.heroeswm.ru/war.php*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=heroeswm.ru
// @grant        none
// ==/UserScript==

(function() {
  'use strict';
  var content = document.getElementsByTagName('body')[0].innerHTML;
  var url = window.location.href.replace('war.php', 'battle.php') + '&lastturn=-1'

  function get_max_dmg(content){
    var re = /\d{1}:m\d+?d\d{6}(\d+?)i.+?>/gm;
    var results = [];

    var match;

    while(match = re.exec(content)) {
      results.push(+match[1]);
      re.lastIndex -= (match[0].length - 1);
    }

    function compare(a, b){
      return (a == b) ? 0 : (a > b ? 1 : -1);
    };

    results.sort(function(a, b){
      return compare(b, a);
    });

    return results.length ? results[0] : 0;
  }

  alert(url)
  send_async_get(url);

  function send_async_get(url){
    var xhr = new XMLHttpRequest();
    xhr.open('GET', url, true);
    xhr.overrideMimeType('text/plain; charset=windows-1251');
    xhr.onreadystatechange = function(){
      if(xhr.readyState == 4){
        if(xhr.status == 200){
          alert(get_max_dmg(xhr.response));
        }
      }
    };

    xhr.send(null);
  }
})();