// ==UserScript== // @name Grepolis Resources Manager // @version 1.0_ALPHA // @include /http[s]{0,1}://[a-z]{2}[0-9]{1,2}\.grepolis\.com/game*/ // @include https://*.forum.grepolis.com/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js // @require https://code.jquery.com/ui/1.12.1/jquery-ui.js // @description A little handy script to help with resource management and more // @author MajorOrbital // @copyright 2020+ // @grant unsafeWindow // @grant GM_addStyle // @namespace https://greasyfork.org/users/451401 // @downloadURL none // ==/UserScript== //The game window, gamedata can be accessed through this constant. const uw = unsafeWindow; //https://imgur.com/a/WmetAfe //#region CSS GM_addStyle(` :root { --main: #ffe2a2 } #GRM_window { background-color: var(--main); display: none; height: 550px; width: 780px; z-index: 1100; position: absolute; top: 100px; left: 30vw; border: 2px black solid } #GRM_toolbar { height: 30px; border-bottom: 2px black solid; } #GRM_toolbar_list { list-style-type: none; margin: 0; padding-top: 3px; padding-left: 1px; overflow: hidden; top: 10px; } #GRM_title { padding-top: 3px; float: left; width: 40%; text-align: left; } #GRM_building { max-width: 360px; position: relative; left: 10px; } #GRM_buildings { margin-left: 5px; } #GRM_troops_container { margin-left: 5px; } #GRM_close { padding-top: 5px; float: left; } #GRM_gods{ height: 100px; width: 100px; position: relative; top: -415px; left: 50px; } .GRM_toolbar_item { height: 25px; float: left; width: 27%; text-align: center; border-left: 1px solid black; border-right: 1px solid black; border-top: 1px solid black; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; margin: 1px } #GRM_close_img { margin-left: 10px; } #GRM_population_container{ max-width: 120px; position: relative; left: 5px; bottom: 450px; font-weight: bold; } #GRM_pop_icon{ position: relative; top: 2px; left: 5px; } .GRM_building_image { height: 40px; width: 40px; letter-spacing: -1px; margin: 0; display: inline-grid; } .GRM_building_level { position: relative; bottom: -25px; right: -10px; color: white; max-height: 18px; font-weight: bolder; } .GRM_selector { height: 40px; width: 30px; top: 10px; display: inline; position: relative; } .GRM_troop_input { width: 36px; } .GRM_building_input { width: 35px; } input.invalid { border: 2px solid red; background-color: rgba(128, 0, 0, 0.3) } input.valid { border: 2px solid green; background-color: rgba(0, 128, 0, 0.3) } .GRM_troop_container { max-width: 50px; z-index: 5; } .GRM_special_container { width: 168px; height: 42px; border: 1px solid black; overflow: hidden; /* add this to contain floated children */ } .GRM_special_child { width: 40px; height: 40px; float: left; margin-left: 1px; margin-right: 1px; padding-top: 1px; padding-bottom: 1px; } .GRM_label{ max-width: 450px; margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; font-weight: bold; } .GRM_border{ border: #c78e25; border-width: medium; border-style: solid; } `); //#endregion class Utils { static checkMouseClicked(x, y, coords) { return ( coords.x <= x && x <= coords.x + 30 && coords.y <= y && y <= coords.y + 30 ); } static all_gods() { return "https://i.imgur.com/Kvb5gqn.png"; } static artemis() { return "https://i.imgur.com/yNL9x1M.png"; } static hades() { return "https://i.imgur.com/Via8HPf.png"; } static poseidon() { return "https://i.imgur.com/w2LtW83.png"; } static hera() { return "https://i.imgur.com/eNTFFg1.png"; } static athene() { return "https://i.imgur.com/u8SRGdE.png"; } static zeus() { return "https://i.imgur.com/35HpxKg.png"; } static no_god() { return "https://i.imgur.com/dFBR5Jd.png"; } static max_levels = { main: 25, hide: 10, place: 1, lumber: 40, stoner: 40, ironer: 40, market: 30, docks: 30, barracks: 30, wall: 25, storage: 35, farm: 45, academy: 36, temple: 30 }; static farm_pop = [ 14, 38, 69, 105, 145, 189, 237, 288, 342, 399, 458, 520, 584, 651, 720, 790, 863, 938, 1015, 1094, 1174, 1257, 1341, 1426, 1514, 1602, 1693, 1785, 1878, 1973, 2070, 2168, 2267, 2368, 2470, 2573, 2678, 2784, 2891, 3000, 3109, 3220, 3332, 3446, 3560 ]; static main_cost = [ 1, 3, 6, 9, 13, 17, 21, 25, 30, 35, 40, 46, 52, 58, 64, 70, 77, 84, 91, 98, 106, 113, 121, 129, 137 ]; static resources_cost = [ 1, 2.4, 3.9, 5.7, 5.7, 9.4, 11.4, 13.5, 15.6, 17.8, 20, 22.3, 24.7, 27.1, 29.5, 32, 34.5, 37.1, 39.7, 42.3, 45, 47.6, 50.4, 53.1, 55.9, 58.7, 61.5, 64.4, 67.3, 70.2, 73.1, 76.1, 79.1, 82.1, 85.1, 88.2, 91.3, 94.3, 97.5, 100.6 ]; static barracks_cost = [ 1, 2.5, 4.2, 6.1, 8.1, 10.3, 12.5, 14.9, 17.4, 20, 22.6, 25.3, 28.1, 30.9, 33.8, 36.8, 39.8, 42.8, 46, 49.1, 52.3, 55.6, 58.9, 62.3, 65.7, 69.1, 72.6, 76.1, 79.6, 83.2 ]; static harbour_cost = [ 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120 ]; static cave_cost = [3, 4.2, 5.2, 6, 6.7, 7.3, 7.9, 8.5, 9, 9.5]; static academy_cost = [ 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99, 102, 105, 108 ]; static temple_cost = [ 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150 ]; static market_cost = [ 2, 4.3, 6.7, 9.2, 11.7, 14.4, 17, 19.7, 22.4, 25.2, 28, 30.8, 33.6, 36.5, 39.3, 42.2, 45.1, 48.1, 51, 54, 56.9, 59.9, 62.9, 66, 69, 72, 75.1, 78.1, 81.2, 84.3 ]; static wall_cost = [ 2, 4.5, 7.2, 10, 12.9, 16, 19.1, 22.3, 25.6, 28.9, 32.3, 35.7, 39.2, 42.7, 46.3, 49.9, 53.5, 57.2, 60.9, 64.6, 68.4, 72.2, 76, 79.8, 83.7 ]; static boar_img = "https://i.imgur.com/1HUB4xG.jpg"; static envoy_img = "https://i.imgur.com/nbXIVhL.png"; static griffin_img = "https://i.imgur.com/G0TYw28.jpg"; static centaur_img = "https://i.imgur.com/Y954Jv4.png"; static pegasus_img = "https://i.imgur.com/qusNCkM.png"; static harpy_img = "https://i.imgur.com/pCxA9u0.png"; static medusas_img = "https://i.imgur.com/3DdtHrv.png"; static cerberus_img = "https://i.imgur.com/BjLWnrL.png"; static eryn_img = "https://i.imgur.com/1FvJy0t.png"; static cyclops_img = "https://i.imgur.com/E8v5wu9.png"; static hydra_img = "https://i.imgur.com/tbc0PK1.png"; static minotaur_img = "https://i.imgur.com/Lw0vKSU.png"; static manticore_img = "https://i.imgur.com/bik0Jzj.png"; static unit_img = "https://i.imgur.com/xLOtNgs.png"; static lightship_img = "https://i.imgur.com/Y5WorTq.png"; static slow_transporter_img = "https://i.imgur.com/43NVBNT.png"; static bireme_img = "https://i.imgur.com/kLQCM99.png"; static catapult_img = "https://i.imgur.com/oFEOsXo.png"; static demolitionship_img = "https://i.imgur.com/JNfJ3h0.png"; static fast_transporter_img = "https://i.imgur.com/WYCQUZo.png"; static trireme_img = "https://i.imgur.com/0YlGkCP.png"; static colo_img = "https://i.imgur.com/e0W5k39.png"; static getMaxLevel(name) { switch (name) { case "main": return max_levels.main; case "hide": return max_levels.hide; case "place": return max_levels.place; case "lumber": return max_levels.lumber; case "stoner": return max_levels.stoner; case "ironer": return max_levels.ironer; case "market": return max_levels.market; case "docks": return max_levels.docks; case "barracks": return max_levels.barracks; case "wall": return max_levels.wall; case "storage": return max_levels.storage; case "farm": return max_levels.farm; case "academy": return max_levels.academy; case "temple": return max_levels.temple; default: return 1; } } static getSpecialBuilding(specialList) { for (let i in specialList) { if (specialList[i][1] === 1) return specialList[i][0]; } return null; } } class View { constructor() {} addMenuItem() { $("#ui_box > div.nui_main_menu > div.middle > div.content > ul").append( `
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
Enter the amount of troops you want of each type in here.
|
|
|
|
|
|
|
|
|
The current maximum possible amount of each troop (+ your choices above)
|
|
|
|
|
|
|
|