ahmetems33gmail.com / Script K

// ==UserScript==
// @name         Script K
// @author       Criyessei
// @version      1511363469
// @require      https://code.jquery.com/jquery-3.1.1.min.js
// @include      *.kingsage.gameforge.com*
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_deleteValue
// @copyright     2017, Criyessei
// @license       MIT
// @version       1.0.0
// ==/UserScript==

// ==OpenUserJS==
// @author ahmetems33gmail.com
// ==/OpenUserJS==

var current_version = 1511363469;

var binalar = [{ "name": "main", "isim": "Kale" }, { "name": "stone", "isim": "Taş ocağı" }, { "name": "wood", "isim": "Oduncu Kampı" }, { "name": "iron", "isim": "Maden ocağı" }, { "name": "storage", "isim": "Depo" }, { "name": "hide", "isim": "Gizli Depo" }, { "name": "farm", "isim": "Değirmen" }, { "name": "barracks", "isim": "Kışla" }, { "name": "wall", "isim": "Sur" }, { "name": "stable", "isim": "Katır çiftliği" }, { "name": "market", "isim": "Market" }, { "name": "garage", "isim": "Simyager" }, { "name": "snob", "isim": "Köşk" }, { "name": "smith", "isim": "Kuyumcu" }, { "name": "statue", "isim": "Anıt" }];
var Kale_Gelistirmeler = [{"tas":85,"odun":70,"demir":65,"isci":2},{"tas":99,"odun":82,"demir":76,"isci":0},{"tas":116,"odun":95,"demir":88,"isci":1},{"tas":136,"odun":111,"demir":103,"isci":0},{"tas":159,"odun":129,"demir":120,"isci":0},{"tas":186,"odun":150,"demir":139,"isci":1},{"tas":218,"odun":175,"demir":163,"isci":0},{"tas":255,"odun":204,"demir":189,"isci":0},{"tas":298,"odun":238,"demir":221,"isci":1},{"tas":349,"odun":277,"demir":257,"isci":1},{"tas":409,"odun":322,"demir":299,"isci":0},{"tas":478,"odun":376,"demir":349,"isci":1},{"tas":559,"odun":438,"demir":406,"isci":1},{"tas":654,"odun":510,"demir":473,"isci":1},{"tas":766,"odun":594,"demir":551,"isci":1},{"tas":896,"odun":692,"demir":642,"isci":1},{"tas":1048,"odun":806,"demir":748,"isci":1},{"tas":1226,"odun":939,"demir":872,"isci":2},{"tas":1435,"odun":1094,"demir":1016,"isci":1},{"tas":1679,"odun":1274,"demir":1183,"isci":2},{"tas":1964,"odun":1485,"demir":1379,"isci":2},{"tas":2298,"odun":1730,"demir":1606,"isci":3},{"tas":2688,"odun":2015,"demir":1871,"isci":2},{"tas":3146,"odun":2347,"demir":2180,"isci":3},{"tas":3680,"odun":2735,"demir":2539,"isci":3},{"tas":4306,"odun":3186,"demir":2958,"isci":4},{"tas":5038,"odun":3712,"demir":3447,"isci":4},{"tas":5894,"odun":4324,"demir":4015,"isci":5},{"tas":6896,"odun":5038,"demir":4678,"isci":5},{"tas":8069,"odun":5869,"demir":5450,"isci":5},{"tas":9440,"odun":6837,"demir":6349,"isci":7},{"tas":11045,"odun":7965,"demir":7396,"isci":7},{"tas":12923,"odun":9280,"demir":8617,"isci":8},{"tas":15120,"odun":10811,"demir":10039,"isci":9},{"tas":17690,"odun":12594,"demir":11695,"isci":10},{"tas":20698,"odun":14673,"demir":13625,"isci":12},{"tas":24216,"odun":17094,"demir":15873,"isci":12},{"tas":28333,"odun":19914,"demir":18492,"isci":14},{"tas":33150,"odun":23200,"demir":21543,"isci":16},{"tas":38785,"odun":27028,"demir":25097,"isci":18},{"tas":45379,"odun":31487,"demir":29238,"isci":20},{"tas":53093,"odun":36683,"demir":34062,"isci":22},{"tas":62119,"odun":42735,"demir":39683,"isci":25},{"tas":72679,"odun":49787,"demir":46230,"isci":28},{"tas":85035,"odun":58001,"demir":53858,"isci":32},{"tas":99491,"odun":67572,"demir":62745,"isci":35},{"tas":116404,"odun":78721,"demir":73098,"isci":39},{"tas":136193,"odun":91710,"demir":85159,"isci":44},{"tas":159346,"odun":106842,"demir":99211,"isci":50},{"tas":186434,"odun":124471,"demir":115580,"isci":55}];
var TasOcagi_Gelistirmeler = [{"tas":40,"odun":30,"demir":55,"isci":5},{"tas":47,"odun":35,"demir":64,"isci":1},{"tas":55,"odun":41,"demir":75,"isci":0},{"tas":64,"odun":47,"demir":87,"isci":1},{"tas":75,"odun":55,"demir":101,"isci":0},{"tas":88,"odun":64,"demir":118,"isci":1},{"tas":103,"odun":75,"demir":138,"isci":1},{"tas":120,"odun":87,"demir":160,"isci":1},{"tas":140,"odun":102,"demir":187,"isci":1},{"tas":164,"odun":119,"demir":217,"isci":1},{"tas":192,"odun":138,"demir":253,"isci":1},{"tas":225,"odun":161,"demir":295,"isci":1},{"tas":263,"odun":188,"demir":344,"isci":2},{"tas":308,"odun":218,"demir":400,"isci":1},{"tas":360,"odun":254,"demir":467,"isci":2},{"tas":422,"odun":296,"demir":544,"isci":2},{"tas":493,"odun":345,"demir":633,"isci":2},{"tas":577,"odun":402,"demir":738,"isci":2},{"tas":675,"odun":469,"demir":859,"isci":3},{"tas":790,"odun":546,"demir":1001,"isci":3},{"tas":924,"odun":636,"demir":1166,"isci":3},{"tas":1081,"odun":741,"demir":1359,"isci":3},{"tas":1265,"odun":864,"demir":1583,"isci":4},{"tas":1480,"odun":1006,"demir":1844,"isci":4},{"tas":1732,"odun":1172,"demir":2149,"isci":4},{"tas":2026,"odun":1365,"demir":2503,"isci":5},{"tas":2371,"odun":1591,"demir":2916,"isci":6},{"tas":2774,"odun":1853,"demir":3398,"isci":6},{"tas":3245,"odun":2159,"demir":3958,"isci":6},{"tas":3797,"odun":2515,"demir":4611,"isci":7},{"tas":4443,"odun":2930,"demir":5372,"isci":8},{"tas":5198,"odun":3414,"demir":6258,"isci":9},{"tas":6081,"odun":3977,"demir":7291,"isci":10},{"tas":7115,"odun":4633,"demir":8494,"isci":10},{"tas":8325,"odun":5398,"demir":9896,"isci":12},{"tas":9740,"odun":6288,"demir":11528,"isci":13},{"tas":11396,"odun":7326,"demir":13431,"isci":14},{"tas":13333,"odun":8535,"demir":15647,"isci":15},{"tas":15600,"odun":9943,"demir":18228,"isci":17},{"tas":18252,"odun":11583,"demir":21236,"isci":19},{"tas":21355,"odun":13495,"demir":24740,"isci":20},{"tas":24985,"odun":15721,"demir":28822,"isci":23},{"tas":29233,"odun":18315,"demir":33578,"isci":25},{"tas":34202,"odun":21337,"demir":39118,"isci":27},{"tas":40016,"odun":24858,"demir":45573,"isci":30},{"tas":46819,"odun":28959,"demir":53092,"isci":33},{"tas":54778,"odun":33738,"demir":61852,"isci":37},{"tas":64091,"odun":39304,"demir":72058,"isci":40},{"tas":74986,"odun":45789,"demir":83947,"isci":44},{"tas":87734,"odun":53345,"demir":97799,"isci":49}];
var OduncuKampi_Gelistirmeler = [{"tas":55,"odun":30,"demir":40,"isci":5},{"tas":64,"odun":35,"demir":47,"isci":1},{"tas":75,"odun":41,"demir":54,"isci":0},{"tas":88,"odun":47,"demir":63,"isci":1},{"tas":103,"odun":55,"demir":74,"isci":0},{"tas":121,"odun":64,"demir":86,"isci":1},{"tas":141,"odun":75,"demir":100,"isci":1},{"tas":165,"odun":87,"demir":117,"isci":1},{"tas":193,"odun":102,"demir":136,"isci":1},{"tas":226,"odun":119,"demir":158,"isci":1},{"tas":264,"odun":138,"demir":184,"isci":1},{"tas":309,"odun":161,"demir":215,"isci":1},{"tas":362,"odun":188,"demir":250,"isci":2},{"tas":423,"odun":218,"demir":291,"isci":1},{"tas":495,"odun":254,"demir":339,"isci":2},{"tas":580,"odun":296,"demir":395,"isci":2},{"tas":678,"odun":345,"demir":461,"isci":2},{"tas":793,"odun":402,"demir":537,"isci":2},{"tas":928,"odun":469,"demir":625,"isci":3},{"tas":1086,"odun":546,"demir":728,"isci":3},{"tas":1271,"odun":636,"demir":848,"isci":3},{"tas":1487,"odun":741,"demir":988,"isci":3},{"tas":1740,"odun":864,"demir":1151,"isci":4},{"tas":2035,"odun":1006,"demir":1341,"isci":4},{"tas":2381,"odun":1172,"demir":1563,"isci":4},{"tas":2786,"odun":1365,"demir":1821,"isci":5},{"tas":3260,"odun":1591,"demir":2121,"isci":6},{"tas":3814,"odun":1853,"demir":2471,"isci":6},{"tas":4462,"odun":2159,"demir":2879,"isci":6},{"tas":5221,"odun":2515,"demir":3354,"isci":7},{"tas":6109,"odun":2930,"demir":3907,"isci":8},{"tas":7147,"odun":3414,"demir":4552,"isci":9},{"tas":8362,"odun":3977,"demir":5303,"isci":10},{"tas":9784,"odun":4633,"demir":6178,"isci":10},{"tas":11447,"odun":5398,"demir":7197,"isci":12},{"tas":13393,"odun":6288,"demir":8384,"isci":13},{"tas":15669,"odun":7326,"demir":9768,"isci":14},{"tas":18333,"odun":8535,"demir":11379,"isci":15},{"tas":21450,"odun":9943,"demir":13257,"isci":17},{"tas":25096,"odun":11583,"demir":15444,"isci":19},{"tas":29363,"odun":13495,"demir":17993,"isci":20},{"tas":34354,"odun":15721,"demir":20962,"isci":23},{"tas":40195,"odun":18315,"demir":24420,"isci":25},{"tas":47028,"odun":21337,"demir":28450,"isci":27},{"tas":55023,"odun":24858,"demir":33144,"isci":30},{"tas":64376,"odun":28959,"demir":38612,"isci":33},{"tas":75320,"odun":33738,"demir":44983,"isci":37},{"tas":88125,"odun":39304,"demir":52406,"isci":40},{"tas":103106,"odun":45789,"demir":61053,"isci":44},{"tas":120634,"odun":53345,"demir":71126,"isci":49}];
var MadenOcagi_Gelistirmeler = [{"tas":55,"odun":40,"demir":30,"isci":5},{"tas":64,"odun":47,"demir":35,"isci":1},{"tas":75,"odun":54,"demir":41,"isci":0},{"tas":88,"odun":63,"demir":47,"isci":1},{"tas":103,"odun":74,"demir":55,"isci":0},{"tas":121,"odun":86,"demir":64,"isci":1},{"tas":141,"odun":100,"demir":75,"isci":1},{"tas":165,"odun":117,"demir":87,"isci":1},{"tas":193,"odun":136,"demir":102,"isci":1},{"tas":226,"odun":158,"demir":119,"isci":1},{"tas":264,"odun":184,"demir":138,"isci":1},{"tas":309,"odun":215,"demir":161,"isci":1},{"tas":362,"odun":250,"demir":188,"isci":2},{"tas":423,"odun":291,"demir":218,"isci":1},{"tas":495,"odun":339,"demir":254,"isci":2},{"tas":580,"odun":395,"demir":296,"isci":2},{"tas":678,"odun":461,"demir":345,"isci":2},{"tas":793,"odun":537,"demir":402,"isci":2},{"tas":928,"odun":625,"demir":469,"isci":3},{"tas":1086,"odun":728,"demir":546,"isci":3},{"tas":1271,"odun":848,"demir":636,"isci":3},{"tas":1487,"odun":988,"demir":741,"isci":3},{"tas":1740,"odun":1151,"demir":864,"isci":4},{"tas":2035,"odun":1341,"demir":1006,"isci":4},{"tas":2381,"odun":1563,"demir":1172,"isci":4},{"tas":2786,"odun":1821,"demir":1365,"isci":5},{"tas":3260,"odun":2121,"demir":1591,"isci":6},{"tas":3814,"odun":2471,"demir":1853,"isci":6},{"tas":4462,"odun":2879,"demir":2159,"isci":6},{"tas":5221,"odun":3354,"demir":2515,"isci":7},{"tas":6109,"odun":3907,"demir":2930,"isci":8},{"tas":7147,"odun":4552,"demir":3414,"isci":9},{"tas":8362,"odun":5303,"demir":3977,"isci":10},{"tas":9784,"odun":6178,"demir":4633,"isci":10},{"tas":11447,"odun":7197,"demir":5398,"isci":12},{"tas":13393,"odun":8384,"demir":6288,"isci":13},{"tas":15669,"odun":9768,"demir":7326,"isci":14},{"tas":18333,"odun":11379,"demir":8535,"isci":15},{"tas":21450,"odun":13257,"demir":9943,"isci":17},{"tas":25096,"odun":15444,"demir":11583,"isci":19},{"tas":29363,"odun":17993,"demir":13495,"isci":20},{"tas":34354,"odun":20962,"demir":15721,"isci":23},{"tas":40195,"odun":24420,"demir":18315,"isci":25},{"tas":47028,"odun":28450,"demir":21337,"isci":27},{"tas":55023,"odun":33144,"demir":24858,"isci":30},{"tas":64376,"odun":38612,"demir":28959,"isci":33},{"tas":75320,"odun":44983,"demir":33738,"isci":37},{"tas":88125,"odun":52406,"demir":39304,"isci":40},{"tas":103106,"odun":61053,"demir":45789,"isci":44},{"tas":120634,"odun":71126,"demir":53345,"isci":49}];
var Depo_Gelistirmeler = [{"tas":43,"odun":40,"demir":35,"isci":0},{"tas":50,"odun":47,"demir":41,"isci":0},{"tas":59,"odun":54,"demir":48,"isci":0},{"tas":69,"odun":63,"demir":55,"isci":0},{"tas":81,"odun":74,"demir":64,"isci":0},{"tas":94,"odun":86,"demir":75,"isci":0},{"tas":110,"odun":100,"demir":88,"isci":0},{"tas":129,"odun":117,"demir":102,"isci":0},{"tas":151,"odun":136,"demir":119,"isci":0},{"tas":177,"odun":158,"demir":138,"isci":0},{"tas":207,"odun":184,"demir":161,"isci":0},{"tas":242,"odun":215,"demir":188,"isci":0},{"tas":283,"odun":250,"demir":219,"isci":0},{"tas":331,"odun":291,"demir":255,"isci":0},{"tas":387,"odun":339,"demir":297,"isci":0},{"tas":453,"odun":395,"demir":346,"isci":0},{"tas":530,"odun":461,"demir":403,"isci":0},{"tas":620,"odun":537,"demir":469,"isci":1},{"tas":726,"odun":625,"demir":547,"isci":0},{"tas":849,"odun":728,"demir":637,"isci":0},{"tas":994,"odun":848,"demir":742,"isci":0},{"tas":1162,"odun":988,"demir":865,"isci":0},{"tas":1360,"odun":1151,"demir":1007,"isci":0},{"tas":1591,"odun":1341,"demir":1174,"isci":0},{"tas":1862,"odun":1563,"demir":1367,"isci":0},{"tas":2178,"odun":1821,"demir":1593,"isci":0},{"tas":2549,"odun":2121,"demir":1856,"isci":0},{"tas":2982,"odun":2471,"demir":2162,"isci":0},{"tas":3489,"odun":2879,"demir":2519,"isci":0},{"tas":4082,"odun":3354,"demir":2934,"isci":1},{"tas":4776,"odun":3907,"demir":3419,"isci":0},{"tas":5588,"odun":4552,"demir":3983,"isci":0},{"tas":6538,"odun":5303,"demir":4640,"isci":0},{"tas":7649,"odun":6178,"demir":5405,"isci":0},{"tas":8949,"odun":7197,"demir":6297,"isci":1},{"tas":10471,"odun":8384,"demir":7336,"isci":0},{"tas":12251,"odun":9768,"demir":8547,"isci":0},{"tas":14333,"odun":11379,"demir":9957,"isci":0},{"tas":16770,"odun":13257,"demir":11600,"isci":1},{"tas":19621,"odun":15444,"demir":13514,"isci":0},{"tas":22956,"odun":17993,"demir":15744,"isci":1},{"tas":26859,"odun":20962,"demir":18341,"isci":0},{"tas":31425,"odun":24420,"demir":21368,"isci":0},{"tas":36767,"odun":28450,"demir":24893,"isci":1},{"tas":43018,"odun":33144,"demir":29001,"isci":1},{"tas":50331,"odun":38612,"demir":33786,"isci":0},{"tas":58887,"odun":44983,"demir":39361,"isci":1},{"tas":68898,"odun":52406,"demir":45855,"isci":1},{"tas":80610,"odun":61053,"demir":53421,"isci":1},{"tas":94314,"odun":71126,"demir":62236,"isci":1}];
var GizliDepo_Gelistirmeler = [{"tas":50,"odun":40,"demir":40,"isci":1},{"tas":59,"odun":47,"demir":47,"isci":0},{"tas":68,"odun":54,"demir":54,"isci":0},{"tas":80,"odun":63,"demir":63,"isci":1},{"tas":94,"odun":74,"demir":74,"isci":0},{"tas":110,"odun":86,"demir":86,"isci":0},{"tas":128,"odun":100,"demir":100,"isci":0},{"tas":150,"odun":117,"demir":117,"isci":1},{"tas":176,"odun":136,"demir":136,"isci":0},{"tas":205,"odun":158,"demir":158,"isci":1},{"tas":240,"odun":184,"demir":184,"isci":0},{"tas":281,"odun":215,"demir":215,"isci":1},{"tas":329,"odun":250,"demir":250,"isci":0},{"tas":385,"odun":291,"demir":291,"isci":1},{"tas":450,"odun":339,"demir":339,"isci":1},{"tas":527,"odun":395,"demir":395,"isci":1},{"tas":617,"odun":461,"demir":461,"isci":1},{"tas":721,"odun":537,"demir":537,"isci":2},{"tas":844,"odun":625,"demir":625,"isci":1},{"tas":987,"odun":728,"demir":728,"isci":2},{"tas":1155,"odun":848,"demir":848,"isci":2},{"tas":1352,"odun":988,"demir":988,"isci":3},{"tas":1581,"odun":1151,"demir":1151,"isci":3},{"tas":1850,"odun":1341,"demir":1341,"isci":3},{"tas":2165,"odun":1563,"demir":1563,"isci":4},{"tas":2533,"odun":1821,"demir":1821,"isci":4},{"tas":2963,"odun":2121,"demir":2121,"isci":5},{"tas":3467,"odun":2471,"demir":2471,"isci":6},{"tas":4057,"odun":2879,"demir":2879,"isci":6},{"tas":4746,"odun":3354,"demir":3354,"isci":8}];
var Degirmen_Gelistirmeler = [{"tas":65,"odun":50,"demir":50,"isci":0},{"tas":76,"odun":58,"demir":58,"isci":0},{"tas":89,"odun":68,"demir":67,"isci":0},{"tas":104,"odun":79,"demir":78,"isci":0},{"tas":122,"odun":92,"demir":91,"isci":0},{"tas":143,"odun":107,"demir":105,"isci":0},{"tas":167,"odun":125,"demir":122,"isci":0},{"tas":195,"odun":146,"demir":141,"isci":0},{"tas":228,"odun":170,"demir":164,"isci":0},{"tas":267,"odun":198,"demir":190,"isci":0},{"tas":312,"odun":230,"demir":221,"isci":0},{"tas":366,"odun":268,"demir":256,"isci":0},{"tas":428,"odun":313,"demir":297,"isci":0},{"tas":500,"odun":364,"demir":344,"isci":0},{"tas":585,"odun":424,"demir":399,"isci":0},{"tas":685,"odun":494,"demir":463,"isci":0},{"tas":801,"odun":576,"demir":537,"isci":0},{"tas":938,"odun":671,"demir":623,"isci":0},{"tas":1097,"odun":781,"demir":723,"isci":0},{"tas":1284,"odun":910,"demir":839,"isci":0},{"tas":1502,"odun":1060,"demir":973,"isci":0},{"tas":1757,"odun":1235,"demir":1129,"isci":0},{"tas":2056,"odun":1439,"demir":1309,"isci":0},{"tas":2405,"odun":1677,"demir":1519,"isci":0},{"tas":2814,"odun":1953,"demir":1762,"isci":0},{"tas":3293,"odun":2276,"demir":2044,"isci":0},{"tas":3853,"odun":2651,"demir":2371,"isci":0},{"tas":4507,"odun":3089,"demir":2750,"isci":0},{"tas":5274,"odun":3598,"demir":3190,"isci":0},{"tas":6170,"odun":4192,"demir":3700,"isci":0},{"tas":7219,"odun":4884,"demir":4292,"isci":0},{"tas":8446,"odun":5689,"demir":4979,"isci":0},{"tas":9882,"odun":6628,"demir":5776,"isci":0},{"tas":11562,"odun":7722,"demir":6700,"isci":0},{"tas":13528,"odun":8996,"demir":7772,"isci":0},{"tas":15828,"odun":10480,"demir":9016,"isci":0},{"tas":18518,"odun":12210,"demir":10458,"isci":0},{"tas":21667,"odun":14224,"demir":12132,"isci":0},{"tas":25350,"odun":16571,"demir":14073,"isci":0},{"tas":29659,"odun":19306,"demir":16324,"isci":0},{"tas":34701,"odun":22491,"demir":18936,"isci":0},{"tas":40601,"odun":26202,"demir":21966,"isci":0},{"tas":47503,"odun":30525,"demir":25480,"isci":0},{"tas":55578,"odun":35562,"demir":29557,"isci":0},{"tas":65027,"odun":41430,"demir":34286,"isci":0},{"tas":76081,"odun":48265,"demir":39772,"isci":0},{"tas":89015,"odun":56229,"demir":46136,"isci":0},{"tas":104148,"odun":65507,"demir":53517,"isci":0},{"tas":121853,"odun":76316,"demir":62080,"isci":0},{"tas":142568,"odun":88908,"demir":72013,"isci":0}];
var Kisla_Gelistirmeler = [{"tas":180,"odun":180,"demir":120,"isci":6},{"tas":221,"odun":218,"demir":146,"isci":1},{"tas":272,"odun":264,"demir":179,"isci":1},{"tas":335,"odun":319,"demir":218,"isci":2},{"tas":412,"odun":386,"demir":266,"isci":1},{"tas":507,"odun":467,"demir":324,"isci":2},{"tas":623,"odun":565,"demir":396,"isci":2},{"tas":767,"odun":684,"demir":483,"isci":3},{"tas":943,"odun":827,"demir":589,"isci":3},{"tas":1160,"odun":1001,"demir":718,"isci":4},{"tas":1427,"odun":1211,"demir":877,"isci":4},{"tas":1755,"odun":1465,"demir":1069,"isci":5},{"tas":2158,"odun":1773,"demir":1305,"isci":5},{"tas":2655,"odun":2145,"demir":1592,"isci":7},{"tas":3265,"odun":2596,"demir":1942,"isci":8},{"tas":4017,"odun":3141,"demir":2369,"isci":9},{"tas":4940,"odun":3800,"demir":2890,"isci":11},{"tas":6077,"odun":4599,"demir":3526,"isci":13},{"tas":7474,"odun":5564,"demir":4302,"isci":14},{"tas":9193,"odun":6733,"demir":5248,"isci":17},{"tas":11308,"odun":8147,"demir":6403,"isci":21},{"tas":13908,"odun":9857,"demir":7812,"isci":23},{"tas":17107,"odun":11928,"demir":9530,"isci":28},{"tas":21042,"odun":14432,"demir":11627,"isci":32},{"tas":25882,"odun":17463,"demir":14185,"isci":38},{"tas":31835,"odun":21130,"demir":17305,"isci":44},{"tas":39157,"odun":25568,"demir":21112,"isci":52},{"tas":48163,"odun":30937,"demir":25757,"isci":60},{"tas":59240,"odun":37434,"demir":31424,"isci":71},{"tas":72865,"odun":45295,"demir":38337,"isci":83}];
var Sur_Gelistirmeler = [{"tas":60,"odun":40,"demir":30,"isci":4},{"tas":70,"odun":47,"demir":35,"isci":1},{"tas":82,"odun":54,"demir":40,"isci":1},{"tas":96,"odun":63,"demir":47,"isci":1},{"tas":112,"odun":74,"demir":54,"isci":1},{"tas":132,"odun":86,"demir":63,"isci":2},{"tas":154,"odun":100,"demir":73,"isci":2},{"tas":180,"odun":117,"demir":85,"isci":2},{"tas":211,"odun":136,"demir":98,"isci":3},{"tas":247,"odun":158,"demir":114,"isci":4},{"tas":288,"odun":184,"demir":132,"isci":4},{"tas":337,"odun":215,"demir":154,"isci":5},{"tas":395,"odun":250,"demir":178,"isci":6},{"tas":462,"odun":291,"demir":207,"isci":7},{"tas":540,"odun":339,"demir":240,"isci":8},{"tas":632,"odun":395,"demir":278,"isci":11},{"tas":740,"odun":461,"demir":322,"isci":12},{"tas":866,"odun":537,"demir":374,"isci":15},{"tas":1013,"odun":625,"demir":434,"isci":17},{"tas":1185,"odun":728,"demir":503,"isci":22}];
var KatirCiftligi_Gelistirmeler = [{"tas":240,"odun":200,"demir":220,"isci":10},{"tas":281,"odun":233,"demir":255,"isci":1},{"tas":329,"odun":271,"demir":296,"isci":1},{"tas":384,"odun":316,"demir":343,"isci":1},{"tas":450,"odun":368,"demir":398,"isci":2},{"tas":526,"odun":429,"demir":462,"isci":1},{"tas":616,"odun":500,"demir":536,"isci":2},{"tas":720,"odun":583,"demir":622,"isci":1},{"tas":843,"odun":679,"demir":721,"isci":2},{"tas":986,"odun":791,"demir":837,"isci":3},{"tas":1154,"odun":921,"demir":971,"isci":2},{"tas":1350,"odun":1073,"demir":1126,"isci":3},{"tas":1579,"odun":1250,"demir":1306,"isci":2},{"tas":1848,"odun":1456,"demir":1515,"isci":4},{"tas":2162,"odun":1697,"demir":1757,"isci":3},{"tas":2529,"odun":1977,"demir":2038,"isci":4},{"tas":2959,"odun":2303,"demir":2365,"isci":4},{"tas":3462,"odun":2683,"demir":2743,"isci":5},{"tas":4051,"odun":3125,"demir":3182,"isci":5},{"tas":4740,"odun":3641,"demir":3691,"isci":5},{"tas":5545,"odun":4242,"demir":4281,"isci":6},{"tas":6488,"odun":4942,"demir":4966,"isci":7},{"tas":7591,"odun":5757,"demir":5761,"isci":7},{"tas":8881,"odun":6707,"demir":6683,"isci":9},{"tas":10391,"odun":7814,"demir":7752,"isci":8},{"tas":12158,"odun":9103,"demir":8992,"isci":10},{"tas":14225,"odun":10605,"demir":10431,"isci":11},{"tas":16643,"odun":12355,"demir":12100,"isci":12},{"tas":19472,"odun":14393,"demir":14036,"isci":13},{"tas":22782,"odun":16768,"demir":16282,"isci":15}];
var Market_Gelistirmeler = [{"tas":100,"odun":80,"demir":70,"isci":10},{"tas":117,"odun":93,"demir":81,"isci":2},{"tas":137,"odun":109,"demir":94,"isci":2},{"tas":160,"odun":126,"demir":109,"isci":2},{"tas":187,"odun":147,"demir":127,"isci":3},{"tas":219,"odun":172,"demir":147,"isci":3},{"tas":257,"odun":200,"demir":171,"isci":4},{"tas":300,"odun":233,"demir":198,"isci":4},{"tas":351,"odun":271,"demir":229,"isci":5},{"tas":411,"odun":316,"demir":266,"isci":6},{"tas":481,"odun":368,"demir":309,"isci":7},{"tas":562,"odun":429,"demir":358,"isci":8},{"tas":658,"odun":500,"demir":416,"isci":10},{"tas":770,"odun":583,"demir":482,"isci":11},{"tas":901,"odun":679,"demir":559,"isci":13},{"tas":1054,"odun":791,"demir":649,"isci":15},{"tas":1233,"odun":921,"demir":752,"isci":18},{"tas":1443,"odun":1073,"demir":873,"isci":21},{"tas":1688,"odun":1250,"demir":1012,"isci":25},{"tas":1975,"odun":1456,"demir":1174,"isci":28},{"tas":2311,"odun":1697,"demir":1362,"isci":34},{"tas":2703,"odun":1977,"demir":1580,"isci":39},{"tas":3163,"odun":2303,"demir":1833,"isci":46},{"tas":3701,"odun":2683,"demir":2126,"isci":54},{"tas":4330,"odun":3125,"demir":2467,"isci":63},{"tas":5066,"odun":3641,"demir":2861,"isci":74},{"tas":5927,"odun":4242,"demir":3319,"isci":86},{"tas":6935,"odun":4942,"demir":3850,"isci":100},{"tas":8113,"odun":5757,"demir":4466,"isci":118},{"tas":9493,"odun":6707,"demir":5181,"isci":138}];
var Simyager_Gelistirmeler = [{"tas":400,"odun":600,"demir":500,"isci":50},{"tas":468,"odun":699,"demir":580,"isci":20},{"tas":548,"odun":814,"demir":673,"isci":28},{"tas":641,"odun":949,"demir":780,"isci":39},{"tas":750,"odun":1105,"demir":905,"isci":55}];
var Kösk_Gelistirmeler = [{"tas":30000,"odun":25000,"demir":25000,"isci":100},{"tas":39000,"odun":32500,"demir":32500,"isci":20},{"tas":50700,"odun":42250,"demir":42250,"isci":24},{"tas":65910,"odun":54925,"demir":54925,"isci":29},{"tas":85683,"odun":71403,"demir":71403,"isci":34},{"tas":111388,"odun":92823,"demir":92823,"isci":42},{"tas":144804,"odun":120670,"demir":120670,"isci":50},{"tas":188246,"odun":156871,"demir":156871,"isci":59},{"tas":244719,"odun":203933,"demir":203933,"isci":72},{"tas":318135,"odun":265112,"demir":265112,"isci":86}];
var Kuyumcu_Gelistirmeler = [{"tas":4000,"odun":3000,"demir":2500,"isci":25},{"tas":5600,"odun":4200,"demir":3500,"isci":5},{"tas":7840,"odun":5880,"demir":4900,"isci":6},{"tas":10976,"odun":8232,"demir":6860,"isci":7},{"tas":15366,"odun":11525,"demir":9604,"isci":9}];
var Anıt_Gelistirmeler = [{"tas":400000,"odun":400000,"demir":400000,"isci":0}];

