Lagom / Lagom-flw:1.2.0.0.3

// ==UserScript==
// @name         Lagom-flw:1.2.0.0.3
// @namespace    http://openuserjs.org/users/Lagom
// @version      1.0
// @description  flw:1.2.0.0.3
// @author       Lagom
// @email        lagomscripts@gmail.com
// @license      AGPL-3.0-or-later
// @copyright    2024, Lagom (https://openuserjs.org/users/Lagom)
// @codigo       Conteudo feito em linguagem javascript com base em EcmaScript
// @match        http://*/*
// @grant        GM_getResourceText
// @grant        GM_addStyle
// @grant        GM_getValue
// @grant        unsafeWindow
// ==/UserScript==

(function () {
  "use strict";
  function handleBuilding() {
    const timeZone = "Europe/Lisbon";

    const TROOPS = [
      {
        unit: "spear",
        wood: 50,
        clay: 30,
        iron: 10,
        population: 1,
        offensive_strength: 10,
        general_defense: 15,
        cavalry_defense: 45,
        archer_defense: 20,
        speed: 18,
        booty: 25,
      },
      {
        unit: "sword",
        wood: 30,
        clay: 30,
        iron: 70,
        population: 1,
        offensive_strength: 25,
        general_defense: 50,
        cavalry_defense: 15,
        archer_defense: 40,
        speed: 22,
        booty: 15,
      },
      {
        unit: "axe",
        wood: 60,
        clay: 30,
        iron: 40,
        population: 1,
        offensive_strength: 40,
        general_defense: 10,
        cavalry_defense: 5,
        archer_defense: 10,
        speed: 18,
        booty: 10,
      },
      {
        unit: "archer",
        wood: 100,
        clay: 30,
        iron: 60,
        population: 1,
        offensive_strength: 15,
        general_defense: 50,
        cavalry_defense: 40,
        archer_defense: 5,
        speed: 18,
        booty: 10,
      },
      {
        unit: "spy",
        wood: 50,
        clay: 50,
        iron: 20,
        population: 2,
        offensive_strength: 0,
        general_defense: 2,
        cavalry_defense: 1,
        archer_defense: 2,
        speed: 9,
        booty: 0,
      },
      {
        unit: "light",
        wood: 125,
        clay: 100,
        iron: 250,
        population: 4,
        offensive_strength: 130,
        general_defense: 30,
        cavalry_defense: 40,
        archer_defense: 30,
        speed: 10,
        booty: 80,
      },
      {
        unit: "mountedarcher",
        wood: 250,
        clay: 100,
        iron: 150,
        population: 5,
        offensive_strength: 120,
        general_defense: 40,
        cavalry_defense: 30,
        archer_defense: 50,
        speed: 10,
        booty: 50,
      },
      {
        unit: "heavy",
        wood: 200,
        clay: 150,
        iron: 600,
        population: 6,
        offensive_strength: 150,
        general_defense: 200,
        cavalry_defense: 80,
        archer_defense: 180,
        speed: 11,
        booty: 50,
      },
      {
        unit: "ram",
        wood: 300,
        clay: 200,
        iron: 200,
        population: 5,
        offensive_strength: 2,
        general_defense: 20,
        cavalry_defense: 50,
        archer_defense: 20,
        speed: 30,
        booty: 0,
      },
      {
        unit: "catapult",
        wood: 320,
        clay: 400,
        iron: 100,
        population: 8,
        offensive_strength: 100,
        general_defense: 100,
        cavalry_defense: 50,
        archer_defense: 100,
        speed: 30,
        booty: 0,
      },
      {
        unit: "knight",
        wood: 20,
        clay: 20,
        iron: 40,
        population: 10,
        offensive_strength: 150,
        general_defense: 250,
        cavalry_defense: 400,
        archer_defense: 150,
        speed: 10,
        booty: 100,
      },
      {
        unit: "snob",
        wood: 40000,
        clay: 50000,
        iron: 50000,
        population: 100,
        offensive_strength: 30,
        general_defense: 100,
        cavalry_defense: 50,
        archer_defense: 100,
        speed: 35,
        booty: 0,
      },
      {
        unit: "militia",
        wood: 0,
        clay: 0,
        iron: 0,
        population: 0,
        offensive_strength: 5,
        general_defense: 15,
        cavalry_defense: 45,
        archer_defense: 25,
        speed: 0.02,
        booty: 0,
      },
    ];

    const STRATEGY_CODE = {
      f1: {
        tabName: "f1",
        allowedTroops: ["axe", "light", "ram", "catapult"],
        message: "Full",
        attackStrategy: "Ataque com todas as tropas possiveis!",
      },
      f2: {
        tabName: "f2",
        allowedTroops: ["axe", "light", "ram", "catapult", "snob"],
        message: "1|Nobre",
        attackStrategy: "Ataque com todas as tropas possiveis!",
      },
      f3: {
        tabName: "f3",
        allowedTroops: ["axe", "light", "ram", "catapult", "snob"],
        message: "3|Nobre",
        attackStrategy:
          "3 quartos no primeiro ataque + arietes e catapultas full e o restante das tropas dividido em mais 3 nobres",
      },
      f4: {
        tabName: "f4",
        allowedTroops: ["axe", "light", "ram", "catapult", "snob"],
        message: "2|Nobre",
        attackStrategy:
          "Dividir em dois ataques de nobres, porém a catapulta e arietes vão todos no primeiro ataque",
      },
    };

    const ATTACK_STORE_NAME = "tribal-attacks-store";

    const memoIdsError = [];

    const tabNames = [];

    const attackQueue = [];

    let openingTab = false;
  }

  handleBuilding();
})();