Greasy Fork is available in English.

Assault Bots Free credits and golds

If it doesn't work, reload the game a few times.

// ==UserScript==
// @name         Assault Bots Free credits and golds
// @version      0.1.1
// @description  If it doesn't work, reload the game a few times.
// @author       nekocell
// @namespace    https://greasyfork.org/ja/users/762895-nekocell
// @match        https://games.crazygames.com/en_US/bot-machines/index.html
// @icon         https://www.google.com/s2/favicons?domain=crazygames.com
// @connect      lucas-web.blayzegames.com
// @grant        unsafeWindow
// @grant        GM_xmlhttpRequest
// @run-at       document-start
// ==/UserScript==

class Main {
  constructor() {
    this.urlGetAccount = 'https://lucas-web.blayzegames.com/Lucas_New_Game/get_account_info.php';
    this.urlBuyItem = 'https://lucas-web.blayzegames.com/Lucas_New_Game/buy_item.php';
    this.username = '';
    this.password = '';
    this.nowCredits = 0;
    this.nowGolds = 0;

    this.init();
  }

  makeFakeItemName() {
    return btoa(String.fromCharCode(...crypto.getRandomValues(new Uint8Array(20)))).substring(0,20);
  }

  GM_fetch(details) {
    return new Promise((resolve, reject) => {
      details.onerror = details.ontimeout = reject;
      details.onload = resolve;

      GM_xmlhttpRequest(details);
    });
  }

  async getCredits(needCredits) {
    const fakeItemName = this.makeFakeItemName();
    const details = {
      method: 'POST',
      url: 'https://lucas-web.blayzegames.com/Lucas_New_Game/buy_item.php',
      headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
      data: `username=${this.username}&password=${this.password}&item=${fakeItemName}&cost=${-needCredits}&costsGold=False`,
    };

    const responseDetails = await this.GM_fetch(details);

    console.log(`[Hack Credits]\n${responseDetails.responseText}`);

    alert("Get Credits Successful!! Please reload the page");
  }

  async getGolds(needGolds) {
    const fakeItemName = this.makeFakeItemName();
    const details = {
      method: 'POST',
      url: 'https://lucas-web.blayzegames.com/Lucas_New_Game/buy_item.php',
      headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
      data: `username=${this.username}&password=${this.password}&item=${fakeItemName}&cost=${-needGolds}&costsGold=True`,
    };

    const responseDetails = await this.GM_fetch(details);

    console.log(`[Hack Golds]\n${responseDetails.responseText}`);

    alert("Get Golds Successful!! Please reload the page");
  }

  injectSend(url, body) {
    if( url !== this.urlGetAccount || !(body instanceof Uint8Array) ) {
      return;
    }

    const text = (new TextDecoder).decode(body);

    try {
      this.username = text.match(/(?<=^username=).+?(?=&)/)[0];
      this.password = text.match(/(?<=password=).+?(?=&)/)[0];
    }catch(e) {
      console.log('[Get account] failed...');
      return;
    }

    console.log(`[Get account] name: ${this.username} password: ${this.password}`);
  }

  injectOpen(_this) {
    if(_this._url !== this.urlGetAccount) {
      return;
    }

    _this.addEventListener('load', () => {
      const text = (new TextDecoder).decode(_this.response);

      try {
        this.nowCredits = text.match(/(?<="credits":)\d+/)[0];
        this.nowGolds = text.match(/(?<="gold":)\d+/)[0];
      }catch(e) {
        console.log('[Get Now] failed...');
        console.error(e);
        return;
      }

      console.log(`[Get Now] nowCredits: ${this.nowCredits} nowGold: ${this.nowGolds}`);

      const needCredits = 999999 - this.nowCredits;
      const needGolds = 999999 - this.nowGolds;

      console.log(`[Give Me] needCredits: ${needCredits} needGolds: ${needGolds}`);

      if(needCredits !== 0 && needGolds !== 0) {
        this.getCredits(needCredits).then(() => this.getGolds(needGolds));
      }
      else if(needCredits !== 0) {
        this.getCredits(needCredits);
      }
      else if(needGolds !== 0) {
        this.getGolds(needGolds);
      }
    });
  }

  init() {
    const _this = this;
    const proto = XMLHttpRequest.prototype;

    proto._send = proto.send;
    proto.send = function(body) {
      _this.injectSend(this._url, body);

      this._send(...arguments);
    };


    proto._open = proto.open;
    proto.open = function(method, url) {
      this._url = url;
      _this.injectOpen(this);

      this._open(...arguments);
    };
  }
}

(new Main());