var bina_özellikleri = [
    {ismi:"Kale",name:"main",gelistirmeler:Kale_Gelistirmeler,max_seviye:50,gereksinimler:null},
    {ismi:"Taş ocağı",name:"stone",gelistirmeler:TasOcagi_Gelistirmeler,max_seviye:50,gereksinimler:null},
    {ismi:"Oduncu Kampı",name:"wood",gelistirmeler:OduncuKampi_Gelistirmeler,max_seviye:50,gereksinimler:null},
    {ismi:"Maden ocağı",name:"iron",gelistirmeler:MadenOcagi_Gelistirmeler,max_seviye:50,gereksinimler:null},
    {ismi:"Depo",name:"storage",gelistirmeler:Depo_Gelistirmeler,max_seviye:50,gereksinimler:null},
    {ismi:"Gizli Depo",name:"hide",gelistirmeler:GizliDepo_Gelistirmeler,max_seviye:30,gereksinimler:[{ismi:"Değirmen",name:"farm",seviye:3}]},
    {ismi:"Değirmen",name:"farm",gelistirmeler:Degirmen_Gelistirmeler,max_seviye:50,gereksinimler:null},
    {ismi:"Kışla",name:"barracks",gelistirmeler:Kisla_Gelistirmeler,max_seviye:30,gereksinimler:[{ismi:"Depo",name:"storage",seviye:3},{ismi:"Değirmen",name:"farm",seviye:3}]},
    {ismi:"Sur",name:"wall",gelistirmeler:Sur_Gelistirmeler,max_seviye:20,gereksinimler:[{ismi:"Kışla",name:"barracks",seviye:1}]},
    {ismi:"Katır çiftliği",name:"stable",gelistirmeler:KatirCiftligi_Gelistirmeler,max_seviye:30,gereksinimler:[{ismi:"Market",name:"market",seviye:1}]},
    {ismi:"Market",name:"market",gelistirmeler:Market_Gelistirmeler,max_seviye:30,gereksinimler:[{ismi:"Depo",name:"storage",seviye:5}]},
    {ismi:"Simyager",name:"garage",gelistirmeler:Simyager_Gelistirmeler,max_seviye:5,gereksinimler:[{ismi:"Kışla",name:"barracks",seviye:5}]},
    {ismi:"Köşk",name:"snob",gelistirmeler:Kösk_Gelistirmeler,max_seviye:10,gereksinimler:[{ismi:"Simyager",name:"garage",seviye:5}]},
    {ismi:"Kuyumcu",name:"smith",gelistirmeler:Kuyumcu_Gelistirmeler,max_seviye:5,gereksinimler:[{ismi:"Köşk",name:"snob",seviye:1}]},
    {ismi:"Anıt",name:"statue",gelistirmeler:Anıt_Gelistirmeler,max_seviye:1,gereksinimler:[{"ismi":"Kale","name":"main","seviye":50},{"ismi":"Taş ocağı","name":"stone","seviye":50},{"ismi":"Oduncu Kampı","name":"wood","seviye":50},{"ismi":"Maden ocağı","name":"iron","seviye":50},{"ismi":"Depo","name":"storage","seviye":50},{"ismi":"Gizli Depo","name":"hide","seviye":30},{"ismi":"Değirmen","name":"farm","seviye":50},{"ismi":"Kışla","name":"barracks","seviye":30},{"ismi":"Sur","name":"wall","seviye":20},{"ismi":"Katır çiftliği","name":"stable","seviye":30},{"ismi":"Market","name":"market","seviye":30},{"ismi":"Simyager","name":"garage","seviye":5},{"ismi":"Köşk","name":"snob","seviye":10},{"ismi":"Kuyumcu","name":"smith","seviye":5}]}
];

