Total Resource Amount In Queue

try to take over the world!

  1. // ==UserScript==
  2. // @name Total Resource Amount In Queue
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.3
  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","wine","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. if(resourceType == "crystal") {
  44. resourceType = "glass";
  45. }
  46. var resourceAmount = parseInt($(this).find("span").html().replace(",",""));
  47. totalResourcesInQueue[resourceType] += resourceAmount;
  48. }
  49. });
  50. });
  51.  
  52. var htmlOutput = '<li><table>';
  53. resourceType.forEach(function(element, index){
  54. if(totalResourcesInQueue[element] > 0 ) {
  55. var minusDiff = '';
  56. if(totalResourcesInQueue[element] > resourceAmountOwn[element]) {
  57. minusDiff = '<span style="color: red; font-wieght:bold">('+(resourceAmountOwn[element] - totalResourcesInQueue[element]).toLocaleString()+')</span>';
  58. }
  59. htmlOutput += '<tr><td><img src="'+resourceIcons[element]+'" style="margin-right: 5px;"></td><td>'+totalResourcesInQueue[element].toLocaleString()+ ' ' + minusDiff + '</td></tr>';
  60. }
  61. });
  62. htmlOutput += '</table></li>';
  63.  
  64. $("#constructionList").after("<h4>Toplam Malzeme İhtiyacı</h4>" + htmlOutput);
  65. }, 1500);
  66. }
  67. });
  68.  
  69. })();

QingJ © 2025

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