Trimps tools

Trimps tools (visual)

当前为 2018-12-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Trimps tools
  3. // @namespace trimps.github.io
  4. // @version 1.264
  5. // @description Trimps tools (visual)
  6. // @author Anton
  7. // @match https://trimps.github.io
  8. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
  9. // ==/UserScript==
  10.  
  11. (function () {
  12. 'use strict';
  13.  
  14. var tAutoBuy, tStyleFix, tPassiveWatcher, $ = jQuery, isStarted = false,
  15. version = typeof GM_info === 'function' ? GM_info().script.version :
  16. (typeof GM_info === 'object' ? GM_info.script.version : '?');
  17.  
  18. var _isPortal = function () {
  19. return portalWindowOpen;
  20. };
  21.  
  22. var _getJobPrice = function (jobName, resource) {
  23. return game.jobs[jobName].cost[resource][0] * Math.pow(game.jobs[jobName].cost[resource][1], game.jobs[jobName].owned);
  24. };
  25.  
  26. var _hasFormation = function(what) {
  27. what = parseInt(what);
  28. if (!game.global.preMapsActive && !game.global.lockTooltip) {
  29. if (game.upgrades.Formations.done && what === 0) return true;
  30. if (game.upgrades.Formations.done && what === 1) return true;
  31. if (game.upgrades.Dominance.done && what === 2) return true;
  32. if (game.upgrades.Barrier.done && what === 3) return true;
  33. if (game.upgrades.Formations.done && game.global.highestLevelCleared >= 180 && what === 4) return true;
  34. }
  35. return false;
  36. };
  37.  
  38. var _getEnemyAttack = function() {
  39. var cellNum, cell;
  40. if (game.global.mapsActive) {
  41. cellNum = game.global.lastClearedMapCell + 1;
  42. cell = game.global.mapGridArray[cellNum];
  43. } else {
  44. cellNum = game.global.lastClearedCell + 1;
  45. cell = game.global.gridArray[cellNum];
  46. }
  47. return calculateDamage(cell.attack, false, false, false, cell);
  48. };
  49.  
  50. var _middleGameStrategy = function() {
  51. if (game.global.world < 60) return;
  52.  
  53. if (game.global.formation === 0) {
  54. if (_hasFormation(1)) setFormation('1');
  55. }
  56.  
  57. var enemy = _getEnemyAttack();
  58. var me = game.global.soldierCurrentBlock + game.global.soldierHealthMax;
  59. if (enemy >= me && parseInt(game.global.formation) !== 1) {
  60. if (_hasFormation(1)) setFormation('1');
  61. }
  62.  
  63. if (parseInt(game.global.formation) !== 2 && _hasFormation(2)) {
  64. var formation2health = game.global.soldierHealthMax / 8;
  65. var me2 = formation2health + game.global.soldierCurrentBlock;
  66. if (me2 > enemy) {
  67. setFormation('2');
  68. }
  69. }
  70. };
  71.  
  72. var _log = function (mes, type) {
  73. if (typeof type === 'undefined') type = "Story";
  74. message("BOT: " + mes, type);
  75. };
  76.  
  77. var _getBreedingBaseSpeed = function () {
  78. if (game.global.challengeActive === "Trapper") return 0;
  79. var base = 0.0085;
  80. var currentCalc = _getBreeding() * base;
  81. if (game.upgrades.Potency.done > 0) {
  82. currentCalc *= Math.pow(1.1, game.upgrades.Potency.done);
  83. }
  84. return currentCalc;
  85. };
  86.  
  87. var _getBreedingTotalSpeed = function () {
  88. if (game.global.challengeActive === "Trapper") return 0;
  89. var trimps = game.resources.trimps;
  90. var base = 0.0085;
  91. //Add job count
  92. var breeding = trimps.owned - trimps.employed;
  93. var currentCalc = breeding * base;
  94. //Add Potency
  95. if (game.upgrades.Potency.done > 0){
  96. currentCalc *= Math.pow(1.1, game.upgrades.Potency.done);
  97. }
  98. //Add Nurseries
  99. if (game.buildings.Nursery.owned > 0){
  100. currentCalc *= Math.pow(1.01, game.buildings.Nursery.owned);
  101. }
  102. //Add Venimp
  103. if (game.unlocks.impCount.Venimp > 0){
  104. var venimpStrength = Math.pow(1.003, game.unlocks.impCount.Venimp);
  105. currentCalc *= (venimpStrength);
  106. }
  107. if (game.global.brokenPlanet){
  108. currentCalc /= 10;
  109. }
  110. //Add pheromones
  111. if (game.portal.Pheromones.level > 0){
  112. var PheromonesStrength = (game.portal.Pheromones.level * game.portal.Pheromones.modifier);
  113. currentCalc *= (PheromonesStrength + 1);
  114. }
  115. //Add Geneticist
  116. if (game.jobs.Geneticist.owned > 0) {
  117. currentCalc *= Math.pow(.98, game.jobs.Geneticist.owned);
  118. }
  119. //Add quick trimps
  120. if (game.unlocks.quickTrimps){
  121. currentCalc *= 2;
  122. }
  123. if (game.global.challengeActive === "Daily"){
  124. var mult = 0;
  125. if (typeof game.global.dailyChallenge.dysfunctional !== 'undefined'){
  126. mult = dailyModifiers.dysfunctional.getMult(game.global.dailyChallenge.dysfunctional.strength);
  127. currentCalc *= mult;
  128. }
  129. if (typeof game.global.dailyChallenge.toxic !== 'undefined'){
  130. mult = dailyModifiers.toxic.getMult(game.global.dailyChallenge.toxic.strength, game.global.dailyChallenge.toxic.stacks);
  131. currentCalc *= mult;
  132. }
  133. }
  134. if (game.global.challengeActive === "Toxicity" && game.challenges.Toxicity.stacks > 0){
  135. currentCalc *= Math.pow(game.challenges.Toxicity.stackMult, game.challenges.Toxicity.stacks);
  136. }
  137. if (game.global.voidBuff === "slowBreed"){
  138. currentCalc *= 0.2;
  139. }
  140. var heirloomBonus = calcHeirloomBonus("Shield", "breedSpeed", 0, true);
  141. if (heirloomBonus > 0){
  142. currentCalc *= ((heirloomBonus / 100) + 1);
  143. }
  144. return currentCalc;
  145. };
  146.  
  147. var _hasUpgradeForEquipment = function (equipName) {
  148. for (var item in game.upgrades) {
  149. if (game.upgrades.hasOwnProperty(item)) {
  150. var upgrade = game.upgrades[item];
  151. if (parseInt(upgrade.locked) === 1) continue;
  152. if (typeof upgrade.prestiges !== 'undefined' && upgrade.prestiges === equipName) {
  153. return true;
  154. }
  155. }
  156. }
  157. return false;
  158. };
  159.  
  160. var _getMetalNeededForEquipment = function (equipName) {
  161. var price = getBuildingItemPrice(game.equipment[equipName], 'metal', true, 1);
  162. var artMult = Math.pow(1 - game.portal.Artisanistry.modifier, game.portal.Artisanistry.level);
  163. if (game.global.challengeActive === "Daily" && typeof game.global.dailyChallenge.metallicThumb !== 'undefined'){
  164. artMult *= dailyModifiers.metallicThumb.getMult(game.global.dailyChallenge.metallicThumb.strength);
  165. }
  166. if (game.global.challengeActive === "Obliterated"){
  167. artMult = (artMult === -1) ? 1e12 : (1e12 * artMult);
  168. }
  169. price = Math.ceil(price * artMult);
  170. return price;
  171. };
  172.  
  173. var _autoEquipment = function () {
  174. var maxEquipLevel = game.global.challengeActive === 'Frugal' ? 10000 : 7;
  175. for (var x in game.equipment) {
  176. if (game.equipment.hasOwnProperty(x) && game.equipment[x].locked === 0) {
  177. if (_hasUpgradeForEquipment(x)) continue;
  178. var maxLevel = game.equipment[x].prestige > maxEquipLevel ? 1 : (maxEquipLevel + 1 - game.equipment[x].prestige) * 2;
  179. if (x === 'Shield' && !game.equipment['Shield'].blockNow) {
  180. maxLevel = 1;
  181. }
  182. if (game.equipment[x].level < maxLevel && canAffordBuilding(x, null, null, true)) {
  183. if (game.equipment[x].cost.hasOwnProperty('metal')) {
  184. // save metal for upgrades
  185. var currentMetal = game.resources['metal'].owned;
  186. var equipMetal = _getMetalNeededForEquipment(x);
  187. var upgradesMetal = _getUpgradePriceSumForRes('metal');
  188. if (currentMetal >= (upgradesMetal + equipMetal)) {
  189. buyEquipment(x, true, true);
  190. _log('Upgrading equipment ' + x);
  191. }
  192. } else {
  193. buyEquipment(x, true, true);
  194. _log('Upgrading equipment ' + x);
  195. }
  196. }
  197. }
  198. }
  199. };
  200.  
  201. var _getMinimumBreeding = function () {
  202. var battleTrimps = (game.portal.Coordinated.level) ? game.portal.Coordinated.currentSend : game.resources.trimps.maxSoldiers;
  203. if (battleTrimps < 5) return 5; else return battleTrimps + 1;
  204. };
  205.  
  206. var _buyStorage = function () {
  207. var packratLevel = (1 + game.portal.Packrat.level * (game.portal.Packrat.modifier * 100) / 100);
  208. var buildingsForResources = {
  209. food: "Barn",
  210. wood: "Shed",
  211. metal: "Forge"
  212. };
  213.  
  214. for (var res in buildingsForResources) {
  215. if (buildingsForResources.hasOwnProperty(res)) {
  216. var bldName = buildingsForResources[res];
  217. if (game.resources[res].owned / (game.resources[res].max * packratLevel) >= 0.8) {
  218. if (canAffordBuilding(bldName, false, false, false, true)) {
  219. buyBuilding(bldName, true, true);
  220. _log('Building ' + bldName);
  221. }
  222. }
  223. }
  224. }
  225. };
  226.  
  227. var _hasInQueue = function (item) {
  228. for (var x in game.global.buildingsQueue) {
  229. var queueItem = game.global.buildingsQueue[x].split('.')[0];
  230. if (queueItem === item) {
  231. return true;
  232. }
  233. }
  234. return false;
  235. };
  236.  
  237. var _getBreeding = function () {
  238. var trimps = game.resources.trimps;
  239. return game.global.challengeActive === "Trapper" ? 0 : trimps.owned - trimps.employed;
  240. };
  241.  
  242. var _earlyGameStrategy = function (isPassive) {
  243. if (_isPortal()) return;
  244.  
  245. var playerStrength = getPlayerModifier();
  246. var minimumSpeedToHelp = 1 + playerStrength;
  247.  
  248. if (parseInt(game.global.eggLoc) !== -1) {
  249. _log('Destroying Easter Egg');
  250. easterEggClicked();
  251. }
  252.  
  253. _buyStorage();
  254. if (isPassive === false) {
  255. _autoJobs();
  256. }
  257.  
  258. var breeding = _getBreeding();
  259. var unemployed = Math.ceil(game.resources.trimps.realMax() / 2) - game.resources.trimps.employed;
  260.  
  261. if (game.buildings.Trap.owned >= 1 && game.resources.trimps.owned < game.resources.trimps.realMax() &&
  262. (breeding < _getMinimumBreeding() || unemployed > 0) &&
  263. _getBreedingBaseSpeed() < 1) {
  264. setGather('trimps');
  265. return;
  266. }
  267.  
  268. var canGetScience = game.global.challengeActive !== "Scientist";
  269.  
  270. var hasTrap = _hasInQueue('Trap');
  271. var cnt = game.global.challengeActive === "Trapper" ? 100 : (breeding < unemployed ? 25 : 1);
  272. if (!hasTrap && game.buildings.Trap.owned < 1 && game.resources.food.owned >= 10 && game.resources.wood.owned >= 10) {
  273. buyBuilding('Trap', true, true, cnt);
  274. return;
  275. }
  276.  
  277. if ((game.global.buildingsQueue.length > 0 && game.global.autoCraftModifier < 1) || (game.global.buildingsQueue.length > 5)) {
  278. setGather('buildings');
  279. return;
  280. }
  281.  
  282. if (getPsString('food', true) < minimumSpeedToHelp && game.resources.food.owned < 10) {
  283. setGather('food');
  284. return;
  285. }
  286.  
  287. if (getPsString('wood', true) < minimumSpeedToHelp && game.resources.wood.owned < 10) {
  288. setGather('wood');
  289. return;
  290. }
  291.  
  292. if (canGetScience && getPsString('science', true) < minimumSpeedToHelp && game.resources.science.owned < 10) {
  293. setGather('science');
  294. return;
  295. }
  296.  
  297. var metalNeeded = _getUpgradePriceSumForRes('metal');
  298. if (getPsString('metal', true) < minimumSpeedToHelp && game.resources.metal.owned < Math.min(100, metalNeeded)) {
  299. setGather('metal');
  300. return;
  301. }
  302.  
  303. var needScientist = game.upgrades.Scientists.done === 0 && game.upgrades.Scientists.allowed === 1;
  304. if (canGetScience && getPsString('science', true) < minimumSpeedToHelp && (game.resources.science.owned < 60 || needScientist)) {
  305. setGather('science');
  306. return;
  307. }
  308.  
  309. if ((game.global.playerGathering === 'trimps' && (game.buildings.Trap.owned === 0 || _getBreedingBaseSpeed() > 1)) ||
  310. (game.global.playerGathering === 'buildings' && game.global.buildingsQueue.length === 0)) {
  311. _selectAutoJob();
  312. }
  313. };
  314.  
  315. var _selectAutoJob = function () {
  316. var canGetScience = game.global.challengeActive !== "Scientist";
  317. var upgradePrice = _getMaximumResourceUpgradePrice();
  318. var scienceNeeded = _getUpgradePriceSumForRes('science');
  319. if (scienceNeeded > game.resources.science.owned && canGetScience) {
  320. setGather('science');
  321. } else {
  322. if (upgradePrice !== false) {
  323. for (var x in upgradePrice) {
  324. if (upgradePrice.hasOwnProperty(x)) {
  325. if (x === 'wood' || x === 'metal' || x === 'science' || x === 'food') {
  326. setGather(x);
  327. } else {
  328. if (canGetScience && scienceNeeded > 0) {
  329. setGather('science');
  330. } else {
  331. setGather('food');
  332. }
  333. }
  334. break;
  335. }
  336. }
  337. } else {
  338. if (canGetScience && scienceNeeded > 0) {
  339. setGather('science');
  340. } else {
  341. setGather('food');
  342. }
  343. }
  344. }
  345. };
  346.  
  347. var _passiveWatcher = function () {
  348. if (_isPortal()) return;
  349.  
  350. _earlyGameStrategy(true);
  351.  
  352. var canAfford = canAffordBuilding("Tribute", false, false, false, true);
  353. if (canAfford && game.buildings.Tribute.locked !== 1) {
  354. buyBuilding("Tribute", true, true);
  355. _log('Building ' + "Tribute");
  356. }
  357.  
  358. canAfford = canAffordBuilding("Gym", false, false, false, true);
  359. if (canAfford && game.buildings.Gym.locked !== 1) {
  360. buyBuilding("Gym", true, true);
  361. _log('Building ' + "Gym");
  362. }
  363.  
  364. _middleGameStrategy();
  365. };
  366.  
  367. var _needAttackCurrentMap = function () {
  368. return (typeof game.mapsAttacked[game.global.world] === 'undefined');
  369. };
  370.  
  371. var _hasMapOfCurrentLevel = function () {
  372. for (var x in game.global.mapsOwnedArray) {
  373. if (game.global.mapsOwnedArray.hasOwnProperty(x)) {
  374. var mapObj = game.global.mapsOwnedArray[x];
  375. if (parseInt(mapObj.level) === parseInt(game.global.world)) return true;
  376. }
  377. }
  378. return false;
  379. };
  380.  
  381. var _buyNewMapOfCurrentLevel = function () {
  382. var money = game.resources.fragments.owned;
  383. if (money > 0) {
  384. var currentMapPrice = updateMapCost(true);
  385. if (money >= currentMapPrice) {
  386. var result = buyMap();
  387. if (result === 1) {
  388. _log('Bought new map level ' + game.global.world);
  389. } else {
  390. console.log('Buy map result = ' + result);
  391. }
  392. } else {
  393. console.log('No fragments (' + money + ') to buy map for ' + currentMapPrice);
  394. }
  395. }
  396. };
  397.  
  398. var _attackMapOfCurrentLevel = function (knownMapId, isPrestige) {
  399. var x, mapObj;
  400. var breeding = _getBreeding();
  401.  
  402. game.global.lookingAtMap = '';
  403. if (typeof knownMapId === 'undefined') {
  404. for (x in game.global.mapsOwnedArray) {
  405. if (game.global.mapsOwnedArray.hasOwnProperty(x)) {
  406. mapObj = game.global.mapsOwnedArray[x];
  407. if (parseInt(mapObj.level) === parseInt(game.global.world)) {
  408. game.global.lookingAtMap = mapObj.id;
  409. break;
  410. }
  411. }
  412. }
  413. } else {
  414. game.global.lookingAtMap = knownMapId;
  415. }
  416.  
  417. if (game.global.lookingAtMap !== '') {
  418. _log('Attacking ' + (isPrestige ? 'prestige ' : '') + 'map ' + game.global.lookingAtMap);
  419. game.options.menu.alwaysAbandon.enabled = 1; // GO TO MAPS!
  420. mapsClicked(true);
  421. game.mapsAttacked[game.global.world] = true;
  422. game.global.repeatMap = true; // REPEAT
  423. repeatClicked(true);
  424. runMap();
  425. if (breeding < (_getMinimumBreeding() + 1)) fightManual();
  426. } else {
  427. console.log('where is my map?');
  428. }
  429. };
  430.  
  431. var _getPrestigeMapToAttack = function () {
  432. for (var x in game.global.mapsOwnedArray) {
  433. if (game.global.mapsOwnedArray.hasOwnProperty(x)) {
  434. var mapObj = game.global.mapsOwnedArray[x];
  435. if (parseInt(mapObj.clears) === 0
  436. && parseInt(mapObj.level) <= parseInt(game.global.world)
  437. && mapObj.noRecycle) {
  438. return mapObj.id;
  439. }
  440. }
  441. }
  442. return -1;
  443. };
  444.  
  445. var _attackCurrentMap = function () {
  446. document.getElementById("mapLevelInput").value = game.global.world;
  447.  
  448. var prestigeMapToAttack = _getPrestigeMapToAttack();
  449. if (prestigeMapToAttack !== -1) {
  450. _attackMapOfCurrentLevel(prestigeMapToAttack, true);
  451. return;
  452. }
  453.  
  454. if (!_hasMapOfCurrentLevel()) {
  455. _buyNewMapOfCurrentLevel();
  456. }
  457.  
  458. if (_hasMapOfCurrentLevel()) {
  459. _attackMapOfCurrentLevel();
  460. } else {
  461. console.log('no map of current level ' + game.global.world);
  462. }
  463. };
  464.  
  465. var _mapAttackStrategy = function () {
  466. var x, mapObj;
  467. var breeding = _getBreeding();
  468.  
  469. if (game.global.world < 6) return;
  470. if (game.global.preMapsActive) return;
  471. //if (!game.global.mapsUnlocked) return;
  472. if (game.global.pauseFight) {
  473. _log('Enabling auto attack!');
  474. fightManual();
  475. game.global.pauseFight = false;
  476. pauseFight(true); // update only
  477. } else {
  478. if (_needAttackCurrentMap()) {
  479. _attackCurrentMap();
  480. } else {
  481. if (_hasMapOfCurrentLevel() && game.global.currentMapId === '') {
  482. game.global.lookingAtMap = '';
  483. var map_id, map_name = '';
  484. for (x in game.global.mapsOwnedArray) {
  485. if (game.global.mapsOwnedArray.hasOwnProperty(x)) {
  486. mapObj = game.global.mapsOwnedArray[x];
  487. if (mapObj.level <= game.global.world && mapObj.noRecycle === true && mapObj.clears === 0) {
  488. game.global.lookingAtMap = mapObj.id;
  489. map_id = x;
  490. map_name = mapObj.name;
  491. break;
  492. }
  493. }
  494. }
  495. if (game.global.lookingAtMap !== '' && typeof map_id !== 'undefined') {
  496. _log('Attacking prestige map ' + map_name + ' level (' + game.global.mapsOwnedArray[map_id].level + ')');
  497. game.options.menu.alwaysAbandon.enabled = 1; // GO TO MAPS!
  498. mapsClicked(true);
  499. game.global.repeatMap = true; // REPEAT
  500. repeatClicked(true);
  501. game.global.mapsOwnedArray[map_id].clears = 1;
  502. runMap();
  503. if (breeding < (_getMinimumBreeding() + 1)) fightManual();
  504. }
  505. } else {
  506. if (game.global.currentMapId !== '') {
  507. var lastMapCell = game.global.mapGridArray[game.global.mapGridArray.length - 1];
  508. var specialGift = '';
  509. if (lastMapCell.special !== '') {
  510. specialGift = game.mapUnlocks[lastMapCell.special];
  511. }
  512. var needExitMap = (specialGift === '' || specialGift.prestige !== true) &&
  513. lastMapCell.special !== 'Heirloom' &&
  514. lastMapCell.name !== 'Warden' &&
  515. lastMapCell.name !== 'Robotrimp' &&
  516. specialGift.canRunOnce !== true;
  517. if (needExitMap) {
  518. mapsClicked(true); // go to maps
  519. recycleMap(-1, true);
  520. mapsClicked(); // go to world
  521. }
  522. }
  523. }
  524. }
  525. }
  526. };
  527.  
  528. var _mapDeleter = function() {
  529. if (game.global.currentMapId === '') {
  530. for (var x in game.global.mapsOwnedArray) {
  531. var map = game.global.mapsOwnedArray[x];
  532. if (map.level < (game.global.world - 10) && map.noRecycle !== true) {
  533. game.global.lookingAtMap = map['id'];
  534. _log('Deleting map ' + map.name + ' (' + map.level + ')');
  535. recycleMap(-1, true);
  536. break;
  537. }
  538. }
  539. }
  540. };
  541.  
  542. var _auto = function () {
  543. if (_isPortal()) return;
  544. _earlyGameStrategy(false);
  545.  
  546. _autoUpgrade();
  547. _autoBuy();
  548. _autoEquipment();
  549. _mapAttackStrategy();
  550.  
  551. _middleGameStrategy();
  552.  
  553. _mapDeleter();
  554. };
  555.  
  556. var _onStartButton = function () {
  557. if (isStarted) {
  558. _stop();
  559. _log('Stop.');
  560. isStarted = false;
  561. } else {
  562. _start();
  563. _log('Started!');
  564. isStarted = true;
  565. }
  566. };
  567.  
  568. var _autoUpgrade = function () {
  569. for (var item in game.upgrades) {
  570. if (game.upgrades.hasOwnProperty(item)) {
  571. var upgrade = game.upgrades[item];
  572. if (parseInt(upgrade.locked) === 1) continue;
  573. var canAfford = canAffordTwoLevel(upgrade);
  574. if (canAfford) {
  575. if (item === "Coordination") {
  576. if (!canAffordCoordinationTrimps()) continue;
  577. }
  578. if (item === "Gigastation") {
  579. var minAddon = Math.floor(game.global.highestLevelCleared / 6);
  580. var minWaprstation = Math.floor(game.global.world / 6) + minAddon + game.upgrades.Gigastation.done * 2;
  581. if (minWaprstation < 6 + minAddon) minWaprstation = 6 + minAddon;
  582. if (game.buildings.Warpstation.owned < minWaprstation) continue;
  583. }
  584. buyUpgrade(item, true, true);
  585. _log('Upgrading ' + item);
  586. _selectAutoJob();
  587. return 1;
  588. }
  589. }
  590. }
  591. return 0;
  592. };
  593.  
  594. var getUpgradePrice = function (upgradeObject) {
  595. var price, result = {};
  596. for (var cost in upgradeObject.cost) {
  597. if (upgradeObject.cost.hasOwnProperty(cost)) {
  598. if (typeof upgradeObject.cost[cost] === 'object' && typeof upgradeObject.cost[cost][1] === 'undefined') {
  599. var costItem = upgradeObject.cost[cost];
  600. for (var item in costItem) {
  601. if (costItem.hasOwnProperty(item)) {
  602. price = costItem[item];
  603. if (upgradeObject.prestiges && (item === "metal" || item === "wood")) {
  604. if (game.global.challengeActive === "Daily" && typeof game.global.dailyChallenge.metallicThumb !== 'undefined') {
  605. price *= dailyModifiers.metallicThumb.getMult(game.global.dailyChallenge.metallicThumb.strength);
  606. }
  607. price *= Math.pow(1 - game.portal.Artisanistry.modifier, game.portal.Artisanistry.level);
  608. }
  609. if (typeof price === 'function') price = price();
  610. if (typeof price[1] !== 'undefined') price = resolvePow(price, upgradeObject);
  611. result[item] = price;
  612. }
  613. }
  614. }
  615. }
  616. }
  617. return result;
  618. };
  619.  
  620. var _getAllUpgradePrice = function () {
  621. var totalPrice = {};
  622. for (var item in game.upgrades) {
  623. if (game.upgrades.hasOwnProperty(item)) {
  624. var upgrade = game.upgrades[item];
  625. if (parseInt(upgrade.locked) === 1) continue;
  626. var price = getUpgradePrice(upgrade);
  627. for (var res in price) {
  628. if (price.hasOwnProperty(res)) {
  629. if (typeof totalPrice[res] === 'undefined') totalPrice[res] = 0;
  630. totalPrice[res] += price[res];
  631. }
  632. }
  633. }
  634. }
  635. return totalPrice;
  636. };
  637.  
  638. var _getUpgradePriceSumForRes = function (res) {
  639. var totalPrice = _getAllUpgradePrice();
  640. if (typeof totalPrice[res] !== 'undefined') {
  641. return totalPrice[res];
  642. } else {
  643. return 0;
  644. }
  645. };
  646.  
  647. var _getMaximumResourceUpgradePrice = function () {
  648. var totalPrice = _getAllUpgradePrice(), maxPriceName = '', maxPrice = 0;
  649. for (var res in totalPrice) {
  650. if (totalPrice.hasOwnProperty(res)) {
  651. if (totalPrice[res] > maxPrice) {
  652. maxPrice = totalPrice[res];
  653. maxPriceName = res;
  654. }
  655. }
  656. }
  657. var result = {};
  658. if (maxPriceName !== '') {
  659. result[maxPriceName] = maxPrice;
  660. return result;
  661. } else {
  662. return false;
  663. }
  664. };
  665.  
  666. var _autoBuy = function () {
  667. var toBuy;
  668. for (var item in game.buildings) {
  669. if (item === 'Barn' || item === 'Shed' || item === 'Forge' || item === 'Wormhole' || item === 'Trap') continue;
  670. if (!game.buildings.Collector.locked &&
  671. (item === 'Mansion' || item === 'Hotel' || item === 'Resort' || item === 'House' || item === 'Hut')) continue;
  672. if (game.upgrades.Gigastation.done >= 10 && item === 'Collector') continue;
  673.  
  674. if (game.buildings.hasOwnProperty(item)) {
  675. if (parseInt(game.buildings[item].locked) === 1) continue;
  676. var canAfford = canAffordBuilding(item, false, false, false, true);
  677. if (canAfford) {
  678. if (item === 'Nursery') {
  679. var isElectro = game.global.challengeActive === "Electricity";
  680. var mult = game.global.brokenPlanet ? (game.global.world >= 80 ? 2 : 1.5) : 1;
  681. var enoughNursery = (game.buildings.Nursery.owned >= (game.buildings.Tribute.owned * mult) ||
  682. game.buildings.Nursery.owned >= (game.buildings.Gym.owned * mult));
  683.  
  684. if ((isElectro || !enoughNursery) && !_hasInQueue('Nursery'))
  685. {
  686. toBuy = item;
  687. }
  688. } else {
  689. toBuy = item;
  690. }
  691. }
  692. }
  693. }
  694. if (typeof toBuy !== 'undefined') {
  695. buyBuilding(toBuy, true, true);
  696. _log('Building ' + toBuy);
  697. return 1;
  698. } else {
  699. return 0;
  700. }
  701. };
  702.  
  703. var needFarmer = 25, needLumber = 25, needMiner = 25, needScientist = 1;
  704. var needAllMax = needFarmer + needLumber + needMiner + needScientist;
  705.  
  706. var _buyJobs = function ($obj, unemployed, objName, jobId) {
  707. if ($obj.length > 0) {
  708. var breeding = _getBreeding();
  709. var cnt = 1;
  710. var minBreeding = _getMinimumBreeding();
  711. if (unemployed > needAllMax * 1000000000 && (breeding - 10000000000 > minBreeding)) {
  712. game.global.buyAmt = 10000000000;
  713. cnt = 10000000000;
  714. }
  715. else if (unemployed > needAllMax * 100000000 && (breeding - 1000000000 > minBreeding)) {
  716. game.global.buyAmt = 1000000000;
  717. cnt = 1000000000;
  718. }
  719. else if (unemployed > needAllMax * 10000000 && (breeding - 100000000 > minBreeding)) {
  720. game.global.buyAmt = 100000000;
  721. cnt = 100000000;
  722. }
  723. else if (unemployed > needAllMax * 1000000 && (breeding - 10000000 > minBreeding)) {
  724. game.global.buyAmt = 10000000;
  725. cnt = 10000000;
  726. }
  727. else if (unemployed > needAllMax * 100000 && (breeding - 1000000 > minBreeding)) {
  728. game.global.buyAmt = 1000000;
  729. cnt = 1000000;
  730. }
  731. else if (unemployed > needAllMax * 10000 && (breeding - 100000 > minBreeding)) {
  732. game.global.buyAmt = 100000;
  733. cnt = 100000;
  734. }
  735. else if (unemployed > needAllMax * 1000 && (breeding - 10000 > minBreeding)) {
  736. game.global.buyAmt = 10000;
  737. cnt = 10000;
  738. }
  739. else if (unemployed > needAllMax * 100 && (breeding - 1000 > minBreeding)) {
  740. game.global.buyAmt = 1000;
  741. cnt = 1000;
  742. }
  743. else if (unemployed > needAllMax * 10 && (breeding - 100 > minBreeding)) {
  744. numTab(4);
  745. cnt = 100;
  746. }
  747. else if (unemployed > needAllMax * 2.5 && (breeding - 25 > minBreeding)) {
  748. numTab(3);
  749. cnt = 25;
  750. }
  751. else if (unemployed > needAllMax && (breeding - 10 > minBreeding)) {
  752. numTab(2);
  753. cnt = 10;
  754. }
  755. else {
  756. numTab(1);
  757. cnt = 1;
  758. }
  759. buyJob(jobId, true, true); // confirmed, noTip
  760. numTab(1); // +1
  761. _log('New ' + objName + (cnt > 1 ? " x" + cnt : ''), 'Combat');
  762. return cnt;
  763. } else {
  764. return 0;
  765. }
  766. };
  767.  
  768. var _getJobsNeededCounts = function () {
  769. var maxTrimps = game.resources.trimps.realMax();
  770. var unemployed = Math.ceil(maxTrimps / 2) - game.resources.trimps.employed;
  771. var jobsTotal =
  772. unemployed +
  773. game.jobs.Farmer.owned +
  774. game.jobs.Lumberjack.owned +
  775. game.jobs.Miner.owned +
  776. game.jobs.Scientist.owned;
  777. var hasFarmer = game.jobs.Farmer.locked === 0;
  778. var hasLumber = game.jobs.Lumberjack.locked === 0;
  779. var hasMiner = game.jobs.Miner.locked === 0;
  780. var hasScientist = game.jobs.Scientist.locked === 0;
  781. var needAll =
  782. (hasFarmer ? needFarmer : 0) +
  783. (hasLumber ? needLumber : 0) +
  784. (hasMiner ? needMiner : 0) +
  785. (hasScientist ? needScientist : 0);
  786. if (needAll < 1) needAll = 1;
  787. var minOwned = Math.min(
  788. game.jobs.Farmer.owned,
  789. game.jobs.Lumberjack.owned,
  790. game.jobs.Miner.owned,
  791. Math.floor(jobsTotal * 0.25)
  792. );
  793. if (game.global.world < 20) minOwned = minOwned / 2;
  794. if (minOwned > 30) minOwned = 30; // for science
  795. if (minOwned < 1) minOwned = 1;
  796. var jobsWithoutScientists = jobsTotal - minOwned;
  797.  
  798. return {
  799. Scientist: needScientist ? minOwned : -1,
  800. Farmer: needFarmer ? Math.floor(jobsWithoutScientists * needFarmer / needAll) : -1,
  801. Lumberjack: needLumber ? Math.floor(jobsWithoutScientists * needLumber / needAll) : -1,
  802. Miner: needMiner ? Math.floor(jobsWithoutScientists * needMiner / needAll) : -1
  803. };
  804. };
  805.  
  806. var _autoJobs = function () {
  807. var breeding = game.resources.trimps.owned - game.resources.trimps.employed;
  808. if (breeding < (_getMinimumBreeding() + 1) && game.global.challengeActive !== 'Trapper') return;
  809.  
  810. var maxTrimps = game.resources.trimps.realMax();
  811. var unemployed = Math.ceil(maxTrimps / 2) - game.resources.trimps.employed;
  812.  
  813. var trainerCost = _getJobPrice('Trainer', 'food');
  814. if ((trainerCost < game.resources.food.owned) && unemployed <= 0 && game.jobs.Farmer.owned > 1 && game.jobs.Trainer.locked === 0) {
  815. _log('Fire farmer, sorry. We need trainers.');
  816. game.global.firing = true;
  817. buyJob('Farmer', true, true);
  818. game.global.firing = false;
  819. }
  820.  
  821. if (unemployed <= 0) return;
  822.  
  823. if (trainerCost <= game.resources.food.owned && game.jobs.Trainer.locked === 0) {
  824. buyJob('Trainer', true, true);
  825. _log('New trainer');
  826. return 1;
  827. }
  828.  
  829. if (game.jobs.Geneticist.locked === 0 && _getBreedingTotalSpeed() > maxTrimps * 2) {
  830. buyJob('Geneticist', true, true);
  831. _log('New geneticist');
  832. return 1;
  833. }
  834.  
  835. var cnt = 0;
  836. var $jobsBlock = $('#jobsHere');
  837.  
  838. var $explorer = $jobsBlock.find('.thingColorCanAfford[id=Explorer]');
  839. if ($explorer.length > 0) {
  840. buyJob('Explorer', true, true);
  841. _log('New explorer');
  842. return ++cnt;
  843. }
  844.  
  845. var $farmer = $jobsBlock.find('.thingColorCanAfford[id=Farmer]');
  846.  
  847. var toHire = _getJobsNeededCounts();
  848.  
  849. if (toHire.Farmer > 0 && game.jobs.Farmer.owned < toHire.Farmer) {
  850. cnt += _buyJobs($farmer, unemployed, 'farmer', 'Farmer');
  851. } else if (toHire.Lumberjack > 0 && game.jobs.Lumberjack.owned < toHire.Lumberjack) {
  852. var $lumber = $jobsBlock.find('.thingColorCanAfford[id=Lumberjack]');
  853. cnt += _buyJobs($lumber, unemployed, 'lumberjack', 'Lumberjack');
  854. } else if (toHire.Miner > 0 && game.jobs.Miner.owned < toHire.Miner) {
  855. var $miner = $jobsBlock.find('.thingColorCanAfford[id=Miner]');
  856. cnt += _buyJobs($miner, unemployed, 'miner', 'Miner');
  857. } else if (toHire.Scientist > 0 && game.jobs.Scientist.owned < toHire.Scientist) {
  858. var $science = $jobsBlock.find('.thingColorCanAfford[id=Scientist]');
  859. cnt += _buyJobs($science, unemployed, 'scientist', 'Scientist');
  860. }
  861.  
  862. if (unemployed > 0 && cnt === 0) {
  863. cnt += _buyJobs($farmer, unemployed, 'farmer', 'Farmer');
  864. }
  865.  
  866. return cnt;
  867. };
  868.  
  869. var _styleUpdate = function () {
  870. // remove counts
  871. //noinspection CssUnusedSymbol
  872. $('head').append($("<style type=\"text/css\">\n" +
  873. "span.thingName{font-size:85%;}\n"+
  874. ".queueItem,.btn{padding:0}\n" +
  875. ".thingColorCanNotAfford.upgradeThing{background-color:#530053;}\n" +
  876. "#battleSideTitle{padding:0}\n" +
  877. ".battleSideBtnContainer{margin-top:0;}\n" +
  878. "#logBtnGroup{display:none}\n" +
  879. "#log{height:100%;}\n" +
  880. ".glyphicon-apple{color:orangered;}\n" +
  881. ".glyphicon-tree-deciduous{color:limegreen;}\n"+
  882. ".icomoon.icon-cubes{color:silver;}\n"+
  883. ".icomoon.icon-diamond{color:white;}\n"+
  884. "#buildingsTitleDiv,#upgradesTitleDiv,#equipmentTitleDiv{display:none}\n"+
  885. "#buildingsQueue{height:30px}\n"+
  886. "#buyHere .alert.badge{display:none}\n"+
  887. '</style>'));
  888.  
  889. // remove tabs
  890. $('#buyTabs').hide();
  891. filterTabs('all');
  892. // fix height
  893. $('#topRow,#queueContainer').css('margin-bottom', '0');
  894. $('#jobsTitleDiv').css('padding', '0').css('font-size', 'smaller');
  895. $('#buyHere').css('margin', '0').css('padding', '0').css('overflow-x', 'hidden');
  896. $('#queueContainer').css('height', '70px');
  897. $('#numTabs').css('margin', '0');
  898. $('#buyContainer').css('height', 'calc(99vh - 20vw - 96px)');
  899. // add button
  900. $('#settingsTable').find('tr').append('<td class="btn btn-info" id="botStart" title="' + version + '">Bot start</td>');
  901. $('#botStart').on('click', _onStartButton);
  902. // add grid
  903. var $grid = $('<table style="width:100%;margin-top:4px;font-size:smaller;"><tr>' +
  904. '<td id="magnimp-cell"><span class="glyphicon glyphicon-magnet"></span><label style="margin-left:4px" title="Magimp">...</label></td>' +
  905. '<td id="venimp-cell"><span class="glyphicon glyphicon-glass"></span><label style="margin-left:4px" title="Venimp">...</label></td>' +
  906. '</tr><tr>' +
  907. '<td id="whipimp-cell"><span class="glyphicon glyphicon-star"></span><label style="margin-left:4px" title="Whipimp">...</label></td>' +
  908. '<td id="titimp-cell"><span class="icomoon icon-hammer"></span><label style="margin-left:4px" title="Titimp">' + prettify(game.global.titimpLeft) + '</label></td>' +
  909. '</tr></table>');
  910. $('#battleBtnsColumn').append($grid);
  911. _updateSuperTrimps();
  912. };
  913.  
  914. var _styleFix = function () {
  915. _disableLog();
  916.  
  917. var $buyBoxThings = $('.buyBox').find('.thing');
  918. $buyBoxThings.find('br').remove();
  919. $buyBoxThings.find('.thingOwned').css('margin-left', '4px');
  920.  
  921. /*for (var x in game.upgrades) {
  922. if (game.upgrades.hasOwnProperty(x)) {
  923. if (game.upgrades[x].alert && game.upgrades[x].locked === 0) game.upgrades[x].alert = false;
  924. }
  925. }
  926. for (x in game.buildings) {
  927. if (game.buildings.hasOwnProperty(x)) {
  928. if (game.buildings[x].alert && game.buildings[x].locked === 0) game.buildings[x].alert = false;
  929. }
  930. }
  931. for (x in game.jobs) {
  932. if (game.jobs.hasOwnProperty(x)) {
  933. if (game.jobs[x].alert && game.jobs[x].locked === 0) game.jobs[x].alert = false;
  934. }
  935. }*/
  936.  
  937. $('#buildingsTitleDiv,#upgradesTitleDiv,#equipmentTitleDiv').css('display', 'none');
  938.  
  939. if (typeof game.passedMaps === 'undefined') game.passedMaps = {};
  940. if (typeof game.mapsAttacked === 'undefined') game.mapsAttacked = {};
  941.  
  942. for (var x in game.passedMaps) if (x > game.global.world) {
  943. // Game restart?
  944. game.passedMaps = {};
  945. game.mapsAttacked = {};
  946. $('#venimp-cell').find('label').text('...');
  947. $('#magnimp-cell').find('label').text('...');
  948. $('#whipimp-cell').find('label').text('...');
  949. break;
  950. }
  951.  
  952. var hasItem = false;
  953. if (typeof game.mapUnlocks === 'undefined') {
  954. clearInterval(tStyleFix);
  955. tStyleFix = setInterval(_styleFix, 2000);
  956. } else {
  957. for (x in game.mapUnlocks) {
  958. if (game.mapUnlocks.hasOwnProperty(x)) {
  959. var notPass = game.mapUnlocks[x].startAt <= game.global.world && (typeof game.passedMaps[game.mapUnlocks[x].startAt] === 'undefined' || game.passedMaps[game.mapUnlocks[x].startAt] < 1);
  960. if (notPass) {
  961. $('#battleSideTitle').css('background-color', notPass ? '#A00' : '#600');
  962. hasItem = true;
  963. break;
  964. }
  965. }
  966. }
  967. }
  968. if (!hasItem) {
  969. $('#battleSideTitle').css('background-color', 'transparent');
  970. }
  971. game.passedMaps[game.global.world] = game.global.mapBonus;
  972. if (game.global.mapBonus > 0) {
  973. for (x in game.mapUnlocks) {
  974. if (game.mapUnlocks.hasOwnProperty(x)) {
  975. if (game.mapUnlocks[x].startAt < game.global.world) {
  976. game.passedMaps[game.mapUnlocks[x].startAt] = 1;
  977. }
  978. }
  979. }
  980. }
  981. };
  982.  
  983. var _start = function () {
  984. _log('Passive watcher stop');
  985. clearInterval(tPassiveWatcher);
  986.  
  987. _log('BOT start version ' + version);
  988. tAutoBuy = setInterval(_auto, 1000);
  989.  
  990. $('#botStart').text('Bot stop');
  991. };
  992.  
  993. var _stop = function () {
  994. _log('BOT stop');
  995. clearInterval(tAutoBuy);
  996.  
  997. tPassiveWatcher = setInterval(_passiveWatcher, 1000);
  998. _log('Passive watcher started');
  999.  
  1000. $('#botStart').text('Bot start');
  1001. };
  1002.  
  1003. var logEnabled = true, tTitimp;
  1004.  
  1005. var _updateSuperTrimps = function () {
  1006. var whipStrength = Math.pow(1.003, game.unlocks.impCount.Whipimp);
  1007. whipStrength = prettify((whipStrength - 1) * 100) + "%";
  1008. var magimpStrength = Math.pow(1.003, game.unlocks.impCount.Magnimp);
  1009. magimpStrength = prettify((magimpStrength - 1) * 100) + "%";
  1010. var venimpStrength = Math.pow(1.003, game.unlocks.impCount.Venimp);
  1011. venimpStrength = prettify((venimpStrength - 1) * 100) + "%";
  1012.  
  1013. var mag = $('#magnimp-cell').find('label');
  1014. if (mag.text() !== magimpStrength) mag.text(magimpStrength);
  1015. var whip = $('#whipimp-cell').find('label');
  1016. if (whip.text() !== whipStrength) whip.text(whipStrength);
  1017. var ven = $('#venimp-cell').find('label');
  1018. if (ven.text() !== venimpStrength) ven.text(venimpStrength);
  1019. };
  1020.  
  1021. var _disableLog = function () {
  1022. if (logEnabled) {
  1023. message = function (messageString, type, lootIcon, extraClass, extraTag, htmlPrefix) {
  1024. if (type === 'Loot' && lootIcon === null) return;
  1025. if (type === 'Combat' && (lootIcon === null || typeof lootIcon === 'undefined')) return;
  1026. if (type === 'Loot' &&
  1027. (messageString.indexOf('You just found') > -1 ||
  1028. messageString.indexOf('You found') > -1 ||
  1029. messageString.indexOf('That guy just left') > -1 ||
  1030. (messageString.indexOf(' dropped ') > -1 && messageString.indexOf('That ') > -1) ||
  1031. messageString.indexOf(' manage to ') > -1 ||
  1032. messageString.indexOf('Then he died') > -1 ||
  1033. messageString.indexOf(' popped out!') > -1 ||
  1034. messageString.indexOf('That Feyimp gave you') > -1 ||
  1035. messageString.indexOf('in that dead Tauntimp') > -1 ||
  1036. messageString.indexOf('fragments from that Flutimp') > -1 ||
  1037. messageString.indexOf('That Jestimp gave you') > -1 ||
  1038. messageString.indexOf('That Titimp made your Trimps super strong') > -1 ||
  1039. messageString.indexOf('You scored ') > -1 ||
  1040. messageString.indexOf('Hulking Mutimp ') > -1 ||
  1041. messageString.indexOf('Cubist art is your favorite!') > -1 ||
  1042. messageString.indexOf('Reward encountered: ') > -1 ||
  1043. messageString.indexOf('Findings: ') > -1 ||
  1044. messageString.indexOf('Salvage results: ') > -1 ||
  1045. messageString.indexOf('You hear nearby Kittimps ') > -1
  1046. )) return;
  1047. if (type === 'Story' && typeof lootIcon === 'undefined' &&
  1048. messageString.indexOf('BOT: New ') > -1) return;
  1049. var showTimestamps = parseInt(game.options.menu.timestamps.enabled) === 1;
  1050. if (type === 'Notices' && messageString === 'Game Saved!') {
  1051. var t = showTimestamps ? getCurrentTime() : updatePortalTimer(true);
  1052. $('#saveIndicator').find('.autosaving').text(t);
  1053. return;
  1054. }
  1055. if (messageString.indexOf('The ground up Venimp now increases your Trimps') > -1) {
  1056. _updateSuperTrimps();
  1057. return;
  1058. }
  1059. if (messageString.indexOf('You killed a Magnimp! The strong magnetic forces now increase your loot by') > -1) {
  1060. _updateSuperTrimps();
  1061. return;
  1062. }
  1063. if (messageString.indexOf('Seeing the Whipimps fall is causing all of your Trimps to work') > -1) {
  1064. _updateSuperTrimps();
  1065. return;
  1066. }
  1067.  
  1068. var log = document.getElementById("log");
  1069. var displayType = "block";
  1070. var prefix = "";
  1071. var addId = "";
  1072. if (messageString === "Game Saved!" || extraClass === 'save') {
  1073. addId = " id='saveGame'";
  1074. if (document.getElementById('saveGame') !== null) {
  1075. log.removeChild(document.getElementById('saveGame'));
  1076. }
  1077. }
  1078. if (game.options.menu.timestamps.enabled) {
  1079. messageString = (showTimestamps ? getCurrentTime() : updatePortalTimer(true)) + " " + messageString;
  1080. }
  1081. if (!htmlPrefix) {
  1082. if (lootIcon && lootIcon.charAt(0) === "*") {
  1083. lootIcon = lootIcon.replace("*", "");
  1084. prefix = "icomoon icon-";
  1085. }
  1086. else prefix = "glyphicon glyphicon-";
  1087. if (type === "Story") messageString = "<span class='glyphicon glyphicon-star'></span> " + messageString;
  1088. if (type === "Combat") messageString = "<span class='glyphicon glyphicon-flag'></span> " + messageString;
  1089. if (type === "Loot" && lootIcon) messageString = "<span class='" + prefix + lootIcon + "'></span> " + messageString;
  1090. if (type === "Notices") {
  1091. messageString = "<span class='glyphicon glyphicon-off'></span> " + messageString;
  1092. }
  1093. } else {
  1094. messageString = htmlPrefix + " " + messageString;
  1095. }
  1096. var messageHTML = "<span" + addId + " class='" + type + "Message message" + " " + extraClass + "' style='display: " + displayType + "'>" + messageString + "</span>";
  1097. pendingLogs.all.push(messageHTML);
  1098. postMessages();
  1099.  
  1100. var $allLogs = $('#log').find('span');
  1101. $allLogs.slice(0, -30).remove();
  1102. };
  1103. logEnabled = false;
  1104. }
  1105. };
  1106.  
  1107. var _titimpUpdate = function () {
  1108. $('#titimp-cell').find('label').text(prettify(game.global.titimpLeft > 0 ? game.global.titimpLeft : 0));
  1109. };
  1110.  
  1111. setTimeout(function () {
  1112. _log('Trimps BOT version ' + version);
  1113.  
  1114. tStyleFix = setInterval(_styleFix, 2000);
  1115. tTitimp = setInterval(_titimpUpdate, 500);
  1116.  
  1117. _styleUpdate();
  1118. _styleFix();
  1119.  
  1120. var TrimpsTools = {};
  1121. TrimpsTools.getJobsNeededCounts = _getJobsNeededCounts;
  1122. TrimpsTools.hasUpgradeForEquipment = _hasUpgradeForEquipment;
  1123. TrimpsTools.hasMapOfCurrentLevel = _hasMapOfCurrentLevel;
  1124. TrimpsTools.needAttackCurrentMap = _needAttackCurrentMap;
  1125. TrimpsTools.getAllUpgradePrice = _getAllUpgradePrice;
  1126. TrimpsTools.getUpgradePriceSumForRes = _getUpgradePriceSumForRes;
  1127.  
  1128. if (typeof game.TrimpsTools === 'undefined') {
  1129. game.TrimpsTools = TrimpsTools;
  1130. }
  1131. if (typeof unsafeWindow !== 'undefined') unsafeWindow.TrimpsTools = TrimpsTools;
  1132.  
  1133. _disableLog();
  1134.  
  1135. _stop(); // start passive watcher
  1136. }, 1000);
  1137.  
  1138. })();