function insaat_var_mi(){
    var cevap = {};
    if($('#main_content > tbody > tr:nth-child(2) > td > div:nth-child(8) > div > table:nth-child(3)')[0]!==undefined){
        cevap.insaat = true;
        var insaatlar = $('#main_content > tbody > tr:nth-child(2) > td > div:nth-child(8) > div > table:nth-child(3) > tbody > tr');
        var insaat_sayisi = insaatlar.length;
        insaat_sayisi = insaat_sayisi===2?1:insaat_sayisi===3?2:insaat_sayisi-3;
        cevap.insaatlar = insaatlar;
        cevap.insaat_sayisi = insaat_sayisi;
    }
    else{
        cevap.insaat = false;
    }
    return cevap;
}
(function(){
    // setTimeout(function(){
    //     versiyon_kontrolü();
    //     sayfa_kontrolü();
    // },1000);
    depo_dolma_süresi_göster();
    if(sayfa_kontrolü('build_main')){
        insaat_listesi_görüntüle();
        var binalar = document.getElementById('main_content').getElementsByClassName('mainBuildList')[0].getElementsByClassName('box');
        for(var i = 0 ; i < binalar.length ; i++){
            var bina_ismi = binalar[i].getElementsByClassName('name')[0].getElementsByTagName('a')[0].textContent;
            append(binalar[i],'<img id="insaat_listesi_'+i+'" style="position:absolute;top: 32px;cursor:pointer;right: 30px;background-Color: #f6f6f6;-webkit-border-radius: 7px;" src="https://cdn3.iconfinder.com/data/icons/gray-toolbar-2/512/work_business_career_briefcase-512.png" width="20px">');
            $('#insaat_listesi_'+i).click(function(){
                var parent = this.parentElement;
                var odun_maliyeti = parseInt(parent.getElementsByClassName('res1')[0].textContent.split('.').join(''));
                var tas_maliyeti = parseInt(parent.getElementsByClassName('res2')[0].textContent.split('.').join(''));
                var demir_maliyeti = parseInt(parent.getElementsByClassName('res3')[0].textContent.split('.').join(''));
                var isci_sayisi = parseInt(parent.getElementsByClassName('workers')[0].textContent.split('.').join(''));
                var gelistirme_yapilir = bina_gelistirilebilir(tas_maliyeti,odun_maliyeti,demir_maliyeti,isci_sayisi);
                var cevap = insaat_var_mi();
                if(cevap.insaat){
                    if(cevap.insaat_sayisi<3){
                        if(gelistirme_yapilir){
                            parent.getElementsByClassName('button')[0].getElementsByTagName('a')[0].click();
                        }
                        else{
                            console.log('Hammadde yeterli olunca geliştir!');
                        }
                    }
                    else{
                        console.log('Diğer işlemlerin bitmesini bekle!');
                    }
                }
                else{
                    if(gelistirme_yapilir){
                        parent.getElementsByClassName('button')[0].getElementsByTagName('a')[0].click();
                    }
                    else{
                        console.log('Hammadde yeterli olunca geliştir!');
                    }
                }
            });
        }
    }
})();
function depo_kapasitesi(){
    return parseInt($('#main_content > tbody > tr:nth-child(2) > td > div.contentpane > div > div.resourceBar > span:nth-child(8)')[0].textContent.split('.').join(''));
}
function tas_miktari(){
    return parseInt($('#stone')[0].textContent.split('.').join(''));
}
function odun_miktari(){
    return parseInt($('#wood')[0].textContent.split('.').join(''));
}
function demir_miktari(){
    return parseInt($('#iron')[0].textContent.split('.').join(''));
}
function issiz_vatandaslar(){
    return parseInt($('#main_content > tbody > tr:nth-child(2) > td > div.contentpane > div > div.freeSettlers > span')[0].textContent.split('.').join(''));
}
function bina_gelistirilebilir(a,b,c,d){
    var yeterli = 0;
    if(tas_miktari()-a>=0){
        yeterli++;
    }
    if(odun_miktari()-b>=0){
        yeterli++;
    }
    if(demir_miktari()-c>=0){
        yeterli++;
    }
    if(issiz_vatandaslar()-d>=0){
        yeterli++;
    }
    yeterli = yeterli===4?true:false;
    return yeterli;
}
function sayfa_kontrolü(text){
    return location.href.indexOf(text)!==-1?true:false;
}
// function versiyon_kontrolü(){
//     console.log(this.version);
//     GM_xmlhttpRequest({
//         method: "GET",
//         url: "https://openuserjs.org/meta/ahmet149033/Script.meta.js",
//         onload: function(response) {
//             var text = response.responseText;
//             var b = text.indexOf('@version')+8;
//             var b1 = text.indexOf('/',b);
//             var version = parseInt(text.substring(b,b1).trim());
//             if(version>current_version){
//                 console.log("Old Version : " + sort_date(current_version));
//                 console.log("New Version : " + sort_date(version));
//                 document.getElementById('container').getElementsByClassName('shadow')[0].style.display='block';
//                 $(document.getElementById('container')).append('<div class="focus container visible" style="display: block;position: absolute;top: 190px;left: 226px;padding-bottom: 40px;padding: 15px; width: 562px; word-wrap: break-word;text-align: center!important;"> <h2><span class="icon" style="background:url(http://fussballcup.de/designs/redesign/images/layout/icons_sprite.png?v=2.2.6.14231) 0 -1180px no-repeat;margin-Right:10px;"></span>Fussballcup Scriptinin '+sort_date(version)+' Versiyonu Çıktı!!!</h2><label><p style="font-size:12px;margin-Bottom:10px;font-weight: bold;color:red">Şuanki versiyon '+sort_date(current_version)+'<label style="color:green;margin-Left:50px">Yeni versiyon : '+sort_date(version)+'</label></p> <p style="font-size:14px;font-weight: bold;color:blue">Scripti güncellemek istiyorsanız <a href="https://openuserjs.org/install/ahmet149033/Script.user.js" style="font-size:14px">bu linke</a> tıklayarak açılan sayfada update butonuna basın ve bu sayfayı yenileyin(F5)!!!</p></label><img src="https://i.hizliresim.com/LO0p2b.png" width="515px" style="-webkit-border-radius: 15px;margin-Top:15px;"> <div class="footer"></div> <div class="close"></div></div>');
//             }
//         }
//     });
// }
function insaat_listesi_görüntüle(){
    // var data = GM_getValue('insaat_listesi');
    // if(data!==undefined){
    //     data+='';
    // }
    // else{
    //     data = 'Hiç inşaat yapılmıyor!';
    // }
    append(document.getElementsByClassName('contentpane')[1],'<table class="borderlist" style="width:820px;"><tbody><tr> <th>Yapılacak İnşaatlar</th> </tr> <tr> <td> </td> </tr> </tbody></table>');
}
function append(element,eklenen){
    element.insertAdjacentHTML('beforeend', eklenen);
}
function depo_dolma_süresi_göster(){
    var resource = ["stone","wood","iron"];
    var min_saniye = 8640000;
    for(var i = 0 ; i < resource.length ; i++)
    {
        var e = document.getElementById(resource[i]);
        var üretim = parseInt(e.getAttribute('prod').split('.').join(''));
        var miktar = parseInt(e.innerHTML);
        var max = parseInt(e.getAttribute('max').split('.').join(''));
        var kalan = max-miktar;
        var saniyelik_üretim = üretim/3600;
        var saniye = Math.floor(kalan/saniyelik_üretim);
        var text = saat_olustur(saniye);
        e.title+='. Dolmasına kalan süre : ' + text;
        create_Interval(e,saniye);
        if(min_saniye>saniye){
            min_saniye = saniye;
        }
    }
    var e = $('#main_content > tbody > tr:nth-child(2) > td > div.contentpane > div > div.resourceBar > span:nth-child(8)')[0];
    var text = saat_olustur(min_saniye);
    e.title='Deponun taşmasına kalan süre : ' + text;
    create_Interval(e,min_saniye);
    function saat_olustur(saniye){
        var dakika = 0;
        var saat = 0;
        var gün = 0;
        var text = '';
        if(saniye>59){
            dakika = parseInt(saniye/60);
            saniye = saniye%60;
            if(dakika>59){
                saat = parseInt(dakika/60);
                dakika = dakika%60;
                if(saat>23){
                    gün = parseInt(saat/23);
                    saat = saat%24;
                }
            }
        }
        saat=basamak_düzenle(saat);
        dakika=basamak_düzenle(dakika);
        saniye=basamak_düzenle(saniye);
        if(gün===0){
            text = saat+':'+dakika+':'+saniye;
        }
        else{
            text = gün+" Gün "+saat+':'+dakika+':'+saniye;
        }
        return text;
    }
    function create_Interval(e,saniye){
        saniye--;
        setInterval(function(){
            console.log('yey');
            var title = e.title;
            var text = saat_olustur(saniye);
            title = title.substring(0,title.lastIndexOf(': ')+2)+text;
            e.title = title;
            saniye--;
        },1000);
    }
    function basamak_düzenle(a){
        return a<10?"0"+a:a;
    }
}

