Total Resource Amount In Queue

try to take over the world!

当前为 2020-11-20 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Total Resource Amount In Queue
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author Serhat Yücel
  7. // @match https://s46-tr.ikariam.gameforge.com/?view=city*
  8. // @grant GM_xmlhttpRequest
  9. // @require https://code.jquery.com/jquery-3.5.1.min.js
  10.  
  11.  
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16. $(document).ready(function(){
  17.  
  18. $("#locations .building").click(function() {
  19. calculateInQueueResources();
  20. });
  21.  
  22. function calculateInQueueResources() {
  23. var resourceType = ["wood","marble","glass","sulfur"];
  24. var totalResourcesInQueue = {"wood": 0, "wine":0, "marble":0, "glass": 0, "sulfur": 0}
  25. var resourceAmountOwn = {"wood": 0, "wine":0, "marble":0, "glass": 0, "sulfur": 0}
  26. resourceAmountOwn["wood"] = parseInt($("#js_GlobalMenu_wood").text().replace(",",""));
  27. resourceAmountOwn["wine"] = parseInt($("#js_GlobalMenu_wine").text().replace(",",""));
  28. resourceAmountOwn["marble"] = parseInt($("#js_GlobalMenu_marble").text().replace(",",""));
  29. resourceAmountOwn["glass"] = parseInt($("#js_GlobalMenu_crystal").text().replace(",",""));
  30. resourceAmountOwn["sulfur"] = parseInt($("#js_GlobalMenu_sulfur").text().replace(",",""));
  31. var resourceIcons = {"wood": "https://s46-tr.ikariam.gameforge.com/skin/resources/icon_wood.png",
  32. "marble": "https://s46-tr.ikariam.gameforge.com/skin/resources/icon_marble.png",
  33. "wine": "https://s46-tr.ikariam.gameforge.com/skin/resources/icon_wine.png",
  34. "glass": "https://s46-tr.ikariam.gameforge.com/skin/resources/icon_glass.png",
  35. "sulfur":"https://s46-tr.ikariam.gameforge.com/skin/resources/icon_sulfur.png"}
  36.  
  37.  
  38. setTimeout(function() {
  39. $("#constructionList li").each(function( index ) {
  40. $(this).find(".tooltip").find("div").each(function(ind){
  41. if(ind >= 2) {
  42. var resourceType = $(this).find("img").attr("src").split("_")[1];
  43. var resourceAmount = parseInt($(this).find("span").html().replace(",",""));
  44. totalResourcesInQueue[resourceType] += resourceAmount;
  45. }
  46. });
  47. });
  48.  
  49. var htmlOutput = '<li><table>';
  50. resourceType.forEach(function(element, index){
  51. if(totalResourcesInQueue[element] > 0 ) {
  52. var minusDiff = '';
  53. if(totalResourcesInQueue[element] > resourceAmountOwn[element]) {
  54. minusDiff = '<span style="color: red; font-wieght:bold">('+(resourceAmountOwn[element] - totalResourcesInQueue[element]).toLocaleString()+')</span>';
  55. }
  56. htmlOutput += '<tr><td><img src="'+resourceIcons[element]+'" style="margin-right: 5px;"></td><td>'+totalResourcesInQueue[element].toLocaleString()+ ' ' + minusDiff + '</td></tr>';
  57. }
  58. });
  59. htmlOutput += '</table></li>';
  60.  
  61. $("#constructionList").after("<h4>Toplam Malzeme İhtiyacı</h4>" + htmlOutput);
  62. }, 1500);
  63. }
  64. });
  65.  
  66. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址