//location.href = location.protocol+'//'+location.hostname+'/game.php?village='+village_id+'&s=build_main&a=buildBuilding&p='+ref+'&build='+building;
//<table class="borderlist" style="width:820px;" id="yapilacak_insaatlar"><tbody><tr> <th colspan="5" style="text-align:center;">Yapılacak İnşaatlar</th> </tr> <tr> <th>İnşa anlaşması</th> <th style="width:235px;">İnşa işlemleri</th> <th style="width:100px; text-align:center;">Süre</th> <th style="width:200px;">Bitiş</th> <th>İptal</th> </tr><tr><td><img src="http://s31.tr.kingsage.gameforge.com/img/buildings/storage.png"> Depo (Seviye 4)</td><td><div class="progressbar-container"><div style="border:1px solid #CFAB65; width:200px; height:10px; background: #CFAB65;"><div class="progress" style="width: 144px; height: 10px; background: url(&quot;img/layout/bg_table_cell_marked.png&quot;) repeat-x;" start="1512539170" end="1512539349" maxwidth="200"></div></div></div></td><td align="center"><span class="countdown" time="177" reload="true">0:00:51</span></td><td nowrap="">zaman 08:49:09 .</td><td><a href="game.php?village=2568&amp;s=build_main&amp;a=cancelBuilding&amp;p=53a6&amp;aid=75444">iptal</a></td></tr> </tbody></table>