NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name MyFreeFarm Berater // @namespace https://github.com/BastianKanaan/GMscripts_MyFreeFarm // @author BastianKanaan // @description Extends MyFreeFarm // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB94BGgo6NO+u5q4AAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAS0ElEQVRo3t2aeYxl11ngf+fub3+172t3V1cv7sVuJ3bs7jh2QtoMDoHEwRlCbMJEATRiSaKBQTNBCKGwBwSDNAyTQVGCYJIMEINjxrFix3E73mO7TW/V1VXVtS+v6i13v+ee+aNvQSXDaCTS7W7nSE/v3veuzrm/8y3nO9934Dq08cE+APv9E/1//tDN+16/9+hNJ/l+bXv3jAHw4zf1P/sLdx5TRqXyc++fHPvsGzW+/kbC5vMOyyvrfOSDJz99eM/gj+09fkK9Na/fW8sVzr86NfOl7ydgB+iK46TnVz75wJNtHZX3rcuUI8dvFS9cnuHQ7YcOWprTfvb8pUe/H4BzwH7g0H/59INfq3Z09++ZHBPHbn8LpVKF3WNdWPlOdeIdd962MDf/8vSl+XPX8mW0awxrAiPAgd/4xXf+wdaG74yP7BL9w/vp7x2h1WrRM3SYwf5+8cLz31Yf/w8f/fK1nn3tGkt2D3AE6J7o6xoc7Cjyq//pt3ntm88wMzvDhfMX+dmP/AJJnDKxe0j09HQZDzzwns+9GVW6CBwGjgIdhbz91vfdffjg6soWrhcwf+p5Cu7L3DwhWTkdYvVWCeOEQsFm//5dY1/4wld+880kYQeYBG4CqoD23uMTk0mcQJTQF9R4/48PM3mwDU2HDz5Y5dk/+VPc5YuErZpKooZ9LSVsXOX+BNAB7AUK2X1yx97C7oXpNQb7Nrn5pw5hOA6FthLFYh4hdD7+B8Nce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lrLqbSXgGmd5jI+Uyte5qRrD06Q9Nqb/sw1NbCIFj64gWTFaUfA37kken6oyA/HHUMfwqWuV6tANwJ/BrwF9le+W7gs6OVwnYq4k9vGuy8cP/+8jPQb/4L6/0w8BPAFxHi+I7//puZyx/YMc5f2MXKEa5z07Ii2k8AN2c7KwG8e8czd+Rs+wN2tTM33Nv9L/XRA9wP3PVdGpf7rue6rsYL/x8HbwtumjbAVwAAAABJRU5ErkJggg== // @date 01.04.2015 // @version 2.4.2 // @include /^http:\/\/(|www\.|s\d+\.)au\.myfreefarm\.com\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)veselaferma\.com\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)myfreefarm\.com\.br\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)myfreefarm\.de\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)myfreefarm\.cz\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)myfreefarm\.dk\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)myfreefarm\.gr\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)migranjalinda\.es\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)mabelleferme\.fr\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)myfreefarm\.com\.hr\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)myfreefarm\.ae\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)myfreefarm\.ir\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)myfreefarm\.it\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)enkicsitanyam\.hu\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)myfreefarm\.nl\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)myfreefarm\.co\.nz\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)myfreefarm\.no\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)wolnifarmerzy\.pl\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)pt\.myfreefarm\.com\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)fermavesela\.ro\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)mojaderewnja\.ru\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)myfreefarm\.se\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)th\.myfreefarm\.com\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)tr\.myfreefarm\.com\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)myfreefarm\.co\.uk\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)myfreefarm\.com\/.*$/ // @include /^http:\/\/(|www\.|s\d+\.)myfreefarm\.com\.vn\/.*$/ // @exclude http://*/dyn_bubbles.php* // @exclude http://*/nachrichten/bbhelp.php* // @exclude http://*/payment/* // @grant GM_addStyle // @grant GM_deleteValue // @grant GM_getValue // @grant GM_listValues // @grant GM_log // @grant GM_registerMenuCommand // @grant GM_setValue // @grant GM_xmlhttpRequest // @grant unsafeWindow // @require https://raw.githubusercontent.com/BastianKanaan/GMscripts_MyFreeFarm/master/MyFreeFarm_Common_functions.user.js // ==/UserScript== //*********************************************************************************************************** unsafeData.beraterDone=false; // global variables const VERSION=GM_info["script"]["version"]; const neededVersionFunctionFile="2.1.3"; const GM_Home =GM_info["script"]["namespace"]; const GM_Source=GM_info["script"]["namespace"]; // [version,date,[[de,en],[de,en],...]] const CHANGELOG=[["2.0","29.05.2014",[["Migration nach openuserjs.org","Migration to openuserjs.org"],["Script wird jetzt auf GitHub entwickelt","Script now developed on GitHub"]]] ,["2.1.1","14.06.2014",[["Neu: Changelog","New: Changelog"],["Bugfixes","Bugfixes"]]] ,["2.1.2","28.06.2014",[["Ge"+a_dots+"ndert: Berechnung des \"Rekursiv ben"+o_dots+"tigt\"-Wertes","Change: Calculation of \"Recursive needed\" value"],["Neu: Optionen bzgl. Globaler Zeit und Bauernmarkt","New: Options according to global time and farmersmarket"],["Bugfix: Event nach Bedienung eines Farmis","Bugfix: Event after handling a farmi"]]] ,["2.2","11.07.2014",[["Refaktorierung der Zonen-Daten","Refactoring of zones data"]]] ,["2.2.1","12.07.2014",[["Bugfix","Bugfix"]]] ,["2.3","14.08.2014",[["Anpassung an Firefox 30","Adaptation to Firefox 30"]]] ,["2.3.1","15.08.2014",[["Bugfix: Zeit von anderen Accounts auf dem Server (Umloggen)","Bugfix: Time of other account on the server (login)"],["Bugfix: Ignorieren von verwelkten Gestecken","Bugfix: Ignoring of faded arrangements"],["Ge"+a_dots+"ndert: Spezieller Portal-Login nicht mehr ben"+o_dots+"tigt","Change: Special Portal-Login not needed anymore"]]] ,["2.3.2","17.08.2014",[["Bugfix: Farmi MiniInfo verschwindet","Bugfix: Farmi MiniInfo vanishes"],["Neu: Goldesel Waltraud Log","New: Donkey Luke Log"]]] ,["2.3.3","19.08.2014",[["Neu: Baumereiprodukte und -quests durch Patch 18.08.2014","New: Forestry products and quests by patch 18.08.2014"]]] ,["2.3.4","22.08.2014",[["Bugfix: S"+a_dots+"gewerk und Schreinerei durch Patch 18.08.2014","Bugfix: Sawmill and carpentry by patch 18.08.2014"]]] ,["2.3.5","23.11.2014",[["Bugfix: Im Markt wird manchmal die Menge nicht selektiert, wenn man ein Produkt kaufen will","Bugfix: Sometimes the amout of a product is not selected when buying a product"]]] ,["2.3.6","08.12.2014",[["Bugfix: DonkeyInfoPanel-Verhalten, wenn von zwei Computern auf einen Account zugegriffen wird","Bugfix: Multi user handling of donkey info panel (when accessing an account from several computers)"]]] ,["2.3.7","16.12.2014",[["Aktualisierung der Daten","Update of data"]]], ,["2.4.0","01.02.2015",[["Anpassung an Firefox 35","Fix for Firefox 35"],["Neu: G"+u_dots+"terhof","New: Megafield"]]] ,["2.4.1","12.02.2015",[["Bugfix: Logging Waltraud","Bugfix: Logging Waltraud"]]] ,["2.4.2","01.04.2015",[["Aktualisierung der Daten","Update of data"]]] ]; if(!VERSIONfunctionFile){ alert("Hi, I am the Berater-Script.\nThe function-file is missing.\nPlease install me again."); location.href=GM_Source; }else if(compareVersions(neededVersionFunctionFile,VERSIONfunctionFile)>0){ alert("Hi, I am the Berater-Script.\nThe function-file is too old.\nPlease install me again."); location.href=GM_Source; } var DEVMODE=GM_getValue("devmode",false); var DEVMODE_EVENTS=GM_getValue("devmode_events",false); var DEVMODE_FUNCTION=GM_getValue("devmode_function",false); var DEVMODE_LOG_WARNING=GM_getValue("devmode_log_warning",false); var DEVMODE_LOG_ERROR=GM_getValue("devmode_log_error",false); var hotkeymap=explode(GM_getValue("hotkeymap"),"do_main/hotkeymap",{"prevPage":37,"nextPage":39,"farm1":49,"farm2":50,"farm3":51,"guild":52,"city1":53,"city2":54,"farmilog":70,"help":72,"market":77,"marketstand":188,"messages":78,"options":79,"profit":80,"sgh":83,"overview":85,"contract":86,"systemmessage":88}); var FARMNAME=null; var USERLEVEL=null; // Constants const INIT_CSS_STYLES = { "systemMsg_marketsale":[[],""], "systemMsg_contractsale":[[],"font-style:italic;"], "lowrack":[[],"background:orangered;color:#000;"], "farmicart_lowrack":[[],"color:yellow!important;"], "timeholder":[[],"background:url(\"http://mff.wavecdn.de/mff/guild/help_back.jpg\") -25px -25px;border:1px groove #4d240e;border-radius:10px;padding:5px;margin-bottom:5px;"], "timer":[[],"background-color:#de9008;color:white;font-weight:bold;text-align:center;"], "watertimer":[[],"background-color:blue;color:white;font-weight:bold;text-align:center;"], "timer_ready":[[],"background-color:red;color:white;font-weight:bold;text-align:center;"], "prod_border_lowamount":[[],"border:1px solid blue;"], "prod_border_missing":[[],"border:1px solid red;"], "cloud_back_noprice":[[],"background-color:white;"], "cloud_border_noprice":[["cloud_back_noprice"],"border:2px solid black;"], "cloud_back_below":[[],"background-color:#fdd;"], "cloud_border_below":[["cloud_back_below"],"border:2px solid red;"], "cloud_back_between":[[],"background-color:#ffe87c;"], "cloud_border_between":[["cloud_back_between"],"border:2px solid #ff8c00;"], "cloud_back_above":[[],"background-color:#dfd;"], "cloud_border_above":[["cloud_back_above"],"border:2px solid green;"], "farmi_price_unknown":[[],"background-color:none;"], "farmi_price_low":[[],"background-color:#FF3333;"], "farmi_price_between":[[],"background-color:yellow;"], "farmi_price_above":[[],"background-color:#22AA22;"], "farmi_amount_missing":[["farmi_price_above"],"border:1px solid red;"], "farmi_amount_low":[["farmi_price_above"],"border:1px solid blue;"], "farmi_amount_above":[["farmi_price_above"],"border:1px solid grey;"]}; const IMAGES={"leftarrow":"data:image/gif;base64,R0lGODlhIwAaAPcAAEQWBLyCVIROJKRqNFwyBOy2dGQ6JNyiZIRSPJxuVHxCDMySVIxeNLR2PFwyFPzSpEwmBNyefIxWJHRGJOy6lGw6FLSGZJxqRJRePFQmFMSSbKRyRKx6VOSqfIxiTHxONHRKNKRiPOSqdKx2TFwuBIRWNPzKlLyKXHw6DIQ+JJxmLHQyFIRGJHQ6FKxqROy6hGxCHLyOZMyabMR+ZIxOJHQ2BGxCJMyedJxeLJpmPLx6VOSyjEQeBPCyfIRCHMSCXMqSZGQyHF8mBHNGLLB+TJVaPMSGZKRqTJpiRFkuFJRWNPzOpHQ6HPC+jOSidJ1eNFwiBGIyDPzitOKmfIxWLPi+nMiWdKpyTMR6XLiCXIJOLLRyPHQ+JIxaPLRyVKh2RGwyFEwmDGk6HJxePOSqhIxONLx6TFouDPzOnK5uTHxCHNCadIxOLGpCLEceDNSSZFguHKVqPPS+fGs+JIxWPPzWtNyihHpKJO6+lLSGbKJuRNSWbKx6XPSufKdmRLB6TIpaNKx2VNCmdOy2jOyydIlKHMyObPyyhOy2fMySXPjGnHQ2HIRKLGwyDFwqDPzSrMyOXPy2hHxGLPy+jPzmvJRWLLR2ROCibIRCFJxmRFQiDLRyRJxmNMyOZNyedPyyfLx+TGQuFPzOrLRyTGQuDNyadHRCLFw2BIFWPJRiNGQ2FFQqBNiifLyKZJBiPMSWbLR+VOyufIRSNMSOXHxCJHY2FIdKJHk+FK5uRHRGHKBiLL9+VMeGXMiWZGg2HMmKZKFuTJZaNHU+HPTCjOmmdKBiNGQ2DIRaLMJ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pE5r9utMg1glaSEomIAM57stRAFMQYPqI9oWRTb5KmpZV7PbwQDUUi2JsSoZTCpAaMIsZIbWNBob5sP4gvza/d44f/8ymeOdTi299+l/U78+hQjXBCkiQJnzk5Tby+wfzCLU6YUy+lD6sFnfOnInEPqgjyvsAmICREH2gmnHGPHJrRTfQemSqIAkEzppFKIvZkoA8CicTbiHcOgph3Bc8XH8RXb96+xZP/qcfzT8zwvb97h+WlO6y88yHqUwczWjoQRMNEx6ZSyvGQ9xbX6diJhQPV5Fdd330cwxmjJFrJJqxO4H3AWU90IAJEF3C1x9aRsvAUI8dg6BmNHMXYU9lAbaFygUHpGFSOYjd807+TfubOjd2Fe7urPPXpGX7zZJ9rl9a49MFVFt64xO1FgfIhMmUcLQNBaoTUHJk0tEXF2zeW2XWR7m7nGzbzb7vAQ7V3B20Zm8R34J2k9mAd+EpQVgFrobbgHHgXG/CWEqQCKXASvJVvhUK+EK+Y353fWoXU8yv/5Rw/c3yC77xyhcU7y2y99yaXPxC8qxRitp1wdq7Nj57oc+LwNHlvmn6vRz9XZErwtX+8wZrPmdv/ALPtHtWx4lllxAsiCU/HGPPgQUXBfTXpQyR4gTGNEpK6EcAoAVEUoeYVV4avtRfb37q7u83GaI0HT83yld/7PPzDRf75u9f43vcv8trfL+Kk4oYWrCrZGArw8QMdvvTYPiYnOnSm95O22kx1c2a7KTdXBnzz7SU264SJiRmm2106Sc7g6O5zSJ7RRp7VmkOoOBEFWfAhSCFridoWQSzFwGXv4su9+e5LO1XB2nCX3WqbqZnAF37hAk+f2QevXuPv3rzK9Uvf443/v8Z8r81O8Kz7Rvj8G6vVoZVEm1YtAAAAAElFTkSuQmCC" } // cases(%=number): %=money, "c%"=coins, "f%"=fictive money const NPC=[[,0.5,1.1,1.34,2.75,3.95,8.05,17.8,18.5,"f85","f110","f180","f280",,,,,0.16,0.52,1.02,1.44,1.96,2.28,3.8,3.69,"f340",4.38,"f510","f590",12.4,"f650",3.49,5.19,8.75,6,15.63,16.88,37.5,3.9,52.44,51.75,60.25,58.13,66.19,18.2,"c79",150,,1200,,1200,,,,,4500,,14400,1200,,"c125",,"c23",,4800,4200,,,,,,,,750,2100,"c25",,,,,,,10800,12000,,1500,3300,,,,,"f650","f1500","f1500",5000,12000,"c10",,"c20",,"c5","c5","c5","c5",,"c5",,,10.12,3.72,"f155.1","f545.7",37.42,23.32,7.44,82.36,"f106.8","f148.8","f69.6","f196.8","f278.4","f408","f240","f324","f250","f864",47.15,140.56,125.88,,"f12.8","f73.5","f127","f106","f53.05","f113.75","f44","f33.33","f71.3","f73.2","f181.2","f321","f316","f491","f350","f484.2","f906.5","f421.7","f473.5","f749.98","f237.1","f675","f975",12.25,37.5,"f1025","f1100","f810",,"f231","f6500","f58","f137.67","f197.67","f342.5","f830","f700.5","f1063.2","f704.42","f734","f339.53",3.1,3.15,3.27,7.3,4.9,5.92,6.61,6.1,7.3,5.6,5.2,3.6,10,8.1,23.5,7.8,8.2,,,,,,,,,,,,,"f410","f490","f503","f589","f469","f1312","f598","f533","f480","f420","f1620","f1030","f675","f950","f2350","f2400","f2450","f3550","f3600","f3650","f8000","f8000"],{},[],[]]; // task_new_plant task_new_product /* var new_NPC=NPC.clone(); new_NPC[0][221]='f8000'; GM_log(implode(new_NPC)); */ const INIT_NPC_SAISON={"94":false,"95":false,"96":false,"98":false,"100":false,"101":false,"102":false,"103":false,"105":false}; // task_new_product const ALL_ZONES = {"farm":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24],"farmersmarket":["farmersmarket-0","farmersmarket-1","farmersmarket-2","farmersmarket-3","farmersmarket-4","farmersmarket-5","farmersmarket-6"],"forestry":["forest","sawmill","carpentry"],"city":["windmill"],"foodworld":["foodworld-0","foodworld-1","foodworld-2","foodworld-3","foodworld-4"]}; // task_new_zone unsafeData.ALL_ZONES=ALL_ZONES.clone(); const DATA_zones = {"1":{"location":"farm","farmNr":0,"zoneNr":1,"productional":true},"2":{"location":"farm","farmNr":0,"zoneNr":2,"productional":true},"3":{"location":"farm","farmNr":0,"zoneNr":3,"productional":true},"4":{"location":"farm","farmNr":0,"zoneNr":4,"productional":true},"5":{"location":"farm","farmNr":0,"zoneNr":5,"productional":true},"6":{"location":"farm","farmNr":0,"zoneNr":6,"productional":true},"7":{"location":"farm","farmNr":1,"zoneNr":1,"productional":true},"8":{"location":"farm","farmNr":1,"zoneNr":2,"productional":true},"9":{"location":"farm","farmNr":1,"zoneNr":3,"productional":true},"10":{"location":"farm","farmNr":1,"zoneNr":4,"productional":true},"11":{"location":"farm","farmNr":1,"zoneNr":5,"productional":true},"12":{"location":"farm","farmNr":1,"zoneNr":6,"productional":true},"13":{"location":"farm","farmNr":2,"zoneNr":1,"productional":true},"14":{"location":"farm","farmNr":2,"zoneNr":2,"productional":true},"15":{"location":"farm","farmNr":2,"zoneNr":3,"productional":true},"16":{"location":"farm","farmNr":2,"zoneNr":4,"productional":true},"17":{"location":"farm","farmNr":2,"zoneNr":5,"productional":true},"18":{"location":"farm","farmNr":2,"zoneNr":6,"productional":true},"19":{"location":"farm","farmNr":3,"zoneNr":1,"productional":true},"20":{"location":"farm","farmNr":3,"zoneNr":2,"productional":true},"21":{"location":"farm","farmNr":3,"zoneNr":3,"productional":true},"22":{"location":"farm","farmNr":3,"zoneNr":4,"productional":true},"23":{"location":"farm","farmNr":3,"zoneNr":5,"productional":true},"24":{"location":"farm","farmNr":3,"zoneNr":6,"productional":true},"windmill":{"location":"city","cityNr":2,"zoneNr":1,"productional":true},"forest":{"location":"forestry","productional":true},"sawmill":{"location":"forestry","zoneNr":1,"productional":true},"carpentry":{"location":"forestry","zoneNr":2,"productional":true},"foodworld-0":{"location":"foodworld","productional":false},"foodworld-1":{"location":"foodworld","zoneNr":1,"productional":true},"foodworld-2":{"location":"foodworld","zoneNr":2,"productional":true},"foodworld-3":{"location":"foodworld","zoneNr":3,"productional":true},"foodworld-4":{"location":"foodworld","zoneNr":4,"productional":true},"farmersmarket-0":{"location":"farmersmarket","productional":false},"farmersmarket-1":{"location":"farmersmarket","zoneNr":1,"productional":true},"farmersmarket-2":{"location":"farmersmarket","zoneNr":2,"productional":true},"farmersmarket-3":{"location":"farmersmarket","zoneNr":3,"productional":true},"farmersmarket-4":{"location":"farmersmarket","zoneNr":4,"productional":true},"farmersmarket-5":{"location":"farmersmarket","zoneNr":5,"productional":true},"farmersmarket-6":{"location":"farmersmarket","zoneNr":6,"productional":true}}; // task_new_zone // All single-slot-zones themselves and all slots of multi-slot-zones var ALL_SLOTS={}; // [farm, forestry, recipes, powerups] // Growing duration in min const PRODUCT_GROWTIME=[[,20,45,45,90,120,240,480,960,240,720,1440,2880,,,,,15,90,240,480,600,500,800,720,1000,780,2000,3000,950,4000,1000,720,1200,800,2000,880,3000,960,4000,4800,5500,6200,6800,7200,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2880,,,,,,720,,,,,,,740,,,700,360,135,2160,1000,1440,1680,540,5100,840,1080,480,1320,1800,2520,1260,1620,720,3780,6400,7400,7800,640,180,180,90,90,200,200,100,130,150,80,80,120,120,120,375,300,240,300,480,220,360,3120,3240,1440,1920,1440,2520,840,600,,,210,130,260,190,160,195,250,90,150,300,420,270,540,220,180,315,390,250,230,345,600,245,880,360,510,440,240,,,,,,,,,,,,,240,240,180,210,350,60,180,250,290,380,180,325,120,210,480,480,480,480,480,480,1440,1440],{"1":600,"2":960,"3":2160,"4":480,"5":2750,"6":490,"7":1200,"8":2520,"41":300,"42":345,"43":360,"44":270,"45":300,"46":330,"47":420,"48":480,"49":510,"50":180,"51":210,"52":240,"53":480,"54":510,"55":540,"56":300,"57":375,"58":470,"59":360,"60":450,"61":420,"101":240,"102":700,"103":640,"104":360,"105":960,"106":90,"107":120,"108":1320,"109":570,"110":330,"111":160,"112":935,"113":120,"114":300,"115":180,"116":1040,"117":1920,"118":300,"119":1440,"120":2010,"121":480,"122":300,"123":840,"124":690,"125":480,"126":240,"127":255,"128":525,"129":375,"130":410,"131":480,"132":225,"133":120,"500":0,"501":0,"502":0,"511":0,"512":0}]; // task_new_plant task_new_product // Points earned at cropping const PRODUCT_POINTS=[[,3,17,10,44,64,128,267,600,750,950,1540,2350,,,,,1,7,24,42,63,52,88,92,3100,108,4500,5000,319,5400,179,133,229,157,405,733,2569,211,3611,4444,5220,6028,6769,1833,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2500,,,,,,0,,,,,,,0,,0,0,179,31,2300,4900,490,340,240,1174,890,1240,580,1640,2320,3400,2000,2700,1250,7200,1475,6540,7955,0,36,36,18,18,40,36,20,26,30,16,16,24,24,24,3600,60,48,60,69,44,72,5400,7750,450,2600,8250,9725,6250,0,,,41,30,45,36,27,54,36,23,17,23,252,165,310,137,114,207,258,173,161,257,420,192,701,290,425,380,220,,,,,,,,,,,,,520,625,460,650,810,394,515,634,660,762,1343,1500,361,852,1245,1255,1275,1312,1362,1425,45000,45000],{"1":30,"2":48,"3":108,"4":24,"5":138,"6":0,"7":60,"8":126,"21":0,"22":0,"23":0,"24":0,"25":0,"41":150,"42":105,"43":108,"44":108,"45":60,"46":66,"47":294,"48":144,"49":153,"50":54,"51":42,"52":48,"53":48,"54":51,"55":54,"56":33,"57":38,"58":47,"59":39,"60":45,"61":42,"101":48,"102":140,"103":128,"104":74,"105":0,"106":18,"107":66,"108":0,"109":114,"110":70,"111":32,"112":187,"113":24,"114":60,"115":36,"116":208,"117":384,"118":660,"119":0,"120":0,"121":96,"122":60,"123":168,"124":138,"125":24,"126":48,"127":51,"128":105,"129":75,"130":82,"131":96,"132":45,"133":24,"500":0,"501":0,"502":0,"511":0,"512":0}]; // task_new_plant task_new_product // Required quest to unlock product const PRODUCT_QUEST=[{"117":["main",2,15],"118":["main",2,25],"119":["main",2,35],"120":["main",2,45],"121":["main",2,50],"123":["main",2,15],"124":["main",2,25],"125":["main",2,35]},{"1":["forestry",1,3],"2":["forestry",1,9],"3":["forestry",1,24],"4":["forestry",1,47],"5":["forestry",1,63],"7":["forestry",2,35],"8":["forestry",2,45],"21":["forestry",1,3],"22":["forestry",1,9],"23":["forestry",1,24],"24":["forestry",1,47],"25":["forestry",1,63],"26":["forestry",2,35],"27":["forestry",2,45],"41":["forestry",1,6],"42":["forestry",1,6],"43":["forestry",1,6],"44":["forestry",1,9],"45":["forestry",1,9],"46":["forestry",1,9],"47":["forestry",1,24],"48":["forestry",1,24],"49":["forestry",1,24],"50":["forestry",1,47],"51":["forestry",1,47],"52":["forestry",1,47],"53":["forestry",1,63],"54":["forestry",1,63],"55":["forestry",1,63],"56":["forestry",2,35],"57":["forestry",2,35],"58":["forestry",2,35],"59":["forestry",2,45],"60":["forestry",2,45],"61":["forestry",2,45],"101":["forestry",1,12],"102":["forestry",1,18],"103":["forestry",1,21],"104":["forestry",1,27],"105":["forestry",1,30],"106":["forestry",1,33],"107":["forestry",1,36],"108":["forestry",1,39],"109":["forestry",1,42],"110":["forestry",1,60],"111":["forestry",1,50],"112":["forestry",1,53],"115":["forestry",1,66],"116":["forestry",1,69],"117":["forestry",1,75],"118":["forestry",1,72],"119":["forestry",2,16],"120":["forestry",2,24],"121":["forestry",2,35],"122":["forestry",2,35],"123":["forestry",2,36],"124":["forestry",2,42],"125":["forestry",2,43],"126":["forestry",2,46],"127":["forestry",2,46],"128":["forestry",2,47],"129":["forestry",2,47],"130":["forestry",2,48],"131":["forestry",2,48],"132":["forestry",2,49]}]; // Required products to produce const PRODUCT_REQUIRE=[{"25":[[0,9,30]],"27":[[0,10,12]],"28":[[0,11,8]],"30":[[0,12,5]],"111":[[0,110,5]],"116":[[0,2,1980]],"117":[[0,7,550]],"118":[[0,4,1020]],"119":[[0,38,650]],"120":[[0,42,110]],"121":[[0,43,100]],"122":[[0,112,130],[0,116,35]],"123":[[0,113,220],[0,117,35]],"124":[[0,114,345],[0,118,35]],"125":[[0,115,80],[0,119,35]],"130":[[0,17,400]],"131":[[0,21,150]],"132":[[0,20,100],[0,10,2]],"133":[[0,19,100],[0,10,2]],"134":[[0,17,400],[0,6,25]],"135":[[0,21,150],[0,6,25]],"136":[[0,2,120]],"137":[[0,1,200]],"138":[[0,1,200],[0,23,30]],"139":[[0,18,150],[0,22,30]],"140":[[0,21,150],[0,22,30]],"141":[[0,26,100],[0,144,3]],"142":[[0,26,100],[0,25,3]],"143":[[0,26,100],[0,25,3],[0,144,3]],"144":[[0,21,450]],"145":[[0,33,300],[0,12,2]],"146":[[0,35,200],[0,10,4],[0,12,2]],"147":[[0,37,60],[0,12,2]],"148":[[0,31,250],[0,26,150],[0,27,7]],"149":[[0,21,300],[0,43,10],[0,22,50],[0,121,4]],"150":[[0,38,60],[0,119,6],[0,17,50]],"152":[[0,151,5]],"155":[[0,152,5],[0,28,6]],"156":[[0,152,8],[0,28,5]],"157":[[0,152,2],[0,28,9]],"161":[[0,1,300],[0,17,150]],"162":[[0,1,250],[0,20,200]],"163":[[0,22,190],[0,26,120]],"164":[[0,1,150],[0,10,30]],"165":[[0,10,10],[0,12,5]],"166":[[0,10,10],[0,27,7]],"167":[[0,40,60],[0,111,10]],"168":[[0,10,10],[0,42,25]],"169":[[0,6,300],[0,9,15],[0,121,3]],"170":[[0,1,200],[0,43,20],[0,121,4]],"200":[[-1,1200],[0,171,24],[0,172,20],[0,173,12]],"201":[[-1,1400],[0,171,25],[0,172,18],[0,174,15]],"202":[[-1,1500],[0,172,22],[0,173,19],[0,174,16]],"203":[[-1,1460],[0,172,19],[0,173,16],[0,175,29]],"204":[[-1,1510],[0,171,7],[0,173,18],[0,174,8],[0,176,21]],"205":[[-1,1622],[0,171,14],[0,173,22],[0,176,10],[0,177,12]],"206":[[-1,1787],[0,174,16],[0,176,9],[0,177,10],[0,178,9]],"207":[[-1,1894],[0,173,15],[0,175,10],[0,177,11],[0,179,8]],"208":[[-1,1950],[0,173,12],[0,175,13],[0,178,15],[0,180,18]],"209":[[-1,2110],[0,171,12],[0,176,21],[0,179,7],[0,181,9]],"210":[[-1,2250],[0,171,12],[0,175,5],[0,179,34],[0,182,11]],"211":[[-1,2357],[0,172,9],[0,176,12],[0,181,22],[0,183,18]],"212":[[-1,2488],[0,171,13],[0,182,13],[0,183,16],[0,184,6]],"213":[[-1,2595],[0,171,3],[0,179,8],[0,185,7],[0,186,9],[0,187,7]],"214":[[0,0,2],[0,171,10],[0,172,14],[0,173,13],[0,174,18]],"215":[[0,0,2],[0,171,12],[0,172,22],[0,174,10],[0,175,19]],"216":[[0,0,2],[0,173,14],[0,175,8],[0,177,19],[0,178,16]],"217":[[0,0,3],[0,171,19],[0,177,5],[0,178,17],[0,180,13]],"218":[[0,0,3],[0,180,9],[0,181,8],[0,182,9],[0,183,9]],"219":[[0,0,3],[0,179,4],[0,182,1],[0,185,6],[0,186,15],[0,187,7]],"220":[[-1,1500],[0,171,70],[0,172,180],[0,173,80],[0,174,80],[0,188,1]],"221":[[-1,1500],[0,171,80],[0,172,50],[0,173,65],[0,174,140],[0,189,1]]},{"41":[[1,21,1]],"42":[[1,21,1]],"43":[[1,21,1]],"44":[[1,22,1]],"45":[[1,22,1]],"46":[[1,22,1]],"47":[[1,23,1]],"48":[[1,23,1]],"49":[[1,23,1]],"50":[[1,24,1]],"51":[[1,24,1]],"52":[[1,24,1]],"53":[[1,25,1]],"54":[[1,25,1]],"55":[[1,25,1]],"56":[[1,26,1]],"57":[[1,26,1]],"58":[[1,26,1]],"59":[[1,27,1]],"60":[[1,27,1]],"61":[[1,27,1]],"101":[[1,41,4]],"102":[[1,41,18],[1,42,2]],"103":[[1,44,11]],"104":[[1,42,1],[1,43,5]],"105":[[1,44,20],[1,45,50],[1,46,70]],"106":[[1,49,1]],"107":[[1,46,1]],"108":[[1,47,125],[1,48,65],[1,49,32]],"109":[[1,47,5]],"110":[[1,50,9],[1,51,4]],"111":[[1,52,4]],"112":[[1,50,12],[1,51,7],[1,52,6]],"113":[[1,42,1]],"114":[[1,41,1],[1,43,1]],"115":[[1,53,8],[1,55,2]],"116":[[1,53,120],[1,54,40],[1,55,40]],"117":[[1,53,80],[1,54,65],[1,55,125]],"118":[[1,53,6],[1,54,8]],"119":[[1,54,20],[1,55,25]],"120":[[1,54,35],[1,55,40]],"121":[[1,56,7],[1,57,4]],"122":[[1,58,9]],"123":[[1,57,4],[1,58,5]],"124":[[1,56,9],[1,57,4]],"125":[[1,58,3]],"126":[[1,61,5]],"127":[[1,60,3]],"128":[[1,60,6],[1,61,5]],"129":[[1,59,10],[1,60,8],[1,61,5]],"130":[[1,60,9],[1,61,8]],"131":[[1,59,6],[1,61,12]],"132":[[1,59,10],[1,60,8],[1,61,5]],"133":[[1,42,1]]}]; // task_new_product task_new_picnic_product // Yielded amount of production const PRODUCT_YIELD=[,{"1":1,"2":1,"3":1,"4":1,"5":1,"7":1,"8":1,"21":1,"22":1,"23":1,"24":1,"25":1,"26":1,"27":1,"41":5,"42":3,"43":3,"44":4,"45":2,"46":2,"47":7,"48":3,"49":3,"50":3,"51":2,"52":2,"53":8,"54":4,"55":4,"56":5,"57":3,"58":5,"59":6,"60":4,"61":3,"101":1,"102":1,"103":1,"104":1,"105":1,"106":1,"107":1,"108":1,"109":1,"110":1,"111":1,"112":1,"113":1,"114":1,"115":1,"116":1,"117":1,"118":1,"119":1,"120":1,"121":1,"122":1,"123":1,"124":1,"125":1,"126":1,"127":1,"128":1,"129":1,"130":1,"131":1,"132":1,"133":1}]; // task_new_product /* var new_data=PRODUCT_YIELD.clone(); new_data[1][7]=; GM_log(implode(new_data)); */ const ANIMAL_MOVE=[,,[false,0,0,255,10,10,505],[false,0,0,280,1,0,525],[false,0,0,280,1,25,500],,,,,,,[false,2,20,120,4,0,200]]; // Upgrade-data of buildings // BUILDING_UPGRADES[zoneType][levelNr-1][needed level,buildcost,bonus,animalamount] const BUILDING_UPGRADES={"1":[[1,2000,0.95,0],[15,21500,0.9,0],[21,76000,0.85,0],[27,192300,0.8,0],[33,"c20",0.8,0]],"2":[[2,2500,1,5],[7,15200,1,10],[12,32500,1,15],[23,134500,0.9,20],[29,350800,0.8,20]],"3":[[11,3400,1,2],[13,16300,1,3],[17,50200,1,4],[25,159600,0.9,5],[32,441000,0.8,6]],"4":[[14,6200,1,2],[18,33500,1,3],[20,76000,1,4],[28,210500,0.9,5],[34,482000,0.8,6]],"5":[[19,6800,1,1],[22,44800,1,2],[26,128200,1,3],[31,230600,0.9,4],[35,482000,0.8,4]],"7":[[16,5200,1,1],[19,33500,0.95,1],[25,106400,0.9,1],[30,230600,0.85,1],[33,441000,0.8,1]],"8":[[18,6800,1,1],[21,38000,0.95,1],[27,128200,0.9,1],[31,230600,0.85,1],[35,482000,0.8,1]],"9":[[27,8100,1,1],[30,53200,0.95,1],[33,140300,0.9,1],[36,264600,0.85,1],[38,597200,0.8,1]],"10":[[30,9700,1,1],[33,70200,0.95,1],[34,153700,0.9,1],[37,289200,0.85,1],[39,626300,0.8,1]],"11":[[16,10000,1,1],[20,85000,1,3],[24,200000,1,5],[28,"c22",0.9,6],[32,"c38",0.8,6]],"12":[[15,38000,1,2],[17,17200,1,3],[23,54600,1,4],[29,168800,0.9,5],[38,472400,0.8,6]],"13":[[31,16800,1,1],[32,86400,0.95,1],[34,174200,0.9,1],[36,362800,0.85,1],[38,796300,0.8,1]],"14":[[35,19400,1,1],[37,97100,0.95,1],[39,218400,0.9,1],[40,509800,0.85,1],[41,1388600,0.8,1]],"15":[[37,23000,1,1],[37,95300,1,2],[38,198500,1,3],[38,391700,0.9,4],[39,842200,0.8,5]],"16":[[38,97100,1,1],[39,209736,0.95,1],[40,467711,0.9,1],[41,1080413,0.85,1],[42,2538970,0.8,1]],"17":[[10,1000,1,1]],"18":[[10,5000,1,1]],"19":[[28,250000,1,1]],"fw1":[[11,7000,1,1],[11,24600,0.95,1],[11,64200,0.9,1],[11,114400,0.85,1],[11,186300,0.8,1]],"fw2":[[12,8400,1,1],[12,32500,0.95,1],[12,68900,0.9,1],[12,122400,0.85,1],[12,178600,0.8,1]],"fw3":[[12,11200,1,1],[12,43300,0.95,1],[12,91900,0.9,1],[12,163200,0.85,1],[12,238100,0.8,1]],"fl1":[[23,85000,0.95,36]],"fl2":[[23,75000,1,1]],"fl3":[[31,900000,1,1]],"fl6":[[31,900000,1,1]]}; // task_new_building // produced thing -> production area const PRODUCT2BUILDING=[[,1,1,1,1,1,1,1,1,2,3,4,5,,,,,1,1,1,1,1,1,1,1,7,1,8,9,1,10,1,1,1,1,1,1,1,1,1,1,1,1,1,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,11,,,,,,1,,,,,,,1,,,1,1,1,12,8,1,1,1,1,13,13,13,13,13,13,14,14,14,14,1,1,1,1,"fw1","fw1","fw1","fw1","fw1","fw1","fw2","fw2","fw2","fw2","fw2","fw2","fw2","fw2",7,"fw1","fw1","fw1","fw2","fw2","fw2",15,9,1,1,16,16,16,1,,,"fw3","fw3","fw3","fw3","fw3","fw3","fw3","fw3","fw3","fw3","fl1","fl1","fl1","fl1","fl1","fl1","fl1","fl1","fl1","fl1","fl1","fl1","fl1","fl1","fl1","fl1","fl1","fl1","fl1",,,,,,,,,,,"fl2","fl2","fl2","fl2","fl2","fl2","fl2","fl2","fl2","fl2","fl2","fl2","fl2","fl2","fl2","fl2","fl2","fl2","fl2","fl2","fl2","fl2",,],{"1":"forest","2":"forest","3":"forest","4":"forest","5":"forest","7":"forest","8":"forest","21":"forest","22":"forest","23":"forest","24":"forest","25":"forest","26":"forest","27":"forest","41":"sawmill","42":"sawmill","43":"sawmill","44":"sawmill","45":"sawmill","46":"sawmill","47":"sawmill","48":"sawmill","49":"sawmill","50":"sawmill","51":"sawmill","52":"sawmill","53":"sawmill","54":"sawmill","55":"sawmill","56":"sawmill","57":"sawmill","58":"sawmill","59":"sawmill","60":"sawmill","61":"sawmill","101":"carpentry","102":"carpentry","103":"carpentry","104":"carpentry","105":"carpentry","106":"carpentry","107":"carpentry","108":"carpentry","109":"carpentry","110":"carpentry","111":"carpentry","112":"carpentry","113":"carpentry","114":"carpentry","115":"carpentry","116":"carpentry","117":"carpentry","118":"carpentry","119":"carpentry","120":"carpentry","121":"carpentry","122":"carpentry","123":"carpentry","124":"carpentry","125":"carpentry","126":"carpentry","127":"carpentry","128":"carpentry","129":"carpentry","130":"carpentry","131":"carpentry","132":"carpentry","133":"carpentry","300":"forest"},[],[,"windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill","windmill"]];// task_new_plant task_new_product unsafeData.PRODUCT2BUILDING=PRODUCT2BUILDING.clone(); // produced thing <- production area const BUILDING2PRODUCT=[,,[9],[10],[11],[12],,[25,144],[27,111],[28,152],[30],[91],[110],[116,117,118,119,120,121],[122,123,124,125],[151],[155,156,157]]; // task_new_product unsafeData.BUILDING2PRODUCT=BUILDING2PRODUCT.clone(); // building -> -/field/stable/factory/foodworld const BUILDINGTYPE={"0":0,"1":1,"2":2,"3":2,"4":2,"5":2,"6":0,"7":3,"8":3,"9":3,"10":3,"11":2,"12":2,"13":3,"14":3,"15":2,"16":3,"17":0,"18":0,"19":3,"fl1":1,"fl2":4,"fw1":4,"fw2":4,"fw3":4} // task_new_building unsafeData.BUILDINGTYPE=BUILDINGTYPE.clone(); const BUILDING_SIZE={"1":120,"forest":25,"fl0":17,"fl1":36,"19":[11,9]}; unsafeData.BUILDING_SIZE=BUILDING_SIZE.clone(); // Needed input of a zone // BUILDING_INPUT[buildTyp]{output}[alternatives]=[[prod1,amount1||reducing time1],...] const BUILDING_INPUT=[,,{"9":[[[1,600]],[[2,1200]]]},{"10":[[[3,900]],[[4,1800]]]},{"11":[[[5,2400]],[[6,4800]]]},{"12":[[[7,4800]],[[8,9600]]]},,{"25":[[[9,30]]],"144":[[[21,450]]]},{"27":[[[10,12]]],"111":[[[110,5]]]},{"28":[[[11,8]]],"152":[[[151,5]]]},{"30":[[[12,5]]]},{"91":[[[92,14400]],[[93,28800]]]},{"110":[[[108,3600]],[[109,1800]]]},{"116":[[[2,1980]]],"117":[[[7,550]]],"118":[[[4,1020]]],"119":[[[38,650]]],"120":[[[42,110]]],"121":[[[43,100]]]},{"122":[[[112,130],[116,35]]],"123":[[[113,220],[117,35]]],"124":[[[114,345],[118,35]]],"125":[[[115,80],[119,35]]]},{"151":[[[153,1560]],[[154,3120]]]},{"155":[[[152,5],[28,6]]],"156":[[[152,8],[28,5]]],"157":[[[152,2],[28,9]]]}]; // task_new_product unsafeData.BUILDING_INPUT=BUILDING_INPUT.clone(); // Zone 2 -> "9":[[[0,1,600]],[[0,2,1200]]] // Zone 3 -> "10":[[[0,3,900]],[[0,4,1800]]] // Zone 4 -> "11":[[[0,5,2400]],[[0,6,4800]]] // Zone 5 -> "12":[[[0,7,4800]],[[0,8,9600]]] // Zone 11 -> "91":[[[0,92,14400]],[[0,93,28800]]] // Zone 12 -> "110":[[[0,108,3600]],[[0,109,1800]]] // Zone 15 -> "151":[[[0,153,1560]],[[0,154,3120]]] // price of an animal. formula: cost=Math.round(ANIMALCOST[zone][0]+nr*ANIMALCOST[zone][1]) const ANIMALCOST=[,,[309,1000/19],[419,320],[529,320],[1599,2600/3],,,,,,[999,1000],[789,320],,,[2400,1200],,,]; // task_new_building // sizes of Farmis [width,height,left,top] in px , taken from setFarmis() const FARMISIZE=[,[40,60,-1,-5],[30,40,0,0],[30,40,2,0],[33,45,2,0],[33,45,4,2],[40,65,2,-11],[40,65,-2,-20],[45,60,-2,-14]]; // QUESTS[questType][campaign][nr]=[[[type1,id1,amount1],...],waitdays,points,more] // more: Array of items: // [0,money] // [1,type of gained product,id of gained product,amount] // [2,number of accessed rack] // [3,number of accessed farm] // [4,type of product,id of product,minutes this product grows faster]] // [5,number of additional farmis ('<img src=GFX+"adbonus.gif" style="border:0;height:15px;">')] // [6,Erhoehung der Lagerkapazitaet Staemme um x] // [7,Giessbonus x%] // [8,id of accessed zone] // [9,type of accessed product,id of accessed product] // [10] access to watering of forest // [11,number of additional farmi slots] // [12,id of gained farmhouse item] // [13,id of gained gift] // task_new_quest: const QUESTS = {"main":{"1":[,[[[0,17,43],[0,9,1]],1,142,[[0,54]]],[[[0,1,173],[0,9,2]],1,348,[[0,145]]],[[[0,18,192],[0,17,288]],1,255,[[0,73]]],[[[0,18,672],[0,9,10]],1,1883,[[0,608]]],[[[0,17,922],[0,9,19]],1,2304,[[0,890]]],[[[0,20,360],[0,18,960]],1,3300],[[[0,19,540],[0,20,720]],1,6413],[[[0,2,240],[0,21,245]],1,2895],[[[0,20,1440],[0,9,24]],1,11700,[[1,0,47,1]]],[[[0,21,1152],[0,9,48]],1,16200],[[[0,9,72],[0,22,1037]],1,16202],[[[0,20,3456],[0,10,27]],1,25476],[[[0,18,8064],[0,10,48]],1,15660],[[[0,23,3110],[0,9,144]],1,57240],[[[0,10,96],[0,9,180]],1,33930,[[1,0,59,1]]],[[[0,9,240],[0,6,1836]],1,62190],[[[0,10,384],[0,9,144]],1,70920],[[[0,10,192],[0,23,6739]],1,116280,[[2,2]]],[[[0,22,7518],[0,9,216]],1,108956],[[[0,11,150],[[0,10,272],[0,110,112]]],1,34650],[[[0,7,1350],[0,12,50]],1,78375,[[1,0,63,1]]],[[[0,23,15552],[0,9,1008]],1,318600],[[[0,29,6552],[0,25,130]],1,373645,[[3,2]]],[[[0,1,51840],[[0,27,55],[0,111,51]]],1,60579],[[[0,11,280],[0,12,210]],1,138705],[[[[0,10,672],[0,110,276]],[0,12,210]],1,169785],[[[0,1,75600],[0,2,25000]],1,42131,[[1,0,90,1]]],[[[0,11,480],[0,12,272]],1,206760],[[[0,9,2688],[[0,10,1024],[0,110,420]]],1,448320],[[[0,12,320],[0,11,560]],1,242160],[[[0,29,14742],[[0,27,194],[0,111,180]]],1,836328,[[2,3]]],[[[0,20,77760],[0,12,383]],1,620831,[[1,0,78,1]]],[[[0,12,540],[0,32,14600]],1,449550],[[[0,32,50400],[0,25,432]],1,1208880],[[[[0,10,1760],[0,110,722]],[0,11,1000]],1,481800,[[3,3]]],[[[0,9,4800],[0,12,595]],1,749738],[[[0,26,46550],[[0,27,216],[0,111,201]]],1,933756,[[1,0,77,1]]],[[[0,1,259200],[0,30,216]],1,252960],[[[0,23,51840],[0,28,230]],1,856800],[[[0,9,5280],[[0,10,1795],[0,110,736]]],1,849816],[[[0,25,475],[0,30,238]],1,1665576,[[1,0,80,1]]],[[[0,34,64152],[0,28,253]],1,1704780],[[[0,11,1320],[0,12,880]],1,615120],[[[[0,27,238],[0,111,221]],[0,24,30294]],1,576923,[[1,0,76,1]]],[[[[0,10,2304],[0,110,945]],[0,30,259]],1,538272],[[[0,9,5760],[[0,10,2304],[0,110,945]]],1,976320],[[[0,37,13800],[0,25,518]],1,5559806,[[1,0,61,1]]],[[[0,9,5760],[[0,10,1958],[0,110,803]]],1,927072],[[[0,28,276],[0,30,259]],1,417312],[[[0,12,1040],[0,30,281]],1,376253,[[1,0,52,1]]],[[[0,20,72000],[0,12,800]],1,732000,[[4,0,23,15]]],[[[0,12,4000],[[0,10,1920],[0,110,787]]],1,1683600],[[[0,23,64800],[0,9,4800]],1,1395000],[[[0,25,432],[0,28,230]],1,373680,[[4,0,24,15]]],[[[0,24,72000],[[0,27,216],[0,111,201]]],1,1135800],[[[0,7,18000],[[0,10,1920],[0,110,787]]],1,1083600],[[[[0,27,216],[0,111,201]],[0,11,1200]],1,423000,[[4,0,31,15]]],[[[0,31,103700],[0,30,216]],1,2965498],[[[0,11,1200],[0,25,432]],1,478080,[[4,0,21,10]]],[[[0,21,57600],[[0,10,1920],[0,110,787]]],1,813600],[[[0,12,800],[[0,27,216],[0,111,201]]],1,427800,[[4,0,29,15]]],[[[0,29,27300],[0,25,432]],1,1506635],[[[0,4,48000],[0,9,4800]],1,855000],[[[0,28,230],[[0,27,216],[0,111,201]]],1,318600,[[4,0,33,15]]],[[[0,33,43200],[0,25,432]],1,1685880,[[5,1]]],[[[0,9,4800],[0,12,800]],1,822000,[[4,0,22,10]]],[[[0,8,18000],[0,28,230]],1,1792800],[[[[0,10,1920],[0,110,787]],[0,11,1200]],1,550800,[[4,0,34,15]]],[[[0,34,64800],[0,30,216]],1,1704960],[[[0,6,10800],[0,28,230]],1,207000],[[[0,11,1200],[[0,10,1920],[0,110,787]]],1,550800,[[4,0,35,20]]],[[[0,35,12950],[[0,27,216],[0,111,201]]],1,932692],[[[0,25,432],[0,11,1200]],1,478080],[[[0,32,72000],[0,12,800]],1,1722000,[[4,0,36,15]]],[[[0,36,24500],[0,9,4800]],1,3235000],[[[[0,27,216],[0,111,201]],[0,30,216]],1,320760,[[4,0,7,10]]],[[[0,26,66500],[0,28,230]],1,1298451],[[[0,12,800],[[0,10,1920],[0,110,787]]],1,555600,[[4,0,37,30]]],[[[0,37,3833],[0,9,4800]],1,2017431],[[[0,28,230],[0,25,432]],1,373680],[[[0,33,43200],[0,12,800]],1,1767000,[[4,0,38,15]]],[[[0,38,108000],[0,30,216]],1,3594960],[[[0,9,4800],[0,28,230]],1,712800,[[4,0,19,5]]],[[[0,5,72000],[[0,10,1920],[0,110,787]]],1,963600],[[[0,30,216],[0,9,4800]],1,714960,[[4,0,39,30]]],[[[0,39,2867],[0,12,800]],1,1834778],[[[[0,10,1920],[0,110,787]],[0,25,432]],1,474480],[[[0,32,72000],[[0,27,216],[0,111,201]]],1,1585800,[[4,0,40,30]]],[[[0,40,2250],[0,12,800]],1,1782000],[[[0,25,432],[0,11,1200]],1,478080,[[4,0,20,10]]],[[[0,3,64000],[0,30,216]],1,374960],[[[[0,27,216],[0,111,201]],[0,11,1200]],1,423000,[[4,0,41,30]]],[[[0,41,1975],[[0,10,1920],[0,110,787]]],1,1819998],[[[0,11,1200],[[0,27,216],[0,111,201]]],1,423000,[[4,0,8,15]]],[[[0,24,72000],[[0,10,1280],[0,110,787]]],1,1172400,[[5,1]]],[[[0,12,800],[0,9,4800]],1,822000,[[4,0,26,15]]],[[[0,36,24500],[0,28,230]],1,2867800],[[[0,31,103700],[[0,10,1920],[0,110,787]]],1,3064138,[[4,0,42,30]]],[[[0,28,230],[0,25,432]],1,373680],[[[0,42,1680],[0,30,216]],1,1693960,[[4,0,33,15]]],[[[0,4,80000],[0,30,210]],2,722800],[[[0,6,48000],[0,12,300]],2,854400],[[[0,1,800000],[0,25,320]],2,998400,[[4,0,32,10]]],[[[0,35,64000],[0,32,12000]],2,1629600],[[[0,26,108000],[0,11,540]],2,1452600],[[[0,39,12000],[0,9,5600]],2,2160000,[[4,0,43,30]]],[[[0,43,10000],[[0,27,600],[0,111,558]]],2,2556000],[[[0,24,184000],[0,25,480]],2,2248000],[[[0,9,10200],[[0,10,24000],[0,110,9840]]],2,2205600],[[[0,23,108000],[0,91,250]],2,1359600,[[12,105]]],[[[0,34,36936],[0,37,10580]],2,1959726],[[[0,29,78624],[0,26,5200]],2,2164176],[[[0,44,2016],[0,28,1600]],2,2059245],[[[[0,10,12000],[0,110,4920]],[0,12,1200]],2,1536000],[[[0,30,840]],2,906800,[[12,123]]],[[[0,40,3240],[0,36,9800]],2,1265312],[[[0,91,750],[0,31,72590]],2,1233972],[[[0,26,113050],[[0,27,600],[0,111,558]]],2,1874430],[[[0,38,7020],[0,42,2352]],2,2134942],[[[0,41,9480],[0,9,28800]],2,1886172,[[5,1]]],[[[0,23,174960],[0,22,98515]],2,2267541],[[[0,8,5040],[0,7,3780]],2,2022804],[[[0,32,27000],[[0,10,24000],[0,110,9840]]],2,2357400],[[[0,39,2580],[0,37,7935]],2,1525641,[[1,0,99,1]]],[[[0,33,51840],[0,35,20720]],2,2464720],[[[0,43,5000],[0,21,146880]],2,2139910],[[[0,31,60664],[0,26,100520]],2,1945541],[[[0,20,100800],[0,9,15360]],2,1216320,[[4,0,44,20]]],[[[[0,10,10080],[0,110,4132]],[0,11,4500]],2,1571400],[[[0,7,18900],[0,38,5400]],2,2239480],[[[0,40,3500],[0,35,12000]],2,1168200],[[[0,91,1000]],2,600000,[[12,137]]],[[[0,44,4400],[0,26,22400]],2,1284560],[[[0,3,280000],[0,31,40000]],2,1328000],[[[0,12,1200],[0,39,3900]],2,1228860],[[[0,7,9800],[0,2,240000]],2,1003320],[[[0,26,60000],[0,1,275000]],2,1031000],[[[0,11,6400]],2,1088000],[[[0,6,14444],[0,33,34000]],2,1158911],[[[[0,27,625],[0,111,581]]],2,1078125],[[[0,38,8600],[0,41,2900]],2,1056220],[[[0,43,4050],[0,7,5250]],2,1133280],[[[0,9,16200]],2,453600,[[5,1]]],[[[0,25,900],[[0,10,5400],[0,110,2214]]],2,990000],[[[0,37,8600]],2,1016520],[[[0,28,300],[[0,10,7500],[0,110,3075]]],2,1050000],[[[0,30,400],[0,42,3600]],2,1096880],[[[0,29,51000],[0,9,3600]],2,1069800],[[[0,91,175],[0,8,18200]],2,1087560],[[[0,36,10300],[0,41,3800]],2,1312700],[[[0,24,90000],[[0,10,800],[0,110,328]]],2,1028000],[[[0,22,95500],[0,1,300000]],2,930300],[[[0,35,13000],[0,32,33000]],2,1176800],[[[0,17,155000],[0,21,99999]],2,1049993],[[[0,38,13000],[[0,27,250],[0,111,232]]],2,1104650],[[[0,37,4444],[0,39,3333]],2,1083225],[[[0,2,122000],[0,21,122000]],2,1146800],[[[0,20,112000],[[0,10,2800],[0,110,1148]]],2,1097600],[[[0,9,1111],[0,26,66000]],2,1142108],[[[0,11,2320],[0,23,72000]],2,1200800],[[[0,19,116000],[0,25,900]],2,976200,[[5,1]]],[[[0,5,220000],[0,12,720]],2,1049600],[[[0,18,240000],[0,6,50000]],2,1028000],[[[0,41,4400],[0,1,150000]],2,1076640],[[[0,40,3250],[0,30,500]],2,1069300],[[[0,29,45000],[0,20,25000]],2,1050000],[[[0,91,840],[0,1,510000]],2,1014000],[[[0,34,45000],[0,12,680]],2,1190400],[[[0,31,425000],[0,43,2800]],2,1048680],[[[[0,10,7500],[0,110,3075]],[0,3,140000]],2,1048000,[[7,5]]]] ,"2":[,[[[0,8,6500],[0,12,300]],,495000],[[[0,34,18600],[0,111,75]],,496298],[[[0,33,5650],[0,30,315]],,498270],[[[0,26,15600],[0,9,11200]],,506380],[[[0,37,2150],[0,12,530]],,508530],[[[0,18,175000],[0,91,505]],,511250],[[[0,108,6350],[0,7,5400]],,505010],[[[0,35,6530],[0,110,950]],,507946],[[[0,24,19150],[0,27,412]],,511190],[[[0,23,33000],[0,25,480]],,518500,[[3,4]]],[[[0,28,366],[0,46,100]],,516000],[[[0,116,460],[0,11,1400]],,523880],[[[0,21,42000],[0,9,8000]],,534800],[[[0,32,15420],[0,10,3630]],,540204],[[[0,7,5000],[0,30,265]],,550550,[[9,0,117],[9,0,123]]],[[[0,116,480],[0,91,777]],,551640],[[[0,19,84000],[0,110,1255]],,554475],[[[0,117,917],[0,18,277000]],,559816],[[[0,12,625],[0,109,42000]],,560400],[[[0,108,12300],[0,116,670]],,559600],[[[0,5,50500],[0,26,32000]],,564800],[[[0,117,490],[0,9,16000]],,569520],[[[0,29,16600],[0,31,24000]],,574600],[[[0,33,18200],[0,11,1800]],,589560],[[[0,4,40450],[0,116,1560]],,594810,[[9,0,118],[9,0,124]]],[[[0,3,110000],[0,12,515]],,599200],[[[0,17,75000],[0,10,6800]],,605000],[[[0,91,700],[0,34,9900]],,610080],[[[0,2,155000],[0,28,305]],,615000],[[[0,37,3800],[0,118,1450]],,617360,[[8,"20"]]],[[[0,1,172350],[0,111,558]],,622350],[[[0,117,1090],[0,36,5800]],,625320],[[[0,12,900],[0,25,310]],,624400],[[[0,31,38380],[0,118,1800]],,623304],[[[0,38,9200],[0,116,840]],,623304,[[9,0,119],[9,0,125]]],[[[0,65,10],[0,27,680]],,623333],[[[0,36,7500],[0,9,8000]],,627000],[[[0,6,13150],[0,110,2214]],,626620],[[[0,37,2415],[0,11,2000]],,625453],[[[0,119,735],[0,30,360]],,626280],[[[0,21,19000],[0,10,6120]],,630200],[[[0,33,14400],[0,35,4750]],,634970],[[[0,38,8200],[0,111,116]],,640341],[[[0,73,30],[0,28,600]],,650000],[[[0,42,2980],[0,117,430]],,660324,[[9,0,120]]],[[[0,39,2250],[0,12,666]],,696030],[[[0,40,2400],[0,30,286]],,700580],[[[0,41,2200],[0,118,2275]],,702800],[[[0,20,36000],[0,23,38000]],,706400],[[[0,43,1850],[0,120,690]],,709770,[[9,0,121]]],[[[0,108,14000],[0,8,13200]],,715040],[[[0,40,1950],[0,9,14200]],,719600],[[[0,39,1900],[0,116,1540]],,729920],[[[0,27,268],[0,43,1300]],,735580],[[[0,42,2300],[0,109,34850]],,740010],[[[0,112,3300],[0,121,500]],,748000],[[[0,41,2500],[0,111,138]],,754830],[[[0,119,1000],[0,29,22750]],,760250],[[[0,112,3300],[0,22,52300]],,766260],[[[0,32,24799],[0,9,13333]],,766260,[[8,"21"]]],[[[0,113,9100],[0,27,400]],,750000],[[[0,44,1142],[0,144,790]],,755000],[[[0,154,1695],[0,111,210]],,760000],[[[0,24,39500],[0,118,2350]],,765000],[[[0,153,6250],[0,26,22650]],,765000],[[[0,23,39500],[0,28,385]],,770000],[[[0,6,34500],[0,122,37]],,770000],[[[0,32,13400],[0,10,3900]],,775000],[[[0,39,990],[0,38,8400]],,775000],[[[0,144,1150],[0,123,46]],,780000],[[[0,9,7900],[0,151,85]],,780000],[[[0,5,56200],[0,4,41500]],,785000],[[[0,64,15],[0,152,80]],,785000],[[[0,31,28500],[0,91,550]],,790000],[[[0,20,59000],[0,30,720]],,790000,[[8,"22"]]],[[[0,114,15000],[0,29,25000]],,795000],[[[0,120,400],[0,11,4500]],,795000],[[[0,2,150000],[0,6,45000]],,800000],[[[0,40,9000],[0,25,200]],,800000],[[[0,7,28000],[0,30,225]],,805000],[[[0,32,65000],[0,1,190000]],,805000],[[[0,109,125000],[0,108,65000]],,810000],[[[0,22,92000],[0,27,450]],,810000],[[[0,124,1125],[0,21,85000]],,815000],[[[0,36,9500],[0,112,6600]],,815000],[[[0,116,840],[0,24,63000]],,820000],[[[0,26,63000],[0,117,700]],,820000],[[[0,152,120],[0,44,15000]],,825000],[[[0,144,450],[0,113,30000]],,825000],[[[0,125,650],[0,151,550]],,830000,[[8,"23"]]],[[[0,115,1680],[0,10,4200]],,835000],[[[0,154,7500],[0,118,3300]],,840000],[[[0,153,18500],[0,31,22000]],,845000],[[[0,42,2250],[0,110,1450]],,850000],[[[0,43,1500],[0,1,150000]],,855000],[[[0,41,2200],[0,12,1100]],,860000],[[[0,157,550],[0,120,600]],,865000],[[[0,33,14000],[0,35,16500]],,870000],[[[0,21,29500],[0,112,11500]],,875000],[[[0,10,3500],[0,114,18200]],,880000],[[[0,22,32000],[0,123,1250]],,885000],[[[0,30,650],[0,155,350]],,890000],[[[0,91,1050],[0,7,14000]],,895000],[[[0,29,18400],[0,26,21200]],,900000],[[[0,28,650],[0,152,250]],,905000],[[[0,157,320],[0,156,410]],,910000],[[[0,121,1000],[0,9,15000]],,915000],[[[0,44,62000],[0,144,450]],,920000],[[[0,8,18000],[0,12,1350]],,925000],[[[0,113,18000],[0,27,350]],,930000],[[[0,21,42500],[0,122,1850]],,935000],[[[0,22,95000],[0,120,950]],,940000],[[[0,40,5500],[0,41,6800]],,945000],[[[0,116,2500],[0,38,18600]],,950000],[[[0,111,650],[0,119,750]],,955000],[[[0,36,18500],[0,37,12000]],,960000],[[[0,6,32500],[0,117,1450]],,965000],[[[0,34,27500],[0,32,32100]],,970000],[[[0,151,600],[0,11,1200]],,980000],[[[0,125,1000],[0,124,1600]],,985000,[[8,"24"]]]] } ,"forestry":{"1":[,[[[0,4,3300],[0,19,4500],[0,24,1400]],,51520],[[[0,5,2600],[0,17,8000],[0,91,50]],,50360],[[[0,6,1250],[0,21,6600],[0,18,7300]],,0,[[1,1,1,5],[8,"forest"],[9,1,1],[9,1,21]]],[[[0,22,1400],[0,7,750]],,48630],[[[0,25,64],[0,3,3200],[1,21,8]],,50800],[[[0,8,650],[0,27,85],[0,4,4800],[0,91,25]],,0,[[8,"sawmill"],[9,1,41],[9,1,42],[9,1,43]]],[[[0,10,420],[0,19,1600]],,39360],[[[0,2,6000],[0,22,2100],[0,21,1800]],,38980],[[[0,24,1800],[1,21,12],[1,41,10]],,0,[[1,1,2,5],[9,1,2],[9,1,22],[9,1,44],[9,1,45],[9,1,46]]],[[[0,3,3200],[0,5,3150],[0,20,1900]],,36200],[[[0,27,40],[0,18,7700]],,39240],[[[0,91,60],[1,22,30],[1,44,12]],,0,[[8,"carpentry"],[9,1,101]]],[[[0,8,300],[0,6,2000]],,39600],[[[0,17,16000],[1,22,30],[1,42,10]],,34520],[[[0,11,90],[1,101,6],[1,22,18]],,0,[[10]]],[[[0,22,800],[0,7,430],[0,2,2200]],,32642],[[[0,10,380]],,30400],[[[0,9,460],[1,41,20]],,0,[[9,1,102]]],[[[0,19,2600],[0,3,3000],[0,18,5400],[0,4,1200]],,31740],[[[0,91,15],[0,26,1700]],,31420],[[[0,25,35],[0,5,2800],[1,102,4]],,0,[[9,1,103]]],[[[0,24,1900],[0,6,1400]],,31060],[[[0,20,1350],[0,23,1250],[0,1,4900]],,30230],[[[0,12,75],[0,21,2500],[1,45,15]],,0,[[1,1,3,5],[9,1,3],[9,1,23],[9,1,47],[9,1,48],[9,1,49]]],[[[0,8,310],[0,9,240]],,31520],[[[0,7,130],[0,6,400],[0,27,30]],,32562],[[[0,3,5400],[1,23,18],[1,103,3]],,0,[[9,1,104]]],[[[0,11,185]],,31450],[[[0,22,1900],[0,91,22],[0,2,2600]],,30940],[[[0,10,110],[1,41,32],[1,101,24]],,0,[[9,1,105]]],[[[0,25,55],[1,46,27]],,35025],[[[0,20,2300],[0,23,1350],[1,43,36]],,34485],[[[0,5,2000],[1,104,12],[1,47,72]],,0,[[9,1,106]]],[[[0,26,2100],[0,8,150]],,36600],[[[0,3,2200],[0,18,4500],[0,19,3000],[0,4,1400],[0,17,2800]],,37520],[[[0,9,600],[1,106,20]],,0,[[9,1,107]]],[[[0,7,700]],,37380],[[[0,29,1400],[0,12,40]],,42000],[[[0,1,45000],[1,107,52],[1,48,18]],,0,[[9,1,108]]],[[[0,5,3000],[0,11,240]],,44400],[[[0,3,5800],[0,9,380],[0,21,2400]],,46970],[[[0,6,1600],[1,102,12],[1,23,48]],,0,[[9,1,109]]],[[[0,25,75]],,48500],[[[0,29,1200],[0,8,1300],[0,17,20000],[0,2,5600],[1,49,24]],,50340,[[5,1]]],[[[0,20,5400],[0,10,100],[1,42,35]],,52325],[[[0,26,450],[0,25,45],[0,9,850]],,52510],[[[0,5,18000],[0,4,3600],[1,109,50]],,0,[[1,1,4,5],[9,1,4],[9,1,24],[9,1,50],[9,1,51],[9,1,52]]],[[[0,11,100],[0,3,9200],[1,45,30],[1,103,18]],,52207],[[[0,91,50],[0,22,3300],[0,18,4000],[1,46,45]],,52953],[[[1,101,40],[1,21,80],[1,48,30]],,0,[[9,1,111]]],[[[0,21,3000],[0,23,1600],[0,6,800]],,51960],[[[0,25,50],[0,24,2200],[1,43,60]],,53008],[[[1,104,70],[1,107,55],[1,24,60]],,0,[[9,1,112]]],[[[0,8,500],[0,7,450]],,50730],[[[0,91,35],[0,2,3500],[0,29,1200],[1,23,30]],,52432],[[[0,11,290],[1,52,30]],,50496,[[5,1]]],[[[0,10,360],[0,9,720],[1,106,100]],,52200],[[[0,27,75],[1,112,15]],,50049,[[11,1]]],[[[0,23,2000],[0,12,60],[1,42,50],[1,102,20]],,53630],[[[1,50,65],[1,47,30],[1,111,50]],,0,[[9,1,110]]],[[[0,109,3500],[0,24,2500],[1,48,30]],,50792],[[[0,11,275],[1,22,60]],,51934],[[[0,10,250],[0,12,100],[1,41,50],[1,23,33]],,0,[[1,1,5,5],[9,1,5],[9,1,25],[9,1,53],[9,1,54],[9,1,55]]],[[[0,9,250],[0,23,4000]],,51800],[[[0,25,90],[0,18,6400],[0,21,1000],[1,44,50]],,55282],[[[0,108,7500],[1,53,15],[1,112,5]],,0,[[9,1,115]]],[[[0,6,500],[0,22,6250]],,48650],[[[0,3,9700],[0,17,30000],[0,5,2200],[1,25,36]],,51590],[[[0,91,50],[1,115,26],[1,101,62]],,0,[[9,1,116]]],[[[0,112,2900],[0,12,80],[1,22,32]],,54505],[[[0,108,3700],[0,11,200]],,51020],[[[0,27,125],[1,115,22]],,0,[[9,1,118]]],[[[0,29,2700],[1,104,27]],,54896],[[[0,10,380],[0,19,5100],[1,50,65],[1,109,8]],,52508],[[[0,91,40],[1,118,10],[1,50,80],[1,107,65]],,0,[[9,1,117],[7,5]]]] ,"2":[,[[[0,111,45],[0,9,380]],,48150],[[[1,21,400]],,,[[6,100]]],[[[0,12,100],[0,5,315]],,49140],[[[1,24,350]],,,[[6,100]]],[[[0,26,3200],[0,9,220],[1,106,30]],,47452],[[[1,22,450]],,,[[6,100]]],[[[0,11,150],[1,111,35]],,51945],[[[1,21,600],[1,41,80]],,,[[6,100]]],[[[0,8,555],[1,44,40],[1,45,30]],,46164],[[[0,91,55],[1,23,550]],,,[[6,100]]],[[[1,25,150]],,103843],[[[1,102,22]],,276206],[[[1,115,45]],,145202],[[[1,21,650],[1,22,100]],,,[[6,100]]],[[[1,110,15]],,124977],[[[1,53,120],[1,55,50],[1,54,50]],,,[[9,1,119]]],[[[0,7,5200],[0,6,1200],[0,24,3500]],,103941],[[[1,21,350],[1,22,300]],,,[[6,100]]],[[[0,10,240],[0,27,85],[0,26,2500]],,135945],[[[1,1,125],[1,2,100],[1,3,90],[1,4,70],[1,5,50]],,138279],[[[1,109,30]],,168612],[[[0,144,40],[0,110,100],[0,12,50]],,,[[6,100]]],[[[1,103,20]],,179495],[[[1,53,210],[1,55,160]],,,[[9,1,120]]],[[[1,41,100],[1,48,75],[1,52,50]],,156645],[[[1,25,190]],,,[[6,100]]],[[[0,11,400]],,125956],[[[1,24,220],[1,47,50],[1,43,85]],,114596],[[[1,118,20]],,221544],[[[1,1,250],[1,2,200],[1,3,180],[1,4,140],[1,5,100]],,,[[6,100]]],[[[0,110,100],[0,12,80],[1,41,45],[1,53,40],[1,52,20]],,237672],[[[1,41,100],[1,21,80],[1,43,125],[1,42,75]],,257504],[[[1,46,70],[1,49,50],[1,23,60],[1,25,80]],,273176],[[[0,10,60],[1,118,5],[0,27,100],[0,26,8000]],,288144],[[[1,5,200],[1,4,200],[1,3,200]],,,[[1,1,7,5],[9,1,7],[9,1,26],[9,1,56],[9,1,57],[9,1,58],[9,1,121],[9,1,122],[13,309]]],[[[1,121,20],[1,122,5]],,288473,[[9,1,123]]],[[[1,123,15],[1,56,120]],,313426],[[[0,11,500],[1,111,40],[0,5,8000],[0,1,15000]],, 346934],[[[1,24,200],[1,23,200],[1,53,100],[1,58,50]],,305630],[[[1,54,100],[1,42,150],[1,51,250]],,512943],[[[0,12,200],[1,110,20],[0,6,3000],[0,7,2500]],,382357],[[[1,109,15],[1,107,15],[1,106,4],[1,102,8]],,311131,[[9,1,124]]],[[[1,124,25]],,401729,[[9,1,125]]],[[[1,125,80]],,298927],[[[1,7,250],[1,5,200],[1,1,500]],,,[[1,1,8,5],[9,1,8],[9,1,27],[9,1,59],[9,1,60],[9,1,61],[13,310]]],[[[0,27,80],[0,26,3000],[1,27,80],[1,122,5],[1,121,10]],,337285,[[9,1,126],[9,1,127]]],[[[1,126,20],[1,127,20]],,322536,[[9,1,128],[9,1,129]]],[[[1,128,10],[1,129,5]],,377008,[[9,1,130],[9,1,131]]],[[[1,130,10],[1,131,5]],,390178,[[9,1,132]]],[[[1,132,35],[1,41,400]],,807960]] } ,"foodworld":{"1":[,[[[0,2,17000]],2,57800],[[[0,21,2000],[0,23,2500],[0,22,2750]],2,97800],[[[0,3,30000]],2,60000],[[[0,1,10000],[0,20,2500],[0,10,50]],2,36500],[[[0,22,6000]],2,62400],[[[0,4,8000]],2,70400],[[[0,131,40],[0,137,21],[0,140,23]],2,65400],[[[0,24,3000],[0,10,80]],2,70400],[[[0,1,6000],[0,2,4000],[0,5,2500]],2,65000],[[[0,19,2000],[0,109,3500],[0,2,7000]],2,55100],[[[0,11,50],[0,22,2500]],2,41400],[[[0,10,70],[0,110,45],[0,9,100]],2,49000],[[[0,6,2500],[0,21,2000],[0,17,9000]],2,91000],[[[0,20,4500],[0,21,3500],[0,10,30]],2,87600],[[[0,108,1500],[0,109,4000]],2,78500],[[[0,23,2000],[0,26,600],[0,9,150]],2,70660],[[[0,6,2200],[0,22,5000]],2,108320],[[[0,21,4000],[0,26,3500]],2,126000],[[[0,24,1200],[0,10,85],[0,17,20000]],2,42230],[[[0,1,20000],[0,12,35],[0,20,7500]],2,91450,[[8,"foodworld-3"]]]] } }; unsafeData.QUESTS=QUESTS.clone(); const INIT_questDataItem = {"nr":0,"time":0,"calcTo":0,"state":0,"given":{}}; const INIT_questData = {"main":{"1":INIT_questDataItem.clone(),"2":INIT_questDataItem.clone()},"forestry":{"1":INIT_questDataItem.clone(),"2":INIT_questDataItem.clone()},"foodworld":{"1":INIT_questDataItem.clone()}}; // state: 0:not available, 1:not activated, 2:active /* // Generate PRODUCT_QUEST var new_PRODUCT_QUEST=[]; for(var type in QUESTS){ if(!QUESTS.hasOwnProperty(type)){ continue; } for(var campaign in QUESTS[type]){ if(!QUESTS[type].hasOwnProperty(campaign)){ continue; } for(var nr=1;nr<QUESTS[type][campaign].length;nr++){ if(QUESTS[type][campaign][nr][3]){ for(var i=0;i<QUESTS[type][campaign][nr][3].length;i++){ if(QUESTS[type][campaign][nr][3][i][0]==9){ if(!new_PRODUCT_QUEST[QUESTS[type][campaign][nr][3][i][1]]){ new_PRODUCT_QUEST[QUESTS[type][campaign][nr][3][i][1]]={}; } new_PRODUCT_QUEST[QUESTS[type][campaign][nr][3][i][1]][QUESTS[type][campaign][nr][3][i][2]] = [type,parseInt(campaign,10),nr]; } } } } } } for(type=0;type<new_PRODUCT_QUEST.length;type++){ new_PRODUCT_QUEST[type].sortObj(); } GM_log("new_PRODUCT_QUEST:\n"+implode(new_PRODUCT_QUEST)); */ const INIT_valMinRack={"v":200,"e":50,"o":10,"z":0,"f1":25,"f2":10,"f3":10,"f4":0,"fw1":10,"fw2":10,"fw3":10}; const LEVEL_POINTS=[0,0,58,2420,6620,15620,27900,58700,101700,163100,211900 ,276900,359000,467000,730000,1190000,1750000,2680000,3900000,5660000,7850000 ,10590000,15300000,20640000,26020000,37340000,50030000,65160000,85030000,108900000,139150000 ,175520000,222430000,276920000,345930000,429330000,535520000,669000000,797010000,927020000,1069440000 ,1202920000,1336400000,1469880000,1603360000,1896272000,2220357000,2576977000,2967479000,3393198000,3855457000 ,4355565000,4894822000,5474516000,6095926000,6760322000,7468962000,8223098000,9023973000,9872820000,10770866000 ,11719330000,12719423000,13772351000,14879311000,16041494000,17260085000,18536263000,19871201000,21266065000,22722017000 ,24240212000,25821802000,27467932000,29179741000,30958366000,32804936000,34720579000,36706414000,38763560000,40893128000 ,43096227000,45373962000,47727432000,50157733000,52665958000,55253195000,57920530000,60669042000,63499810000,66413907000 ,69412404000,72496369000,75666864000,78924952000,82271688000,85708127000,89235321000,92854318000,96566163000,100371897000 ]; // task_new_level const VARIABLES = { "USER":{"bargeld":["Cash amount",2], "calcToLodgeCampaign":["Target lodge campaign",5], "calcToLodgeQuest":["Target lodge quest",5], "calcToQuest":["Target quest",3], "changedata":["Data version",1], "clubmemberLog":["Log-data club",1], "contractSave":["Saved contract templates",3], "css_styles":["CSS",3], "farmiLog":["Log-data farmies",1], "farmiOk":["Limit at farmi-log",5], "farmname":["Name of farm",2], "highlight":["Highlighted users",3], "highlightProducts":["Highlighted products",3], "infoPanelFormulas":["Mode",4], "kauf":["Log-data sales",5], "logSales":["Log-data sales",1], "lastContractTo":["Last contract recipient",2], "lastOffer":["Last market offer",2], "levelLog":["Log-data points",1], "lodgeCampaignNr":["Lodge campaign",5], "lodgeQuestData":["Lodge quest data",5], "lodgeQuestNr":["Lodge quest number",5], "lodgeTimeEnd":["Lodge quest time",5], "lotteryCollectForPrize":["Lottery collect data",3], "lotteryLastLot":["Lottery taken time",2], "lotteryLog":["Log-data lottery",1], "marketOffers":["Market offers",5], "ownMarketOffers":["Own market offers",2], "marketOfferTimes":["Market offer times",5], "modeBuildPreise":["Mode",4], "modeBuyNotepad":["Mode",4], "modeLotteryLog":["Mode",5], "modeMarket":["Mode",4], "modeProfittable":["Mode",4], "modeProfittableFeed":["Mode",5], "modeProfittableSterne":["Mode",5], "modeQuestsTable":["Mode",4], "modeStatistic":["Mode",4], "modeStockTable":["Mode",4], "nachrichten":["Messages",1], "nachrichten_doread":["Messages auto-read",5], "nachrichten_doreadState":["Messages auto-read",5], "nachrichten_letzte":["Messages",2], "nachrichten_system":["Messages",5], "nachrichtvorlage":["Message template",3], "notepad":["Notepad",3], "prodBestand":["Product stock",5], "prodBlock":["Blocked products",2], "prodGrowTime":["Product growtime",2], "prodMinRack":["Minimal rackamounts",2], "prodMinRackInit":["Minimal rackamounts",3], "prodRequire":["Recursive needed products",5], "prodStock":["Product stock",2], "prodStockMax":["Product stock limit",2], "prodYield":["Product yield",2], "quest":["Quest number",5], "questState":["Quest state",5], "questTime":["Quest time",5], "questData":["Quest data",2], "raisedEvents":["Raised events",4], "session":["Session",4], "show":["Mode",4], "totalFarmis":["Farmi needings",2], "valAssumeWater":["Option",3], "valAutoCrop":["Option",3], "valAutoWater":["Option",3], "valClickErrorbox":["Option",3], "valContractLogAmount":["Option",3], "valDrag":["Option",3], "valEmptyFieldForestLimit":["Option",5], "valErnte":["Option",5], "valErnteMsg":["Option",3], "valFarmiLimits":["Option",3], "valFarmiMiniInfo":["Option",3], "valGamecursor":["Option",3], "valGiess":["Option",5], "valGiessAnnehm":["Option",5], "valGiessNotw":["Option",5], "valGlobalTimeAdd":["Option",3], "valGlobaltimeShowCroppedZone":["Option",3], "valHotkey":["Option",3], "valJoinPreise":["Option",3], "valKauflimit":["Option",3], "valKauflimitNPC":["Option",3], "valLeereFelderLimit":["Option",5], "valLimitEmptyFields":["Option",3], "valMessageRe":["Option",3], "valMessagesSystemMarkRead":["Option",3], "valMinRack":["Option",3], "valMinRackE":["Option",5], "valMinRackF":["Option",5], "valMinRackP":["Option",5], "valMinRackV":["Option",5], "valMinRackFarmis":["Option",3], "valMinRackForestryFarmis":["Option",3], "valMinRackGrowing":["Option",3], "valMinRackLodgeQuest":["Option",5], "valMinRackMan":["Option",3], "valMinRackPlantsize":["Option",3], "valMinRackQuest":["Option",5], "valMinRackRecursive":["Option",3], "valMoveAnimals":["Option",3], "valMsgFormat":["Option",3], "valNachr":["Option",5], "valPrivNachr":["Option",3], "valProtectMinRack":["Option",3], "valQuicklinks":["Option",3], "valSpoilerZoneUpdate":["Option",5], "valStatistik":["Option",3], "valStatistikNpc":["Option",5], "valStatistikTime":["Option",5], "valVerkaufLimitDown":["Option",3], "valVerkaufLimitUp":["Option",3], "valWaterNeeded":["Option",3], "vertraegeIn":["Contracts received",1], "vertraegeOut":["Contracts sent",1], "vertraegePreise":["Contract prices",3], "zoneAnimals":["Amount of animals",5], "zoneBlock":["Blocked zones",5], "zoneBonus":["Zones bonus",5], "zoneBonusSpecialAmount":["Zone special product",5], "zoneBonusSpecialProduct":["Zone special product",5], "zoneEndProducts":["Zones productions",5], "zoneEndTimes":["Zones endtimes",5], "zoneErnte":["Zones productions",5], "zoneFieldData":["Zones productions",5], "zoneProductionData":["Zones productions",5], "zoneMainprod":["Zones productions",5], "zones":["Zones",2], "zoneTyp":["Zones types",5], "zoneWaterTimes":["Times watering",5]}, "SERVER":{"buildPreiseShowAll":["Mode",5], "changedata":["Data version",1], "competition":["Competition data",2], "farmNamen":["Farm names",2], "gut":["Product prices",3], "gutBeob":["Product observed prices",2], "npcSaison":["Products saisons",2], "pagedataNachrichtenNew":["Page attributes",4], "pagedataStadtMarktstand":["Page attributes",4], "pagedataVertraegeNew":["Page attributes",4], "pagedataVertraegeOverview":["Page attributes",4], "preisBeob":["Price observation",2], "prodId":["Product names lookup",2], "prodName":["Product names",2], "prodNameSort":["Product names",2], "prodPlantSize":["Plant sizes",2], "prodPoints":["Product points",2], "prodRequire":["Recursive needed products",2], "prodTyp":["Product types",2], "sessionlost":["Page attributes",4], "username":["Username",4], "valNimmBeob":["Option",3]}, "COUNTRY":{"changedata":["Data version",1], "pagedataLogin":["Page attributes",4], "valServerTimeOffset":["Option",3]}, "GLOBAL":{"changedata":["Data version",1], "devmode":["Option",3], "devmode_function":["Option",3], "devmode_events":["Option",3], "hotkeymap":["Option",3], "loginbusy":["Page attributes",4], "logindata":["Accounts",3], "tutorial":["Tutorial step",1], "updateCheck":["Script update",5], "valAutoLogin":["Option",3], "valUpdate":["Option",3]} }; var npcSaison = INIT_NPC_SAISON.clone(); var prodName=new Array(); var prodId=new Array(); var recipeNameToId=null; //TODO maybe rename / save as var var prodTyp=new Array(); //c:coins, v:plant, e:product, u:garbage, z:deco, f:forestry, d:forestry deco var prodBlock=new Array(); //c:only by club, u:garbage, l:level too low, t:not tradable, f:forestry, q:forestry quest too low var prodMinRackInit=new Array(); // initial minimal rack amounts // integer<0 is possible and means something like "product is produced" // call: unsafeWindow.prodMinRackAddon.add(type,1,"Mill-Queue",20000); // call: unsafeWindow.prodMinRackAddon.remove(type,1,"Mill-Queue"); var prodMinRackAddon=new Array(new Array(), new Object()); // additional minimal rack data from addons unsafeWindow.prodMinRackAddon=new Object(); unsafeWindow.prodMinRackAddon.newdata=new Array(); unsafeWindow.prodMinRackAddon.busy=false; var prodMinRack=new Array(); // + quest amount - field and powerup amounts var prodNameSort=new Array(); // sorted by type(cveoz) var prodStock=new Array(); var prodStockMax=new Array();//if not id is undefined then there is no max var prodPlantSize=new Array(); var prodYield=new Array(); var prodRequire=new Array(); var prodPoints=new Array(); var prodGrowTime=new Array(); var gut=new Array(); var gutBeob=new Array(); var preisBeob=new Array(); var questData; var css_styles=new Object(); var regMsgMarketsaleContent,regMsgContractsaleContent,regMsgContractsaleList,regMsgFriend; var valAutoWater, valWaterNeeded, valAssumeWater, valAutoCrop, valErnteMsg, valLimitEmptyFields, valStatistik, valClickErrorbox, valGlobaltimeShowCroppedZone; var valMoveAnimals, valMinRackMan, valMinRack, valMinRackPlantsize, valMinRackFarmis,valMinRackForestryFarmis, valMinRackGrowing, valMinRackRecursive, valFarmiLimits, valFarmiMiniInfo var upjersAds, buyNotePadShowBlocked, show; var farmiLog, farmiDailyCount, levelLog, levelLogId, lotteryLog, lotteryLogId, logSales, logSalesId, logDonkey; var zoneAddToGlobalTime; var totalAnimals, totalErnte, totalFarmis, totalPowerups, totalQuest, totalRecursive, totalZones, totalEndtime; var valKauflimit, valKauflimitNPC, highlightProducts, highlightUser, valNimmBeob, valVerkaufLimitDown, valVerkaufLimitUp, valJoinPreise, lastOffer, protectMinRack, ownMarketOffers; var valMessagesSystemMarkRead; var megafieldVehicle; top.unsafeData.autoAction=null; var gameLocation=[null,null]; unsafeData.gameLocation=gameLocation.clone(); //*********************************************************************************************************** // developer functions if(DEVMODE_FUNCTION){ tracking.init("berater"); } //*********************************************************************************************************** //*********************** FUNCTIONS ************************************************************************* // DOM function SortableTable (sortRow){ // Sortable HTML table inspired by http://www.webtoolkit.info/ // example-call: new SortableTable(x); // sorting by value-attribute of td-elements // only cols with sortdir-attribute in the thead-cell function sortCol(cell){ try{ var tableEl=cell; while(tableEl.tagName!="TABLE"){ tableEl=tableEl.parentNode; } var tbody=tableEl.getElementsByTagName("tbody")[0]; var sortRow=cell.parentNode; var newclass,oldclass,sortdir; // clone the rows var newRows=new Array(); for(j=0; j < tbody.rows.length; j++){ newRows[j]=tbody.rows[j]; } //sort them newRows.sort(function(a,b){ aa=parseFloat(a.cells[cell.cellIndex].getAttribute("value"),10); if (isNaN(aa)) aa=0; bb=parseFloat(b.cells[cell.cellIndex].getAttribute("value"),10); if (isNaN(bb)) bb=0; return (aa-bb); }); // set classes of headercells if (cell.getAttribute("sortdir") == "Asc"){ newRows.reverse(); sortdir="Desc"; }else{ sortdir="Asc"; } cell.setAttribute("sortdir",sortdir); for(var i=0; i<sortRow.cells.length; i++){ if(typeof(sortRow.cells[i].getAttribute("sortdir"))=="string"){ oldclass=sortRow.cells[i].getAttribute("class"); newclass=oldclass.replace(/sortableCol(.*)\b/,"sortableCol"+(i==cell.cellIndex?sortdir:"")); if(oldclass!=newclass){ sortRow.cells[i].setAttribute("class",newclass); } } } // rebuild table for(i=0;i<newRows.length;i++){ tbody.appendChild(newRows[i]); } tableEl=null;tbody=null;sortRow=null;newRows=null; }catch(err){ GM_logError("sortCol\n"+sortRow.cells[i].innerHTML+"\n"+err); } } // constructor actions try{ for(var i=0; i<sortRow.cells.length; i++){ if(typeof(sortRow.cells[i].getAttribute("sortdir"))=="string"){ var oldclass=sortRow.cells[i].getAttribute("class"); sortRow.cells[i].setAttribute("class",(oldclass?oldclass+" ":"")+"sortableCol"); sortRow.cells[i].addEventListener("click",function (){ sortCol(this); return false; },false); } } }catch(err){ GM_logError("SortableTable\n"+err); } } function bar(size,markvalue,maxvalue){ size=Math.floor(size); var mark=Math.floor(size*markvalue/maxvalue); var cell=createElement("div",{"style":"border:2px solid black; position:absolute;width:"+size+"px;height:12px;"}); createElement("div",{"style":"position:absolute;width:"+mark+"px;height:12px;background-color:#5555FF;"},cell); return cell; } function setSelRange(inputEl, selStart, selEnd){ if (inputEl.setSelectionRange){ inputEl.focus(); inputEl.setSelectionRange(selStart, selEnd); }else if (inputEl.createTextRange){ var range=inputEl.createTextRange(); range.collapse(true); range.moveEnd('character', selEnd); range.moveStart('character', selStart); range.select(); } } // Strings function getKeySymbol(keyCode){ if((46<keyCode)&&(keyCode<91)){ return String.fromCharCode(keyCode); } var codelist={"8":"backspace","9":"tab","13":"enter","16":"shift","17":"ctrl","18":"alt","19":"pause/break","20":"caps lock","27":"escape","33":"page up","34":"page down","35":"end","36":"home","37":"<-","38":"up arrow","39":"->","40":"down arrow","45":"insert","46":"delete","91":"left window key","92":"right window key","93":"select key","96":"numpad 0","97":"numpad 1","98":"numpad 2","99":"numpad 3","100":"numpad 4","101":"numpad 5","102":"numpad 6","103":"numpad 7","104":"numpad 8","105":"numpad 9","106":"*","107":"+","109":"-","110":"decimal point","111":"divide","112":"F1","113":"F2","114":"F3","115":"F4","116":"F5","117":"F6","118":"F7","119":"F8","120":"F9","121":"F10","122":"F11","123":"F12","144":"num lock","145":"scroll lock","186":"semi-colon","187":"equal sign","188":",","189":"dash","190":"period","191":"forward slash","192":"grave accent","219":"open bracket","220":"back slash","221":"close braket","222":"single quote"}; return codelist[keyCode]?codelist[keyCode]:"key("+keyCode+")"; } // Game function igm(name,append,betreff){ try{ var link=createElement("span",{"to":name,"subject":(betreff?betreff:""),"class":"link playerMsg"}); createElement("div",{},link); link.addEventListener("click",function(){ try{ if(unsafeWindow.messages_write_block == 1){ unsafeWindow.showDiv("messages_view_info"); unsafeWindow.hideDiv("messages_view_form"); }else{ unsafeWindow.hideDiv("messages_view_info"); unsafeWindow.showDiv("messages_view_form"); } $("messages_view_name").value = this.getAttribute("to"); $("messages_view_subject").value = this.getAttribute("subject"); $("messages_view_body").value = ""; unsafeWindow.hideDiv("messages_list"); unsafeWindow.hideDiv("messages_contacts"); unsafeWindow.showDiv("messages_view"); unsafeWindow.messagesNavi("new"); unsafeWindow.messagesCalcBody(); }catch(err){GM_logError("igm.click\n"+err);} },false); link.addEventListener("mouseover",function(event){ toolTip.show(event,getText("writeMessage"),this); },false); if (append){ append.appendChild(link); } return link; }catch(err){GM_logError("igm\n"+err);} } function vertrag(name,append){ var link=createElement("span",{"to":name,"class":"link playerContract"}); createElement("div",{},link); link.addEventListener("click",function(){ var pagedata=new Object(); pagedata["to"]=this.getAttribute("to"); window.setTimeout(function(){ GM_setValue(COUNTRY+"_"+SERVER+"_pagedataVertraegeNew",implode(pagedata)); if($top("multiframe")){ toolTip.hide(this); $top("multiframe").src="../vertraege/new.php"; $top("multiframe").style.display="block"; }else{ window.open("../vertraege/new.php"); } },0); },false); link.addEventListener("mouseover",function(event){ toolTip.show(event,getText("sendContract")); },false); if (append) append.appendChild(link); return link; } function stats(name,append){ var link=createElement("span", {"mouseOverText":getText("statistics"),"class":"link playerStats","href":"../stadt/stats.php?search=1&searchterm="+name}); createElement("div",{},link); if($top("shop")){ link.addEventListener("click",function(){ toolTip.hide(this); showShopframePage(this.getAttribute("href")); },false); }else{ link.addEventListener("click",function(){location.href=this.getAttribute("href");},false); } link.addEventListener("mouseover",function(event){ toolTip.show(event,this.getAttribute("mouseOverText"),this); },false); if (append) append.appendChild(link); return link; } function loadProductData(){ try{ if(DEVMODE_FUNCTION){ var trackingHandle = tracking.start("berater","loadProductData"); } gut=explode(GM_getValue(COUNTRY+"_"+SERVER+"_gut"),"loadProductData/gut",[]); gutBeob=explode(GM_getValue(COUNTRY+"_"+SERVER+"_gutBeob"),"loadProductData/gutBeob",[]); preisBeob=explode(GM_getValue(COUNTRY+"_"+SERVER+"_preisBeob"),"loadProductData/preisBeob",[]); //isNotSent,time,min,max,amount prodName=explode(GM_getValue(COUNTRY+"_"+SERVER+"_prodName"),"loadProductData/prodName",[]); prodId=explode(GM_getValue(COUNTRY+"_"+SERVER+"_prodId"),"loadProductData/prodId",[]); prodPlantSize=explode(GM_getValue(COUNTRY+"_"+SERVER+"_prodPlantSize"),"loadProductData/err/prodPlantSize",[]); prodStock=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodStock"),"loadProductData/prodStock",[]); prodStockMax=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodStockMax"),"loadProductData/prodStockMax",[]); prodYield=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodYield"),"loadProductData/prodYield",[]); prodRequire=explode(GM_getValue(COUNTRY+"_"+SERVER+"_prodRequire"),"loadProductData/prodRequire",[]); prodTyp=explode(GM_getValue(COUNTRY+"_"+SERVER+"_prodTyp"),"loadProductData/prodTyp",[]);//c:coins, v:plant, e:product, u:garbage, z:deco, f:forestry, r:recipe prodGrowTime=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodGrowTime"),"loadProductData/prodGrowTime",[]); prodPoints=explode(GM_getValue(COUNTRY+"_"+SERVER+"_prodPoints"),"loadProductData/prodPoints",[]); prodNameSort=explode(GM_getValue(COUNTRY+"_"+SERVER+"_prodNameSort"),"loadProductData/err/prodNameSort",[]); prodBlock=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodBlock"),"loadProductData/err/prodBlock",[]); prodMinRackInit=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodMinRackInit"),"loadProductData/err/prodMinRackInit",[]); prodMinRack=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodMinRack"),"loadProductData/err/prodMinRack",[]); if(DEVMODE_FUNCTION){ tracking.end("berater",trackingHandle); } }catch(err){ GM_logError("loadProductData\n"+err); } } function updateProductDataFarm(){ try{ if(DEVMODE_FUNCTION){ var trackingHandle = tracking.start("berater","updateProductDataFarm"); } if(USERLEVEL<parseInt(unsafeWindow.currentuserlevel,10)){ raiseEvent("gameUserlevelUp"); } USERLEVEL=parseInt(unsafeWindow.currentuserlevel,10); if(!(prodName instanceof Array)){ prodName=[]; } if(!(prodId instanceof Array)){ prodId=[]; } if(!(prodPlantSize instanceof Array)){ prodPlantSize=[]; } if(!(prodStock instanceof Array)){ prodStock=[]; } if(!(prodStockMax instanceof Array)){ prodStockMax=[]; } if(!(prodYield instanceof Array)){ prodYield=[]; } if(!(prodRequire instanceof Array)){ prodRequire=[]; } if(!(prodTyp instanceof Array)){ prodTyp=[]; } if(!(prodGrowTime instanceof Array)){ prodGrowTime=[]; } if(!(prodPoints instanceof Array)){ prodPoints=[]; } if(!(prodNameSort instanceof Array)){ prodNameSort=[]; } if(!(prodBlock instanceof Array)){ prodBlock=[]; } if(!prodName[0]||!(prodName[0] instanceof Array)){ prodName[0]=[]; } if(!prodId[0]||(typeof prodId[0]!="object")||(prodId[0] instanceof Array)){ prodId[0]={}; } if(!prodPlantSize[0]||!(prodPlantSize[0] instanceof Array)){ prodPlantSize[0]=[]; } if(!prodStock[0]||!(prodStock[0] instanceof Array)){ prodStock[0]=[]; } if(!prodStockMax[0]||!(prodStockMax[0] instanceof Array)){ prodStockMax[0]=[]; } if(!prodYield[0]||!(prodYield[0] instanceof Array)){ prodYield[0]=[]; } if(!prodRequire[0]||!(prodRequire[0] instanceof Array)){ prodRequire[0]=[]; } if(!prodTyp[0]||!(prodTyp[0] instanceof Array)){ prodTyp[0]=[]; } if(!prodGrowTime[0]||!(prodGrowTime[0] instanceof Array)){ prodGrowTime[0]=[]; } if(!prodPoints[0]||!(prodPoints[0] instanceof Array)){ prodPoints[0]=[]; } // if(!prodBlock[0]||!(prodBlock[0] instanceof Array)){ prodBlock[0]=[]; } //c:only by club, u:garbage, l:level too low, t:not tradable, f:forestry, q:forestry quest too low, r:recipe, p:powerup, b:block recipe/powerup prodBlock[0]=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","ct","","ct","","ct","ct","","ct","","","","","","","","","","ct","ct","ct","ct","ct","ct","ct","","","","","","","ct","","ct","","","ct","","","ct","ct","ct","","","","","","","","t","","","","","","","t","","t","t","","","","","","","","","","","","","","","","","","","","","","t","","","","","","","","","","","","","","","","","","","","","","","","","","","","","t","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","ut","ut",,,,,,,,,,,"","","","","","","","","","","","","","","t","t","t","t","t","t","t","t"]; // task_new_plant task_new_product /* var new_prodBlock=prodBlock[0].clone(); new_prodBlock[221]=""; GM_log(implode(new_prodBlock)); */ var help={"v":[],"e":[],"o":[],"fw1":[],"fw2":[],"fw3":[],"fw4":[],"z":[],"fl":[],"fla":[]}; // for(var v=1;v<unsafeWindow.produkt_name.length;v++){ for(var v in unsafeWindow.produkt_name){ if(!unsafeWindow.produkt_name.hasOwnProperty(v)){continue;} if(isNaN(gut[v])){ gut[v]=0; } prodName[0][v]=unsafeWindow.produkt_name[v]; prodId[0][prodName[0][v]]=v; prodPlantSize[0][v]=unsafeWindow.produkt_x[v]*unsafeWindow.produkt_y[v]; var c=(unsafeWindow.rackElement[v]&&unsafeWindow.rackElement[v].number)?unsafeWindow.rackElement[v].number:0; prodStock[0][v]=(c?parseInt(c,10):0); prodYield[0][v]=(unsafeWindow.produkt_ernte[v]?parseInt(unsafeWindow.produkt_ernte[v],10):0); prodTyp[0][v]=unsafeWindow.produkt_category[v]; prodRequire[0][v]=PRODUCT_REQUIRE[0][v]; prodGrowTime[0][v]=PRODUCT_GROWTIME[0][v]; //TODO take from game? prodPoints[0][v]=PRODUCT_POINTS[0][v]; //TODO take from game? if(prodTyp[0][v]=="u"){ prodBlock[0][v]="ut"; }else{ if(typeof prodBlock[0][v]=="undefined"){ prodBlock[0][v]="t"; } // Hack: split picnic products in different categories if(prodTyp[0][v]=="fw"){ // task_new_picnic_product switch(parseInt(v,10)){ case 130:case 131:case 132:case 133:case 134:case 135:case 145:case 146:case 147: prodTyp[0][v]+="1"; break; case 136:case 137:case 138:case 139:case 140:case 141:case 142:case 143:case 148:case 149:case 150: prodTyp[0][v]+="2"; break; case 161:case 162:case 163:case 164:case 165:case 166:case 167:case 168:case 169:case 170: prodTyp[0][v]+="3"; break; default: prodTyp[0][v]+="4"; } } if(help[prodTyp[0][v]]){ help[prodTyp[0][v]].push(v); } if(USERLEVEL<unsafeWindow.produkt_level[v]){ prodBlock[0][v]+="l"+unsafeWindow.produkt_level[v]; } if(PRODUCT_QUEST[0][v]&&(questData[PRODUCT_QUEST[0][v][0]][PRODUCT_QUEST[0][v][1]]["nr"]<=PRODUCT_QUEST[0][v][2])){ prodBlock[0][v]+="q"; } } } prodTyp[0][0]="c"; try{ prodStock[0][0]=parseInt($("coins").innerHTML,10); }catch(err){} prodNameSort[0]=[0].concat(help["v"],help["e"],help["o"],help["fw1"],help["fw2"],help["fw3"],help["fw4"],help["fl"],help["fla"],help["z"]); // quest boni for(var v=1;v<questData["main"]["1"]["nr"];v++){ if(QUESTS["main"]["1"][v]&&QUESTS["main"]["1"][v][3]){ for(var w=0;w<QUESTS["main"]["1"][v][3].length;w++){ if(QUESTS["main"]["1"][v][3][w][0]==4){ prodGrowTime[QUESTS["main"]["1"][v][3][w][1]][QUESTS["main"]["1"][v][3][w][2]]-=QUESTS["main"]["1"][v][3][w][3]; } } } } publishProductData(); if(DEVMODE_FUNCTION){ tracking.end("berater",trackingHandle); } }catch(err){ GM_logError("updateProductDataFarm\n"+err); loadProductData(); } } function updateProductDataForestry(){ try{ if(DEVMODE_FUNCTION){ var trackingHandle = tracking.start("berater","updateProductDataForestry"); } prodName[1]={}; if(!prodId[1]||(typeof prodId[1]!="object")||(prodId[1] instanceof Array)){ prodId[1]={}; } if(!prodPlantSize[1]||(typeof prodPlantSize[1]!="object")||(prodPlantSize[1] instanceof Array)){ prodPlantSize[1]={}; } if(!prodStock[1]||(typeof prodStock[1]!="object")||(prodStock[1] instanceof Array)){ prodStock[1]={}; } if(!prodStockMax[1]||(typeof prodStockMax[1]!="object")||(prodStockMax[1] instanceof Array)){ prodStockMax[1]={}; } if(!prodYield[1]||(typeof prodYield[1]!="object")||(prodYield[1] instanceof Array)){ prodYield[1]={}; } if(!prodRequire[1]||(typeof prodRequire[1]!="object")||(prodRequire[1] instanceof Array)){ prodRequire[1]={}; } if(!prodTyp[1]||(typeof prodTyp[1]!="object")||(prodTyp[1] instanceof Array)){ prodTyp[1]={}; } if(!prodGrowTime[1]||(typeof prodGrowTime[1]!="object")||(prodGrowTime[1] instanceof Array)){ prodGrowTime[1]={}; } if(!prodPoints[1]||(typeof prodPoints[1]!="object")||(prodPoints[1] instanceof Array)){ prodPoints[1]={}; } if(!prodNameSort[1]||!(prodNameSort[1] instanceof Array)){ prodNameSort[1]=[]; } if(!prodBlock[1]||(typeof prodBlock[1]!="object")||(prodBlock[1] instanceof Array)){ prodBlock[1]={}; } var help={"f1":[],"f2":[],"f3":[],"f4":[],"f5":[]}; for(var v in unsafeWindow.produkt_name_forestry){ if(!unsafeWindow.produkt_name_forestry.hasOwnProperty(v)){continue;} prodName[1][v]=unsafeWindow.produkt_name_forestry[v]; prodId[1][prodName[1][v]]=v; prodPlantSize[1][v]=1; // prodStock // prodStockMax prodYield[1][v]=PRODUCT_YIELD[1][v]; if((v==105)||(v==108)||(v==116)||(v==117)||(v==119)||(v==120)){ prodTyp[1][v]="f5"; } // farmhouse-items from carpentry else if(v<20){ prodTyp[1][v]="f1"; } // saplings else if(v<40){ prodTyp[1][v]="f2"; } // logs else if(v<100){ prodTyp[1][v]="f3"; } // sawmill-products else if(v<500){ prodTyp[1][v]="f4"; } // carpentry-products else { prodTyp[1][v]="u"; } // useless "products" prodRequire[1][v]=PRODUCT_REQUIRE[1][v]; prodGrowTime[1][v]=PRODUCT_GROWTIME[1][v]; prodPoints[1][v]=PRODUCT_POINTS[1][v]; if(prodTyp[1][v]=="u"){ prodBlock[1][v]="qtu"; }else{ prodBlock[1][v]="t"; if((unsafeWindow.forestry_unlock==undefined)||(PRODUCT_QUEST[1][v]&&(questData[PRODUCT_QUEST[1][v][0]][PRODUCT_QUEST[1][v][1]]["nr"]<=PRODUCT_QUEST[1][v][2]))){ prodBlock[1][v]+="q"; } if(v==113||v==114){ prodBlock[1][v]+="s"; } if(help[prodTyp[1][v]]){ help[prodTyp[1][v]].push(v); } } } prodNameSort[1]=help["f1"].concat(help["f2"],help["f3"],help["f4"],help["f5"]); // prodName[1].sortObj(); publishProductData(); if(DEVMODE_FUNCTION){ tracking.end("berater",trackingHandle); } }catch(err){ GM_logError("updateProductDataForestry\n"+err); } } function updateProductDataWindmill(){ try{ if(DEVMODE_FUNCTION){ var trackingHandle = tracking.start("berater","updateProductDataWindmill"); } if(!prodName[2]||!(prodName[2] instanceof Array)){ prodName[2]=[]; } if(!prodId[2]||(typeof prodId[2]!="object")||(prodId[2] instanceof Array)){ prodId[2]={}; } if(!prodPlantSize[2]||!(prodPlantSize[2] instanceof Array)){ prodPlantSize[2]=[]; } if(!prodStock[2]||!(prodStock[2] instanceof Array)){ prodStock[2]=[]; } if(!prodStockMax[2]||!(prodStockMax[2] instanceof Array)){ prodStockMax[2]=[]; } // if(!prodYield[2]||!(prodYield[2] instanceof Array)){ prodYield[2]=[]; } // if(!prodRequire[2]||!(prodRequire[2] instanceof Array)){ prodRequire[2]=[]; } if(!prodTyp[2]||!(prodTyp[2] instanceof Array)){ prodTyp[2]=[]; } // if(!prodGrowTime[2]||!(prodGrowTime[2] instanceof Array)){ prodGrowTime[2]=[]; } // if(!prodPoints[2]||!(prodPoints[2] instanceof Array)){ prodPoints[2]=[]; } if(!prodBlock[2]||!(prodBlock[2] instanceof Array)){ prodBlock[2]=[]; } prodYield[2]=[]; prodRequire[2]=[]; prodGrowTime[2]=[]; prodPoints[2]=[]; // GM_log("formulas:\n"+print_r(unsafeWindow.formulas,"",true,"\n")); for(var v in unsafeWindow.formulas[0]){ if(!unsafeWindow.formulas[0].hasOwnProperty(v)){continue;} pId=unsafeWindow.formulas[0][v][0]; // GM_log("updateProductDataWindmill loop formulas v="+v+" pId="+pId); prodName[2][pId]="*"+unsafeWindow.formulas[0][v][2]; prodId[2]["*"+unsafeWindow.formulas[0][v][2]]=pId; prodId[2][unsafeWindow.formulas[0][v][2]]=pId; prodPlantSize[2][pId]=1; if(!prodStock[2][pId]||(typeof prodStock[2][pId]!="number")){ prodStock[2][pId]=0; } //1=earn prods,2=earn extra amount,3=earn extra score if(unsafeWindow.formulas[0][v][5][0]!=0){ prodTyp[2][pId]="r0"; } else if(unsafeWindow.formulas[0][v][5][1]!=0){ prodTyp[2][pId]="r1"; } else if(unsafeWindow.formulas[0][v][5][2]!=0){ prodTyp[2][pId]="r2" } prodBlock[2][pId]="rt"+(USERLEVEL<unsafeWindow.formulas[0][v][1]?"l":"")+(unsafeWindow.formulas[0][v]["endremain"]<0?"s":""); } // prodTyp[2].sortObj(); var help={"r0":[],"r1":[],"r2":[]}; for(var v in prodTyp[2]){ if(!prodTyp[2].hasOwnProperty(v)){continue;} if(help[prodTyp[2][v]]){ help[prodTyp[2][v]].push(v); } } prodNameSort[2]=help["r0"].concat(help["r1"],help["r2"]); publishProductData(); if(DEVMODE_FUNCTION){ tracking.end("berater",trackingHandle); } }catch(err){ GM_logError("updateProductDataWindmill\n"+err); } } function updateProductDataPowerup(){ try{ if(DEVMODE_FUNCTION){ var trackingHandle = tracking.start("berater","updateProductDataPowerup"); } if(!prodName[3]||!(prodName[3] instanceof Array)){ prodName[3]=[]; } if(!prodId[3]||(typeof prodId[3]!="object")||(prodId[3] instanceof Array)){ prodId[3]={}; } if(!prodPlantSize[3]||!(prodPlantSize[3] instanceof Array)){ prodPlantSize[3]=[]; } if(!prodStock[3]||!(prodStock[3] instanceof Array)){ prodStock[3]=[]; } if(!prodStockMax[3]||!(prodStockMax[3] instanceof Array)){ prodStockMax[3]=[]; } if(!prodYield[3]||!(prodYield[3] instanceof Array)){ prodYield[3]=[]; } if(!prodRequire[3]||!(prodRequire[3] instanceof Array)){ prodRequire[3]=[]; } if(!prodTyp[3]||!(prodTyp[3] instanceof Array)){ prodTyp[3]=[]; } if(!prodGrowTime[3]||!(prodGrowTime[3] instanceof Array)){ prodGrowTime[3]=[]; } if(!prodPoints[3]||!(prodPoints[3] instanceof Array)){ prodPoints[3]=[]; } if(!prodBlock[3]||!(prodBlock[3] instanceof Array)){ prodBlock[3]=[]; } var pId; for(var v in unsafeWindow.formulas[0]){ if(!unsafeWindow.formulas[0].hasOwnProperty(v)){continue;} pId=unsafeWindow.formulas[0][v][0]; // GM_log("updateProductDataPowerup loop formulas v="+v+" pId="+pId); prodName[3][pId]=unsafeWindow.formulas[0][v][2]; prodPlantSize[2][pId]=1; prodStock[3][pId]=0; prodYield[3][pId]=1; prodRequire[3][pId]=[[2,pId,1]]; for(var i=0;i<unsafeWindow.formulas[0][v][3].length;i++){ prodRequire[3][pId].push([0,unsafeWindow.formulas[0][v][3][i][0],unsafeWindow.formulas[0][v][3][i][1]]); } //1=earn prods,2=earn extra amount,3=earn extra score if(unsafeWindow.formulas[0][v][5][0]!=0){ prodTyp[3][pId]="p0"; } else if(unsafeWindow.formulas[0][v][5][1]!=0){ prodTyp[3][pId]="p1"; } else if(unsafeWindow.formulas[0][v][5][2]!=0){ prodTyp[3][pId]="p2"; } prodGrowTime[3][pId]=Math.round(unsafeWindow.formulas[0][v][4]/60); prodPoints[3][pId]=unsafeWindow.formulas[0][v][8]; prodBlock[3][pId]="pt"+(USERLEVEL<unsafeWindow.formulas[0][v][1]?"l":""); } if (unsafeWindow.poweruprack == null) unsafeWindow.poweruprack = 0; for(var v in unsafeWindow.poweruprack){ if(!unsafeWindow.poweruprack.hasOwnProperty(v)){continue;} pId=unsafeWindow.poweruprack[v][0]; // GM_log("updateProductDataPowerup loop poweruprack v="+v+" pId="+pId); prodName[3][pId]=unsafeWindow.poweruprack[v][2]; prodStock[3][pId]=unsafeWindow.poweruprack[v]["rack"]; if(unsafeWindow.poweruprack[v]["endremain"]<0){ prodBlock[3][pId]+="s"; } } for(var v=0;v<prodName[3].length;v++){ prodId[3][prodName[3][v]]=v; } // prodTyp[3].sortObj(); var help={"p0":[],"p1":[],"p2":[]}; for(var v in prodTyp[3]){ if(!prodTyp[3].hasOwnProperty(v)){continue;} if(help[prodTyp[3][v]]){ help[prodTyp[3][v]].push(v); } } prodNameSort[3]=help["p0"].concat(help["p1"],help["p2"]); publishProductData(); if(DEVMODE_FUNCTION){ tracking.end("berater",trackingHandle); } }catch(err){ GM_logError("updateProductDataPowerup\n"+err); } } function publishProductData(){ window.setTimeout(function(){ try{ if(DEVMODE_FUNCTION){ var trackingHandle = tracking.start("berater","publishProductData"); } top.unsafeData.prodName =prodName.clone(); top.unsafeData.prodNameSort =prodNameSort.clone(); top.unsafeData.prodTyp =prodTyp.clone(); top.unsafeData.prodBlock =prodBlock.clone(); top.unsafeData.prodYield =prodYield.clone(); top.unsafeData.prodRequire =prodRequire.clone(); top.unsafeData.prodStock =prodStock.clone(); top.unsafeData.prodStockMax =prodStockMax.clone(); top.unsafeData.prodGrowTime =prodGrowTime.clone(); top.unsafeData.prodPlantSize=prodPlantSize.clone(); top.unsafeData.prodPoints =prodPoints.clone(); top.unsafeData.prodId =prodId.clone(); top.unsafeData.gut =gut.clone(); top.unsafeData.preisBeob =explode(GM_getValue(COUNTRY+"_"+SERVER+"_preisBeob","[]"),"publishProductData/preisBeob",[]).clone(); if(DEVMODE_FUNCTION){ tracking.end("berater",trackingHandle); } }catch(err){ GM_logError("publishProductData\n"+err); } },0); } function saveProductData(){ try{ if(DEVMODE_FUNCTION){ var trackingHandle = tracking.start("berater","saveProductData"); } GM_setValue(COUNTRY+"_"+SERVER+"_prodName",implode(prodName,"saveProductData\prodName")); GM_setValue(COUNTRY+"_"+SERVER+"_prodNameSort",implode(prodNameSort,"saveProductData\prodNameSort")); GM_setValue(COUNTRY+"_"+SERVER+"_prodId",implode(prodId,"saveProductData\prodId")); GM_setValue(COUNTRY+"_"+SERVER+"_prodPoints",implode(prodPoints,"saveProductData\prodPoints")); GM_setValue(COUNTRY+"_"+SERVER+"_prodPlantSize",implode(prodPlantSize,"saveProductData\prodPlantSize")); GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodStock",implode(prodStock,"saveProductData\prodStock")); GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodStockMax",implode(prodStockMax,"saveProductData\prodStockMax")); GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodYield",implode(prodYield,"saveProductData\prodYield")); GM_setValue(COUNTRY+"_"+SERVER+"_prodRequire",implode(prodRequire,"saveProductData\prodRequire")); GM_setValue(COUNTRY+"_"+SERVER+"_prodTyp",implode(prodTyp,"saveProductData\prodTyp")); GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodGrowTime",implode(prodGrowTime,"saveProductData\prodGrowTime")); GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodBlock",implode(prodBlock,"saveProductData\prodBlock")); GM_setValue(COUNTRY+"_"+SERVER+"_gut",implode(gut,"saveProductData\gut")); GM_setValue(COUNTRY+"_"+SERVER+"_gutBeob",implode(gutBeob,"saveProductData\gutBeob")); if(DEVMODE_FUNCTION){ tracking.end("berater",trackingHandle); } }catch(err){ GM_logError("saveProductData\n"+err); } } /* function checkRequest(request){ if((request.readyState==4)&&(request.status==200)){ var response=request.responseText; if(response!=0){ var result=eval('('+response+')'); if(result[0]!=0){ return result; } } } return null; } */ // function for validation of AJAX-response. taken from game and shrunk on return value function checkRequest(request, mode) { try{ if (request.readyState == 4 && request.status == 200) { response = request.responseText; if ((response!="failed") && (response!="maintenance") && (response!=0)) { var result = eval("(" + response + ")"); if (result.datablock) { return result.datablock; } else { return result; } } } return 0; }catch(err){GM_logError("checkRequest\n"+err);return null;} } function showMultiframePage(page){ try{ //GM_log("showMultiframePage:"+page); top.window.wrappedJSObject.gclr(); top.window.wrappedJSObject.clr(); var i=0,help; while (help=$top("kunde"+(i++))){ help.style.display="none"; } closeInfoPanel(); if(help=$top("einkaufszettel")){ help.style.display="none"; } if(help=$top("popup_garden")){ help.style.display="block"; } if(help=$top("multiframe")){ help.style.display="block"; } if(help=$top("multiframe")){ help.src=page; } }catch(err){GM_logError("showMultiframePage page="+page+"\n"+err);} } function showShopframePage(page){ var cell=$top("shop"); if(cell){ if (top.window.wrappedJSObject.city!=1){ top.document.addEventListener("gameCity1",function(){ GM_log("showShopframePage:in stad 1"); top.document.removeEventListener("gameCity1",arguments.callee,false); showShopframePage(page); },false); click($top("speedlink_city1")); }else if (cell.style.display!="block"){ cell.style.display="block"; cell.style.visibility="visible"; cell=$top("transp3"); cell.style.display="block"; cell.style.visibility="visible"; showShopframePage(page); }else{ $top("travel2city").style.display="none"; $top("shopframe").src=page; } //closeInfoPanel(); }else{ location.href=page; } cell=null; } function showMessage(from,page,msg){ //GM_log("showMessage:"+from+":"+page+":"+msg); //click($top("menueimg1")); showMultiframePage("http://s"+SERVER+"."+GAMEPAGES[COUNTRY]+"/nachrichten/read.php?from="+from+"&page="+page+"&msg="+msg+"&mass=0"); } function showSGH(){ top.document.addEventListener("gameCity1",function(){ click($top("cityzone_1_2")); top.document.removeEventListener("gameCity1",arguments.callee,false); },false); click($top("speedlink_city1")); } function showLottery(){ var div=$top("speedlink_city2"); if(div&&($top("lotterycontainer"))){ top.document.addEventListener("gameCity2",function(){ click($top("cityzone_2_8")); top.document.removeEventListener("gameCity2",arguments.callee,false); },false); click(div); } div=null; } function goToDonkey(){ try{ var div; if((gameLocation[0]=="farm")&&(gameLocation[1]==0)){ if(div=$("farm_inner_waltraud")){ click(div); } }else if(div=$("speedlink_farm1")){ document.addEventListener("gameFarmOpened",function(){ document.removeEventListener("gameFarmOpened",arguments.callee,false); window.setTimeout(goToDonkey,100); },false); click(div); } div=null; }catch(err){GM_logError("goToDonkey\n"+err);} } function showGoToMarketToolTip(event,prod,add1,add2){ var str='<table>'; str += '<tr><th colspan="2" class="lightBg">'+getText("goToMarketOfX").replace(/%1%/,prodName[0][prod])+'</th></tr>'; if(add1){ str += add1; str += '<tr><td colspan="2" style="border-bottom:1px solid black;"></td></tr>'; } str += '<tr><td>'+getText("marketPrice")+'</td><td style="text-align:right;">'+(gut[prod]>=100?moneyFormatInt(gut[prod]):moneyFormat(gut[prod]))+'</td></tr>'; str += '<tr><td>'+getText("inventory")+'</td><td style="text-align:right;">'+numberFormat(prodStock[0][prod])+'</td></tr>'; str += '<tr><td>'+getText("value")+'</td><td style="text-align:right;">'+moneyFormatInt(gut[prod]*prodStock[0][prod])+'</td></tr>'; if(add2){ str += '<tr><td colspan="2" style="border-bottom:1px solid black;"></td></tr>'; str += add2; } str += '</table>'; toolTip.show(event,str); str=null; } function showStatisticFullscreen(pid){ var mode=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeStatistic"),"showStatisticFullscreen/modeStatistic"); var newdiv=createElement("div",{"style":"position:absolute;top:0;left:0;height:"+window.innerHeight+"px;width:"+window.innerWidth+"px;background-color:white;color:black;z-index:995;"},ALL,getText("loading")+"..."); var url=STAT_VIEW[COUNTRY]+"/chart.php?w="+window.innerWidth+"&h="+window.innerHeight+"&t=h"+mode["time"]+"&shownpc="+(mode["npc"]?1:0)+"&clip=1&server1="+SERVER+"&product1="+pid+"&color1=green"; var newobject=createElement("object",{"data":url,"type":"type=image/svg+xml","style":"position:absolute;top:0;left:0;","width":window.innerWidth+"px","height":window.innerHeight+"px"},newdiv); createElement("param",{"name":"src","value":url},newobject); var newimg=createElement("img",{"src":GFX+"close.jpg","class":"link","style":"position:absolute;top:30px;right:10px;z-index:2;"},newdiv); newimg.addEventListener("click",function(){removeElement(this.parentNode);},false); newimg=createElement("div",{"style":"position:absolute;top:0px;left:40%;padding:5px;z-index:2;border-width:0px 2px 2px 2px;border-style:solid;border-radius:0px 0px 10px 10px;background-color:white;"},newdiv); produktPic(0,pid,newimg); createElement("span",{"style":"font-weight:bold;"},newimg,prodName[0][pid]); newdiv=null;newobject=null;newimg=null; } function calcProductionTime(buildingType,productType,productId,bonus,feedTime,feedAmount){ // bonus like 0.85 try{ var time; switch(buildingType){ case 1: case "forest": time=calcGrowDuration(prodGrowTime[productType][productId]*60,bonus); break; case 2: var totalTime=prodGrowTime[productType][productId]*60*bonus; time=totalTime; if(!feedAmount){ feedAmount=Math.ceil(totalTime/feedTime); } totalTime*=0.5; if(unsafeWindow.premium==0 && USERLEVEL>9){ totalTime+=5; } // hack: non-premiums cant feed completely for(var i=1;i<=feedAmount;i++){ if(time-feedTime>=totalTime){ time-=feedTime; } else { break; } } totalTime=null; time=[time,i-1]; break; case 3: case 4: time=prodGrowTime[productType][productId]*60*bonus; break; case "windmill": time=parseInt(unsafeWindow.formulas[0][productId][4],10); //time*=bonus; break; case "forest": time=calcGrowDuration(prodGrowTime[productType][productId]*60,bonus); break; case "sawmill": case "carpentry": time=prodGrowTime[productType][productId]*60*bonus; break; } return time; }catch(err){GM_logError("calcProductionTime product:"+[productType,productId]+" bonus="+bonus+" \n"+err);return 0;} } function calcGrowDuration(growDurationInitial,bonus){ //growDurationInitial in seconds, bonus like 0.85 var gesamtdauer=0; while(growDurationInitial>0){ growDurationInitial *= bonus; var help=Math.min(growDurationInitial,86400); growDurationInitial -= help; gesamtdauer += help; } return Math.round(gesamtdauer); } function calcGrowTimes(growDurationInitial,period,bonus){ return period/calcGrowDuration(growDurationInitial,bonus); } // Zones var zones=new function(){ var data; const INIT_zoneItem={"animals":null,"block":"blpqs","bonus":0,"bonusSpecial":null,"building":null,"crop":[],"endproduct":null,"endtime":NEVER,"mainproduct":null,"production":[[{},{}],0,0,true],"slots":null,"watertime":NEVER}; const INIT_zoneSlotItem={"block":"blpqs"}; this.init=function(){ try{ data=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_zones","{}"),"zones.init/data",{}); for(var zoneNrF in data){ if(!data.hasOwnProperty(zoneNrF)){ continue; } if((typeof data[zoneNrF]!="object")||(data[zoneNrF] instanceof Array)){ zones.create(zoneNrF); } } }catch(err){GM_logError("zones.init\n"+err);} } this.save=function(){ try{ GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_zones",implode(data,"zones.save/data")); }catch(err){GM_logError("zones.save\n"+err);} } this.create=function(zoneNrF){ try{ data[zoneNrF]=INIT_zoneItem.clone(); if(isNaN(zoneNrF)){ var building; switch(zoneNrF){ case "farmersmarket-0": building="fl0";break; case "farmersmarket-1": building="fl1";break; case "farmersmarket-2": building="fl2";break; case "farmersmarket-3": building="fl3";break; case "farmersmarket-4": building="fl4";break; case "farmersmarket-5": building="fl5";break; case "farmersmarket-6": building="fl6";break; case "windmill": building="windmill";break; case "forest": building="forest";break; case "sawmill": building="sawmill";break; case "carpentry": building="carpentry";break; case "foodworld-0": building="fw0";break; case "foodworld-1": building="fw1";break; case "foodworld-2": building="fw2";break; case "foodworld-3": building="fw3";break; case "foodworld-4": building="fw4";break; default: building=null; } zones.setBuilding(zoneNrF,building); } }catch(err){GM_logError("zones.create\n"+err);} } this.swap=function(zoneNr1,zoneNr2){ try{ if(data[zoneNr1]&&data[zoneNr1]){ var help=data[zoneNr1].clone(); data[zoneNr1]=data[zoneNr2].clone(); data[zoneNr2]=help; } }catch(err){GM_logError("zones.swap\n"+err);} } // Values this.setAnimals=function(zoneNrF,value){ try{ if(!data[zoneNrF]){ zones.create(zoneNrF); } if(data[zoneNrF]["animals"]!=value){ data[zoneNrF]["animals"]=value; zones.save(); calcTotalAnimals(); } }catch(err){GM_logError("zones.setAnimals\n"+err);} } this.getAnimals=function(zoneNr){ try{ var zoneNrF=zoneNr.toString().replace(/\.\d+$/g,""); if(data[zoneNrF]){ return data[zoneNrF]["animals"]; }else{ return INIT_zoneItem["animals"]; } }catch(err){GM_logError("zones.getAnimals\n"+err);} } this.setBlock=function(zoneNr,value){ // b: payment // l: level requirement // p: premium-feature // q: quest // s: status // t: type (not handled) try{ zoneNr=zoneNr.toString(); var slot=(zoneNr.match(/\.(\d+)$/)?parseInt(/\.(\d+)$/.exec(zoneNr)[1],10):null); var zoneNrF=zoneNr.replace(/\.\d+$/g,""); if(!data[zoneNrF]){ zones.create(zoneNrF); } if(slot){ if(data[zoneNrF]["slots"][slot]["block"]!=value){ data[zoneNrF]["slots"][slot]["block"]=value; zones.save(); } }else if(data[zoneNrF]["block"]!=value){ data[zoneNrF]["block"]=value; zones.save(); } }catch(err){GM_logError("zones.setBlock zoneNr="+zoneNr+"\n"+implode(data[zoneNrF])+"\n"+err);} } this.getBlock=function(zoneNr){ try{ zoneNr=zoneNr.toString(); var slot=(zoneNr.match(/\.(\d+)$/)?parseInt(/\.(\d+)$/.exec(zoneNr)[1],10):null); var zoneNrF=zoneNr.replace(/\.\d+$/g,""); if(!data[zoneNrF]){ return INIT_zoneItem["block"]; }else if(data[zoneNrF]["block"]){ return data[zoneNrF]["block"]; }else if(slot&&data[zoneNrF]["slots"]){ return data[zoneNrF]["slots"][slot]["block"]; }else{ return ""; } }catch(err){GM_logError("zones.getBlock zoneNr="+zoneNr+"\n"+err);} } this.setBonus=function(zoneNrF,value){ try{ if(!data[zoneNrF]){ zones.create(zoneNrF); } if(data[zoneNrF]["bonus"]!=value){ data[zoneNrF]["bonus"]=value; zones.save(); } }catch(err){GM_logError("zones.setBonus\n"+err);} } this.getBonus=function(zoneNr){ try{ var zoneNrF=zoneNr.toString().replace(/\.\d+$/g,""); if(data[zoneNrF]){ return data[zoneNrF]["bonus"]; }else{ return INIT_zoneItem["bonus"]; } }catch(err){GM_logError("zones.getBonus\n"+err);} } this.setBonusSpecial=function(zoneNrF,value){ try{ if(!data[zoneNrF]){ zones.create(zoneNrF); } if(data[zoneNrF]["bonusSpecial"]==null){ if(value!=null){ data[zoneNrF]["bonusSpecial"]=value; zones.save(); } }else if((value==null)||(data[zoneNrF]["bonusSpecial"][0]!=value[0])||(data[zoneNrF]["bonusSpecial"][1]!=value[1])){ data[zoneNrF]["bonusSpecial"]=value; zones.save(); } }catch(err){GM_logError("zones.setBonusSpecial\n"+err);} } this.getBonusSpecial=function(zoneNr){ try{ var zoneNrF=zoneNr.toString().replace(/\.\d+$/g,""); if(data[zoneNrF]){ return data[zoneNrF]["bonusSpecial"]; }else{ return INIT_zoneItem["bonusSpecial"]; } }catch(err){GM_logError("zones.getBonusSpecial\n"+err);} } this.setBuilding=function(zoneNrF,value){ /* BUILDING NAME TYPE 0 empty 1 Field Field 2 Chickens Stable 3 Cows Stable 4 Sheep Stable 5 Bees Stable 6 Clubhouse 7 Cheese Factory 8 Mayo Factory 9 Whool Factory 10 Bonbons Factory 11 Fishs Stable 12 Goats Stable 13 Oil Factory 14 Special-Oil Factory 15 Angora shed Stable 16 Knitting mill Factory 17 Architectural office 18 Pony farm 19 Megafield Factory fw1 Soda stall Foodworld fw2 Snack booth Foodworld fw3 Pastry shop Foodworld fl1 Flower meadow Farmersmarket fl2 Flower workshop Farmersmarket fl3 Farmersmarket */ try{ if(!data[zoneNrF]){ zones.create(zoneNrF); } if(data[zoneNrF]["building"]!=value){ data[zoneNrF]["building"]=value; switch(value){ case 13: // Oil case 14: // Special oil case 16: // Knitting case "windmill": case "sawmill": case "carpentry": case "fw1": case "fw2": case "fw3": // Foodworld case "fl2": // Flowers data[zoneNrF]["slots"]=[]; for(var i=1;i<=3;i++){ data[zoneNrF]["slots"][i]=INIT_zoneSlotItem.clone(); } break; default: data[zoneNrF]["slots"]=null; } zones.save(); } }catch(err){GM_logError("zones.setBuilding\n"+err);} } this.getBuilding=function(zoneNr){ try{ var zoneNrF=zoneNr.toString().replace(/\.\d+$/g,""); if(data[zoneNrF]){ return data[zoneNrF]["building"]; }else{ return INIT_zoneItem["building"]; } }catch(err){GM_logError("zones.getBuilding zoneNr="+zoneNr+"\n"+err);} } this.getBuildingName=function(zoneNr){ try{ return getBuildingName(zones.getBuilding(zoneNr)); }catch(err){GM_logError("zones.getBuildingName\n"+err);} } this.getLocation=function(zoneNr){ try{ var zoneNrF=zoneNr.toString().replace(/\.\d+$/g,""); if(DATA_zones[zoneNrF]){ return DATA_zones[zoneNrF]; }else{ GM_logWarning("getLocation returns null\nzoneNr="+zoneNr); return null; } }catch(err){ GM_logError("getLocation\n"+err);return null; } } // Production this.setProduction=function(zoneNrS,value){ // production[0][i]={"id":item,...} // i = product-type // case production : item=[[amount,points,endtime,nextwatertime],...] // - amount : amount of production with these times // - points : points given for this production // - endtime : time of cropping (without future waterings) // - nextwatertime : NEVER if not possible to water in future // case deco : item=[[amount1,time1],[amount2,time2],...] // case garbage : item=amount // production[1]=[,int,int,,int]||int : free places for currently planting with that size // production[2]=[,int,int,,int]||int : free places for possibly planting with that size (cropped field) // production[3]=true||false : flag if data is ready try{ if(!data[zoneNrS]){ zones.create(zoneNrS); } data[zoneNrS]["production"]=value; zones.processProduction(zoneNrS); }catch(err){GM_logError("zones.setProduction\n"+err);} } this.getProduction=function(zoneNrS){ try{ if(data[zoneNrS]){ return data[zoneNrS]["production"]; }else{ return INIT_zoneItem["production"]; } }catch(err){GM_logError("zones.getProduction\n"+err);} } this.processProduction=function(zoneNrS){ try{ if(DEVMODE_FUNCTION){ var trackingHandle = tracking.start("berater","zones.processProduction",[zoneNrS]); } var err_trace="begin"; var zoneNrF=zoneNrS.toString().replace(/\.\d+$/g,""); var help; data[zoneNrS]["crop"]=new Array(); data[zoneNrS]["endtime"]=NEVER; data[zoneNrS]["endproduct"]=null; data[zoneNrS]["watertime"]=NEVER; data[zoneNrS]["mainproduct"]=null; if(!zones.getBlock(zoneNrS)){ var currLocation=zones.getLocation(zoneNrS).location; var currBonus=zones.getBonus(zoneNrS); var currBonusSpecial=zones.getBonusSpecial(zoneNrS); var zoneErnteCurr=new Object(); var iZoneTyp=zones.getBuilding(zoneNrS); var isProductional=zones.isProductional(zoneNrS); var nowServer=unsafeWindow.Zeit.Server; var c=0,item; err_trace="product loop"; for(var iType=0;iType<data[zoneNrS]["production"][0].length;iType++){ for(var iProdStr in data[zoneNrS]["production"][0][iType]){ if(!data[zoneNrS]["production"][0][iType].hasOwnProperty(iProdStr)){ continue; } var iProd = parseInt(iProdStr,10); if((prodTyp[iType][iProd]!="u")&&(prodTyp[iType][iProd]!="z")){ // only products item=data[zoneNrS]["production"][0][iType][iProdStr]; for(var i=0;i<item.length;i++){ var z=item[i][2]; var w=item[i][3]; if (data[zoneNrS]["mainproduct"]==iProd){ c += item[i][0]; } else{ c -= item[i][0]; } if (c<1){ data[zoneNrS]["mainproduct"]=iProd; c=item[i][0]; } if (!zoneErnteCurr[iType]){ zoneErnteCurr[iType]={}; } if (!zoneErnteCurr[iType][iProdStr]){ zoneErnteCurr[iType][iProdStr]=[0,0]; } zoneErnteCurr[iType][iProdStr][0] += item[i][0]; zoneErnteCurr[iType][iProdStr][1] += item[i][1]; if(w){ data[zoneNrS]["watertime"]=Math.min(data[zoneNrS]["watertime"],w); if(valAssumeWater[currLocation]&&(nowServer<=z)&&(w<=z)){ // calculate future watering // w<nowServer means that now can be watered. because it isnt watered, assume that watering is not wanted // if (nowServer<=w){ w=Math.max(0,Math.min(86400,w-nowServer)); // time till watering z-=nowServer; // remaining time z=nowServer+w+calcGrowDuration(z-w,(100-currBonus-((currBonusSpecial&&(iProd==currBonusSpecial[0]))?currBonusSpecial[1]:0))/100); } } if (z < data[zoneNrS]["endtime"]){ data[zoneNrS]["endtime"]=z; data[zoneNrS]["endproduct"]=iProd; } } } } } if(isProductional){ for(var iTypeStr in zoneErnteCurr){ if(!zoneErnteCurr.hasOwnProperty(iTypeStr)){ continue; } for(var iProdStr in zoneErnteCurr[iTypeStr]){ if(!zoneErnteCurr[iTypeStr].hasOwnProperty(iProdStr)){ continue; } if(iTypeStr=="0"){ // zoneErnteCurr[iTypeStr][iProdStr][0] /= 10; // Fix Seberoth ... why ... TODO! } data[zoneNrS]["crop"].push([parseInt(iTypeStr,10),parseInt(iProdStr,10)].concat(zoneErnteCurr[iTypeStr][iProdStr])); } } } // too many empty fields err_trace="empty fields"; if(now<data[zoneNrS]["endtime"]){ if(!isNaN(valLimitEmptyFields[iZoneTyp])){ if(data[zoneNrS]["production"][1][1]>valLimitEmptyFields[iZoneTyp]){ data[zoneNrS]["endtime"]=NEVER; data[zoneNrS]["endproduct"]=null; } }else if(valGlobaltimeShowCroppedZone[currLocation]&&(data[zoneNrS]["production"][1][1]>0)){ data[zoneNrS]["endtime"]=NEVER; data[zoneNrS]["endproduct"]=null; } } // create watering timer if(iZoneTyp==1){ var farmNR=Math.floor((zoneNrF-1)/6)+1; var zoneNr=zoneNrF-6*(farmNR-1); createZoneTimer("zoneTimerWater_"+zoneNrS,zoneNrS,"zoneTimerWater","top:20px;left:5px;",$("farm"+farmNR+"_pos"+zoneNr)); } } err_trace="readyZone"; zones.checkReady(zoneNrS); err_trace="timer"; updateZoneTimer("zoneTimer_"+zoneNrS,zoneNrS,"zonetimer"); updateZoneTimer("zoneTimerWater_"+zoneNrS,zoneNrS,"zoneTimerWater"); updateZoneTimer("globalZoneTimer_"+zoneNrS,zoneNrS,"zonetimer"); updateZoneTimer("globalZoneTimerWater_"+zoneNrS,zoneNrS,"zoneTimerWater"); calcTotalEndtime(); zones.save(); if(DEVMODE_FUNCTION){ tracking.end("berater",trackingHandle); } }catch(err){ GM_logError("zones.processProduction ("+err_trace+") zoneNrS="+zoneNrS+" iProdStr="+iProdStr+" \n"+err); } } this.flagProduction=function(zoneNrS){ try{ if(!data[zoneNrS]){ zones.create(zoneNrS); } data[zoneNrS]["production"][3]=false; }catch(err){GM_logError("zones.flagProduction\n"+err);} } this.getEndproduct=function(zoneNr){ try{ if(data[zoneNr]&&data[zoneNr]["endproduct"]){ return data[zoneNr]["endproduct"]; }else{ return INIT_zoneItem["endproduct"]; } }catch(err){GM_logError("zones.getEndproduct\n"+err);} } this.getEndtime=function(zoneNr){ try{ if(data[zoneNr]&&data[zoneNr]["endtime"]){ return data[zoneNr]["endtime"]; }else{ return INIT_zoneItem["endtime"]; } }catch(err){GM_logError("zones.getEndtime\n"+err);} } this.getWatertime=function(zoneNr){ try{ if(data[zoneNr]&&data[zoneNr]["watertime"]){ return data[zoneNr]["watertime"]; }else{ return INIT_zoneItem["watertime"]; } }catch(err){GM_logError("zones.getWatertime\n"+err);} } this.getCrop=function(zoneNr){ // {"prodId1":[amount1,points1],"prodId2":[amount2,points2],...} try{ if(data[zoneNr]&&data[zoneNr]["crop"]){ return data[zoneNr]["crop"]; }else{ return INIT_zoneItem["crop"]; } }catch(err){GM_logError("zones.getCrop\n"+err);} } this.getMainproduct=function(zoneNr){ try{ if(data[zoneNr]&&data[zoneNr]["mainproduct"]){ return data[zoneNr]["mainproduct"]; }else{ return INIT_zoneItem["mainproduct"]; } }catch(err){GM_logError("zones.getMainproduct\n"+err);} } this.checkReady=function(zoneNrS){ try{ var readyZoneAdded=0; if((!zones.getBlock(zoneNrS))&&(zones.isProductional(zoneNrS))){ var zoneNrF=zoneNrS.toString().replace(/\.\d+$/g,""); var farmNR=Math.floor((zoneNrF-1)/6)+1; var zoneNr=zoneNrF-6*(farmNR-1); var currZoneType=zones.getBuilding(zoneNrF); var currLocation=zones.getLocation(zoneNrF); var zT=zones.getEndtime(zoneNrS); var zTw=zones.getWatertime(zoneNrS); var div; if (zT==NEVER){ // empty if(unsafeData.readyZone[zoneNrS]&&(unsafeData.readyZone[zoneNrS][1]=="e")){ if(!unsafeData.readyZone[zoneNrS][2]){ unsafeData.readyZone[zoneNrS][2]=true; } }else{ unsafeData.readyZone[zoneNrS]=[currLocation.farmNr==undefined?currLocation.location:currLocation.farmNr,"e",true]; readyZoneAdded=1; } if((currZoneType==1)&&(div=$("farm_production_ready"+farmNR+"_"+zoneNr))){ div.setAttribute("class","farm_production_ready1 fieldReady"); } }else if(zT<=unsafeWindow.Zeit.Server){ //READY if(unsafeData.readyZone[zoneNrS]&&(unsafeData.readyZone[zoneNrS][1]=="r")){ if(!unsafeData.readyZone[zoneNrS][2]){ unsafeData.readyZone[zoneNrS][2]=true; } }else{ if(DEVMODE){GM_log("checkReady readyZone add=READY zoneNrS="+zoneNrS);} unsafeData.readyZone[zoneNrS]=[currLocation.farmNr==undefined?currLocation.location:currLocation.farmNr,"r",true]; readyZoneAdded=1; } if((currZoneType==1)&&(div=$("farm_production_ready"+farmNR+"_"+zoneNr))){ div.setAttribute("class","farm_production_ready1 fieldReady"); } // running (unsafeWindow.Zeit.Server<zT) }else if(valWaterNeeded[currLocation.location]&&(zTw<unsafeWindow.Zeit.Server)&&(zones.getBonus(zoneNrF)>0)){ //zTw<zT removes the watertimer if ready later then the field timer if(unsafeData.readyZone[zoneNrS]&&(unsafeData.readyZone[zoneNrS][1]=="w")){ if(!unsafeData.readyZone[zoneNrS][2]){ unsafeData.readyZone[zoneNrS][2]=true; } }else{ if(DEVMODE){GM_log("checkReady readyZone add:WATER zoneNrS:"+zoneNrS);} unsafeData.readyZone[zoneNrS]=[currLocation.farmNr==undefined?currLocation.location:currLocation.farmNr,"w",true]; readyZoneAdded=1; } if((currZoneType==1)&&(div=$("farm_production_ready"+farmNR+"_"+zoneNr))){ div.setAttribute("class","farm_production_ready1 fieldWaterReady blinking"); } }else if(unsafeData.readyZone[zoneNrS]){ if(DEVMODE){GM_log("checkReady readyZone add:DELETE zoneNrS:"+zoneNrS);} delete unsafeData.readyZone[zoneNrS]; if((currZoneType==1)&&(div=$("farm_production_ready"+farmNR+"_"+zoneNr))){ div.setAttribute("class","farm_production_ready1"); } } div=null; } return readyZoneAdded; }catch(err){GM_logError("zones.checkReady zoneNrS="+zoneNrS+"\n"+err);} } // Type this.isMultiSlot=function(zoneNrF){ try{ if(!data[zoneNrF]){ zones.create(zoneNrF); } if(data[zoneNrF]["slots"]==null){ return false; }else{ return true; } }catch(err){GM_logError("isMultiSlot\n"+err);} } this.isProductional=function(zoneNr){ try{ var zoneNrF=zoneNr.toString().replace(/\.\d+$/g,""); if(DATA_zones[zoneNrF]){ return DATA_zones[zoneNrF]["productional"]; }else{ GM_logWarning("zones.isProductional returns null\nzoneNr="+zoneNr); return null; } }catch(err){ GM_logError("zones.isProductional\n"+err);return null; } } } unsafeData.zones=zones; function getBuildingName(building){ try{ if(unsafeWindow.buildinginfos[0][building]){ return unsafeWindow.buildinginfos[0][building][10]; }else if(getText(building)){ return getText(building); }else{ return "???"; } }catch(err){GM_logError("getBuildingName\n"+err);} } // Totals function calcTotalRecursive(recursionCount,stack){ try{ if(DEVMODE_FUNCTION){ var trackingHandle = tracking.start("berater","calcTotalRecursive",[recursionCount]); } if(recursionCount>100){throw("TOO MUCH RECURSION")} var err_trace="init"; var help; var next=false; var nextStack={}; if(!stack){ totalRecursive=new Array(new Object(),new Object(),new Object(),new Object()); stack=prodStock.clone(); for(var type in prodMinRack){ if(!prodMinRack.hasOwnProperty(type)){ continue; } for(var iProd in prodMinRack[type]){ if (!prodMinRack[type].hasOwnProperty(iProd)){ continue; } if(!stack[type]){ stack[type]={}; } stack[type][iProd]-=prodMinRack[type][iProd]; } } } err_trace="step"; for(var type in stack){ if(!stack.hasOwnProperty(type)){ continue; } for(var iProd in stack[type]){ if(!stack[type].hasOwnProperty(iProd)){ continue; } if(stack[type][iProd]<0){ if((typeof prodRequire[type][iProd]=="object")&&(totalZones[PRODUCT2BUILDING[type][iProd]]>0)){ err_trace="prodRequire"; for(var i=0;i<prodRequire[type][iProd].length;i++){ err_trace="prodRequire "+i; if(prodRequire[type][iProd][i][0]>-1){ help=-stack[type][iProd]/prodYield[type][iProd]*prodRequire[type][iProd][i][2]; if(!nextStack[prodRequire[type][iProd][i][0]]){ nextStack[prodRequire[type][iProd][i][0]]={}; } if(!nextStack[prodRequire[type][iProd][i][0]][prodRequire[type][iProd][i][1]]){ nextStack[prodRequire[type][iProd][i][0]][prodRequire[type][iProd][i][1]]=0; } next=true; nextStack[prodRequire[type][iProd][i][0]][prodRequire[type][iProd][i][1]]-=help; if(!totalRecursive[prodRequire[type][iProd][i][0]][prodRequire[type][iProd][i][1]]){ totalRecursive[prodRequire[type][iProd][i][0]][prodRequire[type][iProd][i][1]]=0; } totalRecursive[prodRequire[type][iProd][i][0]][prodRequire[type][iProd][i][1]]+=help; } } } } } } if(next){ calcTotalRecursive(++recursionCount,nextStack); } if(DEVMODE_FUNCTION){ tracking.end("berater",trackingHandle); } }catch(err){ GM_logError("calcTotalRecursive ("+err_trace+")\ntype="+type+" iProd="+iProd+" help="+implode(help)+" i="+i+"\n"+err); } } function calcTotalErnte(){ try{ var help; totalErnte=new Array(new Object(),new Object(),new Object(),new Object()); for(var i in ALL_ZONES){ if(!ALL_ZONES.hasOwnProperty(i)){ continue; } for(var j=0;j<ALL_ZONES[i].length;j++){ try{ var zoneNrF=ALL_ZONES[i][j]; if(help=zones.getCrop(zoneNrF)){ for(var k=0;k<help.length;k++){ if(!totalErnte[help[k][0]][help[k][1]]){ totalErnte[help[k][0]][help[k][1]]=0; } totalErnte[help[k][0]][help[k][1]] += help[k][2]; } } }catch(err){ GM_logError("calcTotalErnte loop\ni="+i+" j="+j+" zoneNrF="+zoneNrF+" help="+implode(help)+"\n"+err); } } } //GM_log("calcTotalErnte totalErnte:"+implode(totalErnte)); }catch(err){ GM_logError("calcTotalErnte\nzoneNrF="+zoneNrF+"\n"+err); } } function calcTotalFarmis(){ try{ totalFarmis[0]=new Object(); var farmiNr=-1; // GM_log("farmisinfo:\n"+print_r(unsafeWindow.farmisinfo,"",true,"\n")); // GM_log("farmilist:\n"+print_r(unsafeWindow.farmilist,"",true,"\n")); if(top.window.wrappedJSObject.farmisinfo&&top.window.wrappedJSObject.farmisinfo[0]){ for(var farmiNr in top.window.wrappedJSObject.farmisinfo[0]){ // loop through all farmis... if(!top.window.wrappedJSObject.farmisinfo[0].hasOwnProperty(farmiNr)){continue;} if(top.window.wrappedJSObject.farmilist[farmiNr]==1){ // ...which are waiting... // {"id":integer(string),"pic":integer(string),"verkauft":"0","price":float(string),"p1":prod(string),"a1":amount(string),...,"p7":...,"a7":...} if(valFarmiLimits[0]<=top.window.wrappedJSObject.farmisinfo[0][farmiNr]["costQuotient"]){ // ...and pay enough for(var i=1 ; i <= 7 ; i++){ // 7=max-amount of products per farmi var pid=top.window.wrappedJSObject.farmisinfo[0][farmiNr]["p"+i]; var amount=parseInt(top.window.wrappedJSObject.farmisinfo[0][farmiNr]["a"+i],10); if((pid > 0) && (amount > 0)){ if (totalFarmis[0][pid]) totalFarmis[0][pid] += amount; else totalFarmis[0][pid]=amount; } } } } } // totalFarmis[0].sortObj(); } }catch(err){GM_logError("calcTotalFarmis \n"+err);} //GM_log("calcTotalFarmis totalFarmis:"+implode(totalFarmis[0])); //calcProdMinRack(); //TODO possible security error this in wrappedJSObject .. and the calcProMinRack/doBuyNotePad is in unsafeWindow } function calcTotalPowerups(){ try{ totalPowerups=new Object(); if(unsafeWindow.poweruprack){ for(var v in unsafeWindow.poweruprack){ if(!unsafeWindow.poweruprack.hasOwnProperty(v)){continue;} if(unsafeWindow.poweruprack[v][5] && unsafeWindow.poweruprack[v][5][0]){ //problem in the game made this visible var k=parseInt(unsafeWindow.poweruprack[v][5][0][0],10); totalPowerups[k]=parseInt(unsafeWindow.poweruprack[v]["rack"],10)*parseInt(unsafeWindow.poweruprack[v][5][0][1],10); } } } //GM_log("calcTotalPowerups totalPowerups:"+implode(totalPowerups)); }catch(err){ GM_logError("calcTotalPowerups\n"+err); } } function calcTotalQuest(quTyp){ try{ // GM_log("calcTotalQuest quTyp="+quTyp); totalQuest[quTyp]=new Array(new Object(),new Object()); var questCurr; for(var camp in questData[quTyp]){ if (!questData[quTyp].hasOwnProperty(camp)){ continue; } // GM_log("calcTotalQuest camp="+camp); // GM_log("questData["+quTyp+"]["+camp+"]="+implode(questData[quTyp][camp])); if(questData[quTyp][camp]["calcTo"]>0){ questCurr=questData[quTyp][camp]["data"]; // GM_log("calcTotalQuest questCurr="+implode(questCurr)); if(questCurr&&questCurr[0]){ for(var j=0;j<questCurr[0].length;j++){ if(questCurr[0][j][3]){ if(!totalQuest[quTyp][questCurr[0][j][0]][questCurr[0][j][1]]){ totalQuest[quTyp][questCurr[0][j][0]][questCurr[0][j][1]]=0; } totalQuest[quTyp][questCurr[0][j][0]][questCurr[0][j][1]]+=questCurr[0][j][2]; } } } for(var pTyp in questData[quTyp][camp]["given"]){ if (!questData[quTyp][camp]["given"].hasOwnProperty(pTyp)){ continue; } for(var p in questData[quTyp][camp]["given"][pTyp]){ if (!questData[quTyp][camp]["given"][pTyp].hasOwnProperty(p)){ continue; } if(totalQuest[quTyp][pTyp]&&totalQuest[quTyp][pTyp][p]){ totalQuest[quTyp][pTyp][p]=Math.max(0,totalQuest[quTyp][pTyp][p]-questData[quTyp][camp]["given"][pTyp][p]); } } } for(var q=questData[quTyp][camp]["nr"]+1;q<=questData[quTyp][camp]["calcTo"];q++){ // GM_log("calcTotalQuest q="+q); if(QUESTS[quTyp][camp][q]){ for(var j=0;j<QUESTS[quTyp][camp][q][0].length;j++){ questCurr=getQuestBestAlternative(QUESTS[quTyp][camp][q][0][j]); if(!totalQuest[quTyp][questCurr[0]][questCurr[1]]){ totalQuest[quTyp][questCurr[0]][questCurr[1]]=0; } totalQuest[quTyp][questCurr[0]][questCurr[1]]+=questCurr[2]; } } } } } // GM_log("totalQuest["+quTyp+"]="+implode(totalQuest[quTyp])); }catch(err){ GM_logError("calcTotalQuest quTyp="+quTyp+" camp="+camp+" q="+q+"\n"+err); } // GM_log("calcTotalQuest END"); } function calcTotalZones(){ try{ totalZones=new Object(); var zoneNrF,currZoneTyp; for(var i in ALL_ZONES){ if(!ALL_ZONES.hasOwnProperty(i)){ continue; } for(var j=0;j<ALL_ZONES[i].length;j++){ try{ zoneNrF=ALL_ZONES[i][j]; if(!zones.getBlock(zoneNrF)){ currZoneTyp=zones.getBuilding(zoneNrF) if(!totalZones[currZoneTyp]){ totalZones[currZoneTyp]=0; } totalZones[currZoneTyp]++; } }catch(err){ GM_logError("calcTotalErnte loop\ni="+i+" j="+j+" zoneNrF="+zoneNrF+"\n"+err); } } } }catch(err){ GM_logError("calcTotalZones\n"+err); } } function calcTotalAnimals(){ try{ totalAnimals=[,,0,0,0,0,,,,,,0,0]; var help; for(var i=0;i<ALL_ZONES["farm"].length;i++){ help=zones.getAnimals(ALL_ZONES["farm"][i]); if(help>0){ totalAnimals[zones.getBuilding(ALL_ZONES["farm"][i])]+=help; } } }catch(err){ GM_logError("calcTotalAnimals\n"+err); } } function calcTotalEndtime(){ try{ totalEndtime=NEVER; for(var i in ALL_ZONES){ if(!ALL_ZONES.hasOwnProperty(i)){ continue; } for(var j=0;j<ALL_ZONES[i].length;j++){ zoneNrF=ALL_ZONES[i][j]; if((!zones.getBlock(zoneNrF))&&(zones.getBuilding(zoneNrF)!=0)&&((i=="farm")||zoneAddToGlobalTime[zoneNrF])){ help=zones.getEndtime(zoneNrF); if(help==NEVER){ if(valGlobaltimeShowCroppedZone[i]){ totalEndtime=-1; GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_totalEndtime",totalEndtime); return; } }else{ totalEndtime=Math.min(totalEndtime,help); if(valWaterNeeded[i]){ totalEndtime=Math.min(totalEndtime,zones.getWatertime(zoneNrF)); } } } } } GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_totalEndtime",totalEndtime); }catch(err){ GM_logWarning("calcTotalEndtime\ni="+i+" j="+j+" zoneNrF="+zoneNrF+"\n"+err); } } // calcProdMinRackInit: sets base values // -> calcProdMinRack: adds quests, farmis, growing, addons, forestry // (calls calcTotalQuest,calcTotalErnte) // -> doBuyNotepad, doRack, TODO doFarmis! // TODO: switch this logic to: calcTotalX -> calcProdMinRack function calcProdMinRackInit(){ try{ if(DEVMODE_FUNCTION){ var trackingHandle = tracking.start("berater","calcProdMinRackInit"); } prodMinRackInit=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodMinRackInit"),"calcProdMinRackInit/prodMinRackInit",[[],{},{},{}]); if(!(prodMinRackInit instanceof Array)){ prodMinRackInit=[]; } for(var type in prodName){ if(!prodName.hasOwnProperty(type)){continue;} if(type==1){ if((!prodMinRackInit[type])||(typeof prodMinRackInit[type]!="object")||(prodMinRackInit[type] instanceof Array)){ prodMinRackInit[type]={}; } }else{ if((!prodMinRackInit[type])||(!(prodMinRackInit[type] instanceof Array))){ prodMinRackInit[type]=[]; } } if(!valMinRackMan){ // detail-setting option (else see buildPreise) for(var prod in prodName[type]){ //GM_log("prodName type:"+type+" prod:"+prod); if(!prodName[type].hasOwnProperty(prod)){continue;} if((!valMinRack[prodTyp[type][prod]])||(prodBlock[type][prod])){ // .match(/t/) prodMinRackInit[type][prod]=0; }else if(prodTyp[type][prod]=="v"){ prodMinRackInit[type][prod]=valMinRack[prodTyp[type][prod]]/(valMinRackPlantsize?prodPlantSize[type][prod]:1); }else{ prodMinRackInit[type][prod]=valMinRack[prodTyp[type][prod]]; } } } // prodMinRackInit[type].sortObj(); } GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodMinRackInit",implode(prodMinRackInit,"calcProdMinRackInit\prodMinRackInit")); unsafeData.prodMinRackInit=prodMinRackInit.clone(); calcProdMinRack(); if(DEVMODE_FUNCTION){ tracking.end("berater",trackingHandle); } }catch(err){ GM_logError("calcProdMinRackInit\ntype="+type+" prod="+prod+"\n"+err); } } function calcProdMinRack(caller){ try{ if(DEVMODE){ GM_log("begin calcProdMinRack"); } prodMinRack=prodMinRackInit.clone(); // Quest var err_trace="quest"; for(var quTyp in QUESTS){ if(!QUESTS.hasOwnProperty(quTyp)){ continue; } calcTotalQuest(quTyp); for(var type in totalQuest[quTyp]){ if(!totalQuest[quTyp].hasOwnProperty(type)){ continue; } for(var prod in totalQuest[quTyp][type]){ if(!totalQuest[quTyp][type].hasOwnProperty(prod)){ continue; } if(!prodMinRack[type][prod]){prodMinRack[type][prod]=0;} prodMinRack[type][prod] += totalQuest[quTyp][type][prod]; } } } // Farmis err_trace="farmis"; if(valMinRackFarmis){ for(var prod in totalFarmis[0]){ if(!totalFarmis[0].hasOwnProperty(prod)){ continue; } if(!prodMinRack[0][prod]){ prodMinRack[0][prod]=0;} prodMinRack[0][prod] += totalFarmis[0][prod]; } } if(valMinRackForestryFarmis){ for(var prod in totalFarmis[1]){ if(!totalFarmis[1].hasOwnProperty(prod)){ continue; } if(!prodMinRack[1][prod]){ prodMinRack[1][prod]=0;} prodMinRack[1][prod] += totalFarmis[1][prod]; } } // Addons err_trace="prodMinRackAddon"; for(var type in prodMinRackAddon){ if (!prodMinRackAddon.hasOwnProperty(type)){ continue; } for(var prod in prodMinRackAddon[type]){ if(!prodMinRackAddon[type].hasOwnProperty(prod)){ continue; } if(prodMinRackAddon[type][prod]){ for(var k in prodMinRackAddon[type][prod]){ if(!prodMinRackAddon[type][prod].hasOwnProperty(k)){ continue; } if(!prodMinRack[type][prod]){prodMinRack[type][prod]=0;} prodMinRack[type][prod] += prodMinRackAddon[type][prod][k]; } } } } // Growing products err_trace="growing"; if(valMinRackGrowing){ calcTotalErnte(); for(var type in totalErnte){ if (!totalErnte.hasOwnProperty(type)){ continue; } for(var prod in totalErnte[type]){ if(!totalErnte[type].hasOwnProperty(prod)){ continue; } if(!prodMinRack[type][prod]){prodMinRack[type][prod]=0;} prodMinRack[type][prod] -= totalErnte[type][prod]; } } for(var prod in totalPowerups){ if(!totalPowerups.hasOwnProperty(prod)){ continue; } if(!prodMinRack[0][prod]){prodMinRack[0][prod]=0;} prodMinRack[0][prod] -= totalPowerups[prod]; } } err_trace="recursive"; //GM_log("Before calcTotalRecursive prodMinRack:"+implode(prodMinRack[1])); if(valMinRackRecursive){ calcTotalRecursive(1); // recursive need products calculation for(var type in totalRecursive){ if (!totalRecursive.hasOwnProperty(type)){ continue; } for(var prod in totalRecursive[type]){ if(!totalRecursive[type].hasOwnProperty(prod)){ continue; } if(!prodMinRack[type][prod]){ prodMinRack[type][prod]=0; } prodMinRack[type][prod] += totalRecursive[type][prod]; } } } //GM_log("After calcTotalRecursive totalRecursive:"+implode(totalRecursive)); //GM_log("After calcTotalRecursive prodMinRack:"+implode(prodMinRack[1])); //GM_log("After calcTotalRecursive prodStock:"+implode(prodStock[1])); // delete wrong values err_trace="QA"; for(var type in prodMinRack){ if (!prodMinRack.hasOwnProperty(type)){ continue; } for(var prod in prodMinRack[type]){ if(!prodMinRack[type].hasOwnProperty(prod)){ continue; } try{ if(prodMinRack[type][prod]<0){ // delete negatives prodMinRack[type][prod]=0; }else if((type==0)&&(prodBlock[0][prod].match(/l/))){ // delete non-availables prodMinRack[type][prod]=0; } }catch(err){} } } err_trace="save"; unsafeData.prodMinRack=prodMinRack.clone(); unsafeData.prodMinRackSettings = {"valMinRackGrowing":valMinRackGrowing,"valMinRackFarmis":valMinRackFarmis,"valMinRackFarmis":valMinRackFarmis,"valMinRackRecursive":valMinRackRecursive}; GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodMinRack",implode(prodMinRack)); doBuyNotepad(); doRack(); doFarmis(); raiseEvent("gameCalcProdMinRack"); if(DEVMODE){ GM_log("end calcProdMinRack"); } }catch(err){ GM_logError("calcProdMinRack ("+err_trace+")\ntype="+type+" prod="+prod+"\n"+err); } } function getQuestBestAlternative(arr){ // item=[prodType,prodId,amount]. arr=item or arr=[item,item,...] if(typeof arr[0]=="object"){ var returnId,minPrice=null,currPrice; for(var k=0;k<arr.length;k++){ if(arr[k][0]!=0){ currPrice=0; }else if(isNaN(NPC[0][arr[k][1]])){ currPrice=arr[k][2]*gut[arr[k][1]]; }else{ currPrice=arr[k][2]*Math.min(gut[arr[k][1]],NPC[0][arr[k][1]]); } if((minPrice==null)||(currPrice<minPrice)){ minPrice=currPrice; returnId=k; } } return arr[returnId]; } if(typeof arr=="object"){ return arr; } else { GM_logWarning("getQuestBestAlternative bad call arr="+implode(arr)); return []; } } unsafeData.getQuestBestAlternative=getQuestBestAlternative; function setCalcToQuest(type,campaign,nr){ try{ // GM_log("setCalcToQuest type="+type+" campaign="+campaign+" nr="+nr); if(QUESTS[type]&&QUESTS[type][campaign]&&questData[type][campaign]){ questData[type][campaign]["calcTo"] = Math.min(nr,QUESTS[type][campaign].length); GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_questData",implode(questData)); unsafeData.questData=questData.clone(); // if(farmiLog){ doFarmis(); } //hack bypass early call calcProdMinRack(); handleQuestLine(); } }catch(err){ GM_logError("setCalcToQuest\n"+err); } } unsafeData.setCalcToQuest=setCalcToQuest; function handleQuestLine(){ try{ // GM_log("unsafeWindow.quests_status:\n"+print_r(unsafeWindow.quests_status,"",true,"\n")); var div,help; for(var type in questData){ if (!questData.hasOwnProperty(type)){ continue; } for(var campaign in questData[type]){ if(!questData[type].hasOwnProperty(campaign)){continue;} // GM_log("questData["+type+"]["+campaign+"]:\n"+print_r(questData[type][campaign],"",true,"\n")); if((type=="foodworld")&&unsafeWindow.quests_status&&unsafeWindow.quests_status[type]&&unsafeWindow.quests_status[type][campaign]&&unsafeWindow.quests_status[type][campaign]["data"]){ unsafeWindow.quests_status[type][campaign]["questid"]=unsafeWindow.quests_status[type][campaign]["data"]["questid"]; //Bugfix } if(unsafeWindow.quests_status&&unsafeWindow.quests_status[type]&&unsafeWindow.quests_status[type][campaign]){ help=parseInt(unsafeWindow.quests_status[type][campaign]["questid"],10); if(isNaN(help)){ help=1; }; switch(implode([type,campaign])){ case implode(["main","2"]):{ if(USERLEVEL<31){ help=-1; } break;} case implode(["forestry","1"]):{ if(USERLEVEL<20){ help=-1; } break;} case implode(["forestry","2"]):{ if(questData["forestry"]["1"]["nr"]<35){ help=-1; } break;} case implode(["foodworld","1"]):{ if(USERLEVEL<12){ help=-1; } break;} } // if((type=="forestry")&&(campaign=="2")){ help++; } // Bugfix if(questData[type][campaign]["nr"]!=help){ switch(type){ case "main":{ logBubble.add(getText("pleaseOpenX").replace(/%1%/,getText("quest"+type+campaign))+" ("+questData[type][campaign]["nr"]+"≠"+help+")"); break;} case "forestry":{ logBubble.add(getText("pleaseOpenX").replace(/%1%/,getText("lodge"))+" ("+questData[type][campaign]["nr"]+"≠"+help+")"); break;} case "foodworld":{ logBubble.add(getText("pleaseOpenX").replace(/%1%/,getText("foodworld"))+" ("+questData[type][campaign]["nr"]+"≠"+help+")"); break;} } if(!QUESTS[type][campaign][questData[type][campaign]["nr"]]){ questData[type][campaign]["nr"]=help; questData[type][campaign]["given"] = new Object(); questData[type][campaign]["time"] = 0; GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_questData",implode(questData)); unsafeData.questData=questData.clone(); } } }else{ help=QUESTS[type][campaign].length; switch(implode([type,campaign])){ case implode(["main","2"]):{ if(USERLEVEL<31){ help=-1; } break;} case implode(["forestry","1"]):{ if(USERLEVEL<20){ help=-1; } break;} case implode(["forestry","2"]):{ if(questData["forestry"]["1"]["nr"]<35){ help=-1; } break;} case implode(["foodworld","1"]):{ if(USERLEVEL<12){ help=-1; } break;} } if(questData[type][campaign]["nr"]!=help){ questData[type][campaign]["nr"]=help; questData[type][campaign]["given"] = new Object(); questData[type][campaign]["time"] = 0; GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_questData",implode(questData)); unsafeData.questData=questData.clone(); } } if(div=$("quests_status_bar_"+type+campaign)){ if(questData[type][campaign]["nr"]==0){ div.style.display="block"; // quest number unknown switch(type){ case "main":{ logBubble.add(getText("informationIsMissing")+" "+getText("pleaseOpenX").replace(/%1%/,getText("quest"+type+campaign))); break;} case "forestry":{ logBubble.add(getText("informationIsMissing")+" "+getText("pleaseOpenX").replace(/%1%/,getText("lodge"))); break;} case "foodworld":{ logBubble.add(getText("informationIsMissing")+" "+getText("pleaseOpenX").replace(/%1%/,getText("foodworld"))); break;} } }else if((questData[type][campaign]["nr"]==-1)||(questData[type][campaign]["calcTo"]==-1)){ div.style.display="none"; // do not show quest }else if(QUESTS[type][campaign][questData[type][campaign]["nr"]]){ div.style.display="block"; // quest available }else{ div.style.display="none"; // all quests done } if(!unsafeWindow.premium){ switch(type){ case "forestry":{ div.addEventListener("click",function(){ if((gameLocation[0]=="city")&&(gameLocation[1]==2)){ unsafeWindow.close_page(); unsafeWindow.showDiv("transp3"); unsafeWindow.initCampaigns(); }else{ document.addEventListener("gameCity2",function(){ document.removeEventListener("gameCity2",arguments.callee,false); unsafeWindow.close_page(); unsafeWindow.showDiv("transp3"); unsafeWindow.initCampaigns(); },false); click($("speedlink_city2")); } },false); break;} case "foodworld":{ div.addEventListener("click",function(){ if(gameLocation[0]=="foodworld"){ click($("foodworld_questblock")); }else{ document.addEventListener("gameFoodworldOpened",function(){ document.removeEventListener("gameFoodworldOpened",arguments.callee,false); click($("foodworld_questblock")); },false); click($("speedlink_foodworld")); } },false); break;} } } } } } div=null; }catch(err){GM_logError("handleQuestLine\ntype="+type+"\ncampaign="+campaign+"\n"+err);} }; //*********************************************************************************************************** function do_shop(){ if(pageZusatz["s"]=="3"){ // Decoration - Shop npcSaison=explode(GM_getValue(COUNTRY+"_"+SERVER+"_NpcSaison"),"do_shop/npcSaison",INIT_NPC_SAISON); for(var v in npcSaison){ if(!npcSaison.hasOwnProperty(v)){ continue; } npcSaison[v]=(document.getElementsByClassName("s"+v).length>0); } unsafeData.npcSaison=npcSaison.clone(); GM_setValue(COUNTRY+"_"+SERVER+"_NpcSaison",implode(npcSaison)); } } function do_stats(){ var canddiv; var currStat="1"; try{ currStat=pageZusatz["type"]; } catch(err){ currStat="1"; } if (typeof pageZusatz["search"]!="undefined"){ currStat="0"; } if (typeof pageZusatz["guildsearch"]!="undefined"){ unsafeWindow.initGuildsearch(); $("guildname").value=pageZusatz["guildsearch"]; unsafeWindow.stats_searchGuild(); } switch (currStat){ case "0": // Einzelspieler try { loadProductData(); var newdiv=$("spielerinfo"); var newdiv1; for(var v=0;v<newdiv.childElementCount;v++){ newdiv1=createElement("div",{"class":"hoverBgLightblue","style":"height:15px;width:100%;"}); newdiv.insertBefore(newdiv1,newdiv.children[v]); newdiv1.appendChild(newdiv.children[v+1]); // left cell newdiv1.appendChild(newdiv.children[v+1]); // right cell removeElement(newdiv.children[v+1]); // br node } canddiv=$("spielerinfo").getElementsByClassName("cright3"); var thisUser=/(.*?) /.exec(canddiv[0].firstElementChild.innerHTML+" ")[1]; canddiv[0].insertBefore(vertrag(thisUser),canddiv[0].firstElementChild); canddiv[0].insertBefore(stats(thisUser),canddiv[0].firstElementChild); canddiv[0].insertBefore(igm(thisUser),canddiv[0].firstElementChild); var nextQuest=parseInt(canddiv[5].innerHTML,10)+1; if(QUESTS["main"]["1"][nextQuest]){ canddiv[5].parentNode.setAttribute("nextQuest",nextQuest); canddiv[5].parentNode.addEventListener("mouseover",function(event){ var nextQuest=this.getAttribute("nextQuest"); var str="<div style='border-bottom:1px solid black;'>"+getText("quest_farm")+" "+nextQuest+"</div>"; for(var i=0;i<QUESTS["main"]["1"][nextQuest][0].length;i++){ if(typeof QUESTS["main"]["1"][nextQuest][0][i][0]=="object"){ for(var j=0;j<QUESTS["main"]["1"][nextQuest][0][i].length;j++){ str += "<div>*"+numberFormat(QUESTS["main"]["1"][nextQuest][0][i][j][2])+" "+prodName[QUESTS["main"]["1"][nextQuest][0][i][j][0]][QUESTS["main"]["1"][nextQuest][0][i][j][1]]+"</div>"; } }else{ str += "<div>"+numberFormat(QUESTS["main"]["1"][nextQuest][0][i][2])+" "+prodName[QUESTS["main"]["1"][nextQuest][0][i][0]][QUESTS["main"]["1"][nextQuest][0][i][1]]+"</div>"; } } toolTip.show(event,str); },false); } nextQuest=null; } catch(err){} break; // Spielerlisten case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "10": case "11": if($("rankinghead")){ canddiv=createElement("input",{"class":"text","maxlength":"5","style":"margin-left:10px;width:40px;"},$("rankinghead")); canddiv.addEventListener("mouseover",function(event){ toolTip.show(event,getText("goToRank")); },false); canddiv.addEventListener("change",function(){ var ranksPerPage=15; var targetPage=parseInt(this.value,10); if(targetPage>0){ targetPage=Math.ceil(targetPage/ranksPerPage); location.href="stats.php?page="+targetPage+"&type="+currStat; }else{ this.value=""; } },false); } canddiv=$("rankingcontent").getElementsByClassName("stats_name"); for(var v=0;v<canddiv.length;v++){ thisUser=/(.*?) /.exec(canddiv[v].firstElementChild.innerHTML+" ")[1]; thisGuild=/ \[(.*?)\] /.exec(canddiv[v].firstElementChild.innerHTML+" "); var help=canddiv[v].firstElementChild.innerHTML.replace(thisUser,"<a href='stats.php?search=1&searchterm="+thisUser+"'>"+thisUser+"</a>"); if(thisGuild) help=help.replace(thisGuild[0]," [<a href='stats.php?guildsearch="+thisGuild[1]+"'>"+thisGuild[1]+"</a>] "); canddiv[v].firstElementChild.innerHTML=help; canddiv[v].insertBefore(igm(thisUser),canddiv[v].firstElementChild); } break; } canddiv=null; } function do_wettbewerb(){ // in .de not used anymore var candtd=document.getElementsByTagName("table")[1].getElementsByTagName("td"); for(var v=6;v<candtd.length;v=v+3){ var thisUser=/(.*?) /.exec(candtd[v].firstElementChild.innerHTML+" ")[1]; igm(thisUser,candtd[v]); } candtd=null; } //*********************************************************************************************************** unsafeWindow.buildInfoPanel=function(mode,mode2){ try{ if(typeof mode2=="undefined"){ mode2=""; } var div,div1; if(!(div=$("infoPanel"))){ if(div1=$("garten_komplett")){ div=createElement("div",{"id":"infoPanel","mode":"","style":"z-index:100;background-color:rgba(0,0,0,0.7);position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;display:none;"},div1); div1=createElement("div",{"style":"position:absolute;top:50px;left:20px;width:660px;height:580px;"},div); }else{ div=createElement("div",{"id":"infoPanel","mode":"","style":"z-index:100;background-color:rgba(0,0,0,0.7);position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;display:none;"},ALL); div1=createElement("div",{"style":"position:absolute;top:50px;left:100px;width:660px;height:580px;"},div); } createElement("img",{"src":GFX+"guild/help_back.jpg","style":"position:absolute;top:0;left:0;width:100%;height:100%;z-index:-1;"},div1); createElement("div",{"id":"infoPanelInner","style":"position:absolute;top:0;left:0;width:596px;height:516px;margin:32px;overflow:none;"},div1); div1=createElement("img",{"id":"infoPanelClose","class":"link","src":GFX+"close.jpg","style":"position:absolute;top:8px;right:8px;width:20px;height:20px;"},div1); div1.addEventListener("click",closeInfoPanel,false); } if((mode==div.getAttribute("mode"))&&(implode(mode2)==div.getAttribute("mode2"))){ closeInfoPanel(); }else{ div.setAttribute("mode",mode); div.setAttribute("mode2",implode(mode2)); div.style.display="block"; $("infoPanelInner").innerHTML=""; if(unsafeWindow.buildInfoPanelAutomat){ unsafeWindow.buildInfoPanelAutomat(mode,mode2); } switch(mode){ case "changelog": buildInfoPanelChangelog(); break; case "donkey": buildInfoPanelDonkey(); break; case "farmies": buildInfoPanelFarmies(); break; case "formulas": buildInfoPanelFormulas(); break; case "level": buildInfoPanelLevel(); break; case "lottery": buildInfoPanelLottery(); break; case "menu": unsafeWindow.buildInfoPanelMenu(mode2); break; case "profit": buildInfoPanelProfit(); break; case "quests": buildInfoPanelQuests(); break; case "messages": buildInfoPanelMessages(); break; case "stock": buildInfoPanelStock(mode2); break; case "upjersAds": buildInfoPanelUpjersAds(); break; case "zones": buildInfoPanelZones(); break; } raiseEvent("gameInfoPanelOpen"); div=null;div1=null; } }catch(err){ GM_logError("buildInfoPanel mode="+implode(mode)+" mode2="+implode(mode2)+"\n"+err); } } function closeInfoPanel(){ try{ var div; if(div=$top("infoPanel")){ div.setAttribute("mode",""); div.style.display="none"; } if(div=$top("infoPanelInner")){ div.innerHTML=""; } div=null; } catch(err){ GM_logError("closeInfoPanel\n"+err); } } function buildInfoPanelChangelog(){ try{ var table,tr,td,div; var container=$("infoPanelInner"); container.innerHTML=""; // Head newdiv=createElement("div",{"class":"borderBottom1Black","style":"height:50px;"},container); table=createElement("table",{"border":"0","cellspacing":"0","style":"width:100%;"},newdiv); tr=createElement("tr",{},table); createElement("td",{"class":"tnormal","style":"color:black;font-weight:bold;text-align:center;height:40px;"},tr,getText("adviser")+" "+VERSION); createElement("td",{},tr); // Body newdiv=createElement("div",{"style":"height:470px;width:100%;overflow:auto;"},container); table=createElement("table",{"border":"0","cellspacing":"0","style":"width:100%;"},newdiv); tr=createElement("tr",{},table); createElement("th",{},tr,getText("version")); createElement("th",{},tr,getText("date")); createElement("th",{},tr,getText("change")); for(var i=CHANGELOG.length-1;i>-1;i--){ tr=createElement("tr",{"class":"hoverBgCc9 borderBottom1dashedGrey"},table); createElement("td",{},tr,CHANGELOG[i][0]); createElement("td",{},tr,CHANGELOG[i][1]); td=createElement("td",{},tr); div=createElement("ul",{},td); for(var j=0;j<CHANGELOG[i][2].length;j++){ createElement("li",{},div,CHANGELOG[i][2][j][LANGUAGE=="de"?0:1]); } } container=null;table=null;tr=null;td=null;div=null; }catch(err){GM_logError("buildInfoPanelChangelog\n"+err);} } function buildInfoPanelStock(mode){ try{ var help=mode["filterCategory"]; var modeDefault={"filterCategories":[{"v":true},{"f1":true},{"r1":true},{"f1":true}],"filterCategory":{"v":true},"page":1,"prodType":0,"showAll":false}; var modeOld=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeStockTable"),"buildInfoPanelStock/modeOld"); if(typeof modeOld!="object"){ modeOld=modeDefault; } if(typeof mode!="object"){ mode=modeOld; } for(var v in modeDefault){ if(!modeDefault.hasOwnProperty(v)){ continue; } if(mode[v]==undefined){ mode[v]=(modeOld[v]==undefined?modeDefault[v]:modeOld[v]); } } if(mode["prodType"]>0){ mode["page"]=2; } if(help){ mode["filterCategories"][mode["prodType"]]=mode["filterCategory"]; }else{ mode["filterCategory"]=mode["filterCategories"][mode["prodType"]]; } GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeStockTable",implode(mode,"buildInfoPanelStock/mode")); var container=$("infoPanelInner"); container.innerHTML=""; //head line var newdiv=createElement("div",{"class":"borderBottom1Black","style":"height:50px;width:100%;font-color:black;overflow:none;"},container); var newtable=createElement("table",{"border":"0","cellspacing":"0","style":"width:100%;"},newdiv); var newtr=createElement("tr",{},newtable); // switch price / stock var newtd=createElement("td",{"align":"center"},newtr); if(mode["prodType"]==0){ newdiv=createElement("div",{"class":"link naviItem"+(mode["page"]==1?"Active":"")},newtd,getText("prices")); newdiv.addEventListener("click",function(){ buildInfoPanelStock({"page":1}); },false); }else{ newdiv=createElement("div",{"class":"naviItemInactive"},newtd,getText("prices")); } newdiv=createElement("div",{"class":"link naviItem"+(mode["page"]==2?"Active":"")},newtd,getText("stock")); newdiv.addEventListener("click",function(){ buildInfoPanelStock({"page":2}); },false); // switch prodType newtd=createElement("td",{"align":"left"},newtr); newdiv = createElement("select",{},newtd); createElement("option",{"value":0},newdiv,getText("farm")); createElement("option",{"value":1},newdiv,getText("forestry")); createElement("option",{"value":2},newdiv,getText("recipes")); createElement("option",{"value":3},newdiv,getText("powerups")); newdiv.addEventListener("change",function(){ buildInfoPanelStock({"prodType":parseInt(this.value,10)}); },false); newdiv.value=mode["prodType"]; // switch filterCategory newtd=createElement("td",{"align":"right"},newtr); newdiv=createElement("div",{"style":"-moz-user-select:none;float:right;"},newtd); newdiv.addEventListener("mouseover",function(event){ var mouseOverText=event.target.getAttribute("mouseOverText"); if(mouseOverText){ mouseOverText='<div>'+getText("click")+' / '+getText("clickCtrl")+'</div><div>'+mouseOverText+'</div>'; toolTip.show(event,mouseOverText); } },false); newdiv.addEventListener("click",function(filterCategory){ return function(event){ var thisFilter=explode(event.target.getAttribute("filter"),"buildInfoPanelStock\thisFilter"); if(thisFilter){ if(event.ctrlKey){ for(var i=thisFilter.length-1;i>-1;i--){ if(filterCategory[thisFilter[i]]){ delete filterCategory[thisFilter[i]]; }else{ filterCategory[thisFilter[i]]=true; } } }else{ filterCategory={}; for(var i=thisFilter.length-1;i>-1;i--){ filterCategory[thisFilter[i]]=true; } } buildInfoPanelStock({"filterCategory":filterCategory}); } }}(mode["filterCategory"]),false); switch(mode["prodType"]){ case 0:{ createElement("div",{"class":"link rackcat1v"+(mode["filterCategory"]["v"]?"_active":""),"filter":'["v"]',"mouseOverText":getText("category_v"),"style":"float:left;"},newdiv); createElement("div",{"class":"link rackcat1e"+(mode["filterCategory"]["e"]?"_active":""),"filter":'["e"]',"mouseOverText":getText("category_e"),"style":"float:left;"},newdiv); createElement("div",{"class":"link rackcat5"+(mode["filterCategory"]["o"]?"_active":""),"filter":'["o"]',"mouseOverText":getText("category_o"),"style":"float:left;"},newdiv); createElement("div",{"class":"link rackcat10"+(mode["filterCategory"]["c"]||mode["filterCategory"]["z"]?"_active":""),"filter":'["c","z"]',"mouseOverText":getText("category_c")+"<br>"+getText("category_z"),"style":"float:left;"},newdiv); newdiv1=createElement("div",{"style":"float:left;width:53px;"},newdiv); for(var i=1;i<=4;i=i+2){ createElement("div",{"class":"link rackcat2"+i+(mode["filterCategory"]["fw"+i]?"_active":""),"filter":'["fw'+i+'"]',"mouseOverText":getText("category_fw"+i),"style":"float:left;"},newdiv1); if(i==3){ i=0; } } createElement("div",{"class":"link rackcat30fl"+(mode["filterCategory"]["fl"]?"_active":""),"filter":'["fl"]',"mouseOverText":getText("category_fl"),"style":"float:left;"},newdiv); createElement("div",{"class":"link rackcat30fla"+(mode["filterCategory"]["fla"]?"_active":""),"filter":'["fla"]',"mouseOverText":getText("category_fla"),"style":"float:left;"},newdiv); } break; case 1:{ for(var i=1;i<=5;i++){ newdiv1=createElement("div",{"class":"category_f"+i+(mode["filterCategory"]["f"+i]?"_active":"")+" link","filter":'["f'+i+'"]',"mouseOverText":getText("category_f"+i),"style":"display:inline-block;"},newdiv); } } break; case 2:{ for(var i=0;i<=2;i++){ newdiv1=createElement("div",{"class":"category_r"+i+(mode["filterCategory"]["r"+i]?"_active":"")+" link","filter":'["r'+i+'"]',"mouseOverText":getText("category_r"+i),"style":"display:inline-block;"},newdiv); } } break; case 3:{ for(var i=0;i<=2;i++){ newdiv1=createElement("div",{"class":"category_r"+i+(mode["filterCategory"]["p"+i]?"_active":"")+" link","filter":'["p'+i+'"]',"mouseOverText":getText("category_p"+i),"style":"display:inline-block;"},newdiv); } } break; } //the table newdiv=createElement("div",{"class":"borderBottom1Black","style":"height:430px;overflow:auto;"},container); newtable=createElement("table",{"border":"0","cellspacing":"0","style":"width:100%;"},newdiv); newtable.addEventListener("mouseover",function(event){ var node=event.target; var mouseOverText=node.getAttribute("mouseOverText"); while((node!=this)&&(!mouseOverText)){ node=node.parentNode; mouseOverText=node.getAttribute("mouseOverText"); } if(mouseOverText){ toolTip.show(event,mouseOverText); } node=null;mouseOverText=null; },false); var thead=createElement("thead",{},newtable); // sortable table var newtablebody=createElement("tbody",{},newtable); var sumwert=0; newtr=createElement("tr",{},thead); switch(mode["page"]){ case 1:{ createElement("th",{"colspan":"2"},newtr,getText("product")); createElement("th",{},newtr,getText("inventory")); createElement("th",{},newtr," "+getText("NPCprice")); createElement("th",{},newtr," "+getText("observed")); createElement("th",{},newtr,getText("marketPrice")); createElement("th",{},newtr,getText("afterFee")); var prevTyp=null; for(var w=0;w<prodNameSort[mode["prodType"]].length;w++){ try{ v=prodNameSort[mode["prodType"]][w]; if((!prodBlock[mode["prodType"]][v].match(/t/))&&(mode["showAll"]||((!prodBlock[mode["prodType"]][v].match(/l/))&&(!prodBlock[mode["prodType"]][v].match(/q/))))){ if (mode["filterCategory"][prodTyp[mode["prodType"]][v]]){ if(prodTyp[mode["prodType"]][v]!="c"){ sumwert += prodStock[mode["prodType"]][v]*gut[v]; } if((prevTyp!=null)&&(prevTyp!=prodTyp[mode["prodType"]][v])){ newtr=createElement("tr",{"class":"hoverBgCc9 borderTop1dashedBlack"},newtablebody); }else{ newtr=createElement("tr",{"class":"hoverBgCc9"},newtablebody); } prevTyp=prodTyp[mode["prodType"]][v]; newdiv=createElement("td",{},newtr); produktPic(mode["prodType"],v,newdiv); newdiv=createElement("td",{},newtr); newa=createElement("a",{"prodId":v},newdiv,prodName[mode["prodType"]][v]); if(prodBlock[mode["prodType"]][v].match(/l/)){ newtr.setAttribute("mouseOverText",getText("levelXneeded").replace(/%1%/,/l(\d+)/.exec(prodBlock[mode["prodType"]][v])[1])); newa.style.textDecoration="none"; }else if(prodBlock[mode["prodType"]][v].match(/t/)){ newa.style.textDecoration="none"; }else{ if(mode["prodType"]==0){ newtr.setAttribute("mouseOverText",getText("value")+": "+moneyFormatInt(prodStock[mode["prodType"]][v]*gut[v])); newa.setAttribute("mouseOverText",'<table class="tmenu"><tr><th colspan="2" class="lightBg">'+getText("goToMarketOfX").replace(/%1%/,prodName[mode["prodType"]][v])+'</th></tr><tr><td>'+getText("value")+'</td><td style="text-align:right;">'+moneyFormatInt(prodStock[mode["prodType"]][v]*gut[v])+'</td></table>'); newa.setAttribute("class","link"); newa.addEventListener("click",function(){showMarket(this.getAttribute("prodId"));},false); } } createElement("td",{"style":"text-align:right;"},newtr,prodBlock[mode["prodType"]][v]?"<span style='color:red;'>---</span>":(prodStock[mode["prodType"]][v]?numberFormat(prodStock[mode["prodType"]][v]):"-")); newtd=createElement("td",{"style":"text-align:right;"},newtr); if(NPC[mode["prodType"]][v]){ if(!isNaN(NPC[mode["prodType"]][v])){ newtd.innerHTML=numberFormat(NPC[mode["prodType"]][v],2); }else if (NPC[mode["prodType"]][v].match(/^f/)){ newtd.innerHTML="("+numberFormat(parseFloat(NPC[mode["prodType"]][v].replace("f",""),10),2)+")"; }else if (NPC[mode["prodType"]][v].match(/^c/)){ coinsFormat(parseInt(NPC[mode["prodType"]][v].replace("c",""),10),newtd); } if((npcSaison[v]!=undefined)&&(!npcSaison[v])){ newtd.style.textDecoration="line-through"; newtd.setAttribute("class","hoverNoTextDecoration"); } }else{ newtd.innerHTML=" "; } newtd=createElement("td",{"style":"text-align:right;"},newtr,(gutBeob[v]?numberFormat(gutBeob[v],2):" ")); if(preisBeob[v]){ if(preisBeob[v][4]>0){ newtd.setAttribute("mouseOverText",getFormattedDateStr(preisBeob[v][1])+" "+getDaytimeStr(preisBeob[v][1])+"<br>"+moneyFormat(preisBeob[v][2])+" - "+moneyFormat(preisBeob[v][3])+"<br>#"+numberFormat(preisBeob[v][4])); }else{ newtd.setAttribute("mouseOverText",getFormattedDateStr(preisBeob[v][1])+" "+getDaytimeStr(preisBeob[v][1])+"<br>#"+numberFormat(preisBeob[v][4])); newtd.style.textDecoration="line-through"; newtd.setAttribute("class","hoverNoTextDecoration"); } if(now-preisBeob[v][1]>259200){ // 3 days if(now-preisBeob[v][1]>604800){ // 7 days newtd.style.color="red"; }else{ newtd.style.color="yellow"; } } }else if(!prodBlock[mode["prodType"]][v]){ newtd.setAttribute("mouseOverText","---"); } newtd=createElement("td",{"style":"text-align:right;"},newtr); if(valNimmBeob){ newtd.innerHTML=numberFormat(gut[v],2); }else{ createElement("span",{"style":"font-size:0;"},newtd,numberFormat(gut[v],2)); newinput=createElement("input",{"id":"inp"+v,"tabindex":parseInt(w,10)+1,"value":numberFormat(gut[v],2),"class":"text","size":"10","maxlength":"10","style":"text-align:right; background-color:transparent; color:black;"},newtd); newinput.addEventListener("blur",function(){ this.value=numberFormat(gut[this.id.replace("inp","")],2); },false); newinput.addEventListener("change",function(){ var currId=this.id.replace("inp",""); var preis=Math.max(0,parseFloat(this.value.replace(regDelimThou,"").replace(regDelimDeci,"."),10)); var thisNode=this; var yesFkt = function(){ gut[currId]=preis; GM_setValue(COUNTRY+"_"+SERVER+"_gut",implode(gut)); raiseEventTop("gameChangedGut"); thisNode.value=numberFormat(preis,2); thisNode.parentNode.nextSibling.innerHTML=numberFormat(0.9*preis,2); thisNode=null; }; var noFkt = function(){ thisNode.value=numberFormat(gut[currId],2); thisNode=null; }; if(preis==0){ alert2(getText("alertSetPriceNone").replace(/%PRODUCT%/,prodName[mode["prodType"]][currId]),getText("yes"),getText("no"),yesFkt,noFkt); }else if((!isNaN(NPC[mode["prodType"]][currId]))&&(preis>NPC[mode["prodType"]][currId])){ alert2(getText("alertSetPriceOverNPC").replace(/%PRODUCT%/,prodName[mode["prodType"]][currId]).replace(/%PRICE%/,moneyFormat(preis)).replace(/%NPC%/,moneyFormat(NPC[mode["prodType"]][currId])),getText("yes"),getText("no"),yesFkt,noFkt); }else if ((gutBeob[currId]!=undefined)&&(gutBeob[currId]>0)){ if(preis<0.7*gutBeob[currId]){ alert2(getText("alertSetPriceUnderObs").replace(/%PRODUCT%/,prodName[mode["prodType"]][currId]).replace(/%PRICE%/,moneyFormat(preis)).replace(/%OBS%/,moneyFormat(gutBeob[currId])),getText("yes"),getText("no"),yesFkt,noFkt); }else if (1.3*gutBeob[currId]<preis){ alert2(getText("alertSetPriceOverObs").replace(/%PRODUCT%/,prodName[mode["prodType"]][currId]).replace(/%PRICE%/,moneyFormat(preis)).replace(/%OBS%/,moneyFormat(gutBeob[currId])),getText("yes"),getText("no"),yesFkt,noFkt); }else{ yesFkt(); } }else{ yesFkt(); } this.style.backgroundColor="transparent"; },false); } createElement("td",{"style":"text-align:right;"},newtr,numberFormat(0.9*gut[v],2)); } } }catch(err){ GM_logError("buildInfoPanelStock\nmode="+implode(mode)+"\nv="+v+"\n"+err); } } break;} case 2:{ var valMinRackMan=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMinRackMan",false); createElement("th",{"align":"center"},newtr," "); newtd=createElement("th",{"align":"left","class":"link hoverBgLightblue","sortdir":"Desc"},newtr,getText("product")); newtd=createElement("th",{"align":"right","class":"link hoverBgLightblue","sortdir":"Asc"},newtr,getText("inventory")); newtd=createElement("th",{"align":"right","class":"link hoverBgLightblue","sortdir":"Asc"},newtr," "+getText("value")); createElement("th",{"align":"right","style":"padding-right:20px"},newtr," "+getText("minRack")); new SortableTable(newtr); for(var w=0;w<prodNameSort[mode["prodType"]].length;w++){ try{ v=prodNameSort[mode["prodType"]][w]; if(mode["showAll"]||((!prodBlock[mode["prodType"]][v].match(/l/))&&(!prodBlock[mode["prodType"]][v].match(/q/)))){ if (mode["filterCategory"][prodTyp[mode["prodType"]][v]]){ if((mode["prodType"]==0)&&(prodTyp[mode["prodType"]][v]!="c")){ sumwert+=prodStock[mode["prodType"]][v]*gut[v]; } newtr=createElement("tr",{"class":"hoverBgCc9","v":v},newtablebody); newdiv=createElement("td",{},newtr); produktPic(mode["prodType"],v,newdiv); newdiv=createElement("td",{"value":w},newtr); newa=createElement("a",{"prodId":v},newdiv,prodName[mode["prodType"]][v]); if(prodBlock[mode["prodType"]][v].match(/l/)){ newtr.setAttribute("mouseOverText",getText("levelXneeded").replace(/%1%/,/l(\d+)/.exec(prodBlock[mode["prodType"]][v])[1])); newa.style.textDecoration="none"; }else if(prodBlock[mode["prodType"]][v].match(/t/)){ newa.style.textDecoration="none"; }else if(mode["prodType"]==0){ newtr.setAttribute("mouseOverText",getText("marketPrice")+": "+moneyFormat(gut[v])); newa.setAttribute("mouseOverText",'<table class="tmenu"><tr><th colspan="2" class="lightBg">'+getText("goToMarketOfX").replace(/%1%/,prodName[mode["prodType"]][v])+'</th></tr><tr><td>'+getText("marketPrice")+'</td><td style="text-align:right;">'+moneyFormat(gut[v])+'</td></table>'); newa.setAttribute("class","link"); newa.addEventListener("click",function(){showMarket(this.getAttribute("prodId"));},false); } if(prodBlock[mode["prodType"]][v].match(/l/)){ createElement("td",{"align":"right","value":0},newtr,"<span style='color:red;'>---</span>"); createElement("td",{"align":"right","value":0},newtr,"<span style='color:red;'>---</span>"); }else if(prodStock[mode["prodType"]][v]){ createElement("td",{"align":"right","value":prodStock[mode["prodType"]][v]},newtr,numberFormat(prodStock[mode["prodType"]][v])); if(mode["prodType"]==0&&(!prodBlock[mode["prodType"]][v].match(/t/))){ createElement("td",{"align":"right","value":prodStock[mode["prodType"]][v]*gut[v]},newtr,numberFormat(prodStock[mode["prodType"]][v]*gut[v])); }else{ createElement("td",{"align":"right","value":0},newtr,"-"); } }else{ createElement("td",{"align":"right","value":0},newtr,"-"); createElement("td",{"align":"right","value":0},newtr,"-"); } newtd=createElement("td",{"align":"right","style":"padding-right:20px"},newtr); if(valMinRackMan){ newinput=createElement("input",{"tabindex":parseInt(w,10)+1,"value":numberFormat(prodMinRackInit[mode["prodType"]][v]),"class":"text","size":"10","maxlength":"10","style":"text-align:right; background-color:transparent; color:black;"},newtd); newinput.addEventListener("blur",function(){ this.value=numberFormat(parseInt(this.value.replace(regDelimThou,""),10)); },false); newinput.addEventListener("change",function(prodType,currId){ return function(){ prodMinRackInit[prodType][currId]=parseInt(this.value.replace(regDelimThou,""),10); GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodMinRackInit",implode(prodMinRackInit)); raiseEventTop("gameChangedProdMinRackInit"); }}(mode["prodType"],v),false); }else{ createElement("span",{},newtd,numberFormat(prodMinRackInit[mode["prodType"]][v])); } } } }catch(err){ GM_logError("buildInfoPanelStock\nmode="+implode(mode)+"\nv="+v+"\n"+err); } } break;} } newtablebody.setAttribute("height",Math.min(361,19*newtablebody.childElementCount)+"px"); //foot line newdiv=createElement("div",{},container); newtable=createElement("table",{"border":"0","cellspacing":"0","style":"width:100%;"},newdiv); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newdiv=createElement("input",{"type":"checkbox","class":"link","checked":mode["showAll"]},newtd); newdiv.addEventListener("click",function(){ buildInfoPanelStock({"showAll":this.checked}); },false); createElement("span",{},newtd,getText("showAll")); newtd=createElement("td",{"align":"center"},newtr); if((mode["prodType"]==0)&&(mode["page"]==1)&&(!valNimmBeob)){ newdiv=createElement("button",{"class":"link button_new","style":"margin-right:10px;"},newtd,getText("takeObservedPrices")); newdiv.addEventListener("click",function(){ alert2(getText("confirmUseObservedPrices"),getText("yes"),getText("no"),function(){ for(var v=0;v<gutBeob.length;v++){ gut[v]=gutBeob[v]; if(!isNaN(NPC[0][v])){ gut[v]=Math.min(gut[v],NPC[0][v]); } } GM_setValue(COUNTRY+"_"+SERVER+"_gut",implode(gut)); raiseEventTop("gameChangedGut"); buildInfoPanelStock(); }); },false); } newtd=createElement("td",{"align":"center","style":"font-weight:bold;"},newtr,getText("stockValue")+": "+moneyFormatInt(sumwert)); newtable=null;thead=null;newtablebody=null;newtr=null;newtd=null;newdiv=null;newdiv1=null; }catch(err){ GM_logError("buildInfoPanelStock\nmode="+implode(mode)+"\n"+err); } } function buildInfoPanelProfit(mode){ try{ var err_trace="init"; //GM_log("buildInfoPanelProfit "+implode(mode)); var modeDefault={"perc":0.9,"showAll":false,"sort":"gut","buildingLevel":{},"feed":{},"filterCategory":{"v":true}}; var modeOld=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeProfittable"),"buildInfoPanelProfit/modeOld"); if(typeof modeOld!="object"){ modeOld=modeDefault; } if(typeof mode!="object"){ mode=modeOld; } for(var v in modeDefault){ if(!modeDefault.hasOwnProperty(v)){ continue; } if(mode[v]==undefined){ mode[v]=(modeOld[v]==undefined?modeDefault[v]:modeOld[v]); } } if(!mode["buildingLevel"]["1"]){ mode["buildingLevel"]["1"]=1; } // [alternative, fully fed(0/1)] err_trace="calc array"; var profit=new Array(); var c=-1; var help, currBuilding, preis, preisBeob, menge, bonus, currInput; for(var v=0;v<prodName[0].length;v++){ if((mode["showAll"]||(!prodBlock[0][v]))&&(prodGrowTime[0][v])){ if(mode["filterCategory"][prodTyp[0][v]]){ profit[++c]=new Object(); profit[c]["id"]=v; currBuilding=PRODUCT2BUILDING[0][v]; if(!mode["buildingLevel"][currBuilding]){ mode["buildingLevel"][currBuilding]=1; } profit[c]["level"]=mode["buildingLevel"][currBuilding]; profit[c]["maxlevel"]=BUILDING_UPGRADES[currBuilding].length; if(!mode["showAll"]){ while((profit[c]["maxlevel"]>1)&&(USERLEVEL<BUILDING_UPGRADES[currBuilding][profit[c]["maxlevel"]-1][0])){ profit[c]["maxlevel"]--; } profit[c]["level"]=Math.min(profit[c]["level"],profit[c]["maxlevel"]); } bonus=BUILDING_UPGRADES[currBuilding][profit[c]["level"]-1][2]; switch(BUILDINGTYPE[currBuilding]){ case 1:{ // Fields if(questData["main"]["1"]["nr"]>170){ bonus-=0.05; } profit[c]["input"]=[]; profit[c]["input"][0]=[[]]; profit[c]["dauer"] = calcProductionTime(1,0,v,bonus); profit[c]["runs"] = 86400/profit[c]["dauer"]; preis=gut[v]; preisBeob=(gutBeob[v]?gutBeob[v]:0); if(!isNaN(NPC[0][v])){ preis=Math.min(NPC[0][v],preis); preisBeob=Math.min(NPC[0][v],preisBeob); } menge=profit[c]["runs"]*(BUILDING_SIZE[currBuilding]/prodPlantSize[0][v]); profit[c]["input"][0][0][0]=[v,menge,preis,preisBeob]; profit[c]["menge"] = menge*prodYield[0][v]; profit[c]["punkte"]= menge*prodPoints[0][v]; help=profit[c]["input"][0][0]; break;} case 2:{ // Stable if(!mode["feed"][v]){ mode["feed"][v]=[0,0]; } if(typeof mode["feed"][v][0]!="number"){ mode["feed"][v][0]=0; } if(typeof mode["feed"][v][1]!="number"){ mode["feed"][v][1]=0; } profit[c]["input"]=[]; help=[]; for(var alt=0;alt<BUILDING_INPUT[currBuilding][v].length;alt++){ profit[c]["input"][alt]=[[],[]]; help[alt]=[[],[]]; help[alt][0]=calcProductionTime(2,0,v,bonus,BUILDING_INPUT[currBuilding][v][alt][0][1]/BUILDING_UPGRADES[currBuilding][profit[c]["level"]-1][3]); help[alt][1]=calcProductionTime(2,0,v,bonus,BUILDING_INPUT[currBuilding][v][alt][0][1]/BUILDING_UPGRADES[currBuilding][profit[c]["level"]-1][3],1); for(var i=0;i<BUILDING_INPUT[currBuilding][v][alt].length;i++){ currInput=BUILDING_INPUT[currBuilding][v][alt][i]; preis=gut[currInput[0]]; preisBeob=(gutBeob[currInput[0]]?gutBeob[currInput[0]]:0); if(!isNaN(NPC[0][currInput[0]])){ preis=Math.min(NPC[0][currInput[0]],preis); preisBeob=Math.min(NPC[0][currInput[0]],preisBeob); } menge=help[alt][1][1]*86400/help[alt][1][0]; profit[c]["input"][alt][1][i]=[currInput[0],menge,preis,preisBeob]; menge=help[alt][0][1]*86400/help[alt][0][0]; profit[c]["input"][alt][0][i]=[currInput[0],menge,preis,preisBeob]; } } if(!help[mode["feed"][v][0]]){ mode["feed"][v][0]=0; } if(!help[mode["feed"][v][0]][mode["feed"][v][1]]){ mode["feed"][v][1]=0; } profit[c]["dauer"] = help[mode["feed"][v][0]][mode["feed"][v][1]][0]; profit[c]["runs"] = 86400/profit[c]["dauer"]; profit[c]["menge"] = profit[c]["runs"]*BUILDING_UPGRADES[currBuilding][profit[c]["level"]-1][3]*prodYield[0][v]; profit[c]["punkte"]= profit[c]["menge"]*prodPoints[0][v]; help=profit[c]["input"][mode["feed"][v][0]][mode["feed"][v][1]]; break;} case 3:{ // Factory if(!mode["feed"][v]){ mode["feed"][v]=[0,0]; } if(typeof mode["feed"][v][0]!="number"){ mode["feed"][v][0]=0; } if(typeof mode["feed"][v][1]!="number"){ mode["feed"][v][1]=0; } profit[c]["input"]=[]; help=[]; for(var alt=0;alt<BUILDING_INPUT[currBuilding][v].length;alt++){ profit[c]["input"][alt]=[[]]; help[alt]=[[]]; help[alt][0][0]=calcProductionTime(3,0,v,bonus); for(var i=0;i<BUILDING_INPUT[currBuilding][v][alt].length;i++){ currInput=BUILDING_INPUT[currBuilding][v][alt][i]; preis=gut[currInput[0]]; preisBeob=(gutBeob[currInput[0]]?gutBeob[currInput[0]]:0); if(!isNaN(NPC[0][currInput[0]])){ preis=Math.min(NPC[0][currInput[0]],preis); preisBeob=Math.min(NPC[0][currInput[0]],preisBeob); } menge=currInput[1]*86400/help[alt][0][0]; profit[c]["input"][alt][0][i]=[currInput[0],menge,preis,preisBeob]; } } if(!help[mode["feed"][v][0]]){ mode["feed"][v][0]=0; } if(!help[mode["feed"][v][0]][mode["feed"][v][1]]){ mode["feed"][v][1]=0; } profit[c]["dauer"] = help[mode["feed"][v][0]][mode["feed"][v][1]][0]; profit[c]["runs"] = 86400/profit[c]["dauer"]; profit[c]["menge"] = profit[c]["runs"]*BUILDING_UPGRADES[currBuilding][profit[c]["level"]-1][3]*prodYield[0][v]; profit[c]["punkte"]= profit[c]["menge"]*prodPoints[0][v]; help=profit[c]["input"][mode["feed"][v][0]][mode["feed"][v][1]]; break;} case 4:{ // Foodworld, flowers profit[c]["input"]=[]; profit[c]["input"][0]=[[]]; profit[c]["dauer"]=calcProductionTime(BUILDINGTYPE[currBuilding],0,v,bonus); profit[c]["runs"] = 86400/profit[c]["dauer"]; for(var i=0;i<prodRequire[0][v].length;i++){ currInput=prodRequire[0][v][i]; switch(currInput[0]){ case -1:{ preis=1; preisBeob=1; menge=currInput[1]*profit[c]["runs"]; profit[c]["input"][0][0][i]=[-1,menge,preis,preisBeob]; break;} case 0:{ preis=gut[currInput[1]]; preisBeob=(gutBeob[currInput[1]]?gutBeob[currInput[1]]:0); if(!isNaN(NPC[0][currInput[1]])){ preis=Math.min(NPC[0][currInput[1]],preis); preisBeob=Math.min(NPC[0][currInput[1]],preisBeob); } menge=currInput[2]*profit[c]["runs"]; profit[c]["input"][0][0][i]=[currInput[1],menge,preis,preisBeob]; break;} } } profit[c]["menge"] = profit[c]["runs"]*BUILDING_UPGRADES[currBuilding][profit[c]["level"]-1][3]*prodYield[0][v]; profit[c]["punkte"]= profit[c]["menge"]*prodPoints[0][v]; help=profit[c]["input"][0][0]; break;} } menge=profit[c]["menge"]; preis=mode["perc"]*gut[v]; preisBeob=mode["perc"]*(gutBeob[v]?gutBeob[v]:0); profit[c]["output"]=[v,menge,preis,preisBeob]; profit[c]["gut"]=menge*preis profit[c]["gutBeob"]=menge*preisBeob; for(var i=0;i<help.length;i++){ profit[c]["gut"]-=help[i][1]*help[i][2]; profit[c]["gutBeob"]-=help[i][1]*help[i][3]; } // GM_log(prodName[0][v]+":"+implode(profit[c])); } } } profit.sort(function (a,b){return b[mode["sort"]] - a[mode["sort"]];}); // console.log("variable:\n"+print_r(profit,"",true,"\n")); //head line err_trace="head line"; var table,newtr,newtd,newspan,newdiv,newtable1,newtr1,newtd1; var container=$("infoPanelInner"); container.innerHTML=""; newdiv=createElement("div",{"class":"borderBottom1Black","style":"height:50px;"},container); table=createElement("table",{"border":"0","cellspacing":"0","style":"width:100%;"},newdiv); newtr=createElement("tr",{},table); createElement("td",{"class":"tnormal","style":"color:black;font-weight:bold;text-align:center;"},newtr,getText("profitTable")); // switch bar to filter category newtd=createElement("td",{"align":"right"},newtr); newdiv=createElement("div",{"style":"-moz-user-select:none;width:212px;"},newtd); newdiv.addEventListener("mouseover",function(event){ var mouseOverText=event.target.getAttribute("mouseOverText"); if(mouseOverText){ mouseOverText='<div>'+getText("click")+' / '+getText("clickCtrl")+'</div><div>'+mouseOverText+'</div>'; toolTip.show(event,mouseOverText); } },false); newdiv.addEventListener("click",function(filterCategory){ return function(event){ var thisFilter=explode(event.target.getAttribute("filter"),"buildInfoPanelProfit\thisFilter"); if(thisFilter){ if(event.ctrlKey){ for(var i=thisFilter.length-1;i>-1;i--){ if(filterCategory[thisFilter[i]]){ delete filterCategory[thisFilter[i]]; }else{ filterCategory[thisFilter[i]]=true; } } }else{ filterCategory={}; for(var i=thisFilter.length-1;i>-1;i--){ filterCategory[thisFilter[i]]=true; } } buildInfoPanelProfit({"filterCategory":filterCategory}); } }}(mode["filterCategory"]),false); createElement("div",{"class":"link rackcat1v"+(mode["filterCategory"]["v"]?"_active":""),"filter":'["v"]',"mouseOverText":getText("category_v"),"style":"float:left;"},newdiv); createElement("div",{"class":"link rackcat1e"+(mode["filterCategory"]["e"]?"_active":""),"filter":'["e"]',"mouseOverText":getText("category_e"),"style":"float:left;"},newdiv); createElement("div",{"class":"link rackcat5"+(mode["filterCategory"]["o"]?"_active":""),"filter":'["o"]',"mouseOverText":getText("category_o"),"style":"float:left;"},newdiv); newdiv1=createElement("div",{"style":"float:left;width:53px;"},newdiv); for(var i=1;i<=4;i=i+2){ createElement("div",{"class":"link rackcat2"+i+(mode["filterCategory"]["fw"+i]?"_active":""),"filter":'["fw'+i+'"]',"mouseOverText":getText("category_fw"+i),"style":"float:left;"},newdiv1); if(i==3){ i=0; } } createElement("div",{"class":"link rackcat30fl"+(mode["filterCategory"]["fl"]?"_active":""),"filter":'["fl"]',"mouseOverText":getText("category_fl"),"style":"float:left;"},newdiv); createElement("div",{"class":"link rackcat30fla"+(mode["filterCategory"]["fla"]?"_active":""),"filter":'["fla"]',"mouseOverText":getText("category_fla"),"style":"float:left;"},newdiv); // the table err_trace="table"; newdiv=createElement("div",{"class":"borderBottom1Black","style":"height:440px;width:100%;overflow:auto;"},container); table=createElement("table",{"border":"0","cellspacing":"0","style":"width:100%;"},newdiv); table.addEventListener("mouseover",function(event){ var node=event.target; var mouseOverText=node.getAttribute("mouseOverText"); while((node!=this)&&(!mouseOverText)){ node=node.parentNode; mouseOverText=node.getAttribute("mouseOverText"); } if(mouseOverText){ toolTip.show(event,mouseOverText); } node=null;mouseOverText=null; },false); err_trace="tablehead"; newtr=createElement("tr",{"style":"color:black;"},table); newtd=createElement("th",{"class":"link hoverBgCc9"+(mode["sort"]=="product"?" sortableColDesc":"")},newtr,getText("product")); newtd.addEventListener("click",function(){ buildInfoPanelProfit({"sort":"product"}); },false); newtd=createElement("th",{"class":"link hoverBgCc9"+(mode["sort"]=="dauer"?" sortableColDesc":"")},newtr,getText("duration")); newtd.addEventListener("click",function(){ buildInfoPanelProfit({"sort":"dauer"}); },false); newtd=createElement("th",{"style":"border-bottom:1px dashed black;"},newtr); newtd=createElement("th",{"class":"link hoverBgCc9"+(mode["sort"]=="punkte"?" sortableColDesc":"")},newtr,getText("points")); newtd.addEventListener("click",function(){ buildInfoPanelProfit({"sort":"punkte"}); },false); newtd=createElement("th",{"class":"link hoverBgCc9"+(mode["sort"]=="gut"?" sortableColDesc":"")},newtr,getText("prices")); newtd.addEventListener("click",function(){ buildInfoPanelProfit({"sort":"gut"}); },false); newtd=createElement("th",{"class":"link hoverBgCc9"+(mode["sort"]=="gutBeob"?" sortableColDesc":"")},newtr,getText("observed")); newtd.addEventListener("click",function(){ buildInfoPanelProfit({"sort":"gutBeob"}); },false); err_trace="tablebody"; for(var v=0;v<profit.length;v++){ var buildingNr=PRODUCT2BUILDING[0][profit[v]["id"]]; var buildingName=getBuildingName(buildingNr); newtr=createElement("tr",{"nr":v,"prod":profit[v]["id"],"class":"hoverBgCc9","style":"color:black;"},table); newtd=createElement("td",{},newtr); newtd=createElement("div",{"style":"position:relative;height:100%;"},newtd); produktPic(0,profit[v]["id"],newtd); newtable1=createElement("table"); newtr1=createElement("tr",{},newtable1); createElement("td",{},newtr1,getText("dailyYield")); createElement("td",{"style":"text-align:right;padding-left:10px;"},newtr1,numberFormat(profit[v]["menge"],1)); newtr1=createElement("tr",{},newtable1); createElement("td",{},newtr1,getText("yield")); createElement("td",{"style":"text-align:right;padding-left:10px;"},newtr1,numberFormat(profit[v]["menge"]/profit[v]["runs"])); newtr1=createElement("tr",{},newtable1); createElement("td",{},newtr1,getText("dailyRuns")); createElement("td",{"style":"text-align:right;padding-left:10px;"},newtr1,numberFormat(profit[v]["runs"],3)); newspan=createElement("span",{"class":"link","data":newtable1.innerHTML},newtd,prodName[0][profit[v]["id"]]); newspan.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.parentNode.parentNode.parentNode.getAttribute("prod"),this.getAttribute("data")); },false); newspan.addEventListener("click",function(){ showMarket(this.parentNode.parentNode.parentNode.getAttribute("prod")); },false); if(typeof profit[v]["level"]=="number"){ help=mode["buildingLevel"].clone(); help[buildingNr]=(profit[v]["level"]+1)%(profit[v]["maxlevel"]+1); newspan=createElement("span",{"mouseOverText":"<table cellspacing=0><tr><th class='lightBg'>"+buildingName+"</th></tr><tr><td>"+getText("upgradeLevel")+"</td></tr><tr><td>("+getText("clickToChange")+")</td></tr></table>","class":"link","nextLevel":implode(help,"nextLevel")},newtd); // ,"mouseOverText":"max "+profit[v]["maxlevel"] for(var w=1;w<=profit[v]["maxlevel"];w++){ createElement("img",{"src":w<=profit[v]["level"]?GFX+"star.png":IMAGES["starGrey"]},newspan); } newspan.addEventListener("click",function(){ var prod=this.parentNode.parentNode.parentNode.getAttribute("prod"); var nextLevel=explode(this.getAttribute("nextLevel"),"nextLevel.click",{}); buildInfoPanelProfit({"jumpTo":prod,"buildingLevel":nextLevel}); },false); } if(profit[v]["input"]&&(profit[v]["input"].length>1)){ newspan=produktPic(0,profit[v]["input"][mode["feed"][profit[v]["id"]][0]][mode["feed"][profit[v]["id"]][1]][0][0],newtd); newdiv=createElement("div"); newtable1=createElement("table",{"cellspacing":0},newdiv); newtr1=createElement("tr",{},newtable1); createElement("th",{"colspan":2,"class":"lightBg"},newtr1,buildingName); newtr1=createElement("tr",{},newtable1); createElement("td",{"colspan":2},newtr1,getText("feed")+":"); for(var i=0;i<profit[v]["input"].length;i++){ for(var j=0;j<profit[v]["input"][i].length;j++){ newtr1=createElement("tr",{},newtable1); var help=((profit[v]["input"].length>1)&&(mode["feed"][profit[v]["id"]][0]==i)&&(mode["feed"][profit[v]["id"]][1]==j))?"background-color:#BB6600;":""; createElement("td",{"style":"text-align:right;"+help},newtr1,numberFormat(profit[v]["input"][i][j][0][1],1)); createElement("td",{"style":help},newtr1,prodName[0][profit[v]["input"][i][j][0][0]]); } } newtr1=createElement("tr",{},newtable1); createElement("td",{"colspan":2},newtr1,"("+getText("clickToChange")+")"); newspan.setAttribute("class",newspan.getAttribute("class")+" link"); help=mode["feed"].clone(); if(1+mode["feed"][profit[v]["id"]][1]<profit[v]["input"][mode["feed"][profit[v]["id"]][0]].length){ help[profit[v]["id"]]=[help[profit[v]["id"]][0],1+help[profit[v]["id"]][1]]; }else if(1+mode["feed"][profit[v]["id"]][0]<profit[v]["input"].length){ help[profit[v]["id"]]=[1+help[profit[v]["id"]][0],0]; }else{ help[profit[v]["id"]]=[0,0]; } newspan.setAttribute("nextFeed",implode(help,"nextFeed.click")); profit[v]["input"][mode["feed"][profit[v]["id"]][0]][mode["feed"][profit[v]["id"]][1]] newspan.addEventListener("click",function(){ var prod=this.parentNode.parentNode.parentNode.getAttribute("prod"); var nextFeed=explode(this.getAttribute("nextFeed"),"nextFeed.click",{}); buildInfoPanelProfit({"jumpTo":prod,"feed":nextFeed}); },false); newspan.setAttribute("mouseOverText",newdiv.innerHTML); } createElement("td",{"style":"text-align:right;"},newtr,getTimeStr(profit[v]["dauer"],1)); createElement("td",{"style":"text-align:right;"},newtr,getDaytimeStr(now+profit[v]["dauer"],1)+" "+getText("shortOClock")); newdiv=createElement("div"); newtable1=createElement("table",{"cellspacing":0},newdiv); newtr1=createElement("tr",{},newtable1); createElement("th",{"colspan":2,"class":"lightBg"},newtr1,buildingName); newtr1=createElement("tr",{},newtable1); createElement("td",{},newtr1,getText("points")); createElement("td",{"style":"padding-left:10px;"},newtr1,numberFormat(profit[v]["punkte"]/profit[v]["runs"])); newtr1=createElement("tr",{},newtable1); createElement("td",{},newtr1,getText("dailyRuns")); createElement("td",{},newtr1,numberFormat(profit[v]["runs"],3)); createElement("td",{"style":"text-align:right;padding-left:10px;","mouseOverText":newdiv.innerHTML},newtr,numberFormat(profit[v]["punkte"])); newdiv=createElement("div"); newtable1=createElement("table",{"cellspacing":0},newdiv); newtr1=createElement("tr",{},newtable1); createElement("th",{"colspan":6,"class":"lightBg"},newtr1,buildingName); newtr1=createElement("tr",{},newtable1); createElement("td",{"colspan":4},newtr1); createElement("td",{"colspan":2,"style":"text-align:center;"},newtr1,getText("observed")); if(profit[v]["input"]){ if(profit[v]["input"].length>1){ help=profit[v]["input"][mode["feed"][profit[v]["id"]][0]][mode["feed"][profit[v]["id"]][1]]; }else{ help=profit[v]["input"][0][0]; } for(var j=0;j<help.length;j++){ newtr1=createElement("tr",{},newtable1); if(prodName[0][help[j][0]]){ createElement("td",{"style":"text-align:right;"},newtr1,numberFormat(help[j][1]/profit[v]["runs"])); createElement("td",{},newtr1,prodName[0][help[j][0]]); createElement("td",{"style":"text-align:right;padding-left:10px;"},newtr1,"("+moneyFormat(help[j][2])+")"); createElement("td",{"style":"text-align:right;"},newtr1,moneyFormatInt(-help[j][1]*help[j][2]/profit[v]["runs"])); createElement("td",{"style":"text-align:right;padding-left:10px;"},newtr1,"("+moneyFormat(help[j][3])+")"); createElement("td",{"style":"text-align:right;"},newtr1,moneyFormatInt(-help[j][1]*help[j][3]/profit[v]["runs"])); }else{ createElement("td",{"colspan":3},newtr1); createElement("td",{"style":"text-align:right;"},newtr1,moneyFormatInt(-help[j][1]*help[j][2]/profit[v]["runs"])); createElement("td",{"style":"text-align:right;padding-left:10px;"},newtr1); createElement("td",{"style":"text-align:right;"},newtr1,moneyFormatInt(-help[j][1]*help[j][3]/profit[v]["runs"])); } } } newtr1=createElement("tr",{},newtable1); createElement("td",{"style":"text-align:right;"},newtr1,numberFormat(profit[v]["output"][1]/profit[v]["runs"])); createElement("td",{},newtr1,prodName[0][profit[v]["output"][0]]); createElement("td",{"style":"text-align:right;padding-left:10px;"},newtr1,"("+moneyFormat(profit[v]["output"][2])+")"); createElement("td",{"style":"border-bottom:1px solid black;text-align:right;"},newtr1,moneyFormatInt(profit[v]["output"][1]*profit[v]["output"][2]/profit[v]["runs"])); createElement("td",{"style":"text-align:right;padding-left:10px;"},newtr1,"("+moneyFormat(profit[v]["output"][3])+")"); createElement("td",{"style":"border-bottom:1px solid black;text-align:right;"},newtr1,moneyFormatInt(profit[v]["output"][1]*profit[v]["output"][3]/profit[v]["runs"])); newtr1=createElement("tr",{},newtable1); createElement("td",{"style":"border-bottom:1px solid black;","colspan":3},newtr1); createElement("td",{"style":"border-bottom:1px solid black;text-align:right;"},newtr1,moneyFormatInt(profit[v]["gut"]/profit[v]["runs"])); createElement("td",{"style":"border-bottom:1px solid black;padding-left:10px;"},newtr1); createElement("td",{"style":"border-bottom:1px solid black;text-align:right;"},newtr1,moneyFormatInt(profit[v]["gutBeob"]/profit[v]["runs"])); newtr1=createElement("tr",{},newtable1); createElement("td",{"colspan":2},newtr1,getText("dailyRuns")); createElement("td",{"colspan":4,"style":"padding-left:10px;"},newtr1,numberFormat(profit[v]["runs"],3)); createElement("td",{"style":"text-align:right;","mouseOverText":newdiv.innerHTML},newtr,moneyFormatInt(profit[v]["gut"])); createElement("td",{"style":"text-align:right;","mouseOverText":newdiv.innerHTML},newtr,moneyFormatInt(profit[v]["gutBeob"])); if(mode["jumpTo"]&&(mode["jumpTo"]==profit[v]["id"])){ delete mode["jumpTo"]; table.scrollTop=newtr.offsetTop; newspan=createElement("div",{"id":"vanishDiv","style":"position:absolute;top:0;left:0;height:15px;width:100%;background-color:blue;opacity:0.7;"},newtr.firstElementChild.firstElementChild); var intervalVanishDiv=window.setInterval(function(){ try{ var div=$("vanishDiv"); if(div){ var opac=parseFloat(div.style.opacity,10)-0.05; if(opac>0){ div.style.opacity=opac; } else{ removeElement(div); window.clearInterval(intervalVanishDiv); } }else{ window.clearInterval(intervalVanishDiv); } }catch(err){} },100); } } // foot line err_trace="foot line"; newdiv=createElement("div",{},container); table=createElement("table",{"border":"0","cellspacing":"0","style":"width:100%;"},newdiv); newtr=createElement("tr",{},table); newtd=createElement("td",{"align":"center"},newtr); newspan=createElement("input",{"type":"checkbox","class":"link","checked":mode["showAll"]},newtd); newspan.addEventListener("click",function(){ buildInfoPanelProfit({"showAll":this.checked}); },false); createElement("span",{},newtd,getText("showAll")); newtd=createElement("td",{"align":"center"},newtr); newspan=createElement("input",{"type":"checkbox","class":"link","checked":(mode["perc"]==0.9)},newtd); newspan.addEventListener("click",function(){ buildInfoPanelProfit({"perc":this.checked?0.9:1}); },false); createElement("span",{},newtd,"90%"); err_trace="saving"; container=null;table=null;newtr=null;newtd=null;newspan=null;newdiv=null;newtable1=null;newtr1=null;newtd1=null; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeProfittable",implode(mode,"buildInfoPanelProfit/modeProfittable")); }catch(err){ GM_logError("buildInfoPanelProfit ("+err_trace+")\nv="+v+"\n"+err); } } function buildInfoPanelQuests(mode){ try{ var err_trace="init"; var modeDefault={"type":"main","campaign":"1","sort":"product"}; var modeOld=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeQuestsTable"),"buildInfoPanelQuests/modeOld"); if(typeof modeOld!="object"){ modeOld=modeDefault; } if(typeof mode!="object"){ mode=modeOld; } for(var v in modeDefault){ if(!modeDefault.hasOwnProperty(v)){ continue; } if(mode[v]==undefined){ mode[v]=(modeOld[v]==undefined?modeDefault[v]:modeOld[v]); } } if(QUESTS[mode["type"]]==undefined){ mode["type"]="main"; } if(QUESTS[mode["type"]][mode["campaign"]]==undefined){ mode["campaign"]="1"; } //head line err_trace="head line"; var help; var table,tr,td,span,div,div1,table1,tr1,td1,tr2,td2; var container=$("infoPanelInner"); container.innerHTML=""; table=createElement("table",{"border":"0","cellspacing":"0","style":"width:100%;"},container); tr=createElement("tr",{},table); createElement("td",{"class":"tnormal","style":"color:black;font-weight:bold;text-align:center;"},tr,getText("quests")); // switch bar td=createElement("td",{},tr); td=createElement("div",{"style":"float:right"},td); for(var type in QUESTS){ if(!QUESTS.hasOwnProperty(type)){ continue; } for(var campaign in QUESTS[type]){ if(!QUESTS[type].hasOwnProperty(campaign)){ continue; } // createElement("td",{"class":"link hoverBgLightbrown","style":""+((type==mode["type"])&&(campaign==mode["campaign"])?"background-color:lightblue;":"")},tr2,campaign); div=createElement("div",{"class":"link quests_status_bar_item quests_status_bar_"+type+campaign+(((type==mode["type"])&&(campaign==mode["campaign"]))?"_active":""),"style":"-moz-user-select:none;display:block;","next":implode({"type":type,"campaign":campaign},"buildInfoPanelQuests/next")},td); div.addEventListener("mouseover",function(event){ var help=explode(this.getAttribute("next"),"buildInfoPanelQuests/next"); toolTip.show(event,getText("quest"+help["type"]+help["campaign"])); },false); div.addEventListener("click",function(event){ buildInfoPanelQuests(explode(this.getAttribute("next"),"buildInfoPanelQuests/next")); },false); if(questData[type]&&questData[type][campaign]&&(questData[type][campaign]["nr"]==-1)){ createElement("div",{"class":"rack_lock_page","style":"transform:scale(0.7);"},div); } } // createElement("td",{"style":"width:100px;","colspan":help},tr1,getText(type=="main"?"farm":type)); } // quest table err_trace="table"; div=createElement("div",{"style":"height:300px;width:100%;font-color:black;overflow:auto;border-top:1px solid black;","id":"questTable"},container); table=createElement("table",{"border":"0","cellspacing":"0","style":"width:100%;","class":"black"},div); err_trace="table.head"; tr=createElement("tr",{},table); td=createElement("th",{},tr,getText("nr")); td=createElement("th",{},tr,getText("demand")); td=createElement("th",{"colspan":"2"},tr,getText("value")); td=createElement("th",{},tr,getText("reward")); err_trace="table.body"; var questCurr,item,str,mouseOver; var questDone,questTotal={}; for(var v=1;v<QUESTS[mode["type"]][mode["campaign"]].length;v++){ if(questCurr=QUESTS[mode["type"]][mode["campaign"]][v]){ tr=createElement("tr",{"class":"hoverBgCc9 borderBottom1dashedGrey"},table); // white-space:nowrap; if((!questData[mode["type"]])||(!questData[mode["type"]][mode["campaign"]])){ questDone = true; }else if(questData[mode["type"]][mode["campaign"]]["nr"]>v){ questDone = true; tr.style.opacity=0.6; }else if(questData[mode["type"]][mode["campaign"]]["nr"]==v){ questDone = false; tr.style.backgroundColor="lightblue"; }else{ questDone = false; } createElement("td",{},tr,v); td=createElement("td",{},tr); // icon, name td1=createElement("td",{"style":"padding-right:10px;text-align:right;"},tr); // amount td2=createElement("td",{"style":"padding-right:10px;text-align:right;"},tr); // value for(var i=0;i<questCurr[0].length;i++){ if(questCurr[0][i]){ if(typeof questCurr[0][i][0]=="object"){ help=[null,null,]; for(var j=0;j<questCurr[0][i].length;j++){ item=questCurr[0][i][j]; if((item[0]==0)&&(!prodBlock[0][item[1]].match(/t/))){ help[2]=(item[2]*gut[item[1]]); }else{ help[2]=0; } if((help[1]==null)||(help[2]<help[1])){ help[0]=j; help[1]=help[2]; } } for(var j=0;j<questCurr[0][i].length;j++){ item=questCurr[0][i][j]; str="font-style:italic;" if(j!=help[0]){ str+="text-decoration:line-through;"; mouseOver=false; }else if(questDone){ mouseOver=false; }else{ if(!questTotal[item[0]]){ questTotal[item[0]]={}; } if(!questTotal[item[0]][item[1]]){ questTotal[item[0]][item[1]]=0; } questTotal[item[0]][item[1]]+=item[2]; mouseOver=true; } div=createElement("div",{"prod":item[1],"style":str},td); if(prodBlock[item[0]][item[1]].match(/[lq]/)){ div.classList.add("red"); div.addEventListener("mouseover",function(event){ toolTip.show(event,getText("levelTooLow")); },false); // TODO: correct text if blocked by quest }else if((item[0]==0)&&(!prodBlock[0][item[1]].match(/t/))){ div.classList.add("link"); div.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.getAttribute("prod")); },false); div.addEventListener("click",function(){ showMarket(this.getAttribute("prod")); },false); } produktPic(item[0],item[1],div); createElement("span",{"style":str},div,prodName[item[0]][item[1]]); div=createElement("div",{"style":str},td1,numberFormat(item[2])); if(mouseOver){ div.style.color=(prodStock[item[0]][item[1]]<questTotal[item[0]][item[1]]?"red":"green"); div.setAttribute("data",implode([item,questTotal[item[0]][item[1]]],"buildInfoPanelQuests/data")); div.addEventListener("mouseover",function(event){ var data=explode(this.getAttribute("data"),"buildInfoPanelQuests/data"); var container,table,tr; container=createElement("div"); table=createElement("table",{},container); tr=createElement("tr",{},table); createElement("td",{},tr,getText("inventory")); createElement("td",{"style":"text-align:right;"},tr,numberFormat(prodStock[data[0][0]][data[0][1]])); tr=createElement("tr",{"class":"borderBottom1Black"},table); createElement("td",{},tr,getText("total")); createElement("td",{"style":"text-align:right;"},tr,numberFormat(data[1])); tr=createElement("tr",{},table); createElement("td",{},tr); createElement("td",{"style":"text-align:right;"},tr,numberFormat(prodStock[data[0][0]][data[0][1]]-data[1])); toolTip.show(event,container.innerHTML); data=null; container=null;table=null;tr=null; },false); } createElement("div",{"style":str},td2,item[0]==0?moneyFormatInt(item[2]*gut[item[1]]):"--"); } }else{ item=questCurr[0][i]; if(questDone){ mouseOver=false; }else{ if(!questTotal[item[0]]){ questTotal[item[0]]={}; } if(!questTotal[item[0]][item[1]]){ questTotal[item[0]][item[1]]=0; } questTotal[item[0]][item[1]]+=item[2]; mouseOver=true; } div=createElement("div",{"prod":item[1]},td); if(prodBlock[item[0]][item[1]].match(/[lq]/)){ div.classList.add("red"); div.addEventListener("mouseover",function(event){ toolTip.show(event,getText("levelTooLow")); },false); // TODO: correct text if blocked by quest }else if((item[0]==0)&&(!prodBlock[0][item[1]].match(/t/))){ div.classList.add("link"); div.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.getAttribute("prod")); },false); div.addEventListener("click",function(){ showMarket(this.getAttribute("prod")); },false); } produktPic(item[0],item[1],div); createElement("span",{},div,prodName[item[0]][item[1]]); div=createElement("div",{},td1,numberFormat(item[2])); if(mouseOver){ div.style.color=(prodStock[item[0]][item[1]]<questTotal[item[0]][item[1]]?"red":"green"); div.setAttribute("data",implode([item,questTotal[item[0]][item[1]]],"buildInfoPanelQuests/data")); div.addEventListener("mouseover",function(event){ var data=explode(this.getAttribute("data"),"buildInfoPanelQuests/data"); var container,table,tr; container=createElement("div"); table=createElement("table",{},container); tr=createElement("tr",{},table); createElement("td",{},tr,getText("inventory")); createElement("td",{"style":"text-align:right;"},tr,numberFormat(prodStock[data[0][0]][data[0][1]])); tr=createElement("tr",{"class":"borderBottom1Black"},table); createElement("td",{},tr,getText("total")); createElement("td",{"style":"text-align:right;"},tr,numberFormat(data[1])); tr=createElement("tr",{},table); createElement("td",{},tr); createElement("td",{"style":"text-align:right;"},tr,numberFormat(prodStock[data[0][0]][data[0][1]]-data[1])); toolTip.show(event,container.innerHTML); data=null; container=null;table=null;tr=null; },false); } createElement("div",{},td2,item[0]==0?moneyFormatInt(item[2]*gut[item[1]]):"--"); } } } td=createElement("td",{"style":"white-space:nowrap;"},tr); if(questCurr[2]>0){ div=createElement("div",{},td); pointsFormat(questCurr[2],"div",div); // 70ms } if(questCurr[3]){ for(var w=0;w<questCurr[3].length;w++){ switch(questCurr[3][w][0]){ case 0:{ createElement("div",{},td,moneyFormat(questCurr[3][w][1])); break;} case 1:{ div=createElement("div",{},td); produktPic(questCurr[3][w][1],questCurr[3][w][2],div); createElement("span",{},div,numberFormat(questCurr[3][w][3])+" "+prodName[questCurr[3][w][1]][questCurr[3][w][2]]); break;} case 2:{ createElement("div",{},td,getText("activation")+": "+getText("rackX").replace(/%1%/,questCurr[3][w][1])); break;} case 3:{ createElement("div",{},td,getText("activation")+": "+getText("farmX").replace(/%1%/,questCurr[3][w][1])); break;} case 4:{ div=createElement("div",{},td); produktPic(questCurr[3][w][1],questCurr[3][w][2],div); createElement("span",{},div,getText("productTimeSaving").replace(/%1%/,questCurr[3][w][3]).replace(/%2%/,prodName[questCurr[3][w][1]][questCurr[3][w][2]])); break;} case 5:{ div=createElement("div",{},td); createElement("img",{"src":GFX+"adbonus.gif","style":"border:0;height:15px;"},div); createElement("span",{},div,getText("additionalFarmi").replace(/%1%/,questCurr[3][w][1])); break;} case 6:{ createElement("div",{},td,getText("additionalLogCapacity").replace(/%1%/,questCurr[3][w][1])); break;} case 7:{ createElement("div",{},td,getText("waterBonus").replace(/%1%/,questCurr[3][w][1])); break;} case 8:{ if(DATA_zones[questCurr[3][w][1]]["location"]=="farm"){ createElement("div",{},td,getText("activation")+": "+getText("farmzone").replace(/%1%/,1+((questCurr[3][w][1]-1)%6)).replace(/%2%/,Math.ceil(questCurr[3][w][1]/6))); }else{ createElement("div",{},td,getText("activation")+": "+zones.getBuildingName(questCurr[3][w][1])); } break;} case 9:{ div=createElement("div",{},td); createElement("span",{},div,getText("activation")+": "); produktPic(questCurr[3][w][1],questCurr[3][w][2],div); createElement("span",{},div,prodName[questCurr[3][w][1]][questCurr[3][w][2]]); break;} case 10:{ createElement("div",{},td,getText("activation")+": "+getText("wateringFeature")); break;} case 11:{ div=createElement("div",{},td); createElement("img",{"src":GFX+"adbonus.gif","style":"border:0;height:15px;"},div); createElement("span",{},div,getText("additionalForestFarmiSlot").replace(/%1%/,questCurr[3][w][1])); break;} case 12:{ div=createElement("div",{},td); createElement("span",{},div,unsafeWindow.quest_reward_6+": "); createElement("img",{"src":GFX+"farmhouse/thumbs/"+questCurr[3][w][1]+".jpg","style":"border:0;height:30px;width:30px;"},div); break;} case 13:{ div=createElement("div",{},td); createElement("span",{},div,getText("shadowboxitem")+": "); createElement("img",{"src":GFX+"gifts/"+questCurr[3][w][1]+".gif","style":"border:0;height:30px;width:30px;"},div); break;} } } } } } // all quests done if(questData[mode["type"]]&&questData[mode["type"]][mode["campaign"]]&&(questData[mode["type"]][mode["campaign"]]["nr"]>=QUESTS[mode["type"]][mode["campaign"]].length)){ tr=createElement("tr",{"class":"hoverBgCc9 borderBottom1dashedGrey","style":"color:black;"},table); tr.style.backgroundColor="lightblue"; createElement("td",{},tr,questData[mode["type"]][mode["campaign"]]["nr"]); createElement("td",{},tr); createElement("td",{},tr); createElement("td",{},tr); } // scroll to current quest if(questData[mode["type"]][mode["campaign"]]["nr"]>1){ window.setTimeout(function(scr){ $("questTable").scrollTop=scr; },0,table.children[Math.min(table.childElementCount,questData[mode["type"]][mode["campaign"]]["nr"])].offsetTop); } err_trace="select calcTo"; div=createElement("div",{"style":"height:20px;width:100%;font-color:black;overflow:auto;border-top:1px solid black;"},container); createElement("span",{},div,getText("calcTo")+":"); span = createElement("select",{"id":"selectQuestCalcTo","style":"width:auto;height:18px;margin-left:5px;","mode":implode(mode,"buildInfoPanelQuests/selectQuestCalcTo")},div); createElement("option",{"value":-1},span,getText("hide")); createElement("option",{"value":0},span,"--"); for(var i=questData[mode["type"]][mode["campaign"]]["nr"];i<QUESTS[mode["type"]][mode["campaign"]].length;i++){ createElement("option",{"value":i},span,i); } span.addEventListener("change",function(){ if(isNaN(this.value)){return false;} var mode=explode(this.getAttribute("mode"),"buildInfoPanelQuests/selectQuestCalcTo"); setCalcToQuest(mode["type"],mode["campaign"],this.value); buildInfoPanelQuestsTotal(mode); },false); span.value = questData[mode["type"]][mode["campaign"]]["calcTo"]; err_trace="total table"; div=createElement("div",{"style":"height:155px;width:100%;overflow:auto;","id":"questTableTotal"},container); function buildInfoPanelQuestsTotal(mode){ try{ var err_trace="init"; var modeDefault={"type":"main","campaign":"1","sort":"product"}; var modeOld=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeQuestsTable"),"buildInfoPanelQuestsTotal/modeOld"); if(typeof modeOld!="object"){ modeOld=modeDefault; } if(typeof mode!="object"){ mode=modeOld; } for(var v in modeDefault){ if(!modeDefault.hasOwnProperty(v)){ continue; } if(mode[v]==undefined){ mode[v]=(modeOld[v]==undefined?modeDefault[v]:modeOld[v]); } } err_trace="calc object"; var obj=new Object(); var questCurr,item,help; for(var v=questData[mode["type"]][mode["campaign"]]["nr"];v<=questData[mode["type"]][mode["campaign"]]["calcTo"];v++){ questCurr=QUESTS[mode["type"]][mode["campaign"]][v]; if(questCurr){ for(var i=0;i<questCurr[0].length;i++){ if(questCurr[0][i]){ if(typeof questCurr[0][i][0]=="object"){ help=[null,null,]; for(var j=0;j<questCurr[0][i].length;j++){ item=questCurr[0][i][j]; if((item[0]==0)&&(!prodBlock[0][item[1]].match(/t/))){ help[2]=(item[2]*gut[item[1]]); }else{ help[2]=0; } if((help[1]==null)||(help[2]<help[1])){ help[0]=j; help[1]=help[2]; } } item=questCurr[0][i][help[0]]; }else{ item=questCurr[0][i]; } if(!obj[item[0]]){ obj[item[0]]={}; } if(!obj[item[0]][item[1]]){ obj[item[0]][item[1]]=0; } obj[item[0]][item[1]] += item[2]; } } } } err_trace="calc array"; var arr=new Array(); // [type,prodId,amount,amountValue,missing,missingValue] for(var type in obj){ if(!obj.hasOwnProperty(type)){continue;} for(var prod in obj[type]){ if(!obj[type].hasOwnProperty(prod)){continue;} help=(prodStock[type][prod]?prodStock[type][prod]:0); if((item[0]==0)&&(gut[prod])){ arr.push([type,prod,obj[type][prod],obj[type][prod]*gut[prod],(obj[type][prod]-help),(obj[type][prod]-help)*gut[prod]]); }else{ arr.push([type,prod,obj[type][prod],0,(obj[type][prod]-help),0]); } } } err_trace="sort array"; switch(mode["sort"]){ case "product": arr.sort(function (a,b){ if(a[0]==b[0]){ return(a[1]-b[1]); }else{ return(a[0]-b[0]); } }); break; case "absolute": arr.sort(function (a,b){ return(b[2]-a[2]); }); break; case "absoluteValue": arr.sort(function (a,b){ return(b[3]-a[3]); }); break; case "relative": arr.sort(function (a,b){ return(b[4]-a[4]); }); break; case "relativeValue": arr.sort(function (a,b){ return(b[5]-a[5]); }); break; } // table err_trace="table"; var container,table,tr,td,div; container=$("questTableTotal"); container.innerHTML=""; table=createElement("table",{"class":"black","border":"0","cellspacing":"0","style":"width:100%;"},container); table.addEventListener("mouseover",function(event){ var node=event.target; var mouseOverText=node.getAttribute("mouseOverText"); while((node!=this)&&(!mouseOverText)){ node=node.parentNode; mouseOverText=node.getAttribute("mouseOverText"); } if(mouseOverText){ toolTip.show(event,mouseOverText); } node=null;mouseOverText=null; },false); err_trace="table.head"; tr=createElement("tr",{"class":"borderBottom1dashedBlack"},table); td=createElement("th",{"class":"link hoverBgCc9"+(mode["sort"]=="product"?" sortableColDesc":"")},tr,getText("product")); td.addEventListener("click",function(){ buildInfoPanelQuestsTotal({"sort":"product"}); },false); td=createElement("th",{"class":"link hoverBgCc9"+(mode["sort"]=="absolute"?" sortableColDesc":"")},tr,getText("absolute")); td.addEventListener("click",function(){ buildInfoPanelQuestsTotal({"sort":"absolute"}); },false); td=createElement("th",{"class":"link hoverBgCc9"+(mode["sort"]=="absoluteValue"?" sortableColDesc":"")},tr,getText("value")); td.addEventListener("click",function(){ buildInfoPanelQuestsTotal({"sort":"absoluteValue"}); },false); td=createElement("th",{"class":"link hoverBgCc9"+(mode["sort"]=="relative"?" sortableColDesc":"")},tr,getText("relative")); td.addEventListener("click",function(){ buildInfoPanelQuestsTotal({"sort":"relative"}); },false); td=createElement("th",{"class":"link hoverBgCc9"+(mode["sort"]=="relativeValue"?" sortableColDesc":"")},tr,getText("value")); td.addEventListener("click",function(){ buildInfoPanelQuestsTotal({"sort":"relativeValue"}); },false); err_trace="table.body"; help=null; for(var i=0;i<arr.length;i++){ item=arr[i]; tr=createElement("tr",{"class":"hoverBgCc9","prod":item[1]},table); if(mode["sort"]=="product"){ if(help==null){ help=item[0]; } else if(help!=item[0]){ tr.classList.add("borderTop1dashedBlack"); help=item[0]; } } if(prodBlock[item[0]][item[1]].match(/[lq]/)){ tr.classList.add("red"); tr.addEventListener("mouseover",function(event){ toolTip.show(event,getText("levelTooLow")); },false); // TODO: correct text if blocked by quest }else if((item[0]==0)&&(!prodBlock[0][item[1]].match(/t/))){ tr.classList.add("link"); tr.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.getAttribute("prod")); },false); tr.addEventListener("click",function(){ showMarket(this.getAttribute("prod")); },false); } td=createElement("td",{"style":"white-space:nowrap;"},tr); div=createElement("div",{},td); produktPic(item[0],item[1],div); createElement("span",{},div,prodName[item[0]][item[1]]); createElement("td",{"style":"text-align:right;"},tr,numberFormat(item[2])); createElement("td",{"style":"text-align:right;"},tr,item[3]==0?"--":moneyFormatInt(item[3])); createElement("td",{"style":"text-align:right;"},tr,numberFormat(item[4])); createElement("td",{"style":"text-align:right;"},tr,item[5]==0?"--":moneyFormatInt(item[5])); } err_trace="saving"; container=null;table=null;thead=null;tbody=null;tr=null;td=null;span=null;div=null;table1=null;tr1=null;td1=null;tr2=null;td2=null; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeQuestsTable",implode(mode,"buildInfoPanelQuestsTotal/modeQuestsTable")); }catch(err){ GM_logError("buildInfoPanelQuestsTotal ("+err_trace+")\n"+err); } } buildInfoPanelQuestsTotal(mode); err_trace="saving"; container=null;table=null;thead=null;tbody=null;tr=null;td=null;span=null;div=null;table1=null;tr1=null;td1=null;tr2=null;td2=null; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeQuestsTable",implode(mode,"buildInfoPanelQuests/modeQuestsTable")); }catch(err){ GM_logError("buildInfoPanelQuests ("+err_trace+")\n"+err); } } function buildInfoPanelZones(){ try{ var container=$("infoPanelInner"); container.innerHTML=""; var c,totalPunkte=0,zoneNrF,points,endDay,help; createElement("div",{"class":"tnormal borderBottom1Black","align":"center","style":"line-height:30px;font-weight:bold;"},container,getText("overview")); container=createElement("div",{"style":"width:595px;height:485px;overflow:auto;"},container); // Zones newtable=createElement("table",{"style":"width:100%;","border":"1"},container); for(var i in ALL_ZONES){ if(!ALL_ZONES.hasOwnProperty(i)){ continue; } c=0; newtr=createElement("tr",{},newtable); createElement("th",{"colspan":"6"},newtr,getText(i)); for(var j=0;j<ALL_ZONES[i].length;j++){ zoneNrF=ALL_ZONES[i][j]; if(zones.isProductional(zoneNrF)&&(!zones.getBlock(zoneNrF))){ if(c%3==0){ newtr=createElement("tr",{"style":"width:100%;"},newtable); } newtd=createElement("td",{"style":"width:33%;","colspan":"2","zoneNrF":zoneNrF,"class":"link hoverBgCc9"},newtr); newtd.addEventListener("mouseover",function(event){ toolTip.show(event,toolTipZoneProduction(this.getAttribute("zoneNrF"))); },false); newtd.addEventListener("click",function(){ closeInfoPanel(); goToZone(this.getAttribute("zoneNrF")); },false); newdiv=createElement("div",{"style":"position:relative;top:0;height:70px;overflow:hidden;"},newtd); createElement("div",{"class":"zoneBg70_"+zones.getBuilding(zoneNrF),"style":"position:absolute;opacity:0.3;"},newdiv); newdiv1=createElement("div",{"style":"position:absolute;top:0;height:61px;width:100%;overflow:auto;"},newdiv); newdiv=createElement("div",{},newdiv1); help=zones.getEndtime(zoneNrF); if (help!=NEVER){ endDay=countDays(now,help); if(endDay==0){ newdiv.innerHTML=getDaytimeStr(help,1)+" "+getText("shortOClock"); }else if(getText("day"+endDay)){ newdiv.innerHTML=getText("day"+endDay)+" "+getDaytimeStr(help,1)+" "+getText("shortOClock"); }else{ newdiv.innerHTML=new Date(1000*help).toLocaleString(); } }else{ newdiv.innerHTML=getText("idle"); } if (help<now){ newdiv.style.textDecoration="blink"; newdiv.style.fontWeight="bold"; } points=0; if(help=zones.getCrop(zoneNrF)){ for(var k=0;k<help.length;k++){ newdiv=createElement("div",{"style":"line-height:16px;"},newdiv1); produktPic(help[k][0],help[k][1],newdiv); createElement("div",{"style":"display:inline-block;"},newdiv,numberFormat(help[k][2])+" "+prodName[help[k][0]][help[k][1]]); points += help[k][3]; } }else{ newdiv=createElement("div",{"style":"line-height:16px;"},newdiv1); createElement("div",{"style":"display:inline-block;"},newdiv,"???"); } pointsFormat(points,"div",newdiv1); totalPunkte += points; c++; } } } // Total production newtable=createElement("table",{"style":"width:100%;margin-top:10px;","border":"1"},container); newtr=createElement("tr",{},newtable); createElement("th",{},newtr,getText("total")); newtd=createElement("th",{"class":"link hoverBgCc9"},newtr,getText("missing")); newtd.addEventListener("mouseover",function(event){ toolTip.show(event,getText("toSGH")); },false); newtd.addEventListener("click",showSGH,false); newtr=createElement("tr",{},newtable); newtd=createElement("td",{},newtr); for(var k in totalErnte[0]){ if(!totalErnte[0].hasOwnProperty(k)){ continue; } newdiv=createElement("div",{"style":"height:16px"},newtd); produktPic(0,k,newdiv); createElement("div",{"style":"display:inline-block;"},newdiv,numberFormat(totalErnte[0][k])+" "+prodName[0][k]); } pointsFormat(totalPunkte,"div",newtd); var newtdfehlt=createElement("td",{},newtr); // Farmi overview newtable=createElement("table",{"style":"width:100%;margin-top:10px;","border":"1"},container); newtr=createElement("tr",{},newtable); createElement("th",{},newtr,getText("farmi")); createElement("th",{},newtr,getText("products")); createElement("th",{},newtr,getText("money")); createElement("th",{"colspan":"2"},newtr,getText("value")); var farmiNr=-1; var farmiCount=0; var farmiSum=new Object; var farmiCash=0; var farmiWert=0; while (top.window.wrappedJSObject.farmisinfo[0][++farmiNr]){ if (!top.window.wrappedJSObject.farmisaway[farmiNr]){ farmiCount++; newtr=createElement("tr",{},newtable); newtd=createElement("td",{"class":"link hoverBgCc9","name":farmiNr},newtr); var farmiGfxNr=top.window.wrappedJSObject.farmisinfo[0][farmiNr]["pic"]; createElement("img",{"src":GFX+"verkauf/kunde_"+farmiGfxNr+"_still.gif","style":"width:"+FARMISIZE[farmiGfxNr][0]+"px;height:"+FARMISIZE[farmiGfxNr][1]+"px;"},newtd); newtd.addEventListener("click",function(){ closeInfoPanel(); if ($("citymaincontainer").style.display=="block"){ unsafeWindow.initZones(1); unsafeWindow.showMain(); } unsafeWindow.showCart(parseInt(this.getAttribute("name"),10)); },false); newtd=createElement("td",{},newtr); var cash=parseFloat(top.window.wrappedJSObject.farmisinfo[0][farmiNr]["price"],10); var wert=0; for(var i=1 ; i <= 7 ; i++){ // 7=maxanzahl produkte pro farmi var pid=parseInt(top.window.wrappedJSObject.farmisinfo[0][farmiNr]["p"+i],10); var amount=parseInt(top.window.wrappedJSObject.farmisinfo[0][farmiNr]["a"+i],10); if((pid > 0) && (amount > 0)){ newdiv=createElement("div",{},newtd); produktPic(0,pid,newdiv); newdiv1=createElement("div",{"class":"link hoverBgCc9","style":"display:inline-block;"+(prodStock[0][pid]<amount?"color:red;":""),"prod":pid},newdiv,numberFormat(amount)+" "+prodName[0][pid]); newdiv1.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.getAttribute("prod")); },false); newdiv1.addEventListener("click",function(){showMarket(this.getAttribute("prod"));},false); if (farmiSum[pid]) farmiSum[pid] += amount; else farmiSum[pid]=amount; wert += amount*gut[pid]; } } farmiCash += cash; farmiWert += wert; newtd=createElement("td",{"style":"text-align:right;"},newtr); createElement("div",{},newtd,moneyFormat(cash)); createElement("div",{},newtd,numberFormat(100*cash/wert,1)+"%"); newtd=createElement("td",{"style":"text-align:right;"},newtr); newdiv=createElement("div",{},newtd,moneyFormat(wert)); newdiv.addEventListener("mouseover",function(event){ toolTip.show(event,"100%"); },false); newdiv=createElement("div",{},newtd,moneyFormat(0.9*wert)); newdiv.addEventListener("mouseover",function(event){ toolTip.show(event,"90%"); },false); newtd=createElement("td",{"style":"text-align:right;"},newtr); newdiv=createElement("div",{},newtd,(cash>wert?"+":"")+moneyFormatInt(cash-wert)); newdiv.addEventListener("mouseover",function(event){ toolTip.show(event,"100%"); },false); newdiv=createElement("div",{},newtd,(cash>0.9*wert?"+":"")+moneyFormatInt(cash-0.9*wert)); newdiv.addEventListener("mouseover",function(event){ toolTip.show(event,"90%"); },false); } } if (farmiCount>0){ newtr.setAttribute("class","borderBottom2"); newtr=createElement("tr",{"class":"borderTop2"},newtable); createElement("td",{},newtr); newtd=createElement("td",{},newtr); for(var v in farmiSum){ if(!farmiSum.hasOwnProperty(v)){ continue; } newdiv=createElement("div",{},newtd); produktPic(0,v,newdiv); createElement("div",{"style":"display:inline-block;"},newdiv,numberFormat(farmiSum[v])+" "+prodName[0][v]); } newtd=createElement("td",{"style":"text-align:right;"},newtr); createElement("div",{},newtd,moneyFormat(farmiCash)); createElement("div",{},newtd,numberFormat(100*farmiCash/farmiWert,1)+"%"); newtd=createElement("td",{"style":"text-align:right;"},newtr); newdiv=createElement("div",{},newtd,moneyFormat(farmiWert)); newdiv.addEventListener("mouseover",function(event){ toolTip.show(event,"100%"); },false); newdiv=createElement("div",{},newtd,moneyFormat(0.9*farmiWert)); newdiv.addEventListener("mouseover",function(event){ toolTip.show(event,"90%"); },false); newtd=createElement("td",{"style":"text-align:right;"},newtr); newdiv=createElement("div",{},newtd,(farmiCash>farmiWert?"+":"")+moneyFormatInt(farmiCash-farmiWert)); newdiv.addEventListener("mouseover",function(event){ toolTip.show(event,"100%"); },false); newdiv=createElement("div",{},newtd,(farmiCash>0.9*farmiWert?"+":"")+moneyFormatInt(farmiCash-0.9*farmiWert)); newdiv.addEventListener("mouseover",function(event){ toolTip.show(event,"90%"); },false); }else{ newtr=createElement("tr",{},newtable); createElement("td",{"colspan":"6"},newtr,"---"); } for(var w=0;w<prodNameSort[0].length;w++){ var v=prodNameSort[0][w]; if((!prodBlock[0][v].match(/t/))&&(!prodBlock[0][v].match(/l/))){ var amount1=(farmiSum[v]?farmiSum[v]:0)-prodStock[0][v]; var amount=amount1+prodMinRack[0][v]; if (amount>0){ newdiv=createElement("div",{},newtdfehlt); produktPic(0,v,newdiv); newdiv1=createElement("div",{"style":"display:inline-block;","class":"link hoverBgCc9","name":v},newdiv,numberFormat(amount)+(amount1>0?" ("+numberFormat(amount1)+")":"")+" "+prodName[0][v]); newdiv1.addEventListener("mouseover",function(event){showGoToMarketToolTip(event,this.getAttribute("name"));},false); newdiv1.addEventListener("click",function(){showMarket(this.getAttribute("name"));},false); } } } newtdfehlt=null; }catch(err){GM_logError("buildInfoPanelZones\n"+err);} } function buildInfoPanelUpjersAds(){ try{ var container=$("infoPanelInner"); container.innerHTML=""; createElement("div",{"align":"center","style":"font-weight:bold;line-height:30px;"},container,getText("upjersAdvertising")); for(var v=0;v<upjersAds.length;v++){ createElement("div",{"style":"padding:5px;margin:5px;border:1px solid black;"},container,upjersAds[v]); } }catch(err){GM_logError("buildInfoPanelUpjersAds\n"+err);} } function buildInfoPanelLottery(mode){ try{ var modeDefault={"total":false}; var modeOld=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeInfoPanelLottery"),"buildInfoPanelLottery/modeOld"); if(typeof modeOld!="object"){ modeOld=modeDefault; } if(typeof mode!="object"){ mode=modeOld; } for(var v in modeDefault){ if(!modeDefault.hasOwnProperty(v)){ continue; } if(mode[v]==undefined){ mode[v]=(modeOld[v]==undefined?modeDefault[v]:modeOld[v]); } } GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeInfoPanelLottery",implode(mode,"buildInfoPanelLottery/mode")); // implode data older than last month var stichtag=new Date(); stichtag=Math.round(((new Date(stichtag.getFullYear(),stichtag.getMonth()-1,1)).getTime())/1000); var month; for(var v=lotteryLog.length-1;v>=0;v--){ if(lotteryLog[v][0].match(/\d+\.\d+\.\d+/)){ if(getTime(lotteryLog[v][0])<stichtag){ month=/\d+\.(\d+)\.(\d+)/.exec(lotteryLog[v][0]); if(month[1].length==1){ month=month[2]+"-0"+month[1]; }else{ month=month[2]+"-"+month[1]; } for(var w=0;w<lotteryLog.length;w++){ if(lotteryLog[w][0]==month){ break; } } if(!lotteryLog[w]){ lotteryLog[w]=[month,[],[],{},[]]; } if(lotteryLog[v][1]>0){ if(lotteryLog[v][2]&&(!lotteryLog[v][2].isEmpty())){ if(!lotteryLog[w][2][lotteryLog[v][1]]){ lotteryLog[w][2][lotteryLog[v][1]]=0; } lotteryLog[w][2][lotteryLog[v][1]]++; for(var p in lotteryLog[v][2]){ if(!lotteryLog[v][2].hasOwnProperty(p)){ continue; } if(!lotteryLog[w][3][p]){ lotteryLog[w][3][p]=0; } lotteryLog[w][3][p] += lotteryLog[v][2][p]; } }else{ if(!lotteryLog[w][1][lotteryLog[v][1]]){ lotteryLog[w][1][lotteryLog[v][1]]=0; } lotteryLog[w][1][lotteryLog[v][1]]++; } } // lotteryLog[w][2].sortObj(sortObjFunctions["productId"]); if(lotteryLog[v][3]){ for(var p=0;p<lotteryLog[v][3].length;p++){ if(!lotteryLog[w][4][lotteryLog[v][3][p]]){ lotteryLog[w][4][lotteryLog[v][3][p]]=0; } lotteryLog[w][4][lotteryLog[v][3][p]]++; } } lotteryLog.splice(v,1); } } } lotteryLog.sort(sortObjFunctions["date"]); GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_lotteryLog",implode(lotteryLog)); var container,newdiv,newtable,newtable1,newtr,newtr1,newtd,newinput; container=$("infoPanelInner"); container.innerHTML=""; // Head newdiv=createElement("div",{"class":"borderBottom1Black","style":"height:30px;"},container); newtable=createElement("table",{"class":"tnormal","style":"font-weight:bold;width:100%;"},newdiv); newtr=createElement("tr",{},newtable); createElement("td",{"class":"tnormal","style":"font-weight:bold;text-align:center;"},newtr,getText("lotteryLog")); newtd=createElement("td",{},newtr); newdiv=createElement("div",{"class":"link naviItem"+(!mode["total"]?"Active":"")},newtd,getText("detail")); newdiv.addEventListener("click",function(){ buildInfoPanelLottery({"total":false}); },false); newdiv=createElement("div",{"class":"link naviItem"+(mode["total"]?"Active":"")},newtd,getText("total")); newdiv.addEventListener("click",function(){ buildInfoPanelLottery({"total":true}); },false); // Content newdiv=createElement("div",{"style":"height:485px;overflow:auto;"},container); newtable=createElement("table",{"style":"line-height:16px;width:100%","border":"1"},newdiv); newtr=createElement("tr",{},newtable); if(mode["total"]){ // prepare data var lotteryLogTotal=[[],[],{},[]]; for(var v=lotteryLog.length-1;v>=0;v--){ if(lotteryLog[v][0].match(/\d+\.\d+\.\d+/)){ if(lotteryLog[v][1]>0){ if(lotteryLog[v][2]&&(!lotteryLog[v][2].isEmpty())){ if(!lotteryLogTotal[1][lotteryLog[v][1]]){ lotteryLogTotal[1][lotteryLog[v][1]]=0; } lotteryLogTotal[1][lotteryLog[v][1]]++; for(var p in lotteryLog[v][2]){ if(!lotteryLog[v][2].hasOwnProperty(p)){ continue; } if(!lotteryLogTotal[2][p]){ lotteryLogTotal[2][p]=0; } lotteryLogTotal[2][p] += lotteryLog[v][2][p]; } }else{ if(!lotteryLogTotal[0][lotteryLog[v][1]]){ lotteryLogTotal[0][lotteryLog[v][1]]=0; } lotteryLogTotal[0][lotteryLog[v][1]]++; } } // lotteryLogTotal[2].sortObj(sortObjFunctions["productId"]); if(lotteryLog[v][3]){ for(var p=0;p<lotteryLog[v][3].length;p++){ if(!lotteryLogTotal[3][lotteryLog[v][3][p]]){ lotteryLogTotal[3][lotteryLog[v][3][p]]=0; } lotteryLogTotal[3][lotteryLog[v][3][p]]++; } } }else{ for(var j=0;j<4;j++){ if(j==2){ continue; } for(var i=0;i<lotteryLog[v][j+1].length;i++){ if(lotteryLog[v][j+1][i]>0){ if(!lotteryLogTotal[j][i]){ lotteryLogTotal[j][i]=0; } lotteryLogTotal[j][i] += lotteryLog[v][j+1][i]; } } } for(var prod in lotteryLog[v][3]){ if(!lotteryLog[v][3].hasOwnProperty(prod)){ continue; } if(!lotteryLogTotal[2][prod]){ lotteryLogTotal[2][prod]=0; } lotteryLogTotal[2][prod] += lotteryLog[v][3][prod]; } } } // plot table createElement("th",{"style":"white-space:nowrap;"},newtr,getText("dailyTicket")); createElement("th",{"style":"white-space:nowrap;"},newtr,getText("boughtTickets")); newtr=createElement("tr",{},newtable); newtd=createElement("td",{},newtr); newdiv=createElement("div",{"style":"margin-bottom:3px;"},newtd); newdiv.addEventListener("mouseover",function(event){ toolTip.show(event,getText("keptLots")); },false); var c=0; for(var i=0;i<lotteryLogTotal[0].length;i++){ if(lotteryLogTotal[0][i]>0){ c += lotteryLogTotal[0][i]; newdiv1=createElement("div",{"style":"position:relative;display:inline-block;margin-right:2px;"},newdiv); createElement("img",{"style":"width:20px;border:0;","src":GFX+"city/"+i+".jpg"},newdiv1); createElement("span",{},newdiv1,lotteryLogTotal[0][i]); } } if(c>0){ createElement("div",{"style":"position:relative;display:inline-block;"},newdiv," = "+c+sign_mult); } var changedLots=0; newdiv=createElement("div",{"style":""},newtd); newdiv.addEventListener("mouseover",function(event){ toolTip.show(event,getText("exchangedLots")); },false); for(var i=0;i<lotteryLogTotal[1].length;i++){ if(lotteryLogTotal[1][i]>0){ changedLots += lotteryLogTotal[1][i]; newdiv1=createElement("div",{"style":"position:relative;display:inline-block;margin-right:2px;"},newdiv); createElement("img",{"style":"width:20px;border:0;","src":GFX+"city/"+i+".jpg"},newdiv1); createElement("span",{},newdiv1,lotteryLogTotal[1][i]); } } if(changedLots>0){ createElement("div",{"style":"position:relative;display:inline-block;"},newdiv," = "+changedLots+sign_mult); } var c,sum=0; newtable1=createElement("table",{"style":"display:inline-block;padding-right:5px;margin-right:5px;","border":"0","cellspacing":"0"},newtd); for(var prod in lotteryLogTotal[2]){ if(!lotteryLogTotal[2].hasOwnProperty(prod)){ continue; } newtr1=createElement("tr",{"class":"link hoverBgLightblue","prod":prod},newtable1); newtr1.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.getAttribute("prod")); },false); newtr1.addEventListener("click",function(){showMarket(this.getAttribute("prod"));},false); produktPic(0,prod,createElement("td",{},newtr1)); createElement("td",{"style":"text-align:right;"},newtr1,numberFormat(lotteryLogTotal[2][prod])); createElement("td",{"style":"padding-right:5px;"},newtr1,prodName[0][prod]); c=lotteryLogTotal[2][prod]*gut[prod]; sum += c; createElement("td",{"style":"text-align:right;"},newtr1,moneyFormat(c)); } newtr1=createElement("tr",{},newtable1); createElement("td",{"colspan":"2"},newtr1); createElement("td",{"style":"border-top:1px solid black;"},newtr1,sign_sum); createElement("td",{"style":"border-top:1px solid black;text-align:right;"},newtr1,moneyFormat(sum)); newtr1=createElement("tr",{},newtable1); createElement("td",{"colspan":"2"},newtr1); createElement("td",{},newtr1,sign_average); createElement("td",{"style":"text-align:right;"},newtr1,moneyFormat(sum/changedLots)); c=0; newtd=createElement("td",{},newtr); for(var i=0;i<lotteryLogTotal[3].length;i++){ if(lotteryLogTotal[3][i]>0){ c += lotteryLogTotal[3][i]; newdiv1=createElement("div",{"style":"position:relative;display:inline-block;margin-right:2px;"},newdiv); createElement("img",{"style":"width:20px;border:0;","src":GFX+"city/"+i+".jpg"},newdiv1); createElement("span",{},newdiv1,lotteryLogTotal[3][i]); } } if(c>0){ createElement("div",{"style":"position:relative;display:inline-block;"},newdiv," = "+c+sign_mult); } }else{ createElement("th",{"style":"white-space:nowrap;"},newtr,getText("day")); createElement("th",{"style":"white-space:nowrap;"},newtr,getText("dailyTicket")); createElement("th",{"style":"white-space:nowrap;"},newtr,getText("boughtTickets")); for(var v=lotteryLog.length-1;v>=0;v--){ newtr=createElement("tr",{},newtable); createElement("td",{},newtr,lotteryLog[v][0]); if(lotteryLog[v][0].match(/\d+\.\d+\.\d+/)){ newtd=createElement("td",{},newtr); newdiv=createElement("div",{"style":"display:inline-block;margin-right:3px;vertical-align:top;"},newtd); if(lotteryLog[v][1]>0){ createElement("img",{"style":"width:20px;border:0;","src":GFX+"city/"+lotteryLog[v][1]+".jpg"},newdiv); } if(lotteryLog[v][2]){ var c,sum=0; newtable1=createElement("table",{"style":"display:inline-block;border-right:1px solid black;padding-right:5px;margin-right:5px;","border":"0","cellspacing":"0"},newtd); for(var prod in lotteryLog[v][2]){ if(!lotteryLog[v][2].hasOwnProperty(prod)){ continue; } newtr1=createElement("tr",{"class":"link hoverBgLightblue","prod":prod},newtable1); newtr1.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.getAttribute("prod")); },false); newtr1.addEventListener("click",function(){showMarket(this.getAttribute("prod"));},false); produktPic(0,prod,createElement("td",{},newtr1)); createElement("td",{"style":"text-align:right;"},newtr1,numberFormat(lotteryLog[v][2][prod])); createElement("td",{"style":"padding-right:5px;"},newtr1,prodName[0][prod]); c=lotteryLog[v][2][prod]*gut[prod]; sum += c; createElement("td",{"style":"text-align:right;"},newtr1,moneyFormat(c)); } createElement("div",{"style":"display:inline-block;vertical-align:bottom;"},newtd,moneyFormat(sum)); } newtd=createElement("td",{},newtr); if(lotteryLog[v][3]){ for(var w=0;w<lotteryLog[v][3].length;w++){ createElement("img",{"style":"width:20px;border:0;","src":GFX+"city/"+lotteryLog[v][3][w]+".jpg"},newtd); } } }else{ newtd=createElement("td",{},newtr); newdiv=createElement("div",{"style":"margin-bottom:3px;"},newtd); newdiv.addEventListener("mouseover",function(event){ toolTip.show(event,getText("keptLots")); },false); var c=0; for(var i=0;i<lotteryLog[v][1].length;i++){ if(lotteryLog[v][1][i]>0){ c += lotteryLog[v][1][i]; newdiv1=createElement("div",{"style":"position:relative;display:inline-block;margin-right:2px;"},newdiv); createElement("img",{"style":"width:20px;border:0;","src":GFX+"city/"+i+".jpg"},newdiv1); createElement("span",{},newdiv1,lotteryLog[v][1][i]); } } if(c>0){ createElement("div",{"style":"position:relative;display:inline-block;"},newdiv," = "+c+sign_mult); } var changedLots=0; newdiv=createElement("div",{"style":""},newtd); newdiv.addEventListener("mouseover",function(event){ toolTip.show(event,getText("exchangedLots")); },false); for(var i=0;i<lotteryLog[v][2].length;i++){ if(lotteryLog[v][2][i]>0){ changedLots += lotteryLog[v][2][i]; newdiv1=createElement("div",{"style":"position:relative;display:inline-block;margin-right:2px;"},newdiv); createElement("img",{"style":"width:20px;border:0;","src":GFX+"city/"+i+".jpg"},newdiv1); createElement("span",{},newdiv1,lotteryLog[v][2][i]); } } if(changedLots>0){ createElement("div",{"style":"position:relative;display:inline-block;"},newdiv," = "+changedLots+sign_mult); } var sum=0; for(var prod in lotteryLog[v][3]){ if(!lotteryLog[v][3].hasOwnProperty(prod)){ continue; } newdiv=createElement("div",{"class":"link hoverBgLightblue","prod":prod,"style":"position:relative;display:inline-block;margin-right:3px;"},newtd); newdiv.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.getAttribute("prod")); },false); newdiv.addEventListener("click",function(){showMarket(this.getAttribute("prod"));},false); produktPic(0,prod,newdiv); createElement("span",{"style":"text-align:right;"},newdiv,numberFormat(lotteryLog[v][3][prod])); c=lotteryLog[v][3][prod]*gut[prod]; sum += c; } createElement("div",{},newtd,moneyFormat(sum)+" ("+sign_average+moneyFormat(sum/changedLots)+")"); c=0; newtd=createElement("td",{},newtr); for(var i=0;i<lotteryLog[v][4].length;i++){ if(lotteryLog[v][4][i]>0){ c += lotteryLog[v][4][i]; newdiv1=createElement("div",{"style":"position:relative;display:inline-block;margin-right:2px;"},newdiv); createElement("img",{"style":"width:20px;border:0;","src":GFX+"city/"+i+".jpg"},newdiv1); createElement("span",{},newdiv1,lotteryLog[v][4][i]); } } if(c>0){ createElement("div",{"style":"position:relative;display:inline-block;"},newdiv," = "+c+sign_mult); } } } } container=null;newdiv=null;newtable=null;newtable1=null;newtr=null;newtr1=null;newtd=null;newinput=null; }catch(err){GM_logError("buildInfoPanelLottery\n"+err);} } function buildInfoPanelDonkey(mode){ try{ var modeDefault={"total":false}; var modeOld=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeInfoPanelDonkey"),"buildInfoPanelDonkey/modeOld"); if(typeof modeOld!="object"){ modeOld=modeDefault; } if(typeof mode!="object"){ mode=modeOld; } for(var v in modeDefault){ if(!modeDefault.hasOwnProperty(v)){ continue; } if(mode[v]==undefined){ mode[v]=(modeOld[v]==undefined?modeDefault[v]:modeOld[v]); } } GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeInfoPanelDonkey",implode(mode,"buildInfoPanelDonkey/mode")); // implode data older than last month try{ var stichtag=new Date(); stichtag=Math.round(((new Date(stichtag.getFullYear(),stichtag.getMonth()-1,1)).getTime())/1000); var month; for(var v=logDonkey.length-1;v>=0;v--){ for(var w=logDonkey[v][2].length-1;w>=0;w--){ if(!logDonkey[v][2][w][3]){ logDonkey[v][2][w][3]=1; } } } for(var v=logDonkey.length-1;v>=0;v--){ if(logDonkey[v][0].match(/\d+\.\d+\.\d+/)){ if(getTime(logDonkey[v][0])<stichtag){ month=/\d+\.(\d+)\.(\d+)/.exec(logDonkey[v][0]); if(month[1].length==1){ month=month[2]+"-0"+month[1]; }else{ month=month[2]+"-"+month[1]; } for(var w=0;w<logDonkey.length;w++){ if(logDonkey[w][0]==month){ break; } } if(!logDonkey[w]){ logDonkey[w]=[month,0,[]]; } logDonkey[w][1]+=logDonkey[v][1]; for(var i=logDonkey[v][2].length-1;i>=0;i--){ for(var j=logDonkey[w][2].length-1;j>=0;j--){ if((logDonkey[v][2][i][0]==logDonkey[w][2][j][0])&&(logDonkey[v][2][i][1]==logDonkey[w][2][j][1])&&(logDonkey[v][2][i][2]==logDonkey[w][2][j][2])){ logDonkey[w][2][j][3]+=logDonkey[v][2][i][3]; break; } } if(j<0){ logDonkey[w][2].push(logDonkey[v][2][i]); } } logDonkey.splice(v,1); } } } logDonkey.sort(sortObjFunctions["date"]); GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_logDonkey",implode(logDonkey)); }catch(err){GM_logError("buildInfoPanelWaltraud (old data)\nv="+v+"\n"+err);} var container,newdiv,newtable,newtr,newtd; container=$("infoPanelInner"); container.innerHTML=""; // Head newdiv=createElement("div",{"class":"borderBottom1Black","style":"height:30px;"},container); newtable=createElement("table",{"class":"tnormal","style":"font-weight:bold;width:100%;"},newdiv); newtr=createElement("tr",{},newtable); createElement("td",{"class":"tnormal","style":"font-weight:bold;text-align:center;"},newtr,getText("logDonkey")); newtd=createElement("td",{},newtr); newdiv=createElement("div",{"class":"link naviItem"+(!mode["total"]?"Active":"")},newtd,getText("detail")); newdiv.addEventListener("click",function(){ buildInfoPanelDonkey({"total":false}); },false); newdiv=createElement("div",{"class":"link naviItem"+(mode["total"]?"Active":"")},newtd,getText("total")); newdiv.addEventListener("click",function(){ buildInfoPanelDonkey({"total":true}); },false); // Content newdiv=createElement("div",{"style":"height:485px;overflow:auto;"},container); newtable=createElement("table",{"style":"line-height:16px;width:100%","border":"1"},newdiv); newtr=createElement("tr",{},newtable); if(mode["total"]){ /* // prepare data var lotteryLogTotal=[[],[],{},[]]; for(var v=lotteryLog.length-1;v>=0;v--){ if(lotteryLog[v][0].match(/\d+\.\d+\.\d+/)){ if(lotteryLog[v][1]>0){ if(lotteryLog[v][2]&&(!lotteryLog[v][2].isEmpty())){ if(!lotteryLogTotal[1][lotteryLog[v][1]]){ lotteryLogTotal[1][lotteryLog[v][1]]=0; } lotteryLogTotal[1][lotteryLog[v][1]]++; for(var p in lotteryLog[v][2]){ if(!lotteryLog[v][2].hasOwnProperty(p)){ continue; } if(!lotteryLogTotal[2][p]){ lotteryLogTotal[2][p]=0; } lotteryLogTotal[2][p] += lotteryLog[v][2][p]; } }else{ if(!lotteryLogTotal[0][lotteryLog[v][1]]){ lotteryLogTotal[0][lotteryLog[v][1]]=0; } lotteryLogTotal[0][lotteryLog[v][1]]++; } } // lotteryLogTotal[2].sortObj(sortObjFunctions["productId"]); if(lotteryLog[v][3]){ for(var p=0;p<lotteryLog[v][3].length;p++){ if(!lotteryLogTotal[3][lotteryLog[v][3][p]]){ lotteryLogTotal[3][lotteryLog[v][3][p]]=0; } lotteryLogTotal[3][lotteryLog[v][3][p]]++; } } }else{ for(var j=0;j<4;j++){ if(j==2){ continue; } for(var i=0;i<lotteryLog[v][j+1].length;i++){ if(lotteryLog[v][j+1][i]>0){ if(!lotteryLogTotal[j][i]){ lotteryLogTotal[j][i]=0; } lotteryLogTotal[j][i] += lotteryLog[v][j+1][i]; } } } for(var prod in lotteryLog[v][3]){ if(!lotteryLog[v][3].hasOwnProperty(prod)){ continue; } if(!lotteryLogTotal[2][prod]){ lotteryLogTotal[2][prod]=0; } lotteryLogTotal[2][prod] += lotteryLog[v][3][prod]; } } } // plot table createElement("th",{"style":"white-space:nowrap;"},newtr,getText("dailyTicket")); createElement("th",{"style":"white-space:nowrap;"},newtr,getText("boughtTickets")); newtr=createElement("tr",{},newtable); newtd=createElement("td",{},newtr); newdiv=createElement("div",{"style":"margin-bottom:3px;"},newtd); newdiv.addEventListener("mouseover",function(event){ toolTip.show(event,getText("keptLots")); },false); var c=0; for(var i=0;i<lotteryLogTotal[0].length;i++){ if(lotteryLogTotal[0][i]>0){ c += lotteryLogTotal[0][i]; newdiv1=createElement("div",{"style":"position:relative;display:inline-block;margin-right:2px;"},newdiv); createElement("img",{"style":"width:20px;border:0;","src":GFX+"city/"+i+".jpg"},newdiv1); createElement("span",{},newdiv1,lotteryLogTotal[0][i]); } } if(c>0){ createElement("div",{"style":"position:relative;display:inline-block;"},newdiv," = "+c+sign_mult); } var changedLots=0; newdiv=createElement("div",{"style":""},newtd); newdiv.addEventListener("mouseover",function(event){ toolTip.show(event,getText("exchangedLots")); },false); for(var i=0;i<lotteryLogTotal[1].length;i++){ if(lotteryLogTotal[1][i]>0){ changedLots += lotteryLogTotal[1][i]; newdiv1=createElement("div",{"style":"position:relative;display:inline-block;margin-right:2px;"},newdiv); createElement("img",{"style":"width:20px;border:0;","src":GFX+"city/"+i+".jpg"},newdiv1); createElement("span",{},newdiv1,lotteryLogTotal[1][i]); } } if(changedLots>0){ createElement("div",{"style":"position:relative;display:inline-block;"},newdiv," = "+changedLots+sign_mult); } var c,sum=0; newtable1=createElement("table",{"style":"display:inline-block;padding-right:5px;margin-right:5px;","border":"0","cellspacing":"0"},newtd); for(var prod in lotteryLogTotal[2]){ if(!lotteryLogTotal[2].hasOwnProperty(prod)){ continue; } newtr1=createElement("tr",{"class":"link hoverBgLightblue","prod":prod},newtable1); newtr1.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.getAttribute("prod")); },false); newtr1.addEventListener("click",function(){showMarket(this.getAttribute("prod"));},false); produktPic(0,prod,createElement("td",{},newtr1)); createElement("td",{"style":"text-align:right;"},newtr1,numberFormat(lotteryLogTotal[2][prod])); createElement("td",{"style":"padding-right:5px;"},newtr1,prodName[0][prod]); c=lotteryLogTotal[2][prod]*gut[prod]; sum += c; createElement("td",{"style":"text-align:right;"},newtr1,moneyFormat(c)); } newtr1=createElement("tr",{},newtable1); createElement("td",{"colspan":"2"},newtr1); createElement("td",{"style":"border-top:1px solid black;"},newtr1,sign_sum); createElement("td",{"style":"border-top:1px solid black;text-align:right;"},newtr1,moneyFormat(sum)); newtr1=createElement("tr",{},newtable1); createElement("td",{"colspan":"2"},newtr1); createElement("td",{},newtr1,sign_average); createElement("td",{"style":"text-align:right;"},newtr1,moneyFormat(sum/changedLots)); c=0; newtd=createElement("td",{},newtr); for(var i=0;i<lotteryLogTotal[3].length;i++){ if(lotteryLogTotal[3][i]>0){ c += lotteryLogTotal[3][i]; newdiv1=createElement("div",{"style":"position:relative;display:inline-block;margin-right:2px;"},newdiv); createElement("img",{"style":"width:20px;border:0;","src":GFX+"city/"+i+".jpg"},newdiv1); createElement("span",{},newdiv1,lotteryLogTotal[3][i]); } } if(c>0){ createElement("div",{"style":"position:relative;display:inline-block;"},newdiv," = "+c+sign_mult); } */ }else{ createElement("th",{"style":"white-space:nowrap;"},newtr,getText("day")); createElement("th",{"style":"white-space:nowrap;"},newtr,getText("points")); createElement("th",{"style":"white-space:nowrap;"},newtr,getText("goods")); for(var v=logDonkey.length-1;v>=0;v--){ newtr=createElement("tr",{},newtable); createElement("td",{},newtr,logDonkey[v][0]); newtd=createElement("td",{},newtr); pointsFormat(logDonkey[v][1],"span",newtd); newtd=createElement("td",{},newtr); if(logDonkey[v][2]){ for(var w=0;w<logDonkey[v][2].length;w++){ switch(logDonkey[v][2][w][0]){ case 1:{ newdiv=createElement("div",{"class":"hoverBgLightblue","prod":logDonkey[v][2][w][2]},newtd); if(logDonkey[v][2][w][1]==0){ newdiv.classList.add("link"); newdiv.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.getAttribute("prod")); },false); newdiv.addEventListener("click",function(){showMarket(this.getAttribute("prod"));},false); } produktPic(logDonkey[v][2][w][1],logDonkey[v][2][w][2],newdiv); createElement("span",{},newdiv,numberFormat(logDonkey[v][2][w][3])+" "+prodName[logDonkey[v][2][w][1]][logDonkey[v][2][w][2]]); if((logDonkey[v][2][w][1]==0)&&(gut[logDonkey[v][2][w][2]])){ createElement("span",{"style":"padding-left:5px;"},newdiv,"("+moneyFormat(logDonkey[v][2][w][3]*gut[logDonkey[v][2][w][2]])+")"); } break;} case 5:{ newdiv=createElement("div",{},newtd); createElement("img",{"src":GFX+"adbonus.gif","style":"border:0;height:15px;"},newdiv); createElement("span",{},newdiv,unsafeWindow.t_donkey_farmiadd); if(logDonkey[v][2][w][3]>1){ createElement("span",{},newdiv," ("+logDonkey[v][2][w][3]+"x)"); } break;} case 12:{ newdiv=createElement("div",{},newtd); createElement("span",{},newdiv,unsafeWindow.quest_reward_6+": "); createElement("img",{"src":GFX+"farmhouse/thumbs/"+logDonkey[v][2][w][1]+".jpg","style":"border:0;height:50px;width:50px;"},newdiv); if(logDonkey[v][2][w][3]>1){ createElement("span",{},newdiv," ("+logDonkey[v][2][w][3]+"x)"); } break;} case 13:{ newdiv=createElement("div",{},newtd); createElement("span",{},newdiv,getText("shadowboxitem")+": "); createElement("img",{"src":GFX+"gifts/"+logDonkey[v][2][w][1]+".gif","style":"border:0;height:50px;width:50px;"},newdiv); if(logDonkey[v][2][w][3]>1){ createElement("span",{},newdiv," ("+logDonkey[v][2][w][3]+"x)"); } break;} } } } } } container=null;newdiv=null;newtable=null;newtr=null;newtd=null; }catch(err){GM_logError("buildInfoPanelWaltraud\n"+err);} } function buildInfoPanelFarmies(mode){ try{ var modeDefault={"limit":95}; var modeOld=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeInfoPanelFarmies"),"buildInfoPanelFarmies/modeOld"); if(typeof modeOld!="object"){ modeOld=modeDefault; } if(typeof mode!="object"){ mode=modeOld; } for(var v in modeDefault){ if(!modeDefault.hasOwnProperty(v)){ continue; } if(mode[v]==undefined){ mode[v]=(modeOld[v]==undefined?modeDefault[v]:modeOld[v]); } } GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeInfoPanelFarmies",implode(mode,"buildInfoPanelFarmies/mode")); var newFarmiumsatz=new Object(); var totalPrice=0; var totalWert=0; var totalPriceOk=0; var totalWertOk=0; var countFarmisOk=0; var countFarmisAll=0; var totalProducts=new Object(); var container,newdiv,newtable,newtr,newtd; container=$("infoPanelInner"); container.innerHTML=""; newdiv=createElement("div",{"style":"height:100%;width:565px;overflow:auto;"},container); newtable=createElement("table",{"style":"width:100%","border":"1"},newdiv); newtable.addEventListener("mouseover",function(event){ var node=event.target; var mouseOverText=node.getAttribute("mouseOverText"); while((node!=this)&&(!mouseOverText)){ node=node.parentNode; mouseOverText=node.getAttribute("mouseOverText"); } if(mouseOverText){ toolTip.show(event,mouseOverText); } node=null;mouseOverText=null; },false); // selection bar on the right side newdiv1=createElement("div",{"class":"link","style":"position:absolute;top:0;right:0;border:1px solid black;"},container); newdiv1.addEventListener("mouseover",function(event){ var node=event.target; var mouseOverText=node.getAttribute("mouseOverText"); while((node!=this)&&(!mouseOverText)){ node=node.parentNode; mouseOverText=node.getAttribute("mouseOverText"); } if(mouseOverText){ toolTip.show(event,mouseOverText); } node=null;mouseOverText=null; },false); for(var v=200;v>-1;v--){ newdiv=createElement("div",{"class":"hoverBgRed","style":"width:20px;height:2.5px;","mouseOverText":v+"%"},newdiv1); if (v<=mode["limit"]){ newdiv.style.backgroundColor="blue"; } if (v==90||v==100) newdiv.style.borderTop="1px solid black"; newdiv.addEventListener("click",function(){ buildInfoPanelFarmies({"limit":parseInt(this.getAttribute("mouseOverText"),10)}); },false); } // Farmi table newtr=createElement("tr",{},newtable); createElement("th",{"style":"border-bottom:2px solid black;"},newtr,""); createElement("th",{"style":"border-bottom:2px solid black;"},newtr,getText("products")); createElement("th",{"style":"border-bottom:2px solid black;"},newtr,getText("money")); createElement("th",{"style":"border-bottom:2px solid black;","colspan":"2"},newtr,getText("value")); var borderTop; var c=0; var prev=null; for(var v=0;v<farmiLog.length;v++){ countFarmisAll++; newtr=createElement("tr",{"class":"hoverBgCc9"},newtable); if (prev==null){ borderTop="2px solid black;"; newtd1=createElement("td",{"style":"border-top:"+borderTop},newtr,farmiLog[v][1]); c=1; }else if (farmiLog[v][1]!=farmiLog[prev][1]){ borderTop="2px solid black;"; newtd1.innerHTML += "<br>("+c+")"; newtd1=createElement("td",{"style":"border-top:"+borderTop},newtr,farmiLog[v][1]); c=1; }else{ borderTop="1px solid black;"; newtd1.rowSpan=++c; } newtd=createElement("td",{"style":"border-top:"+borderTop},newtr); var wert=0; for(var w in farmiLog[v][3]){ if(!farmiLog[v][3].hasOwnProperty(w)){ continue; } newdiv=createElement("div",{"style":"line-height:16px;"},newtd); produktPic(0,w,newdiv); createElement("div",{"style":"display:inline-block;"},newdiv,numberFormat(farmiLog[v][3][w])+" "+prodName[0][w]); wert += farmiLog[v][3][w]*gut[w]; } totalPrice += farmiLog[v][2]; totalWert += wert; newtd=createElement("td",{"style":"text-align:right;border-top:"+borderTop},newtr); createElement("div",{},newtd,moneyFormatInt(farmiLog[v][2])); newdiv=createElement("div",{},newtd,numberFormat(100*farmiLog[v][2]/wert,1)+"%"); if (100*farmiLog[v][2]>mode["limit"]*wert){ countFarmisOk++; for(var w in farmiLog[v][3]){ if(!farmiLog[v][3].hasOwnProperty(w)){ continue; } if(totalProducts[w]==undefined){ totalProducts[w]=[0,0]; } totalProducts[w][0]++; totalProducts[w][1]+=farmiLog[v][3][w]; } totalPriceOk += farmiLog[v][2]; totalWertOk += wert; }else{ newdiv.style.backgroundColor="red"; } newtd=createElement("td",{"style":"text-align:right;border-top:"+borderTop},newtr); createElement("div",{"mouseOverText":"100%"},newtd,moneyFormatInt(wert)); createElement("div",{"mouseOverText":"90%"},newtd,moneyFormatInt(0.9*wert)); newtd=createElement("td",{"style":"text-align:right;border-top:"+borderTop},newtr); createElement("div",{"mouseOverText":"100%"},newtd,(farmiLog[v][2]>wert?"+":"")+moneyFormatInt(farmiLog[v][2]-wert)); createElement("div",{"mouseOverText":"90%"},newtd,(farmiLog[v][2]>0.9*wert?"+":"")+moneyFormatInt(farmiLog[v][2]-0.9*wert)); if(!newFarmiumsatz[farmiLog[v][1]]){ newFarmiumsatz[farmiLog[v][1]]=0; } newFarmiumsatz[farmiLog[v][1]] += farmiLog[v][2]; prev=v; } if(countFarmisAll>0){ newtd1.innerHTML += "<br>("+c+")"; } for(var v in newFarmiumsatz){ if(!newFarmiumsatz.hasOwnProperty(v)){ continue; } newFarmiumsatz[v]=Math.round(100*newFarmiumsatz[v])/100; for(var w=0;w<levelLog.length;w++){ if(levelLog[w][0]==v){ levelLog[w][5]=newFarmiumsatz[v]; break; } //dont override all because data could be joined to monthly } } GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_levelLog",implode(levelLog),70); for(var v in totalProducts){ if(!totalProducts.hasOwnProperty(v)){ continue; } totalProducts[v][2]=totalProducts[v][1]/totalProducts[v][0]; } if(countFarmisAll>0){ newtr=createElement("tr"); newtable.insertBefore(newtr,newtable.children[1]); createElement("td",{},newtr,getText("total")+"<br>("+countFarmisOk+")"); newtd=createElement("td",{"id":"tdTotalProducts"},newtr); function buildTotalProducts(mode){ $("tdTotalProducts").innerHTML=""; var newtable=createElement("table",{cellspacing:"0",cellpadding:"0"},$("tdTotalProducts")); var newtr=createElement("tr",{},newtable); var newtd=createElement("td",{"class":"link hoverBgLightblue","style":"text-align:center;padding-right:3px;border-bottom:1px solid black;"},newtr,getText("product")); if (mode==0){ newtd.style.backgroundColor="lightblue"; totalProducts.sortObj(sortObjFunctions["int"],true); }else{ newtd.addEventListener("click",function(){buildTotalProducts(0);},false); totalProducts.sortObj(function(mode){return function(a,b){return (a[1][mode-1]-b[1][mode-1]);}}(mode),true); } newtd=createElement("td",{"class":"link hoverBgLightblue","style":"text-align:center;border-left:1px solid black;border-bottom:1px solid black;padding-left:3px;padding-right:3px;"},newtr,sign_mult); if (mode==1){ newtd.style.backgroundColor="lightblue"; } else{ newtd.addEventListener("click",function(){buildTotalProducts(1);},false); } newtd=createElement("td",{"class":"link hoverBgLightblue","style":"text-align:center;border-left:1px solid black;border-bottom:1px solid black;padding-left:3px;padding-right:3px;"},newtr,sign_sum); if (mode==2){ newtd.style.backgroundColor="lightblue"; } else{ newtd.addEventListener("click",function(){buildTotalProducts(2);},false); } newtd=createElement("td",{"class":"link hoverBgLightblue","style":"text-align:center;border-left:1px solid black;border-bottom:1px solid black;padding-left:3px;padding-right:3px;"},newtr,sign_sum+"/"+sign_mult); if (mode==3){ newtd.style.backgroundColor="lightblue"; } else{ newtd.addEventListener("click",function(){buildTotalProducts(3);},false); } for(var i=0;i<totalProducts.order.length;i++){ var v=totalProducts.order[i]; //newdiv=createElement("div",{"style":"line-height:16px;"},newtd); newtr=createElement("tr",{"class":"hoverBgCc9"},newtable); newtd=createElement("td",{"style":"padding-right:3px;"},newtr); produktPic(0,v,newtd); createElement("div",{"style":"display:inline-block;"},newtd,prodName[0][v]); createElement("td",{"style":"text-align:right;border-left:1px solid black;padding-left:3px;padding-right:3px;"},newtr,numberFormat(totalProducts[v][0])); createElement("td",{"style":"text-align:right;border-left:1px solid black;padding-left:3px;padding-right:3px;"},newtr,numberFormat(totalProducts[v][1])); createElement("td",{"style":"text-align:right;border-left:1px solid black;padding-left:3px;padding-right:3px;"},newtr,numberFormat(totalProducts[v][2])); } newtable=null;newtr=null;newtd=null; } buildTotalProducts(0); newtd=createElement("td",{"style":"text-align:right;"},newtr); createElement("div",{},newtd,moneyFormatInt(totalPriceOk)); createElement("div",{},newtd,numberFormat(100*totalPriceOk/totalWertOk,1)+"%"); newtd=createElement("td",{"style":"text-align:right;"},newtr); createElement("div",{"mouseOverText":"100%"},newtd,moneyFormatInt(totalWertOk)); createElement("div",{"mouseOverText":"90%"},newtd,moneyFormatInt(0.9*totalWertOk)); newtd=createElement("td",{"style":"text-align:right;"},newtr); createElement("div",{"mouseOverText":"100%"},newtd,(totalPriceOk>totalWertOk?"+":"")+moneyFormatInt(totalPriceOk-totalWertOk)); createElement("div",{"mouseOverText":"90%"},newtd,(totalPriceOk>0.9*totalWertOk?"+":"")+moneyFormatInt(totalPriceOk-0.9*totalWertOk)); newtr=createElement("tr",{"class":"hoverBgCc9"}); newtable.insertBefore(newtr,newtable.children[2]); newtd=createElement("td",{},newtr); createElement("div",{},newtd,sign_average+" ("+countFarmisOk+")"); newtd=createElement("td",{},newtr,""); createElement("div",{},newtd,">"+numberFormat(mode["limit"])+"%"); newtd=createElement("td",{"style":"text-align:right;"},newtr); createElement("div",{},newtd,moneyFormatInt(totalPriceOk/countFarmisOk)); newtd=createElement("td",{"style":"text-align:right;"},newtr); createElement("div",{"mouseOverText":"100%<br>"+sign_average+"[>"+numberFormat(mode["limit"])+"%]"},newtd,moneyFormatInt(totalWertOk/countFarmisOk)); createElement("div",{"mouseOverText":" 90%<br>"+sign_average+"[>"+numberFormat(mode["limit"])+"%]"},newtd,moneyFormatInt(0.9*totalWertOk/countFarmisOk)); createElement("div",{"mouseOverText":"100%<br>"+sign_sum+"[>"+numberFormat(mode["limit"])+"%]/"+getText("all"),"style":"border-top:1px solid black;"},newtd,moneyFormatInt(totalWertOk/countFarmisAll)); createElement("div",{"mouseOverText":" 90%<br>"+sign_sum+"[>"+numberFormat(mode["limit"])+"%]/"+getText("all")},newtd,moneyFormatInt(0.9*totalWertOk/countFarmisAll)); newtd=createElement("td",{"style":"text-align:right;"},newtr); createElement("div",{"mouseOverText":"100%"},newtd,(totalPriceOk>totalWertOk?"+":"")+moneyFormatInt((totalPriceOk-totalWertOk)/countFarmisOk)); createElement("div",{"mouseOverText":" 90%"},newtd,(totalPriceOk>0.9*totalWertOk?"+":"")+moneyFormatInt((totalPriceOk-0.9*totalWertOk)/countFarmisOk)); createElement("div",{"mouseOverText":"100%","style":"border-top:1px solid black;"},newtd,(totalPriceOk>totalWertOk?"+":"")+moneyFormatInt((totalPriceOk-totalWertOk)/countFarmisAll)); createElement("div",{"mouseOverText":" 90%"},newtd,(totalPriceOk>0.9*totalWertOk?"+":"")+moneyFormatInt((totalPriceOk-0.9*totalWertOk)/countFarmisAll)); newtr=createElement("tr",{"class":"hoverBgCc9"}); newtable.insertBefore(newtr,newtable.children[3]); newtd=createElement("td",{},newtr); createElement("div",{},newtd,sign_average+" ("+countFarmisAll+")"); newtd=createElement("td",{},newtr); createElement("div",{},newtd,getText("all")); newtd=createElement("td",{"style":"text-align:right;"},newtr); createElement("div",{},newtd,moneyFormatInt(totalPrice/countFarmisAll)); newtd=createElement("td",{"style":"text-align:right;"},newtr); createElement("div",{"mouseOverText":"100%"},newtd,moneyFormatInt(totalWert/countFarmisAll)); createElement("div",{"mouseOverText":"90%"},newtd,moneyFormatInt(0.9*totalWert/countFarmisAll)); newtd=createElement("td",{"style":"text-align:right;"},newtr); createElement("div",{"mouseOverText":"100%"},newtd,(totalPrice>totalWert?"+":"")+moneyFormatInt((totalPrice-totalWert)/countFarmisAll)); createElement("div",{"mouseOverText":"90%"},newtd,(totalPrice>0.9*totalWert?"+":"")+moneyFormatInt((totalPrice-0.9*totalWert)/countFarmisAll)); } container=null;newdiv=null;newtable=null;newtr=null;newtd=null; }catch(err){GM_logError("buildInfoPanelFarmies\n"+err);} } function buildInfoPanelFormulas(mode){ try{ // unsafeWindow.formulas[0][id]: // 0: id // 1: needed level // 2: name // 3: ingredients [[id,amount],[id,amount],[id,amount]] // 4: baking time in sek // 5: gain [0|[prod,amount],0|[prod,+val,time in sek],0|[prod,+pts,time in sek]] // 6: price money // 7: price coins // 8: points for baking // 9: [0,1,2,3,4,5,6] //10: ? //endremain: time to end //end: date until recipe is buyable var modeDefault={"showAll":false,"filterType":"0,1,2,"}; var modeOld=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeInfoPanelFormulas"),"buildInfoPanelFormulas/modeOld"); if(typeof modeOld!="object"){ modeOld=modeDefault; } if(typeof mode!="object"){ mode=modeOld; } for(var v in modeDefault){ if(!modeDefault.hasOwnProperty(v)){ continue; } if(mode[v]==undefined){ mode[v]=(modeOld[v]==undefined?modeDefault[v]:modeOld[v]); } } GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeInfoPanelFormulas",implode(mode,"buildInfoPanelFormulas/mode")); var container=$("infoPanelInner"); container.innerHTML=""; var newdiv,newdiv1,newtable,newtr,newtd,newtd1,newinput; newdiv=createElement("div",{"class":"borderBottom1Black","style":"height:50px;"},container); newtable=createElement("table",{"style":"width:100%;","border":0,"cellspacing":0},newdiv); newtr=createElement("tr",{},newtable); createElement("td",{"class":"tnormal","style":"font-weight:bold;text-align:center;"},newtr,getText("recipes")); newtd=createElement("td",{},newtr); newinput=createElement("input",{"type":"checkbox","class":"link","checked":mode["showAll"]},newtd); newinput.addEventListener("click",function(){ buildInfoPanelFormulas({"showAll":this.checked}); },false); createElement("span",{"style":"margin-right:10px;"},newtd,getText("showAll")); newtd=createElement("td",{"align":"right"},newtr); newtd.addEventListener("click",function(filterType){ return function(event){ var thisFilter=event.target.getAttribute("filter"); if(thisFilter){ if(!event.ctrlKey){ filterType=thisFilter; }else if(filterType.search(thisFilter)!=-1){ filterType.replace(thisFilter,"") }else{ filterType+=thisFilter; } buildInfoPanelFormulas({"filterType":filterType}); } }}(mode["filterType"]),false); newtd.addEventListener("mouseover",function(event){ var mouseOverText=event.target.getAttribute("mouseOverText"); if(mouseOverText){ mouseOverText='<div>'+getText("click")+' / '+getText("clickCtrl")+'</div><div>'+mouseOverText+'</div>'; toolTip.show(event,mouseOverText); } },false); for(var v=0;v<=2;v++){ createElement("div",{"class":"link category_r"+v+(mode["filterType"].search(v+",")!=-1?"_active":""),"filter":v+",","style":"display:inline-block;","mouseOverText":getText("category_r"+v)},newtd); } newdiv=createElement("div",{"style":"height:465px;width:100%;overflow:auto;"},container); newtable=createElement("table",{"style":"line-height:16px;width:100%","border":"1","cellspacing":0},newdiv); var thead=createElement("thead",{},newtable); // sortable table var newtbody=createElement("tbody",{},newtable); newtr=createElement("tr",{"class":"borderBottom2"},thead); createElement("th",{"sortdir":"Asc","class":"link"},newtr,getText("nr")); createElement("th",{"sortdir":"Asc","class":"link"},newtr,getText("lvl")); createElement("th",{"sortdir":"Asc","class":"link"},newtr,getText("title")); createElement("th",{"sortdir":"Asc","class":"link"},newtr,getText("ingredients")); createElement("th",{"sortdir":"Asc","class":"link"},newtr,getText("time")); createElement("th",{"sortdir":"Asc","class":"link"},newtr,getText("gain")); createElement("th",{"sortdir":"Asc","class":"link"},newtr,getText("price")); new SortableTable(newtr); for(var v in unsafeWindow.formulas[0]){ if(!unsafeWindow.formulas[0].hasOwnProperty(v)){ continue; } if(mode["showAll"]||((USERLEVEL>=unsafeWindow.formulas[0][v][1])&&(unsafeWindow.formulas[0][v]["endremain"]>=0))){ if(((mode["filterType"].search("0,")!=-1)&&(unsafeWindow.formulas[0][v][5][0]!=0))||((mode["filterType"].search("1,")!=-1)&&(unsafeWindow.formulas[0][v][5][1]!=0))||((mode["filterType"].search("2,")!=-1)&&(unsafeWindow.formulas[0][v][5][2]!=0))){ newtr=createElement("tr",{"class":"hoverBgCc9"},newtbody); createElement("td",{"value":unsafeWindow.formulas[0][v][0],"style":(unsafeWindow.formulas[0][v]["endremain"]>=0?"":"background-color:red;")},newtr,unsafeWindow.formulas[0][v][0]); createElement("td",{"value":unsafeWindow.formulas[0][v][1],"style":(USERLEVEL>=unsafeWindow.formulas[0][v][1]?"":"background-color:red;")},newtr,unsafeWindow.formulas[0][v][1]); // Title newtd1=createElement("td",{},newtr,unsafeWindow.formulas[0][v][2]); // Ingredients newtd=createElement("td",{},newtr); var sum1=0; var sumPts=0; var preis=0; for(var w=0;w<unsafeWindow.formulas[0][v][3].length;w++){ preis=!isNaN(NPC[0][unsafeWindow.formulas[0][v][3][w][0]])?Math.min(NPC[0][unsafeWindow.formulas[0][v][3][w][0]],gut[unsafeWindow.formulas[0][v][3][w][0]]):gut[unsafeWindow.formulas[0][v][3][w][0]]; sum1 += unsafeWindow.formulas[0][v][3][w][1]*preis; newdiv=createElement("div",{"class":"link hoverBgLightblue","prod":unsafeWindow.formulas[0][v][3][w][0],"value":preis*unsafeWindow.formulas[0][v][3][w][1]},newtd); newdiv.addEventListener("mouseover",function(event){showGoToMarketToolTip(event,this.getAttribute("prod"),null,'<tr><td>'+sign_sum+'</td><td style="text-align:right;">'+moneyFormatInt(parseInt(this.getAttribute("value"),10))+'</td></tr>');},false); newdiv.addEventListener("click",function(){showMarket(this.getAttribute("prod"));},false); produktPic(0,unsafeWindow.formulas[0][v][3][w][0],newdiv); newdiv=createElement("span",{},newdiv,numberFormat(unsafeWindow.formulas[0][v][3][w][1])); } newtd.setAttribute("value",sum1); createElement("div",{},newtd,"("+moneyFormatInt(sum1)+")"); var sum=-sum1; // Time createElement("td",{"value":unsafeWindow.formulas[0][v][4]},newtr,getTimeStr(unsafeWindow.formulas[0][v][4],1)+getText("shortHours")); // Gain newtd=createElement("td",{"style":"width:80px;"},newtr); if(unsafeWindow.formulas[0][v][5][0]!=0){ // Products preis=!isNaN(NPC[0][unsafeWindow.formulas[0][v][5][0][0]])?Math.min(NPC[0][unsafeWindow.formulas[0][v][5][0][0]],gut[unsafeWindow.formulas[0][v][5][0][0]]):gut[unsafeWindow.formulas[0][v][5][0][0]]; sum1=unsafeWindow.formulas[0][v][5][0][1]*preis; sum += sum1; newdiv=createElement("div",{"class":"link hoverBgLightblue","prod":unsafeWindow.formulas[0][v][5][0][0],"value":sum1},newtd); newdiv.addEventListener("mouseover",function(event){showGoToMarketToolTip(event,this.getAttribute("prod"));},false); newdiv.addEventListener("click",function(){showMarket(this.getAttribute("prod"));},false); produktPic(0,unsafeWindow.formulas[0][v][5][0][0],newdiv); createElement("span",{},newdiv,unsafeWindow.formulas[0][v][5][0][1]); createElement("div",{},newtd,"("+moneyFormatInt(sum1)+")"); }else if(unsafeWindow.formulas[0][v][5][1]!=0){ // Crop amount boost createElement("div",{},newtd,getTimeStr(unsafeWindow.formulas[0][v][5][1][2],1)+getText("shortHours")); newdiv=createElement("div",{"class":"link hoverBgLightblue","prod":unsafeWindow.formulas[0][v][5][1][0],"style":"white-space:nowrap;"},newtd); newdiv.addEventListener("mouseover",function(event){showGoToMarketToolTip(event,this.getAttribute("prod"));},false); newdiv.addEventListener("click",function(){showMarket(this.getAttribute("prod"));},false); produktPic(0,unsafeWindow.formulas[0][v][5][1][0],newdiv); createElement("span",{},newdiv,"+"+unsafeWindow.formulas[0][v][5][1][1]+"val (+"+numberFormat(100*unsafeWindow.formulas[0][v][5][1][1]/(prodYield[0][unsafeWindow.formulas[0][v][5][1][0]]-1))+"%)"); preis=!isNaN(NPC[0][unsafeWindow.formulas[0][v][5][1][0]])?Math.min(NPC[0][unsafeWindow.formulas[0][v][5][1][0]],gut[unsafeWindow.formulas[0][v][5][1][0]]):gut[unsafeWindow.formulas[0][v][5][1][0]]; sum1=0; for(var i=0;i<ALL_ZONES["farm"].length;i++){ if((zones.getBuilding(ALL_ZONES["farm"][i])==1)&&(!zones.getBlock(ALL_ZONES["farm"][i]))){ sum1 += preis*unsafeWindow.formulas[0][v][5][1][1]*Math.ceil(calcGrowTimes(60*prodGrowTime[0][unsafeWindow.formulas[0][v][5][1][0]],unsafeWindow.formulas[0][v][5][1][2],1-(zones.getBonus(ALL_ZONES["farm"][i])/100)))*BUILDING_SIZE["1"]/prodPlantSize[0][unsafeWindow.formulas[0][v][5][1][0]]; } } sum += sum1; createElement("div",{},newtd,"("+moneyFormatInt(sum1)+")"); newtd.setAttribute("value",sum1); }else if(unsafeWindow.formulas[0][v][5][2]!=0){ // Crop points boost createElement("div",{},newtd,getTimeStr(unsafeWindow.formulas[0][v][5][2][2],1)+getText("shortHours")); newdiv=createElement("div",{"class":"link hoverBgLightblue","prod":unsafeWindow.formulas[0][v][5][2][0],"style":"white-space:nowrap;"},newtd); newdiv.addEventListener("mouseover",function(event){showGoToMarketToolTip(event,this.getAttribute("prod"));},false); newdiv.addEventListener("click",function(){showMarket(this.getAttribute("prod"));},false); produktPic(0,unsafeWindow.formulas[0][v][5][2][0],newdiv); createElement("span",{},newdiv,"+"); pointsFormat(unsafeWindow.formulas[0][v][5][2][1],"span",newdiv); createElement("span",{},newdiv," (+"+numberFormat(100*unsafeWindow.formulas[0][v][5][2][1]/prodPoints[0][unsafeWindow.formulas[0][v][5][2][0]])+"%)"); sum1=0; for(var i=0;i<ALL_ZONES["farm"].length;i++){ if((zones.getBuilding(ALL_ZONES["farm"][i])==1)&&(!zones.getBlock(ALL_ZONES["farm"][i]))){ sum1 += unsafeWindow.formulas[0][v][5][2][1]*Math.ceil(calcGrowTimes(60*prodGrowTime[0][unsafeWindow.formulas[0][v][5][2][0]],unsafeWindow.formulas[0][v][5][2][2],1-(zones.getBonus(ALL_ZONES["farm"][i])/100)))*BUILDING_SIZE["1"]/prodPlantSize[0][unsafeWindow.formulas[0][v][5][2][0]]; } } sumPts=sum1; newdiv=createElement("div",{},newtd); createElement("span",{},newdiv,"("); pointsFormat(sum1,"span",newdiv); createElement("span",{},newdiv,")"); newtd.setAttribute("value",0); } pointsFormat(unsafeWindow.formulas[0][v][8],"div",newtd); sumPts += unsafeWindow.formulas[0][v][8]; // Price newtd=createElement("td",{},newtr); if(unsafeWindow.formulas[0][v][6]>0){ sum1=unsafeWindow.formulas[0][v][6]; sum -= sum1; newspan=createElement("div",{},newtd,moneyFormatInt(sum1)); newtd.setAttribute("value",sum1); } if(unsafeWindow.formulas[0][v][7]>0){ sum1=unsafeWindow.formulas[0][v][7]*gut[0]; sum -= sum1; newspan=createElement("div",{"class":"link hoverBgLightblue"},newtd,coinsFormat(unsafeWindow.formulas[0][v][7],createElement("div")).parentNode.innerHTML); newspan.addEventListener("mouseover",function(event){showGoToMarketToolTip(event,"0");},false); newspan.addEventListener("click",function(){showMarket("0");},false); createElement("div",{"style":"clear:both;"},newtd,"("+moneyFormatInt(sum1)+")"); newtd.setAttribute("value",sum1); } //createElement("td",{},newtr,unsafeWindow.formulas[0][v][8]); //createElement("td",{},newtr,unsafeWindow.formulas[0][v][9]); // Title createElement("div",{},newtd1,moneyFormatInt(sum)); newtd1.setAttribute("value",sum); pointsFormat(sumPts,"div",newtd1); } } } container=null; newtable=null;thead=null;newtbody=null;newtr=null;newtd=null;newtd1=null;newdiv=null;newinput=null; }catch(err){GM_logError("buildInfoPanelFormulas\n"+err);} } unsafeWindow.buildInfoPanelMenu=function(mode){ try{ var container,newdiv,newdiv1; container=$("infoPanelInner"); container.innerHTML=""; newdiv=createElement("div",{"id":"infoPanelL","style":"position:absolute;left:0;width:105px;overflow:auto;height:515px;border-right:2px solid #685338;padding-right:5px;"},container); newdiv1=createElement("div",{"style":"padding-top:5px;border-bottom:1px solid #685338;font-weight:bold;float:left;width:100%;"},newdiv,getText("adviser")); newdiv1.addEventListener("mouseover",function(event){ toolTip.show(event,getText("showChangelog")); },false); newdiv1.classList.add("link"); newdiv1.addEventListener("click",function(event){ unsafeWindow.buildInfoPanel("changelog"); },false); if(USERNAME){ newdiv1=createElement("div",{"id":"infoPanelNaviOptions","class":"link naviItem","style":"margin-top:5px;width:95px;"},newdiv,getText("options")); newdiv1.addEventListener("click",function(event){ unsafeWindow.buildInfoPanelMenu("options"); },false); }else{ createElement("div",{"id":"infoPanelNaviOptions","class":"naviItemInactive","style":"margin-top:5px;width:95px;"},newdiv,getText("options")); } newdiv1=createElement("div",{"id":"infoPanelNaviAccounts","class":"link naviItem","style":"margin-top:5px;width:95px;"},newdiv,getText("accounts")); newdiv1.addEventListener("click",function(event){ unsafeWindow.buildInfoPanelMenu("accounts"); },false); newdiv1=createElement("div",{"id":"infoPanelNaviHotkeys","class":"link naviItem","style":"margin-top:5px;width:95px;"},newdiv,getText("hotkeys")); newdiv1.addEventListener("click",function(event){ unsafeWindow.buildInfoPanelMenu("hotkeys"); },false); if(USERNAME){ newdiv1=createElement("div",{"id":"infoPanelNaviCss","class":"link naviItem","style":"margin-top:5px;width:95px;"},newdiv,"CSS"); newdiv1.addEventListener("click",function(event){ unsafeWindow.buildInfoPanelMenu("css"); },false); newdiv1=createElement("div",{"id":"infoPanelNaviImport","class":"link naviItem","style":"margin-top:5px;width:95px;"},newdiv,"Import/Export"); newdiv1.addEventListener("click",function(event){ unsafeWindow.buildInfoPanelMenu("import"); },false); }else{ createElement("div",{"id":"infoPanelNaviCss","class":"naviItemInactive","style":"margin-top:5px;width:95px;"},newdiv,"CSS"); createElement("div",{"id":"infoPanelNaviImport","class":"naviItemInactive","style":"margin-top:5px;width:95px;"},newdiv,"Import/Export"); } createElement("div",{"id":"infoPanelR","style":"position:absolute;left:115px;width:480px;overflow:auto;height:515px;"},container); // paypal newdiv=createElement("div",{"style":"position:absolute;left:0;bottom:0;"},container); newdiv1=createElement("form",{"id":"paypalForm","target":"_blank","action":"https://www.paypal.com/cgi-bin/webscr","method":"post"},newdiv); createElement("input",{"type":"hidden","name":"cmd","value":"_donations"},newdiv1); createElement("input",{"type":"hidden","name":"business","value":"jessicakanaan@web.de"},newdiv1); createElement("input",{"type":"hidden","name":"lc","value":((LANGUAGE=="de")?"DE":"US")},newdiv1); createElement("input",{"type":"hidden","name":"item_name","value":"MyFreeFarm Script"},newdiv1); createElement("input",{"type":"hidden","name":"no_note","value":"0"},newdiv1); createElement("input",{"type":"hidden","name":"currency_code","value":"EUR"},newdiv1); createElement("input",{"type":"hidden","name":"bn","value":"PP-DonationsBF:btn_donate_LG.gif:NonHostedGuest"},newdiv1); createElement("input",{"type":"image","style":"border:none;background:transparent;","src":"https://www.paypalobjects.com/"+((LANGUAGE=="de")?"de_DE/DE":"en_US")+"/i/btn/btn_donate_LG.gif","name":"submit","alt":"PayPal"},newdiv1); createElement("img",{"alt":"","border":"0","src":"https://www.paypalobjects.com/en_US/i/scr/pixel.gif","width":"1","height":"1"},newdiv1); // call automat if(unsafeWindow.buildInfoPanelAutomatMenu){ unsafeWindow.buildInfoPanelAutomatMenu(mode); } // switch call switch(mode){ case "options": buildInfoPanelOptions(); break; case "accounts": buildInfoPanelAccounts(false); break; case "hotkeys": buildInfoPanelHotkeys(); break; case "css": buildInfoPanelCss(); break; case "import": buildInfoPanelImport(); break; } container=null;newdiv=null;newdiv1=null; }catch(err){GM_logError("buildInfoPanelMenu\n"+err);} } function buildInfoPanelOptions(){ try{ var container,newdiv,newtable,newtr,newtd,newtr,newtd1,newinput; newdiv=$("infoPanelNaviOptions"); newdiv.classList.remove("naviItem"); newdiv.classList.add("naviItemActive"); container=$("infoPanelR"); newtable=createElement("table",{"style":"width:100%;","border":"1","class":"hoverRowBgCc9"},container); newtr=createElement("tr",{},newtable); newtd=createElement("th",{"colspan":"3"},newtr,getText("farm")); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"type":"checkbox","class":"link","checked":valAutoWater["farm"]},newtd); newinput.addEventListener("click",function(){ valAutoWater["farm"]=this.checked; unsafeData.valAutoWater=valAutoWater; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valAutoWater",implode(valAutoWater),9); },false); createElement("td",{},newtr,getText("settings_valAutoWater")[0]); createElement("td",{},newtr,getText("settings_valAutoWater")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"type":"checkbox","class":"link","checked":valAutoCrop["farm"]},newtd); newinput.addEventListener("click",function(){ valAutoCrop["farm"]=this.checked; unsafeData.valAutoCrop=valAutoCrop; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valAutoCrop",implode(valAutoCrop),11); },false); createElement("td",{},newtr,getText("settings_valAutoCrop")[0]); createElement("td",{},newtr,getText("settings_valAutoCrop")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"type":"checkbox","class":"link","checked":valAssumeWater["farm"]},newtd); newinput.addEventListener("click",function(){ valAssumeWater["farm"]=this.checked; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valAssumeWater",implode(valAssumeWater),10); },false); createElement("td",{},newtr,getText("settings_valAssumeWater")[0]); createElement("td",{},newtr,getText("settings_valAssumeWater")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"type":"checkbox","class":"link","checked":valWaterNeeded["farm"]},newtd); newinput.addEventListener("click",function(){ valWaterNeeded["farm"]=this.checked; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valWaterNeeded",implode(valWaterNeeded),12); },false); createElement("td",{},newtr,getText("settings_valWaterNeeded")[0]); createElement("td",{},newtr,getText("settings_valWaterNeeded")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalErnteMsg","type":"checkbox","class":"link","checked":valErnteMsg},newtd); newinput.addEventListener("click",function(){ valErnteMsg=this.checked; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valErnteMsg", valErnteMsg,13); },false); createElement("td",{},newtr,getText("settings_valCropMsg")[0]); createElement("td",{},newtr,getText("settings_valCropMsg")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"value":valLimitEmptyFields["1"],"class":"text","maxlength":"2","size":"2px","style":"background-color:transparent;text-align:center;"},newtd); newinput.addEventListener("focus",function(){this.style.backgroundColor="lightblue";},false); newinput.addEventListener("blur",function(){this.style.backgroundColor="transparent";},false); newinput.addEventListener("keyup",function(){ var help=parseInt(this.value,10); if(isNaN(help)||(help<0)){ this.value=""; }else{ this.value=help; valLimitEmptyFields["1"]=help; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valLimitEmptyFields",implode(valLimitEmptyFields),14); for(var v=0;v<ALL_ZONES["farm"].length;v++){ if(zones.getBuilding(ALL_ZONES["farm"][v])==1){ zones.processProduction(ALL_ZONES["farm"][v]); } } } },false); createElement("td",{},newtr,getText("settings_valLimitEmptyFields")[0]); createElement("td",{},newtr,getText("settings_valLimitEmptyFields")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"type":"checkbox","class":"link","checked":valGlobaltimeShowCroppedZone["farm"]},newtd); newinput.addEventListener("click",function(){ valGlobaltimeShowCroppedZone["farm"]=this.checked; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valGlobaltimeShowCroppedZone",implode(valGlobaltimeShowCroppedZone),16); },false); createElement("td",{},newtr,getText("settings_valGlobaltimeShowCroppedZone")[0]); createElement("td",{},newtr,getText("settings_valGlobaltimeShowCroppedZone")[1]); newtr=createElement("tr",{},newtable); createElement("td",{"align":"center"},newtr); createElement("td",{},newtr,getText("settings_valMoveAnimals")[0]); newtd=createElement("td",{},newtr,getText("settings_valMoveAnimals")[1]); for(var v=0;v<ANIMAL_MOVE.length;v++){ if(ANIMAL_MOVE[v]){ newspan=createElement("span",{"style":"display:inline-block;margin-right:15px;"},newtd); produktPic(0,BUILDING2PRODUCT[v][0],newspan); newinput=createElement("input",{"id":"inputvalMoveAnimals"+v,"type":"checkbox","class":"link","checked":valMoveAnimals[v]},newspan); newinput.addEventListener("click",function(){ valMoveAnimals[this.id.replace("inputvalMoveAnimals","")]=this.checked; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMoveAnimals", implode(valMoveAnimals),15); },false); }} // *********************************************************************** newtr=createElement("tr",{},newtable); newtd=createElement("th",{"colspan":"3"},newtr,getText("farmis")); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newdiv=createElement("div",{"style":"white-space:nowrap;"},newtd); newinput=createElement("input",{"id":"inputvalFarmiLimits0","value":valFarmiLimits[0],"class":"text","maxlength":"3","size":"3px","style":"background-color:transparent;text-align:center;"},newdiv); newinput.addEventListener("focus",function(){this.style.backgroundColor="lightblue";},false); newinput.addEventListener("blur",function(){this.style.backgroundColor="transparent";},false); newinput.addEventListener("change",function(){ var help=parseInt(this.value,10); if (isNaN(help)){ this.value=""; }else{ help=Math.max(0,Math.min(999,Math.min(help,valFarmiLimits[1]))); valFarmiLimits[0]=help; doFarmis(); this.value=help; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valFarmiLimits", implode(valFarmiLimits),19); unsafeData.valFarmiLimits=valFarmiLimits.clone(); } },false); createElement("span",{},newdiv,"%"); newdiv=createElement("div",{"style":"white-space:nowrap;"},newtd); newinput=createElement("input",{"id":"inputvalFarmiLimits1","value":valFarmiLimits[1],"class":"text","maxlength":"3","size":"3px","style":"background-color:transparent;text-align:center;"},newdiv); newinput.addEventListener("focus",function(){this.style.backgroundColor="lightblue";},false); newinput.addEventListener("blur",function(){this.style.backgroundColor="transparent";},false); newinput.addEventListener("change",function(){ var help=parseInt(this.value,10); if (isNaN(help)){ this.value=""; }else{ help=Math.max(0,Math.min(999,Math.max(help,valFarmiLimits[0]))); valFarmiLimits[1]=help; doFarmis(); this.value=help; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valFarmiLimits", implode(valFarmiLimits),20); unsafeData.valFarmiLimits=valFarmiLimits.clone(); } },false); createElement("span",{},newdiv,"%"); createElement("td",{},newtr,getText("settings_valFarmiLimits")[0]); createElement("td",{},newtr,getText("settings_valFarmiLimits")[1]+" ("+getText("default")+": 90,100)"); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalFarmiMiniInfo","type":"checkbox","class":"link","checked":valFarmiMiniInfo},newtd); newinput.addEventListener("click",function(){ valFarmiMiniInfo=this.checked; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valFarmiMiniInfo", valFarmiMiniInfo,21); doFarmis(); },false); createElement("td",{},newtr,getText("settings_valFarmiMiniInfo")[0]); createElement("td",{},newtr,getText("settings_valFarmiMiniInfo")[1]); // *********************************************************************** newtr=createElement("tr",{},newtable); newtd=createElement("th",{"colspan":"3"},newtr,getText("farmersmarket")); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"value":valLimitEmptyFields["fl1"],"class":"text","maxlength":"2","size":"2px","style":"background-color:transparent;text-align:center;"},newtd); newinput.addEventListener("focus",function(){this.style.backgroundColor="lightblue";},false); newinput.addEventListener("blur",function(){this.style.backgroundColor="transparent";},false); newinput.addEventListener("keyup",function(){ var help=parseInt(this.value,10); if(isNaN(help)||(help<0)){ this.value=""; }else{ this.value=help; valLimitEmptyFields["fl1"]=help; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valLimitEmptyFields",implode(valLimitEmptyFields),14); zones.processProduction("farmersmarket-1"); } },false); createElement("td",{},newtr,getText("settings_valLimitEmptyFields")[0]); createElement("td",{},newtr,getText("settings_valLimitEmptyFields")[1]); newtd1=null; for(var j=0;j<ALL_ZONES["farmersmarket"].length;j++){ zoneNrF=ALL_ZONES["farmersmarket"][j]; if(zones.isProductional(zoneNrF)){ newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"zoneNrF":zoneNrF,"type":"checkbox","class":"link","checked":zoneAddToGlobalTime[zoneNrF]},newtd); if(zones.getBlock(zoneNrF)){ newinput.disabled=true; } newinput.addEventListener("click",function(){ var zoneNrF=this.getAttribute("zoneNrF"); zoneAddToGlobalTime[zoneNrF]=this.checked; unsafeData.zoneAddToGlobalTime=zoneAddToGlobalTime[zoneNrF]; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valGlobalTimeAdd", implode(zoneAddToGlobalTime)); zones.processProduction(zoneNrF); },false); newtd=createElement("td",{},newtr); if(zones.getBlock(zoneNrF)){ newtd.style.opacity="0.6"; } createElement("span",{},newtd,zones.getBuildingName(zoneNrF)); if(newtd1==null){ newtd1=createElement("td",{"rowspan":1},newtr,getText("settings_valzoneAddToGlobalTime")[1]); }else{ newtd1.rowSpan++; } } } newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"type":"checkbox","class":"link","checked":valGlobaltimeShowCroppedZone["farmersmarket"]},newtd); newinput.addEventListener("click",function(){ valGlobaltimeShowCroppedZone["farmersmarket"]=this.checked; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valGlobaltimeShowCroppedZone",implode(valGlobaltimeShowCroppedZone),16); },false); createElement("td",{},newtr,getText("settings_valGlobaltimeShowCroppedZone")[0]); createElement("td",{},newtr,getText("settings_valGlobaltimeShowCroppedZone")[1]); // *********************************************************************** newtr=createElement("tr",{},newtable); newtd=createElement("th",{"colspan":"3"},newtr,getText("windmill")); newtd1=null; for(var j=0;j<ALL_ZONES["city"].length;j++){ zoneNrF=ALL_ZONES["city"][j]; if(zones.isProductional(zoneNrF)){ newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"zoneNrF":zoneNrF,"type":"checkbox","class":"link","checked":zoneAddToGlobalTime[zoneNrF]},newtd); if(zones.getBlock(zoneNrF)){ newinput.disabled=true; } newinput.addEventListener("click",function(){ var zoneNrF=this.getAttribute("zoneNrF"); zoneAddToGlobalTime[zoneNrF]=this.checked; unsafeData.zoneAddToGlobalTime=zoneAddToGlobalTime[zoneNrF]; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valGlobalTimeAdd", implode(zoneAddToGlobalTime)); zones.processProduction(zoneNrF); },false); newtd=createElement("td",{},newtr); if(zones.getBlock(zoneNrF)){ newtd.style.opacity="0.6"; } createElement("span",{},newtd,zones.getBuildingName(zoneNrF)); if(newtd1==null){ newtd1=createElement("td",{"rowspan":1},newtr,getText("settings_valzoneAddToGlobalTime")[1]); }else{ newtd1.rowSpan++; } } } newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"type":"checkbox","class":"link","checked":valGlobaltimeShowCroppedZone["windmill"]},newtd); newinput.addEventListener("click",function(){ valGlobaltimeShowCroppedZone["windmill"]=this.checked; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valGlobaltimeShowCroppedZone",implode(valGlobaltimeShowCroppedZone),16); },false); createElement("td",{},newtr,getText("settings_valGlobaltimeShowCroppedZone")[0]); createElement("td",{},newtr,getText("settings_valGlobaltimeShowCroppedZone")[1]); // *********************************************************************** newtr=createElement("tr",{},newtable); newtd=createElement("th",{"colspan":"3"},newtr,getText("forestry")); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); var newinput=createElement("input",{"id":"inputvalGiess","type":"checkbox","class":"link","checked":valAutoWater["forestry"]},newtd); newinput.addEventListener("click",function(){ valAutoWater["forestry"]=this.checked; unsafeData.valAutoWater=valAutoWater; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valAutoWater",implode(valAutoWater),9); },false); createElement("td",{},newtr,getText("settings_valAutoWater")[0]); createElement("td",{},newtr,getText("settings_valAutoWater")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"type":"checkbox","class":"link","checked":valAutoCrop["forestry"]},newtd); newinput.addEventListener("click",function(){ valAutoCrop["forestry"]=this.checked; unsafeData.valAutoCrop=valAutoCrop; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valAutoCrop",implode(valAutoCrop),11); },false); createElement("td",{},newtr,getText("settings_valAutoCrop")[0]); createElement("td",{},newtr,getText("settings_valAutoCrop")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"type":"checkbox","class":"link","checked":valAssumeWater["forestry"]},newtd); newinput.addEventListener("click",function(){ valAssumeWater["forestry"]=this.checked; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valAssumeWater",implode(valAssumeWater),10); },false); createElement("td",{},newtr,getText("settings_valAssumeWater")[0]); createElement("td",{},newtr,getText("settings_valAssumeWater")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"type":"checkbox","class":"link","checked":valWaterNeeded["forestry"]},newtd); newinput.addEventListener("click",function(){ valWaterNeeded["forestry"]=this.checked; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valWaterNeeded",implode(valWaterNeeded),12); },false); createElement("td",{},newtr,getText("settings_valWaterNeeded")[0]); createElement("td",{},newtr,getText("settings_valWaterNeeded")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"value":valLimitEmptyFields["forest"],"class":"text","maxlength":"2","size":"2px","style":"background-color:transparent;text-align:center;"},newtd); newinput.addEventListener("focus",function(){this.style.backgroundColor="lightblue";},false); newinput.addEventListener("blur",function(){this.style.backgroundColor="transparent";},false); newinput.addEventListener("keyup",function(){ var help=parseInt(this.value,10); if(isNaN(help)||(help<0)){ this.value=""; }else{ this.value=help; valLimitEmptyFields["forest"]=help; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valLimitEmptyFields",implode(valLimitEmptyFields)); zones.processProduction("forest"); } },false); createElement("td",{},newtr,getText("settings_valLimitEmptyFields_forest")[0]); createElement("td",{},newtr,getText("settings_valLimitEmptyFields_forest")[1]); newtd1=null; for(var j=0;j<ALL_ZONES["forestry"].length;j++){ zoneNrF=ALL_ZONES["forestry"][j]; if(zones.isProductional(zoneNrF)){ newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"zoneNrF":zoneNrF,"type":"checkbox","class":"link","checked":zoneAddToGlobalTime[zoneNrF]},newtd); if(zones.getBlock(zoneNrF)){ newinput.disabled=true; } newinput.addEventListener("click",function(){ var zoneNrF=this.getAttribute("zoneNrF"); zoneAddToGlobalTime[zoneNrF]=this.checked; unsafeData.zoneAddToGlobalTime=zoneAddToGlobalTime[zoneNrF]; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valGlobalTimeAdd", implode(zoneAddToGlobalTime)); zones.processProduction(zoneNrF); },false); newtd=createElement("td",{},newtr); if(zones.getBlock(zoneNrF)){ newtd.style.opacity="0.6"; } createElement("span",{},newtd,zones.getBuildingName(zoneNrF)); if(newtd1==null){ newtd1=createElement("td",{"rowspan":1},newtr,getText("settings_valzoneAddToGlobalTime")[1]); }else{ newtd1.rowSpan++; } } } newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"type":"checkbox","class":"link","checked":valGlobaltimeShowCroppedZone["forestry"]},newtd); newinput.addEventListener("click",function(){ valGlobaltimeShowCroppedZone["forestry"]=this.checked; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valGlobaltimeShowCroppedZone",implode(valGlobaltimeShowCroppedZone),16); },false); createElement("td",{},newtr,getText("settings_valGlobaltimeShowCroppedZone")[0]); createElement("td",{},newtr,getText("settings_valGlobaltimeShowCroppedZone")[1]); // ********************************************************************** newtr=createElement("tr",{},newtable); newtd=createElement("th",{"colspan":"3"},newtr,unsafeWindow.foodworld_title); newtd1=null; for(var j=0;j<ALL_ZONES["foodworld"].length;j++){ zoneNrF=ALL_ZONES["foodworld"][j]; if(zones.isProductional(zoneNrF)){ newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"zoneNrF":zoneNrF,"type":"checkbox","class":"link","checked":zoneAddToGlobalTime[zoneNrF]},newtd); if(zones.getBlock(zoneNrF)){ newinput.disabled=true; } newinput.addEventListener("click",function(){ var zoneNrF=this.getAttribute("zoneNrF"); zoneAddToGlobalTime[zoneNrF]=this.checked; unsafeData.zoneAddToGlobalTime=zoneAddToGlobalTime[zoneNrF]; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valGlobalTimeAdd", implode(zoneAddToGlobalTime)); zones.processProduction(zoneNrF); },false); newtd=createElement("td",{},newtr); if(zones.getBlock(zoneNrF)){ newtd.style.opacity="0.6"; } createElement("span",{},newtd,zones.getBuildingName(zoneNrF)); if(newtd1==null){ newtd1=createElement("td",{"rowspan":1},newtr,getText("settings_valzoneAddToGlobalTime")[1]); }else{ newtd1.rowSpan++; } } } newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"type":"checkbox","class":"link","checked":valGlobaltimeShowCroppedZone["foodworld"]},newtd); newinput.addEventListener("click",function(){ valGlobaltimeShowCroppedZone["foodworld"]=this.checked; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valGlobaltimeShowCroppedZone",implode(valGlobaltimeShowCroppedZone),16); },false); createElement("td",{},newtr,getText("settings_valGlobaltimeShowCroppedZone")[0]); createElement("td",{},newtr,getText("settings_valGlobaltimeShowCroppedZone")[1]); // ********************************************************************** newtr=createElement("tr",{},newtable); newtd=createElement("th",{"colspan":"3"},newtr,getText("minRackamount")); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalMinRackMan","type":"checkbox","class":"link","checked":valMinRackMan},newtd); newinput.addEventListener("click",function(){ valMinRackMan=this.checked; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMinRackMan",valMinRackMan,22); var cand=$("infoPanelR").getElementsByClassName("minRackConfig"); if(valMinRackMan){ for(var v=0;v<cand.length;v++){ cand[v].disabled=true; cand[v].parentNode.parentNode.style.opacity=0.6; } }else{ for(var v=0;v<cand.length;v++){ cand[v].disabled=false; cand[v].parentNode.parentNode.style.opacity=1; } calcProdMinRackInit(); } cand=null; },false); createElement("td",{},newtr,getText("settings_valMinRackMan")[0]); newtd=createElement("td",{"class":"link"},newtr,getText("settings_valMinRackMan")[1]); newtd.addEventListener("click",function(){ unsafeWindow.buildInfoPanel("stock",{"page":2}); },false); newTd1=null; for(var v in valMinRack){ if(!valMinRack.hasOwnProperty(v)){ continue; } newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalMinRack_"+v,"class":"text minRackConfig","value":valMinRack[v],"maxlength":"4","size":"5px","style":"background-color:transparent;text-align:center;"},newtd); if(valMinRackMan){ newinput.disabled=true; newtr.style.opacity=0.6; } newinput.addEventListener("focus",function(){this.style.backgroundColor="lightblue";},false); newinput.addEventListener("blur",function(){this.style.backgroundColor="transparent";},false); newinput.addEventListener("keyup",function(){ var help=parseInt(this.value,10); if (isNaN(help)){ this.value=""; }else{ this.value=help; valMinRack[this.id.replace("inputvalMinRack_","")]=help; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMinRack",implode(valMinRack,"valMinRack")); calcProdMinRackInit(); } },false); createElement("td",{},newtr,getText("category_"+v)); if(newTd1==null){ newTd1=createElement("td",{},newtr,getText("settings_valMinRack")[1]); } else { newTd1.rowSpan++; } } newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"class":"text minRackConfig","type":"checkbox","checked":valMinRackPlantsize},newtd); if(valMinRackMan){ newinput.disabled=true; newtr.style.opacity=0.6; } newinput.addEventListener("click",function(){ GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMinRackPlantsize",this.checked,24); calcProdMinRackInit(); },false); createElement("td",{},newtr,getText("settings_valMinRackPlantsize")[0]); createElement("td",{},newtr,getText("settings_valMinRackPlantsize")[1]); // newtr=createElement("tr",{},newtable); // newtd=createElement("th",{"colspan":"3"},newtr,getText("minRackamount")); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalMinRackGrowing","type":"checkbox","class":"link","checked":valMinRackGrowing},newtd); newinput.addEventListener("click",function(){ valMinRackGrowing=this.checked; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMinRackGrowing",valMinRackGrowing,26); calcProdMinRack(); },false); createElement("td",{},newtr,getText("settings_valMinRackGrowing")[0]); createElement("td",{},newtr,getText("settings_valMinRackGrowing")[1]); newTd1=null; for(var typ in questData){ if(!questData.hasOwnProperty(typ)){ continue; } for(var camp in questData[typ]){ if(!questData[typ].hasOwnProperty(camp)){ continue; } newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); var newsel = createElement("select",{"id":"selectQuestCalcTo_"+typ+"_"+camp,"style":"width:auto;height:18px;margin-left:5px;"},newtd); createElement("option",{"value":-1},newsel,getText("hide")); createElement("option",{"value":0},newsel,"--"); for(var i=questData[typ][camp]["nr"];i<QUESTS[typ][camp].length;i++){ createElement("option",{"value":i},newsel,i); } newsel.addEventListener("change",function(){ if(isNaN(this.value)){return false;} var help=this.id.split("_"); setCalcToQuest(help[1],help[2],this.value); },false); newsel.value = questData[typ][camp]["calcTo"]; newtd=createElement("td",{},newtr,getText(typ=="main"?"farm":typ)+" "+camp); if(newTd1==null){ newTd1=createElement("td",{},newtr,getText("settings_valMinRackQuest")[1]); } else { newTd1.rowSpan++; } } } newsel=null;i=null; newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalMinRackRecursive","type":"checkbox","class":"link","checked":valMinRackRecursive},newtd); newinput.addEventListener("click",function(){ valMinRackRecursive=this.checked; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMinRackRecursive",valMinRackRecursive,29); calcProdMinRack(); },false); createElement("td",{},newtr,getText("settings_valMinRackRecursive")[0]); createElement("td",{},newtr,getText("settings_valMinRackRecursive")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalMinRackFarmis","type":"checkbox","class":"link","checked":valMinRackFarmis},newtd); newinput.addEventListener("click",function(){ valMinRackFarmis=this.checked; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMinRackFarmis",valMinRackFarmis,30); calcProdMinRack(); },false); createElement("td",{},newtr,getText("settings_valMinRackFarmis")[0]); createElement("td",{},newtr,getText("settings_valMinRackFarmis")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalMinRackForestryFarmis","type":"checkbox","class":"link","checked":valMinRackForestryFarmis},newtd); newinput.addEventListener("click",function(){ valMinRackForestryFarmis=this.checked; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMinRackForestryFarmis",valMinRackForestryFarmis,31); calcProdMinRack(); },false); createElement("td",{},newtr,getText("settings_valMinRackForestryFarmis")[0]); createElement("td",{},newtr,getText("settings_valMinRackForestryFarmis")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalProtectMinRack","type":"checkbox","class":"link","checked":GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valProtectMinRack",false)},newtd); newinput.addEventListener("click",function(){ GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valProtectMinRack",this.checked,32); },false); createElement("td",{},newtr,getText("settings_protectMinRack")[0]); createElement("td",{},newtr,getText("settings_protectMinRack")[1]); // ******************************************************************* newtr=createElement("tr",{},newtable); newtd=createElement("th",{"colspan":"3"},newtr,getText("market")); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalKauflimit00","value":valKauflimit[0][0],"class":"text","maxlength":"3","size":"2px","style":"background-color:transparent;text-align:center;"},newtd); newinput.addEventListener("focus",function(){this.style.backgroundColor="lightblue";},false); newinput.addEventListener("blur",function(){this.style.backgroundColor="transparent";},false); newinput.addEventListener("keyup",function(){ var help=parseInt(this.value,10); if (isNaN(help)){ this.value=""; }else{ valKauflimit[0][0]=help; this.value=valKauflimit[0][0]; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valKauflimit",implode(valKauflimit),33); } },false); createElement("span",{},newtd,"%"); createElement("td",{},newtr,getText("settings_valBuyingLimitDown")[0]); newtd=createElement("td",{},newtr,getText("settings_valBuyingLimitDown")[1]); newinput=createElement("input",{"id":"inputvalKauflimit01","value":valKauflimit[0][1],"class":"text","maxlength":"6","size":"10px","style":"background-color:#"+valKauflimit[0][1]+";color:#F0FFEF;"},newtd); newinput.addEventListener("keyup",function(){ this.value=this.value.replace(/[^0-9a-f]/ig,""); this.style.backgroundColor="#"+this.value; },false); newinput.addEventListener("change",function(){ var color=this.value; if(!color.match(/^([0-9a-f]{3}){1,2}$/i)){ color="990000"; this.value=color; } this.style.backgroundColor="#"+this.value; valKauflimit[0][1]=this.value; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valKauflimit",implode(valKauflimit),34); },false); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalKauflimit1","value":valKauflimit[1],"class":"text","maxlength":"3","size":"2px","style":"background-color:transparent;text-align:center;"},newtd); newinput.addEventListener("focus",function(){this.style.backgroundColor="lightblue";},false); newinput.addEventListener("blur",function(){this.style.backgroundColor="transparent";},false); newinput.addEventListener("keyup",function(){ var help=parseInt(this.value,10); if (isNaN(help)){ this.value=""; }else{ if(help<0){ help*=-1; } valKauflimit[1]=help; this.value=valKauflimit[1]; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valKauflimit",implode(valKauflimit),35); } },false); createElement("span",{},newtd,"%"); createElement("td",{},newtr,getText("settings_valBuyingLimit")[0]); createElement("td",{},newtr,getText("settings_valBuyingLimit")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalKauflimitNPC","type":"checkbox","class":"link","checked":GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valKauflimitNPC",true)},newtd); newinput.addEventListener("click",function(){ GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valKauflimitNPC",this.checked,36); },false); createElement("td",{},newtr,getText("settings_valBuyingLimitNPC")[0]); createElement("td",{},newtr,getText("settings_valBuyingLimitNPC")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newdiv=createElement("div",{},newtd); newinput=createElement("input",{"id":"inputvalVerkaufLimitDown","value":GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valVerkaufLimitDown",95),"class":"text","maxlength":"3","size":"2px","style":"background-color:transparent;text-align:center;"},newdiv); newinput.addEventListener("focus",function(){this.style.backgroundColor="lightblue";},false); newinput.addEventListener("blur",function(){this.style.backgroundColor="transparent";},false); newinput.addEventListener("change",function(){ var valVerkaufLimitDown=parseInt(this.value,10); var valVerkaufLimitUp=parseInt($("inputvalVerkaufLimitUp").value,10); valVerkaufLimitDown=Math.min(valVerkaufLimitDown,valVerkaufLimitUp); if (isNaN(valVerkaufLimitDown)){ this.value=""; }else{ this.value=valVerkaufLimitDown; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valVerkaufLimitDown", valVerkaufLimitDown,37); } },false); createElement("span",{},newdiv,"%"); newdiv=createElement("div",{},newtd); newinput=createElement("input",{"id":"inputvalVerkaufLimitUp","value":GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valVerkaufLimitUp",130),"class":"text","maxlength":"3","size":"2px","style":"background-color:transparent;text-align:center;"},newdiv); newinput.addEventListener("focus",function(){this.style.backgroundColor="lightblue";},false); newinput.addEventListener("blur",function(){this.style.backgroundColor="transparent";},false); newinput.addEventListener("change",function(){ var valVerkaufLimitDown=parseInt($("inputvalVerkaufLimitDown").value,10); var valVerkaufLimitUp=parseInt(this.value,10); valVerkaufLimitUp=Math.max(valVerkaufLimitDown,valVerkaufLimitUp); if (isNaN(valVerkaufLimitUp)){ this.value=""; }else{ this.value=valVerkaufLimitUp; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valVerkaufLimitUp", valVerkaufLimitUp,38); } },false); createElement("span",{},newdiv,"%"); createElement("td",{},newtr,getText("settings_valSellingLimit")[0]); createElement("td",{},newtr,getText("settings_valSellingLimit")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalJoinPreise","type":"checkbox","class":"link","checked":GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valJoinPreise",false)},newtd); newinput.addEventListener("click",function(){ GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valJoinPreise", this.checked,39); },false); createElement("td",{},newtr,getText("settings_valJoinPrices")[0]); createElement("td",{},newtr,getText("settings_valJoinPrices")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalQuicklinks","type":"checkbox","class":"link","checked":GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valQuicklinks",true)},newtd); newinput.addEventListener("click",function(){GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valQuicklinks", this.checked,40);},false); createElement("td",{},newtr,getText("settings_valQuicklinks")[0]); createElement("td",{},newtr,getText("settings_valQuicklinks")[1]); function drawDivHighlightUser(name,color,parent){ newdiv=createElement("div",{},parent); newinput=createElement("input",{"value":name,"class":"text","maxlength":"20","size":"25px","style":"background-color:transparent;"},newdiv); newinput.addEventListener("focus",function(){this.style.backgroundColor="lightblue";},false); newinput.addEventListener("blur",function(){this.style.backgroundColor="transparent";},false); newinput=createElement("input",{"value":color,"class":"text","maxlength":"6","size":"10px","style":"background-color:#"+color+";color:#F0FFEF;"},newdiv); newinput.addEventListener("keyup",function(){ this.value=this.value.replace(/[^0-9a-f]/ig,""); this.style.backgroundColor="#"+this.value; },false); newdiv.addEventListener("change",function(){ var tableCell=this.parentNode; var candinput=tableCell.getElementsByTagName("input"); var highlightUser=new Object(); for(var v=0;v<candinput.length;v+=2){ var name=candinput[v].value; if(highlightUser[name]){ // remove duplicate removeElement(candinput[v].parentNode); v-=2; }else{ var color=candinput[v+1].value; if(!color.match(/^([0-9a-f]{3}){1,2}$/i)){ color="20b2aa"; candinput[v+1].value=color; candinput[v+1].style.backgroundColor="#"+color; } highlightUser[name]=color; } } if(highlightUser[""]==undefined){ drawDivHighlightUser("","20b2aa",tableCell); }else{ delete highlightUser[""]; } GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_highlight",implode(highlightUser),41); candinput=null;tableCell=null; },false); } var highlightUser=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_highlight","{}"),"buildInfoPanel/options/highlightUser",{}); highlightUser[""]="20b2aa"; newtr=createElement("tr",{},newtable); createElement("td",{"align":"center"},newtr); createElement("td",{},newtr,getText("highlightUser")); newtd=createElement("td",{},newtr); for(var name in highlightUser){ if(!highlightUser.hasOwnProperty(name)){ continue; } drawDivHighlightUser(name,highlightUser[name],newtd); } newtr=createElement("tr",{},newtable); createElement("td",{"align":"center"},newtr); createElement("td",{},newtr,getText("highlightProducts")); newtd=createElement("td",{},newtr); newdiv=createElement("div",{},newtd); newinput=createElement("input",{"type":"checkbox","class":"link","checked":highlightProducts[0]},newdiv); newinput.addEventListener("click",function(){ highlightProducts[0]=this.checked; $("highlightProducts0").disabled=highlightProducts[0]; $("highlightProducts1").disabled=highlightProducts[0]; if(highlightProducts[0]){ // todo calc highlightProducts[1] $("highlightProducts0").value=-1; $("highlightProducts1").value=-1; } else { var i=0; for(var prod in highlightProducts[1]){ if(!highlightProducts[1].hasOwnProperty(prod)){ continue; } if(i>1){continue;} $("highlightProducts"+i).value=prod; i++; } } GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_highlightProducts",implode(highlightProducts),42); },false); createElement("span",{},newdiv,getText("useQuestProducts")); for(var i=0;i<2;i++){ newinput=createElement("select",{"id":"highlightProducts"+i,"class":"link2"},newtd); createElement("option",{"value":"-1"},newinput,"--"); for(var v=0;v<prodNameSort[0].length;v++){ if((!prodBlock[0][prodNameSort[0][v]].match(/t/))&&(!prodBlock[0][prodNameSort[0][v]].match(/l/))){ createElement("option",{"value":prodNameSort[0][v]},newinput,prodName[0][prodNameSort[0][v]]); } } if(highlightProducts[0]){ newinput.disabled=true; newinput.value=-1; } newinput.addEventListener("change",function(){ highlightProducts[1]={}; highlightProducts[1][$("highlightProducts0").value]=true; highlightProducts[1][$("highlightProducts1").value]=true; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_highlightProducts",implode(highlightProducts),43); },false); } if(!highlightProducts[0]){ var i=0; for(var prod in highlightProducts[1]){ if(!highlightProducts[1].hasOwnProperty(prod)){ continue; } if(i>1){continue;} $("highlightProducts"+i).value=prod; i++; } } newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalNimmBeob","type":"checkbox","class":"link","checked":GM_getValue(COUNTRY+"_"+SERVER+"_valNimmBeob",false)},newtd); newinput.addEventListener("click",function(){ GM_setValue2(COUNTRY+"_"+SERVER+"_valNimmBeob",this.checked,44); },false); createElement("td",{},newtr,getText("settings_valUseObservedPrices")[0]); createElement("td",{},newtr,getText("settings_valUseObservedPrices")[1]); // ******************************************************************** newtr=createElement("tr",{},newtable); newtd=createElement("th",{"colspan":"3"},newtr,getText("messages")); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalNachr","value":GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valPrivNachr",100),"class":"text","maxlength":"5","size":"5px","style":"background-color:transparent;text-align:center;"},newtd); newinput.addEventListener("focus",function(){this.style.backgroundColor="lightblue";},false); newinput.addEventListener("blur",function(){this.style.backgroundColor="transparent";},false); newinput.addEventListener("keyup",function(){ var valPrivNachr=parseInt(this.value,10); if (isNaN(valPrivNachr)){ this.value=""; }else{ this.value=valPrivNachr; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valPrivNachr", valPrivNachr,45); } },false); createElement("td",{},newtr,getText("settings_valPrivateMessages")[0]); createElement("td",{},newtr,getText("settings_valPrivateMessages")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalNachr","value":GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valNachr",100),"class":"text","maxlength":"5","size":"5px","style":"background-color:transparent;text-align:center;"},newtd); newinput.addEventListener("focus",function(){this.style.backgroundColor="lightblue";},false); newinput.addEventListener("blur",function(){this.style.backgroundColor="transparent";},false); newinput.addEventListener("keyup",function(){ var valNachr=parseInt(this.value,10); if (isNaN(valNachr)){ this.value=""; }else{ this.value=valNachr; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valNachr", valNachr,46); } },false); createElement("td",{},newtr,getText("settings_valMarketMessages")[0]); createElement("td",{},newtr,getText("settings_valMarketMessages")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalMessageRe","type":"checkbox","checked":GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMessageRe",true),"class":"link"},newtd); newinput.addEventListener("click",function(){ GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMessageRe", this.checked,47); },false); createElement("td",{},newtr,getText("settings_valMessageRe")[0]); createElement("td",{},newtr,getText("settings_valMessageRe")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalContractLogAmount","value":GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valContractLogAmount",200),"class":"text","maxlength":"5","size":"5px","style":"background-color:transparent;text-align:center;"},newtd); newinput.addEventListener("focus",function(){this.style.backgroundColor="lightblue";},false); newinput.addEventListener("blur",function(){this.style.backgroundColor="transparent";},false); newinput.addEventListener("keyup",function(){ var valContractLogAmount=parseInt(this.value,10); if (isNaN(valContractLogAmount)){ this.value=""; }else{ this.value=valContractLogAmount; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valContractLogAmount", valContractLogAmount,17); } },false); createElement("td",{},newtr,getText("settings_valContractLogAmount")[0]); createElement("td",{},newtr,getText("settings_valContractLogAmount")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"type":"checkbox","checked":valMessagesSystemMarkRead,"class":"link"},newtd); newinput.addEventListener("click",function(){ GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMessagesSystemMarkRead", this.checked,47); },false); createElement("td",{},newtr,getText("settings_valMessagesSystemMarkRead")[0]); createElement("td",{},newtr,getText("settings_valMessagesSystemMarkRead")[1]); // ********************************************************************* newtr=createElement("tr",{},newtable); newtd=createElement("th",{"colspan":"3"},newtr,getText("general")); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalAutoLogin","type":"checkbox","class":"link","checked":GM_getValue("valAutoLogin",false)},newtd); newinput.addEventListener("click",function(){GM_setValue2("valAutoLogin", this.checked,48);},false); createElement("td",{},newtr,getText("settings_valAutoLogin")[0]); createElement("td",{},newtr,getText("settings_valAutoLogin")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalUpdate","type":"checkbox","class":"link","checked":GM_getValue("valUpdate",true)},newtd); newinput.addEventListener("click",function(){GM_setValue2("valUpdate", this.checked,49);},false); createElement("td",{},newtr,getText("settings_valUpdate")[0]); createElement("td",{},newtr,getText("settings_valUpdate")[1]); if (STAT_SERVER[COUNTRY]){ newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalStatistik","type":"checkbox","class":"link","checked":valStatistik},newtd); newinput.addEventListener("click",function(){ valStatistik=this.checked; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valStatistik", valStatistik,50); },false); createElement("td",{},newtr,getText("settings_valSendStatistics")[0]); createElement("td",{},newtr,getText("settings_valSendStatistics")[1]); } newtr=createElement("tr",{},newtable); newtd=createElement("td",{},newtr); createElement("td",{},newtr,getText("settings_valServerTimeOffset")[0]); newtd=createElement("td",{},newtr); newinput=createElement("button",{"type":"button","class":"link2"},newtd,"-"); newinput.addEventListener("click",function(){ valServerTimeOffset=Math.max(-86400,valServerTimeOffset-3600); GM_setValue(COUNTRY+"_valServerTimeOffset",valServerTimeOffset); nowServerOff=unsafeWindow.Zeit.Server+valServerTimeOffset; this.parentNode.children[1].innerHTML=(valServerTimeOffset<0?"":"+")+Math.round(valServerTimeOffset/3600)+getText("shortHours"); this.parentNode.children[3].innerHTML=getFormattedDateStr(nowServerOff)+" "+getDaytimeStr(nowServerOff); },false); createElement("span",{"style":"margin-right:5px;"},newtd,(valServerTimeOffset<0?"":"+")+Math.round(valServerTimeOffset/3600)+getText("shortHours")); newinput=createElement("button",{"type":"button","class":"link2"},newtd,"+"); newinput.addEventListener("click",function(){ valServerTimeOffset=Math.min(86400,valServerTimeOffset+3600); GM_setValue(COUNTRY+"_valServerTimeOffset",valServerTimeOffset); nowServerOff=unsafeWindow.Zeit.Server+valServerTimeOffset; this.parentNode.children[1].innerHTML=(valServerTimeOffset<0?"":"+")+Math.round(valServerTimeOffset/3600)+getText("shortHours"); this.parentNode.children[3].innerHTML=getFormattedDateStr(nowServerOff)+" "+getDaytimeStr(nowServerOff); },false); createElement("span",{"style":"margin-left:10px;"},newtd,getFormattedDateStr(nowServerOff)+" "+getDaytimeStr(nowServerOff)); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalGamecursor","type":"checkbox","class":"link","checked":GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valGamecursor",true)},newtd); newinput.addEventListener("click",function(){GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valGamecursor", this.checked,51);},false); createElement("td",{},newtr,getText("settings_valGamecursor")[0]); createElement("td",{},newtr,getText("settings_valGamecursor")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalDrag","type":"checkbox","class":"link","checked":GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valDrag",false)},newtd); newinput.addEventListener("click",function(){GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valDrag", this.checked,52);},false); createElement("td",{},newtr,getText("settings_valDrag")[0]); createElement("td",{},newtr,getText("settings_valDrag")[1]); /* newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalDrag","type":"checkbox","class":"link","checked":valClickErrorbox},newtd); newinput.addEventListener("click",function(){ valClickErrorbox=this.checked; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valClickErrorbox", valClickErrorbox,53); },false); createElement("td",{},newtr,getText("settings_valClickErrorbox")[0]); createElement("td",{},newtr,getText("settings_valClickErrorbox")[1]); */ newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputvalHotkey","type":"checkbox","class":"link","checked":GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valHotkey",true)},newtd); newinput.addEventListener("click",function(){GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valHotkey", this.checked,54);},false); createElement("td",{},newtr,getText("settings_valHotkeys")[0]); createElement("td",{},newtr,getText("settings_valHotkeys")[1]); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"colspan":"2","align":"center"},newtr); newinput=createElement("button",{"type":"button","class":"link2"},newtd,getText("settings_cacheReset")[0]); newinput.addEventListener("click",function(){ alert2(getText("settings_cacheReset")[1],getText("yes"),getText("no"),function(){ for(var i=1000; i >=0; --i){unsafeWindow.clearInterval(i);} window.setTimeout(function(){ var protect={"kauf":1,"farmiLog":1,"vertraegeIn":1,"vertraegeOut":1,"levelLog":1,"nachrichten":1}; var help=cloneInto(GM_listValues(), unsafeWindow); for(var v=help.length-1;v>-1;v--){ if(help[v].match(COUNTRY+"_"+SERVER+"_"+USERNAME+"_")){ var curr=help[v].replace(COUNTRY+"_"+SERVER+"_"+USERNAME+"_",""); if(!protect[curr]){ GM_deleteValue(help[v]); } } } top.location.href=top.location.href; },500); }); },false); createElement("td",{},newtr,getText("settings_cacheReset")[1]); // ***** newtr=createElement("tr",{},newtable); newtd=createElement("th",{"colspan":"3"},newtr,"Developing"); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputDevmode","type":"checkbox","class":"link","checked":DEVMODE},newtd); newinput.addEventListener("click",function(){GM_setValue2("devmode",DEVMODE=this.checked,55);},false); createElement("td",{},newtr,"Developer Mode"); createElement("td",{},newtr); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputDevmodeEvents","type":"checkbox","class":"link","checked":DEVMODE_EVENTS},newtd); newinput.addEventListener("click",function(){GM_setValue2("devmode_events",DEVMODE_EVENTS=this.checked,56);},false); createElement("td",{},newtr,"Developer Mode"); createElement("td",{},newtr,"Show events (reload page)"); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputDevmodeFunctions","type":"checkbox","class":"link","checked":DEVMODE_FUNCTION},newtd); newinput.addEventListener("click",function(){GM_setValue2("devmode_function",DEVMODE_FUNCTION=this.checked);},false); createElement("td",{},newtr,"Developer Function"); createElement("td",{},newtr,"Show function calls"); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputDevmodeLogWarning","type":"checkbox","class":"link","checked":DEVMODE_LOG_WARNING},newtd); newinput.addEventListener("click",function(){GM_setValue2("devmode_log_warning",DEVMODE_LOG_WARNING=this.checked);},false); createElement("td",{"rowspan":"2"},newtr,"Logging"); createElement("td",{},newtr,"Show warnings in screen"); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"align":"center"},newtr); newinput=createElement("input",{"id":"inputDevmodeLogWarning","type":"checkbox","class":"link","checked":DEVMODE_LOG_ERROR},newtd); newinput.addEventListener("click",function(){GM_setValue2("devmode_log_error",DEVMODE_LOG_ERROR=this.checked);},false); createElement("td",{},newtr,"Show errors in screen"); newtable=null;newtr=null;newtd=null;newdiv=null;newinput=null; }catch(err){GM_logError("buildInfoPanelOptions\n"+err);} } function buildInfoPanelAccounts(showPW){ try{ var container,newtable,newtr,newtd,newinput,newselect,newdiv; newdiv=$("infoPanelNaviAccounts"); newdiv.classList.remove("naviItem"); newdiv.classList.add("naviItemActive"); var logindata=explode(GM_getValue("logindata","[]"),"buildInfoPanelAccounts/logindata",[]); container=$("infoPanelR"); container.innerHTML=""; newtable=createElement("table",{"align":"center"},container); newtr=createElement("tr",{},newtable); createElement("th",{},newtr); createElement("th",{},newtr,getText("server")); createElement("th",{},newtr,getText("name")); createElement("th",{},newtr,getText("password")); createElement("th",{"colspan":2},newtr); for(var v=0;v<logindata.length;v++){ newtr=createElement("tr",{"v":v},newtable); newtd=createElement("td",{},newtr); newinput=createElement("input",{"type":"checkbox","class":"link","checked":logindata[v][4]},newtd); newinput.addEventListener("mouseover",function(event){ toolTip.show(event,getText("accountActive")); },false); newinput.addEventListener("change",function(){ logindata[this.parentNode.parentNode.getAttribute("v")][4]=this.checked; GM_setValueCache("logindata",implode(logindata),57); },false); newtd=createElement("td",{},newtr); newinput=createElement("input",{"class":"text","style":"width:20px","maxlength":"2"},newtd); if (isNaN(logindata[v][1])){ logindata[v][1]="0";} if (logindata[v][1]!="0"){ newinput.value=logindata[v][1]; } newinput.addEventListener("change",function(){ var readin=parseInt(this.value,10); if (isNaN(readin) || (readin<1)){ alert2(getText("invalidServer"),getText("ok")); this.value=""; }else{ this.value=readin; logindata[this.parentNode.parentNode.getAttribute("v")][1]=readin; GM_setValueCache("logindata",implode(logindata),57); } },false); newselect=createElement("select",{},newtd); for(var w in GAMEPAGES){ if(!GAMEPAGES.hasOwnProperty(w)){ continue; } createElement("option",{"value":w},newselect,w); } newselect.value=logindata[v][0]; newselect.addEventListener("change",function(){ logindata[this.parentNode.parentNode.getAttribute("v")][0]=this.value; GM_setValueCache("logindata",implode(logindata),57); },false); newtd=createElement("td",{},newtr); newinput=createElement("input",{"value":logindata[v][2],"class":"text","style":"width:140px","maxlength":"20"},newtd); newinput.addEventListener("change",function(){ logindata[this.parentNode.parentNode.getAttribute("v")][2]=this.value; GM_setValueCache("logindata",implode(logindata),57); },false); newtd=createElement("td",{},newtr); newinput=createElement("input",{"value":enc(logindata[v][3],-4242),"class":"text","style":"width:140px","maxlength":"20"},newtd); if (!showPW){ newinput.type="password"; } newinput.addEventListener("change",function(){ logindata[this.parentNode.parentNode.getAttribute("v")][3]=enc(this.value,4242); GM_setValueCache("logindata",implode(logindata),57); },false); newtd=createElement("td",{},newtr); if (v>0){ newdiv=createElement("div",{"class":"link2","style":"width:14px;height:10px;"},newtd); createElement("img",{"src":GFX+"quest_up.gif","style":"width:14px;height:10px;"},newdiv); newdiv.addEventListener("mouseover",function(){this.style.backgroundColor="blue";},false); newdiv.addEventListener("mouseout",function(){this.style.backgroundColor="transparent";},false); newdiv.addEventListener("click",function(showPW){ return function(){ var currLine=parseInt(this.parentNode.parentNode.getAttribute("v"),10); logindata.splice(currLine-1,2,logindata[currLine],logindata[currLine-1]); GM_setValueCache("logindata",implode(logindata),57); buildInfoPanelAccounts(showPW); }}(showPW),false); } if (v<logindata.length-1){ newdiv=createElement("div",{"class":"link2","style":"width:14px;height:10px;"},newtd); createElement("img",{"src":GFX+"quest_down.gif","style":"width:14px;height:10px;"},newdiv); newdiv.addEventListener("mouseover",function(){this.style.backgroundColor="blue";},false); newdiv.addEventListener("mouseout",function(){this.style.backgroundColor="transparent";},false); newdiv.addEventListener("click",function(showPW){ return function(){ var currLine=parseInt(this.parentNode.parentNode.getAttribute("v"),10); logindata.splice(currLine,2,logindata[currLine+1],logindata[currLine]); GM_setValueCache("logindata",implode(logindata),57); buildInfoPanelAccounts(showPW); }}(showPW),false); } newtd=createElement("td",{},newtr); createElement("img",{"src":GFX+"popin/contracts/anullieren.gif","class":"link2","style":"width: 16px;height: 16px;"},newtd); newtd.addEventListener("mouseover",function(event){ toolTip.show(event,getText("delete")); this.style.backgroundColor="blue"; },false); newtd.addEventListener("mouseout",function(){this.style.backgroundColor="transparent";},false); newtd.addEventListener("click",function(showPW){ return function(){ var currLine=parseInt(this.parentNode.getAttribute("v"),10); logindata.splice(currLine,1); GM_setValueCache("logindata",implode(logindata),57); buildInfoPanelAccounts(showPW); }}(showPW),false); } newtr=createElement("tr",{},newtable); newtd=createElement("td",{"colspan":"5","class":"link","style":"font-weight:bold;font-size:16px;text-align:right;"},newtr,"+"); newtd.addEventListener("mouseover",function(){this.style.backgroundColor="blue";},false); newtd.addEventListener("mouseout",function(){this.style.backgroundColor="transparent";},false); newtd.addEventListener("click",function(showPW){ return function(){ logindata.push([COUNTRY,"0","","",false]); // new empty line GM_setValueCache("logindata",implode(logindata),57); buildInfoPanelAccounts(showPW); }}(showPW),false); newdiv=createElement("div",{"align":"center"},container); newinput=createElement("input",{"type":"checkbox","class":"link","checked":showPW},newdiv); newinput.addEventListener("click",function(){buildInfoPanelAccounts(this.checked);},false); createElement("span",{},newdiv,getText("showPasswords")); container=null;newtable=null;newtr=null;newtd=null;newinput=null;newselect=null;newdiv=null; }catch(err){GM_logError("buildInfoPanelAccounts\n"+err);} } function buildInfoPanelHotkeys(){ try{ var container,newtable,newtr,newtd,newinput,newdiv; newdiv=$("infoPanelNaviHotkeys"); newdiv.classList.remove("naviItem"); newdiv.classList.add("naviItemActive"); container=$("infoPanelR"); newtable=createElement("table",{"align":"center","border":"1","class":"hoverRowBgCc9"},container); for(var tr in getText("settings_hotkeymap")){ if(!getText("settings_hotkeymap").hasOwnProperty(tr)){ continue; } newtr=createElement("tr",{},newtable); newtd=createElement("td",{},newtr); newinput=createElement("input",{"id":"hotkey"+tr,"value":getKeySymbol(hotkeymap[tr]),"class":"text","style":"width:80px;"},newtd); newinput.addEventListener("keyup",function(event){ this.value=getKeySymbol(event.keyCode); hotkeymap[this.id.replace("hotkey","")]=event.keyCode; GM_setValue2("hotkeymap",implode(hotkeymap),58); },false); createElement("td",{},newtr,getText("settings_hotkeymap")[tr]); } container=null;newtable=null;newtr=null;newtd=null;newinput=null;newdiv=null; }catch(err){GM_logError("buildInfoPanelHotkeys\n"+err);} } function buildInfoPanelCss(){ try{ var container,newtable,newtr,newtd,newinput,newdiv; newdiv=$("infoPanelNaviCss"); newdiv.classList.remove("naviItem"); newdiv.classList.add("naviItemActive"); container=$("infoPanelR"); newtable=createElement("table",{"align":"center"},container); for(var v in css_styles){ if(!css_styles.hasOwnProperty(v)){ continue; } newtr=createElement("tr",{},newtable); createElement("td",{},newtr,v); newtd=createElement("td",{},newtr); var help=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_"+v,css_styles[v][1]); newinput=createElement("input",{"name":v,"value":help,"class":"text","style":"width:250px;"},newtd); newinput.addEventListener("keyup",function(){ var v=this.getAttribute("name"); if(this.value==""){ this.value=INIT_CSS_STYLES[v][1]; } css_styles[v][1]=this.value; var help=css_styles[v][1]; for(var w=0;w<css_styles[v][0].length;w++){ help=css_styles[css_styles[v][0][w]][1]+help; } this.parentNode.nextSibling.firstElementChild.setAttribute("style",help); GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_css_styles",implode(css_styles)); },false); newtd=createElement("td",{},newtr); for(var w=0;w<css_styles[v][0].length;w++){ help=css_styles[css_styles[v][0][w]][1]+help; } newdiv=createElement("div",{"style":help},newtd,"test"); } container=null;newtable=null;newtr=null;newtd=null;newinput=null;newdiv=null; }catch(err){GM_logError("buildInfoPanelCss\n"+err);} } function buildInfoPanelImport(mode,showData,onlyThisAccount){ try{ var container,newtable,newtr,newtd,newinput,newdiv; newdiv=$("infoPanelNaviImport"); newdiv.classList.remove("naviItem"); newdiv.classList.add("naviItemActive"); container=$("infoPanelR"); container.innerHTML=""; newdiv=createElement("div",{"style":"left:0px;position:absolute;width:450px;"},container); newinput=createElement("div",{"class":"link naviItem"+(mode=="export"?"Active":""),"style":"width:40%;"},newdiv,"Export"); newinput.addEventListener("click",function(){ buildInfoPanelImport("export",false,true); },false); newinput=createElement("div",{"class":"link naviItem"+(mode=="import"?"Active":""),"style":"width:40%;"},newdiv,"Import"); newinput.addEventListener("click",function(){ buildInfoPanelImport("import",false,true); },false); container=createElement("div",{"id":"beraterDataImportContainer","style":"position:absolute;top:30px;left:5px;height:485px;width:475px;overflow:auto;"},container); switch(mode){ case "export":{ // if (showData&&(!onlyThisAccount)){ // if(!confirm("Attention! Showing all data of all accounts can slow down your browser. Continue?")){ // showData=false; // } // } createElement("div",{},container,"Click the lines to remove them."); var newdiv=createElement("div",{},container); var newinput=createElement("input",{"type":"checkbox","checked":showData},newdiv); newinput.addEventListener("click",function(){ showExportData(this.checked,onlyThisAccount); },false); createElement("span",{},newdiv,"Show the data"); newdiv=createElement("div",{},container); newinput=createElement("input",{"type":"checkbox","checked":onlyThisAccount},newdiv); newinput.addEventListener("click",function(){ showExportData(showData,this.checked); },false); createElement("span",{},newdiv,"Only this account"); newinput=createElement("button",{"class":"link"},container,"Create string!"); newinput.addEventListener("click",function(){ var save=""; var help=$("beraterDataImportContainer").getElementsByTagName("tr"); for(var v=0;v<help.length;v++){ var help2=help[v].getElementsByTagName("td"); save += help2[0].innerHTML+":"+help2[1].innerHTML+":"+help2[2].firstElementChild.innerHTML+"::"; } prompt("Copy this string to a text-file", save.slice(0,save.length-2)); },false); var newtable=createElement("table",{"border":"1","class":"hoverRowBgCc9","style":"width:100%"},container); var newtr,newtd; var help=cloneInto(GM_listValues(), unsafeWindow); help.sort(); if(onlyThisAccount){ for(var v=0;v<help.length;v++){ if(help[v].search(COUNTRY+"_"+SERVER+"_"+USERNAME)!=-1){ var help2=GM_getValue(help[v]); var help3="s"; if(help2==""){ help2=" "; } if(typeof help2=="number"){ help3="n"; } else if(typeof help2=="boolean"){ help3="b"; } else{ help2=help2.replace(/(:+)/g,":"); } newtr=createElement("tr",{},newtable); newtr.addEventListener("click",function(){ removeElement(this); },false); createElement("td",{},newtr,help[v].replace(COUNTRY+"_"+SERVER+"_"+USERNAME+"_","")); createElement("td",{},newtr,help3); newtd=createElement("td",{"style":(showData?"":"display:none;")},newtr); createElement("div",{"style":"max-height:100px;width:270px;overflow:auto;"},newtd,help2); } } }else{ for(var v=0;v<help.length;v++){ var help2=GM_getValue(help[v]); var help3="s"; if(help2==""){ help2=" "; } if(typeof help2=="number"){ help3="n"; } else if(typeof help2=="boolean"){ help3="b"; } else{ help2=help2.replace(/(:+)/g,":"); } newtr=createElement("tr",{},newtable); newtr.addEventListener("click",function(){ removeElement(this); },false); createElement("td",{},newtr,help[v]); createElement("td",{},newtr,help3); newtd=createElement("td",{"style":(showData?"":"display:none;")},newtr); createElement("div",{"style":"max-height:100px;width:270px;overflow:auto;"},newtd,help2); } } container=null;newdiv=null;newtable=null;newtr=null;newtd=null;newinput=null; break;} case "import":{ createElement("div",{},container,"Click the lines to remove them."); var newdiv=createElement("div",{},container); var newinput=createElement("input",{"type":"checkbox","checked":showData},newdiv); newinput.addEventListener("click",function(){ showImportData(this.checked,onlyThisAccount); },false); createElement("span",{},newdiv,"Show the data"); newdiv=createElement("div",{},container); newinput=createElement("input",{"type":"checkbox","checked":onlyThisAccount},newdiv); newinput.addEventListener("click",function(){ showImportData(showData,this.checked); },false); createElement("span",{},newdiv,"Only this account"); newinput=createElement("button",{"class":"link"},container,"Enter data-string"); newinput.addEventListener("click",function(){ var promptdata=prompt("Please enter the data-string",""); if(promptdata){ var container=$("beraterDataImportContainer"); var newtable=container.getElementsByTagName("table"); if(newtable[0]){ removeElement(newtable[0]); } newtable=createElement("table",{"border":"1","class":"hoverRowBgCc9","style":"width:100%"},container); var newtr,newtd; var help=promptdata.split("::"); for(var v=0;v<help.length;v++){ var help2=help[v].split(":"); var impName=(onlyThisAccount?COUNTRY+"_"+SERVER+"_"+USERNAME+"_":"")+help2.splice(0,1)[0]; var impType=help2.splice(0,1)[0]; var impContent=help2.join(":"); if(impContent==" "){ impContent=""; } if((impType=="n")||(impType=="b")||(impType=="s")){ newtr=createElement("tr",{},newtable); newtr.addEventListener("click",function(){ removeElement(this); },false); createElement("td",{},newtr,impName); createElement("td",{},newtr,impType); newtd=createElement("td",{"style":(showData?"":"display:none;")},newtr); createElement("div",{"style":"max-height:100px;width:280px;overflow:auto;"},newtd,impContent); } } container=null;newtable=null;newtr=null;newtd=null; } },false); newinput=createElement("button",{"class":"link"},container,"Import this!"); newinput.addEventListener("click",function(){ var help=$("beraterDataImportContainer").getElementsByTagName("tr"); for(var v=0;v<help.length;v++){ var help2=help[v].getElementsByTagName("td"); switch(help2[1].innerHTML){ case "n": GM_setValue2(help2[0].innerHTML,parseInt(help2[2].getElementsByTagName("div")[0].innerHTML,10),59);break; case "b": GM_setValue2(help2[0].innerHTML,help2[2].getElementsByTagName("div")[0].innerHTML=="true",60);break; case "s": GM_setValue2(help2[0].innerHTML,help2[2].getElementsByTagName("div")[0].innerHTML,61);break; } } alert2("done",getText("ok")); },false); break;} } container=null;newtable=null;newtr=null;newtd=null;newinput=null;newdiv=null; }catch(err){GM_logError("buildInfoPanelImport\n"+err);} } function buildInfoPanelLevel(){ try{ var container=$("infoPanelInner"); container.innerHTML=""; // GM_log("levelLog:\n"+print_r(levelLog,"",true,"\n")); newdiv=createElement("div",{"style":"height:400px;overflow:auto;color:black;"},container); // todayStr=getDateStr(now,2,false); levelLog[levelLogId][1]=parseInt($("pkt").innerHTML.replace(/\D/g,""),10); var totalumsatz=[0,0,[0,0]]; var day,days; newtable=createElement("table",{"border":"1","style":"width:100%;"},newdiv); thead=createElement("thead",{},newtable); // sortable table newtbody=createElement("tbody",{"class":"hoverRowBgCc9"},newtable); newtfoot=createElement("tfoot",{},newtable); newtr=createElement("tr",{"class":"borderBottom2"},thead); createElement("th",{"class":"link","sortdir":"Asc","style":"border-right:2px solid black;"},newtr,getText("day")); createElement("th",{"class":"link","sortdir":"Asc"},newtr,getText("points")); createElement("th",{"class":"link","sortdir":"Asc"},newtr,"+"); createElement("th",{"class":"link","sortdir":"Asc","style":"border-right:2px solid black;"},newtr,getText("rank")); createElement("th",{"class":"link","sortdir":"Asc"},newtr,getText("market")); createElement("th",{"class":"link","sortdir":"Asc"},newtr,getText("contract")); createElement("th",{"class":"link","sortdir":"Asc"},newtr,unsafeWindow.customerarecalled.replace(/%FARMI%/,"")); new SortableTable(newtr); for(var v=levelLog.length-1;v>=0;v--){ if(levelLog[v][0].match(/^\d+-\d+$/)){ day=/^(\d+)-(\d+)$/.exec(levelLog[v][0]); day.swap(2,3); day[0]=1; day[1]=parseInt(day[1],10); day[2]=parseInt(day[2],10); days=(new Date(day[2],day[1],0)).getDate(); }else{ day=levelLog[v][0].split(/\./); day[0]=parseInt(day[0],10); day[1]=parseInt(day[1],10); day[2]=parseInt(day[2],10); days=1; // doubling with month-entry day[3]=day[2]+(day[1]<10?"0":"")+day[1]; for(var w=levelLog.length-1;w>=0;w--){ if(levelLog[w][0]==day[3]){ days=0;break; } } } day=(new Date(day[2],day[1]-1,day[0])); newtr=createElement("tr",{"align":"right"},newtbody); // Sundays if (day.getDay()==0){ newtr.setAttribute("class","borderBottom2"); } createElement("td",{"value":day.getTime(),"style":"text-align:right;border-right:2px solid black;"},newtr,levelLog[v][0]==todayServerStr?getText("day0"):levelLog[v][0]); createElement("td",{"value":levelLog[v][1]},newtr,numberFormat(levelLog[v][1])); if(v==0){ createElement("td",{"value":0},newtr); }else{ createElement("td",{"value":(levelLog[v][1]-levelLog[v-1][1])},newtr,numberFormat(levelLog[v][1]-levelLog[v-1][1])); } createElement("td",{"value":levelLog[v][2],"style":"border-right:2px solid black;"},newtr,levelLog[v][2]?numberFormat(levelLog[v][2]):""); for(var w=0;w<=1;w++){ createElement("td",{"value":levelLog[v][w+3]},newtr,numberFormat(levelLog[v][w+3])); totalumsatz[w] += levelLog[v][w+3]; } if(levelLog[v][5]>0){ createElement("td",{"value":levelLog[v][5]},newtr,numberFormat(levelLog[v][5])); totalumsatz[2][0] += days; totalumsatz[2][1] += levelLog[v][5]; }else{ createElement("td",{"value":0},newtr,"-"); } } newtbody.scrollTop=newtbody.scrollHeight; //if (newdiv.scrollTop ==0) newdiv.scrollTop=(newdiv.scrollHeight < newdiv.clientHeight)?0:newdiv.scrollHeight - newdiv.clientHeight; newtr=createElement("tr",{"class":"borderTop2","align":"right"},newtfoot); createElement("td",{"style":"border-right:2px solid black;"},newtr,sign_average); createElement("td",{},newtr); if(v>1){ var daycount=1+Math.round((now-getTime(levelLog[1][0]))/86400); createElement("td",{},newtr,numberFormat((levelLog[v-1][1]-levelLog[0][1])/daycount)); }else{ createElement("td",{},newtr); } createElement("td",{"style":"border-right:2px solid black;"},newtr); var daycount=1+Math.round((now-getTime(levelLog[0][0]))/86400); for(var w=0;w<2;w++){ createElement("td",{},newtr,numberFormat(totalumsatz[w]/daycount)); } createElement("td",{},newtr,numberFormat(totalumsatz[2][1]/totalumsatz[2][0])); newdiv=createElement("div",{"style":"height:106px;margin-top:10px;overflow:auto;color:black;"},container); for(var w=0;w<prodNameSort[0].length;w++){ var v=prodNameSort[0][w]; if((!prodBlock[0][v].match(/t/))&&(buyNotePadShowBlocked||((!prodBlock[0][v].match(/l/))&&(!prodBlock[0][v].match(/q/))))){ if(0<prodMinRack[0][v]){ if (prodStock[0][v]==0){ newdiv1=createElement("div",{"class":"link hoverBgCc9","prod":v,"style":"line-height:16px;"},newdiv); newdiv1.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.getAttribute("prod")); },false); newdiv1.addEventListener("click",function(){ showMarket(this.getAttribute("prod")); },false); produktPic(0,v,newdiv1); createElement("span",{"style":"font-weight:bold;"},newdiv1,getText("stockXmissing").replace(/%1%/,prodName[0][v])); }else if(prodStock[0][v]<prodMinRack[0][v]){ newdiv1=createElement("div",{"class":"link hoverBgCc9","prod":v,"style":"line-height:16px;"},newdiv); newdiv1.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.getAttribute("prod")); },false); newdiv1.addEventListener("click",function(){ showMarket(this.getAttribute("prod")); },false); produktPic(0,v,newdiv1); createElement("span",{"style":"font-weight:bold;"},newdiv1,getText("stockXlow").replace(/%1%/,prodName[0][v])+" ("+numberFormat(prodStock[0][v])+")"); } } } } }catch(err){GM_logError("buildInfoPanelLevel\n"+err);} } function buildInfoPanelMessages(mode){ try{ var modeDefault={"type":1,"filterProduct":-1,"filterPlayer":""}; var modeOld=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeInfoPanelMessages"),"buildInfoPanelMessages/modeOld"); if(typeof modeOld!="object"){ modeOld=modeDefault; } if(typeof mode!="object"){ mode=modeOld; } for(var v in modeDefault){ if(!modeDefault.hasOwnProperty(v)){ continue; } if(mode[v]==undefined){ mode[v]=(modeOld[v]==undefined?modeDefault[v]:modeOld[v]); } } GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeInfoPanelMessages",implode(mode,"buildInfoPanelMessages/mode")); if(!logSales){ logSales=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_logSales","[]"),"buildInfoPanelMessages/logSales",[]); logSales.sort(sortObjFunctions["int"],true); logSalesId=new Object(); for(var v=logSales.length-1;v>=0;v--){ logSalesId[logSales[v][0]]=v; } } var plotLogSales=new Array(); var soldProducts=new Array(); var sumTurnover=0,sumProfit=0,help,help1; if(mode["filterPlayer"]){ var regFilterPlayer=new RegExp("^"+mode["filterPlayer"].replace(/\./g,"\\.").replace(/\*/g,".*")+"$","i"); }else{ var regFilterPlayer=/./; } var container,newtable,newtr,newtd,cell,div; container=$("infoPanelInner"); container.innerHTML=""; // head div=createElement("div",{"class":"borderBottom1Black","style":"height:45px;"},container); newtable=createElement("table",{"style":"width:100%;"},div); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"class":"tnormal","style":"font-weight:bold;text-align:center;"},newtr,getText("salesLog")); newtd=createElement("td",{},newtr); div=createElement("div",{"class":"link naviItem"+(mode["type"]==1?"Active":"")},newtd,getText("detail")); div.addEventListener("click",function(){ buildInfoPanelMessages({"type":1}); },false); div=createElement("div",{"class":"link naviItem"+(mode["type"]==2?"Active":"")},newtd,getText("goods")); div.addEventListener("click",function(){ buildInfoPanelMessages({"type":2}); },false); div=createElement("div",{"class":"link naviItem"+(mode["type"]==3?"Active":"")},newtd,getText("buyers")); div.addEventListener("click",function(){ buildInfoPanelMessages({"type":3}); },false); // content div=createElement("div",{"class":"borderBottom1Black","style":"overflow-y:scroll;overflow-x:hidden;height:425px;"},container); newtable=createElement("table",{"style":"width:100%;","cellspacing":0},div); newtr=createElement("tr",{},newtable); switch(mode["type"]){ case 1:{ for(var v=logSales.length-1;v>-1;v--){ if(logSales[v][2].match(regFilterPlayer)){ help=false; if(typeof logSales[v][3][0]!="object"){ soldProducts[logSales[v][3][0]]=true; if((mode["filterProduct"]==-1)||(mode["filterProduct"]==logSales[v][3][0])){ sumTurnover+=logSales[v][4]; sumProfit+=0.9*logSales[v][4]; plotLogSales.push([v,Math.round(100*logSales[v][4]/logSales[v][3][1])/100]); } }else if(logSales[v][3].length==1){ soldProducts[logSales[v][3][0][0]]=true; if((mode["filterProduct"]==-1)||(mode["filterProduct"]==logSales[v][3][0][0])){ sumTurnover+=logSales[v][4]; sumProfit+=logSales[v][4]; plotLogSales.push([v,[Math.round(100*logSales[v][4]/logSales[v][3][0][1])/100]]); } }else{ help=false;help1=0; for(var i=logSales[v][3].length-1;i>-1;i--){ soldProducts[logSales[v][3][i][0]]=true; help1+=logSales[v][3][i][1]*gut[logSales[v][3][i][0]]; if((mode["filterProduct"]==-1)||(mode["filterProduct"]==logSales[v][3][i][0])){ help=true; } } if(help){ help=[v,[]]; for(var i=logSales[v][3].length-1;i>-1;i--){ help[1][i]=Math.round(100*logSales[v][4]*gut[logSales[v][3][i][0]]/help1)/100; if((mode["filterProduct"]==-1)||(mode["filterProduct"]==logSales[v][3][i][0])){ sumTurnover+=logSales[v][3][i][1]*help[1][i]; sumProfit+=logSales[v][3][i][1]*help[1][i]; } } plotLogSales.push(help); } } } } createElement("th",{},newtr,getText("buyers")); createElement("th",{},newtr,getText("products")); createElement("th",{},newtr,getText("price")); createElement("th",{},newtr,getText("turnover")); createElement("th",{},newtr,getText("profit")); eventListenerScroll=function(){ if((parseInt(this.scrollTop,10)+parseInt(this.style.height,10))>0.95*parseInt(this.scrollHeight,10)){ plot(); } } div.addEventListener("scroll",eventListenerScroll,false); function plot(){ try{ var newtable=$("infoPanelInner").getElementsByTagName("table")[1]; var start=newtable.childElementCount-1; var end=start+100; if(plotLogSales.length<=end){ end=plotLogSales.length; newtable.parentNode.removeEventListener("scroll",eventListenerScroll,false); } var newtr,newtd,newtd1,newtd2,newtd3,newdiv; var help; for(var w=start;w<end;w++){ var v=plotLogSales[w][0]; newtr=createElement("tr",{"class":"hoverBgCc9","v":v},newtable); if(typeof logSales[v][3][0]=="object"){ newtr.style.fontStyle="italic"; } newtr.addEventListener("mouseover",function(event){ toolTip.show(event,toolTipSales(this.getAttribute("v"))); },false); newtd=createElement("td",{"class":"link"},newtr,logSales[v][2]); newtd.addEventListener("click",function(){ buildInfoPanelMessages({"filterPlayer":logSales[this.parentNode.getAttribute("v")][2]}); },false); newtd=createElement("td",{"style":"height:16px"},newtr); newtd1=createElement("td",{"style":"height:16px;padding-left:20px;"},newtr); newtd2=createElement("td",{"style":"height:16px;padding-left:20px;"},newtr); newtd3=createElement("td",{"style":"height:16px;padding-left:20px;"},newtr); if(typeof logSales[v][3][0]!="object"){ newdiv=createElement("div",{"class":"link","prod":logSales[v][3][0]},newtd); newdiv.addEventListener("click",function(){ buildInfoPanelMessages({"filterProduct":this.getAttribute("prod")}); },false); produktPic(0,logSales[v][3][0],newdiv); createElement("span",{},newdiv,numberFormat(logSales[v][3][1])+" "+prodName[0][logSales[v][3][0]]); createElement("div",{"style":"text-align:right;"},newtd1,moneyFormat(plotLogSales[w][1])); createElement("div",{"style":"text-align:right;"},newtd2,moneyFormat(logSales[v][4])); createElement("div",{"style":"text-align:right;"},newtd3,moneyFormat(0.9*logSales[v][4])); }else if(logSales[v][3].length==1){ newdiv=createElement("div",{"class":"link","prod":logSales[v][3][0][0]},newtd); newdiv.addEventListener("click",function(){ buildInfoPanelMessages({"filterProduct":this.getAttribute("prod")}); },false); produktPic(0,logSales[v][3][0][0],newdiv); createElement("span",{},newdiv,numberFormat(logSales[v][3][0][1])+" "+prodName[0][logSales[v][3][0][0]]); createElement("div",{"style":"text-align:right;"},newtd1,moneyFormat(plotLogSales[w][1][0])); createElement("div",{"style":"text-align:right;"},newtd2,moneyFormat(logSales[v][4])); createElement("div",{"style":"text-align:right;"},newtd3,moneyFormat(logSales[v][4])); }else{ help=[0,0]; for(var i=logSales[v][3].length-1;i>-1;i--){ if((mode["filterProduct"]==-1)||(mode["filterProduct"]==logSales[v][3][i][0])){ newdiv=createElement("div",{"class":"link","prod":logSales[v][3][i][0]},newtd); newdiv.addEventListener("click",function(){ buildInfoPanelMessages({"filterProduct":this.getAttribute("prod")}); },false); produktPic(0,logSales[v][3][i][0],newdiv); createElement("span",{},newdiv,numberFormat(logSales[v][3][i][1])+" "+prodName[0][logSales[v][3][i][0]]); createElement("div",{"style":"text-align:right;"},newtd1,"* "+moneyFormat(plotLogSales[w][1][i])); createElement("div",{"style":"text-align:right;"},newtd2,"* "+moneyFormat(plotLogSales[w][1][i]*logSales[v][3][i][1])); createElement("div",{"style":"text-align:right;"},newtd3,"* "+moneyFormat(plotLogSales[w][1][i]*logSales[v][3][i][1])); help[0]++; help[1]+=plotLogSales[w][1][i]*logSales[v][3][i][1]; } } if(help[0]>1){ createElement("div",{},newtd," "); createElement("div",{},newtd1," "); createElement("div",{"style":"text-align:right;border-top:1px solid black;"},newtd2,moneyFormat(help[1])); createElement("div",{"style":"text-align:right;border-top:1px solid black;"},newtd3,moneyFormat(help[1])); } } } $("kaufDataCount").innerHTML=numberFormat(end)+"/"+numberFormat(plotLogSales.length); newtable=null;newtr=null;newtd=null;newdiv=null; }catch(err){GM_logError("buildInfoPanelMessages plot\n"+err);} } break;} case 2:{ for(var v=logSales.length-1;v>-1;v--){ if(logSales[v][2].match(regFilterPlayer)){ if(typeof logSales[v][3][0]!="object"){ if(!plotLogSales[logSales[v][3][0]]){ plotLogSales[logSales[v][3][0]]=[logSales[v][3][0],0,0,0]; } plotLogSales[logSales[v][3][0]][1]+=logSales[v][3][1]; plotLogSales[logSales[v][3][0]][2]+=logSales[v][4]; plotLogSales[logSales[v][3][0]][3]+=0.9*logSales[v][4]; }else if(logSales[v][3].length==1){ if(!plotLogSales[logSales[v][3][0][0]]){ plotLogSales[logSales[v][3][0][0]]=[logSales[v][3][0][0],0,0,0]; } plotLogSales[logSales[v][3][0][0]][1]+=logSales[v][3][0][1]; plotLogSales[logSales[v][3][0][0]][2]+=logSales[v][4]; plotLogSales[logSales[v][3][0][0]][3]+=logSales[v][4]; }else{ help1=0; for(var i=logSales[v][3].length-1;i>-1;i--){ help1+=logSales[v][3][i][1]*gut[logSales[v][3][i][0]]; } for(var i=logSales[v][3].length-1;i>-1;i--){ help=Math.round(100*logSales[v][3][i][1]*logSales[v][4]*gut[logSales[v][3][i][0]]/help1)/100; if(!plotLogSales[logSales[v][3][i][0]]){ plotLogSales[logSales[v][3][i][0]]=[logSales[v][3][i][0],0,0,0]; } plotLogSales[logSales[v][3][i][0]][1]+=logSales[v][3][i][1]; plotLogSales[logSales[v][3][i][0]][2]+=help; plotLogSales[logSales[v][3][i][0]][3]+=help; } } } } plotLogSales.sort(function(a,b){return a[3]-b[3];}); createElement("th",{},newtr,getText("product")); createElement("th",{},newtr,getText("quantity")); createElement("th",{},newtr,getText("turnover")); createElement("th",{},newtr,sign_average); createElement("th",{},newtr,getText("profit")); createElement("th",{},newtr,sign_average); for(var v=plotLogSales.length-1;v>-1;v--){ if(!plotLogSales[v]){ continue; } sumTurnover+=plotLogSales[v][2]; sumProfit+=plotLogSales[v][3]; newtr=createElement("tr",{"class":"hoverBgCc9 link","prod":plotLogSales[v][0]},newtable); newtr.addEventListener("click",function(){ buildInfoPanelMessages({"type":1,"filterProduct":this.getAttribute("prod")}); },false); newtd=createElement("td",{},newtr); produktPic(0,plotLogSales[v][0],newtd); createElement("span",{},newtd,prodName[0][plotLogSales[v][0]]); createElement("td",{"align":"right","style":"padding-right:3px;border-right:1px solid black"},newtr,numberFormat(plotLogSales[v][1],0)); createElement("td",{"align":"right"},newtr,moneyFormat(plotLogSales[v][2])); createElement("td",{"align":"right","style":"padding-right:3px;border-right:1px solid black"},newtr,moneyFormat(plotLogSales[v][2]/plotLogSales[v][1],2)); createElement("td",{"align":"right"},newtr,moneyFormat(plotLogSales[v][3])); createElement("td",{"align":"right","style":"padding-right:20px;"},newtr,moneyFormat(plotLogSales[v][3]/plotLogSales[v][1],2)); } break;} case 3:{ plotLogSales=new Object(); for(var v=logSales.length-1;v>-1;v--){ if(typeof logSales[v][3][0]!="object"){ soldProducts[logSales[v][3][0]]=true; if((mode["filterProduct"]==-1)||(mode["filterProduct"]==logSales[v][3][0])){ if(!plotLogSales[logSales[v][2]]){ plotLogSales[logSales[v][2]]=[logSales[v][2],{},0,0]; } if(!plotLogSales[logSales[v][2]][1][logSales[v][3][0]]){ plotLogSales[logSales[v][2]][1][logSales[v][3][0]]=0; } plotLogSales[logSales[v][2]][1][logSales[v][3][0]]+=logSales[v][3][1]; plotLogSales[logSales[v][2]][2]+=logSales[v][4]; plotLogSales[logSales[v][2]][3]+=0.9*logSales[v][4]; } }else if(logSales[v][3].length==1){ soldProducts[logSales[v][3][0][0]]=true; if((mode["filterProduct"]==-1)||(mode["filterProduct"]==logSales[v][3][0][0])){ if(!plotLogSales[logSales[v][2]]){ plotLogSales[logSales[v][2]]=[logSales[v][2],{},0,0]; } if(!plotLogSales[logSales[v][2]][1][logSales[v][3][0][0]]){ plotLogSales[logSales[v][2]][1][logSales[v][3][0][0]]=0; } plotLogSales[logSales[v][2]][1][logSales[v][3][0][0]]+=logSales[v][3][0][1]; plotLogSales[logSales[v][2]][2]+=logSales[v][4]; plotLogSales[logSales[v][2]][3]+=logSales[v][4]; } }else{ help1=0; for(var i=logSales[v][3].length-1;i>-1;i--){ help1+=logSales[v][3][i][1]*gut[logSales[v][3][i][0]]; } for(var i=logSales[v][3].length-1;i>-1;i--){ soldProducts[logSales[v][3][i][0]]=true; if((mode["filterProduct"]==-1)||(mode["filterProduct"]==logSales[v][3][i][0])){ help=Math.round(100*logSales[v][3][i][1]*logSales[v][4]*gut[logSales[v][3][i][0]]/help1)/100; if(!plotLogSales[logSales[v][2]]){ plotLogSales[logSales[v][2]]=[logSales[v][2],{},0,0]; } if(!plotLogSales[logSales[v][2]][1][logSales[v][3][i][0]]){ plotLogSales[logSales[v][2]][1][logSales[v][3][i][0]]=0; } plotLogSales[logSales[v][2]][1][logSales[v][3][i][0]]+=logSales[v][3][i][1]; plotLogSales[logSales[v][2]][2]+=help; plotLogSales[logSales[v][2]][3]+=help; } } } } help=[]; for(var i in plotLogSales){ if(!plotLogSales.hasOwnProperty(i)){ continue; } help.push(plotLogSales[i]); } plotLogSales=help.clone(); plotLogSales.sort(function(a,b){return a[3]-b[3];}); createElement("th",{},newtr,getText("buyers")); createElement("th",{},newtr,getText("products")); createElement("th",{},newtr,getText("turnover")); createElement("th",{},newtr,getText("profit")); for(var v=plotLogSales.length-1;v>-1;v--){ if(!plotLogSales[v]){ continue; } sumTurnover+=plotLogSales[v][2]; sumProfit+=plotLogSales[v][3]; newtr=createElement("tr",{"class":"hoverBgCc9 link","player":plotLogSales[v][0]},newtable); newtr.addEventListener("click",function(){ buildInfoPanelMessages({"type":1,"filterPlayer":this.getAttribute("player")}); },false); createElement("td",{},newtr,plotLogSales[v][0]); newtd=createElement("td",{},newtr); for(var i in plotLogSales[v][1]){ if(!plotLogSales[v][1].hasOwnProperty(i)){ continue; } div=createElement("div",{},newtd); produktPic(0,i,div); createElement("span",{},div,numberFormat(plotLogSales[v][1][i])+" "+prodName[0][i]); } createElement("td",{"align":"right"},newtr,moneyFormat(plotLogSales[v][2])); createElement("td",{"align":"right"},newtr,moneyFormat(plotLogSales[v][3])); } break;} } // foot div=createElement("div",{"style":"height:45px;"},container); newtable=createElement("table",{"style":"width:100%;"},div); newtr=createElement("tr",{},newtable); createElement("td",{"id":"kaufDataCount"},newtr); newtd=createElement("td",{},newtr); if((mode["type"]==1)||(mode["type"]==3)){ createElement("span",{"style":"padding-left:10px;"},newtd,getText("goods")+":"); cell=createElement("div",{"class":"clearFilter link","style":"display:inline-block;"},newtd); cell.addEventListener("mouseover",function(event){ toolTip.show(event,getText("clearFilter")); },false); cell.addEventListener("click",function(){ buildInfoPanelMessages({"filterProduct":-1}); },false); cell=createElement("select",{"class":"link"},newtd); createElement("option",{"value":-1},cell,"---"); for(var v=0;v<prodNameSort[0].length;v++){ if(soldProducts[prodNameSort[0][v]]){ createElement("option",{"value":prodNameSort[0][v]},cell,prodName[0][prodNameSort[0][v]]); } } cell.value=mode["filterProduct"]; cell.addEventListener("change",function(){ buildInfoPanelMessages({"filterProduct":this.value}); },false); } createElement("td",{},newtr,getText("turnover")+": "); createElement("td",{"align":"right"},newtr,moneyFormat(sumTurnover)); newtr=createElement("tr",{},newtable); newtd=createElement("td",{},newtr); newtd=createElement("td",{},newtr); if((mode["type"]==1)||(mode["type"]==2)){ createElement("span",{"style":"padding-left:10px;"},newtd,getText("buyers")+":"); cell=createElement("div",{"class":"clearFilter link","style":"display:inline-block;"},newtd); cell.addEventListener("mouseover",function(event){ toolTip.show(event,getText("clearFilter")); },false); cell.addEventListener("click",function(){ buildInfoPanelMessages({"filterPlayer":""}); },false); cell=createElement("input",{"value":mode["filterPlayer"],"class":"link","style":"width:100px;","maxlength":"20"},newtd); cell.addEventListener("mouseover",function(event){ toolTip.show(event,getText("useWildcard")); },false); cell.addEventListener("change",function(){ buildInfoPanelMessages({"filterPlayer":this.value}); },false); } createElement("td",{},newtr,getText("profit")+": "); createElement("td",{"align":"right"},newtr,moneyFormat(sumProfit)); if(mode["type"]==1){ plot(); } container=null;newtable=null;newtr=null;newtd=null;cell=null;div=null; }catch(err){GM_logError("buildInfoPanelMessages\n"+err);} } function goToZone(zoneNrF){ try{ var currLocation=zones.getLocation(zoneNrF); var div; switch(currLocation.location){ case "farm":{ if((gameLocation[0]==currLocation.location)&&(gameLocation[1]==currLocation.farmNr)){ if(div=$("farm"+(1+currLocation.farmNr)+"_pos"+currLocation.zoneNr+"_click")){ click(div); } }else if(div=$("speedlink_farm"+(1+currLocation.farmNr))){ document.addEventListener("gameFarmOpened",function(zoneNrF){ return function(){ document.removeEventListener("gameFarmOpened",arguments.callee,false); window.setTimeout(goToZone,100,zoneNrF); } }(zoneNrF),false); click(div); } break;} case "city":{ if((gameLocation[0]==currLocation.location)&&(gameLocation[1]==currLocation.cityNr)){ if((currLocation.zoneNr!=undefined)&&(div=$("cityzone_"+currLocation.cityNr+"_"+currLocation.zoneNr))){ click(div); } }else if(div=$("speedlink_city"+currLocation.cityNr)){ document.addEventListener("gameCity"+currLocation.cityNr,function(zoneNrF,currLocation){ return function(){ document.removeEventListener("gameCity"+currLocation.cityNr,arguments.callee,false); window.setTimeout(goToZone,100,zoneNrF); } }(zoneNrF,currLocation),false); click(div); } break;} case "forestry":{ if(gameLocation[0]==currLocation.location){ if((currLocation.zoneNr!=undefined)&&(div=$("forestry_building_click"+currLocation.zoneNr))){ click(div); } }else if(div=$("speedlink_forestry")){ document.addEventListener("gameOpenForestry",function(zoneNrF){ return function(){ document.removeEventListener("gameOpenForestry",arguments.callee,false); window.setTimeout(goToZone,100,zoneNrF); } }(zoneNrF),false); click(div); } break;} case "foodworld":{ if(gameLocation[0]==currLocation.location){ if((currLocation.zoneNr!=undefined)&&(div=$("food_pos"+currLocation.zoneNr))){ click(div); } }else if(div=$("speedlink_foodworld")){ document.addEventListener("gameFoodworldOpened",function(zoneNrF){ return function(){ document.removeEventListener("gameFoodworldOpened",arguments.callee,false); window.setTimeout(goToZone,100,zoneNrF); } }(zoneNrF),false); click(div); } break;} case "farmersmarket":{ if(gameLocation[0]==currLocation.location){ if((currLocation.zoneNr!=undefined)&&(div=$("farmersmarket_pos"+currLocation.zoneNr+"_click"))){ click(div); } }else if(div=$("speedlink_farmersmarket")){ document.addEventListener("gameFarmersmarketOpened",function(zoneNrF){ return function(){ document.removeEventListener("gameFarmersmarketOpened",arguments.callee,false); window.setTimeout(goToZone,100,zoneNrF); } }(zoneNrF),false); click(div); } break;} } div=null; }catch(err){GM_logError("goToZone zoneNrF="+zoneNrF+"\n"+err);} } function calcAllSlots(){ try{ ALL_SLOTS={}; for(var i in ALL_ZONES){ if(!ALL_ZONES.hasOwnProperty(i)){ continue; } for(var j=0;j<ALL_ZONES[i].length;j++){ if(zones.isMultiSlot(ALL_ZONES[i][j])){ for(var slot=1;slot<=3;slot++){ ALL_SLOTS[ALL_ZONES[i][j]+"."+slot]=i; } }else{ ALL_SLOTS[ALL_ZONES[i][j]]=i; } } } unsafeData.ALL_SLOTS=ALL_SLOTS.clone(); }catch(err){ GM_logError("calcAllSlots\n"+err); } } function toolTipZoneProduction(zoneNrS){ try{ var currLocation=zones.getLocation(zoneNrS); var content=createElement("div"); var time,endDay,table,tr,td; var help; table=createElement("table",{"border":"0","cellspacing":"0","cellpadding":"0"},content); // part: head tr=createElement("tr",{},table); td=createElement("th",{"class":"lightBg","colspan":2},tr); if(currLocation.location=="farm"){ td.innerHTML=getText("farm")+" "+(1+currLocation.farmNr)+"."+currLocation.zoneNr+" ("+zones.getBuildingName(zoneNrS)+")"; }else{ td.innerHTML=zones.getBuildingName(zoneNrS); } // part: time time=zones.getEndtime(zoneNrS); tr=createElement("tr",{},table); if(time==NEVER){ createElement("td",{"colspan":2},tr,getText("idle")); }else{ time+=unsafeWindow.Zeit.Verschiebung; if (time<now){ if(time+20*60*60<now){ createElement("td",{"colspan":2},tr,getText("readySinceX").replace(/%1%/,getFormattedDateStr(time))); }else{ createElement("td",{"colspan":2},tr,getText("readySinceX").replace(/%1%/,getDaytimeStr(time)+" "+getText("shortOClock"))); } } else if ((endDay=countDays(now,time))==0){ createElement("td",{"colspan":2},tr,getText("readyAtX").replace(/%1%/,getDaytimeStr(time)+" "+getText("shortOClock"))); } else if (getText("readyAtX_day"+endDay)){ createElement("td",{"colspan":2},tr,getText("readyAtX_day"+endDay).replace(/%1%/,getDaytimeStr(time)+" "+getText("shortOClock"))); } else{ createElement("td",{"colspan":2},tr,getText("readyAtX").replace(/%1%/,new Date(1000*time).toLocaleString())); } } // part: production tr=createElement("tr",{"style":"border-top:1px solid black;"},table); createElement("td",{"style":"border-top:1px solid black;","colspan":2},tr,getText("yield")+":"); if(help=zones.getCrop(zoneNrS)){ if(help.length==0){ tr=createElement("tr",{},table); td=createElement("td",{"colspan":2},tr,"---"); }else{ for(var k=0;k<help.length;k++){ tr=createElement("tr",{},table); td=createElement("td",{},tr); produktPic(help[k][0],help[k][1],td); createElement("span",{},td,numberFormat(help[k][2])+" "+prodName[help[k][0]][help[k][1]]); td=createElement("td",{"style":"padding-left:5px;"},tr); if(help[k][3]>0){ pointsFormat(help[k][3],"div",td); } } } }else{ tr=createElement("tr",{},table); td=createElement("td",{"colspan":2},tr,"???"); } table=null;tr=null;td=null;time=null;endDay=null; return content.innerHTML; }catch(err){GM_logError("toolTipZoneProduction\n"+err);} } function toolTipSales(nr){ try{ var content=createElement("div"); var table,tr,td; var time; if(logSales[nr]){ time=logSales[nr][1]-valServerTimeOffset; table=createElement("table",{"border":"0","cellspacing":"0","cellpadding":"0"},content); if(typeof logSales[nr][3][0]=="object"){ // contract tr=createElement("tr",{},table); createElement("th",{"class":"lightBg","colspan":3},tr,getText("contract")); tr=createElement("tr",{},table); createElement("td",{"colspan":3},tr,getFormattedDateStr(time,1)+", "+getDaytimeStr(time,1)+" "+getText("shortOClock")); tr=createElement("tr",{},table); createElement("td",{"colspan":3},tr,logSales[nr][2]); tr=createElement("tr",{"class":"borderBottom1Black"},table); createElement("td",{"colspan":3},tr,moneyFormat(logSales[nr][4])); for(var v=0;v<logSales[nr][3].length;v++){ tr=createElement("tr",{},table); createElement("td",{},table,numberFormat(logSales[nr][3][v][1])); createElement("td",{},table,prodName[0][logSales[nr][3][v][0]]); td=createElement("td",{},table); if(logSales[nr][3].length==1){ td.innerHTML="("+moneyFormat(logSales[nr][4]/logSales[nr][3][v][1])+")" } } }else{ // marketplace tr=createElement("tr",{},table); createElement("th",{"class":"lightBg","colspan":3},tr,getText("marketplace")); tr=createElement("tr",{},table); createElement("td",{"colspan":3},tr,getFormattedDateStr(time,1)+", "+getDaytimeStr(time,1)+" "+getText("shortOClock")); tr=createElement("tr",{},table); createElement("td",{"colspan":3},tr,logSales[nr][2]); tr=createElement("tr",{"class":"borderBottom1Black"},table); createElement("td",{"colspan":3},tr,moneyFormat(logSales[nr][4])); tr=createElement("tr",{},table); createElement("td",{},table,numberFormat(logSales[nr][3][1])); createElement("td",{},table,prodName[0][logSales[nr][3][0]]); createElement("td",{},table,"("+moneyFormat(logSales[nr][4]/logSales[nr][3][1])+")"); } } table=null;tr=null;td=null; return content.innerHTML; }catch(err){GM_logError("toolTipSales\n"+err);} } function showMarket(pid){ try{ if((gameLocation[0]!="city")||(gameLocation[1]!=1)){ document.addEventListener("gameCity1",function(pid){ return function(){ document.removeEventListener("gameCity1",arguments.callee,false); showMarket(pid); };}(pid),false); click($("speedlink_city1")); }else if($("market").style.display!="block"){ document.addEventListener("gameOpenMarket",function(pid){ return function(){ document.removeEventListener("gameOpenMarket",arguments.callee,false); showMarket(pid); };}(pid),false); unsafeWindow.close_page(); unsafeWindow.hideDiv("shop"); unsafeWindow.hideDiv("wbwcontainer"); unsafeWindow.hideDiv("adcolumn"); $("transp3").style.visibility = "visible"; unsafeWindow.showDiv("transp3"); unsafeWindow.marketAction("marketinit"); }else{ closeInfoPanel(); unsafeWindow.market_filter_name=""; unsafeWindow.market_filter_pid=parseInt(pid,10); unsafeWindow.market_filter_own=0; unsafeWindow.market_guild_filter=0; unsafeWindow.showOffers(); } }catch(err){ GM_logError("showMarket pid="+pid+"\n"+err); } } function showMarketStall(){ try{ if((gameLocation[0]!="city")||(gameLocation[1]!=1)){ document.addEventListener("gameCity1",function(){ document.removeEventListener("gameCity1",arguments.callee,false); showMarketStall(); },false); click($("speedlink_city1")); }else if($("market").style.display!="block"){ document.addEventListener("gameOpenMarket",function(){ document.removeEventListener("gameOpenMarket",arguments.callee,false); showMarketStall(); },false); unsafeWindow.close_page(); unsafeWindow.showDiv("transp3"); unsafeWindow.$("transp3").style.visibility = "visible"; unsafeWindow.marketAction("marketinit"); }else{ unsafeWindow.setMarketNavi(3); unsafeWindow.market_guild_filter = 0; unsafeWindow.market_filter_pid = -1; unsafeWindow.market_filter_own = 1; unsafeWindow.showOffers(); } }catch(err){ GM_logError("showMarketStall\n"+err); } } function quicklinks(){ try{ if (GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valQuicklinks",true)){ var newdiv=$("market_navi5"); if(newdiv){ newdiv.addEventListener("mouseover",function(event){ $("quicklinks").style.display="block"; },false); newdiv.addEventListener("mouseout",function(event){ $("quicklinks").style.display="none"; },false); var highlightProducts=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_highlightProducts","[false,{}]"),"quicklinks/highlightProducts",[false,{}]); var divquick=createElement("div",{"id":"quicklinks","style":"display:none;position:absolute;right:-75px;top:67px;width:600px;background-color:white;z-index:10;"},newdiv); // if(self!=top){ // divquick.addEventListener("mouseover",function(){this.style.left="290px";},false); // divquick.addEventListener("mouseout",function(){this.style.left="620px";},false); // } var newtable=createElement("table",{"border":"3px solid black;"},divquick); var newtr=createElement("tr",{},newtable); var newtd=createElement("td",{},newtr); // newdiv=createElement("div",{"style":"float:right;height:30px;padding:2px;margin-right:20px;"},newtd); // createElement("div",{"class":"v88"},newdiv); // var newa=createElement("a",{"class":"link2","href":"markt.php","style":"position:relative;top:-30px;"},newdiv); // newdiv=createElement("div",{"style":"width:30px;height:30px;background-color:green;opacity:0;"},newa); // newdiv.addEventListener("mouseover",function(){this.style.opacity="0.3";$("quicklinksName").innerHTML=getText("currentOffers");},false); // newdiv.addEventListener("mouseout",function(){this.style.opacity="0";$("quicklinksName").innerHTML="";},false); createElement("div",{"id":"quicklinksName","style":"color:black;font-weight:bold;float:right;line-height:30px;padding:2px;margin-right:170px;"},newtd); var prodTypOld="c"; for(var w=0;w<prodNameSort[0].length;w++){ var v=prodNameSort[0][w]; if((!prodBlock[0][v].match(/t/))&&(!prodBlock[0][v].match(/l/))){ if (prodTypOld!=prodTyp[0][v]){ newtr=createElement("tr",{},newtable); newtd=createElement("td",{},newtr); prodTypOld=prodTyp[0][v]; } newdiv=createElement("div",{"style":"float:left;height:30px;"+(highlightProducts[1][v]?"border:2px solid blue;border-radius:10px;":"padding:2px;")},newtd); createElement("div",{"class":"v"+v},newdiv); newdiv=createElement("div",{"v":v,"style":"position:relative;top:-30px;width:30px;height:30px;background-color:blue;opacity:0;"},newdiv); newdiv.addEventListener("click",function(event){ event.stopPropagation ? event.stopPropagation() : (event.cancelBubble=true); // stop bubbling showMarket(this.getAttribute("v")); $("quicklinks").style.display="none"; },false); newdiv.addEventListener("mouseover",function(){this.style.opacity="0.3";$("quicklinksName").innerHTML=prodName[0][this.getAttribute("v")];},false); newdiv.addEventListener("mouseout",function(){this.style.opacity="0";$("quicklinksName").innerHTML="";},false); } } divquick=null;newtable=null;newtr=null;newtd=null;newa=null; } newdiv=null; } }catch(err){ GM_logError("quicklinks\n"+err); } } var timer=new function(){ var running=[]; this.add=function(name,node,endtime,callback){ try{ timer.remove(name); running.push([name,node,endtime,callback]); timer.run(name); }catch(err){GM_logError("timer.add name="+name+"\n"+err);} } this.remove=function(name){ try{ for(var i=running.length-1;i>=0;i--){ if(running[i][0]==name){ running.splice(i,1); } } }catch(err){GM_logError("timer.remove\n"+err);} } this.run=function(){ try{ for(var i=running.length-1;i>=0;i--){ if(unsafeWindow.Zeit.Server<running[i][2]){ running[i][1].innerHTML=getTimeStr(running[i][2]-unsafeWindow.Zeit.Server); }else{ running[i][3](); running.splice(i,1); } } }catch(err){GM_logError("timer.run\n"+err);} } } var clocks=new function(){ var running=[]; this.add=function(name,node,time){ try{ clocks.remove(name); running.push([name,node,time]); clocks.run(name); }catch(err){GM_logError("clocks.add name="+name+"\n"+err);} } this.remove=function(name){ try{ for(var i=running.length-1;i>=0;i--){ if(running[i][0]==name){ running.splice(i,1); } } }catch(err){GM_logError("clocks.remove\n"+err);} } this.run=function(){ try{ for(var i=running.length-1;i>=0;i--){ if(running[i][1]){ running[i][1].innerHTML=getDaytimeStr(running[i][2]+now); }else{ running.splice(i,1); } } }catch(err){GM_logError("clocks.run\n"+err);} } } function createZoneTimer(name,zoneNrS,type,style,append){ // type="zonetimer" || "zonetimerWater" try{ if(!$(name)){ var div=createElement("div",{"id":name,"zoneNrS":zoneNrS,"type":type,"style":style},append); div.addEventListener("mouseover",function(event){ try{ var zoneNrS=this.getAttribute("zoneNrS"); var type=this.getAttribute("type"); showBlase(zoneNrS); if(type=="zonetimer"){ toolTip.show(event,toolTipZoneProduction(zoneNrS)); }else{ // zonetimerWater var newDiv1=createElement("div"); var newTable=createElement("table",{"border":"0","cellspacing":"0","cellpadding":"0"},newDiv1); var newTr=createElement("tr",{},newTable); var newTd=createElement("th",{"class":"lightBg","colspan":2},newTr,zones.getBuildingName(zoneNrS)); var time = zones.getWatertime(zoneNrS); if(time!=NEVER){ time+=unsafeWindow.Zeit.Verschiebung; } var endDay=countDays(now,time); newTr=createElement("tr",{},newTable); if(time==NEVER){ createElement("td",{"colspan":2},newTr,"---"); } else if(time<now){ createElement("td",{"colspan":2},newTr,getText("waterNeeded")); } else if (endDay==0){ createElement("td",{},newTr,getText("waterNeededAtX").replace(/%1%/,getDaytimeStr(time)+" "+getText("shortOClock"))); } else if ((endDay==1)&&(getText("waterNeededAtX_day1"))){ createElement("td",{},newTr,getText("waterNeededAtX_day1").replace(/%1%/,getDaytimeStr(time)+" "+getText("shortOClock"))); } else{ createElement("td",{},newTr,getText("waterNeededAtX").replace(/%1%/,new Date(1000*time).toLocaleString())); } toolTip.show(event,newDiv1.innerHTML); newDiv1=null;newTable=null;newTr=null;newTd=null; time=null;endDay=null; } zoneNrS=null;type=null; }catch(err){GM_logError("createTimer.mouseover\n"+err);} },false); div.addEventListener("mouseout",hideBlase,false); div=null; } updateZoneTimer(name,zoneNrS,type) }catch(err){GM_logError("createZoneTimer\nname="+name+"\n"+err);} } function updateZoneTimer(name,zoneNrS,type){ try{ var div; if(div=$(name)){ if(zones.getBlock(zoneNrS)){ removeZoneTimer(name,type); }else if(type=="zonetimer"){ var time=zones.getEndtime(zoneNrS); if (time==NEVER){ // empty div.setAttribute("class","zoneTimer"); timer.remove(name); div.innerHTML="---"; }else if(time<=unsafeWindow.Zeit.Server){ // ready div.setAttribute("class","zoneTimerReady blinking"); timer.remove(name); div.innerHTML=getText("finished").toUpperCase()+"!"; }else{ // running div.setAttribute("class","zoneTimer"); timer.add(name,div,time,function(name,zoneNrS,type){ return function(){ updateZoneTimer(name,zoneNrS,type); }}(name,zoneNrS,type)); } }else{ var time=zones.getWatertime(zoneNrS); if ((time==NEVER)||(time<=unsafeWindow.Zeit.Server)){ // watering not possible or needed removeZoneTimer(name,type); }else{ // wait for watering div.setAttribute("class","zoneTimerWater"); timer.add(name,div,time,function(name,zoneNrS,type){ return function(){ updateZoneTimer(name,zoneNrS,type); }}(name,zoneNrS,type)); } } div=null; } }catch(err){GM_logError("updateZoneTimer name:"+name+" zoneNrS:"+zoneNrS+"\n"+err);} } function removeZoneTimer(name){ try{ timer.remove(name); var div; if(div=$(name)){ removeElement(div); div=null; } }catch(err){GM_logError("removeZoneTimer name:"+name+"\n"+err);} } function showBlase(zoneNrF){ try{ $("sprcontent").style.display="none"; var bubble=$("sprcontent2"); bubble.style.display=""; bubble.innerHTML=""; if (zones.getBlock(zoneNrF).match(/p/)){ createElement("div",{"class":"tnormal"},bubble,unsafeWindow.inforequirepremium); }else if (zones.getBlock(zoneNrF).match(/q/)){ createElement("div",{"class":"tnormal"},bubble,unsafeWindow.questblock); }else if(!zones.getBuilding(zoneNrF)){ // blocked }else if(BUILDINGTYPE[zones.getBuilding(zoneNrF)]==0){ createElement("div",{"class":"tnormal","style":"font-weight:bold;"},bubble,unsafeWindow.buildinginfos[0][zones.getBuilding(zoneNrF)][10]); }else{ var time=zones.getEndtime(zoneNrF); if(time==NEVER){ createElement("font",{"class":"tmenu","style":"font-weight:bold;"},bubble,zones.getBuildingName(zoneNrF)+" "+getText("idle")); // createElement("font",{"class":"tnormal","style":"font-weight:bold;"},bubble,getText("emptyField")); }else{ time+=unsafeWindow.Zeit.Verschiebung; var prod = zones.getEndproduct(zoneNrF); if(prod!=null){ switch(zones.getLocation(zoneNrF).location){ case "windmill": createElement("div",{"class":"fm"+prod,"style":"position:absolute;top:5px;left:0;"},bubble); newdiv=createElement("div",{"style":"position:absolute;top:5px;left:55px;"},bubble); createElement("font",{"class":"tmenu","style":"font-weight:bold;"},createElement("div",{},newdiv),prodName[3][prod]); // unsafeWindow.formulas[0][prod][2] break; case "forestry": createElement("div",{"class":"f_symbol"+prod,"style":"position:absolute;top:5px;left:0;"},bubble); newdiv=createElement("div",{"style":"position:absolute;top:5px;left:55px;"},bubble); createElement("font",{"class":"tmenu","style":"font-weight:bold;"},createElement("div",{},newdiv),prodName[1][prod]); break; default: createElement("div",{"class":"tt"+prod,"style":"position:absolute;top:5px;left:0;"},bubble); newdiv=createElement("div",{"style":"position:absolute;top:5px;left:55px;"},bubble); createElement("font",{"class":"tmenu","style":"font-weight:bold;"},createElement("div",{},newdiv),prodName[0][prod]); } } var newfont=createElement("font",{"class":"tmenu"},createElement("div",{},newdiv)); if (time<now){ if(time+20*60*60<now){ newfont.innerHTML=getText("readySinceX").replace(/%1%/,getFormattedDateStr(time)); }else{ newfont.innerHTML=getText("readySinceX").replace(/%1%/,getDaytimeStr(time)+" "+getText("shortOClock")); } }else if (time<NEVER){ var endDay=countDays(now,time); if (endDay==0){ newfont.innerHTML=getText("readyAtX").replace(/%1%/,getDaytimeStr(time)+" "+getText("shortOClock")); }else if ((endDay==1)&&(getText("readyAtX_day1"))){ newfont.innerHTML=getText("readyAtX_day1").replace(/%1%/,getDaytimeStr(time)+" "+getText("shortOClock")); }else if ((endDay==2)&&(getText("readyAtX_day2"))){ newfont.innerHTML=getText("readyAtX_day2").replace(/%1%/,getDaytimeStr(time)+" "+getText("shortOClock")); }else{ newfont.innerHTML=new Date(1000*time).toLocaleString(); } } newfont=null; } } bubble=null;newdiv=null; }catch(err){ GM_logError("showBlase zoneNrF="+zoneNrF+"\n"+err); } } function hideBlase(){ try{ $("sprcontent").style.display=""; $("sprcontent2").style.display="none"; }catch(err){ GM_logError("hideBlase\n"+err); } } var modeBuyNotepad=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeBuyNotepad",0); function doBuyNotepad(){ try{ var err_trace="init"; if(!show["buyNotepad"]){ return false; } // no calculation if table is hidden var newdiv=$("buyNotepad"); if(newdiv){ /* rack type 0 (farm) */ err_trace="type 0"; var prodMissing=new Array(); var drawProductLines=false; // calculate missing products err_trace="type 0, missing products"; for(var v=0;v<prodNameSort[0].length;v++){ var prod=prodNameSort[0][v]; if((!prodBlock[0][prod].match(/t/))&&(!prodBlock[0][prod].match(/l/))){ var amount=prodMinRack[0][prod]-prodStock[0][prod]; if (amount>0){ prodMissing.push([prod,amount,amount*(gut[prod]?gut[prod]:0)]); } } } // sorting err_trace="type 0, sorting"; switch(modeBuyNotepad){ case 0: drawProductLines=true; prodMissing.sort(sortObjFunctions["productId"]); break; case 1: drawProductLines=true; prodMissing.sort(function(a,b){ if(prodTyp[0][a[0]]==prodTyp[0][b[0]]){ return(b[1][0]-a[1][0]); }else{ return({"c":0,"v":1,"e":2,"o":3,"fw1":4,"fw2":5,"fw3":6,"fw4":7,"z":8}[prodTyp[0][a[0]]]-{"c":0,"v":1,"e":2,"o":3,"fw1":4,"fw2":5,"fw3":6,"fw4":7,"z":8}[prodTyp[0][b[0]]]); } }); break; case 2: drawProductLines=true; prodMissing.sort(function(a,b){ if(prodTyp[0][a[0]]==prodTyp[0][b[0]]){ return(a[1][0]-b[1][0]); }else{ return({"c":0,"v":1,"e":2,"o":3,"fw1":4,"fw2":5,"fw3":6,"fw4":7,"z":8}[prodTyp[0][a[0]]]-{"c":0,"v":1,"e":2,"o":3,"fw1":4,"fw2":5,"fw3":6,"fw4":7,"z":8}[prodTyp[0][b[0]]]); } }); break; case 3: prodMissing.sort(function(a,b){return (a[1][0]-b[1][0]);}); break; case 4: prodMissing.sort(function(a,b){return (a[1][0]-b[1][0]);},true); break; case 5: prodMissing.sort(function(a,b){return (a[1][1]-b[1][1]);}); break; case 6: prodMissing.sort(function(a,b){return (a[1][1]-b[1][1]);},true); break; case 7: prodMissing.sort(function(a,b){return (a[0]-b[0]);},true); break; } // creating table err_trace="type 0, table"; newdiv.innerHTML=""; var newtable=createElement("table",{"border":"0","cellspacing":"0","cellpadding":"0"},newdiv); var newtr=createElement("tr",{"class":"link"},newtable); newtr.addEventListener("click",function(){ modeBuyNotepad=(modeBuyNotepad+1)%7; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeBuyNotepad",modeBuyNotepad); doBuyNotepad(); },false); newtr.addEventListener("mouseover",function(event){toolTip.show(event,"Sortingmode: "+["Producttype, id","Producttype, amount","Producttype, amount descending","amount","amount descending","value","value descending","id"][modeBuyNotepad]+"<br>Click to change");},false); var newtd=createElement("td",{"colspan":"4","style":"border-bottom:1px solid black;text-align:center;"},newtr,getText("missing")); var oldType=null; var newType=null; var help=0; //TODO review for(var i=0;i<prodMissing.length;i++){ var prod=prodMissing[i][0]; var amountForFarmis=valMinRackFarmis?((totalFarmis[0]&&totalFarmis[0][prod]?totalFarmis[0][prod]:0)-(prodStock[0]&&prodStock[0][prod]?prodStock[0][prod]:0)):0; var str='<table>'; str += '<tr><th colspan="3" class="lightBg">'+getText("goToMarketOfX").replace(/%1%/,prodName[0][prod])+'</th></tr>'; str += '<tr><td>'+getText("minRack")+'</td><td></td><td style="text-align:right;">'+numberFormat(prodMinRackInit[0][prod])+'</td></tr>'; for(var k in totalQuest){ if(!totalQuest.hasOwnProperty(k)){ continue; } if(totalQuest[k][0][prod]){ str += '<tr><td>'+getText("quest_"+k)+'</td><td>+</td><td style="text-align:right;">'+numberFormat(totalQuest[k][0][prod])+'</td></tr>'; } } if(valMinRackRecursive&&totalRecursive[0]&&totalRecursive[0][prod]){ str += '<tr><td>'+getText("recursive")+'</td><td>+</td><td style="text-align:right;">'+numberFormat(totalRecursive[0][prod])+'</td></tr>'; } if(valMinRackFarmis&&totalFarmis[0]&&totalFarmis[0][prod]){ str += '<tr><td>'+unsafeWindow.customerarecalled.replace(/%FARMI%/,"")+'</td><td>+</td><td style="text-align:right;">'+numberFormat(totalFarmis[0][prod])+'</td></tr>'; } str += '<tr><td>'+getText("inventory")+'</td><td>-</td><td style="text-align:right;">'+numberFormat(prodStock[0][prod])+'</td></tr>'; if(valMinRackGrowing){ if(totalErnte[0][prod]){ amountForFarmis -= totalErnte[0][prod]; str += '<tr><td>'+getText("production")+'</td><td>-</td><td style="text-align:right;">'+numberFormat(totalErnte[0][prod])+'</td></tr>'; } if(totalPowerups[prod]){ amountForFarmis -= totalPowerups[prod]; str += '<tr><td>'+getText("powerups")+'</td><td>-</td><td style="text-align:right;">'+numberFormat(totalPowerups[prod])+'</td></tr>'; } } if(prodMinRackAddon[0][prod]){ for(var k in prodMinRackAddon[0][prod]){ if(!prodMinRackAddon[0][prod].hasOwnProperty(k)){ continue; } str += '<tr><td>'+k+'</td><td>'+(prodMinRackAddon[0][prod][k]>0?'+':'-')+'</td><td style="text-align:right;">'+numberFormat(prodMinRackAddon[0][prod][k])+'</td></tr>'; } } str += '<tr><td colspan="3" style="border-bottom:1px solid black;"></td></tr>'; str += '<tr><td>'+getText("marketPrice")+'</td><td></td><td style="text-align:right;">'+moneyFormat(gut[prod])+'</td></tr>'; str += '<tr><td>'+getText("value")+'</td><td></td><td style="text-align:right;">'+moneyFormatInt(prodMissing[i][2])+'</td></tr>'; if(prodRequire[0][prod]){ str += '<tr><th colspan="3" class="lightBg">'+getText("requirementPerProduction")+'</th></tr>'; for(j in prodRequire[0][prod]){ if(!prodRequire[0][prod].hasOwnProperty(j)){continue;} if(prodRequire[0][prod][j][0]>-1){ str += '<tr><td>'; str += prodName[prodRequire[0][prod][j][0]][prodRequire[0][prod][j][1]]; str += '</td><td></td><td style="text-align:right;">'+numberFormat(prodRequire[0][prod][j][2])+'</td></tr>'; } } if(prodYield[0][prod]){ str += '<tr><th colspan="3" class="lightBg">'+getText("yieldPerProduction")+'</th></tr>'; str += '<tr><td>'+prodName[0][prod]+'</td><td></td><td style="text-align:right;">'+numberFormat(prodYield[0][prod])+'</td></tr>'; } } str += '</table>'; newType=prodTyp[0][prod]; newtr=createElement("tr",{"class":"link hoverBgCc9"+((drawProductLines&&(oldType!=null)&&(oldType!=newType))?" borderTop1dashedBlack":""),"prod":prod,"mouseOverText":str},newtable); oldType=newType; newtr.addEventListener("click",function(){showMarket(this.getAttribute("prod"));},false); newtr.addEventListener("mouseover",function(event){toolTip.show(event,this.getAttribute("mouseOverText"));},false); newtd=createElement("td",{},newtr); produktPic(0,prod,newtd); createElement("td",{"style":"text-align:right;"},newtr,numberFormat(prodMissing[i][1])); if(amountForFarmis>0){ createElement("td",{"style":"padding-left:3px;text-align:right;"},newtr,"("+numberFormat(amountForFarmis)+")"); }else{ createElement("td",{},newtr); } createElement("td",{"style":"padding-left:3px;"},newtr,prodName[0][prod]); } help=null; if(newtable.childElementCount==1){ newtr=createElement("tr",{},newtable); createElement("td",{"colspan":"3","style":"text-align:center;"},newtr,"---"); } /* rack type 1 (forestry) */ err_trace="type 1"; var newtr=createElement("tr",{},newtable); var newtd=createElement("td",{"colspan":"4","style":"border-bottom:1px solid black;text-align:center;width:100%;"},newtr); drawProductLines=false; prodMissing=new Array(); // calculate missing products err_trace="type 1, missing products"; for(var prod in prodMinRack[1]){ if(!prodMinRack[1].hasOwnProperty(prod)){ continue; } var amount=prodMinRack[1][prod]-(prodStock[1][prod]?prodStock[1][prod]:0); if (amount>0){ prodMissing.push([prod,amount,0]); //'0'==price } } // sorting err_trace="type 1, sorting"; switch(modeBuyNotepad){ case 0: drawProductLines=true; prodMissing.sort(function(a,b){ if(prodTyp[1][a[0]]==prodTyp[1][b[0]]){ return(a[0]-b[0]); }else{ return({"c":0,"v":1,"e":2,"o":3,"fw1":4,"fw2":5,"fw3":6,"fw4":7,"z":8}[prodTyp[1][a[0]]]-{"c":0,"v":1,"e":2,"o":3,"fw1":4,"fw2":5,"fw3":6,"fw4":7,"z":8}[prodTyp[1][b[0]]]); } }); break; case 1: drawProductLines=true; prodMissing.sort(function(a,b){ if(prodTyp[1][a[0]]==prodTyp[1][b[0]]){ return(b[1][0]-a[1][0]); }else{ return({"f1":0,"f2":1,"f3":2,"f4":3,"f5":4}[prodTyp[1][a[0]]]-{"f1":0,"f2":1,"f3":2,"f4":3,"f5":4}[prodTyp[1][b[0]]]); } }); break; case 2: drawProductLines=true; prodMissing.sort(function(a,b){ if(prodTyp[1][a[0]]==prodTyp[1][b[0]]){ return(a[1][0]-b[1][0]); }else{ return({"f1":0,"f2":1,"f3":2,"f4":3,"f5":4}[prodTyp[1][a[0]]]-{"f1":0,"f2":1,"f3":2,"f4":3,"f5":4}[prodTyp[1][b[0]]]); } }); break; case 3: prodMissing.sort(function(a,b){return (a[1][0]-b[1][0]);}); break; case 4: prodMissing.sort(function(a,b){return (a[1][0]-b[1][0]);},true); break; case 5: prodMissing.sort(function(a,b){return (a[1][1]-b[1][1]);}); break; case 6: prodMissing.sort(function(a,b){return (a[1][1]-b[1][1]);},true); break; case 7: prodMissing.sort(function(a,b){return (a[0]-b[0]);},true); break; } //prodMissing.sortObj(); err_trace="type 1, table"; oldType=null; newType=null; for(var i=0;i<prodMissing.length;i++){ var prod=prodMissing[i][0]; var amountForForestryFarmis=valMinRackForestryFarmis?((totalFarmis[1]&&totalFarmis[1][prod]?totalFarmis[1][prod]:0)-(prodStock[1]&&prodStock[1][prod]?prodStock[1][prod]:0)):0; var str='<table>'; str += '<tr><th colspan="3" class="lightBg">'+prodName[1][prod]+'</th></tr>'; str += '<tr><td>'+getText("minRack")+'</td><td></td><td style="text-align:right;">'+numberFormat(prodMinRackInit[1][prod])+'</td></tr>'; if(totalQuest["main"]&&totalQuest["main"][1][prod]){ str += '<tr><td>'+getText("quest_farm")+'</td><td>+</td><td style="text-align:right;">'+numberFormat(totalQuest["main"][1][prod])+'</td></tr>'; } if(totalQuest["forestry"]&&totalQuest["forestry"][1][prod]){ str += '<tr><td>'+getText("quest_forestry")+'</td><td>+</td><td style="text-align:right;">'+numberFormat(totalQuest["forestry"][1][prod])+'</td></tr>'; } if(valMinRackRecursive&&totalRecursive[1]&&totalRecursive[1][prod]){ str += '<tr><td>'+getText("recursive")+'</td><td>+</td><td style="text-align:right;">'+numberFormat(totalRecursive[1][prod])+'</td></tr>'; } if(valMinRackForestryFarmis&&totalFarmis[1]&&totalFarmis[1][prod]){ str += '<tr><td>'+unsafeWindow.customerarecalled.replace(/%FARMI%/,"")+'</td><td>+</td><td style="text-align:right;">'+numberFormat(totalFarmis[1][prod])+'</td></tr>'; } str += '<tr><td>'+getText("inventory")+'</td><td>-</td><td style="text-align:right;">'+numberFormat(prodStock[1][prod])+'</td></tr>'; if(valMinRackGrowing){ if(totalErnte[1][prod]){ amountForForestryFarmis -= totalErnte[1][prod]; str += '<tr><td>'+getText("production")+'</td><td>-</td><td style="text-align:right;">'+numberFormat(totalErnte[1][prod])+'</td></tr>'; } } if(prodMinRackAddon[1][prod]){ for(var k in prodMinRackAddon[1][prod]){ if(!prodMinRackAddon[1][prod].hasOwnProperty(k)){ continue; } str += '<tr><td>'+k+'</td><td>'+(prodMinRackAddon[1][prod][k]>0?'+':'-')+'</td><td style="text-align:right;">'+numberFormat(prodMinRackAddon[1][prod][k])+'</td></tr>'; } } if(prodRequire[1][prod]){ str += '<tr><th colspan="3" class="lightBg">'+getText("requirementPerProduction")+'</th></tr>'; for(j in prodRequire[1][prod]){ if(!prodRequire[1][prod].hasOwnProperty(j)){continue;} if(prodRequire[1][prod][j][0]>-1){ str += '<tr><td>'; str += prodName[prodRequire[1][prod][j][0]][prodRequire[1][prod][j][1]]; str += '</td><td></td><td style="text-align:right;">'+numberFormat(prodRequire[1][prod][j][2])+'</td></tr>'; } } } if(prodYield[1][prod]){ str += '<tr><th colspan="3" class="lightBg">'+getText("yieldPerProduction")+'</th></tr>'; str += '<tr><td>'+prodName[1][prod]+'</td><td></td><td style="text-align:right;">'+numberFormat(prodYield[1][prod])+'</td></tr>'; } str += '</table>'; newType=prodTyp[1][prod]; newtr=createElement("tr",{"class":"hoverBgCc9"+((drawProductLines&&(oldType!=null)&&(oldType!=newType))?" borderTop1dashedBlack":""),"iProd":prod,"mouseOverText":str,"style":(prodBlock[1][prod].match(/b/)?"color:red;":"")},newtable);//TODO color oldType=newType; newtr.addEventListener("mouseover",function(event){toolTip.show(event,this.getAttribute("mouseOverText"));},false); newtd=createElement("td",{},newtr); produktPic(1,prod,newtd); createElement("td",{"style":"text-align:right;"+(prodBlock[1][prod].match(/[lq]/)&&prodBlock[1][prod].match(/t/)?"color:red;":"")},newtr,numberFormat(prodMissing[i][1])); if(amountForForestryFarmis>0){ createElement("td",{"style":"padding-left:3px;text-align:right;"+(prodBlock[1][prod].match(/[lq]/)&&prodBlock[1][prod].match(/t/)?"color:red;":"")},newtr,"("+numberFormat(amountForForestryFarmis)+")"); }else{ createElement("td",{},newtr); } createElement("td",{"style":"padding-left:3px;"+(prodBlock[1][prod].match(/[lq]/)&&prodBlock[1][prod].match(/t/)?"color:red;":"")},newtr,prodName[1][prod]); } if(newtable.childElementCount==2){ newtr=createElement("tr",{},newtable); createElement("td",{"colspan":"4","style":"text-align:center;"},newtr,"---"); } newtable=null;newtr=null;newtd=null; } newdiv=null; }catch(err){ GM_logError("doBuyNotepad ("+err_trace+")\nprod="+prod+" \n"+err); } } function doMarketoffersNotepad(){ try{ if(!show["marketoffersNotepad"]){ return false; } // no calculation if table is hidden var newdiv=$("marketoffersNotepad"); if(newdiv){ newdiv.innerHTML=""; var newtable=createElement("table",{"border":"0","cellspacing":"0","cellpadding":"0"},newdiv); var newtr=createElement("tr",{"class":"link"},newtable); var newtd=createElement("td",{"colspan":"5","style":"border-bottom:1px solid black;text-align:center;"},newtr,getText("marketstall")); newtr.addEventListener("mouseover",function(event){ var str='<table>'; str += '<tr><th colspan="2" class="lightBg">'+getText("goToMarketstall")+'</th></tr>'; str += '<tr><td>'+sign_sum+'</td><td style="text-align:right;">'+moneyFormatInt(parseInt(this.getAttribute("value"),10))+'</td></tr>'; str += '</table>'; toolTip.show(event,str); },false); newtr.addEventListener("click",function(){showMarketStall();},false); var sumTotal=0; var oldType=null; var newType=null; for(var i=0;i<ownMarketOffers.length;i++){ var prod=ownMarketOffers[i][0]; var price=ownMarketOffers[i][1]; var amount=ownMarketOffers[i][2]; newType=prodTyp[0][prod]; sumTotal += amount*price; newtr=createElement("tr",{"class":"link hoverBgCc9"+(((oldType!=null)&&(oldType!=newType))?" borderTop1dashedBlack":""),"prod":prod,"value":(amount*price)},newtable); oldType=newType; newtr.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.getAttribute("prod"),null,'<tr><td>'+sign_sum+'</td><td style="text-align:right;">'+moneyFormatInt(parseInt(this.getAttribute("value"),10))+'</td></tr>'); },false); newtr.addEventListener("click",function(){showMarket(this.getAttribute("prod"));},false); newtd=createElement("td",{},newtr); produktPic(0,prod,newtd); createElement("td",{"style":"text-align:right;"},newtr,numberFormat(amount)); createElement("td",{"style":"padding-left:3px;"},newtr,prodName[0][prod]); createElement("td",{"style":"padding-left:3px;text-align:right;"},newtr,numberFormat(Math.floor(price))); createElement("td",{"style":""},newtr,numberFormat(price,2).slice(-3).replace("00","--")); } newtable.firstElementChild.setAttribute("value",sumTotal); if(newtable.childElementCount==1){ newtr=createElement("tr",{},newtable); createElement("td",{"colspan":"5","style":"text-align:center;"},newtr,"---"); } newtable=null;newtr=null;newtd=null; } newdiv=null; }catch(err){ GM_logError("doMarketoffersNotepad\nprod="+prod+"\n"+err); } } function doRack(){ try{ var cand=$("rackItems").getElementsByClassName("tklein2"); for(var v=0;v<cand.length;v++){ var currProd=parseInt(cand[v].parentNode.id.replace("rackitem",""),10); var cell=$(cand[v].parentNode.id+"format"); if(!cell){ cell=cand[v].parentNode.parentNode; cell.setAttribute("class",(cell.getAttribute("class")+" link").replace(/(^|\s+)link\s+/g," ").replace(/^\s+/,"")); cand[v].style.display="none"; cell=createElement("div",{"id":"rackitem"+currProd+"format"},cand[v].parentNode); } var str=numberFormatPrefixed(prodStock[0][currProd]); if(cell.innerHTML!=str){ cell.innerHTML=str; } str=cand[v].getAttribute("class")+(prodStock[0][currProd]<prodMinRack[0][currProd]?" lowrack":""); // .replace("tklein2","formattedRackItem") if(cell.getAttribute("class")!=str){ cell.setAttribute("class",str); } cell=null; } cand=null; }catch(err){ GM_logError("doRack\nv="+v+"\n"+err); } } function doFarmis(){ try{ if(DEVMODE_FUNCTION){ var trackingHandle = tracking.start("berater","doFarmis"); } var err_trace="init"; // GM_log("farmiLog=\n"+print_r(farmiLog,"",true,"\n")); // TODO: Questproduct is not calculated in at first run. Fixed now I believe // this can't go in the above loop because the amountMinRack are needed to be calculated first var missing,belowMinRack,belowMinRackInit; for(var farmiNr=0;farmiNr<$("customerline").childElementCount;farmiNr++){ missing=0;belowMinRack=0;belowMinRackInit=false; for(var i=1;i<=7;i++){ // 7=max-amount of products per farmi var pid=unsafeWindow.farmisinfo[0][farmiNr]["p"+i]; var amount=parseInt(unsafeWindow.farmisinfo[0][farmiNr]["a"+i],10); if((pid > 0) && (amount > 0)){ if(prodStock[0][pid]<amount){ missing++; } if((prodStock[0][pid]-amount)<prodMinRack[0][pid]-((valMinRackFarmis&&totalFarmis[0]&&totalFarmis[0][pid])?totalFarmis[0][pid]:0)){ belowMinRack++; } if((prodStock[0][pid]-amount)<prodMinRackInit[0][pid]){ belowMinRackInit++; } } } unsafeWindow.farmisinfo[0][farmiNr]["missing"]=missing; unsafeWindow.farmisinfo[0][farmiNr]["belowMinRack"]=belowMinRack; unsafeWindow.farmisinfo[0][farmiNr]["belowMinRackInit"]=belowMinRackInit; } missing=null;belowMinRack=null;belowMinRackInit=null; var cell,customerline,str; if(customerline=$("customerline")){ err_trace="customerline"; for(var farmiNr=0;farmiNr<customerline.childElementCount;farmiNr++){ if (!$("farmiInfo"+farmiNr)){ // assure that this code is run only once per farmi. else eventlisteners are stacked // prepare the additional farmi-info-bubble createElement("div",{"id":"farmiInfo"+farmiNr,"class":"farmiInfo"},$("blase"+farmiNr)); createElement("div",{"id":"farmiMiniInfo"+farmiNr,"class":"farmiMiniInfo"},$("kunde_"+farmiNr)); //createElement("div",{"id":"farmiInfo"+farmiNr,"style":"position:absolute;height:35px;top:-47px;border-radius:5px;padding:5px;color:black;font-size:0.8em;"},$("blase"+farmiNr)); //createElement("div",{"id":"farmiMiniInfo"+farmiNr,"style":"position:absolute;top:45px;right:15px;height:7px;width:7px;display:block;border-radius:5px;"},$("kunde_"+farmiNr)); // fill the bubble when shown $("kunde_"+farmiNr).addEventListener("mouseover",function(event){ var farmiNr=this.id.replace("kunde_",""); // toolTip.show(event,print_r(unsafeWindow.farmisinfo[0][farmiNr],"",true)); var cash=parseFloat(unsafeWindow.farmisinfo[0][farmiNr]["price"],10); var wert = parseFloat(unsafeWindow.farmisinfo[0][farmiNr]["marketValue"],10); var cell=$("blase"+farmiNr).firstElementChild.firstElementChild; var ppid, amount; for(var i=1;i<=7;i++){ // 7=maxanzahl produkte pro farmi if(cell.style.clear=="both"){ // line break after 4 products cell=cell.nextElementSibling; if(!cell){ break; } } pid=unsafeWindow.farmisinfo[0][farmiNr]["p"+i]; amount=parseInt(unsafeWindow.farmisinfo[0][farmiNr]["a"+i],10); if((pid>0)&&(amount>0)){ if(prodStock[0][pid]<amount){ // not enough in rack cell.setAttribute("style",css_styles["prod_border_missing"][1]+"overflow:hidden; margin-right:2px; marign-bottom:2px; float:left; width:15px; height:15px;border-radius:4px;"); }else if(prodStock[0][pid]-amount<prodMinRack[0][pid]-((valMinRackFarmis&&totalFarmis[0]&&totalFarmis[0][pid])?totalFarmis[0][pid]:0)){ // selling this farmi will push the rack below the min-value cell.setAttribute("style",css_styles["prod_border_lowamount"][1]+"overflow:hidden; margin-right:2px; marign-bottom:2px; float:left; width:15px; height:15px;border-radius:4px;"); }else{ cell.style.border="1px solid white"; //css_styles["prod_border_none"][[],"1px solid white","1px solid white"]; //cell.setAttribute("style",css_styles["prod_border_none"][1]+"overflow:hidden; margin-right:2px; marign-bottom:2px; float:left; width:15px; height:15px;border-radius:4px;"); } } cell=cell.nextElementSibling; if(!cell){ break; } } cell=$("farmiInfo"+farmiNr); if(!unsafeWindow.farmisinfo[0][farmiNr]["costQuotient"]){ // a price is missing. can't calculate, so display white cell.innerHTML=moneyFormatInt(cash); cell.setAttribute("style",css_styles["cloud_back_noprice"][1]+css_styles["cloud_border_noprice"][1]); }else if(unsafeWindow.farmisinfo[0][farmiNr]["costQuotient"]<valFarmiLimits[0]){ // low case cell.innerHTML=moneyFormatInt(cash)+"<br>"+numberFormat(unsafeWindow.farmisinfo[0][farmiNr]["costQuotient"],1)+" %<br>"+moneyFormatInt(cash-wert)+" | "+moneyFormatInt(cash-0.9*wert); cell.setAttribute("style",css_styles["cloud_back_below"][1]+css_styles["cloud_border_below"][1]); }else if(unsafeWindow.farmisinfo[0][farmiNr]["costQuotient"]<valFarmiLimits[1]){ // middle case cell.innerHTML=moneyFormatInt(cash)+"<br>"+numberFormat(unsafeWindow.farmisinfo[0][farmiNr]["costQuotient"],1)+" %<br>"+moneyFormatInt(cash-wert)+" | +"+moneyFormatInt(cash-0.9*wert); cell.setAttribute("style",css_styles["cloud_back_between"][1]+css_styles["cloud_border_between"][1]); }else{ // high case cell.innerHTML=moneyFormatInt(cash)+"<br>"+numberFormat(unsafeWindow.farmisinfo[0][farmiNr]["costQuotient"],1)+" %<br>+"+moneyFormatInt(cash-wert)+" | +"+moneyFormatInt(cash-0.9*wert); cell.setAttribute("style",css_styles["cloud_back_above"][1]+css_styles["cloud_border_above"][1]); } cell=null; },false); // farmi is new=not in the FarmiLog var farmi_id=parseInt(unsafeWindow.farmisinfo[0][farmiNr]["id"],10); var farmiLog_id=farmiLog.length; for(var v=0;v<farmiLog.length;v++){ if (farmiLog[v][0]==farmi_id){ farmiLog_id=v; break; } } if (farmiLog_id==farmiLog.length){ raiseEvent("gameFarmiNew"); //todayStr=getDateStr(now,2,false); // add this new farmi farmiLog.push([farmi_id,todayStr,parseFloat(unsafeWindow.farmisinfo[0][farmiNr]["price"],10),{}]); for(var w=1;w<8;w++){ if (unsafeWindow.farmisinfo[0][farmiNr]["p"+w]!="0"){ farmiLog[farmiLog_id][3][unsafeWindow.farmisinfo[0][farmiNr]["p"+w]]=parseInt(unsafeWindow.farmisinfo[0][farmiNr]["a"+w],10); } } levelLog[levelLogId][5]+=farmiLog[farmiLog_id][2]; levelLog[levelLogId][5]=Math.round(100*levelLog[levelLogId][5])/100; // sorting farmiLog.sort(function(a,b){return (getTime(b[1])-getTime(a[1]));}); // saving GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_farmiLog",implode(farmiLog)); GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_levelLog",implode(levelLog)); window.setTimeout(doBuyNotepad,0); } } if(valFarmiMiniInfo){ // Price if(!unsafeWindow.farmisinfo[0][farmiNr]["costQuotient"]){ // unknown case str = css_styles["farmi_price_unknown"][1]; }else if(unsafeWindow.farmisinfo[0][farmiNr]["costQuotient"]<valFarmiLimits[0]){ // low case str = css_styles["farmi_price_low"][1]; }else if(unsafeWindow.farmisinfo[0][farmiNr]["costQuotient"]<valFarmiLimits[1]){ // middle case str = css_styles["farmi_price_between"][1]; }else{ // high case str = css_styles["farmi_price_above"][1]; } // Rackamount if(unsafeWindow.farmisinfo[0][farmiNr]["missing"]>0){ str += ' '+ css_styles["farmi_amount_missing"][1]; }else if(unsafeWindow.farmisinfo[0][farmiNr]["belowminvalue"]>0){ str += ' '+ css_styles["farmi_amount_low"][1]; }else{ str += ' '+ css_styles["farmi_amount_above"][1]; } cell=$("farmiMiniInfo"+farmiNr); if(cell.getAttribute("style")!=str){ cell.setAttribute("style",str); } } } err_trace="alertAdvertEnd"; if((unsafeWindow.customerstats)&&(unsafeWindow.customerstats["adstart"])&&(unsafeWindow.adrun)){ var endDay = getDateStr(getTime(unsafeWindow.customerstats["adstart"])+4*86400-1); if((unsafeWindow.customerstats[endDay])&&(parseInt(unsafeWindow.customerstats[endDay]["count"],10)>=(farmiDailyCount+2*unsafeWindow.adrun))){ if(!(cell=$("alertAdvertEnd"))){ createElement("div",{"id":"alertAdvertEnd","style":"position:absolute;top:65px;left:0;color:white;font-weight:bold;background-color:red;padding:2px;white-space:nowrap;"},$("customerstats"),getText("advertisingEnds")); window.setTimeout(function(){ var newdiv; if(newdiv=$("alertAdvertEnd")){ removeElement(newdiv); } newdiv=null; },1000*(getTime(getDateStr(now,2,false))+86400-now)); // time till midnight } }else{ if(cell=$("alertAdvertEnd")){ removeElement(cell); } } endDay = null; }else{ if(cell=$("alertAdvertEnd")){ removeElement(cell); } } }else{ err_trace="no customerline"; if(cell=$("alertAdvertEnd")){ removeElement(cell); } } cell=null;str=null; if(DEVMODE_FUNCTION){ tracking.end("berater",trackingHandle); } }catch(err){ GM_logError("doFarmis ("+err_trace+")\n"+err); } } function do_main(){ try{ function calcObservedPrice(mode,data){ // data=[[amount1,price1],[amount2,price2],...] switch(mode){ case 1:{ // normal mode. fast market data=data.clone(); // kick upper 20% quantile var sum=0; for(var v=0;v<data.length;v++){ sum += data[v][0]; } sum=Math.floor(0.2*sum); for(var v=data.length-1;0<=v;v--){ if(data[v][0]<sum){ sum -= data[v][0]; data.splice(v,1); }else{ data[v][0] -= sum; sum=0; break; } } // calc weighted mean var weights=[3,3,3,3,2,2,2,2,1,1,1,1]; var count1=0; var count2=0; for(var v=0;v<data.length;v++){ if (weights[v]!=undefined){ count1 += weights[v]*data[v][0]*data[v][1]; count2 += weights[v]*data[v][0]; } } if(count2>0){ return (Math.round(100*count1/count2)/100); }else{ return 0; } break;} case 2:{ // decorations. slow market if(data.length>1){ return data[1][1]; }else if(data.length==1){ return data[0][1]; }else{ return 0; } break;} } } var err_trace="Session"; if(DEVMODE){ logBubble.add("Berater started"); } // Check if username is known if (!USERNAME){ GM_log("Username is not known. Login again with running script.") location.href="http://www."+GAMEPAGES[COUNTRY]+"/login.php?start=1"; return false; } // Check if browser is uptodate var newdiv,newdiv1,container,help; if(!createElement("div").children){ newdiv=createElement("div",{"class":"alertbubble tbig link"},ALL,"Your browser could be too old.<br>This script uses functions which need Gecko 1.9.1 (Firefox 3.5).<br>You will get errors."); newdiv.addEventListener("click",function(){ removeElement(this); },false); } // Save session-id if (unsafeWindow.rid){ GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_session",unsafeWindow.rid); } // Show changelog of new version err_trace="Changelog of new version"; if(CHANGELOG[CHANGELOG.length-1][0]!=GM_getValue("changelogShownVersion","")){ container=createElement("div"); createElement("div",{},container,getText("confirmChangelogVersion").replace("%1%",CHANGELOG[CHANGELOG.length-1][0])); newdiv=createElement("ul",{},container); for(var i=0;i<CHANGELOG[CHANGELOG.length-1][2].length;i++){ createElement("li",{},newdiv,CHANGELOG[CHANGELOG.length-1][2][i][LANGUAGE=="de"?0:1]); } alert2(container.innerHTML,getText("ok"),getText("showChangelog"), function(){ GM_setValueCache("changelogShownVersion",CHANGELOG[CHANGELOG.length-1][0]); }, function(){ GM_setValueCache("changelogShownVersion",CHANGELOG[CHANGELOG.length-1][0]); unsafeWindow.buildInfoPanel("changelog"); }); } // Container Divs err_trace="Container"; var nodes=new Object(); ALL.style.margin="5px"; var upjersToolbarHeight=($("uptoolbar")&&$("uptoolbar").style.display!="none")?30:0; var content_table=document.getElementsByClassName("content_table")[0]; container=createElement("div",{"id":"gameArea","align":"center","style":"margin-top:"+upjersToolbarHeight+"px;"},ALL); newdiv=createElement("div",{"id":"divBeraterButtons","style":"position:fixed;left:0;top:"+(upjersToolbarHeight+50)+"px;width:40px;border:1px groove #4D240E;border-radius:0 10px 10px 0;z-index:500;background:url(\""+GFX+"guild/help_back.jpg\") -25px -25px;"},container); newdiv.addEventListener("mouseover",function(event){ var node=event.target; var mouseOverText=node.getAttribute("mouseOverText"); while((node!=this)&&(!mouseOverText)){ node=node.parentNode; mouseOverText=node.getAttribute("mouseOverText"); } if(mouseOverText){ toolTip.show(event,mouseOverText); } node=null;mouseOverText=null; },false); newdiv1=createElement("div",{"id":"divBeraterButtonsOptionen","class":"link beraterButtonIcon hoverBgGreen","mouseOverText":getText("options")},newdiv); createElement("img",{"src":IMAGES["settings"],"style":"position:relative;top:-3px;left:-1px;;width:32px;height:32px;"},newdiv1); newdiv1.addEventListener("click",function(){ unsafeWindow.buildInfoPanel("menu","options"); },false); newdiv1=createElement("div",{"id":"divGame","style":"position:relative;top:0;margin-left:45px;"},container); newdiv1.appendChild(content_table); if(newdiv=document.querySelector('a[href="https://de.upjers.com/imprint"]')){ newdiv=newdiv.parentNode; container.appendChild(newdiv); newdiv.style.position="relative"; newdiv.style.top=0; newdiv.style.left=0; newdiv.style.margin=0; } content_table.style.position = "relative"; createElement("div",{"id":"statisticArea","align":"center","style":"margin-top:"+upjersToolbarHeight+"px;display:none;"},ALL); if (window.innerWidth<1180){ content_table.style.paddingRight="176px"; } if (window.innerHeight>830){ ALL.style.overflowY="hidden"; } if(newdiv=$("errorboxgarden")){ newdiv.style.left="600px"; newdiv.style.top="105px"; }else if(DEVMODE){ GM_logWarning("#errorboxgarden not found"); } if(newdiv=$("popup_garden")){ newdiv.style.top=""; }else if(DEVMODE){ GM_logWarning("#popup_garden not found"); } err_trace="Container - divRightBorder - divMiddleBorder"; newdiv1=$("questbarcontrol").parentNode; removeElement(newdiv1.firstElementChild); newdiv=createElement("div",{"id":"divRightBorder"},newdiv1); if(container=$("gamearea_spacer")){ container.innerHTML=""; container=createElement("div",{"id":"divMiddleBorder","style":"position:relative;height:100%;"},container); for(var i=0;i+1<newdiv1.childElementCount;){ if(newdiv1.children[i].id.match(/questbarcontrol|farm_production_checker_icon/)){ newdiv.appendChild(newdiv1.children[i]); }else{ container.appendChild(newdiv1.children[i]); } } } err_trace="Container - fixedDivRight"; newdiv=createElement("div",{"id":"fixedDivRight","style":"position:fixed;right:0;top:"+(upjersToolbarHeight)+"px;z-index:500;"},$("divGame")); createElement("div",{"id":"timeHolder"},newdiv); nodes["containerPowerupSymbols"]=new Object(); nodes["containerPowerupSymbols"]["node"]=createElement("div",{"id":"containerPowerupSymbols"},newdiv); err_trace="Container - headercontainer"; newdiv=createElement("div",{"style":"position:absolute;top:2px;left:210px;color:#f7bb87;z-index:10;"},$("headercontainer")); nodes["serverTime"]=new Object(); nodes["serverTime"]["node"]=createElement("div",{"id":"serverTime","style":"float:left;margin-left:2px;"},newdiv); nodes["serverTime"]["node"].addEventListener("mouseover",function(event){ toolTip.show(event,getText("serverTime")); },false); function do_relogin(){ window.setTimeout(function(){ var help=explode(GM_getValue(COUNTRY+"_pagedataLogin","{}"),"clickListener@divSessionEnd/pagedataLogin",{}); if(!(help["doserver"]&&(typeof help["doserver"]=="object"))){ help["doserver"]=new Object(); } help["doserver"][SERVER]=true; GM_setValue(COUNTRY+"_pagedataLogin",implode(help)); if($("logoutbutton")){ click($("logoutbutton")); } else { location.href="http://www."+GAMEPAGES[COUNTRY]+"/login.php?start=1"; } },0); } nodes["sessionTimeLeft"]=new Object(); nodes["sessionTimeLeft"]["node"]=createElement("div",{"id":"sessionTimeLeft","class":"link","style":"float:left;margin-left:2px;"},newdiv); nodes["sessionTimeLeft"]["node"].addEventListener("mouseover",function(event){ toolTip.show(event,getText("sessionEnd").replace(/%1%/,getDaytimeStr(valSessionEndtime))); },false); nodes["sessionTimeLeft"]["node"].addEventListener("click",do_relogin,false); nodes["sessionTimeNow"]=new Object(); nodes["sessionTimeNow"]["node"]=createElement("div",{"id":"sessionTimeNow","style":"float:left;margin-left:2px;"},newdiv); nodes["sessionTimeNow"]["node"].addEventListener("mouseover",function(event){ toolTip.show(event,getText("localTime")); },false); USERLEVEL=parseInt(unsafeWindow.currentuserlevel,10); /* var new_PRODUCT2BUILDING=PRODUCT2BUILDING.clone(); new_PRODUCT2BUILDING[0][154]=1; GM_log(implode(new_PRODUCT2BUILDING)); */ show=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_show","{}"),"do_main/show",{}); // buyNotepad,marketoffersNotepad if((typeof show!="object")||(show instanceof Array)){ show = new Object(); } questData=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_questData"),"questData",INIT_questData); if((typeof questData!="object")||(questData instanceof Array)){ questData = INIT_questData.clone(); } // Check structure of questData for(var t in questData){ if(!questData.hasOwnProperty(t)){continue;} if(INIT_questData[t]){ for(var c in questData[t]){ if(!questData[t].hasOwnProperty(c)){continue;} if(!INIT_questData[t][c]){ delete questData[t][c]; } } }else{ delete questData[t]; } } for(var t in INIT_questData){ if(!INIT_questData.hasOwnProperty(t)){continue;} if(questData[t]){ for(var c in INIT_questData[t]){ if(!INIT_questData[t].hasOwnProperty(c)){continue;} if(!questData[t][c]){ questData[t]=INIT_questData[t]; } } }else{ questData[t]=INIT_questData[t]; } } // Check quest requirements if(USERLEVEL<31){ questData["main"]["2"]["nr"]=-1; } if(USERLEVEL<20){ questData["forestry"]["1"]["nr"]=-1; } if(questData["forestry"]["1"]["nr"]<35){ questData["forestry"]["2"]["nr"]=-1; } if(USERLEVEL<12){ questData["foodworld"]["1"]["nr"]=-1; } unsafeData.questData=questData.clone(); for(var t in questData){ if(!questData.hasOwnProperty(t)){continue;} for(var c in questData[t]){ if(!questData[t].hasOwnProperty(c)){continue;} if((0<questData[t][c]["calcTo"])&&(questData[t][c]["calcTo"]<questData[t][c]["nr"])){ setCalcToQuest(t,c,questData[t][c]["nr"]); } } } valServerTimeOffset=GM_getValue(COUNTRY+"_valServerTimeOffset",0); todayStr=getDateStr(now,2,false); nowServerOff=unsafeWindow.Zeit.Server+valServerTimeOffset; todayServerStr=getDateStr(nowServerOff,2,false); buyNotePadShowBlocked=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_buyNotePadShowBlocked",false);//TODO make option loadProductData(); updateProductDataFarm(); updateProductDataForestry(); updateProductDataWindmill(); updateProductDataPowerup(); err_trace="Show Data"; // SHOW DATA: BUILDING_INPUT /* for(var zone=0;zone<BUILDING_INPUT.length;zone++){ if(!BUILDING_INPUT[zone]){continue;} for(var output in BUILDING_INPUT[zone]){ if(!BUILDING_INPUT[zone].hasOwnProperty(output)){continue;} for(var alt=0;alt<BUILDING_INPUT[zone][output].length;alt++){ var str="Zone "+zone+": "; for(var input=0;input<BUILDING_INPUT[zone][output][alt].length;input++){ if(input>0){ str+=", "; } str+=numberFormat(BUILDING_INPUT[zone][output][alt][input][1])+" "+prodName[0][BUILDING_INPUT[zone][output][alt][input][0]] } str+=" -> "+prodName[0][output]; GM_log(str); } } } */ /* var div=createElement("div",{"style":"z-index:950;position:fixed;top:0;background-color:white;height:800px;overflow:auto;padding-right:40px;"},ALL); var newimg=createElement("img",{"class":"link","src":GFX+"close.jpg","style":"position:absolute;top:8px;right:0px;width:20px;height:20px;"},div); newimg.addEventListener("click",function(){ removeElement(this.parentNode); },false); var tr,td,table=createElement("table",{"border":"1"},div); for(var campaign in QUESTS["forestry"]){ if(!QUESTS["forestry"].hasOwnProperty(campaign)){continue;} for(var v=1;v<QUESTS["forestry"][campaign].length;v++){ tr = createElement("tr",{},table); if(questData["forestry"][campaign]["nr"]==v){ tr.style.backgroundColor="#FBB"; } createElement("td",{},tr,campaign); createElement("td",{},tr,v); for(var w=0;w<6;w++){ td = createElement("td",{"style":"white-space:nowrap;"},tr); if(QUESTS["forestry"][campaign][v][0][w]){ produktPic(QUESTS["forestry"][campaign][v][0][w][0],QUESTS["forestry"][campaign][v][0][w][1],td); createElement("span",{},td,numberFormat(QUESTS["forestry"][campaign][v][0][w][2])); td.setAttribute("mouseovertext",numberFormat(QUESTS["forestry"][campaign][v][0][w][2])+" "+prodName[QUESTS["forestry"][campaign][v][0][w][0]][QUESTS["forestry"][campaign][v][0][w][1]]); td.addEventListener("mouseover",function(event){ toolTip.show(event,this.getAttribute("mouseovertext")); },false); } } createElement("td",{},tr,QUESTS["forestry"][campaign][v][1]); td=createElement("td",{},tr); if(QUESTS["forestry"][campaign][v][2]){ pointsFormat(QUESTS["forestry"][campaign][v][2],"div",td); } td=createElement("td",{},tr); if(QUESTS["forestry"][campaign][v][3]){ createElement("div",{},td,implode(QUESTS["forestry"][campaign][v][3])); } } } div=null;newimg=null; table=null;tr=null;td=null; }); */ // SHOW BUILDING DATA GM_registerMenuCommand(getText("adviser")+" "+"Show Data: Buildings", function(){ try{ var container=createElement("div",{"style":"z-index:995;position:absolute;top:0;left:0;background-color:white;height:100%;"},ALL); var div=createElement("img",{"class":"link","src":GFX+"close.jpg","style":"position:absolute;top:0;right:0;width:20px;height:20px;margin:5px;"},container); div.addEventListener("click",function(){ removeElement(this.parentNode); },false); div=createElement("div",{"style":"height:100%;padding-right:20px;margin-right:30px;overflow:auto;"},container); var table=createElement("table",{"border":"1"},div); var tr=createElement("tr",{},table); var td; createElement("th",{},tr); for(var w=1;w<unsafeWindow.buildinginfos[0][1].length;w++){ createElement("th",{},tr,w); } createElement("th",{},tr,"BUILDING_UPGRADES"); createElement("th",{},tr,"BUILDINGTYPE"); createElement("th",{},tr,"COUNT"); for(var v in unsafeWindow.buildinginfos[0]){ if(!unsafeWindow.buildinginfos[0].hasOwnProperty(v)){continue;} tr=createElement("tr",{},table); createElement("td",{},tr,v); for(var w=1;w<unsafeWindow.buildinginfos[0][v].length;w++){ createElement("td",{},tr,implode(unsafeWindow.buildinginfos[0][v][w])); } createElement("td",{},tr,implode(BUILDING_UPGRADES[v])); createElement("td",{},tr,implode(BUILDINGTYPE[v])); createElement("td",{},tr,implode(totalZones[v])); } for(var i=1;i<=4;i++){ v="fw"+i; tr=createElement("tr",{},table); createElement("td",{},tr,v); for(var w=1;w<=12;w++){ td=createElement("td",{},tr); switch(w){ case 10: td.innerHTML=getBuildingName(v); break; } } createElement("td",{},tr,implode(BUILDING_UPGRADES[v])); createElement("td",{},tr,implode(BUILDINGTYPE[v])); createElement("td",{},tr,implode(totalZones[v])); } for(var i=1;i<=6;i++){ v="fl"+i; tr=createElement("tr",{},table); createElement("td",{},tr,v); for(var w=1;w<=12;w++){ td=createElement("td",{},tr); switch(w){ case 10: td.innerHTML=getBuildingName(v); break; } } createElement("td",{},tr,implode(BUILDING_UPGRADES[v])); createElement("td",{},tr,implode(BUILDINGTYPE[v])); createElement("td",{},tr,implode(totalZones[v])); } container=null;div=null; table=null;tr=null;td=null; }catch(err){ GM_logError("show building data\n"+err); } }); valMinRackMan=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMinRackMan",false); valMinRack=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMinRack"),"do_main/valMinRack"); bChanged=false; if((typeof valMinRack=="object")&&!(valMinRack instanceof Array)){ for(var v in valMinRack){ if(!valMinRack.hasOwnProperty(v)){continue;} if(INIT_valMinRack[v]==undefined){ delete valMinRack[v];bChanged=true; } else if(typeof valMinRack[v]!="number"){ valMinRack[v]=INIT_valMinRack[v];bChanged=true; } } for(var v in INIT_valMinRack){ if(!INIT_valMinRack.hasOwnProperty(v)){continue;} if(valMinRack[v]==undefined){ valMinRack[v]=INIT_valMinRack[v];bChanged=true; } } }else{ valMinRack=INIT_valMinRack.clone();bChanged=true; } if(bChanged){ GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMinRack",implode(valMinRack,"valMinRack")); } valMinRackPlantsize=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMinRackPlantsize",false); //Use plant ratio valMinRackFarmis=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMinRackFarmis",true); valMinRackForestryFarmis=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMinRackForestryFarmis",true); valMinRackGrowing=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMinRackGrowing",true); valMinRackRecursive=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMinRackRecursive",false); valFarmiLimits=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valFarmiLimits","[90,100]"),"do_main/valFarmiLimits",[90,100]); unsafeData.valFarmiLimits=valFarmiLimits.clone(); valFarmiMiniInfo=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valFarmiMiniInfo",true); unsafeOverwriteFunction("createAdvancedProductResponse",function(response,e,c){ try{ unsafeWindow._createAdvancedProductResponse(response,e,c); }catch(err){GM_logError("_createAdvancedProductResponse\n"+err);} try{ raiseEvent("gameStartFactory"); }catch(err){GM_logError("createAdvancedProductResponse\n"+err);} }); // Farmis err_trace="farmis"; if(newdiv=$("customerstats")){ newdiv.setAttribute("class","link"); newdiv.addEventListener("click",function(){unsafeWindow.buildInfoPanel("farmies");},false); } // farmiLog[farmiId]=[date,money,{prod1:amount,...}] farmiLog=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_farmiLog","[]"),"do_main/farmiLog",[]); if(!(farmiLog instanceof Array)){ farmiLog=[]; } // kick farmis older than 1 month, set this value optional? var dayLastMonth=new Date(); dayLastMonth=Math.round(((new Date(dayLastMonth.getFullYear(),dayLastMonth.getMonth()-1,dayLastMonth.getDate())).getTime())/1000); for(var v=farmiLog.length-1;v>=0;v--){ if (getTime(farmiLog[v][1])<=dayLastMonth){ farmiLog.splice(v,1); } } function calcFarmiCost(){ //done on price change, on load and on a new farmi try{ if(DEVMODE_FUNCTION){ var trackingHandle = tracking.start("berater","calcFarmiCost"); } // calculate costs of the farmis for(var farmiNr in unsafeWindow.farmisinfo[0]){ if(!unsafeWindow.farmisinfo[0].hasOwnProperty(farmiNr)){ continue; } var wert=0; var priceMissing=0; for(var i=1;i<=7;i++){ // 7=max-amount of products per farmi var pid=unsafeWindow.farmisinfo[0][farmiNr]["p"+i]; var amount=parseInt(unsafeWindow.farmisinfo[0][farmiNr]["a"+i],10); if((pid>0)&&(amount>0)){ if(gut[pid]>0){ wert += amount*gut[pid]; }else{ priceMissing++; } } } unsafeWindow.farmisinfo[0][farmiNr]["costQuotient"]=(priceMissing>0?null:(100*parseFloat(unsafeWindow.farmisinfo[0][farmiNr]["price"],10)/wert)); unsafeWindow.farmisinfo[0][farmiNr]["marketValue"]=(priceMissing>0?0:wert); } if(DEVMODE_FUNCTION){ tracking.end("berater",trackingHandle); } }catch(err){ GM_logError("calcFarmiCost\n"+err); } } // Foodworld err_trace="Foodworld"; // Foodworld-Farmi /* unsafeOverwriteFunction("showFoodworldFarmiCart",function(id){ unsafeWindow._showFoodworldFarmiCart(id); try{ var newdiv, sum=0, prodId, priceMissing=false; if(newdiv=$("food_cart_products")){ for(var i=0;i<newdiv.childElementCount;i++){ prodId=parseInt(newdiv.children[i].firstElementChild.getAttribute("class").replace(/\D+/g,""),10); newdiv.children[i].setAttribute("prodId",prodId); newdiv.children[i].classList.add("link"); newdiv.children[i].addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.getAttribute("prodId")); },false); newdiv.children[i].addEventListener("click",function(event){ showMarket(this.getAttribute("prodId")); },false); if(gut[prodId]){ sum+=gut[prodId]*unsafeWindow.foodworldfarmis[id]["products"][prodId]; }else{ newdiv.children[i].style.backgroundColor="red"; priceMissing=true; } } } if(newdiv=$("food_cart_cost")){ newdiv.innerHTML="100%: "+moneyFormatInt(sum)+" | 90%: "+moneyFormatInt(0.9*sum); } if(newdiv=$("food_cart_perc")){ if(priceMissing){ newdiv.style.border="4px inset #336"; newdiv.style.color="#336"; newdiv.style.backgroundColor="transparent"; newdiv.innerHTML="--%"; }else{ var price=parseInt(unsafeWindow.foodworldfarmis[id]["price"],10); if(100*price<valFarmiLimits[0]*sum){ var col="red";var col2="#fcc"; } else if(100*price<valFarmiLimits[1]*sum){ var col="#d80";var col2="#ff9"; } else{ var col="green";var col2="#80ff80"; } newdiv.style.border="4px inset "+col; newdiv.style.color=col; newdiv.style.backgroundColor=col2; newdiv.innerHTML=Math.round(100*price/sum)+"%"; } } newdiv=null; }catch(err){ GM_logError("showFoodworldFarmiCart\n"+err); } }); */ unsafeOverwriteFunction("showFoodworldFarmiCart",function(farmi){ try{ unsafeWindow._showFoodworldFarmiCart(farmi); }catch(err){GM_logError("_showFoodworldFarmiCart\n"+err);} try{ // get farmi data var prod,menge; var thisFarmiData=new Object(); thisFarmiData["cart"]=new Array(); thisFarmiData["money"]=parseFloat(unsafeWindow.foodworldfarmis[farmi]["price"],10); for(var i in unsafeWindow.foodworldfarmis[farmi]["products"]){ if(!unsafeWindow.foodworldfarmis[farmi]["products"].hasOwnProperty(i)){ continue; } prod=parseInt(i,10); menge=unsafeWindow.foodworldfarmis[farmi]["products"][i]; thisFarmiData["cart"].push([prod,menge,menge*gut[prod]]); } // (re-)build the table function buildTable(){ try{ var cartContent,newtable,newtr,newtd,span; cartContent=$("food_cart_products"); cartContent.innerHTML=""; var prod,menge,wert,sum=0,priceMissing=false; thisFarmiData["cart"].sort(function(a,b){return (b[2]-a[2]);}); newtable=createElement("table",{"border":"0","cellspacing":"0","cellpadding":"2","style":"margin:0 auto;"},cartContent); for(var v=0;v<thisFarmiData["cart"].length;v++){ prod=thisFarmiData["cart"][v][0]; menge=thisFarmiData["cart"][v][1]; wert=thisFarmiData["cart"][v][2]; sum += wert; newtr=createElement("tr",{"class":((prodStock[0][prod]<menge)?("farmicart_missing"):((prodStock[0][prod]-menge<prodMinRack[0][prod]-((valMinRackFarmis&&totalFarmis[0]&&totalFarmis[0][prod])?totalFarmis[0][prod]:0))?"farmicart_lowrack":"")),"prod":prod},newtable); produktPic(0,prod,createElement("td",{},newtr)); createElement("td",{"style":"text-align:right;font-size:16px;font-weight:bold;"},newtr,numberFormat(menge)); newtd=createElement("td",{"class":"link","style":"width:170px;"},newtr); newtd.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.parentNode.getAttribute("prod")); },false); newtd.addEventListener("click",function(){showMarket(this.parentNode.getAttribute("prod"));},false); span=createElement("span",{"style":"font-size:16px;font-weight:bold;white-space:nowrap;"},newtd,prodName[0][prod]); span.style.fontSize=16*Math.min(1,170/span.offsetWidth)+"px"; newtd=createElement("td",{"class":"link","nr":v,"style":"width:82px;text-align:right;font-size:14px;"},newtr); if(wert>0){ newtd=createElement("div",{"style":"position:relative;height:100%;padding-left:5px;padding-right:5px;"},newtd); createElement("div",{"style":"position:absolute;left:0;height:100%;width:"+Math.ceil(100*wert/thisFarmiData["cart"][0][2])+"%;background-color:grey;opacity:0.6;z-index:-1;"},newtd); createElement("span",{"style":"width:100%;"},newtd,moneyFormatInt(wert)); }else{ newtd.style.backgroundColor="red"; priceMissing=true; } newtd.addEventListener("mouseover",function(event){ toolTip.show(event,getText("editPrice")); },false); newtd.addEventListener("click",function(){ var cell,newtable,newt,newtdr cell=this; while(cell.nodeName!="TD"){ cell=cell.parentNode; } var v=cell.getAttribute("nr"); cell=$("cartcontentEditPrice"); if(cell){ removeElement(cell); } newtable=createElement("div",{"id":"cartcontentEditPrice","style":"z-index:10;position:absolute;right:0;top:0;display:block;border-radius:5px;","class":"blackbox"},$("food_cart_products")); newtable=createElement("table",{"cellspacing":"0","cellpadding":"0","border":"0","nr":v},newtable); newtr=createElement("tr",{},newtable); createElement("td",{"colspan":"2","style":"color:black;text-align:center;padding-bottom:2px;white-space:nowrap;"},newtr,getText("editPrice")); newtr=createElement("tr",{},newtable); createElement("td",{"colspan":"2","style":"color:black;border-bottom:1px solid black;text-align:center;padding-bottom:2px;white-space:nowrap;"},newtr,numberFormat(thisFarmiData["cart"][v][1])+" "+prodName[0][thisFarmiData["cart"][v][0]]); newtr=createElement("tr",{},newtable); createElement("td",{"style":"color:black;text-align:left;padding-top:2px;padding-right:10px;"},newtr,getText("marketPrice")); createElement("td",{"style":"color:black;text-align:right;padding-top:2px;"},newtr,moneyFormat(gut[thisFarmiData["cart"][v][0]])); newtr=createElement("tr",{},newtable); createElement("td",{"style":"color:black;text-align:left;padding-right:10px;"},newtr,getText("NPCprice")); createElement("td",{"style":"color:black;text-align:right;"},newtr,isNaN(NPC[0][thisFarmiData["cart"][v][0]])?"-":moneyFormat(NPC[0][thisFarmiData["cart"][v][0]])); newtr=createElement("tr",{"style":"height:22px;"},newtable); createElement("td",{"style":"color:black;text-align:left;padding-right:10px;"},newtr,getText("single")); newtd=createElement("td",{},newtr); cell=createElement("input",{"class":"text","type":"text","style":"color:black;text-align:right;width:60px;","value":numberFormat(thisFarmiData["cart"][v][2]/thisFarmiData["cart"][v][1],2),"maxlength":"8"},newtd); cell.addEventListener("change",function(){ var help=parseFloat(this.value.replace(regDelimThou,"").replace(regDelimDeci,"."),10); if(!isNaN(help)){ if(help<0){ help*=-1; } help=Math.round(100*help)/100; this.value=numberFormat(help,2); var v=this.parentNode.parentNode.parentNode.getAttribute("nr"); thisFarmiData["cart"][v][2]=help*thisFarmiData["cart"][v][1]; this.parentNode.parentNode.nextElementSibling.children[1].firstElementChild.value=numberFormat(thisFarmiData["cart"][v][2],2); } },false); newtr=createElement("tr",{"style":"height:22px;"},newtable); createElement("td",{"style":"color:black;text-align:left;padding-right:10px;"},newtr,getText("total")); newtd=createElement("td",{},newtr); cell=createElement("input",{"class":"text","type":"text","style":"color:black;text-align:right;width:60px;","value":numberFormat(thisFarmiData["cart"][v][2],2),"maxlength":"9"},newtd); cell.addEventListener("change",function(){ var help=parseFloat(this.value.replace(regDelimThou,"").replace(regDelimDeci,"."),10); if(!isNaN(help)){ if(help<0){ help*=-1; } help=Math.round(100*help)/100; this.value=numberFormat(help,2); var v=this.parentNode.parentNode.parentNode.getAttribute("nr"); thisFarmiData["cart"][v][2]=help; this.parentNode.parentNode.previousElementSibling.children[1].firstElementChild.value=numberFormat(thisFarmiData["cart"][v][2]/thisFarmiData["cart"][v][1],2); } },false); newtr=createElement("tr",{"style":"height:22px;"},newtable); newtd=createElement("td",{"colspan":"2","style":"color:black;border-top:1px solid black;text-align:center;padding-top:2px;"},newtr); cell=createElement("button",{"class":"link","type":"button","style":"color:black;"},newtd,getText("ok")); cell.addEventListener("click",function(){ removeElement(this.parentNode.parentNode.parentNode.parentNode); buildTable(); },false); cell=null;newtable=null;newtr=null;newtd=null; },false); } newtr=createElement("tr",{},newtable); createElement("td",{"colspan":"3"},newtr); newtd=createElement("td",{"style":"padding-left:5px;padding-right:5px;border-top:1px solid #336;text-align:right;color:#336;font-size:14px;","mouseOverText":"90%: "+moneyFormatInt(0.9*sum)},newtr,moneyFormatInt(sum)); newtd.addEventListener("mouseover",function(event){ toolTip.show(event,this.getAttribute("mouseOverText")); },false); newtd=$("food_cart_perc"); if(priceMissing){ newtd.style.border="4px inset #336"; newtd.style.color="#336"; newtd.style.backgroundColor="transparent"; newtd.innerHTML="--%"; }else{ if(100*thisFarmiData["money"]<valFarmiLimits[0]*sum){ var col="red";var col2="#fcc"; } else if(100*thisFarmiData["money"]<valFarmiLimits[1]*sum){ var col="#d80";var col2="#ff9"; } else{ var col="green";var col2="#80ff80"; } newtd.style.border="4px inset "+col; newtd.style.color=col; newtd.style.backgroundColor=col2; newtd.innerHTML=Math.round(100*thisFarmiData["money"]/sum)+"%"; } cartContent=null;newtable=null;newtr=null;newtd=null;span=null; }catch(err){GM_logError("showCart.buildTable\n"+err);} } buildTable(); }catch(err){GM_logError("showFoodworldFarmiCart\n"+err);} }); unsafeOverwriteFunction("createFoodworldFarmis",function(){ try{ unsafeWindow._createFoodworldFarmis(); }catch(err){GM_logError("_createFoodworldFarmis\n"+err);} try{ var div,input; if(div=$("food_farmis")){ div=createElement("div",{"style":"position:absolute;bottom:-20px;"},div); input=createElement("input",{"type":"checkbox","checked":valFoodworldFarmiPlacing,"class":"link"},div); input.addEventListener("click",function(){ valFoodworldFarmiPlacing=this.checked; GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valFoodworldFarmiPlacing",valFoodworldFarmiPlacing); },false); div.addEventListener("mouseover",function(event){ toolTip.show(event,getText("settings_valFoodworldFarmiPlacing")[1]); },false); } }catch(err){GM_logError("createFoodworldFarmis\n"+err);} }); unsafeOverwriteFunction("dragFoodworldFarmiTouch",function(id){ try{ unsafeWindow._dragFoodworldFarmiTouch(id); }catch(err){GM_logError("_dragFoodworldFarmiTouch\n"+err);} try{ if(valFoodworldFarmiPlacing){ loop: for(var b=0;b<=4;b++){ if(unsafeWindow.foodworldtables[b]&&(!unsafeWindow.foodworldtables[b]["block"])&&(!unsafeWindow.foodworldtables[b]["locked"])){ for(var a=1;a<=2;a++) { if(!(unsafeWindow.foodworldtables[b]["chairs"]&&unsafeWindow.foodworldtables[b]["chairs"][a]&&unsafeWindow.foodworldtables[b]["chairs"][a]["id"])){ if(div=$("foodworldchair"+b+"_"+a+"_touch")){ click(div); div=null; break loop; } } } } } } }catch(err){GM_logError("dragFoodworldFarmiTouch\n"+err);} }); if(newdiv=$("food_cart")){ createElement("div",{"id":"food_cart_cost","style":"position:absolute;bottom:130px;left:135px;font-size:12px;color:#463824;"},newdiv); createElement("div",{"id":"food_cart_perc","style":"position:absolute;bottom:105px;left:375px;width:70px;padding:2px;text-align:right;font-size:20px;font-weight:bold;"},newdiv); } // Foodworld-Zones function doFoodworld(){ try{ gameLocation=["foodworld",null]; unsafeData.gameLocation=gameLocation.clone(); var nowServer=unsafeWindow.Zeit.Server; var zoneNrF,zoneNrS,tempZoneProductionData,tempZoneProductionDataSlot,currBlock; // Buildings var err_trace="Buildings"; zoneNrF="foodworld-4"; zones.setBlock(zoneNrF,"blpqs"); if(unsafeWindow.foodworldbuildings){ var res,iProd,iTime,iAmount,iPoints,iSlotCount; for(var building in unsafeWindow.foodworldbuildings){ if(!unsafeWindow.foodworldbuildings.hasOwnProperty(building)){continue;} res=unsafeWindow.foodworldbuildings[building]; zoneNrF="foodworld-"+building; currBlock=(unsafeWindow.foodworldbuildings[building]["cost"]?"b":""); // foodworld building locked due to missing payment currBlock+=(unsafeWindow.foodworldbuildings[building]["block"]?"l":""); // foodworld building locked due to level requirement zones.setBlock(zoneNrF,currBlock); if(zones.isMultiSlot(zoneNrF)){ iSlotCount=3; if(!currBlock){ for(var slot=1;slot<=iSlotCount;slot++){ zoneNrS=zoneNrF+"."+slot; zones.setBlock(zoneNrS,res["slots"]&&res["slots"][slot]&&res["slots"][slot]["block"]?"b":""); } } }else{ iSlotCount=0; } if(!currBlock){ zones.setBonus(zoneNrF,0); // TODO // unsafeWindow.forestry_user_buildings[building]["boni"]?unsafeWindow.forestry_user_buildings[building]["boni"]:0; res=(unsafeWindow.foodworldbuildings[building]&&unsafeWindow.foodworldbuildings[building]["slots"])?unsafeWindow.foodworldbuildings[building]["slots"]:{}; tempZoneProductionData=[[{},{}],0,0,true]; for(var slot=1;slot<=(iSlotCount==0?1:iSlotCount);slot++){ if(DEVMODE){ GM_log("doFoodworld zoneNrF="+zoneNrF+" slot="+slot+" res["+slot+"]="+implode(res[slot],"res")); } if(iSlotCount>0){ zoneNrS=zoneNrF+"."+slot; }else{ zoneNrS=zoneNrF; } if(!zones.getBlock(zoneNrS)){ tempZoneProductionDataSlot=[[{},{}],0,0,true]; if(res[slot]){ iProd=(res[slot]["pid"]?parseInt(res[slot]["pid"],10):null); if(isNaN(iProd)){ iProd=null; } if((iProd!=null)&&(res[slot]["ready"])){ // production ready iTime=nowServer; }else if((iProd!=null)&&(res[slot]["remain"])){ // production busy iTime=nowServer+res[slot]["remain"]; }else{ iTime=NEVER; tempZoneProductionData[1]++; tempZoneProductionDataSlot[1]++; } // iAmount=(res[slot]["amount"]?res[slot]["amount"]:null); tempZoneProductionData[2]++; tempZoneProductionDataSlot[2]++; if(iProd!=null){ iAmount=prodYield[0][iProd]; iPoints=iAmount*prodPoints[0][iProd]; if(!tempZoneProductionData[0][0][iProd]){ tempZoneProductionData[0][0][iProd]=[]; } tempZoneProductionData[0][0][iProd].push([iAmount,iPoints,iTime,NEVER]); if(!tempZoneProductionDataSlot[0][0][iProd]){ tempZoneProductionDataSlot[0][0][iProd]=[]; } tempZoneProductionDataSlot[0][0][iProd].push([iAmount,iPoints,iTime,NEVER]); } } if(iSlotCount>0){ zones.setProduction(zoneNrS,tempZoneProductionDataSlot.clone()); } } } zones.setProduction(zoneNrF,tempZoneProductionData.clone()); //auto-cropping // if(iSlotCount=0){ // var div; // if((top.unsafeData.autoAction==null) && valAutoCrop["forestry"] && (zones.getEndtime(zoneNrF)<=unsafeWindow.Zeit.Server) && (div=$("forestry_building_click"+building))){ // top.unsafeData.autoAction="berater: forestry building crop"; // document.addEventListener("gameOpenGlobalCommitBox",function(){ // document.removeEventListener("gameOpenGlobalCommitBox",arguments.callee,false); // window.setTimeout(function(){ // click($("globalcommitboxfooter").firstElementChild); // top.unsafeData.autoAction=null; // },500); // }); // window.setTimeout(function(div){ click(div); },500,div); // } // div=null; // } createZoneTimer("zoneTimer_"+zoneNrF,zoneNrF,"zonetimer","position:absolute;top:-20px;left:0px;",$("food_pos"+building)); } } building=null;res=null;iProd=null;iTime=null;maxCapacity=null; } calcTotalZones(); // Quest handleQuestDataFoodworld(); if((newdiv=$("foodworld_questblock"))&&(!newdiv.classList.contains("mouseOver"))){ newdiv.classList.add("mouseOver"); newdiv.addEventListener("mouseover",function(event){ toolTip.show(event,questLineMouseOver("foodworld","1")); },false); } zoneNrF=null;tempZoneProductionData=null;tempZoneProductionDataSlot=null; err_trace="saving"; publishProductData(); }catch(err){GM_logError("doFoodworld ("+err_trace+")\n"+err);} } unsafeOverwriteFunction("foodworldActionResponse",function(request,action,id,table,chair){ try{ unsafeWindow._foodworldActionResponse(request,action,id,table,chair); }catch(err){GM_logError("_foodworldActionResponse\n"+err);} try{ var result = checkRequest(request); if((result!=0)&&(result[0]!=0)){ doFoodworld(); switch(action){ case "crop": raiseEvent("gameFoodworldCropped"); break; case "init": raiseEvent("gameFoodworldOpened"); break; case "open": raiseEvent("gameFoodworldOpened" + id); break case "production": raiseEvent("gameFoodworldStarted"); break // logBubble.add("gameLocation = " + gameLocation + "id = " + id); } } result=null; }catch(err){GM_logError("foodworldActionResponse\n"+err);} }); unsafeOverwriteFunction("openFoodworldBuildingSelect",function(position,slot){ try{ unsafeWindow._openFoodworldBuildingSelect(position,slot); }catch(err){GM_logError("_openFoodworldBuildingSelect\n"+err);} try{ raiseEvent("gameFoodworldSlotOpened") }catch(err){GM_logError("openFoodworldBuildingSelect\n"+err);} }); // Addons err_trace="Addons"; // TODO remove document.addEventListener("gameBotStarted",function(){ try{ valAutoWater["farm"]=unsafeData.botConfigData[0]; valAutoCrop["farm"]=unsafeData.botConfigData[1]; valWaterNeeded["farm"]=unsafeData.botConfigData[2]; for(var z in unsafeData.readyZone){ if(!unsafeData.readyZone.hasOwnProperty(z)){continue;} unsafeData.readyZone[z][2]=true; } }catch(err){} },false); document.addEventListener("gameBotStopped",function(){ window.setTimeout(function(){ try{ valAutoWater=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valAutoWater"),"valAutoWater",{"farm":false,"forestry":true}); valAutoCrop=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valAutoCrop"),"valAutoCrop",{"farm":false,"forestry":true}); valWaterNeeded=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valWaterNeeded"),"valWaterNeeded",{"farm":true,"forestry":true}); }catch(err){} },0); },false); unsafeWindow.prodMinRackAddon.add = function(type,pid,reason,amount){ try{ type=parseInt(type,10); pid=parseInt(pid,10); amount=parseInt(amount,10); if(isNaN(type)||isNaN(pid)||isNaN(amount)){ GM_log("prodMinRackAddon.add wrong arguments:"); GM_log([type,pid,reason,amount]); return false; } unsafeWindow.prodMinRackAddon.newdata.push([type,pid,reason,amount]); raiseEvent("gameChangedProdMinRackAddon"); }catch(err){ GM_logError("prodMinRackAddon.add\n"+err); } }; unsafeWindow.prodMinRackAddon.remove = function(type,pid,reason){ try{ unsafeWindow.prodMinRackAddon.newdata.push([type,pid,reason,null]); raiseEvent("gameChangedProdMinRackAddon"); }catch(err){ GM_logError("prodMinRackAddon.remove\n"+err); } }; unsafeWindow.prodMinRackAddon.removeAll = function(type,reason){ try{ for(var p in prodMinRackAddon[type]){ if(!prodMinRackAddon[type].hasOwnProperty(p)){ continue; } if(prodMinRackAddon[type][p]&&prodMinRackAddon[type][p][reason]){ unsafeWindow.prodMinRackAddon.newdata.push([type,parseInt(p,10),reason,null]); } } raiseEvent("gameChangedProdMinRackAddon"); }catch(err){ GM_logError("prodMinRackAddon.removeAll\n"+err); } }; document.addEventListener("gameChangedProdMinRackAddon",function(){ try{ // test if calculation is running if(unsafeWindow.prodMinRackAddon.busy){ return false; } // set flag unsafeWindow.prodMinRackAddon.busy=true; // get data inside var helper=unsafeWindow.prodMinRackAddon.newdata; unsafeWindow.prodMinRackAddon.newdata=new Array(); // calculate var type,prod,reason,amount; for(var k=0;k<helper.length;k++){ type =helper[k][0]; prod=helper[k][1]; reason=helper[k][2]; amount=helper[k][3]; if(prodMinRackAddon[type][prod]){ if(prodMinRackAddon[type][prod][reason]){ if(amount==null){ // delete existing entry delete prodMinRackAddon[type][prod][reason]; }else if(prodMinRackAddon[type][prod][reason]!=amount){ // update existing entry prodMinRackAddon[type][prod][reason]=amount; } // else the entry is correct }else if(amount!=null){ prodMinRackAddon[type][prod][reason]=amount; } }else if(amount!=null){ // create new entry prodMinRackAddon[type][prod]=new Object(); prodMinRackAddon[type][prod][reason]=amount; } // else a non-existing entry should be deleted } calcProdMinRack(); // remove flag unsafeWindow.prodMinRackAddon.busy=false; // restart if new data meanwhile arrived if(unsafeWindow.prodMinRackAddon.newdata.length>0){ arguments.callee(); } }catch(err){ GM_logError("listener gameChangedProdMinRackAddon\n"+err); } },false); GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_farmname",FARMNAME); var documentTitle=" - "+FARMNAME+" - s"+SERVER+" - "+document.title; var lastGiess=null; var lastErnte=null; err_trace="zones"; zones.init(); for(var j=0;j<ALL_ZONES["farm"].length;j++){ help=zones.getBlock(ALL_ZONES["farm"][j]); if((!help.match(/b/))&&(unsafeWindow.farmamount<Math.ceil(ALL_ZONES["farm"][j]/6))){ GM_log("Blocking zone because farmamount is too low: "+ALL_ZONES["farm"][j]); zones.setBlock(ALL_ZONES["farm"][j],help+"b"); } } zones.setBlock("windmill",USERLEVEL>=8?"":"l"); calcAllSlots(); calcTotalZones(); calcTotalAnimals(); zoneAddToGlobalTime=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valGlobalTimeAdd","{}"),"do_main/zoneAddToGlobalTime",{}); //TODO name change totalErnte=new Array(new Object(),new Object(),new Object()); // Value of products the farm currently produces totalFarmis=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_totalFarmis","[{},{}]"),"do_main/totalFarmis",[{},{}]); // Value of products the farmis want totalPowerups=new Object(); // Value of powerups creating products totalQuest=new Object(); // Value of products the quests need: totalQuest[questType][prodType][prodId]=amount totalRecursive=new Array(new Object(), new Object()); /* function findRecursiveNeededProducts(type,iProd,amount,addto){ //addto=new Array(new Object(), new Object()); if(prodRequire[type]&&prodRequire[type][iProd]){ //if(DEVMODE_FUNCTION){GM_log("Begin findRecursiveNeededProducts name:"+prodName[type][iProd]+" iProd:"+iProd+" amount:"+amount+" totalRecursive:"+implode(totalRecursive,"findRecursiveNeededProducts\totalRecursive"));} var help; for(var i in prodRequire[type][iProd]){ if (!prodRequire[type][iProd].hasOwnProperty(i)){ continue; } help=prodRequire[type][iProd][i]; if (help[0]==type&&help[1]==iProd){continue;} pAmount = Math.ceil((parseInt(help[2],10)*amount)/(prodYield[type][iProd]?prodYield[type][iProd]:1)); if(!addto){ if(!totalRecursive[help[0]][help[1]]){totalRecursive[help[0]][help[1]]=0;} totalRecursive[help[0]][help[1]]+=pAmount; }else{ if(!addto[help[0]][help[1]]){addto[help[0]][help[1]]=0;} addto[help[0]][help[1]]+=pAmount; } if(prodRequire[help[0]][help[1]]){//&&!(help[0]==type&&help[1]==iProd)){ findRecursiveNeededProducts(help[0],parseInt(help[1],10),pAmount,addto); } } help=null; //if(DEVMODE_FUNCTION){GM_log("End findRecursiveNeededProducts name:"+prodName[type][iProd]+" iProd:"+iProd+" amount:"+amount+" totalRecursive:"+implode(totalRecursive,"findRecursiveNeededProducts/totalRecursive"));} } } */ calcTotalPowerups(); // Value of active powerup for a field // currentPowerup[plantNr]=[time,+value,+points] var currentPowerup=new Object; function calcCurrentPowerup(){ try{ currentPowerup=new Object; if(unsafeWindow.poweruprack){ for(var i in unsafeWindow.poweruprack){ if(!unsafeWindow.poweruprack.hasOwnProperty(i)){continue;} var item=unsafeWindow.poweruprack[i]; if((item[5])&&(item["remain"]>0)){ if(item[5][1]){ currentPowerup[item[5][1][0]]=[item["remain"]+unsafeWindow.Zeit.Server,item[5][1][1],0]; var newdiv=$("powerupSymbol"+item["0"]); if(!newdiv){ newdiv=createElement("div",{"id":"powerupSymbol"+item["0"],"style":"position:relative;width:60px;height:87px;margin-bottom:5px;","end":item["remain"]+unsafeWindow.Zeit.Server},nodes["containerPowerupSymbols"]["node"]); newdiv.addEventListener("mouseover",function(event){ var end=parseInt(this.getAttribute("end"),10); var endDay=countDays(now,end); toolTip.show(event,(getText("day"+endDay)?getText("day"+endDay):(new Date(1000*end).toLocaleString()))+"<br>"+getDaytimeStr(end)); },false); createElement("img",{"src":GFX+"powerup2.png","border":"0"},newdiv); createElement("div",{"style":"position:absolute;top:3px;left:6px;","class":"kp"+item[5][1][0]},newdiv); createElement("div",{"style":"position:absolute;top:3px;left:22px;font-weight:bold;color:black;"},newdiv,"+"+item[5][1][1]); createElement("div",{"style":"position:absolute;top:64px;right:0;font-weight:bold;","class":"blackbox"},newdiv,getTimeStr(item["remain"])); } newdiv=null; } if(item[5][2]){ currentPowerup[item[5][2][0]]=[item["remain"]+unsafeWindow.Zeit.Server,0,item[5][2][1]]; var newdiv=$("powerupSymbol"+item["0"]); if(!newdiv){ newdiv=createElement("div",{"id":"powerupSymbol"+item["0"],"style":"position:relative;width:60px;height:87px;margin-bottom:5px;","end":item["remain"]+unsafeWindow.Zeit.Server},nodes["containerPowerupSymbols"]["node"]); newdiv.addEventListener("mouseover",function(event){ var end=parseInt(this.getAttribute("end"),10); var endDay=countDays(now,end); toolTip.show(event,(getText("day"+endDay)?getText("day"+endDay):(new Date(1000*end).toLocaleString()))+"<br>"+getDaytimeStr(end)); },false); createElement("img",{"src":GFX+"powerup3.png","border":"0"},newdiv); createElement("div",{"style":"position:absolute;top:3px;left:6px;","class":"kp"+item[5][2][0]},newdiv); createElement("div",{"style":"position:absolute;top:3px;left:22px;font-weight:bold;color:black;"},newdiv,"+"+item[5][2][1]); createElement("div",{"style":"position:absolute;top:64px;right:0;font-weight:bold;","class":"blackbox"},newdiv,getTimeStr(item["remain"])); } newdiv=null; } } } } unsafeData.currentPowerup=currentPowerup.clone(); }catch(err){ GM_logError("calcCurrentPowerup\n"+err); } } calcCurrentPowerup(); // powerup-data is updated // function isnt available anymore? unsafeOverwriteFunction("handlePowerups",function(page){ try{ unsafeWindow._handlePowerups(page); }catch(err){ GM_logError("_handlePowerups\n"+err); } try{ // GM_log("unsafeWindow.poweruprack:\n"+implode(unsafeWindow.poweruprack)); calcTotalPowerups(); updateProductDataPowerup(); window.setTimeout(saveProductData,0); raiseEvent("gamePoweruprackUpdated"); }catch(err){ GM_logError("handlePowerups\n"+err); } }); unsafeOverwriteFunction("activatePowerup",function(formula){ try{ unsafeWindow._activatePowerup(formula); }catch(err){ GM_logError("_activatePowerup\n"+err); } try{ document.addEventListener("gamePoweruprackUpdated",function(){ try{ calcCurrentPowerup(); for(var v=0;v<ALL_ZONES["farm"].length;v++){ zones.processProduction(ALL_ZONES["farm"][v]); } //TODO calcProdMinRack(); raiseEvent("gamePowerupActivated"); this.removeEventListener("gamePoweruprackUpdated",arguments.callee,false); }catch(err){ GM_logError("listener gamePoweruprackUpdated\n"+err); } },false); }catch(err){ GM_logError("activatePowerup\n"+err); } }); err_trace="valAutoWater"; valAutoWater=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valAutoWater"),"valAutoWater",null); // TODO set true when automat handles it if(valAutoWater==null){ valAutoWater={"farm":false,"forestry":true}; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valAutoWater",implode(valAutoWater,"valAutoWater")); } unsafeData.valAutoWater=valAutoWater; valWaterNeeded=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valWaterNeeded"),"valWaterNeeded",null); if(valWaterNeeded==null){ valWaterNeeded={"farm":true,"forestry":true}; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valWaterNeeded",implode(valWaterNeeded,"valWaterNeeded")); } unsafeData.valWaterNeeded=valWaterNeeded; valAssumeWater=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valAssumeWater"),"valAssumeWater",null); if(valAssumeWater==null){ valAssumeWater={"farm":true,"forestry":true}; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valAssumeWater",implode(valAssumeWater,"valAssumeWater")); } valAutoCrop=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valAutoCrop"),"valAutoCrop",null); if(valAutoCrop==null){ valAutoCrop={"farm":false,"forestry":true}; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valAutoCrop",implode(valAutoCrop,"valAutoCrop")); } unsafeData.valAutoCrop=valAutoCrop; valErnteMsg=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valErnteMsg",false); valLimitEmptyFields=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valLimitEmptyFields"),"valLimitEmptyFields",null); if(valLimitEmptyFields==null){ valLimitEmptyFields={"1":3,"fl1":0,"forest":1}; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valLimitEmptyFields",implode(valLimitEmptyFields,"valLimitEmptyFields")); } if(typeof GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valKauflimit",110)=="number"){ GM_deleteValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valKauflimit"); } valKauflimit=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valKauflimit","[[85,'990000'],110]"),"do_main/valKauflimit",[[85,'990000'],110]); valMessagesSystemMarkRead=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMessagesSystemMarkRead",true); valFoodworldFarmiPlacing=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valFoodworldFarmiPlacing",true); valStatistik=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valStatistik",true); // valClickErrorbox=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valClickErrorbox",false); valGlobaltimeShowCroppedZone=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valGlobaltimeShowCroppedZone"),"valGlobaltimeShowCroppedZone",null); if(!valGlobaltimeShowCroppedZone||(typeof valGlobaltimeShowCroppedZone!="object")||(valGlobaltimeShowCroppedZone instanceof Array)){ valGlobaltimeShowCroppedZone={"farm":true,"windmill":true,"forestry":true}; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valGlobaltimeShowCroppedZone",implode(valGlobaltimeShowCroppedZone,"valGlobaltimeShowCroppedZone")); } unsafeData.readyZone=new Object; unsafeData.zoneAddToGlobalTime=zoneAddToGlobalTime.clone(); // Werbung err_trace="Advertisement"; upjersAds=new Array(); for(var v in unsafeWindow.welcomeblurb){ if(!unsafeWindow.welcomeblurb.hasOwnProperty(v)){ continue; } if(v!="1"){ upjersAds.push(unsafeWindow.welcomeblurb[v]); delete unsafeWindow.welcomeblurb[v]; } } unsafeWindow.gclr(); newdiv=createElement("img",{"style":"position:absolute;top:0;right:0;height:15px;width:15px;","class":"link","src":GFX+"points.gif"},$("headercontainer")); newdiv.addEventListener("mouseover",function(event){ toolTip.show(event,getText("upjersAdvertising")); },false); newdiv.addEventListener("click",function(){ unsafeWindow.buildInfoPanel("upjersAds"); },false); $("notepad").style.zIndex=111; // Notizen on top unsafeWindow.shredderCommit = function(){return;}; // Schredder weg // Dragging err_trace="Dragging"; if(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valDrag",false)){ $("gameArea").style.position="absolute"; $("gameArea").style.top="5px"; $("gameArea").style.left="5px"; makeDraggable($("notepad")); makeDraggable($("divGame"),true,false); //makeDraggable("gardenmaincontainer"); //makeDraggable("innermaincontainer"); $("globaltransp").style.height="0"; //$("transp").style.height="0"; } // speedlinks err_trace="speedlinks"; if(unsafeWindow.premium!=1){ unsafeOverwriteFunction("speedLinks",function(){ try{ unsafeWindow._speedLinks(); }catch(err){GM_logError("_speedLinks\n"+err);} try{ // taken from game-js and modified to run without premium var err_trace="init"; if (!unsafeWindow.premium){ unsafeWindow.showDiv("farm_speedlinks"); var a = ["farm1", "farm2", "farm3", "farm4", "city1", "city2", "guild", "forestry", "foodworld"]; for (var b = 0; b <= a.length; b++) { if ($("speedlink_" + a[b])) { unsafeWindow.hideDiv($("speedlink_" + a[b])); $("speedlink_" + a[b]).className = "speedlink link speedlink_" + a[b]; $("speedlink_" + a[b]).onclick = new Function("") } } err_trace="farm"; for (var b = 1; b <= unsafeWindow.farmamount; b++) { if (unsafeWindow.farm == b) { $("speedlink_farm" + b).classList.remove("speedlink_farm" + b); $("speedlink_farm" + b).classList.add("speedlink_farm" + b + "_active") } unsafeWindow.showDiv("speedlink_farm" + b); $("speedlink_farm" + b).onclick = new Function("unsafeWindow.farm=" + b + "; unsafeWindow.farmMove(" + b + "); unsafeWindow.showMain();") } err_trace="city"; for (var b = 1; b <= 2; b++) { if (unsafeWindow.city == b) { $("speedlink_city" + b).classList.remove("speedlink_city" + b); $("speedlink_city" + b).classList.add("speedlink_city" + b + "_active") } unsafeWindow.showDiv("speedlink_city" + b); if(b == 1){ $("speedlink_city" + b).onclick = new Function("unsafeWindow.close_page();unsafeWindow.showDiv('transp3');unsafeWindow.initCity(1);"); }else{ $("speedlink_city" + b).onclick = new Function("unsafeWindow.travel2City2();") } if (b == 2 && unsafeWindow.currentuserlevel < 8) { unsafeWindow.hideDiv("speedlink_city" + b) } else { unsafeWindow.showDiv("speedlink_city" + b) } } err_trace="player_guild"; if (unsafeWindow.player_guild) { if (unsafeWindow.inguild) { $("speedlink_guild").classList.remove("speedlink_guild"); $("speedlink_guild").classList.add("speedlink_guild_active") } unsafeWindow.showDiv("speedlink_guild"); $("speedlink_guild").onclick = new Function("unsafeWindow.inguild=1; unsafeWindow.showMain(); unsafeWindow.initGuild();") } err_trace="forestry"; if (unsafeWindow.forestry_unlock == 1) { if (unsafeWindow.forestry_quicknavi) { $("speedlink_forestry").classList.remove("speedlink_forestry"); $("speedlink_forestry").classList.add("speedlink_forestry_active") } unsafeWindow.showDiv("speedlink_forestry"); $("speedlink_forestry").onclick = new Function("unsafeWindow.travel2forestry();") } err_trace="foodworld"; if (unsafeWindow.currentuserlevel >= 11) { if (unsafeWindow.foodworld_quicknavi) { $("speedlink_foodworld").classList.remove("speedlink_foodworld"); $("speedlink_foodworld").classList.add("speedlink_foodworld_active") } unsafeWindow.showDiv("speedlink_foodworld"); $("speedlink_foodworld").onclick = new Function("unsafeWindow.travel2foodworld();") } err_trace="newarea"; unsafeWindow.hideDiv("speedlink_farmersmarket"); if (unsafeWindow.farmersmarket_data) { unsafeWindow.showDiv("speedlink_farmersmarket"); $("speedlink_farmersmarket").onclick = new Function("unsafeWindow.travel2farmersmarket();") } } }catch(err){GM_logError("speedLinks ("+err_trace+")\n"+err);} }); unsafeWindow.speedLinks(); unsafeWindow.travel2City2 = function(){ try{ switch(gameLocation[0]){ case "city": unsafeWindow.initCity(2); break; case "forestry": case "foodworld": unsafeWindow.initCity(2,0,1); break; default:{ document.addEventListener("gameCity1",function(){ unsafeWindow.travel2City2(); document.removeEventListener("gameCity1",arguments.callee,false); },false); unsafeWindow.initCity(1); } } }catch(err){GM_logError("travel2City2\n"+err);} }; unsafeWindow.travel2forestry = function(){ try{ if((gameLocation[0]=="forestry")||((gameLocation[0]=="city")&&(gameLocation[1]==2))){ unsafeWindow.farm=0; unsafeWindow.city=0; unsafeWindow.forestry_quicknavi=1; unsafeWindow.initForestry(); }else{ document.addEventListener("gameCity2",function(){ unsafeWindow.travel2forestry(); document.removeEventListener("gameCity2",arguments.callee,false); },false); unsafeWindow.travel2City2(); } }catch(err){GM_logError("travel2forestry\n"+err);} }; unsafeWindow.travel2foodworld = function(){ try{ if((gameLocation[0]=="foodworld")||((gameLocation[0]=="city")&&(gameLocation[1]==2))){ unsafeWindow.farm=0; unsafeWindow.city=0; unsafeWindow.foodworld_quicknavi=1; unsafeWindow.foodworldAction('init'); }else{ document.addEventListener("gameCity2",function(){ unsafeWindow.travel2foodworld(); document.removeEventListener("gameCity2",arguments.callee,false); },false); unsafeWindow.travel2City2(); } }catch(err){GM_logError("travel2foodworld\n"+err);} }; unsafeWindow.travel2farmersmarket = function(){ try{ switch(gameLocation[0]){ case "farm": case "farmersmarket":{ unsafeWindow.farmMove(99); break;} case "city":{ document.addEventListener("gameFarmOpened",function(){ unsafeWindow.travel2farmersmarket(); document.removeEventListener("gameFarmOpened",arguments.callee,false); },false); unsafeWindow.showTravel2Farm(1); break;} default:{ document.addEventListener("gameCity2",function(){ unsafeWindow.travel2farmersmarket(); document.removeEventListener("gameCity2",arguments.callee,false); },false); unsafeWindow.initCity(2,0,1);; } } }catch(err){GM_logError("travel2farmersmarket\n"+err);} }; } // andere ServerAccounts err_trace="Other accounts on server"; var farmNamen=explode(GM_getValue(COUNTRY+"_"+SERVER+"_farmNamen","{}"),"do_main/farmNamen",{}); farmNamen[USERNAME]=FARMNAME; if(farmNamen[USERNAME].toLowerCase()!=USERNAME){ newdiv=createElement("div",{"class":"userinfositem link","style":"font-weight: bold;"}); newdiv.innerHTML="("+USERNAME+")"; newdiv1=$("userinfoscontainer"); newdiv1.insertBefore(newdiv,newdiv1.children[1]); } GM_setValue(COUNTRY+"_"+SERVER+"_farmNamen",implode(farmNamen)); var otherAccs=new Array(); function calcOtherAccs(){ try{ otherAccs=new Array(); var help=explode(GM_getValue("logindata","[]"),"do_main/logindata",[]); var help2; for(var v=0;v<help.length;v++){ if((help[v][4]) && (help[v][0]==COUNTRY) && (help[v][1]==SERVER)){ help2=[v,help[v][2],NEVER]; if(help2[1].toLowerCase()==USERNAME){ // this account help2[0]=-1; }else{ try{ help2[2]=GM_getValue(help[v][0]+"_"+help[v][1]+"_"+help[v][2].toLowerCase()+"_totalEndtime"); }catch(err){} } otherAccs.push(help2); } if(!farmNamen[help[v][2]]){ farmNamen[help[v][2]]=help[v][2]; } } }catch(err){GM_logError("calcOtherAccs\n"+err);} } calcOtherAccs(); function testOtherAccReady(){ try{ var found=null; for(var v=0;v<otherAccs.length;v++){ if(otherAccs[v][0]>-1){ if (otherAccs[v][2]+unsafeWindow.Zeit.Verschiebung<now){ found=v; break; } }} if(found!=null){ var cell=$("bubble_adtext"); if(!cell){ cell=$("sprcontent"); } cell.innerHTML=""; cell=createElement("a",{"id":"linkOtherAccReady","class":"link","dologin":otherAccs[found][0],"href":"#","style":"font-weight:bold;"},createElement("div",{"style":"height:50px;"},cell),farmNamen[otherAccs[found][1]]+" "+getText("finished").toLowerCase()+"!"); cell.addEventListener("click",function(){ try{ var dologin=parseInt(this.getAttribute("dologin"),10); window.setTimeout(function(dologin){ try{ var help=explode(GM_getValue(COUNTRY+"_pagedataLogin","{}"),"testOtherAccReady/pagedataLogin",{}); if(!(help["dologin"]&&(typeof help["dologin"]=="object"))){ help["dologin"]=new Object(); } help["dologin"][dologin]=true; GM_setValue(COUNTRY+"_pagedataLogin",implode(help)); if($("logoutbutton")){ click($("logoutbutton")); } else if(GAMEPAGES[COUNTRY]){ location.href="http://www."+GAMEPAGES[COUNTRY]+"/login.php?start=1"; } }catch(err){ GM_logError("listener linkOtherAccReady.click\n"+err); } },0,dologin); }catch(err){ GM_logError("listener linkOtherAccReady.click\n"+err); } },false); cell=null; raiseEvent("gameOtherAccReady"); }else{ window.setTimeout(testOtherAccReady,5000); } }catch(err){GM_logError("testOtherAccReady\n"+err);} } if (otherAccs.length>1){ newdiv=createElement("div",{"id":"divOtherAccountsTimes","class":"blackbox","style":"position:absolute;top:5px;right:150px;border:2px solid black;padding:2px;z-index:300;display:none;"},$("headercontainer")); newdiv.addEventListener("mouseout",function(){this.style.display="none";},false); newdiv.addEventListener("mouseover",function(){this.style.display="";},false); newdiv=createElement("div",{"style":"position:absolute;top:4px;right:220px;font-size:11px;color:#f7bb87;","class":"link"},$("headercontainer")); createElement("div",{"style":"display:inline-block;margin-bottom:2px;margin-right:2px;text-decoration:underline;vertical-align:top;font-size:11px;"},newdiv,getText("login")); newdiv1=createElement("div",{"style":"display:inline-block;"},newdiv); createElement("img",{"border":"0","src":GFX+"menu/logout.gif"},newdiv1); newdiv.addEventListener("mouseout",function(){$("divOtherAccountsTimes").style.display="none";},false); function fillDivOtherAccountsTimes(){ divOtherAccountsTimes=$("divOtherAccountsTimes"); if(divOtherAccountsTimes.style.display=="none"){ divOtherAccountsTimes.innerHTML=""; }else{ var newtable=createElement("table",{"cellspacing":"0"},newdiv); var newtr,newtd; for(var v=0;v<otherAccs.length;v++){ if(otherAccs[v][0]>-1){ newtr=createElement("tr",{"class":"link hoverBgCc9","dologin":otherAccs[v][0]},newtable); newtr.addEventListener("click",function(){ var dologin=parseInt(this.getAttribute("dologin"),10); window.setTimeout(function(dologin){ var help=explode(GM_getValue(COUNTRY+"_pagedataLogin","{}"),"fillDivOtherAccountsTimes/pagedataLogin",{}); if(!(help["dologin"]&&(typeof help["dologin"]=="object"))){ help["dologin"]=new Object(); } help["dologin"][dologin]=true; GM_setValue(COUNTRY+"_pagedataLogin",implode(help)); if($("logoutbutton")){ click($("logoutbutton")); } else if(GAMEPAGES[COUNTRY]){ location.href="http://www."+GAMEPAGES[COUNTRY]+"/login.php?start=1"; } },0,dologin); },false); }else{ newtr=createElement("tr",{"class":"fontWeightBold"},newtable); otherAccs[v][2]=totalEndtime; } createElement("td",{},newtr,farmNamen[otherAccs[v][1]]); newtd=createElement("td",{"style":"padding-left:5px;"},newtr); var help=unsafeWindow.Zeit.Verschiebung+otherAccs[v][2]; if (help>now){ newtd.innerHTML=getTimeStr(help-now); } else{ newtd.innerHTML=getText("finished").toLowerCase()+"!"; } } divOtherAccountsTimes.innerHTML=""; divOtherAccountsTimes.appendChild(newtable); newtable=null;newtr=null;newtd=null; window.setTimeout(fillDivOtherAccountsTimes,1000); } divOtherAccountsTimes=null; } newdiv.addEventListener("mouseover",function(){ $("divOtherAccountsTimes").style.display=""; fillDivOtherAccountsTimes(); },false); help=NEVER; for(var v=otherAccs.length-1;v>=0;v--){ if(otherAccs[v][0]>-1){ help=Math.min(help,otherAccs[v][2]); } } if(help<NEVER){ window.setTimeout(testOtherAccReady,Math.max(0,help+unsafeWindow.Zeit.Verschiebung-now)); } } // SessionEnd err_trace="SessionEnd"; //window.setTimeout('top.location.href="main.php?page=logout";','4457000'); in the gamepage function timerSessionEnd(sec){ try{ if(sec<1){ var help=explode(GM_getValue(COUNTRY+"_pagedataLogin","{}"),"timerSessionEnd/pagedataLogin",{}); if(!(help["doserver"]&&(typeof help["doserver"]=="object"))){ help["doserver"]=new Object(); } help["doserver"][SERVER]=true; GM_setValue(COUNTRY+"_pagedataLogin",implode(help)); if($("logoutbutton")){ click($("logoutbutton")); } else if(GAMEPAGES[COUNTRY]){ location.href="http://www."+GAMEPAGES[COUNTRY]+"/login.php?start=1"; } }else{ window.setTimeout(function(){ timerSessionEnd(sec-1); },1000); $("divSessionEndTime").innerHTML=getTimeStr(sec); } }catch(err){ GM_logError("timerSessionEnd\n"+err); } } var valSessionEndtime=null; if (unsafeWindow.logout_remain){ valSessionEndtime=Math.floor(now+unsafeWindow.logout_remain); window.setTimeout(function(){ var newdiv=createElement("div",{"id":"divSessionEnd","class":"alertbubble tbig link"},ALL,getText("relogin").replace(/%1%/,"<span id='divSessionEndTime'>0</span>")); newdiv.addEventListener("click",do_relogin,false); timerSessionEnd(Math.max(0,valSessionEndtime-now-30)); newdiv=null; raiseEvent("gameSessionEnds"); },Math.max(1,1000*unsafeWindow.logout_remain-getRandom(600000,1800000))); } // Statistik err_trace="Statistic"; if (STAT_SERVER[COUNTRY]){ function buildStatistik(mode){ try{ var modeDefault={"category":"c","npc":true,"showAll":false,"time":120}; var modeOld=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeStatistic"),"buildStatistik/modeOld"); if(typeof modeOld!="object"){ modeOld=modeDefault; } if(typeof mode!="object"){ mode=modeOld; } for(var v in modeDefault){ if(!modeDefault.hasOwnProperty(v)){ continue; } if(mode[v]==undefined){ mode[v]=(modeOld[v]==undefined?modeDefault[v]:modeOld[v]); } } GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeStatistic",implode(mode,"buildStatistik/mode")); var container=$("statisticArea"); container.innerHTML=""; // Header var newdiv=createElement("div",{"style":"position:fixed;width:90%;margin-left:5%;z-index:10;border:2px solid black;color:black;background-color:#ccf;"},container); var newselect=createElement("select",{"class":"link","style":"margin-right:20px;"},newdiv); createElement("option",{"value":"24"},newselect,getText("stat_days1")); createElement("option",{"value":"72"},newselect,getText("stat_days3")); createElement("option",{"value":"120"},newselect,getText("stat_days5")); createElement("option",{"value":"168"},newselect,getText("stat_days7")); newselect.value=mode["time"]; newselect.addEventListener("change",function(){ buildStatistik({"time":parseInt(this.value,10)}); },false); newselect=createElement("input",{"type":"checkbox","class":"link","checked":mode["npc"]},newdiv); newselect.addEventListener("click",function(){ buildStatistik({"npc":this.checked}); },false); createElement("span",{"style":"margin-right:20px;"},newdiv,getText("NPC")); newselect=createElement("input",{"type":"checkbox","class":"link","checked":mode["showAll"]},newdiv); newselect.addEventListener("click",function(){ buildStatistik({"showAll":this.checked}); },false); createElement("span",{"style":"margin-right:20px;"},newdiv,getText("showAll")); var help={}; for (var v=0;v<prodBlock[0].length;v++){ if(prodBlock[0][v]==undefined){ continue; } if((!prodBlock[0][v].match(/t/))&&(mode["showAll"]||!prodBlock[0][v].match(/[lq]/))){ help[prodTyp[0][v]]=true; } } newselect=createElement("select",{"class":"link","style":"margin-right:20px;"},newdiv); for(var v in help){ if(!help.hasOwnProperty(v)){ continue; } createElement("option",{"value":v},newselect,getText("category_"+v)); } newselect.value=mode["category"]; newselect.addEventListener("change",function(){ buildStatistik({"category":this.value}); },false); newselect=createElement("img",{"class":"link","src":GFX+"close.jpg","style":"position:absolute;top:8px;right:8px;width:20px;height:20px;"},newdiv); newselect.addEventListener("click",function(){ $("gameArea").style.display="block"; $("statisticArea").style.display="none"; $("statisticArea").innerHTML=""; },false); // Body newdiv=createElement("div",{"style":"overflow-y:auto;overflow-x:hidden;color:black;padding-top:30px;"},container); var newdiv1,newimg,newobject; for (var v=0;v<prodName[0].length;v++){ if(prodName[0][v]==undefined){ continue; } if ((prodTyp[0][v]==mode["category"])&&(!prodBlock[0][v].match(/t/))&&(mode["showAll"]||!prodBlock[0][v].match(/[lq]/))){ newdiv1=createElement("div",{"id":"stat"+v,"class":"link smallStatistic"},newdiv); if(prodBlock[0][v]){ createElement("div",{"style":"height:14px;font-weight:bold;color:red;"},newdiv1,prodName[0][v]+", "+moneyFormat(gut[v])); }else{ createElement("div",{"style":"height:14px;font-weight:bold;"},newdiv1,prodName[0][v]+", "+numberFormat(prodStock[0][v],0)+", "+moneyFormat(gut[v])+", "+moneyFormat(gutBeob[v])); } var url=STAT_SERVER[COUNTRY]+"/chart.php?w=400&h=200&t=h"+mode["time"]+"&shownpc="+(mode["npc"]?1:0)+"&clip=1&lng1="+COUNTRY+"&server1="+SERVER+"&product1="+v+"&color1=green"; newobject=createElement("object",{"data":url,"type":"type=image/svg+xml","width":"400px","height":"200px"},newdiv1); createElement("param",{"name":"src","value":url},newobject); createElement("div",{"class":"v"+v,"style":"position:absolute;bottom:10px;left:10px;z-index:2;"},newdiv1); createElement("div",{"style":"position:absolute;top:0;left:0;width:100%;height:100%;z-index:2;"},newdiv1); newdiv1.addEventListener("click",function(){ showStatisticFullscreen(this.id.replace("stat","")); },false); } } /* if (isNaN(mode)){ }else{ newdiv1=createElement("div",{"style":"margin:5px;"},newdiv); createElement("div",{"style":"font-weight:bold"},newdiv1,prodName[0][mode]+", "+numberFormat(prodStock[0][mode],0)+", "+moneyFormat(gut[mode])+", "+moneyFormat(gutBeob[mode])); var breit=(window.innerWidth-60); var hoch=(window.innerHeight-130); var url=STAT_SERVER[COUNTRY]+"/chart.php?w="+breit+"&h="+hoch+"&t=h"+mode["time"]+"&shownpc="+(mode["npc"]?1:0)+"&clip=1&lng1="+COUNTRY+"&server1="+SERVER+"&product1="+mode+"&color1=green"; newobject=createElement("object",{data:url,"type":type="image/svg+xml","width":breit+"px","height":hoch+"px"},newdiv1); createElement("param",{"name":"src","value":url},newobject); createElement("div",{"class":"v"+mode,"style":"position:relative;top:-40px;left:10px;z-index:2"},newdiv1); } */ newdiv1=null;newimg=null;newobject=null; container=null;newdiv=null;newselect=null;newselect=null; }catch(err){ GM_logError("buildStatistik\nmode="+implode(mode)+"\n"+err); } } function sendStatData (){ try{ if(STAT_SERVER[COUNTRY]){ var prodStr=""; var preisBeob=explode(GM_getValue(COUNTRY+"_"+SERVER+"_preisBeob","[]"),"sendStatData/preisBeob",[]); //isNotSent,time,min,max,amount var bChanged=false; if(!(preisBeob instanceof Array)){ preisBeob=new Array(); bChanged=true; } gutBeob=explode(GM_getValue(COUNTRY+"_"+SERVER+"_gutBeob","[]"),"sendStatData/gutBeob",[]); var c=0; var neededTime=now-300; // Data max 5min old for(var v=0;v<preisBeob.length;v++){ if(preisBeob[v] && preisBeob[v][0] && (neededTime<preisBeob[v][1]) && (0<preisBeob[v][2]) && (preisBeob[v][2]<=gutBeob[v]) && (gutBeob[v]<=preisBeob[v][3])){ prodStr += ',\"product'+(++c)+'\":{\"product_id\":'+v+',\"avg_price\":'+gutBeob[v]+',\"min_price\":'+preisBeob[v][2]+',\"max_price\":'+preisBeob[v][3]+'}'; preisBeob[v][0]=false; bChanged=true; } } if(bChanged){ GM_setValue2(COUNTRY+"_"+SERVER+"_preisBeob",implode(preisBeob),8); raiseEventTop("gameChangedBeobPrice"); } if (c>0){ logBubble.add(getText("sendingXObservedPricesToServer").replace(/%1%/,c)); // GM_log("sendStatData sending:\n" + STAT_SERVER[COUNTRY]+'/add.php?json={\"server\":'+SERVER+',\"COUNTRY\":'+COUNTRY+',\"productcount\":'+c+prodStr+'}') GM_xmlhttpRequest({ method: "POST", url: STAT_SERVER[COUNTRY]+"/add.php", data: 'json={\"server\":'+SERVER+',\"COUNTRY\":\"'+COUNTRY+'\",\"productcount\":'+c+prodStr+'}', headers: { "Content-Type": "application/x-www-form-urlencoded" }, onload: function(c){ return function(response){ try{ logBubble.add(getText("sendingXObservedPricesToServer").replace(/%1%/,c)+" "+response.responseText) }catch(err){GM_logError("sendStatData.onload\n"+err);} } }(c), onerror: function(response){ GM_logError("sendStatData.onerror\n"+response.responseText); }, timeout: function(response){ GM_logError("sendStatData.timeout\n"+response.responseText); } }); c=null; } } }catch(err){ GM_logError("sendStatData\n"+err); } } if(STAT_VIEW && STAT_VIEW[COUNTRY]){ newdiv=createElement("div",{"id":"divBeraterButtonsStatistic","class":"link beraterButtonIcon hoverBgGreen","mouseOverText":getText("stat_stats")},$("divBeraterButtons")); createElement("img",{"src":IMAGES["graph"],"style":"position:relative;top:2px;left:0;width:25px;height:25px;"},newdiv); newdiv.addEventListener("click",function(){ $("gameArea").style.display="none"; $("statisticArea").style.display="block"; buildStatistik(); },false); } if (valStatistik && STAT_SERVER && STAT_SERVER[COUNTRY]){ sendStatData(); window.setInterval(function (){ sendStatData(); },310000); } } err_trace="Rack bottom"; if(newdiv=$("canvassracklink")){ newdiv.style.height = "55px"; } if(newdiv=$("forumracklink")){ newdiv.style.height = "55px"; } if(newdiv=$("rackBottom")){ // Spieler suchen newinput=createElement("input",{"value":getText("searchPlayer"),"class":"text","style":"position:absolute;top:60px;left:125px;width:85px;background:transparent;border:1px solid black;"},newdiv); newinput.addEventListener("click",function(){this.value="";},false); newinput.addEventListener("blur",function(){this.value=getText("searchPlayer");},false); newinput.addEventListener("keyup",function(event){ try{ if (event.keyCode==13){ // showShopframePage("http://s"+SERVER+"."+GAMEPAGES[COUNTRY]+"/stadt/stats.php?search=1&searchterm="+this.value); } }catch(err){ GM_logError("listener searchPlayer.keyup\n"+err); } },false); // Farmpedia newinput=createElement("a",{"href":getText("farmpediaUrl"),"target":"_blank","style":"position:absolute;top:55px;left:100px;z-index:2;","class":"link"},newdiv); createElement("img",{"style":"width:25px;height:25px;border:none;","src":GFX+"points.gif"},newinput); newinput.addEventListener("mouseover",function(event){ toolTip.show(event,getText("farmpedia")); },false); } // InfoPanel err_trace="InfoPanel"; if (newdiv=$("speedlinks")){ newdiv.addEventListener("click",closeInfoPanel,false); } if (newdiv=$("cityline")){ newdiv.addEventListener("click",closeInfoPanel,false); } // Profit err_trace="Profit"; newdiv=createElement("div",{"id":"divBeraterButtonsProfit","class":"link beraterButtonIcon hoverBgGreen","mouseOverText":getText("profitTable")},$("divBeraterButtons")); createElement("img",{"src":GFX+"farmhouse/items/76_1.png","style":"position:relative;top:-5px;left:-5px;width:40px;height:40px;"},newdiv); newdiv.addEventListener("click",function(){ unsafeWindow.buildInfoPanel("profit"); },false); // Preise err_trace="Prices"; newdiv=createElement("div",{"id":"divBeraterButtonsPreise","class":"link beraterButtonIcon hoverBgGold","mouseOverText":getText("prices")},$("divBeraterButtons")); createElement("img",{"src":GFX+"money.gif","style":"width:30px;height:30px;"},newdiv); newdiv.addEventListener("click",function(){ unsafeWindow.buildInfoPanel("stock",{"page":1}); },false); // Recipes and Powerups err_trace="Recipes and Powerups"; if(unsafeWindow.formulas){ newdiv=createElement("div",{"id":"divBeraterButtonsFormulas","class":"link beraterButtonIcon hoverBgBlue","mouseOverText":getText("recipes")},$("divBeraterButtons")); createElement("img",{"src":GFX+"farmhouse/catalogue.gif","style":"position:relative;top:3px;left:0;width:24px;height:24px;"},newdiv); newdiv.addEventListener("click",function(){unsafeWindow.buildInfoPanel("formulas");},false); if(unsafeWindow.showPowerUps){ // hofix 13.03.2013 unsafeOverwriteFunction("showPowerUps",function(){ try{ unsafeWindow._showPowerUps(); }catch(err){GM_logError("_showPowerUps\n"+err);} try{ var cand=$("powerselectorcontent").getElementsByClassName("blackbox"); for(var v=0;v<cand.length;v++){ if(cand[v].id.match(/^formulatimer\d+$/)){ cand[v].style.top="47px"; } } cand=null; }catch(err){GM_logError("showPowerUps\n"+err);} }); unsafeWindow.showPowerUps(); } } // Uebersicht err_trace="Overview"; newdiv=$("titlepig"); if(!newdiv){ newdiv = createElement("div",{"id":"titlepig","style":"top:12px;left:218px;width:97px;height:100px;position:absolute;"},$("headercontainer")) }; newdiv.setAttribute("class","link"); newdiv.addEventListener("click",function(){ unsafeWindow.buildInfoPanel("zones"); },false); newdiv.addEventListener("mouseover",function(event){ toolTip.show(event,getText("overview")); },false); // Quest err_trace="Quest - MouseOver"; /* questdata={ "questid":quest number, "remain":seconds to the start, "data":{ "0":2, "1":{"0":{"prodId1":amountNeeded, "prodId2":{"prod2a":amountNeeded, "prod2a":amountNeeded}}, "1":0, "2":0, "3":0}, "2":{"0":points,"1":money,"2":0,"3":flagRack,"4":flagFarm","5":object,"6":0}, //Rewards "3":??, "4":??, "5":??, "6":"Short Description", "7":"Long Description", "8":waitingTime (before or after?), "9":??, "10":??}, "entries":{"prodId1":"amountGiven","prodId2":"amountGiven"}, "solved":0, "farmi":flagFarmiRewarded, "end":flagQuestsEnded} */ highlightProducts=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_highlightProducts","[false,{}]"),"do_main/highlightProducts",[false,{}]); for(var type in QUESTS){ if(!QUESTS.hasOwnProperty(type)){continue;} for(var campaign in QUESTS[type]){ if(!QUESTS[type].hasOwnProperty(campaign)){continue;} if(newdiv=$("quests_status_bar_"+type+campaign)){ newdiv.setAttribute("type",implode([type,campaign],"QuestStatusBar")); newdiv.addEventListener("mouseover",function(event){ var help=explode(this.getAttribute("type"),"QuestStatusBar"); toolTip.show(event,questLineMouseOver(help[0],help[1])); },false); } } } err_trace="Quest - BeraterButton"; newdiv=createElement("div",{"id":"divBeraterButtonsQuests","class":"link beraterButtonIcon hoverBgBlack","mouseOverText":getText("quests")},$("divBeraterButtons")); createElement("img",{"src":IMAGES["exclamationMark"],"style":"position:relative;top:4px;left:0;width:24px;height:24px;"},newdiv); newdiv.addEventListener("click",function(){unsafeWindow.buildInfoPanel("quests",null);},false); err_trace="Quest - Farmi amount bonus"; farmiDailyCount=6; for(var v=1;v<questData["main"]["1"]["nr"];v++){ if(QUESTS["main"]["1"][v]&&QUESTS["main"]["1"][v][3]){ for(var w=0;w<QUESTS["main"]["1"][v][3].length;w++){ if(QUESTS["main"]["1"][v][3][w][0]==5){ farmiDailyCount+=QUESTS["main"]["1"][v][3][w][1]; } } } } if(div=$("foodworld_questblock")){ div.removeAttribute("onclick"); } function calcQuestData(quTyp,campaign){ try{ var err_trace = "Set current data"; // Quest data if(QUESTS[quTyp][campaign][questData[quTyp][campaign]["nr"]]){ questData[quTyp][campaign]["data"]=QUESTS[quTyp][campaign][questData[quTyp][campaign]["nr"]].clone(); for(var i=questData[quTyp][campaign]["data"][0].length-1;i>=0;i--){ // Alternative: if product is already given, reduce to this one if(typeof questData[quTyp][campaign]["data"][0][i][0]=="object"){ for(var j=0;j<questData[quTyp][campaign]["data"][0][i].length;j++){ if(questData[quTyp][campaign]["given"][questData[quTyp][campaign]["data"][0][i][j][0]]&&questData[quTyp][campaign]["given"][questData[quTyp][campaign]["data"][0][i][j][0]][questData[quTyp][campaign]["data"][0][i][j][1]]){ questData[quTyp][campaign]["data"][0][i]=questData[quTyp][campaign]["data"][0][i][j]; } } } // Mark the cheapest items. important at alternatives if(typeof questData[quTyp][campaign]["data"][0][i][0]=="object"){ help=[]; for(var k=0;k<questData[quTyp][campaign]["data"][0][i].length;k++){ if(questData[quTyp][campaign]["data"][0][i][k][0]!=0){ help[k]=0; }else if(isNaN(NPC[questData[quTyp][campaign]["data"][0][i][k][0]][questData[quTyp][campaign]["data"][0][i][k][1]])){ help[k]=questData[quTyp][campaign]["data"][0][i][k][2]*gut[questData[quTyp][campaign]["data"][0][i][k][1]]; }else{ help[k]=questData[quTyp][campaign]["data"][0][i][k][2]*Math.min(gut[questData[quTyp][campaign]["data"][0][i][k][1]],NPC[questData[quTyp][campaign]["data"][0][i][k][0]][questData[quTyp][campaign]["data"][0][i][k][1]]); } questData[quTyp][campaign]["data"][0][i][k][3]=true; for(var l=0;l<k;l++){ if(help[k]<help[l]){ questData[quTyp][campaign]["data"][0][i][l][3]=false; } else { questData[quTyp][campaign]["data"][0][i][k][3]=false; } } } help=questData[quTyp][campaign]["data"][0].splice(i,1) questData[quTyp][campaign]["data"][0]=questData[quTyp][campaign]["data"][0].concat(help[0]); }else{ questData[quTyp][campaign]["data"][0][i][3]=true; } } }else{ questData[quTyp][campaign]["data"]=[]; } // GM_log("questData["+quTyp+"]["+campaign+"]="+implode(questData[quTyp][campaign])); // GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_questData",implode(questData)); // unsafeData.questData=questData.clone(); }catch(err){ GM_logError("calcQuestData ("+err_trace+")\n"+err); } } function handleQuestData(){ // GM_log("setQuest newQuestNr="+newQuestNr); try{ var err_trace = "Get questdata"; if(unsafeWindow.questdata){ // GM_log("unsafeWindow.questdata:\n"+print_r(unsafeWindow.questdata,"",true,"\n")); for(var campaign in QUESTS["main"]){ if(!QUESTS["main"].hasOwnProperty(campaign)){continue;} if(unsafeWindow.questdata[campaign]){ if(!questData["main"][campaign]){ questData["main"][campaign]=INIT_questData["main"][campaign].clone(); } if(unsafeWindow.questdata[campaign]["end"]&&(unsafeWindow.questdata[campaign]["end"]==1)){ questData["main"][campaign]["nr"]=QUESTS["main"][campaign].length; questData["main"][campaign]["given"] = new Object(); questData["main"][campaign]["time"] = 0; }else{ // if(!questData["main"][campaign]){continue;} // Quest number questData["main"][campaign]["nr"]=unsafeWindow.questdata[campaign]["questid"]; // Given questData["main"][campaign]["given"] = new Object(); if(unsafeWindow.questdata[campaign]["entries"]){ for(var t in unsafeWindow.questdata[campaign]["entries"]){ if(!unsafeWindow.questdata[campaign]["entries"].hasOwnProperty(t)){continue;} var prod = parseInt(t,10); var type = 0; if(!questData["main"][campaign]["given"][type]){ questData["main"][campaign]["given"][type] = new Object(); } if(!questData["main"][campaign]["given"][type][prod]){ questData["main"][campaign]["given"][type][prod] = 0; } questData["main"][campaign]["given"][type][prod] += parseInt(unsafeWindow.questdata[campaign]["entries"][t],10); } } // Time questData["main"][campaign]["time"] = now+unsafeWindow.questdata[campaign]["remain"]; } calcQuestData("main",campaign); } } // GM_log("questdata:\n"+print_r(questData["main"],"",true,"\n")); GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_questData",implode(questData)); unsafeData.questData=questData.clone(); } err_trace = "Calc highlightProducts"; if(highlightProducts[0]){ // TODO: For all quests. Not if all given. highlightProducts[1]={}; if(questData["main"]["1"]["data"]){ for(var j=0;j<questData["main"]["1"]["data"][0].length;j++){ if(questData["main"]["1"]["data"][0][j][3]){ highlightProducts[1][questData["main"]["1"]["data"][0][j][1]]=true; } } } GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_highlightProducts",implode(highlightProducts)); } handleQuestLine(); }catch(err){ GM_logError("handleQuestData ("+err_trace+")\n"+err); } } unsafeOverwriteFunction("questInitGo",function(response,mode,b,h,l){ try{ unsafeWindow._questInitGo(response,mode,b,h,l); }catch(err){GM_logError("_questInitGo\n"+err);} try{ handleQuestData(); }catch(err){GM_logError("questInitGo\n"+err);} }); function handleQuestDataFoodworld(){ // GM_log("setQuest newQuestNr="+newQuestNr); try{ var err_trace = "Get questdata"; if(unsafeWindow.foodworld_quest){ // GM_log("unsafeWindow.foodworld_quest:\n"+print_r(unsafeWindow.foodworld_quest,"",true,"\n")); if(!questData["foodworld"]){ questData["foodworld"]={}; } for(var campaign in QUESTS["foodworld"]){ if(!QUESTS["foodworld"].hasOwnProperty(campaign)){continue;} if(!questData["foodworld"][campaign]){ questData["foodworld"][campaign]=INIT_questData["foodworld"][campaign].clone(); } if(campaign==unsafeWindow.foodworld_quest["campaignid"]){ if(unsafeWindow.foodworld_quest["questid"]){ // Quest number questData["foodworld"][campaign]["nr"]=unsafeWindow.foodworld_quest["questid"]; // Given questData["foodworld"][campaign]["given"] = new Object(); if(unsafeWindow.foodworld_quest["entries"]){ for(var t in unsafeWindow.foodworld_quest["entries"]){ if(!unsafeWindow.foodworld_quest["entries"].hasOwnProperty(t)){continue;} var prod = parseInt(t,10); var type = 0; if(!questData["foodworld"][campaign]["given"][type]){ questData["foodworld"][campaign]["given"][type] = new Object(); } if(!questData["foodworld"][campaign]["given"][type][prod]){ questData["foodworld"][campaign]["given"][type][prod] = 0; } questData["foodworld"][campaign]["given"][type][prod] += parseInt(unsafeWindow.foodworld_quest["entries"][t],10); } } // Time questData["foodworld"][campaign]["time"] = now+unsafeWindow.foodworld_quest["remain"]; }else{ questData["foodworld"][campaign]["nr"]=QUESTS["foodworld"][campaign].length; questData["foodworld"][campaign]["given"] = new Object(); questData["foodworld"][campaign]["time"] = 0; } }else{ questData["foodworld"][campaign]["nr"]=QUESTS["foodworld"][campaign].length; questData["foodworld"][campaign]["given"] = new Object(); questData["foodworld"][campaign]["time"] = 0; } calcQuestData("foodworld",campaign); // GM_log("questdata:\n"+print_r(questData["foodworld"],"",true,"\n")); } GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_questData",implode(questData)); unsafeData.questData=questData.clone(); } div=null; }catch(err){ GM_logError("handleQuestData ("+err_trace+")\n"+err); } } // mouseover showing quest data function questLineMouseOver(questType,campaign){ try{ var container=createElement("div"); var questDataCurr = questData[questType][campaign]; var questCurr = QUESTS[questType][campaign][questDataCurr["nr"]]; var questStarted = (questDataCurr["time"]<now); var table=createElement("table",{"border":"0","cellspacing":"0","cellpadding":"3","style":"line-height:16px;"},container); var tr=createElement("tr",{},table); var td=createElement("td",{"colspan":"3","style":"text-align:center;border-bottom:1px solid black;font-weight:bold;"},tr,getText("quest"+questType+campaign)+"<br>"+getText("nr")+" "+questDataCurr["nr"]); if(questStarted){ createElement("td",{"colspan":"2","style":"text-align:center;border-bottom:1px solid black;border-left:1px solid black;"},tr,getText("given")); } createElement("td",{"colspan":"2","style":"text-align:center;border-bottom:1px solid black;border-left:1px solid black;"},tr,getText("missing")); createElement("td",{"colspan":"2","style":"text-align:center;border-bottom:1px solid black;border-left:1px solid black;"},tr,getText("total")); var sumWert=[0,0,0]; //given,needed,total var menge,item,preis; for(var v=0;v<questDataCurr["data"][0].length;v++){ item=questDataCurr["data"][0][v]; menge=[,,item[2]]; if(questStarted){ menge[0]=(questDataCurr["given"]&&questDataCurr["given"][item[0]]&&questDataCurr["given"][item[0]][item[1]])?questDataCurr["given"][item[0]][item[1]]:0; } else{ menge[0]=0; } menge[1]=Math.max(0,menge[2]-menge[0]-prodStock[item[0]][item[1]]); preis=null; if(item[0]==0){ preis=gut[item[1]]; if(!isNaN(NPC[item[0]][item[1]])){ preis=Math.min(preis,NPC[item[0]][item[1]]); } } tr=createElement("tr",{},table); if(!item[3]){ tr.style.textDecoration="line-through"; } td=createElement("td",{},tr); produktPic(item[0],item[1],td); createElement("td",{},tr,prodName[item[0]][item[1]]); createElement("td",{"style":"text-align:right;"},tr,numberFormat(100*(menge[2]-menge[1])/menge[2])+"%"); for(var i=0;i<3;i++){ if((i==0)&&(!questStarted)){ continue; } if(item[3]&&(preis!=null)){ sumWert[i] += menge[i]*preis; } createElement("td",{"style":"text-align:right;border-left:1px solid black;"},tr,numberFormat(menge[i])); createElement("td",{"style":"text-align:right;padding-left:10px;"},tr,preis!=null?moneyFormatInt(menge[i]*preis):"--"); } } tr=createElement("tr",{},table); createElement("td",{"colspan":"2","style":"border-top:1px solid black;"},tr); createElement("td",{"style":"text-align:right;border-top:1px solid black;"},tr,numberFormat(100*(sumWert[2]-sumWert[1])/(sumWert[2]))+"%"); for(var i=0;i<3;i++){ if((i==0)&&(!questStarted)){ continue; } createElement("td",{"style":"text-align:right;border-top:1px solid black;","colspan":"2"},tr,moneyFormatInt(sumWert[i])); } table=createElement("table",{"border":"0","cellspacing":"0","cellpadding":"3","style":"line-height:16px;"},container); tr=createElement("tr",{},table); createElement("td",{"style":"vertical-align:top;"},tr,getText("reward")+":"); td=createElement("td",{},tr); var div; if(questCurr[2]>0){ pointsFormat(questCurr[2],"div",td); } if(questCurr[3]){ for(var w=0;w<questCurr[3].length;w++){ switch(questCurr[3][w][0]){ case 0:{ createElement("div",{},td,moneyFormat(questCurr[3][w][1])); break;} case 1:{ div=createElement("div",{},td); produktPic(questCurr[3][w][1],questCurr[3][w][2],div); createElement("span",{},div,numberFormat(questCurr[3][w][3])+" "+prodName[questCurr[3][w][1]][questCurr[3][w][2]]); break;} case 2:{ createElement("div",{},td,getText("activation")+": "+getText("rackX").replace(/%1%/,questCurr[3][w][1])); break;} case 3:{ createElement("div",{},td,getText("activation")+": "+getText("farmX").replace(/%1%/,questCurr[3][w][1])); break;} case 4:{ div=createElement("div",{},td); produktPic(questCurr[3][w][1],questCurr[3][w][2],div); createElement("span",{},div,getText("productTimeSaving").replace(/%1%/,questCurr[3][w][3]).replace(/%2%/,prodName[questCurr[3][w][1]][questCurr[3][w][2]])); break;} case 5:{ div=createElement("div",{},td); createElement("img",{"src":GFX+"adbonus.gif","style":"border:0;height:15px;"},div); createElement("span",{},div,getText("additionalFarmi").replace(/%1%/,questCurr[3][w][1])); break;} case 6:{ createElement("div",{},td,getText("additionalLogCapacity").replace(/%1%/,questCurr[3][w][1])); break;} case 7:{ createElement("div",{},td,getText("waterBonus").replace(/%1%/,questCurr[3][w][1])); break;} case 8:{ if(DATA_zones[questCurr[3][w][1]]["location"]=="farm"){ createElement("div",{},td,getText("activation")+": "+getText("farmzone").replace(/%1%/,1+((questCurr[3][w][1]-1)%6)).replace(/%2%/,Math.ceil(questCurr[3][w][1]/6))); }else{ createElement("div",{},td,getText("activation")+": "+zones.getBuildingName(questCurr[3][w][1])); } break;} case 9:{ div=createElement("div",{},td); createElement("span",{},div,getText("activation")+": "); produktPic(questCurr[3][w][1],questCurr[3][w][2],div); createElement("span",{},div,prodName[questCurr[3][w][1]][questCurr[3][w][2]]); break;} case 10:{ createElement("div",{},td,getText("activation")+": "+getText("wateringFeature")); break;} case 11:{ div=createElement("div",{},td); createElement("img",{"src":GFX+"adbonus.gif","style":"border:0;height:15px;"},div); createElement("span",{},div,getText("additionalForestFarmiSlot").replace(/%1%/,questCurr[3][w][1])); break;} } } } tr=createElement("tr",{},table); createElement("td",{},tr,getText("start")+": "); createElement("td",{},tr,getDateText(questDataCurr["time"])+" "+getDaytimeStr(questDataCurr["time"])); div=null; table=null;tr=null;td=null; return container.innerHTML; }catch(err){ GM_logError("questLineMouseOver\n"+err); try{ switch(questType){ case "main":{ return (getText("informationIsMissing")+" "+getText("pleaseOpenX").replace(/%1%/,getText("quest"+questType+campaign))); break;} case "forestry":{ return (getText("informationIsMissing")+" "+getText("pleaseOpenX").replace(/%1%/,getText("lodge"))); break;} case "foodworld":{ return (getText("informationIsMissing")+" "+getText("pleaseOpenX").replace(/%1%/,getText("foodworld"))); break;} } }catch(err){} return null; } } unsafeOverwriteFunction("showQuestBox",function(c){ try{ unsafeWindow._showQuestBox(c); }catch(err){GM_logError("_showQuestBox\n"+err);} try{ var cand=$("questboxobjects").getElementsByClassName("questboxbarout"); for(var i=0;i<cand.length;i++){ var questWare = parseInt(cand[i].children[0].id.replace("questboxbarin",""),10); var menge = [0,0,0]; //given,stock,total for(var v in unsafeWindow.questdata[c]["data"][1][0]){ if(!unsafeWindow.questdata[c]["data"][1][0].hasOwnProperty(v)){ continue; } if(typeof unsafeWindow.questdata[c]["data"][1][0][v]=="object"){ if(unsafeWindow.questdata[c]["data"][1][0][v][questWare]){ menge[2] = unsafeWindow.questdata[c]["data"][1][0][v][questWare]; } }else{ if(v==questWare){ menge[2] = unsafeWindow.questdata[c]["data"][1][0][v]; } } } menge[0]=((unsafeWindow.questdata[c]["entries"]&&unsafeWindow.questdata[c]["entries"][questWare])?parseInt(unsafeWindow.questdata[c]["entries"][questWare],10):0); menge[1]=Math.min(menge[2]-menge[0],prodStock[0][questWare]); createElement("div",{"style":"width:"+Math.floor(200*menge[1]/menge[2])+"px;left:"+Math.floor(200*(menge[0])/menge[2])+"px;","class":"questboxbarinPoss"},cand[i]); // better number-formatting $("questboxobj"+questWare+"_current").innerHTML = numberFormat(menge[0]); $("questboxobj"+questWare+"_need").innerHTML = numberFormat(menge[2]); } }catch(err){ GM_logError("showQuestBox\n"+err); } }); unsafeOverwriteFunction("questsHandler",function(status){ try{ unsafeWindow._questsHandler(status); }catch(err){GM_logError("_questsHandler\n"+err);} try{ handleQuestLine(); }catch(err){GM_logError("questsHandler\n"+err);} }); /* todo: raiseEvent("gameQuestSolvable"); raiseEvent("gameQuestNewAvailable"); raiseEvent("gameQuestFinished"); raiseEvent("gameQuestAccepted"); */ unsafeOverwriteFunction("showQuestBoxLine",function(){ try{ unsafeWindow._showQuestBoxLine(); }catch(err){GM_logError("_showQuestBoxLine\n"+err);} try{ handleQuestLine(); }catch(err){GM_logError("showQuestBoxLine\n"+err);} }); function updateQuestLineTimer(){ try{ return false; for(var type in QUESTS){ if (!QUESTS.hasOwnProperty(type)){ continue; } if (type=="main"){ continue; } for(var campaign in QUESTS[type]){ if (!QUESTS[type].hasOwnProperty(campaign)){ continue; } if(nodes["questline_"+type+"_"+campaign]&&nodes["questline_"+type+"_"+campaign]["node"]){ if(now<questData[type][campaign]["time"]){ nodes["questline_"+type+"_"+campaign]["node"].children[1].innerHTML = getTimeStr(questData[type][campaign]["time"]-now,false)+" "+getText("shortHours"); }else{ handleQuestLine(); } } } } }catch(err){GM_logError("updateQuestLineTimer\ntype="+type+"\ncampaign="+campaign+"\n"+err);} } handleQuestData(); // --> handleQuestLine // SHOW RACK DATA err_trace="Show rack data"; function showDataAllProducts(){ try{ var container=createElement("div",{"style":"z-index:995;position:absolute;top:0;left:0;background-color:white;height:100%;"},ALL); var div=createElement("img",{"class":"link","src":GFX+"close.jpg","style":"position:absolute;top:0;right:0;width:20px;height:20px;margin:5px;"},container); div.addEventListener("click",function(){ removeElement(this.parentNode); },false); div=createElement("div",{"style":"height:100%;padding-right:20px;margin-right:30px;overflow:auto;"},container); var table=createElement("table",{"border":"1"},div); var tr,td,newDiv1; for(var type in prodName){ try{ if(!prodName.hasOwnProperty(type)){continue;} tr=createElement("tr",{"style":"background-color:orange;color:black;"},table); createElement("th",{"colspan":"16"},tr,type+": "+["farm","forestry","recipes","powerups"][type]); tr=createElement("tr",{"style":"background-color:orange;color:black;"},table); createElement("th",{"style":"white-space:nowrap;"},tr,"id"); createElement("th",{"style":"white-space:nowrap;"},tr,"Name"); createElement("th",{},tr,"Typ"); createElement("th",{},tr,"Stock"); createElement("th",{},tr,"MaxStock"); createElement("th",{},tr,"MinRack"); createElement("th",{},tr,"MinRackInit"); createElement("th",{},tr,"PlantSize"); createElement("th",{},tr,"Block"); createElement("th",{},tr,"Require"); createElement("th",{},tr,"Yield"); createElement("th",{},tr,"GrowTime"); createElement("th",{},tr,"Points"); createElement("th",{},tr,"NPC"); createElement("th",{},tr,"gut"); createElement("th",{},tr,"loc"); for(var v in prodName[type]){ try{ if(!prodName[type].hasOwnProperty(v)){continue;} tr=createElement("tr",{},table); createElement("td",{},tr,v); td=createElement("td",{"style":"white-space:nowrap;"},tr); produktPic(type,v,td); createElement("span",{},td,prodName[type][v]); td=createElement("td",{},tr,prodTyp[type][v]); td=createElement("td",{},tr,numberFormat(prodStock[type][v])); td=createElement("td",{},tr,numberFormat(prodStockMax[type][v])); td=createElement("td",{},tr,numberFormat(prodMinRack[type][v])); td=createElement("td",{},tr,numberFormat(prodMinRackInit[type][v])); td=createElement("td",{},tr,prodPlantSize[type][v]); td=createElement("td",{},tr,prodBlock[type][v]); td=createElement("td",{},tr); if(typeof prodRequire[type][v]=="object"){ for(var i=0;i<prodRequire[type][v].length;i++){ if(i>0){ createElement("div",{"style":"display:inline-block;white-space:nowrap;"},td,"; "); } if(prodRequire[type][v][i][0]>-1){ newDiv1=createElement("div",{"style":"display:inline-block;white-space:nowrap;","class":"hoverBgLightblue","prodType":prodRequire[type][v][i][0],"prodId":prodRequire[type][v][i][1]},td); newDiv1.addEventListener("mouseover",function(event){ toolTip.show(event,prodName[this.getAttribute("prodType")][this.getAttribute("prodId")]); //toolTip.show(event,prodName[parseInt(this.getAttribute("prodType"),10)][parseInt(this.getAttribute("prodId"),10)]); },false); produktPic(prodRequire[type][v][i][0],prodRequire[type][v][i][1],newDiv1); createElement("span",{},newDiv1,numberFormat(prodRequire[type][v][i][2])); }else{ newDiv1=createElement("div",{"style":"display:inline-block;white-space:nowrap;","class":"hoverBgLightblue"},td); createElement("span",{},newDiv1,moneyFormat(prodRequire[type][v][i][1])); } } } td=createElement("td",{},tr,prodYield[type][v]); td=createElement("td",{},tr,prodGrowTime[type][v]>0?getTimeStr(60*prodGrowTime[type][v],true):""); td=createElement("td",{},tr,prodPoints[type][v]==undefined?"-":numberFormat(prodPoints[type][v])); td=createElement("td",{},tr); if(!NPC[type][v]){ createElement("span",{},td,"-"); }else if(!isNaN(NPC[type][v])){ createElement("span",{},td,moneyFormat(NPC[type][v])); }else if (NPC[type][v].match(/^f/)){ createElement("span",{},td,"*"+moneyFormat(parseFloat(NPC[type][v].replace("f",""),10))); }else if (NPC[type][v].match(/^c/)){ coinsFormat(parseInt(NPC[type][v].replace("c",""),10),td); } td=createElement("td",{},tr,gut[v]==undefined||type>0?"-":moneyFormat(gut[v])); td=createElement("td",{},tr,PRODUCT2BUILDING[type][v]); }catch(err){ GM_logError("showDataAllProducts type="+type+" v="+v+"\n"+err); } } }catch(err){ GM_logError("showDataAllProducts type="+type+"\n"+err); } } container=null;div=null; table=null;tr=null;td=null;newDiv1=null; }catch(err){ GM_logError("showDataAllProducts\n"+err); } } GM_registerMenuCommand(getText("adviser")+" "+"Show Data: Products", showDataAllProducts); // SHOW ZONE DATA err_trace="Show zone data"; function showDataAllZones(){ try{ var prType,zoneNrS,allZones=[],currZoneType,help; var style=""; for(var i in ALL_ZONES){ if(!ALL_ZONES.hasOwnProperty(i)){ continue; } for(var j=0;j<ALL_ZONES[i].length;j++){ allZones.push(ALL_ZONES[i][j].toString()); if(zones.isMultiSlot(ALL_ZONES[i][j])){ for(var slot=1;slot<=3;slot++){ allZones.push(ALL_ZONES[i][j]+"."+slot); } } } } var container=createElement("div",{"style":"z-index:995;position:absolute;top:0;left:0;background-color:white;height:100%;"},ALL); var div=createElement("img",{"class":"link","src":GFX+"close.jpg","style":"position:absolute;top:0;right:0;width:20px;height:20px;margin:5px;"},container); div.addEventListener("click",function(){ removeElement(this.parentNode); },false); div=createElement("div",{"style":"height:100%;padding-right:20px;margin-right:30px;overflow:auto;"},container); var table=createElement("table",{"border":"1"},div); var tr=createElement("tr",{},table); var td=createElement("td",{},tr,"Nr"); createElement("td",{},tr,"Type(building,BUILDINGTYPE)"); createElement("td",{},tr,"Block"); createElement("td",{},tr,"AddToGlobalTime"); createElement("td",{},tr,"Animals"); createElement("td",{},tr,"Bonus"); createElement("td",{},tr,"BonusSpecial"); createElement("td",{},tr,"EndProduct"); createElement("td",{},tr,"EndTime"); createElement("td",{},tr,"WaterTime"); createElement("td",{},tr,"Ernte"); createElement("td",{},tr,"FieldData"); for(var i=0;i<allZones.length;i++){ try{ zoneNrS=allZones[i]; style="color:"+(zones.getBlock(zoneNrS)?"lightgrey;":"black;"); tr=createElement("tr",{},table); createElement("td",{"style":style},tr,zoneNrS); switch(zones.getLocation(zoneNrS).location){ case "windmill":{ prType=3; } break; case "forestry":{ prType=1; } break; default:{ prType=0; } } if(currZoneType=zones.getBuilding(zoneNrS)){ createElement("td",{"style":style},tr,getBuildingName(currZoneType)+" ("+currZoneType+","+BUILDINGTYPE[currZoneType]+")"); }else{ createElement("td",{"style":style},tr,""); } createElement("td",{"style":style},tr,zones.getBlock(zoneNrS)); createElement("td",{"style":style},tr,(isNaN(zoneNrS)?!!zoneAddToGlobalTime[zoneNrS]:true).toString()); createElement("td",{"style":style},tr,isNaN(zones.getAnimals(zoneNrS))?"":numberFormat(zones.getAnimals(zoneNrS))); createElement("td",{"style":style},tr,isNaN(zones.getBonus(zoneNrS))?"":(numberFormat(zones.getBonus(zoneNrS))+"%")); td=createElement("td",{"style":style},tr); if(zones.getBonusSpecial(zoneNrS)){ createElement("span",{},td,numberFormat(zones.getBonusSpecial(zoneNrS)[1])+"%"); produktPic(0,zones.getBonusSpecial(zoneNrS)[0],td); createElement("span",{},td,"("+numberFormat(zones.getBonusSpecial(zoneNrS)[0])+")"); } td=createElement("td",{"style":style},tr); if(help=zones.getEndproduct(zoneNrS)){ produktPic(prType,help,td); createElement("span",{},td,"("+prType+","+help+")"); } help=zones.getEndtime(zoneNrS); td=createElement("td",{"style":style+(help<now?"font-weight:bold;":"")},tr); if(help){ if(help==NEVER){ createElement("div",{},td,"NEVER"); } else { createElement("div",{},td,getDateText(help)); createElement("div",{},td,getDaytimeStr(help,false,true)); } } help=zones.getWatertime(zoneNrS); td=createElement("td",{"style":style+(help<now?"font-weight:bold;":"")},tr); if(help){ if(help==NEVER){ createElement("div",{},td,"NEVER"); } else { createElement("div",{},td,getDateText(help)); createElement("div",{},td,getDaytimeStr(help,false,true)); } } td=createElement("td",{"style":style},tr); if(help=zones.getCrop(zoneNrS)){ for(var j=0;j<help.length;j++){ div=createElement("div",{"style":"white-space:nowrap;"},td); produktPic(help[j][0],help[j][1],div); createElement("span",{},div,numberFormat(help[j][2])+"("); pointsFormat(help[j][3],"span",div); createElement("span",{},div,")"); } } td=createElement("td",{"style":style},tr); if(help=zones.getProduction(zoneNrS)){ createElement("div",{"style":"white-space:nowrap;"},td,print_r(help)); } }catch(err){ GM_logError("showDataAllZones row zoneNrS="+zoneNrS+"\n"+err); } } container=null;div=null; table=null;tr=null;td=null; }catch(err){ GM_logError("showDataAllZones\n"+err); } } GM_registerMenuCommand(getText("adviser")+" "+"Show Data: Zones", showDataAllZones); /* function showDataForestryFarmi(){ var div=createElement("div",{"style":"z-index:995;position:fixed;top:0;background-color:white;height:800px;overflow:auto;padding-right:40px;"},ALL); var newimg=createElement("img",{"class":"link","src":GFX+"close.jpg","style":"position:absolute;top:8px;right:0px;width:20px;height:20px;"},div); newimg.addEventListener("click",function(){ removeElement(this.parentNode); },false); var table=createElement("table",{"border":"1"},div); var tr=createElement("tr",{},table); createElement("td",{"style":"max-width:120px;"},tr,"ID"); for(var k in prodName[1]){ if(!prodName[1].hasOwnProperty(k)){continue;} if(k>=500){continue;} produktPic(1,k,createElement("td",{"style":"max-width:120px;"},tr)); } createElement("td",{"style":"max-width:120px;"},tr,"price"); createElement("td",{"style":"max-width:120px;"},tr,"points"); var tr=createElement("tr",{},table); createElement("td",{"style":"max-width:120px;"},tr,"ID"); for(var k in prodName[1]){ if(!prodName[1].hasOwnProperty(k)){continue;} if(k>=500){continue;} createElement("td",{"style":"max-width:120px;"},tr,k); } if(unsafeWindow.forestry_production_products.length>0){ var tr=createElement("tr",{},table); createElement("td",{"style":"max-width:120px;"},tr,"{1}"); for(var k in prodName[1]){ if(!prodName[1].hasOwnProperty(k)){continue;} if(k>=500){continue;} createElement("td",{"style":"max-width:120px;"},tr,unsafeWindow.forestry_production_products[prodTyp[1][k].replace("f","")][k]?unsafeWindow.forestry_production_products[prodTyp[1][k].replace("f","")][k][1]:"-"); } var tr=createElement("tr",{},table); createElement("td",{"style":"max-width:120px;"},tr,"{7}"); for(var k in prodName[1]){ if(!prodName[1].hasOwnProperty(k)){continue;} if(k>=500){continue;} createElement("td",{"style":"max-width:120px;"},tr,unsafeWindow.forestry_production_products[prodTyp[1][k].replace("f","")][k]?unsafeWindow.forestry_production_products[prodTyp[1][k].replace("f","")][k][7]:"-"); } } var farmies=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_forestry_farmies","{}"),"showDataForestryFarmi/forestry_farmies",{}); for(var v in farmies){ if(!farmies.hasOwnProperty(v)){continue;} tr=createElement("tr",{},table); createElement("td",{},tr,v); farmies[v]["products"].sort(function(a,b){return -1*((parseInt(b["product"],10)>parseInt(a["product"],10))-(parseInt(b["product"],10)<parseInt(a["product"],10)));}); for(var k in prodName[1]){ if(!prodName[1].hasOwnProperty(k)){continue;} if(k>=500){continue;} td=createElement("td",{"style":"white-space:nowrap;"},tr); for(var i in farmies[v]["products"]){ if(!farmies[v]["products"].hasOwnProperty(i)){continue;} if(farmies[v]["products"][i]["product"]==k){ createElement("span",{},td,farmies[v]["products"][i]["amount"]); //createElement("span",{},td," x "); //createElement("span",{},td,farmies[v]["products"][i]["product"]); produktPic(1,farmies[v]["products"][i]["product"],td); } } } createElement("td",{"style":"white-space:nowrap;"},tr,farmies[v]["price"]); createElement("td",{"style":"white-space:nowrap;"},tr,farmies[v]["points"]); } farmies=null; var tr=createElement("tr",{},table); createElement("td",{"style":"max-width:120px;"},tr,"ID"); for(var k in prodName[1]){ if(!prodName[1].hasOwnProperty(k)){continue;} if(k>=500){continue;} produktPic(1,k,createElement("td",{"style":"max-width:120px;"},tr)); } createElement("td",{"style":"max-width:120px;"},tr,"price"); createElement("td",{"style":"max-width:120px;"},tr,"points"); var tr=createElement("tr",{},table); createElement("td",{"style":"max-width:120px;"},tr,"ID"); for(var k in prodName[1]){ if(!prodName[1].hasOwnProperty(k)){continue;} if(k>=500){continue;} createElement("td",{"style":"max-width:120px;"},tr,k); } if(unsafeWindow.forestry_production_products.length>0){ var tr=createElement("tr",{},table); createElement("td",{"style":"max-width:120px;"},tr,"{1}"); for(var k in prodName[1]){ if(!prodName[1].hasOwnProperty(k)){continue;} if(k>=500){continue;} createElement("td",{"style":"max-width:120px;"},tr,unsafeWindow.forestry_production_products[prodTyp[1][k].replace("f","")][k]?unsafeWindow.forestry_production_products[prodTyp[1][k].replace("f","")][k][1]:"-"); } var tr=createElement("tr",{},table); createElement("td",{"style":"max-width:120px;"},tr,"{7}"); for(var k in prodName[1]){ if(!prodName[1].hasOwnProperty(k)){continue;} if(k>=500){continue;} createElement("td",{"style":"max-width:120px;"},tr,unsafeWindow.forestry_production_products[prodTyp[1][k].replace("f","")][k]?unsafeWindow.forestry_production_products[prodTyp[1][k].replace("f","")][k][7]:"-"); } } } GM_registerMenuCommand(getText("adviser")+" "+"Show Data: forestry Farmi", showDataForestryFarmi); */ // NPC-shop err_trace="NPC shop"; // TODO: function not existing anymore unsafeOverwriteFunction("shopDialog",function(e,d){ try{ unsafeWindow._shopDialog(e,d); }catch(err){GM_logError("_shopDialog\n"+err);} try{ $("shopdialog_amount").addEventListener("keyup",function(event){ try{ if (event.keyCode==13){ click(this.nextElementSibling); } }catch(err){ GM_logError("listener searchPlayer.keyup\n"+err); } },false); }catch(err){GM_logError("shopDialog\n"+err);} }); // Market err_trace="Market"; valKauflimit=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valKauflimit","[[85,'990000'],110]"),"do_main/valKauflimit",[[85,'990000'],110]); valKauflimitNPC=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valKauflimitNPC",true); highlightProducts=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_highlightProducts","[false,{}]"),"do_main/highlightProducts",[false,{}]); highlightUser=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_highlight","{}"),"do_main/highlightUser",{}); highlightUser[FARMNAME]="104e8b"; valNimmBeob=GM_getValue(COUNTRY+"_"+SERVER+"_valNimmBeob",false); valVerkaufLimitDown=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valVerkaufLimitDown",95); valVerkaufLimitUp=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valVerkaufLimitUp",130); valJoinPreise=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valJoinPreise",false); lastOffer=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_lastOffer","[]"),"do_main/lastOffer",[]); protectMinRack=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valProtectMinRack",false); ownMarketOffers=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_ownMarketOffers","[]"),"do_main/ownMarketOffers",[]); // var mode=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeMarket","cveoz"); function do_market(){ // GM_log("function do_market"); try{ var err_trace="Init"; // Berater Information Line err_trace="market_beraterline"; var market_beraterline=$("market_beraterline"); if(!market_beraterline){ market_beraterline=createElement("div",{"id":"market_beraterline","style":"position:absolute;width:630px;height:40px;bottom:-40px;padding:0 20px 20px 20px;background:url('"+GFX+"market/market_back.jpg') repeat scroll 0px -470px transparent;"},$("market")); } market_beraterline.innerHTML=""; for(var i=0;i<7;i++){ createElement("div",{"style":"float:left;height:40px;width:90px;"},market_beraterline); } // loadProductData(); var candtable; //document.getElementsByTagName("table"); var candtr; //candtable[0].getElementsByTagName("tr"); var row,row_title,canddiv,canda,candtd,newa,newinput,newspan,newdiv,newdiv1; /* var marktButtons=new Array(); marktButtons[0]=document.querySelector('div[onclick*="\'marktstand.php\'"]'); // market stall marktButtons[1]=document.querySelector('div[onclick*="\'markt.php?filter=1&guild=1\'"]'); // club offers marktButtons[2]=document.querySelector('div[onclick*="\'markt.php?show=overview\'"]'); // overview marktButtons[3]=document.querySelector('div[onclick*="\'markt.php\'"]'); // current offers for(var v=0;v<marktButtons.length;v++){ if(marktButtons[v]){ marktButtons[v].setAttribute("class","link hoverBlack"); marktButtons[v].id="marketButton_"+["marktstand","guild","overview","current"][v]; } } */ /* // Market mode newdiv=createElement("div",{"id":"offertypeselector","style":"position:absolute;top:0;left:500px;-moz-user-select:none;"},ALL); newdiv.addEventListener("mouseover",function(event){ var mouseOverText=event.target.getAttribute("mouseOverText"); if(mouseOverText){ mouseOverText='<div>'+getText("click")+' / '+getText("clickCtrl")+'</div><div>'+mouseOverText+'</div>'; toolTip.show(event,mouseOverText); } },false); var newdiv1=createElement("div",{"mouseOverText":getText("category_v"),"class":"link","style":"display:inline-block;height:20px;width:26px;background:url('"+GFX+"racksort2.jpg') repeat scroll -10px 0px transparent;"},newdiv); if (mode.match(/v/)){ newdiv1.style.backgroundPosition="-10px -20px"; }else{ newdiv1.addEventListener("mouseout",function(){this.style.backgroundPosition="-10px 0px";},false); newdiv1.addEventListener("mouseover",function(){this.style.backgroundPosition="-10px -20px";},false); } newdiv1.addEventListener("click",function(event){ if(event.ctrlKey){ if(mode.match(/v/)){mode=mode.replace(/v/,"");} else{mode += "v";}} else{mode="v";} GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeMarket",mode); location.href=location.href; },false); newdiv1=createElement("div",{"mouseOverText":getText("category_c")+"<br>"+getText("category_e"),"class":"link","style":"display:inline-block;height:20px;width:26px;background:url('"+GFX+"racksort2.jpg') repeat scroll -62px 0px transparent;"},newdiv); if (mode.match(/c/)&&mode.match(/e/)){ newdiv1.style.backgroundPosition="-62px -20px"; }else{ newdiv1.addEventListener("mouseout",function(){this.style.backgroundPosition="-62px 0px";},false); newdiv1.addEventListener("mouseover",function(){this.style.backgroundPosition="-62px -20px";},false); } newdiv1.addEventListener("click",function(event){ if(event.ctrlKey){ if(mode.match(/ce/)){mode=mode.replace(/ce/,"");} else{mode += "ce";}} else{mode="ce";} GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeMarket",mode); location.href=location.href; },false); newdiv1=createElement("div",{"mouseOverText":getText("category_o"),"class":"link","style":"display:inline-block;height:20px;width:26px;background:url('"+GFX+"racksort2.jpg') repeat scroll -62px 0px transparent;"},newdiv); if (mode.match(/o/)&&mode.match(/o/)){ newdiv1.style.backgroundPosition="-62px -20px"; }else{ newdiv1.addEventListener("mouseout",function(){this.style.backgroundPosition="-62px 0px";},false); newdiv1.addEventListener("mouseover",function(){this.style.backgroundPosition="-62px -20px";},false); } newdiv1.addEventListener("click",function(event){ if(event.ctrlKey){ if(mode.match(/o/)){mode=mode.replace(/o/,"");} else{mode += "o";}} else{mode="o";} GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeMarket",mode); location.href=location.href; },false); newdiv1=createElement("div",{"mouseOverText":getText("category_z"),"class":"link","style":"display:inline-block;height:20px;width:26px;background:url('"+GFX+"racksort2.jpg') repeat scroll -36px 0px transparent;"},newdiv); if (mode.match(/z/)){ newdiv1.style.backgroundPosition="-36px -20px"; }else{ newdiv1.addEventListener("mouseout",function(){this.style.backgroundPosition="-36px 0px";},false); newdiv1.addEventListener("mouseover",function(){this.style.backgroundPosition="-36px -20px";},false); } newdiv1.addEventListener("click",function(event){ if(event.ctrlKey){ if(mode.match(/z/)){mode=mode.replace(/z/,"");} else{mode += "z";}} else{mode="z";} GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_modeMarket",mode); location.href=location.href; },false); */ var pageId=unsafeWindow.market_filter_pid; var userId=unsafeWindow.market_filter_name; var marktoffers_rows=$("marktoffers_rows"); if(unsafeWindow.market_filter_own==0){ // Market page err_trace="Market page"; var nothingToBuy=true; // Page of a single product if((pageId!=-1)&&(userId=="")&&(unsafeWindow.market_guild_filter==0)){ err_trace="Market page, single product"; var preisKlasse=0; // $("offertypeselector").style.display="none"; newdiv1=createElement("div",{"prod":pageId},market_beraterline.children[0]); newdiv1.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.getAttribute("prod")); },false); produktPic(0,pageId,newdiv1); newspan=createElement("div",{"style":"display:inline-block;"},newdiv1,numberFormat(prodStock[0][pageId],0)); // NPC price newdiv1=createElement("div",{},market_beraterline.children[0]); err_trace="Market page, single product, NPC"; if(NPC[0][pageId]){ if(!isNaN(NPC[0][pageId])){ newspan=createElement("span",{},newdiv1,"NPC "+numberFormat(NPC[0][pageId],2)); }else if (NPC[0][pageId].match(/^f/)){ newspan=createElement("span",{},newdiv1,"*NPC* "+numberFormat(parseFloat(NPC[0][pageId].replace("f",""),10),2)); }else if (NPC[0][pageId].match(/^c/)){ newspan=createElement("span",{},newdiv1,"NPC <span style='display:inline-block;vertical-align:bottom;'>"+coinsFormat(parseInt(NPC[0][pageId].replace("c",""),10)).innerHTML+"</span>"); //coinsFormat(parseInt(NPC[0][pageId].replace("c",""),10),newdiv).style.cssFloat="right"; } if((npcSaison[pageId]!=undefined)&&(!npcSaison[pageId])){ newspan.style.textDecoration="line-through"; newspan.setAttribute("class","hoverNoTextDecoration"); } }else{ createElement("span",{},newdiv1,"NPC --"); } // Link to previous/next product err_trace="Market page, single product, prev/next"; var c=0; while ((c<prodNameSort[0].length)&&(prodNameSort[0][c]!=pageId)){ c++; } var pageIdVor=c-1; if(pageIdVor<0){ pageIdVor+=prodNameSort[0].length; } while(prodBlock[0][prodNameSort[0][pageIdVor]].match(/t/)||prodBlock[0][prodNameSort[0][pageIdVor]].match(/l/)){ pageIdVor--; if(pageIdVor<0){ pageIdVor+=prodNameSort[0].length; } } pageIdVor=prodNameSort[0][pageIdVor]; var pageIdNach=c+1; if(pageIdNach>prodNameSort[0].length-1){ pageIdNach=0; } while(prodBlock[0][prodNameSort[0][pageIdNach]].match(/t/)||prodBlock[0][prodNameSort[0][pageIdNach]].match(/l/)){ pageIdNach++; if(pageIdNach>prodNameSort[0].length-1){ pageIdNach=0; } } pageIdNach=prodNameSort[0][pageIdNach]; newdiv1=createElement("div",{},market_beraterline.children[0]); newspan=createElement("div",{"class":"link2","style":"display:inline-block;padding-right:2px;","prod":pageIdVor},newdiv1,"<<"); newspan.addEventListener("click",function(event){ showMarket(this.getAttribute("prod")); },false); newspan.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.getAttribute("prod")); },false); newspan=createElement("div",{"class":"link2","style":"display:inline-block;","prod":pageIdNach},newdiv1,">>"); newspan.addEventListener("click",function(event){ showMarket(this.getAttribute("prod")); },false); newspan.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.getAttribute("prod")); },false); // Total amount of all offers // newtd=createElement("td",{"align":"right","style":"border-top:1px solid;"}); // newtd.innerHTML=numberFormat(sumTotal,0); // candtr[candtr.length-1].insertBefore(newtd,candtr[candtr.length-1].firstElementChild); // Set price field err_trace="Market page, single product, set price"; newdiv1=createElement("div",{},market_beraterline.children[1]); newinput=createElement("input",{"id":"marketButton_price","value":numberFormat(gut[pageId],2),"class":"text","maxlength":"10","style":"width:65px;text-align:right;background-color:#589456;"},newdiv1); newinput.addEventListener("mouseover",function(event){ toolTip.show(event,getText("price")+"<br>"+getText("observed")+": "+moneyFormat(gutBeob[pageId])); },false); if(valNimmBeob){ newinput.readOnly=true; }else{ newinput.addEventListener("focus",function(){ this.style.backgroundColor="white"; unsafeWindow.clearMarketTimer(); },false); newinput.addEventListener("blur",function(){ this.style.backgroundColor="#589456"; if(!unsafeWindow.market_timer['update']){ unsafeWindow.market_timer['update'] = unsafeWindow.setInterval("marketTimer()",1000); } },false); newinput.addEventListener("change",function(){ var currId=unsafeWindow.market_filter_pid; var preis=Math.max(0,parseFloat(this.value.replace(regDelimThou,"").replace(regDelimDeci,"."),10)); var thisNode=this; var yesFkt = function(){ gut[currId]=preis; GM_setValueCache(COUNTRY+"_"+SERVER+"_gut",implode(gut)); raiseEventTop("gameChangedGut"); unsafeWindow.showOffers(); if(!unsafeWindow.market_timer['update']){ unsafeWindow.market_timer['update'] = unsafeWindow.setInterval("marketTimer()",1000); } }; var noFkt = function(){ thisNode.value=numberFormat(gut[currId],2); thisNode=null; }; if(preis==0){ alert2(getText("alertSetPriceNone").replace(/%PRODUCT%/,prodName[0][currId]),getText("yes"),getText("no"),yesFkt,noFkt); }else if((!isNaN(NPC[0][currId]))&&(preis>NPC[0][currId])){ alert2(getText("alertSetPriceOverNPC").replace(/%PRODUCT%/,prodName[0][currId]).replace(/%PRICE%/,moneyFormat(preis)).replace(/%NPC%/,moneyFormat(NPC[0][currId])),getText("yes"),getText("no"),yesFkt,noFkt); }else if ((gutBeob[currId]!=undefined)&&(gutBeob[currId]>0)){ if(preis<0.7*gutBeob[currId]){ alert2(getText("alertSetPriceUnderObs").replace(/%PRODUCT%/,prodName[0][currId]).replace(/%PRICE%/,moneyFormat(preis)).replace(/%OBS%/,moneyFormat(gutBeob[currId])),getText("yes"),getText("no"),yesFkt,noFkt); }else if (1.3*gutBeob[currId]<preis){ alert2(getText("alertSetPriceOverObs").replace(/%PRODUCT%/,prodName[0][currId]).replace(/%PRICE%/,moneyFormat(preis)).replace(/%OBS%/,moneyFormat(gutBeob[currId])),getText("yes"),getText("no"),yesFkt,noFkt); }else{ yesFkt(); } }else{ yesFkt(); } },false); } // Statistic server err_trace="Market page, single product, Statistic"; if (STAT_VIEW && STAT_VIEW[COUNTRY]){ newdiv1=createElement("div",{"id":"marketButton_stats","class":"link2 hoverBlack","style":"position:relative;width:80px;height:40px;background: url('"+GFX+"stadt/uebersicht.gif') repeat scroll 0% 0% transparent;"},market_beraterline.children[2]); createElement("div",{"style":"position:absolute;top:13px;width:80px;font-weight:bold;text-align:center;"},newdiv1,getText("statistics")); newdiv1.addEventListener("click",function(){ showStatisticFullscreen(unsafeWindow.market_filter_pid); },false); } }else{ var preisKlasse=2; } if(pageId!=-1){ //Link to NPC-Shop err_trace="Link to NPC"; if(nothingToBuy && (unsafeWindow.marketlist_currentpage==1) && (prodTyp[0][pageId]=="v") && $top("shop")){ newdiv1=createElement("div",{"id":"marketButton_npc","class":"link2 hoverBlack","style":"position:relative;width:80px;height:40px;background: url('"+GFX+"stadt/uebersicht.gif') repeat scroll 0 0 transparent;"},market_beraterline.children[3]); createElement("div",{"style":"position:absolute;top:13px;width:80px;font-weight:bold;text-align:center;"},newdiv1,getText("SGH")); newdiv1.addEventListener("click",showSGH,false); } } // Page of a single user /* if(userId!=""){ canda=candtr[3].getElementsByTagName("a"); if(canda[1]){ var thisUser=canda[1].innerHTML; } newtr=createElement("tr",{},candtable[0]); newtd=createElement("td",{},newtr); if (thisUser){igm(thisUser,newtd);} stats(userId,newtd); } */ } // Redesign of table err_trace="Redesign"; var currId, currOffer, time, sum=[0,0]; for(var v=0;v<marktoffers_rows.childElementCount;v++){ err_trace="Redesign, row "+v; row=marktoffers_rows.children[v]; if(row.childElementCount<6){ continue; } currId=/market_price_tt(\d+)/.exec(row.children[2].getAttribute("onmouseover"))[1]; currOffer=null; for(var i=0;i<unsafeWindow.market_offers.length;i++){ if(currId==unsafeWindow.market_offers[i].id){ currOffer=unsafeWindow.market_offers[i]; break; } } if(!currOffer){ continue; } row.children[3].removeAttribute("onmouseover"); row_title=$("market_amount_tt"+currOffer["id"]); help=createElement("div",{},false,row_title.innerHTML); row_title.innerHTML=""; row_title.appendChild(help); // TODO(Seberoth): What is time now? if(currOffer["zeit"]){ time=parseInt(currOffer["zeit"],10)+0; if(countDays(time,now)==0){ createElement("div",{},row_title,getText("sinceX").replace(/%1%/,getDaytimeStr(time,false,true)+" "+getText("shortOClock"))); }else{ createElement("div",{},row_title,getText("sinceX").replace(/%1%/,getFormattedDateStr(time,2,false)+", "+getDaytimeStr(time,false,true)+" "+getText("shortOClock"))); } } var prodId=parseInt(currOffer["p"],10); var menge=parseInt(currOffer["a"],10); var preis=parseFloat(currOffer["pr"],10); if((pageId!=-1)&&(userId=="")&&(unsafeWindow.market_guild_filter==0)){ createElement("div",{},row_title,getText("above")+": "+numberFormat(sum[0])); } sum[0] += menge; sum[1] += menge*preis; row.children[2].innerHTML=numberFormat(preis,2); row.setAttribute("offerId",currOffer["id"]); //GutPreis zeigen newdiv=createElement("div",{},false,numberFormat(gut[prodId],2)); row.insertBefore(newdiv,row.children[6]); // own offers if((unsafeWindow.market_filter_own==0)&&(currOffer["s"])){ row.children[5].setAttribute("class","market_buy market_noicon"); row.children[5].setAttribute("onclick",""); } if(NPC[0][prodId]&&((npcSaison[prodId]==undefined)||(npcSaison[prodId]))&&(preis>=NPC[0][prodId])){ if(preisKlasse<1){ preisKlasse++; row.style.borderTop="2px solid white"; } if(valKauflimitNPC&&row.children[5]){ //zu teuer Link entfernen (NPC) if(unsafeWindow.market_filter_own==0){ row.children[5].setAttribute("class","market_buy market_noicon"); row.children[5].setAttribute("onclick",""); } createElement("div",{},row_title,getText("overNPCprice")+" ("+numberFormat(NPC[0][prodId],2)+")"); } row.style.opacity="0.5"; row.children[5].style.fontStyle="italic"; if (0.9*preis>NPC[0][prodId]){ //111% NPC row.style.fontStyle="italic"; if(preisKlasse<2){ preisKlasse++; row.style.borderTop="2px dashed white"; } } }else if(gut[prodId]!=0){ var help=100*preis/gut[prodId]; if(help<=valKauflimit[0][0]){ if(row.children[5]){ row.children[5].style.backgroundColor="#"+valKauflimit[0][1]; } //billig Angebot highlight }else if(help>valKauflimit[1]){ //zu teuer Link entfernen (Limit) if(row.children[5]){ if(unsafeWindow.market_filter_own==0){ row.children[5].setAttribute("class","market_buy market_noicon"); row.children[5].setAttribute("onclick",""); } createElement("div",{},row_title,getText("overX").replace(/%1%/,valKauflimit[1]+"%")); } row.style.opacity="0.7"; } } if(row.children[5].getAttribute("class").search(/market_noicon/)==-1){ nothingToBuy=false; } if (row.children[4].children[0]&&(highlightUser[row.children[4].children[0].innerHTML.replace(/[ ]\[.*\]/,"")])){ row.children[4].children[0].style.backgroundColor="#"+highlightUser[row.children[4].children[0].innerHTML.replace(/[ ]\[.*\]/,"")]; } if (highlightProducts[1][prodId]){ row.children[1].style.backgroundColor="#20b2aa"; } row.addEventListener("mouseover",function(event){ toolTip.show(event,$("market_amount_tt"+this.getAttribute("offerId")).innerHTML); },false); } if((unsafeWindow.market_filter_own==1)&&(userId=="")&&(unsafeWindow.market_guild_filter==0)){ createElement("div",{},market_beraterline.children[0],sign_sum+" "+moneyFormatLimit(sum[1],100000)); } // No offers if(sum[0]==0){ // Page of a single product if((unsafeWindow.market_filter_own==0)&&(pageId!=-1)&&(userId=="")&&(unsafeWindow.market_guild_filter==0)){ newdiv=createElement("div",{"style":"padding:2px;"},marktoffers_rows); createElement("div",{"style":"float:left;","class":"kp"+pageId},newdiv); createElement("div",{"onclick":"market_filter_name=''; market_filter_pid="+pageId+"; showOffers();","class":"market_product underline link","title":prodName[0][pageId]},newdiv,prodName[0][pageId]); if(NPC[0][pageId]){ if((npcSaison[pageId]!=undefined)&&(!npcSaison[pageId])){ createElement("div",{"class":"market_price"},newdiv); createElement("div",{"class":"market_amount"},newdiv); createElement("div",{"class":"market_seller"},newdiv); }else if(!isNaN(NPC[0][pageId])){ createElement("div",{"class":"market_price"},newdiv,numberFormat(NPC[0][pageId],2)); createElement("div",{"class":"market_amount"},newdiv,"0"); newdiv1=createElement("div",{"class":"market_seller"},newdiv); createElement("span",{},newdiv1,"NPC"); }else if (NPC[0][pageId].match(/^f/)){ createElement("div",{"class":"market_price"},newdiv,numberFormat(3*parseFloat(NPC[0][pageId].replace("f",""),10),2)); createElement("div",{"class":"market_amount"},newdiv,"0"); newdiv1=createElement("div",{"class":"market_seller"},newdiv); createElement("span",{},newdiv1,"*NPC*"); }else{ createElement("div",{"class":"market_price"},newdiv); createElement("div",{"class":"market_amount"},newdiv); createElement("div",{"class":"market_seller"},newdiv); } }else{ createElement("div",{"class":"market_price"},newdiv); createElement("div",{"class":"market_amount"},newdiv); createElement("div",{"class":"market_seller"},newdiv); } } } marktoffers_rows=null; // Buttons err_trace="buttons"; /* newdiv=createElement("div",{"id":"marketButton_current","class":"link hoverBlack","style":"position:absolute;top:475px;left:545px;width:80px;height:40px;font-size:8pt;background: url('"+GFX+"stadt/uebersicht.gif') repeat scroll 0% 0% transparent;"},ALL); newdiv.addEventListener("click",function(){showMarket();},false); createElement("div",{"style":"position:absolute;top:7px;left:7px;width:67px;color:white;font-weight: bold;"},newdiv,getText("currentOffers")); */ newdiv1=createElement("div",{"id":"marketButton_tablePrices","class":"link2 hoverBlack","style":"position:relative;width:80px;height:40px;background:url('"+GFX+"stadt/uebersicht.gif') repeat scroll 0% 0% transparent;"},market_beraterline.children[4]); newdiv1.addEventListener("click",function(){ unsafeWindow.buildInfoPanel("stock",{"page":1,"prodType":0,"filterCategory":unsafeWindow.market_filter_pid?prodTyp[0][unsafeWindow.market_filter_pid]:null}); },false); createElement("div",{"style":"position:absolute;top:13px;width:80px;font-weight:bold;text-align:center;"},newdiv1,getText("prices")); newdiv1=createElement("div",{"id":"marketButton_tableStock","class":"link2 hoverBlack","style":"position:relative;width:80px;height:40px;background:url('"+GFX+"stadt/uebersicht.gif') repeat scroll 0% 0% transparent;"},market_beraterline.children[5]); newdiv1.addEventListener("click",function(){ unsafeWindow.buildInfoPanel("stock",{"page":2,"prodType":0,"filterCategory":unsafeWindow.market_filter_pid?prodTyp[0][unsafeWindow.market_filter_pid]:null}); },false); createElement("div",{"style":"position:absolute;top:13px;width:80px;font-weight:bold;text-align:center;"},newdiv1,getText("stock")); market_beraterline=null; canda=null;candtable=null;candtr=null;candtd=null;canddiv=null;newa=null;newinput=null;newspan=null;newdiv=null;newdiv1=null; }catch(err){ GM_logError("do_market ("+err_trace+")\n"+err); } } unsafeOverwriteFunction("showOffers",function(page){ try{ unsafeWindow._showOffers(page); }catch(err){GM_logError("_showOffers\n"+err);} try{ do_market(); // GM_log("unsafeWindow.market_offers:\n"+print_r(unsafeWindow.market_offers,"",true,"\n")); raiseEvent("gameOpenMarket"); }catch(err){GM_logError("showOffers\n"+err);} }); unsafeOverwriteFunction("openMarketNewOffer",function(){ try{ unsafeWindow._openMarketNewOffer(); }catch(err){GM_logError("_openMarketNewOffer\n"+err);} try{ var err_trace="Init"; var currId=unsafeWindow.market_filter_pid; if(currId!=-1){ if(lastOffer[currId]){ $("marketnewoffer_amount").value=lastOffer[currId][0]; $("marketnewoffer_price1").value=lastOffer[currId][1]; $("marketnewoffer_price2").value=(lastOffer[currId][2]<10?"0":"")+lastOffer[currId][2]; if($("marketnewoffer_price_comb")){ $("marketnewoffer_price_comb").value=lastOffer[currId][1]+delimDeci+(lastOffer[currId][2]<10?"0":"")+lastOffer[currId][2]; } }else{ $("marketnewoffer_amount").value=0; } keyup($("marketnewoffer_amount")); /* if ($("produkt_preis1")){ $("lbl_produkt_max").setAttribute("class",$("lbl_produkt_max").getAttribute("class")+" link"); $("lbl_produkt_max").addEventListener("click",function(){ $("produkt_anzahl").value=this.innerHTML.replace(regDelimThou,""); keyup($("produkt_anzahl")); },false); $("produkt_anzahl").addEventListener("focus",checkPreis,false); // fired when offer-div opens $("preisschild").addEventListener("keyup",function(event){ checkPreis(); if (event.keyCode==13){ var submitButton=$("preisschild").querySelector("#verkaufe_markt"); if(submitButton.style.display!="none"){ click(submitButton); } submitButton=null; } },false); if(valJoinPreise){ $("produkt_preis1").setAttribute("tabindex","0"); $("produkt_preis2").setAttribute("tabindex","0"); var newinput=createElement("input",{"id":"produkt_preis_ganz","type":"text","style":"position:absolute;left:0;top:0;background-color:#002300;color:#f0ffef;width:131px;text-align:right;border:1px solid #555;","tabindex":"2","maxlength":"9","name":"p_preis_ganz","class":"text thuge"},$("produkt_preis1").parentNode); newinput.addEventListener("keyup",function(event){ if (event.keyCode==13){ var submitButton=$("preisschild").querySelector("#verkaufe_markt"); if(submitButton.style.display!="none"){ click(submitButton); } submitButton=null; }else{ var preis=this.value.replace(regDelimThou,"").replace(regDelimDeci,"."); var preis1=parseInt(preis,10); var preis2=(preis.search(/\./)!=-1?(preis+"00").substr(1+preis.search(/\./),2):"00"); $("produkt_preis1").value=preis1; $("produkt_preis2").value=preis2; keyup($("produkt_preis1")); } },false); newinput=null; } } */ // coins function checkPreisCoins(){ //GM_log("checkPreisCoins "+oldPricesInserted); window.setTimeout(function(){ // first let finish the functions if(oldPricesInserted==0){ //old offer set lastOffer[0]=[parseInt($("coinsanzahl").value,10),parseInt($("coinspreis").value,10),$("coinssollpreis").checked]; try{ GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_lastOffer",implode(lastOffer)); }catch(err){ GM_log("checkPreisCoins: 0 not saved!\n"+err); } }else{ oldPricesInserted=0; if(lastOffer[0]){ $("coinsanzahl").value=lastOffer[0][0]; $("coinspreis").value=lastOffer[0][1]; $("coinssollpreis").checked=lastOffer[0][2]; unsafeWindow.chkAmount(); unsafeWindow.calcMarketPrice(); } } var currPreis=parseInt($("coinsmarktpreis").innerHTML,10); var currAnzahl=parseInt($("coinsanzahl").value,10); var currUserPreis=parseInt($("coinsuserpreis").innerHTML,10); if(protectMinRack){ //rack amount protection prodStock[0][0]=parseInt($("lbl_produkt_max").innerHTML.replace(regDelimThou,""),10); if(currAnzahl>prodStock[0][0]-prodMinRack[0][0]){ currAnzahl=Math.max(0,prodStock[0][0]-prodMinRack[0][0]); $("coinsanzahl").value=currAnzahl; } } var newtable=createElement("table"); var newtr; $("divBerInfoCoins").replaceChild(newtable,$("divBerInfoCoins").getElementsByTagName("table")[0]); if (gut[0]){ $("coinspreisschild").querySelector("#verkaufe_markt").style.display=(((100*currPreis>valVerkaufLimitDown*gut[0]) && (100*currPreis<valVerkaufLimitUp*gut[0]))?"":"none"); newtr=createElement("tr",{},newtable); createElement("td",{"style":"color:#f0ffef;font-weight:bold;"},newtr,getText("price")+": "); createElement("td",{"style":"color:#f0ffef;font-weight:bold;text-align:right;"},newtr,moneyFormatLimit(gut[0],100)); } newtr=createElement("tr",{},newtable); createElement("td",{"style":"color:#f0ffef;font-weight:bold;"},newtr,getText("value")+": "); createElement("td",{"style":"color:#f0ffef;font-weight:bold;text-align:right;"},newtr,moneyFormatLimit(currUserPreis*currAnzahl,100)); newtr=createElement("tr",{},newtable); createElement("td",{"style":"color:#f0ffef;font-weight:bold;"},newtr,getText("commission")+": "); createElement("td",{"style":"color:#f0ffef;font-weight:bold;text-align:right;"},newtr,numberFormat(((currPreis-currUserPreis)/currUserPreis)*100,1)+"%"); if (preisBeob[0]){ newtr=createElement("tr",{},newtable); createElement("td",{"style":"color:#f0ffef;font-weight:bold;"},newtr,"min: "); createElement("td",{"style":"color:#f0ffef;font-weight:bold;text-align:right;"},newtr,moneyFormatLimit(preisBeob[0][2],100)); } if (gutBeob[0]){ newtr=createElement("tr",{},newtable); createElement("td",{"style":"color:#f0ffef;font-weight:bold;"},newtr,getText("observed")+": "); createElement("td",{"style":"color:#f0ffef;font-weight:bold;text-align:right;"},newtr,moneyFormatLimit(gutBeob[0],100)); } newtable=null;newtr=null; },200); } /* if($("coinsauflager")){ $("coinsauflager").setAttribute("class",$("coinsauflager").getAttribute("class")+" link"); $("coinsauflager").addEventListener("click",function(){ $("coinsanzahl").value=this.innerHTML; keyup($("coinsanzahl")); },false); } if($("coinspreisschild")){ var newdiv=createElement("div",{"style":"position:absolute;top:0;left:330px;width:150px"},$("coinspreisschild")); newdiv=createElement("div",{"id":"divBerInfoCoins","style":"float:left;padding:3px;background-color:#002300;border:5px solid #594230;color:#f0ffef;font-weight:bold;"},newdiv); createElement("table",{},newdiv); newdiv=null; $("coinsanzahl").addEventListener("keyup",function(){ this.value=this.value.replace(/\D/g,""); },false); $("coinspreis").addEventListener("keyup",function(){ this.value=this.value.replace(/\D/g,""); },false); $("coinspreisschild").addEventListener("click",checkPreisCoins,false); $("coinspreisschild").addEventListener("keyup",function(event){ checkPreisCoins(); if (event.keyCode==13){ var submitButton=$("preisschild").querySelector("#verkaufe_markt"); if(submitButton.style.display!="none"){ click(submitButton); } submitButton=null; } },false); // bugfix: no focus when coinspreisschild opens $("coinspreisschild").addEventListener("DOMAttrModified",function(event){ if((event.target.id=="coinspreisschild")&&(event.attrName=="style")){ if(event.newValue.match(/display\:\s*block/)){ if(oldPricesInserted!=0){ checkPreisCoins(); // fired when offer-div opens } }else{ if(oldPricesInserted==0){ oldPricesInserted=-1; } } } }, false); } cand=null;candtable=null; */ } }catch(err){ GM_logError("openMarketNewOffer ("+err_trace+")\n"+err); } }); unsafeOverwriteFunction("calcMarketFee",function(){ try{ unsafeWindow._calcMarketFee(); }catch(err){GM_logError("_calcMarketFee\n"+err);} try{ var err_trace="Init"; var berater_box=$("marketnewoffer_berater"); if(!berater_box){ berater_box=createElement("div",{"style":"position:absolute;top:0px;width:175px;right:-160px;background-position:-140px 0px;","class":"market_popup"}); newdiv=$("marketnewoffer"); newdiv.insertBefore(berater_box,newdiv.lastElementChild); berater_box=createElement("div",{"id":"marketnewoffer_berater","style":"position:relative;margin-top:35px;"},berater_box); } berater_box.innerHTML=""; var currId=unsafeWindow.market_filter_pid; if(currId!=-1){ var currPreis=parseFloat($("marketnewoffer_price1").value+"."+$("marketnewoffer_price2").value,10); var currAnzahl=parseInt($("marketnewoffer_amount").value,10); // Stock amount err_trace="Stock amount"; var newdiv; if(newdiv=$("marketcreateoffer_stockamount")){ newdiv.innerHTML=numberFormat(prodStock[0][currId]); } // Rack amount protection err_trace="Rack amount protection"; if(protectMinRack){ if(currAnzahl>prodStock[0][currId]-prodMinRack[0][currId]){ currAnzahl=Math.max(0,prodStock[0][currId]-prodMinRack[0][currId]); $("marketnewoffer_amount").value=currAnzahl; } } // Block Submit Button err_trace="Submit Button"; var submitButton = $("market_new_button"); if(submitButton){ var help=null; if(NPC[0][currId]){ if(!isNaN(NPC[0][currId])){ if(100*currPreis<20*NPC[0][currId]){ help=3; } else if(100*currPreis>300*NPC[0][currId]){ help=4; } }else if (NPC[0][currId].match(/^f/)){ if(100*currPreis<2*parseFloat(NPC[0][currId].replace("f",""),10)){ help=3; } else if(100*currPreis>300*parseFloat(NPC[0][currId].replace("f",""),10)){ help=4; } } } if((help!=null)&&gut[currId]){ if(100*currPreis<valVerkaufLimitDown*gut[currId]){ help=1; } else if(100*currPreis>valVerkaufLimitUp*gut[currId]){ help=2; } }; if(help==null){ submitButton.style.display="block"; newdiv = $("market_new_button_block"); if(newdiv){ newdiv.style.display="none"; } }else{ submitButton.style.display="none"; newdiv = $("market_new_button_block"); if(!newdiv){ newdiv=createElement("div",{"id":"market_new_button_block","class":"alertbox","style":"padding:2px;width:100%;text-align:center;"}); insertAfter(newdiv,submitButton); } newdiv.style.display="block"; switch(help){ case 1: newdiv.innerHTML = "Too cheap"; break; case 2: newdiv.innerHTML = "Too expensive"; break; case 3: newdiv.innerHTML = "Not allowed - Too cheap"; break; case 4: newdiv.innerHTML = "Not allowed - Too expensive"; break; } } help=null; } submitButton=null; // Info Boards err_trace="berater_box"; var newtable=createElement("table",{},berater_box); var newtr; newtr=createElement("tr",{},newtable); createElement("td",{"style":"color:#f0ffef;font-weight:bold;"},newtr,getText("price")+": "); if(gut[currId]){ createElement("td",{"style":"color:#f0ffef;font-weight:bold;text-align:right;"},newtr,moneyFormatLimit(gut[currId],100)); } else { createElement("td",{"style":"color:#f0ffef;font-weight:bold;text-align:right;"},newtr,"--"); } newtr=createElement("tr",{},newtable); createElement("td",{"style":"color:#f0ffef;font-weight:bold;"},newtr,getText("value")+": "); createElement("td",{"style":"color:#f0ffef;font-weight:bold;text-align:right;"},newtr,moneyFormatLimit(currPreis*currAnzahl,100)); newtr=createElement("tr",{},newtable); createElement("td",{"style":"color:#f0ffef;font-weight:bold;"},newtr,"min: "); if (preisBeob[currId]){ createElement("td",{"style":"color:#f0ffef;font-weight:bold;text-align:right;"},newtr,moneyFormatLimit(preisBeob[currId][2],100)); }else{ createElement("td",{"style":"color:#f0ffef;font-weight:bold;text-align:right;"},newtr,"--"); } newtr=createElement("tr",{},newtable); createElement("td",{"style":"color:#f0ffef;font-weight:bold;"},newtr,getText("observed")+": "); if (gutBeob[currId]){ createElement("td",{"style":"color:#f0ffef;font-weight:bold;text-align:right;"},newtr,moneyFormatLimit(gutBeob[currId],100)); }else{ createElement("td",{"style":"color:#f0ffef;font-weight:bold;text-align:right;"},newtr,"--"); } newtr=createElement("tr",{},newtable); createElement("td",{"style":"color:#f0ffef;font-weight:bold;"},newtr,getText("NPCprice")+": "); if(!NPC[0][currId]){ createElement("td",{"style":"color:#f0ffef;font-weight:bold;text-align:right;"},newtr,"--"); }else if(!isNaN(NPC[0][currId])){ createElement("td",{"style":"color:#f0ffef;font-weight:bold;text-align:right;"},newtr,moneyFormatLimit(NPC[0][currId],100)); }else if (NPC[0][currId].match(/^f/)){ createElement("td",{"style":"color:#f0ffef;font-weight:bold;text-align:right;"},newtr,"*"+moneyFormatLimit(parseFloat(NPC[0][currId].replace("f",""),10),100)); }else if (NPC[0][currId].match(/^c/)){ coinsFormat(parseInt(NPC[0][currId].replace("c",""),10),createElement("td",{"style":"color:#f0ffef;font-weight:bold;text-align:right;"},newtr)); } newtable=null;newtr=null;newdiv=null; } currId=null; }catch(err){ GM_logError("calcMarketFee\n"+err); } }); unsafeOverwriteFunction("buyMarketOffer",function(id){ try{ unsafeWindow._buyMarketOffer(id); }catch(err){GM_logError("_buyMarketOffer\n"+err);} try{ for(var i=0;i<unsafeWindow.market_offers.length;i++){ if(id==unsafeWindow.market_offers[i].id){ var money=parseFloat($("bar").innerHTML.replace(getText("gamecurrency"),"").replace(/\s+/g,"").replace(regDelimThou,"").replace(regDelimDeci,"."),10); $("marketbuyofferamount").value = Math.min(unsafeWindow.market_offers[i].a,Math.floor(money/unsafeWindow.market_offers[i].pr)); window.setTimeout(function() { $("marketbuyofferamount").select(); }, 50); unsafeWindow.calcMarketOfferCost(); money=null; break; } } }catch(err){ GM_logError("buyMarketOffer\n"+err); } }); unsafeOverwriteFunction("marketAction",function(action,id,open){ try{ unsafeWindow._marketAction(action,id,open); }catch(err){GM_logError("_marketAction\n"+err);} try{ if(action=="marketcreateoffer"){ var currId=unsafeWindow.market_filter_pid; var amount=parseInt($("marketnewoffer_amount").value,10); var price1=parseInt($("marketnewoffer_price1").value,10); var price2=parseInt($("marketnewoffer_price2").value,10); lastOffer[currId]=[amount,price1,price2]; GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_lastOffer",implode(lastOffer)); currId=null;amount=null;price1=null;price2=null; } }catch(err){ GM_logError("marketAction\n"+err); } }); unsafeOverwriteFunction("marketActionResponse",function(request,action,id,open){ try{ var result = checkRequest(request) if((result!=0)&&(result[0]!=0)&&(result[1]["offers"])){ //GM_log("marketActionResponse "+result[1]["offers"].length); // Save own offers var err_trace="Save own offers"; var _ownMarketOffers=new Array(); var marketOffersArr=new Array(); var row,prod,preis,menge,menge_sum; err_trace="Save own offers"; for(var v=0;v<result[1]["offers"].length;v++){ row=result[1]["offers"][v]; prod=parseInt(row["p"],10); preis=parseFloat(row["pr"],10); menge=parseInt(row["a"],10); if(row["s"]){ _ownMarketOffers.push([prod,preis,menge]); } if(!marketOffersArr[prod]){ marketOffersArr[prod]=new Array(); } // TODO(Seberoth): What is time again? // marketOffersArr[prod].push([menge,preis,parseInt(row["zeit"],10)]); marketOffersArr[prod].push([menge,preis]); } // sort the ownMarketOffers-data _ownMarketOffers.sort(function(a,b){ if(a[0]==b[0]){ return(a[1]-b[1]); } else if(prodTyp[0][a[0]]==prodTyp[0][b[0]]){ return(a[0]-b[0]); } else { return({"c":0,"v":1,"e":2,"o":3,"fw1":4,"fw2":5,"fw3":6,"fw4":7,"z":8}[prodTyp[0][a[0]]]-{"c":0,"v":1,"e":2,"o":3,"fw1":4,"fw2":5,"fw3":6,"fw4":7,"z":8}[prodTyp[0][b[0]]]); } }); ownMarketOffers=_ownMarketOffers; GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_ownMarketOffers",implode(ownMarketOffers)); doMarketoffersNotepad(); // calculate all observed prices err_trace="Observing prices"; for(var v=0;v<prodBlock[0].length;v++){ if(prodBlock[0][v]==undefined){ continue; } if((!prodBlock[0][v].match(/t/))&&(!prodBlock[0][v].match(/l/))){ if(marketOffersArr[v]){ // sort offers marketOffersArr[v].sort(function(a,b){ return((a[1]==b[1])?(a[2]-b[2]):(a[1]-b[1])); }); marketOffersArr[v]=marketOffersArr[v].slice(0,18); menge_sum=0; for(var w=0;w<marketOffersArr[v].length;w++){ menge_sum += marketOffersArr[v][w][0]; } gutBeob[v]=calcObservedPrice((prodTyp[0][v]=="z"?2:1),marketOffersArr[v]); if (valNimmBeob){ if(!isNaN(NPC[0][v])){ gut[v]=Math.min(gutBeob[v],NPC[0][v]); }else{ gut[v]=gutBeob[v]; } } if(!(preisBeob instanceof Array)){ preisBeob=new Array(); } preisBeob[v]=[true,now,marketOffersArr[v][0][1],marketOffersArr[v][marketOffersArr[v].length-1][1],menge_sum]; }else{ // no offers if (valNimmBeob){ if(!isNaN(NPC[0][v])){ gut[v]=NPC[0][v]; }else{ gut[v]=0; } } if(!(preisBeob instanceof Array)){ preisBeob=new Array(); } if(!(preisBeob[v]&&preisBeob[v][0])){ preisBeob[v]=[false,now,,,0]; } } } } _ownMarketOffers=null;marketOffersArr=null; row=null;prod=null;preis=null;menge=null;menge_sum=null; if (valNimmBeob){ GM_setValueCache(COUNTRY+"_"+SERVER+"_gut",implode(gut)); raiseEventTop("gameChangedGut"); } GM_setValueCache(COUNTRY+"_"+SERVER+"_gutBeob",implode(gutBeob)); GM_setValueCache(COUNTRY+"_"+SERVER+"_preisBeob",implode(preisBeob)); raiseEventTop("gameChangedBeobPrice"); } }catch(err){GM_logError("marketActionResponse ("+err_trace+")\nv="+v+"\n"+err);} try{ unsafeWindow._marketActionResponse(request,action,id,open); }catch(err){GM_logError("_marketActionResponse\n"+err);} }); quicklinks(); // Buy offer by pressing Enter if(newdiv=$("marketbuyofferamount")){ newdiv.addEventListener("keyup",function(event){ if(event.keyCode==13){ unsafeWindow.calcMarketOfferCost(); var newdiv=$("marketbuyofferbutton"); if(newdiv.style.display=="block"){ click(newdiv); } newdiv=null; } },false); } // Create offer enter stock amount if(newdiv=$("marketcreateoffer_stockamount")){ newdiv.setAttribute("class","link"); newdiv.addEventListener("click",function(event){ var newdiv=$("marketnewoffer_amount"); if(newdiv){ newdiv.value=prodStock[0][unsafeWindow.market_filter_pid]; keyup(newdiv); } newdiv=null; },false); } // Notepad for Non-Premium err_trace="Notepad for Non-Premium"; if((newdiv=$("sub_notepad"))&&(newdiv.style.display=="none")){ newdiv=insertAfter(createElement("div",{"id":"beraterNotepad","class":"submenueitem link","style":"display:block;"}),newdiv); createElement("img",{"src":GFX+"guild/contract.gif","style":"width:15px;height:15px;"},newdiv); newdiv.addEventListener("mouseover",function(event){ toolTip.show(event,unsafeWindow.lng_t_notizen); },false); newdiv.addEventListener("click",function(){ $("notepadentry").value=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_notepad",""); unsafeWindow.calcNotepadLetters(); unsafeWindow.showDiv("notepad"); },false); newdiv=$("notepadheader"); newdiv.getElementsByTagName("img")[0].removeAttribute("onclick"); newdiv.getElementsByTagName("img")[0].addEventListener("click",function(){ GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_notepad",$("notepadentry").value,72); unsafeWindow.hideDiv("notepad"); },false); } // BuyNotepad err_trace="BuyNotepad"; newdiv=createElement("div",{"style":"position:relative;margin-top:5px;display:block;white-space:nowrap;"},$("divRightBorder")); newdiv1=createElement("div",{"class":"opener link","style":"display:inline-block;vertical-align:top;background-position:0px "+(show["buyNotepad"]?-20:0)+"px;"},newdiv); newdiv1.addEventListener("click",function(){ show["buyNotepad"]=!show["buyNotepad"]; GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_show",implode(show)); if(show["buyNotepad"]){ this.style.backgroundPosition="0px -20px"; $("buyNotepad").style.display="inline-block"; doBuyNotepad(); }else{ this.style.backgroundPosition="0px 0px"; $("buyNotepad").style.display="none"; } },false); createElement("div",{"id":"buyNotepad","style":"display:"+(show["buyNotepad"]?"inline-block":"none")+";"},newdiv); // MarketoffersNotepad err_trace="MarketoffersNotepad"; newdiv=createElement("div",{"style":"position:relative;margin-top:5px;display:block;white-space:nowrap;"},$("divRightBorder")); newdiv1=createElement("div",{"class":"opener link","style":"display:inline-block;vertical-align:top;background-position:0px "+(show["marketoffersNotepad"]?-20:0)+"px;"},newdiv); newdiv1.addEventListener("click",function(){ show["marketoffersNotepad"]=!show["marketoffersNotepad"]; GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_show",implode(show)); if(show["marketoffersNotepad"]){ this.style.backgroundPosition="0px -20px"; $("marketoffersNotepad").style.display="inline-block"; }else{ this.style.backgroundPosition="0px 0px"; $("marketoffersNotepad").style.display="none"; } doMarketoffersNotepad(); },false); createElement("div",{"id":"marketoffersNotepad","style":"display:"+(show["marketoffersNotepad"]?"inline-block":"none")+";"},newdiv); doMarketoffersNotepad(); document.addEventListener("gameChangedOwnMarketOffers",function(){ window.setTimeout(function(){ ownMarketOffers=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_ownMarketOffers"),"event:gameChangedOwnMarketOffers/ownMarketOffers",{}); doMarketoffersNotepad(); },0); },false); // Points and level. levelLog[day]=[points,rank,market sales,contract sales,farmi money] err_trace="Points and level"; levelLog=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_levelLog","[]"),"do_main/levelLog",[]); if(!(levelLog instanceof Array)){ levelLog = []; } function setLevelLogId(){ levelLog.sort(sortObjFunctions["date"]); for(levelLogId=levelLog.length-1;levelLogId>=0;levelLogId--){ if(levelLog[levelLogId][0]==todayServerStr){ return; } } levelLog.push([todayServerStr,0,null,0,0,0]); setLevelLogId(); } setLevelLogId(); function getDailyRanking(){ try{ if(!levelLog[levelLogId][2]){ logBubble.add(getText("requestingUserStatistic")); GM_xmlhttpRequest({ method: "GET", url: "http://s"+SERVER+"."+GAMEPAGES[COUNTRY]+"/city/ajax.php?mode=stats&type=pkt&page=1&findme=1&rid="+unsafeWindow.rid, headers: {"Content-type": "application/x-www-form-urlencoded"}, onload: function(response){ try{ var result=checkRequest(response); if(result){ for(var i in result[1]["data"]){ if(!result[1]["data"].hasOwnProperty(i)){ continue; } if(result[1]["data"][i]["own"]){ levelLog[levelLogId][2]=((result[1].page-1)*result[1].max)+parseInt(i,10); GM_setValue2(COUNTRY+"_"+SERVER+"_"+USERNAME+"_levelLog",implode(levelLog),73); logBubble.add(getText("youAreOnRankX").replace(/%1%/,levelLog[levelLogId][2])); return; } } logBubble.add(getText("couldNotGetPlace")); }else{ logBubble.add(getText("couldNotGetPlace")+" ("+response.responseText+")"); } }catch(err){ GM_logError("getDailyRanking.onload\n"+err); } }, onerror: function(response){ GM_logError("getDailyRanking.onerror\n"+response.responseText); }, timeout: function(response){ GM_logError("getDailyRanking.timeout\n"+response.responseText); } }); } }catch(err){ GM_logError("getDailyRanking\n"+err); } } getDailyRanking(); function plotLevelProgressBar(){ try{ var help; // data quality levelLog.sort(sortObjFunctions["date"]); if(help=$("pkt")){ help=parseInt(help.innerHTML.replace(/\D/g,""),10); levelLog[levelLogId][1]=help; for(var v=levelLog.length-1;v>=0;v--){ if(help<levelLog[v][1]){ levelLog[v][1]=0; } // points limited by current points } } help=0; for(var v=0;v<levelLog.length;v++){ if(levelLog[v][1]<help){ levelLog[v][1]=help; } // monotony help=levelLog[v][1]; } var month,stichtag=new Date(); stichtag=Math.round(((new Date(stichtag.getFullYear(),stichtag.getMonth()-2,1)).getTime())/1000); for(var v=levelLog.length-1;v>=0;v--){ if(levelLog[v][0].match(/^\d+\.\d+\.\d+$/)){ if(getTime(levelLog[v][0])<stichtag){ // save full data for the last 3 months, else join data to monthly month=/^(\d+)\.(\d+)\.(\d+)$/.exec(levelLog[v][0]); if(month[2].length==1){ month[2]="0"+month[2]; } month = month[3]+"-"+month[2]; for(var w=0;w<levelLog.length;w++){ if(levelLog[w][0]==month){ break; } } if(levelLog[w]==undefined){ levelLog[w]=[month,0,,0,0,0]; } if(levelLog[w][1]<levelLog[v][1]){ levelLog[w][1]=levelLog[v][1]; levelLog[w][2]=levelLog[v][2]; } levelLog[w][3] += levelLog[v][3]; levelLog[w][4] += levelLog[v][4]; levelLog[w][5] += levelLog[v][5]; levelLog.splice(v,1); } } } setLevelLogId(); GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_levelLog",implode(levelLog)); // plotting level log bar if(USERLEVEL<LEVEL_POINTS.length){ var levelSize=959; var levelsum=LEVEL_POINTS[USERLEVEL+1]-LEVEL_POINTS[USERLEVEL-1]; var newdiv=$("levelProgressBar"); if(newdiv){ removeElement(newdiv); } newdiv=createElement("div",{"class":"link","id":"levelProgressBar","style":"float:left;width:"+levelSize+"px;position:relative;top:-2px;left:18px;"},content_table.firstElementChild.children[2].firstElementChild); newdiv.addEventListener("click",function(){unsafeWindow.buildInfoPanel("level");},false); newdiv.addEventListener("mouseover",function(event){ var node=event.target; var mouseOverText=node.getAttribute("mouseOverText"); while((node!=this)&&(!mouseOverText)){ node=node.parentNode; mouseOverText=node.getAttribute("mouseOverText"); } if(mouseOverText){ toolTip.show(event,mouseOverText); } node=null;mouseOverText=null; },false); var newdiv1=bar(levelSize*(LEVEL_POINTS[USERLEVEL]-LEVEL_POINTS[USERLEVEL-1])/levelsum,1,1); newdiv1.style.cssFloat="left"; newdiv1.setAttribute("mouseOverText",getText("level")+" "+(USERLEVEL-1)+": "+numberFormat(LEVEL_POINTS[USERLEVEL-1],0)+"-"+numberFormat(LEVEL_POINTS[USERLEVEL],0)); newdiv.appendChild(newdiv1); newdiv1=bar(levelSize*(LEVEL_POINTS[USERLEVEL+1]-LEVEL_POINTS[USERLEVEL])/levelsum,levelLog[levelLogId][1]-LEVEL_POINTS[USERLEVEL],LEVEL_POINTS[USERLEVEL+1]-LEVEL_POINTS[USERLEVEL]); newdiv1.style.cssFloat="left"; newdiv1.style.marginLeft=Math.ceil(2+levelSize*(LEVEL_POINTS[USERLEVEL]-LEVEL_POINTS[USERLEVEL-1])/levelsum)+"px"; newdiv1.setAttribute("mouseOverText",getText("level")+" "+(USERLEVEL)+": "+numberFormat(LEVEL_POINTS[USERLEVEL],0)+"-"+numberFormat(LEVEL_POINTS[USERLEVEL+1],0)); newdiv.appendChild(newdiv1); for(var v=levelLog.length-1;v>=0;v--){ if(levelLog[v][0].match(/^\d+\.\d+\.\d+$/)){ newdiv1=createElement("div",{"mouseOverText":levelLog[v][0]+"<br>"+numberFormat(levelLog[v][1]),"style":"position:absolute;width:0;margin-top:2px;height:12px;border-right:1px solid white;"},newdiv); if (levelLog[v][1]<LEVEL_POINTS[USERLEVEL]){ newdiv1.style.marginLeft=Math.floor(2+levelSize*(levelLog[v][1]-LEVEL_POINTS[USERLEVEL-1])/levelsum)+"px"; } else { newdiv1.style.marginLeft=Math.floor(4+levelSize*(levelLog[v][1]-LEVEL_POINTS[USERLEVEL-1])/levelsum)+"px"; } help=levelLog[v][0].split("."); if (new Date(parseInt(help[2],10),parseInt(help[1],10)-1,parseInt(help[0],10)).getDay()=="0"){ newdiv1.style.borderColor="red"; } } } newdiv1=null;newdiv=null; } }catch(err){ GM_logError("plotLevelProgressBar\nlevelLog["+v+"]="+implode(levelLog[v])+"\n"+err); } } plotLevelProgressBar(); unsafeOverwriteFunction("updateMenuGo",function(){ try{ unsafeWindow._updateMenuGo(); }catch(err){GM_logError("_updateMenuGo\n"+err);} window.setTimeout(function(){ try{ // calcTotalFarmis(); // loadProductData(); updateProductDataFarm(); plotLevelProgressBar(); calcProdMinRack(); // calcProdMinRackInit(); if(USERLEVEL<parseInt(unsafeWindow.currentuserlevel,10)){ raiseEvent("gameUserlevelUp"); } USERLEVEL=parseInt(unsafeWindow.currentuserlevel,10); }catch(err){ GM_logError("updateMenuGo\n"+err); } },0); }); // Removing Advertising end on Advertising Abort unsafeOverwriteFunction("cancelAdResponse",function(response){ try{ var cell=$("alertAdvertEnd"); if(cell){ removeElement(cell); } cell=null; }catch(err){GM_logError("cancelAdResponse\n"+err);} try{ unsafeWindow._cancelAdResponse(response); }catch(err){GM_logError("_cancelAdResponse\n"+err);} }); // Sprechblase err_trace="Bubble"; createElement("div",{"id":"sprcontent2","style":"position:absolute;top:20px;left:323px;z-index:100;width:200px;height:90px;overflow:auto;display:none;"},$("sprcontent").parentNode);//same style as #sprcontent // Lager / Rack err_trace="Rack"; newdiv=createElement("div",{"style":"display:none;"},$("lager_info"));//position:absolute;top:50px;left:58px;display:none; createElement("img",{"src":GFX+"adtime.gif","style":"float:left;width:14px;height:14px;margin-left:5px;"},newdiv); createElement("div",{"id":"lager_zeit_ziel","class":"tnormal","style":"float:left;margin-left:5px;"},newdiv); newdiv=createElement("div",{"id":"sendStockingContract","class":"link playerContract","style":"position:absolute;top:155px;left:10px;"},$("lager").firstElementChild); createElement("div",{},newdiv); newdiv.addEventListener("mouseover",function(event){ try{ if(unsafeWindow.selected&&(!prodBlock[0][unsafeWindow.selected].match(/t/))){ toolTip.show(event,getText("storeXinContract").replace(/%1%/,prodName[0][unsafeWindow.selected])); }else{ toolTip.show(event,"---"); } }catch(err){ GM_logError("listener sendStockingContract.mouseover\n"+err); } },false); newdiv.addEventListener("click",function(event){ try{ if(unsafeWindow.selected&&(!prodBlock[0][unsafeWindow.selected].match(/t/))){ var thisdata=new Object(); thisdata["to"]=FARMNAME; thisdata["fillContract"]=new Object(); thisdata["fillContract"][unsafeWindow.selected]=[prodStock[0][unsafeWindow.selected],1]; GM_setValue(COUNTRY+"_"+SERVER+"_pagedataVertraegeNew",implode(thisdata)); showMultiframePage("vertraege/new.php"); } }catch(err){ GM_logError("listener sendStockingContract.click\n"+err); } },false); function showLagerZeitZiel(zoneNrF){ try{ // if(gameLocation[0]!="farm"){ return false; } var divLagerZeitZiel=$("lager_zeit_ziel"); var growtime,help; switch(zones.getBuilding(zoneNrF)){ case 1:{ if ((unsafeWindow.mode==0)&&(prodTyp[0][unsafeWindow.selected]=="v")){ var bonus=zones.getBonus(zoneNrF); if((help=zones.getBonusSpecial(zoneNrF))&&(unsafeWindow.selected==help[0])){ bonus += help[1]; } bonus=1-(bonus/100); growtime=calcGrowDuration(60*prodGrowTime[0][unsafeWindow.selected],bonus); } break;} case "fl1":{ if ((unsafeWindow.mode==0)&&(prodTyp[0][unsafeWindow.selected]=="fl")){ var bonus=1-(zones.getBonus(zoneNrF)/100); if((help=zones.getBonusSpecial(zoneNrF))&&(unsafeWindow.selected==help[0])){ bonus *= 1-(help[1]/100); } growtime=calcGrowDuration(60*prodGrowTime[0][unsafeWindow.selected],bonus); } break;} } if(growtime){ $("lager_zeit").innerHTML=getTimeStr(growtime)+" "+getText("shortHours"); if(divLagerZeitZiel.parentNode.style.display!="block"){ divLagerZeitZiel.parentNode.style.display="block"; } divLagerZeitZiel.innerHTML="= "+getDaytimeStr(now+growtime)+" "+getText("shortOClock"); }else{ hideLagerZeitZiel(); } divLagerZeitZiel=null; }catch(err){ GM_logError("showLagerZeitZiel zoneNrF="+zoneNr+"\n"+err); } } function hideLagerZeitZiel(){ try{ var divLagerZeitZiel=$("lager_zeit_ziel"); if(divLagerZeitZiel.parentNode.style.display!="none"){ divLagerZeitZiel.parentNode.style.display="none"; } divLagerZeitZiel=null; }catch(err){ GM_logError("hideLagerZeitZiel\n"+err); } } unsafeOverwriteFunction("selectRackItem",function(id,b){ try{ unsafeWindow._selectRackItem(id,b); }catch(err){GM_logError("selectRackItem id="+id+"\n"+err);} try{ if($("gardenmaincontainer").style.display=="block"){ var zoneNr=/parent.cache_me\((\d+?),120/.exec($("gardenarea").innerHTML); if(zoneNr){ zoneNr=parseInt(zoneNr[1],10); showLagerZeitZiel(zoneNr+6*gameLocation[1]); } }else if($("farmersmarket_pos1_inner").style.display=="block"){ showLagerZeitZiel("farmersmarket-1"); } }catch(err){GM_logError("selectRackItem id="+id+"\n"+err);} }); valMoveAnimals=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valMoveAnimals","[]"),"do_main/valMoveAnimals",[]); // executed,speedvert,top,bottom,speedhor,left,right function moveAnimals(mode){ //GM_log("moveAnimals "+mode); if(($("innermaincontainer").style.display == "block")&&($("animalline"+mode))){ var cand=$("animalline"+mode).getElementsByTagName("img"); for(var v=0;v<cand.length;v++){ cand[v].style.top=(Math.max(ANIMAL_MOVE[mode][2],Math.min(ANIMAL_MOVE[mode][3],parseInt(cand[v].style.top,10)+ANIMAL_MOVE[mode][1]*getRandom(-1,1))))+"px"; cand[v].style.left=(Math.max(ANIMAL_MOVE[mode][5],Math.min(ANIMAL_MOVE[mode][6],parseInt(cand[v].style.left,10)+ANIMAL_MOVE[mode][4]*getRandom(-1,1))))+"px"; } cand=null; window.setTimeout(function(){moveAnimals(mode);},100); }else{ ANIMAL_MOVE[mode][0]=false; } } // events general ============================================================================= err_trace="events general"; // rack for(var v in prodName[0]){ if(!prodName[0].hasOwnProperty(v)){ continue; } if(v==0){ continue; } // Coins if (!unsafeWindow.rackElement[v]){ prodStock[0][v]=0; } // not available // else if ("undefined" === typeof(unsafeWindow.rackElement[v].id)){ prodStock[0][v]=0; } // empty elements else if ("undefined" === typeof(unsafeWindow.rackElement[v].number)){ prodStock[0][v]=0; } // no stock available else if (!unsafeWindow.rackElement[v].number){ prodStock[0][v]=0; } // no stock available else { prodStock[0][v]=parseInt(unsafeWindow.rackElement[v].number,10); } } GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodStock",implode(prodStock)); unsafeWindow.updateRackBusy=false; unsafeOverwriteFunction("updateRack",function(rack,init){ try{ var cell=$("divUpdateRack"); if(!cell){ cell=createElement("div",{"id":"divUpdateRack","class":"blackbox","style":"position:absolute;top:20%;left:50%;font-weight:bold;"},$("rackItems"),"Rack updating"); cell.style.marginLeft=(-(cell.offsetWidth)/2)+"px"; } cell.style.display="block"; cell=null; unsafeWindow.updateRackBusy=true; }catch(err){GM_logError("updateRack\n"+err);} try{ unsafeWindow._updateRack(rack,init); }catch(err){GM_logError("_updateRack\n"+err);} }); unsafeOverwriteFunction("sortRackNew",function(type){ try{ unsafeWindow._sortRackNew(type); }catch(err){GM_logError("_sortRackNew\n"+err);} try{ // save rack amounts for(var v in prodName[0]){ if(!prodName[0].hasOwnProperty(v)){ continue; } if(v==0){ continue; } // Coins if (!unsafeWindow.rackElement[v]){ prodStock[0][v]=0; } // not available // else if ("undefined" === typeof(unsafeWindow.rackElement[v].id)){ prodStock[0][v]=0; } // empty elements else if ("undefined" === typeof(unsafeWindow.rackElement[v].number)){ prodStock[0][v]=0; } // no stock available else if (!unsafeWindow.rackElement[v].number){ prodStock[0][v]=0; } // no stock available else { prodStock[0][v]=parseInt(unsafeWindow.rackElement[v].number,10); } } GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodStock",implode(prodStock)); var cell=$("divUpdateRack"); if(cell){ cell.style.display="none"; } cell=null; window.setTimeout(function(){ calcProdMinRack(); // -> doBuyNotepad,doRack unsafeWindow.updateRackBusy=false; raiseEvent("gameUpdateRack"); },0); }catch(err){GM_logError("sortRackNew type="+type+"\n"+err);} }); /* function doRackNavi(){ try{ if(unsafeWindow.racktype!=2){ // Oil: no navi if(unsafeWindow.userracks>1){ if(unsafeWindow._currRack=="0"){ // Left arrow to last rack var div = unsafe$("racknavileft"); div.className = "link racknavi"; div.onmouseover = function(e) { unsafeWindow.showDiv("racknavileftinfo"); } div.onmouseout = function(e) { unsafeWindow.hideDiv("racknavileftinfo"); } div.onclick = function(e) { unsafeWindow.updateRack(Math.min(unsafeWindow.userracks,(unsafeWindow.premium==1?3:2))-1); } $("racknavileftinfo").innerHTML = unsafeWindow.rack_tt_info+" "+Math.min(unsafeWindow.userracks,(unsafeWindow.premium==1?3:2)); div=null; } else if (parseInt(unsafeWindow._currRack,10)==Math.min(unsafeWindow.userracks,(unsafeWindow.premium==1?3:2))-1){ // Right arrow to first rack var div = unsafe$("racknaviright"); div.className = "link racknavi"; div.onmouseover = function(e) { unsafeWindow.showDiv("racknavirightinfo"); } div.onmouseout = function(e) { unsafeWindow.hideDiv("racknavirightinfo"); } div.onclick = function(e) { unsafeWindow.updateRack("0"); } $("racknavirightinfo").innerHTML = unsafeWindow.rack_tt_info+" 1"; div=null; } } } }catch(err){ GM_logError("doRackNavi\n"+err); } } doRackNavi(); unsafeOverwriteFunction("initRackNavi",function(){ unsafeWindow._initRackNavi(); doRackNavi(); }); */ if(newdiv=$("rackItems")){ newdiv.addEventListener("dblclick",function(event){ try{ //GM_log("dblclick on "+event.target+" id="+event.target.id+" parentNode.id="+event.target.parentNode.id); var currId=null; var node=event.target; while((currId==null)&&(node!=this)){ if(node.id.match(/rackitem\d+/)){ currId=/rackitem(\d+)/.exec(node.id)[1]; }else{ node=node.parentNode; } } if((currId!=null)&&(!prodBlock[0][currId].match(/t/))){ showMarket(currId); } }catch(err){GM_logError("listener #rackItems.dblclick\n"+err);} },false); } /* TODO: function is not existing anymore unsafeOverwriteFunction("linfo",function(title,amount,id,offset,felder,kategorie){ unsafeWindow._linfo(title,amount,id,offset,felder,kategorie); var newdiv; var rackPopup=$("rackPopup"); if (!isNaN(NPC[0][id])){ newdiv=createElement("div",{"class":"tmenu","style":"position:relative;height:13px;width:172px;top:-75px;padding-left:20px;background: url('"+GFX+"lager/flaeche.gif') left top transparent;background-position:0px -155px;"},rackPopup); createElement("span",{"style":"float:left;width:60px;"},newdiv,getText("NPCprice")+": "); createElement("span",{"style":"float:left;width:100px;text-align:right;"},newdiv,moneyFormat(NPC[0][id])); } if(!prodBlock[0][id].match(/t/)){ newdiv=createElement("div",{"class":"tmenu","style":"position:relative;height:13px;width:172px;top:-75px;padding-left:20px;background: url('"+GFX+"lager/flaeche.gif') left top transparent;background-position:0px -155px;"},rackPopup); createElement("div",{"style":"display:inline-block;width:60px;"},newdiv,getText("marketPrice")+": "); createElement("div",{"style":"display:inline-block;width:100px;text-align:right;"},newdiv,moneyFormat(gut[id])); newdiv=createElement("div",{"class":"tmenu","style":"position:relative;height:13px;width:172px;top:-75px;padding-left:20px;background: url('"+GFX+"lager/flaeche.gif') left top transparent;background-position:0px -155px;"},rackPopup); createElement("div",{"style":"display:inline-block;width:60px;"},newdiv,getText("value")+": "); createElement("div",{"style":"display:inline-block;width:100px;text-align:right;"},newdiv,moneyFormatInt(gut[id]*prodStock[0][id])); newdiv=createElement("div",{"class":"tmenu","style":"position:relative;height:25px;width:172px;top:-75px;padding-left:20px;background: url('"+GFX+"lager/flaeche.gif') left top transparent;background-position:0px -155px;"},rackPopup); createElement("div",{"style":"width:160px;"},newdiv,getText("clickDouble")+": "+getText("goToMarket")); } newdiv=null;rackPopup=null; }); */ unsafeOverwriteFunction("globalcommitbox",function(content,onclick,onclick2){ try{ unsafeWindow._globalcommitbox(content,onclick,onclick2); }catch(err){GM_logError("_globalcommitbox\n"+err);} try{ raiseEvent("gameOpenGlobalCommitBox"); }catch(err){GM_logError("globalcommitbox\n"+err);} }); unsafeOverwriteFunction("globalBox",function(f,a,e,c,b){ try{ unsafeWindow._globalBox(f,a,e,c,b); }catch(err){GM_logError("_globalBox\n"+err);} try{ raiseEvent("gameOpenGlobalBox"); }catch(err){GM_logError("globalBox\n"+err);} }); if(newdiv=$("coins")){ newdiv1=newdiv.cloneNode(true); insertAfter(newdiv1,newdiv); newdiv1.id="coinsFormat"; newdiv1.innerHTML=numberFormat(prodStock[0][0]); newdiv.style.display="none"; newdiv.parentNode.setAttribute("class","link"); newdiv.parentNode.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,0); },false); newdiv.parentNode.addEventListener("click",function(){ showMarket(0); },false); } if(COUNTRY=="SE"){ $("bar").innerHTML=$("bar").innerHTML.replace(/\.(\d\d) /,",$1 "); } unsafeOverwriteFunction("updatePlayerInfo",function(money,coins,points,level,deco){ try{ unsafeWindow._updatePlayerInfo(money,coins,points,level,deco); }catch(err){GM_logError("_updatePlayerInfo\n"+err);} try{ // GM_log("updatePlayerInfo money="+money+" coins="+coins+" points="+points+" level="+level+" deco="+deco); if(money){ if(COUNTRY=="SE"){ money=money.replace(/\.(\d\d) /,",$1 "); $("bar").innerHTML=money; } money=parseFloat(money.replace(getText("gamecurrency"),"").replace(/\s+/g,"").replace(regDelimThou,"").replace(regDelimDeci,".")); unsafeData.money=money; GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_bargeld",money); } if(coins){ var c=parseInt(coins,10); if(!isNaN(c)){ prodStock[0][0]=c; $("coinsFormat").innerHTML=numberFormat(c); GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodStock",implode(prodStock)); } } }catch(err){GM_logError("updatePlayerInfo\n"+err);} }); document.addEventListener("gameDoGetData",function(){ window.setTimeout(loadProductData,0); },false); document.addEventListener("gameChangedBeobPrice",function(){ window.setTimeout(function(){ // GM_log("publish GMpreisBeob"); top.unsafeData.preisBeob=explode(GM_getValue(COUNTRY+"_"+SERVER+"_preisBeob","[]"),"eventListener@gameChangedBeobPrice/preisBeob",[]).clone(); },0); },false); document.addEventListener("gameChangedGut",function(){ window.setTimeout(function(){ gut=explode(GM_getValue(COUNTRY+"_"+SERVER+"_gut","[]"),"eventListener@gameChangedGut/gut",[]); top.unsafeData.gut=gut.clone(); calcFarmiCost(); },0); },false); document.addEventListener("gameChangedLevelLog",function(){ window.setTimeout(function(){ levelLog=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_levelLog","[]"),"eventListener@gameChangedLevelLog/levelLog",[]); setLevelLogId(); },0); },false); document.addEventListener("gameChangedProdMinRackInit",function(){ window.setTimeout(function(){ //if(valMinRackMan){ prodMinRackInit=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodMinRackInit","[]")); } calcProdMinRackInit(); },0); },false); // messages unsafeOverwriteFunction("messagesActionResponse",function(request,mode,id){ try{ unsafeWindow._messagesActionResponse(request,mode,id); }catch(err){GM_logError("_messagesActionResponse\n"+err);} try{ if(checkRequest(request,mode)){ switch(mode){ case "system": window.setTimeout(messagesSystem,0); break; } } }catch(err){GM_logError("messagesActionResponse\n"+err);} }); // market: [id,time,name,[prod,amount],money] // contract: [id,time,name,[[prod,amount],...],money] function messagesSystem(){ try{ if(!logSales){ logSales=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_logSales","[]"),"messagesSystem/logSales",[]); logSales.sort(sortObjFunctions["int"],true); logSalesId=new Object(); for(var v=logSales.length-1;v>=0;v--){ logSalesId[logSales[v][0]]=v; } } var j,help,help2,help3,help4,currMsg,sender,betreff,time,amount,prod,money,dayStr,price; var div,span; var countRequest=0; for(var i=unsafeWindow.messages_data.length-1;i>=0;i--){ currMsg=unsafeWindow.messages_data[i]; help=currMsg.body.replace(/\s+/g," "); if(help2=regMsgFriend.exec(currMsg.subject)){ //Friendship message // GM_log("messagesSystem: friendship message\nmessages_data["+i+"]:\n"+print_r(unsafeWindow.messages_data[i],"",true,"\n")); sender=help[1]; }else if (help2=regMsgMarketsaleContent.exec(help)){ // Market sale // GM_log("messages_data["+i+"] MARKET:\n"+print_r(unsafeWindow.messages_data[i],"",true,"\n")); switch(COUNTRY){ case "TR":{ help2.push(help2.splice(2,1).toString()); break;} case "SE":{ help2[4]=help2[4].replace(/\.(\d\d) /,",$1 "); help2[4]=help2[4].replace(/\.(\d\d)$/,",$1"); break;} } sender=help2[1]; betreff=(getText("marketplace")+": "+help2[3]).replace(/ /g," "); time=getTime(currMsg.time); prod=prodId[0][help2[3]]; amount=parseInt(help2[2],10); money=parseFloat(help2[4].replace(regDelimThou,"").replace(regDelimDeci,"."),10); price=Math.round(100*money/amount)/100; if(logSalesId[currMsg.nnr]==undefined){ logSalesId[currMsg.nnr]=logSales.push([currMsg.nnr])-1; dayStr=getDateStr(time,2,false); for(var v=levelLog.length-1;v>=0;v--){ if(levelLog[v][0]==dayStr){ break; } } if(v<0){ v=levelLog.push([dayStr,0,null,0,0,0])-1; } levelLog[v][3]+=money; levelLog[v][3]=Math.round(100*levelLog[v][3])/100; help3 = amount; while(help3>0){ for(var v=ownMarketOffers.length-1;v>=0;v--){ if((ownMarketOffers[v][0]==prod)&&(ownMarketOffers[v][1]==price)){ help4 = Math.min(ownMarketOffers[v][2],help3); ownMarketOffers[v][2] -= help4; if(ownMarketOffers[v][2]<1){ ownMarketOffers.splice(v,1); } help3 -= help4; break; } } if(v<0){ help3=0; } } } j=logSalesId[currMsg.nnr]; logSales[j][1]=time; logSales[j][2]=sender; logSales[j][3]=[prod,amount]; logSales[j][4]=money; if(valMessagesSystemMarkRead&&(currMsg.read=="0")){ window.setTimeout(unsafeWindow.messagesAction,500*(++countRequest),"unread",i); } if(div=$("messages_list_subject"+currMsg.nnr)){ div.setAttribute("j",j); div.addEventListener("mouseover",function(event){ toolTip.show(event,toolTipSales(this.getAttribute("j"))); },false); div.classList.add("systemMsg_marketsale"); div.innerHTML=""; igm(sender,div,betreff); createElement("div",{"style":"display:inline-block;width:125px;margin-right:5px;"},div,sender); span=createElement("div",{"style":"display:inline-block;width:145px;margin-right:5px;text-align:right;"},div,numberFormat(amount)+" "+prodName[0][prod]+" "); produktPic(0,prod,span); createElement("div",{"style":"display:inline-block;width:75px;margin-right:5px;text-align:right;"},div,moneyFormatInt(money)); } }else if (help2=regMsgContractsaleContent.exec(help)){// Contract sale if(COUNTRY=="SE"){ help2[3]=help2[3].replace(/\.(\d\d) /,",$1 "); help2[3]=help2[3].replace(/\.(\d\d)$/,",$1"); } sender=help2[1]; money=parseFloat(help2[3].replace(regDelimThou,"").replace(regDelimDeci,"."),10); time=getTime(currMsg.time); if(logSalesId[currMsg.nnr]==undefined){ logSalesId[currMsg.nnr]=logSales.push([currMsg.nnr])-1; var dayStr=getDateStr(time,2,false); for(var v=levelLog.length-1;v>=0;v--){ if(levelLog[v][0]==dayStr){ break; } } if(v<0){ v=levelLog.push([dayStr,0,null,0,0,0])-1; } levelLog[v][4]+=money; levelLog[v][4]=Math.round(100*levelLog[v][4])/100; } j=logSalesId[currMsg.nnr]; logSales[j][1]=time; logSales[j][2]=sender; logSales[j][3]=new Array(); help4=new Array(); while(help3=regMsgContractsaleList.exec(help2[2])){ help2[2]=help2[2].replace(help3[0],""); logSales[j][3].push([prodId[0][help3[2]],parseInt(help3[1],10)]); } betreff=getText("contract"); if(logSales[j][3].length==1){ prod=logSales[j][3][0][0]; amount=logSales[j][3][0][1]; betreff+=": "+prodName[0][prod]; } logSales[j][4]=money; if(valMessagesSystemMarkRead&&(currMsg.read=="0")){ window.setTimeout(unsafeWindow.messagesAction,500*(++countRequest),"unread",i); } if(div=$("messages_list_subject"+currMsg.nnr)){ div.setAttribute("j",j); div.addEventListener("mouseover",function(event){ toolTip.show(event,toolTipSales(this.getAttribute("j"))); },false); div.classList.add("systemMsg_contractsale"); div.innerHTML=""; igm(sender,div,betreff); createElement("div",{"style":"display:inline-block;width:125px;margin-right:5px;"},div,sender); span=createElement("div",{"style":"display:inline-block;width:145px;margin-right:5px;text-align:right;"},div); if(logSales[j][3].length==1){ span.innerHTML=numberFormat(amount)+" "+prodName[0][prod]+" "; produktPic(0,prod,span); }else{ span.innerHTML="..."; } createElement("div",{"style":"display:inline-block;width:75px;margin-right:5px;text-align:right;"},div,moneyFormatInt(money)); } }else{ GM_log("messagesSystem: unknown message type\nmessages_data["+i+"]:\n"+print_r(unsafeWindow.messages_data[i],"",true,"\n")); } } if(countRequest>0){ if(div=$("messageAlertReadingAll")){ removeElement(div); } if(div=$("messages_main")){ createElement("div",{"id":"messageAlertReadingAll","class":"alertbubble","style":"left:50%;margin-left:-200px;top:100px;text-align:center;font-weight:bold;"},div,getText("pleaseWait")); window.setTimeout(function(){ removeElement($("messageAlertReadingAll")); },500*(++countRequest)); } } GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_levelLog",implode(levelLog)); GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_ownMarketOffers",implode(ownMarketOffers)); doMarketoffersNotepad(); GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_logSales",implode(logSales)); }catch(err){GM_logError("messagesSystem\n"+err);} }; if(newdiv=$("messages_list_check")){ newdiv2=createElement("button",{"class":"link button_new","type":"button","style":"margin-right:5px;"},false,getText("salesLog")); newdiv.insertBefore(newdiv2, newdiv.firstElementChild); newdiv2.addEventListener("click",function(){ unsafeWindow.buildInfoPanel("messages"); },false); } // events farm ================================================================================ err_trace="events farm"; unsafeOverwriteFunction("farmMove",function(b){ try{ unsafeWindow._farmMove(b); }catch(err){GM_logError("_farmMove\n"+err);} try{ if(b==99){ gameLocation=["farmersmarket"]; unsafeData.gameLocation=gameLocation.clone(); raiseEvent("gameFarmersmarketOpened"); }else{ gameLocation=["farm",unsafeWindow.farm-1]; unsafeData.gameLocation=gameLocation.clone(); raiseEvent("gameFarmOpened"); } }catch(err){GM_logError("farmMove\n"+err);} }); function doFarmZone(farmNR,zoneNr){ try{ var divZone,divZoneInfo,div; var help,zoneNrF,data,currZoneType; if(divZone=$("farm"+farmNR+"_pos"+zoneNr)){ zoneNrF=zoneNr+6*(farmNR-1); // zone is blocked divZone.style.opacity=(zones.getBlock(zoneNrF).match(/[pq]/)?0.5:1); if(!zones.getBlock(zoneNrF)){ data=unsafeWindow.farms_data.farms[farmNR][zoneNr]; currZoneType=parseInt(data.buildingid,10); // Upgrade button if(BUILDING_UPGRADES[currZoneType]&&BUILDING_UPGRADES[currZoneType][data.level]){ if(data.upgrade&&(!data.premiumblock)){ div=$("farm_upgrade_tt"+farmNR+"_"+zoneNr); }else{ div=$("farm_buttons"+farmNR+"_"+zoneNr); div=createElement("div",{"id":"farm_button_upgrade"+farmNR+"_"+zoneNr,"class":"farm_button_upgrade button_upgrade link"},div); div=createElement("div",{"id":"farm_upgrade_tt"+farmNR+"_"+zoneNr,"class":"ttbox farm_button_tt"},div); createElement("div",{},div,unsafeWindow.infoupdatebuilding); if(isNaN(BUILDING_UPGRADES[currZoneType][data.level][1])){ createElement("div",{},div,BUILDING_UPGRADES[currZoneType][data.level][1].replace("c","")+" "+getText("coins")); }else{ createElement("div",{},div,moneyFormatInt((1-unsafeData.carpentry_bonus/100)*BUILDING_UPGRADES[currZoneType][data.level][1])); } if(USERLEVEL<BUILDING_UPGRADES[currZoneType][data.level][0]){ createElement("div",{"class":"bonusinfo important"},div,unsafeWindow.error1005.replace("%LEVEL%",BUILDING_UPGRADES[currZoneType][data.level][0])); } } if(div){ var help2=BUILDING_UPGRADES[currZoneType][data.level-1][2]-BUILDING_UPGRADES[currZoneType][data.level][2]; if(help2>0){ if(currZoneType==1){ if(data.level>3){ createElement("div",{"style":"margin-top:10px;"},div,unsafeWindow.updatetext[7].replace(/%MORE%/,numberFormat(100*help2))); // water bonus on product }else{ createElement("div",{"style":"margin-top:10px;"},div,unsafeWindow.updatetext[6].replace(/%MORE%/,numberFormat(100*(1-BUILDING_UPGRADES[currZoneType][data.level][2])))); // general water bonus } }else{ createElement("div",{"style":"margin-top:10px;"},div,unsafeWindow.updatetext[2].replace(/%MORE%/,numberFormat(100*help2))); // reduction of time } } help2=BUILDING_UPGRADES[currZoneType][data.level][3]-BUILDING_UPGRADES[currZoneType][data.level-1][3]; if(help2>0){ // more animals var animalCost=0; for(var nr=1;nr<=help2;nr++){ animalCost += Math.round(ANIMALCOST[currZoneType][0]+(totalAnimals[currZoneType]+nr)*ANIMALCOST[currZoneType][1]); } createElement("div",{"style":"margin-top:10px;"},div,unsafeWindow.updatetext[1].replace(/%MORE%/,numberFormat(BUILDING_UPGRADES[currZoneType][data.level][3]))+" (+"+help2+", "+moneyFormatInt(animalCost)+")"); } } } // Zone mouseover showing possible production if(BUILDINGTYPE[currZoneType]!=0){ // Replace Level-Stars (else it blocks zone mouseover) divZone.querySelector(".farm_pos_back").appendChild(divZone.querySelector(".farm_pos_level")); divZone.querySelector(".farm_pos_click").addEventListener("mouseover",function(event){ var help=/^farm(\d+)_pos(\d+)_click$/.exec(this.id); var farmNR=parseInt(help[1],10); var zoneNr=parseInt(help[2],10); var zoneNrF=zoneNr+6*(farmNR-1); var currZoneType=zones.getBuilding(zoneNrF); var currAnimals=zones.getAnimals(zoneNrF); if(currZoneType==1){ showLagerZeitZiel(zoneNrF); }else{ var buildinginfo = this.querySelector(".tt"); if(!buildinginfo){ buildinginfo=createElement("div",{"class":"tt","style":"display:none;"},this); var table,tr,td,div; table=createElement("table",{"border":"0","cellspacing":"0","cellpadding":"0"},buildinginfo); switch(BUILDINGTYPE[currZoneType]){ case 2:{ help=""; for(var output in BUILDING_INPUT[currZoneType]){ if(!BUILDING_INPUT[currZoneType].hasOwnProperty(output)){ continue; } if(prodBlock[0][output]){ continue; } tr=createElement("tr",{},table); td=createElement("td",{"style":help+"padding-right:5px;"},tr); div=createElement("div",{"style":"line-height:16px;white-space:nowrap;"},td); produktPic(0,output,div); createElement("span",{},div,numberFormat(prodYield[0][output]*currAnimals)+" "+prodName[0][output]); pointsFormat(prodYield[0][output]*currAnimals*prodPoints[0][output],"div",td); // 60*prodGrowTime[0][output]*(100-zones.getBonus(zoneNrF))/100 var time=[]; time[0]=calcProductionTime(2,0,output,1-zones.getBonus(zoneNrF)/100,BUILDING_INPUT[currZoneType][output][0][0][1]/currAnimals)[0]; time[1]=calcProductionTime(2,0,output,1-zones.getBonus(zoneNrF)/100,BUILDING_INPUT[currZoneType][output][0][0][1]/currAnimals,1)[0]; for(var alt=1;alt<BUILDING_INPUT[currZoneType][output].length;alt++){ time[0]=Math.min(time[0],calcProductionTime(2,0,output,1-zones.getBonus(zoneNrF)/100,BUILDING_INPUT[currZoneType][output][alt][0][1]/currAnimals)[0]); time[1]=Math.max(time[1],calcProductionTime(2,0,output,1-zones.getBonus(zoneNrF)/100,BUILDING_INPUT[currZoneType][output][alt][0][1]/currAnimals,1)[0]); } createElement("div",{"style":"line-height:16px;white-space:nowrap;"},td,getTimeStr(time[0])+" - "+getTimeStr(time[1])); for(var alt=0;alt<BUILDING_INPUT[currZoneType][output].length;alt++){ td=createElement("td",{"style":help+"border-left:1px dashed black;padding:0 5px;"},tr); for(var i=0;i<BUILDING_INPUT[currZoneType][output][alt].length;i++){ div=createElement("div",{"style":"line-height:16px;white-space:nowrap;"},td); produktPic(0,BUILDING_INPUT[currZoneType][output][alt][i][0],div); createElement("span",{},div,"1 - "+numberFormat(calcProductionTime(2,0,output,1-zones.getBonus(zoneNrF)/100,BUILDING_INPUT[currZoneType][output][alt][0][1]/currAnimals)[1])+" "+prodName[0][BUILDING_INPUT[currZoneType][output][alt][i][0]]); createElement("div",{"style":"line-height:16px;white-space:nowrap;"},td,getTimeStr(BUILDING_INPUT[currZoneType][output][alt][i][1]/currAnimals)); } } help="border-top:1px solid black;"; } break;} case 3:{ help=""; for(var output in BUILDING_INPUT[currZoneType]){ if(!BUILDING_INPUT[currZoneType].hasOwnProperty(output)){ continue; } if(prodBlock[0][output]){ continue; } tr=createElement("tr",{},table); td=createElement("td",{"style":help+"padding-right:10px;"},tr); div=createElement("div",{"style":"line-height:16px;white-space:nowrap;"},td); produktPic(0,output,div); createElement("span",{},div,numberFormat(prodYield[0][output])+" "+prodName[0][output]); pointsFormat(prodYield[0][output]*prodPoints[0][output],"div",td); createElement("div",{"style":"line-height:16px;white-space:nowrap;"},td,getTimeStr(60*prodGrowTime[0][output]*(100-zones.getBonus(zoneNrF))/100)); for(var alt=0;alt<BUILDING_INPUT[currZoneType][output].length;alt++){ td=createElement("td",{"style":help+"border-left:1px dashed black;padding:0 5px;"},tr); for(var i=0;i<BUILDING_INPUT[currZoneType][output][alt].length;i++){ div=createElement("div",{"style":"line-height:16px;white-space:nowrap;"},td); produktPic(0,BUILDING_INPUT[currZoneType][output][alt][i][0],div); createElement("span",{},div,numberFormat(BUILDING_INPUT[currZoneType][output][alt][i][1])+" "+prodName[0][BUILDING_INPUT[currZoneType][output][alt][i][0]]); } } help="border-top:1px solid black;" } break;} } table=null;tr=null;td=null;div=null; } toolTip.show(event,buildinginfo.innerHTML,this); buildinginfo=null; } help=null; },false); } // Zone info - show current production divZoneInfo=divZone.querySelector(".farm_pos_production"); if(!divZoneInfo){ divZoneInfo=createElement("div",{"class":"farm_pos_production"},divZone); } divZoneInfo.addEventListener("mouseover",function(event){ var help=/^farm(\d+)_pos(\d+)$/.exec(this.parentNode.id); help=parseInt(help[2],10)+6*(parseInt(help[1],10)-1); toolTip.show(event,toolTipZoneProduction(help)); },false); // Mouseover divZone.addEventListener("mouseout",function(){ hideBlase(); hideLagerZeitZiel(); },false); divZone.addEventListener("mouseover",function(){ var help = /^farm(\d+)_pos(\d+)$/.exec(this.id); help=parseInt(help[2],10)+6*(parseInt(help[1],10)-1) showBlase(help); showLagerZeitZiel(help); },true); // Mouseover by tooltip if(div=divZone.querySelector(".farm_button_autoplant")){ div.addEventListener("mouseover",function(event){ toolTip.show(event,this.querySelector(".farm_button_tt").innerHTML,this); },false); } if(div=divZone.querySelector(".farm_button_upgrade")){ div.addEventListener("mouseover",function(event){ toolTip.show(event,this.querySelector(".farm_button_tt").innerHTML,this); },false); } if(div=divZone.querySelector(".farm_button_gardenspeedup")){ div.addEventListener("mouseover",function(event){ toolTip.show(event,this.querySelector(".farm_button_tt").innerHTML,this); },false); } // Specific things switch(currZoneType){ case 1:{ // field // percentage of garbaged area if((help=zones.getProduction(zoneNrF))&&help[2]&&(help[2][1]<BUILDING_SIZE["1"])){ createElement("div",{"id":"garbagePerc_"+zoneNrF,"class":"blackbox","style":"position:absolute;top:50px;left:50px;padding:4px;font-weight:bold;"},divZone.querySelector(".farm_pos_back"),numberFormat(100*help[2][1]/BUILDING_SIZE["1"])+"%"); } // Production if(div=$("farm_production_running"+farmNR+"_"+zoneNr)){ createElement("div",{"class":"v"+zones.getMainproduct(zoneNrF),"style":"position:absolute;"},div); } // Watering timer createZoneTimer("zoneTimerWater_"+zoneNrF,zoneNrF,"zoneTimerWater","top:20px;left:5px;",divZone); break;} case 2:{ // chicken // more animals createElement("img",{"src":GFX+"chickenmapani2.gif","style":"position:absolute;top:30px;left:10px;"},divZone.firstElementChild.firstElementChild); createElement("img",{"src":GFX+"chickenmapani2.gif","style":"position:absolute;top:30px;left:50px;"},divZone.firstElementChild.firstElementChild); createElement("img",{"src":GFX+"chickenmapani1.gif","style":"position:absolute;top:50px;left:70px;"},divZone.firstElementChild.firstElementChild); createElement("img",{"src":GFX+"chickenmapani1.gif","style":"position:absolute;top:60px;left:30px;"},divZone.firstElementChild.firstElementChild); createElement("img",{"src":GFX+"chickenmapani1.gif","style":"position:absolute;top:80px;left:30px;"},divZone.firstElementChild.firstElementChild); createElement("img",{"src":GFX+"chickenmapani2.gif","style":"position:absolute;top:100px;left:50px;"},divZone.firstElementChild.firstElementChild); break;} case 4:{ // sheep // more animals createElement("img",{"src":GFX+"sheep_ani01.gif","style":"position:absolute;top:60px;left:30px;"},divZone.firstElementChild.firstElementChild); createElement("img",{"src":GFX+"sheep_ani02.gif","style":"position:absolute;top:30px;left:10px;"},divZone.firstElementChild.firstElementChild); break;} case 12:{ // goats // more animals createElement("img",{"src":GFX+"goat_ani_01.gif","style":"position:absolute;top:105px;left:50px;"},divZone.firstElementChild.firstElementChild); createElement("img",{"src":GFX+"goat_ani_02.gif","style":"position:absolute;top:75px;left:30px;"},divZone.firstElementChild.firstElementChild); break;} case 13:{ // oil if(div=$("farm_production_current13_"+zoneNr)){ divZone.appendChild(div); } } case 14:{ // special oil if(div=$("farm_production_current14_"+zoneNr)){ divZone.appendChild(div); } } } } divZone=null;divZoneInfo=null;div=null; } }catch(err){GM_logError("doFarmZone\nfarmNR="+farmNR+" zoneNr="+zoneNr+"\n"+err);} } unsafeData.carpentry_bonus=parseInt($("carpentry_icon_currentbonus").innerHTML,10); unsafeOverwriteFunction("farmBuildPositions",function(){ try{ unsafeWindow._farmBuildPositions(); }catch(err){GM_logError("_farmBuildPositions\n"+err);} try{ var farmNr,zoneNr,zoneNrF,data,currZoneType,currBlock,currBonus,currBonusSpecial; totalAnimals=[]; if(!unsafeData.carpentry_bonus){ unsafeData.carpentry_bonus=0; } for (var d in unsafeWindow.farms_data.farms) { if(!unsafeWindow.farms_data.farms.hasOwnProperty(d)){ continue; } if (d > unsafeWindow.farms_data.count) { break; } for (var c in unsafeWindow.farms_data.farms[d]) { if(!unsafeWindow.farms_data.farms[d].hasOwnProperty(c)){ continue; } data=unsafeWindow.farms_data.farms[d][c]; farmNr=parseInt(d,10); zoneNr=parseInt(c,10); zoneNrF=zoneNr+6*(farmNr-1); currZoneType=parseInt(data.buildingid,10); currBlock=""; if(BUILDINGTYPE[currZoneType]==0){ currBlock+="t"; //blocked by type (Club & Carpentry) } if(data.bulldoze&&data.bulldoze.quest){ currBlock+="q"; //blocked by quest } if(data.bulldoze&&data.bulldoze.cost){ currBlock+="b"; //blocked by payment } if(data.status=="0"){ currBlock+="s"; //blocked by status } if ((unsafeWindow.premium!=1)&&(data.premium==1)){ currBlock+="p"; //premium-zone but no premium-account } currBonus=((BUILDING_UPGRADES[currZoneType]&&BUILDING_UPGRADES[currZoneType][data.level-1])?Math.round(100*(1-BUILDING_UPGRADES[currZoneType][data.level-1][2])):0); currBonusSpecial=null; if (currZoneType==1){ // Field if(questData["main"]["1"]["nr"]>170){ currBonus+=5; } // global bonus gained by quest 170 if(data.product){ currBonusSpecial=[parseInt(data.product,10),10]; // the id of special plant, additional bonus for special plant } } zones.setBuilding(zoneNrF,currZoneType); zones.setBlock(zoneNrF,currBlock); zones.setBonus(zoneNrF,currBonus); zones.setBonusSpecial(zoneNrF,currBonusSpecial); if(currBlock){ zones.setProduction(zoneNrF,[[],0,0,true]); if(zones.isMultiSlot(zoneNrF)){ for(var slot=1;slot<=3;slot++){ // TODO dynamic slot-amount zones.setProduction(zoneNrF+"."+slot,[[],0,0,true]); } } } if(data.animals){ zones.setAnimals(zoneNrF,parseInt(data.animals,10)); } } } for (var d in unsafeWindow.farms_data.farms) { if(!unsafeWindow.farms_data.farms.hasOwnProperty(d)){ continue; } if (d > unsafeWindow.farms_data.count) { break; } for (var c in unsafeWindow.farms_data.farms[d]) { if(!unsafeWindow.farms_data.farms[d].hasOwnProperty(c)){ continue; } doFarmZone(parseInt(d,10),parseInt(c,10)); } } calcTotalZones(); lastGiess=null; lastErnte=null; // Event raiseEvent("gameFarmLoaded"); }catch(err){GM_logError("farmBuildPositions\nzoneNrF="+zoneNrF+"\n"+err);} }); // Farm filling // initZones > getUserFarmInfos > userFarmInfosResponse > getTimeEvents > // unsafeOverwriteFunction("initZones",function(farmid){ // unsafeWindow._initZones(farmid); // }); function drawZoneNavi(zoneNrF,container){ try{ // logBubble.add("drawZoneNavi zoneNrF="+zoneNrF); var newdiv=$("zoneNavi"); if(newdiv){ removeElement(newdiv); } newdiv=createElement("div",{"id":"zoneNavi"},container); var newdiv1; var c=[null,null,null]; for(var i=0;i<ALL_ZONES["farm"].length;i++){ if(ALL_ZONES["farm"][i]==zoneNrF){ c[1]=i;break; } } if(c[1]!=null){ c[2]=((c[1]+1)%ALL_ZONES["farm"].length); while(zones.getBlock(ALL_ZONES["farm"][c[2]])||(zones.getBuilding(ALL_ZONES["farm"][c[2]])!=zones.getBuilding(zoneNrF))){ c[2]=((c[2]+1)%ALL_ZONES["farm"].length); } if (c[1]!=c[2]){ c[0]=((c[1]+ALL_ZONES["farm"].length-1)%ALL_ZONES["farm"].length); while(zones.getBlock(ALL_ZONES["farm"][c[0]])||(zones.getBuilding(ALL_ZONES["farm"][c[0]])!=zones.getBuilding(zoneNrF))){ c[0]=((c[0]+ALL_ZONES["farm"].length-1)%ALL_ZONES["farm"].length); } if (c[0]!=c[2]){ newdiv1=createElement("div",{"class":"link leftarrow","zone":ALL_ZONES["farm"][c[0]]},newdiv); newdiv1.addEventListener("click",function(){ if(this.parentNode){ removeElement(this.parentNode); } goToZone(this.getAttribute("zone")); },false); newdiv1.addEventListener("mouseover",function(event){ var zone=parseInt(this.getAttribute("zone"),10); toolTip.show(event,getText("goToZoneX").replace(/%1%/,Math.ceil(zone/6)+"."+(1+((zone-1)%6)))); zone=null; },false); } newdiv1=createElement("div",{"class":"link rightarrow","zone":ALL_ZONES["farm"][c[2]]},newdiv); newdiv1.addEventListener("click",function(){ if(this.parentNode){ removeElement(this.parentNode); } goToZone(this.getAttribute("zone")); },false); newdiv1.addEventListener("mouseover",function(event){ var zone=parseInt(this.getAttribute("zone"),10); toolTip.show(event,getText("goToZoneX").replace(/%1%/,Math.ceil(zone/6)+"."+(1+((zone-1)%6)))); zone=null; },false); } } newdiv=null;newdiv1=null; }catch(err){GM_logError("drawZoneNavi zoneNrF="+zoneNrF+"\n"+err);} } // field function checkFieldTimes(){ try{ if(DEVMODE_FUNCTION){ var trackingHandle = tracking.start("berater","checkFieldTimes"); } var zoneNr=parseInt(/parent.cache_me\((\d+?),120/.exec($("gardenarea").innerHTML)[1],10); var zoneNrF=zoneNr+6*gameLocation[1]; var newData=[[{}],[,0,0,,0],[,0,0,,0],true]; // save garden-informations var helpArray=new Array();//planted fields var helpArray2=new Array();//empty fields var z,p,w,iAmount,iPoints,help; for(var v=1;v<=BUILDING_SIZE["1"];v++){ z=parseInt(unsafeWindow.garten_zeit[v],10); p=unsafeWindow.garten_prod[v]; switch(unsafeWindow.garten_kategorie[v]){ case "v":{ // plants helpArray[v]=true; helpArray2[v]=false; if (z>0){ iAmount=(prodYield[0][p]+((currentPowerup[p]&&(z<currentPowerup[p][0]))?currentPowerup[p][1]:0)); iPoints=(prodPoints[0][p]+((currentPowerup[p]&&(z<currentPowerup[p][0]))?currentPowerup[p][2]:0)); if ((unsafeWindow.garten_x[v]==1)&&(unsafeWindow.garten_y[v]==1)){ // only first part of a plant w=parseInt(unsafeWindow.garten_wasser[v],10)+86400; w=((w==86400)?1:(w<z?w:NEVER)); // watertime if(!newData[0][0][p]){ newData[0][0][p]=new Array(); } var notfound=true; for(var i=0;i<newData[0][0][p].length;i++){ if((newData[0][0][p][i][2]==z)&&(newData[0][0][p][i][3]==w)){ newData[0][0][p][i][0]+=iAmount; newData[0][0][p][i][1]+=iPoints; notfound=false;break; } } if(notfound){ newData[0][0][p].push([iAmount,iPoints,z,w]); } } // only show one sprinkler if ((unsafeWindow.garten_x[v]==2)||(unsafeWindow.garten_y[v]!=unsafeWindow.garten_max_y[v])){ if ($("w"+v).style.display!="none") $("w"+v).style.display="none"; }else{ if ($("w"+v).style.display!="") $("w"+v).style.display=""; } }else{ helpArray[v]=true; helpArray2[v]=true; } break;} case "z":{ // decorations helpArray[v]=false; helpArray2[v]=false; if ((unsafeWindow.garten_x[v]==1)&&(unsafeWindow.garten_y[v]==1)){ // only first part if(!newData[0][0][p]){ newData[0][0][p]=new Array(); } var notfound=true; for(var i=0;i<newData[0][0][p].length;i++){ if((newData[0][0][p][i][2]==z)){ newData[0][0][p][i][0]++; notfound=false;break; } } if(notfound){ newData[0][0][p].push([1,0,z]); } } break;} case "u":{ // garbage helpArray[v]=false; helpArray2[v]=false; if(!newData[0][0][p]){ newData[0][0][p]=1; } else{ newData[0][0][p]++; } break;} default:{ // empty fields , p==0 helpArray[v]=true; helpArray2[v]=true; break;} } } // calculate current space for(var v=1;v<helpArray2.length;v++){ if(helpArray2[v]){ newData[1][1]++; } } help=helpArray2.clone(); for(var v=1;v<help.length;v++){ if((v%12!=0)&&help[v]&&help[v+1]){ help[v+1]=false; newData[1][2]++; } } help=helpArray2.clone(); for(var v=1;v<help.length;v++){ if((v%12!=0)&&help[v]&&help[v+1]&&help[v+12]&&help[v+13]){ help[v+1]=false; help[v+12]=false; help[v+13]=false; newData[1][4]++; } } // calculate possible space for(var v=1;v<helpArray.length;v++){ if(helpArray[v]){ newData[2][1]++; } } help=helpArray.clone(); for(var v=1;v<help.length;v++){ if((v%12!=0)&&help[v]&&help[v+1]){ help[v+1]=false; newData[2][2]++; } } help=helpArray.clone(); for(var v=1;v<help.length;v++){ if((v%12!=0)&&help[v]&&help[v+1]&&help[v+12]&&help[v+13]){ help[v+1]=false; help[v+12]=false; help[v+13]=false; newData[2][4]++; } } // calculate garden-informations zones.setProduction(zoneNrF,newData.clone()); newData=null; // auto-watering if((top.unsafeData.autoAction==null)&&valAutoWater["farm"] && (zones.getWatertime(zoneNrF)<unsafeWindow.Zeit.Server) && (lastGiess!=zoneNrF) && $("tooltipwaterall") && $("waterall")){ top.unsafeData.autoAction="berater: field water"; lastGiess=zoneNrF; window.setTimeout(function(div){ click(div); top.unsafeData.autoAction=null; },500,$("waterall").firstElementChild); } //auto-cropping if((top.unsafeData.autoAction==null)&&valAutoCrop["farm"] && (zones.getEndtime(zoneNrF)<unsafeWindow.Zeit.Server) && (lastErnte!=zoneNrF) && $("tooltipcropall") && $("cropall")){ top.unsafeData.autoAction="berater: field crop"; lastErnte=zoneNrF; window.setTimeout(function(div){ click(div); top.unsafeData.autoAction=null; },500,$("cropall").firstElementChild); } // update zone-icons // TODO! // show croppings of this field var cell=$("currentFieldZoneErnte"); var newdiv; if(cell){ cell.innerHTML=""; } else{ cell=createElement("div",{"id":"currentFieldZoneErnte","style":"position:absolute;top:40px;left:0;","class":"blackbox"},$("gardenmaincontainer")); } help=zones.getCrop(zoneNrF); for(var k=0;k<help.length;k++){ newdiv=createElement("div",{"style":"height:15px"},cell); produktPic(help[k][0],help[k][1],newdiv); createElement("span",{},newdiv,numberFormat(help[k][2])+" "+prodName[help[k][0]][help[k][1]]); } cell=null;newdiv=null; if(DEVMODE_FUNCTION){ tracking.end("berater",trackingHandle); } }catch(err){ GM_logError("checkFieldTimes\n"+err); } } unsafeOverwriteFunction("getGardenInfoResponse",function(request,zoneNr){ try{ unsafeWindow._getGardenInfoResponse(request,zoneNr); }catch(err){GM_logError("_getGardenInfoResponse\n"+err);} try{ // GM_log("getGardenInfoResponse zoneNr="+zoneNr+"\n"+print_r(eval('('+response+')'),"",true,"\n")); //waterlog GM_log("getGardenInfoResponse zoneNr="+zoneNr+"\nwater: "+print_r(eval('('+response+')')["water"],"",true,"\n")); zoneNr=parseInt(zoneNr,10); var zoneNrF=zoneNr+6*gameLocation[1]; if (!$("divErnteInfo")){ createElement("div",{"id":"divErnteInfo"},$("gardenmaincontainer")); } $("gardenmaincontainer").setAttribute("zoneNr",zoneNr); drawZoneNavi(zoneNrF,$("gardenmaincontainer")); showLagerZeitZiel(zoneNrF); //Klon des Anpflanzautomaten /* var newdiv; if($("gardencancel").childElementCount==1 && $("autoplantbutton"+zoneNr)){ newdiv=$("autoplantbutton"+zoneNr).parentNode.cloneNode(true); newdiv.addEventListener("click",function(){$("gardenmaincontainer").setAttribute("style","display:none");},false); $("gardencancel").appendChild(newdiv); } newdiv=null; */ checkFieldTimes(); }catch(err){GM_logError("getGardenInfoResponse\n"+err);} }); unsafeOverwriteFunction("farmAction",function(mode,farm,position,s,d,b,a){ try{ switch(mode){ case "dailydonkey":{ // Only consider opening donkeyInfoPanel, if donkey is bought if (unsafeWindow.donkey_isset) { var showDonkeyPanel=false; for(var i=logDonkey.length-1;i>=0;i--){ if(logDonkey[i][0]==todayServerStr){ showDonkeyPanel=true; break; } } if(showDonkeyPanel){ unsafeWindow.buildInfoPanel("donkey"); return false; } } break;} } }catch(err){GM_logError("farmAction (pre)\n"+err);} try{ unsafeWindow._farmAction(mode,farm,position,s,d,b,a); }catch(err){GM_logError("_farmAction\n"+err);} }); unsafeOverwriteFunction("farmActionResponse",function(request,mode,farmNR,zoneNr,z,d,b,a){ try{ unsafeWindow._farmActionResponse(request,mode,farmNR,zoneNr,z,d,b,a); }catch(err){GM_logError("_farmActionResponse\n"+err);} try{ var r = checkRequest(request, mode); if((r!=0)&&(r[0]!=0)){ var zoneNrF = zoneNr+6*(farmNR-1); if(zones.getBuilding(zoneNrF)==1){ switch(mode){ case "gardeninit": raiseEvent("gameFieldOpened"); break; case "autoplant": raiseEvent("gameFieldPlanted"); break; case "watergarden": raiseEvent("gameFieldWatered"); break; case "cropgarden": raiseEvent("gameFieldCropped"); break; } } switch(mode){ case "dogbonus": doDogBen(); break; case "flowerarea_harvest_all": raiseEvent("gameFarmersmarketCropped"); break; case "flowerarea_autoplant": raiseEvent("gameFarmersmarketStarted"); break; case "flowerarea_water_all": raiseEvent("gameFarmersmarketWatered"); break; case "megafield_tour": raiseEvent("gameMegafieldTourStarted"); break; case "nursery_harvest": raiseEvent("gameFarmersmarketCropped"); break; case "nursery_startproduction": raiseEvent("gameFarmersmarketStarted"); break; case "sellfarmi":{ calcFarmiCost(); calcTotalFarmis(); doFarmis(); raiseEvent("gameFarmiResponse"); break;} } } else { switch(mode) { case "dailydonkey": raiseEvent("gameDonkeyResponse"); if (unsafeWindow.donkey_isset && r!=0 && r[0]==0) { for(var i=logDonkey.length-1;i>=0;i--){ if(logDonkey[i][0]==todayServerStr){ return; // Don't save dummy, if entry for today found } } // Save dummy for today's donkey log var newElem=[todayServerStr,0,[]]; logDonkey.push(newElem); GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_logDonkey",implode(logDonkey)); hideGoToDonkey(); } break; } } }catch(err){GM_logError("farmActionResponse\n"+err);} }); unsafeOverwriteFunction("PflanzResponse",function(request){ try{ unsafeWindow._PflanzResponse(request); }catch(err){GM_logError("_PflanzResponse\n"+err);} try{ if((request.readyState==4)&&(request.status==200)){ checkFieldTimes(); raiseEvent("gameFieldPlanted"); } }catch(err){GM_logError("PflanzResponse\n"+err);} }); unsafeOverwriteFunction("WasserResponse",function(request){ try{ unsafeWindow._WasserResponse(request); }catch(err){GM_logError("_WasserResponse\n"+err);} try{ if((request.readyState==4)&&(request.status==200)){ checkFieldTimes(); raiseEvent("gameFieldWatered"); } }catch(err){GM_logError("WasserResponse\n"+err);} }); unsafeOverwriteFunction("ErnteResponse",function(request){ try{ unsafeWindow._ErnteResponse(request); }catch(err){GM_logError("_ErnteResponse\n"+err);} try{ if((request.readyState==4)&&(request.status==200)){ checkFieldTimes(); raiseEvent("gameFieldCropped"); } }catch(err){GM_logError("ErnteResponse\n"+err);} }); unsafeOverwriteFunction("AbrissResponse",function(request){ try{ unsafeWindow._AbrissResponse(request); }catch(err){GM_logError("_AbrissResponse\n"+err);} try{ if((request.readyState==4)&&(request.status==200)){ checkFieldTimes(); raiseEvent("gameFieldDemolished"); } }catch(err){GM_logError("AbrissResponse\n"+err);} }); unsafeOverwriteFunction("killGardenTimeruns",function(){ try{ unsafeWindow._killGardenTimeruns(); }catch(err){GM_logError("_killGardenTimeruns\n"+err);} try{ lastGiess=null; lastErnte=null; if ($("divErnteInfo")){ removeElement($("divErnteInfo")); } if ($("zoneNavi")){ removeElement($("zoneNavi")); } //if ($("lager_zeit_ziel").parentNode.style.display == "") $("lager_zeit_ziel").parentNode.style.display="none"; }catch(err){GM_logError("killGardenTimeruns\n"+err);} }); unsafeOverwriteFunction("errorboxgarden",function(text,onclick){ try{ unsafeWindow._errorboxgarden(text,onclick); }catch(err){GM_logError("_errorboxgarden\n"+err);} try{ // Fix(Seberoth) // $("divErnteInfo").innerHTML=$("errorboxcontentgarden").innerHTML; $("divErnteInfo").innerHTML=document.getElementsByClassName('cropall_dialog_product')[0].innerHTML; $("divErnteInfo").style.display="block"; if (valErnteMsg){ // Fix(Seberoth) // $("errorboxgarden").style.display="none"; $("globalbox").style.display="none"; $("globaltransp").style.display="none"; } // Fix(Seberoth) // var zoneNr=/refreshGarden\((\d)\)/.exec($("errorboxfootergarden").parentNode.innerHTML); var zoneNr=/refreshGarden\((\d)\)/.exec($("globalbox_button1").parentNode.innerHTML); if(zoneNr){ zoneNr=zoneNr[1]; unsafeWindow.refreshGarden(zoneNr); } }catch(err){GM_logError("errorboxgarden\n"+err);} }); // Farmhouse unsafeOverwriteFunction("initFarmhouseResponse",function(response){ try{ unsafeWindow._initFarmhouseResponse(response); }catch(err){GM_logError("_initFarmhouseResponse\n"+err);} try{ if(unsafeWindow.reallocatebuildinghead&&!$("reallocatebuildingbutton")){ var newdiv=createElement("div",{"onclick":"initReallocateBuilding();showDiv('transp');","style":"position:absolute;top:70px;right:20px;","class":"link"},$("farmhousecontainer")); createElement("img",{"id":"reallocatebuildingbutton","onmouseout":"this.src=_GFX+'reallocatebuildingbutton_off.png';hideDiv('reallocatebuildinginfo');","onmouseover":"this.src=_GFX+'reallocatebuildingbutton_on.png';showDiv('reallocatebuildinginfo');","src":GFX+"reallocatebuildingbutton_off.png","class":"link","style":"width:25px;height:25px;"},newdiv); createElement("div",{"id":"reallocatebuildinginfo","style":"display:none;position:absolute;top:70px;right:50px;","class":"blackbox"},$("farmhousecontainer"),unsafeWindow.reallocatebuildinghead); newdiv=null; } }catch(err){GM_logError("initFarmhouseResponse\n"+err);} }); // Dog Ben function doDogBen(){ try{ unsafeWindow.farmdog_harvest=1; var zoneNrF,zoneNrS,iProd,item,tempZoneProductionData; var allZones=[]; var nowServer=unsafeWindow.Zeit.Server; for(var i=ALL_ZONES["farm"].length-1;i>=0;i--){ zoneNrF=ALL_ZONES["farm"][i]; if(!zones.getBlock(zoneNrF)){ allZones.push(zoneNrF); if(zones.isMultiSlot(zoneNrF)){ for(var j=1;j<3;j++){ zoneNrS=zoneNrF+"."+j; if(!zones.getBlock(zoneNrS)){ allZones.push(zoneNrS); } } } } } for(var j=allZones.length-1;j>=0;j--){ zoneNrS=allZones[j]; tempZoneProductionData=zones.getProduction(zoneNrS); if(tempZoneProductionData&&tempZoneProductionData[0]){ for(var iType=0;iType<tempZoneProductionData[0].length;iType++){ for(var iProdStr in tempZoneProductionData[0][iType]){ if(!tempZoneProductionData[0][iType].hasOwnProperty(iProdStr)){ continue; } iProd = parseInt(iProdStr,10); if((prodTyp[iType][iProd]!="u")&&(prodTyp[iType][iProd]!="z")){ // only products item=tempZoneProductionData[0][iType][iProdStr]; for(var i=0;i<item.length;i++){ item[i][2]=Math.max(item[i][2]-600,nowServer); if(item[i][2]<item[i][3]){ item[i][3]=NEVER; } } } } } } zones.setProduction(zoneNrS,tempZoneProductionData.clone()); } }catch(err){GM_logError("doDogBen\n"+err);} } // Stable function doStable(farmNr,zoneNr){ try{ var zoneNrF=zoneNr+6*(farmNr-1); drawZoneNavi(zoneNrF,$("building_inner")); if (valAutoCrop["farm"]&&(div=$("commitboxcrop"))&&(div.style.display=="block")&&(div=$("commitboxfootercrop"))){ window.setTimeout(function(div){ click(div); },500,div.firstElementChild); } for(var v=0;v<ANIMAL_MOVE.length;v++){ if((valMoveAnimals[v])&&(!ANIMAL_MOVE[v][0])&&($("animalline"+v))){ ANIMAL_MOVE[v][0]=true; moveAnimals(v); break; }} var data=unsafeWindow.buildingdata[farmNr][zoneNr]; var tempZoneProductionData=[[{}],0,0,true]; tempZoneProductionData[2]=1; if(data.remain==undefined){ // empty tempZoneProductionData[1]=1; }else if(data.remain>0){ // running var iPrTyp=0; var iProd=data.pid; var iTime=data.remain+now-unsafeWindow.Zeit.Verschiebung; var iAmount=data.crop; var iPoints=data.crop*prodPoints[iPrTyp][iProd]; if(!tempZoneProductionData[0][iPrTyp][iProd]){ tempZoneProductionData[0][iPrTyp][iProd]=[]; } tempZoneProductionData[0][iPrTyp][iProd].push([iAmount,iPoints,iTime,NEVER]); }else{ // done var iPrTyp=0; var iProd=data.pid; var iTime=zones.getEndtime(zoneNrF); var iAmount=data.crop; var iPoints=data.crop*prodPoints[iPrTyp][iProd]; if(!tempZoneProductionData[0][iPrTyp][iProd]){ tempZoneProductionData[0][iPrTyp][iProd]=[]; } tempZoneProductionData[0][iPrTyp][iProd].push([iAmount,iPoints,iTime,NEVER]); } zones.setProduction(zoneNrF,tempZoneProductionData.clone()); tempZoneProductionData=null; }catch(err){GM_logError("doStable\n"+err);} } unsafeOverwriteFunction("rewriteBuildingInnerFeed",function(e,a){ try{ unsafeWindow._rewriteBuildingInnerFeed(e,a); }catch(err){GM_logError("_rewriteBuildingInnerFeed\n"+err);} try{ var d = unsafeWindow.buildingdata[e][a]; var div; for (var b in d.feed) { if(!d.feed.hasOwnProperty(b)){ continue; } if(div=$("feed_item"+b)){ var currProd=parseInt(b,10); var str="blackbox"+(prodStock[0][currProd]<prodMinRack[0][currProd]?" lowrack":""); createElement("div",{"id":"feed_item"+b+"_rackamount","class":str,"style":"position:absolute;top:-25px;left:-2px;font-weight:bold;"},div,numberFormatPrefixed(prodStock[0][currProd])); } } }catch(err){GM_logError("rewriteBuildingInnerFeed\n"+err);} }); unsafeOverwriteFunction("buildingInnerActionResponse",function(request,action,farm,position){ try{ unsafeWindow._buildingInnerActionResponse(request,action,farm,position); }catch(err){GM_logError("_buildingInnerActionResponse\n"+err);} try{ if(checkRequest(request)){ // logBubble.add("buildingInnerActionResponse "+action+":"+farm+":"+position); switch(action){ case "init": raiseEvent("gameOpenStable"); break; default: } } }catch(err){GM_logError("buildingInnerActionResponse\n"+err);} }); unsafeOverwriteFunction("newBuildingInner",function(farm,position){ try{ unsafeWindow._newBuildingInner(farm,position); }catch(err){GM_logError("_newBuildingInner\n"+err);} try{ doStable(farm,position); }catch(err){GM_logError("newBuildingInner\n"+err);} }); // Factory function doFactory(zoneNr){ try{ var zoneNrF=zoneNr+6*gameLocation[1]; showBlase(zoneNrF); drawZoneNavi(zoneNrF,$("innermaincontainer")); var cand,newdiv; var data=unsafeWindow.farms_data.farms[unsafeWindow.farm][zoneNr]; var tempZoneProductionData=[[{}],0,0,true]; if (data.production&&data.production["0"]&&data.production["0"].pid){ var iPrTyp=0; var iProd=parseInt(data.production["0"].pid,10); var iAmount=prodYield[iPrTyp][iProd]; var iPoints=iAmount*prodPoints[iPrTyp][iProd]; if(data.production["0"].remain>0){ // running var iTime=data.production["0"].remain+now-unsafeWindow.Zeit.Verschiebung; }else{ // done var iTime=zones.getEndtime(zoneNrF); } if(!tempZoneProductionData[0][iPrTyp][iProd]){ tempZoneProductionData[0][iPrTyp][iProd]=[]; } tempZoneProductionData[0][iPrTyp][iProd].push([iAmount,iPoints,iTime,NEVER]); }else{ // empty tempZoneProductionData[1]=1; } tempZoneProductionData[2]=1; zones.setProduction(zoneNrF,tempZoneProductionData.clone()); tempZoneProductionData=null; if(!$("articleline"+unsafeWindow.locationinfo[6])){ cand=createElement("div",{"id":"articleline"+unsafeWindow.locationinfo[6]},$("innercontent")); for(var prodNr=0;prodNr<unsafeWindow.locationinfo["in"].length;prodNr++){ newdiv=createElement("div",{"id":(gameLocation[1]+1)+"_"+zoneNr+"_article"+unsafeWindow.locationinfo["in"][prodNr],"class":"feedproduct","style":"position:absolute;top:54px;left:"+(55+60*prodNr)+"px;border:2px solid black;z-index:11;","prodNr":prodNr},cand); createElement("div",{"id":"articleimg"+unsafeWindow.locationinfo["in"][prodNr],"style":"position:absolute;","class":"l"+unsafeWindow.locationinfo["in"][prodNr]},createElement("div",{"style":"position:absolute;top:5px;left:5px;width:40px;height:40px;overflow:hidden;"},newdiv)); newdiv.addEventListener("mouseover",function(event){ var prodNr = parseInt(this.getAttribute("prodNr"),10); toolTip.show(event,unsafeWindow.locationinfo["need"][prodNr]+"x "+prodName[0][unsafeWindow.locationinfo["in"][prodNr]]); },false); } } var cand=$("innercontent").getElementsByClassName("feedproduct"); for(var v=0;v<cand.length;v++){ var currProd=parseInt(cand[v].getElementsByTagName("div")[1].getAttribute("class").replace("l",""),10); var str="blackbox"+(prodStock[0][currProd]<prodMinRack[0][currProd]?" lowrack":""); if(!$(cand[v].id+"_rackamount")){ createElement("div",{"id":cand[v].id+"_rackamount","style":"position:absolute;top:-25px;left:-2px;font-weight:bold;"},cand[v]); } newdiv=$(cand[v].id+"_rackamount"); if(newdiv.getAttribute("class")!=str){ newdiv.setAttribute("class",str); } newdiv.innerHTML=numberFormatPrefixed(prodStock[0][currProd]); } if (valAutoCrop["farm"]&&(div=$("commitboxcrop"))&&(div.style.display=="block")&&(div=$("commitboxfootercrop"))){ window.setTimeout(function(div){ click(div); },500,div.firstElementChild); } cand=null;newdiv=null; raiseEvent("gameOpenFactory"); }catch(err){GM_logError("doFactory\n"+err);} } // Oil factory, special oil factory function doFactoryOil(zoneNr){ //GM_log("doFactoryOil "+unsafeWindow.currentposition); var zoneNrF=zoneNr+6*gameLocation[1]; showBlase(zoneNrF); drawZoneNavi(zoneNrF,$("innermaincontainer")); raiseEvent("gameOpenFactoryOil"); } unsafeOverwriteFunction("buildOilpressInner",function(position,buildingid,info){ try{ unsafeWindow._buildOilpressInner(position,buildingid,info); }catch(err){GM_logError("_buildOilpressInner\n"+err);} try{ var zoneNr=position; var zoneNrF=zoneNr+6*gameLocation[1]; var zoneNrS; var data=unsafeWindow.oilproduction; var newDiv,newDiv1; var tempZoneProductionData=[[{}],0,0,true]; var tempZoneProductionDataSlot; for(var slot=1;slot<=3;slot++){ zoneNrS=zoneNrF+"."+slot; if((slot==1)||(!unsafeWindow.oilslots[slot]["block"])){ zones.setBlock(zoneNrS,""); tempZoneProductionDataSlot=[[{}],0,0,true]; tempZoneProductionData[1]++; tempZoneProductionData[2]++; tempZoneProductionDataSlot[1]++; tempZoneProductionDataSlot[2]++; if(data[slot]){ var iPrTyp=0; var iProd=parseInt(data[slot].pid,10); var iAmount=data[slot].amount; var iPoints=data[slot].amount*prodPoints[iPrTyp][iProd]; var iTime=now+data[slot].remain; var endDay=countDays(now,iTime); newDiv=createElement("div",{"class":"blackbox","id":"oil_slot"+slot+"_prodinfo","style":"position:absolute;left:225px;top:25px;white-space:nowrap;"},$("oil_slot"+slot)); if(iTime<now){ if(iTime+20*60*60<now){ createElement("div",{},newDiv,getText("readySinceX").replace(/%1%/,getFormattedDateStr(iTime))); }else{ createElement("div",{},newDiv,getText("readySinceX").replace(/%1%/,getDaytimeStr(iTime)+" "+getText("shortOClock"))); } } else if (endDay==0){ createElement("div",{},newDiv,getText("readyAtX").replace(/%1%/,getDaytimeStr(iTime)+" "+getText("shortOClock"))); } else if ((endDay==1)&&(getText("readyAtX_day1"))){ createElement("div",{},newDiv,getText("readyAtX_day1").replace(/%1%/,getDaytimeStr(iTime)+" "+getText("shortOClock"))); } else if ((endDay==2)&&(getText("readyAtX_day2"))){ createElement("div",{},newDiv,getText("readyAtX_day2").replace(/%1%/,getDaytimeStr(iTime)+" "+getText("shortOClock"))); } else{ createElement("div",{},newDiv,getText("readyAtX").replace(/%1%/,new Date(1000*iTime).toLocaleString())); } newDiv1=$("oil_slot"+slot+"_img_tt_time"); if(newDiv1){ newDiv.appendChild(newDiv1); } newDiv1=createElement("div",{},newDiv); produktPic(iPrTyp,iProd,newDiv1); createElement("span",{},newDiv1,numberFormat(iAmount)+" "+prodName[iPrTyp][iProd]); pointsFormat(iPoints,"div",newDiv1); iTime-=unsafeWindow.Zeit.Verschiebung; tempZoneProductionData[1]--; if(!tempZoneProductionData[0][iPrTyp][iProd]){ tempZoneProductionData[0][iPrTyp][iProd]=[]; } tempZoneProductionData[0][iPrTyp][iProd].push([iAmount,iPoints,iTime,NEVER]); tempZoneProductionDataSlot[1]--; if(!tempZoneProductionDataSlot[0][iPrTyp][iProd]){ tempZoneProductionDataSlot[0][iPrTyp][iProd]=[]; } tempZoneProductionDataSlot[0][iPrTyp][iProd].push([iAmount,iPoints,iTime,NEVER]); //auto-cropping if((top.unsafeData.autoAction==null)&&valAutoCrop["farm"] && (newDiv=$("oil_slot"+slot+"_cropbutton")) && (newDiv.style.display=="block")){ top.unsafeData.autoAction="berater: oil crop"; window.setTimeout(function(div){ click(div); top.unsafeData.autoAction=null; },500,newDiv); } } zones.setProduction(zoneNrF+"."+slot,tempZoneProductionDataSlot.clone()); } else { zones.setBlock(zoneNrS,"b"); } } zones.setProduction(zoneNrF,tempZoneProductionData.clone()); var tempZoneProductionData=null;newDiv=null;newDiv1=null; }catch(err){GM_logError("buildOilpressInner\n"+err);} }); // Knitting unsafeOverwriteFunction("strickereiAjaxActionResponse",function(request,pos,mode){ try{ unsafeWindow._strickereiAjaxActionResponse(request,pos,mode); }catch(err){GM_logError("_strickereiAjaxActionResponse\n"+err);} try{ var result = checkRequest(request); if((result!=0)&&(result[0]!=0)){ switch(mode){ case "buy": break; case "cancel": break; case "crop": raiseEvent("gameFactoryKnittingCropped"); break; case "speedup": break; case "start": raiseEvent("gameFactoryKnittingStarted"); break; default: } } }catch(err){GM_logError("strickereiAjaxActionResponse\n"+err);} }); unsafeOverwriteFunction("strickereiSelection",function(a,c,slot){ try{ unsafeWindow._strickereiSelection(a,c,slot); }catch(err){GM_logError("_strickereiSelection\n"+err);} try{ raiseEvent("gameFactoryKnittingDialogStart"); }catch(err){GM_logError("strickereiSelection\n"+err);} }); unsafeOverwriteFunction("buildStrickereiInner",function(position,buildingid){ try{ unsafeWindow._buildStrickereiInner(position,buildingid); }catch(err){GM_logError("_buildStrickereiInner\n"+err);} try{ var zoneNr=position; var zoneNrF=zoneNr+6*gameLocation[1]; var zoneNrS; showBlase(zoneNrF); drawZoneNavi(zoneNrF,$("innermaincontainer")); var newDiv,newDiv1; var tempZoneProductionData=[[{}],0,0,true]; var tempZoneProductionDataSlot; var data=unsafeWindow.strickerei_data; for(var slot=1;slot<=3;slot++){ zoneNrS=zoneNrF+"."+slot; if((slot==1)||(!data.slots[slot]["block"])){ zones.setBlock(zoneNrS,""); tempZoneProductionDataSlot=[[{}],0,0,true]; tempZoneProductionData[1]++; tempZoneProductionData[2]++; tempZoneProductionDataSlot[1]++; tempZoneProductionDataSlot[2]++; if(data.slots[slot]){ var iPrTyp=0; var iProd=data.slots[slot].pid; if(iProd){ var iAmount=data.slots[slot].amount; var iPoints=iAmount*prodPoints[iPrTyp][iProd]; if(data.slots[slot].ready){ var iTime=zones.getEndtime(zoneNrF); } else{ var iTime=now+data.slots[slot].remain-unsafeWindow.Zeit.Verschiebung; } newDiv=$("strickerei_slot"+slot).children[1]; newDiv1=createElement("div",{},newDiv); pointsFormat(iPoints,"div",newDiv1); tempZoneProductionData[1]--; if(!tempZoneProductionData[0][iPrTyp][iProd]){ tempZoneProductionData[0][iPrTyp][iProd]=[]; } tempZoneProductionData[0][iPrTyp][iProd].push([iAmount,iPoints,iTime,NEVER]); tempZoneProductionDataSlot[1]--; if(!tempZoneProductionDataSlot[0][iPrTyp][iProd]){ tempZoneProductionDataSlot[0][iPrTyp][iProd]=[]; } tempZoneProductionDataSlot[0][iPrTyp][iProd].push([iAmount,iPoints,iTime,NEVER]); //auto-cropping if(data.slots[slot].ready&&(top.unsafeData.autoAction==null)&&valAutoCrop["farm"]&&(newDiv=$("strickerei_slot"+slot))){ top.unsafeData.autoAction="berater: knitting crop"; window.setTimeout(function(div){ click(div); top.unsafeData.autoAction=null; },500,newDiv); } } } zones.setProduction(zoneNrF+"."+slot,tempZoneProductionDataSlot.clone()); } else { zones.setBlock(zoneNrS,"b"); } } zones.setProduction(zoneNrF,tempZoneProductionData.clone()); var tempZoneProductionData=null;newDiv=null;newDiv1=null; raiseEvent("gameOpenFactoryKnitting"); }catch(err){GM_logError("buildStrickereiInner\n"+err);} }); unsafeOverwriteFunction("innerInfosResponse",function(zoneNr){ // oil, knitting, factory, pony try{ unsafeWindow._innerInfosResponse(zoneNr); }catch(err){GM_logError("_innerInfosResponse\n"+err);} try{ $("innermaincontainer").setAttribute("zoneNr",zoneNr); if(unsafeWindow.locationinfo["buildingid"]){ switch(unsafeWindow.locationinfo["buildingid"]){ case "13": doFactoryOil(zoneNr); break; // Oil case "14": doFactoryOil(zoneNr); break; // Special Oil case "16": // Knitting case "17": // Carpentry case "18": // Pony case "19": // Megafield default: } }else{ // }else if(unsafeWindow.locationinfo["in"]){ doFactory(zoneNr); } }catch(err){GM_logError("innerInfosResponse\n"+err);} }); // Megafield err_trace="Megafield"; // Remembering of latest vehicle. ["harvest", "fertilize"] megafieldVehicle = explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_megafieldVehicle"),"do_main/megafieldVehicle",[]); unsafeData.megafieldVehicle=megafieldVehicle.clone(); function doMegafieldData(){ /* megafield: "points": STRING(INTEGER), "count": STRING(INTEGER), "count_buy": null, "area": { "1": { "pid": INTEGER, "time": DATETIME of planting, "duration": INTEGER, "remain": INTEGER }, ... }, "area_free": { "1": DATETIME of unlocking , ... }, "job": { "products": [ { "pid": INTEGER, "quality": INTEGER, "need": INTEGER, "have": INTEGER, "amount": INTEGER, "harvest": INTEGER, "duration": INTEGER }, ... ], "remain": INTEGER }, "job_start": STRING(DATETIME), "job_endtime": "0", "vehicles": { "1": { "time": DATETIME of purchase, "durability": INTEGER, "range": INTEGER }, ... }, "vehicles_unlock": { "1": { "time": DATETIME of unlocking } , ... }, "tour": [], "tutorial_step": STRING(INTEGER), "level": INTEGER, "level_rest": INTEGER, "level_percent": INTEGER, "exchangecoins": INTEGER, "next_tiles": { "cost": INTEGER, "tiles": [INTEGER, INTEGER, ...] }, "vehicle_slots": { "1": { "type": "harvest"|"fertilize", "name": STRING, "size": INTEGER, "level": INTEGER, "unlock": INTEGER, "durability": INTEGER, "range": INTEGER, "duration": INTEGER, "money": INTEGER }, ... }, "reward_info": { "quality": INTEGER, "points": INTEGER, "money": INTEGER, "license": INTEGER, "difficultybonus_points": INTEGER, "difficultybonus_money": INTEGER, "difficultybonus_license": INTEGER, "timebonus_points": INTEGER, "timebonus_money": INTEGER, "timebonus_license": INTEGER } }*/ try{ if(unsafeWindow.megafield_data&&unsafeWindow.megafield_data.area_free){ /* var str=""; for(var i in unsafeWindow.megafield_data.vehicles){ str+=i+":"+getDateStr(unsafeWindow.megafield_data.vehicles[i].time)+" "+getDaytimeStr(unsafeWindow.megafield_data.vehicles[i].time)+"\n"; } GM_log(str); */ var zoneNrF=null; for(var i=0;i<ALL_ZONES["farm"].length;i++){ if(zones.getBuilding(ALL_ZONES["farm"][i])==19){ zoneNrF=ALL_ZONES["farm"][i]; break; } } if(zoneNrF==null){ throw("Location of Megafield not found."); } var tempZoneProductionData=[[{}],0,0,true]; var iPrTyp=0,iProd,iTime; for(var i=BUILDING_SIZE["19"][0]*BUILDING_SIZE["19"][1];i>=1;i--){ if(unsafeWindow.megafield_data.area_free[i]){ tempZoneProductionData[1]++; tempZoneProductionData[2]++; if(unsafeWindow.megafield_data.area[i]){ iProd=unsafeWindow.megafield_data.area[i].pid; iTime=unsafeWindow.megafield_data.area[i].time+unsafeWindow.megafield_data.area[i].duration; iTime-=unsafeWindow.Zeit.Verschiebung; tempZoneProductionData[1]--; if(!tempZoneProductionData[0][iPrTyp][iProd]){ tempZoneProductionData[0][iPrTyp][iProd]=[]; } tempZoneProductionData[0][iPrTyp][iProd].push([1,0,iTime,NEVER]); } } } zones.setProduction(zoneNrF,tempZoneProductionData.clone()); } }catch(err){GM_logError("_megafieldHandler\n"+err);} } doMegafieldData(); unsafeOverwriteFunction("megafieldHandler",function(a){ try{ unsafeWindow._megafieldHandler(a); }catch(err){GM_logError("_megafieldHandler\n"+err);} try{ doMegafieldData(); }catch(err){GM_logError("megafieldHandler\n"+err);} }); unsafeOverwriteFunction("buildMegafield",function(){ try{ unsafeWindow._buildMegafield(); }catch(err){GM_logError("_buildMegafield\n"+err);} try{ if(megafieldVehicle[0]&&(!unsafeWindow.megafield_vehicle_id)){ unsafeWindow.megafield_move_position=2; unsafeWindow._setTourVehicleMegafield(megafieldVehicle[0]); } raiseEvent("gameOpenMegafield"); }catch(err){GM_logError("buildMegafield\n"+err);} }); unsafeOverwriteFunction("setTourVehicleMegafield",function(b){ try{ unsafeWindow._setTourVehicleMegafield(b); }catch(err){GM_logError("_setTourVehicleMegafield\n"+err);} try{ var a; if(b&&(a=unsafeWindow.megafield_data.vehicle_slots[b])&&(!a.block)&&(!a.unlockable)){ megafieldVehicle[{"harvest":0,"fertilize":1}[a.type]]=b; unsafeData.megafieldVehicle=megafieldVehicle.clone(); GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_megafieldVehicle",implode(megafieldVehicle,"setTourVehicleMegafield\megafieldVehicle")); } }catch(err){GM_logError("setTourVehicleMegafield\n"+err);} }); // Club err_trace="Club"; // Clubquest direct show var lastGuildQuestRequest=0; function clubQuestToolTip(data){ try{ var container=$("guildlink_tt_quest"); container.innerHTML=""; var newdiv=createElement("div",{"style":"position:absolute;top:5px;left:5px;"},container); var newspan=createElement("span",{"style":"margin-right:2px;"},newdiv); if(data!=0){ createElement("img",{"src":GFX+'adtime.gif'},newspan); createElement("span",{"style":"font-weight:bold;"},newdiv,getTimeStr(data['remain'])); if(data['questtype'] == 1 || data['questtype'] == 2){ // produkte oder geld in vorgegebener zeit var top=25; var left=0; var newdiv1; for(var i=1 ; i <= 2 ; i++){ if(data['product' + i] > 0){ data['sum' + i]=parseInt(data['sum' + i],10); data['amount' + i]=parseInt(data['amount' + i],10); var barleft=parseInt(Math.round((data['sum' + i] * 100) / data['amount' + i])-100,10); if(data['questtype'] == 2){ data['sum' + i]=moneyFormat(data['sum' + i]); data['amount' + i]=moneyFormat(data['amount' + i]); } newdiv=createElement("div",{"style":'position:absolute; top:' + top + 'px; left:' + left + 'px;width:40px;height:15px;'},container); if(data['questtype'] == 1){ newdiv1=createElement("div",{"style":"position:absolute; top:0; left:5px;height:15px;width:15px; overflow:hidden;"},newdiv); createElement("img",{"class":"kp" + data['product' + i], "style":"position:absolute;"},newdiv1); } else if(data['questtype'] == 2){ newdiv1=createElement("div",{"style":"position:absolute; top:0; left:5px;height:15px;width:15px;"},newdiv); createElement("img",{"src":GFX+"money.gif","height":"15","width":"15"},newdiv1); } newdiv1=createElement("div",{"style":"position:absolute;top:0;left:23px;border:1px solid #000;background-color:#fff;width:100px;height:15px;overflow:hidden;"},newdiv); createElement("div",{"style":"position:absolute;top:0;left:"+barleft+"px;background-color:#f00;width:100px;height:25px;"},newdiv1); createElement("div",{"style":"position:absolute;top:0;left:0;width:100px;height:15px;color:black;font-weight:bold;text-align:center;"},newdiv1,numberFormat(data['sum' + i])); createElement("div",{"style":"position:absolute;top:20px;white-space:nowrap;left:5px;"},newdiv,(data['amount' + i]==data['sum' + i])?"":('<b>' + numberFormat(data['amount' + i]-data['sum' + i]) + '/' + numberFormat(data['amount' + i]) + '</b>')); top += 40; } } newdiv1=null; } }else{ newspan.innerHTML="---"; } container=null;newdiv=null;newspan=null; }catch(err){GM_logError("clubQuestToolTip\ndata="+implode(data)+"\n"+err);} } if((newdiv=$("speedlink_guild"))&&(newdiv1=$("speedlink_guild_tt"))){ var str=newdiv1.innerHTML; newdiv1.innerHTML=""; createElement("div",{"style":"border-bottom:1px solid black;"},newdiv1,str); createElement("div",{"id":"guildlink_tt_quest","style":"position:relative;width:130px;height:100px;"},newdiv1,"---"); /* TODO: review needed. request has changed. newdiv.addEventListener("mouseover",function(){ if (now-lastGuildQuestRequest>30){ // 30 seconds delay to next request lastGuildQuestRequest=now; GM_xmlhttpRequest({ method: "GET", url: "http://s"+SERVER+"."+GAMEPAGES[COUNTRY]+"/guild/ajax/initguild.php?rid="+unsafeWindow.rid, headers: {"Content-type": "application/x-www-form-urlencoded"}, onload: function(response){ if(response.responseText!=0){ var result=eval('(' + response.responseText + ')'); if(result[0]!=0){ clubQuestToolTip(result[0][2]); } } } }); } },false); */ } // Clubquest updated /* TODO: function is not existing anymore unsafeOverwriteFunction("setGuildQuestResponse",function(request){ unsafeWindow._setGuildQuestResponse(request); var result=checkRequest(request); if(result){ lastGuildQuestRequest=now; clubQuestToolTip(result[1]); } }); */ // Clubdata loaded unsafeOverwriteFunction("initGuildResponse",function(response){ try{ unsafeWindow._initGuildResponse(response); }catch(err){GM_logError("_initGuildResponse\n"+err);} try{ lastGuildQuestRequest=now; clubQuestToolTip(response[0][2]); }catch(err){GM_logError("initGuildResponse\n"+err);} }); // Memberlist unsafeOverwriteFunction("openMultiBox",function(id){ try{ if(id==5){ $('guildmultiboxheader').innerHTML='<img class="link" src="' + unsafeWindow.imgpath + 'button_cancel_off.png" onclick="hideDiv(\'transp9\'); hideDiv(\'guildmultibox\');" onmouseover="this.src=\'' + unsafeWindow.imgpath + 'button_cancel_on.png\';" onmouseout="this.src=\'' + unsafeWindow.imgpath + 'button_cancel_off.png\';"></div>'; $('guildmultiboxcontent').innerHTML=''; unsafeWindow.showGuildQuestStats(2,1,0); for(var i=1;i<=3;i++){ $('guildmultiboxmenue'+i).style.backgroundImage="url(" + unsafeWindow.imgpath + "leer.gif)"; } $('guildmultiboxmenue4').style.backgroundImage="url(" + unsafeWindow.imgpath + "multiscreen_reiter4.jpg)"; $('guildmultiboxheadline').innerHTML=unsafeWindow.guildmultibox_headline4; unsafeWindow.hideDiv('guildnewsticker'); unsafeWindow.showDiv('transp9'); unsafeWindow.showDiv('guildmultibox'); }else{ try{ unsafeWindow._openMultiBox(id); }catch(err){GM_logError("_openMultiBox\n"+err);} } }catch(err){GM_logError("openMultiBox\n"+err);} }); $("guildmultiboxmenue4").setAttribute("onclick","openMultiBox(5)"); unsafeOverwriteFunction("getGuildMembersResponse",function(request){ try{ unsafeWindow._getGuildMembersResponse(request); }catch(err){GM_logError("_getGuildMembersResponse\n"+err);} try{ if(request.readyState == 4 && request.status == 200){ var canddiv=Array.prototype.slice.call($("guildmultiboxcontent").getElementsByClassName("guildmemberlist_even")).concat(Array.prototype.slice.call($("guildmultiboxcontent").getElementsByClassName("guildmemberlist_uneven"))); var newdiv,newspan,newa; for(var v=0;v<canddiv.length;v++){ newdiv=canddiv[v].children[1].firstElementChild; var thisUser=/(.*?) /.exec(newdiv.innerHTML); newdiv.innerHTML=newdiv.innerHTML.replace(thisUser[0],""); newspan=createElement("span"); newspan.innerHTML=" "; newdiv.insertBefore(newspan,newdiv.firstElementChild); newa=createElement("a",{"class":"link2"}); newa.innerHTML=thisUser[1]; newdiv.insertBefore(newa,newdiv.firstElementChild); newa.addEventListener("click",function(){ showShopframePage("http://s"+SERVER+"."+GAMEPAGES[COUNTRY]+"/stadt/stats.php?search=1&searchterm="+this.innerHTML); },false); //newdiv.insertBefore(igm(thisUser[1]),newdiv.firstElementChild); } newdiv=null;newspan=null;newa=null;canddiv=null; } }catch(err){GM_logError("getGuildMembersResponse\n"+err);} }); // Questhistory unsafeOverwriteFunction("showGuildQuestStatsResponse",function(request,type,page,self){ try{ unsafeWindow._showGuildQuestStatsResponse(request,type,page,self); }catch(err){GM_logError("_showGuildQuestStatsResponse\n"+err);} try{ var result=checkRequest(request); if(result&&result[0]!=0){ window.setTimeout(function(){ if(DEVMODE){ GM_log("showGuildQuestStatsResponse "+request+":"+type+"("+typeof type+"):"+page+"("+typeof page+"):"+self+"("+typeof self+")"); }; var newdiv=$("chg_guildqueststats"); newdiv.setAttribute("onchange",""); newdiv.addEventListener("change",function(){ var type=parseInt($("chg_guildqueststats").value,10); if(type<4){ unsafeWindow.showGuildQuestStats(type,1,0); }else{ showGuildQuestStatsLastDays(7); } },false); createElement("option",{"value":"4"},newdiv,getText("stat_days7")); if(type>3){ newdiv.value=type; newdiv.nextElementSibling.style.display="none"; } //todayStr=getDateStr(now,2,false); var clubmemberLog=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_clubmemberLog","[]"),"showGuildQuestStatsResponse/clubmemberLog",[]); for(var u=0;u<clubmemberLog.length;u++){ if(typeof clubmemberLog[u][0]!="string"){ clubmemberLog.splice(u,1); u--;continue; } if(!clubmemberLog[u][1] instanceof Array){ clubmemberLog[u][1]=[]; } for(var v=0;v<clubmemberLog[u][1].length;v++){ if((typeof clubmemberLog[u][0][v][0]!="string")||(typeof clubmemberLog[u][0][v][1]!="number")){ clubmemberLog[u][1].splice(v,1); v--;continue; } if(!clubmemberLog[u][1][v][2] instanceof Array){ clubmemberLog[u][1][v][2]=[]; } if(clubmemberLog[u][1][v][0]=="0"){ continue; } // join old data var w=null; if(clubmemberLog[u][1][v][0].match(/^\d+\.\d+\.\d+$/)){ if(now-getTime(clubmemberLog[u][1][v][0])>604800){ // 1 week (7*86400) for(var x=0;x<clubmemberLog[u][1].length;x++){ if(clubmemberLog[u][1][x][0]==clubmemberLog[u][1][v][0].replace(/^(\d+\.)/,"")){ w=x; break; } } if(w==null){ w=clubmemberLog[u].length; clubmemberLog[u].push([0,[]]); } } }else if(clubmemberLog[u][1][v][0].match(/^\d+\.\d+$/)){ if(now-getTime(clubmemberLog[u][1][v][0])>16070400){ // 6 months (6*31*86400) for(var x=0;x<clubmemberLog[u].length;x++){ if(clubmemberLog[u][1][x][0]==clubmemberLog[u][1][v][0].replace(/^(\d+\.)/,"")){ w=x; break; } } if(w==null){ w=clubmemberLog[u].length; clubmemberLog[u].push([0,[]]); } } } if(w!=null){ clubmemberLog[u][1][w][1] += clubmemberLog[u][1][v][1]; for(var x=0;x<clubmemberLog[u][1][v][2].length;x++){ for(var y=0;y<clubmemberLog[u][1][w][2].length;y++){ if(clubmemberLog[u][1][v][2][x]==clubmemberLog[u][1][w][2][y]){ break; } } if(clubmemberLog[u][1][w][2][y]){ clubmemberLog[u][1][w][2][y][1] += clubmemberLog[u][1][v][2][x][1]; } else { clubmemberLog[u][1][w][2].push(clubmemberLog[u][1][v][2][x]); } } clubmemberLog[u][1].splice(v,1); clubmemberLog[u][1].sort(sortObjFunctions["date"]); } } } var clubmembers=new Object(); var clubmemberLogSum=new Object(); for(var i=0;i<clubmemberLog.length;i++){ var u=clubmemberLog[i][0]; clubmemberLogSum[u]=[0,{}]; for(var j=0;j<clubmemberLog[i][1].length;j++){ var v=clubmemberLog[i][1][j][0]; if(v==todayStr){ continue; } clubmemberLogSum[u][0] += clubmemberLog[i][1][j][1]; for(var k=0;k<clubmemberLog[i][1][j][2].length;k++){ var w=clubmemberLog[i][1][j][2][k][0]; if(clubmemberLogSum[u][1][w]==undefined){ clubmemberLogSum[u][1][w]=0; clubmemberLogSum[u][1].sortObj(sortObjFunctions["productId"]); } clubmemberLogSum[u][1][w] += clubmemberLog[i][1][j][2][k][1]; } } } var container=$("guildmultiboxcontent"); var newtable,newtable1,newtr,newtr1,newtd,newdiv1,cell; for(var v=0;v<container.childElementCount;v++){ if(container.children[v].id.match(/^line\d+$/)){ var lineNr=parseInt(/^line(\d+)$/.exec(container.children[v].id)[1],10); var thisUser=container.children[v].children[1].innerHTML; var thisPoints=parseInt(container.children[v].children[3].innerHTML,10); container.children[v].children[3].innerHTML=numberFormat(thisPoints); clubmembers[thisUser]=[thisPoints,{}]; // reformat of info bubble cell=$("bartt"+lineNr); cell.style.whiteSpace="nowrap"; cell.style.left=""; cell.style.right="30px"; for(var w=0;w+1<cell.childElementCount;w++){ if(cell.children[w].style.clear == "both"){ continue; } var help=parseInt(cell.children[w].getAttribute("class").replace(/kp/,""),10); var help1=parseInt(cell.children[++w].innerHTML.replace(/ /g,""),10); clubmembers[thisUser][1][help]=help1; } cell.innerHTML=""; clubmembers[thisUser][1].sortObj(sortObjFunctions["productId"]); newtable=createElement("table",{"cellspacing":"0","style":"display:inline-block;vertical-align:top;"},cell); var c=2; for(var w in clubmembers[thisUser][1]){ if(!clubmembers[thisUser][1].hasOwnProperty(w)){ continue; } if(c==2){ c=0; newtr=createElement("tr",{},newtable); } c++; newtd=createElement("td",{"class":"link hoverBgDarkgreen","style":"text-align:right;padding-right:5px;","prod":w},newtr); newtd.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.getAttribute("prod")); },false); newtd.addEventListener("click",function(){ showMarket(this.getAttribute("prod")); },false); produktPic(0,w,newtd).style.cssFloat="left"; createElement("span",{},newtd,numberFormat(clubmembers[thisUser][1][w])); } var clubmemberLogId = null; for(var x=0;x<clubmemberLog.length;x++){ if(clubmemberLog[x][0]==thisUser){ clubmemberLogId=x; break; } } if(!clubmemberLog[clubmemberLogId]){ clubmemberLogId=clubmemberLog.length; clubmemberLog.push([thisUser,["0",0,[]]]); clubmemberLogSum[thisUser]=clubmembers[thisUser]; } if(type==2){ // all quests var clubmemberLogDateId = null; for(var x=0;x<clubmemberLog[clubmemberLogId][1].length;x++){ if(clubmemberLog[clubmemberLogId][1][x][0]==todayStr){ clubmemberLogDateId=x; break; } } if(!clubmemberLog[clubmemberLogId][1][clubmemberLogDateId]){ clubmemberLogDateId=clubmemberLog[clubmemberLogId][1].length; clubmemberLog[clubmemberLogId][1].push([todayStr,0,[]]); } clubmemberLog[clubmemberLogId][1][clubmemberLogDateId][0]=thisPoints-clubmemberLogSum[thisUser][0]; for(var w in clubmembers[thisUser][1]){ if(!clubmembers[thisUser][1].hasOwnProperty(w)){ continue; } var help=clubmembers[thisUser][1][w]-(clubmemberLogSum[thisUser][1][w]==undefined?0:clubmemberLogSum[thisUser][1][w]); for(var x=0;x<clubmemberLog[clubmemberLogId][1][clubmemberLogDateId][1].length;x++){ if(clubmemberLog[clubmemberLogId][1][clubmemberLogDateId][1][x][0]==w){ break; } } if(help>0){ if(!clubmemberLog[clubmemberLogId][1][clubmemberLogDateId][1][x]){ clubmemberLog[clubmemberLogId][1][clubmemberLogDateId][1][x].push([w,help]); clubmemberLog[clubmemberLogId][1][clubmemberLogDateId][1].sort(sortObjFunctions["productId"]); }else{ clubmemberLog[clubmemberLogId][1][clubmemberLogDateId][1][x][1]=help; } } } clubmemberLog[clubmemberLogId][1].sort(sortObjFunctions["date"]); } newtable=createElement("table",{"cellspacing":"0","style":"display:inline-block;margin-left:5px;vertical-align:top;"},cell); var sum=0; for(var i=0;i<clubmemberLog[clubmemberLogId][1].length;i++){ sum += clubmemberLog[clubmemberLogId][1][i][1]; if(clubmemberLog[clubmemberLogId][1][0]=="0"){ continue; } newtr=createElement("tr",{"class":"hoverBgDarkgreen"}); newtable.insertBefore(newtr,newtable.firstElementChild); newdiv=createElement("div"); newtable1=createElement("table",{"cellspacing":"0","style":"display:inline-block;vertical-align:top;"},newdiv); var c=2; //var pkte=0; for(var j=0;j<clubmemberLog[clubmemberLogId][1][i][2].length;j++){ var prod=clubmemberLog[clubmemberLogId][1][i][2][j][0]; var amount=clubmemberLog[clubmemberLogId][1][i][2][j][1]; if(c==2){ c=0; newtr1=createElement("tr",{},newtable1); } newtd=createElement("td",{"style":"text-align:right;padding-right:5px;"},newtr1); c++; produktPic(0,prod,newtd).style.cssFloat="left"; createElement("span",{},newtd,numberFormat(amount)); //pkte += POINTS[0][prod]*clubmemberLog[thisUser][w][1][prod]; } //createElement("div",{},newdiv,numberFormat(0.05*Math.round(pkte))); if(newtable1.childElementCount>0){ newtr.setAttribute("mouseOverText",newdiv.innerHTML); newtr.addEventListener("mouseover",function(event){ toolTip.show(event,this.getAttribute("mouseOverText")); },false); } createElement("td",{"style":"text-align:right;padding-right:5px;border-left:1px solid black;"},newtr,clubmemberLog[clubmemberLogId][1][i][0]); createElement("td",{"style":"text-align:right;padding-right:5px;"},newtr,numberFormat(sum)); createElement("td",{"style":"text-align:right;padding-right:5px;"},newtr,(clubmemberLog[clubmemberLogId][1][i][1]>0)?("+"+numberFormat(clubmemberLog[clubmemberLogId][1][i][1])):""); } } } cell=null;newtable=null;newtable1=null;newtr=null;newtr1=null;newtd=null;newdiv1=null; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_clubmemberLog",implode(clubmemberLog)); container=null;newdiv=null; },0); } }catch(err){GM_logError("showGuildQuestStatsResponse\n"+err);} }); // New mode for questhistory function showGuildQuestStatsLastDays(days){ //GM_log("showGuildQuestStatsLastDays "+days); //todayStr=getDateStr(now,2,false); var startDay=new Date(); startDay=((new Date(startDay.getFullYear(),startDay.getMonth(),startDay.getDate()-days)).getTime())/1000; var obj=[0,[],0,1,0]; var clubmemberLog=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_clubmemberLog","{}"),"showGuildQuestStatsLastDays/clubmemberLog",{}); var clubmemberLogSum=new Object(); for(var u in clubmemberLog){ if(!clubmemberLog.hasOwnProperty(u)){ continue; } var p=0; var help=new Object(); for(var v in clubmemberLog[u]){ if(!clubmemberLog[u].hasOwnProperty(v)){ continue; } if(v=="0"){ continue; } if(startDay<=getTime(v)){ p += clubmemberLog[u][v][0]; for(var w in clubmemberLog[u][v][1]){ if(!clubmemberLog[u][v][1].hasOwnProperty(w)){ continue; } help[w]=(help[w]==undefined?0:help[w])+clubmemberLog[u][v][1][w]; } } } var help2=new Array(); for(var w in help){ if(!help.hasOwnProperty(w)){ continue; } help2.push({"p":w,"a":help[w]}); } obj[0]=1; obj[1].push({"n":u,"p":p,"products":help2,"c":(u==FARMNAME?1:0)}); obj[2]++; obj[4]=Math.max(obj[4],p); } if(obj[0]==0){ obj[1]="No data"; }else{ obj[1].sort(function(a,b){return (b["p"]-a["p"]);}); } var request=new Object(); request.readyState=4; request.status=200; request.responseText=implode(obj); //GM_log("responseText= "+implode(obj)); unsafeWindow.showGuildQuestStatsResponse(request,4,1,0); //type,page,self /* request: [1,[ {"n":"name1","p":17049,"products":[{"p":"id","a":amount},...],"c":1}, ... ],nameCounter,pageNr,highestPoints] on error: [0,text] */ } // Clubquest reformat unsafeOverwriteFunction("setGuildQuestRun",function(r){ try{ unsafeWindow._setGuildQuestRun(r); }catch(err){GM_logError("_setGuildQuestRun\n"+err);} try{ if(!$("guildquestboxBerater")){ createElement("h1",{"id":"guildquestboxBerater","style":"display:none;"},$("guildquestboxcontent")); var cand=$("questobjectives").getElementsByClassName("link"); var newdiv; for(var v=0;v<cand.length;v++){ newdiv=cand[v].getElementsByTagName("b")[0]; var help=/(\d+)\/(\d+)/.exec(newdiv.innerHTML.replace(regDelimThou,"")); help[1]=parseInt(help[1],10); help[2]=parseInt(help[2],10); newdiv.innerHTML=((help[1]==help[2])?"":(numberFormat(help[2]-help[1])+"/"+numberFormat(help[2]))); createElement("div",{"style":"position:absolute;top:0;left:0;width:100px;height:15px;color:black;font-weight:bold;text-align:center;"},cand[v].getElementsByTagName("div")[2],numberFormat(help[1])); } cand=null;newdiv=null; } }catch(err){GM_logError("setGuildQuestRun\n"+err);} }); // Clubquest product submitting unsafeOverwriteFunction("commitboxguild",function(c,a,d,b,e){ try{ unsafeWindow._commitboxguild(c,a,d,b,e); }catch(err){GM_logError("_commitboxguild\n"+err);} try{ if(!$("commitboxguildBerater")){ createElement("h1",{"id":"commitboxguildBerater","style":"display:none;"},$("commitboxcontentguild")); if((help=$("commitboxguildokbutton").getAttribute("onclick")).match(/guildQuestAddProducts\((\d+)\)/)){ var currProd=/guildQuestAddProducts\((\d+)\)/.exec(help)[1]; var cand=$("commitboxcontentguild").getElementsByTagName("input")[0]; cand.setAttribute("prod",currProd); // maximal value according to minRack cand.value=Math.max(0,Math.min(cand.value,prodStock[0][currProd]-prodMinRack[0][currProd])); createElement("div",{"id":"commitboxguildLowrack","class":"blackbox alertbox","style":"display:none;position:absolute;top:135px;left:0;"},$("commitboxcontentguild"),getText("alertWillLowRack")); cand.addEventListener("keyup",function(){ // warning if more than minRack allows var currProd=this.getAttribute("prod"); var help=(prodStock[0][currProd]-parseInt(this.value,10)<prodMinRack[0][currProd]?"block":"none"); var cell=$("commitboxguildLowrack"); if(cell.style.display!=help){ cell.style.display=help; } cell=null; },false); cand=null; } } }catch(err){GM_logError("commitboxguild\n"+err);} }); /* // wanna see all clubhouses ? ^^ unsafeOverwriteFunction("setBeauties",function setBeauties(){ for(var v=0;v<15;v++){ // <- edit the 18 (=max) to see the steps unsafeWindow.guilddata[4][v]=v+1; } unsafeWindow._setBeauties(); }); */ // Friendslist unsafeOverwriteFunction("showfriendslist",function(status){ try{ unsafeWindow._showfriendslist(status); }catch(err){GM_logError("_showfriendslist\n"+err);} try{ var cand=$("friendslistcon").getElementsByClassName("friendslinename"); // for(var v=0;v<cand.length;v++){ // var player=cand[v].getElementsByTagName("div")[0].innerHTML.replace(/ .*/g,""); // newspan=vertrag(player,cand[v].nextSibling); // } cand=$("friendslistcon").getElementsByTagName("img"); for(var v=0;v<cand.length;v++){ if(cand[v].getAttribute("src").match(/\/guild\/1\.gif/)){ cand[v].addEventListener("mouseover",function(event){ toolTip.show(event,unsafeWindow.guildrank[1]); },false); }else if(cand[v].getAttribute("src").match(/\/guild\/2\.gif/)){ cand[v].addEventListener("mouseover",function(event){ toolTip.show(event,unsafeWindow.guildrank[2]); },false); }else if(cand[v].getAttribute("src").match(/\/star\.png/)){ cand[v].addEventListener("mouseover",function(event){ toolTip.show(event,unsafeWindow.lng_t_premium); },false); } } cand=null; }catch(err){GM_logError("showfriendslist\n"+err);} }); // Friendpage loaded err_trace="Friendpage"; unsafeOverwriteFunction("setFriendInfoContent",function(status,sel){ try{ unsafeWindow._setFriendInfoContent(status,sel); }catch(err){GM_logError("_setFriendInfoContent\n"+err);} try{ if(status == 1){ var container=$("friendlistinfoblock"); var cand=container.getElementsByTagName("li"); var nextQuest=parseInt(cand[5].children[1].innerHTML,10)+1; if(QUESTS["main"]["1"][nextQuest]){ cand[5].setAttribute("nextQuest",nextQuest); cand[5].addEventListener("mouseover",function(event){ var nextQuest=this.getAttribute("nextQuest"); var str="<div style='border-bottom:1px solid black;'>"+getText("quest_farm")+" "+nextQuest+"</div>"; for(var i=0;i<QUESTS["main"]["1"][nextQuest][0].length;i++){ if(typeof QUESTS["main"]["1"][nextQuest][0][i][0]=="object"){ for(var j=0;j<QUESTS["main"]["1"][nextQuest][0][i].length;j++){ str += "<div>*"+numberFormat(QUESTS["main"]["1"][nextQuest][0][i][j][2])+" "+prodName[QUESTS["main"]["1"][nextQuest][0][i][j][0]][QUESTS["main"]["1"][nextQuest][0][i][j][1]]+"</div>"; } }else{ str += "<div>"+numberFormat(QUESTS["main"]["1"][nextQuest][0][i][2])+" "+prodName[QUESTS["main"]["1"][nextQuest][0][i][0]][QUESTS["main"]["1"][nextQuest][0][i][1]]+"</div>"; } } toolTip.show(event,str); },false); } cand=null;container=null; } }catch(err){GM_logError("setFriendInfoContent\n"+err);} }); // Farmis err_trace="Farmis"; // Buylist opening unsafeOverwriteFunction("showCart",function(farmi,type){ try{ unsafeWindow._showCart(farmi,type); }catch(err){GM_logError("_showCart\n"+err);} try{ // get farmi data var prod,menge; var thisFarmiData=new Object(); thisFarmiData["cart"]=new Array(); switch(type){ case 1:{ for (var j=unsafeWindow.farmersmarket_data.farmis.length-1;j>-1;j--){ if(unsafeWindow.farmersmarket_data.farmis[j].id==farmi){ thisFarmiData["money"]=parseFloat(unsafeWindow.farmersmarket_data.farmis[j]["price"],10); thisFarmiData["points"]=parseFloat(unsafeWindow.farmersmarket_data.farmis[j]["points"],10); for (var i=unsafeWindow.farmersmarket_data.farmis[j].cart.length-1;i>-1;i--){ prod=unsafeWindow.farmersmarket_data.farmis[j].cart[i]["pid"]; menge=unsafeWindow.farmersmarket_data.farmis[j].cart[i]["amount"]; thisFarmiData["cart"].push([prod,menge,menge*gut[prod]]); } break; } } break;} default:{ thisFarmiData["money"]=parseFloat(unsafeWindow.farmisinfo[0][farmi]["price"],10); for(var i=1;i<=7;i++){ prod=parseInt(unsafeWindow.farmisinfo[0][farmi]["p"+i],10); menge=parseInt(unsafeWindow.farmisinfo[0][farmi]["a"+i],10); if((prod>0)&&(menge>0)){ thisFarmiData["cart"].push([prod,menge,menge*gut[prod]]); } } } } // extend cart var cand=$top("cartheader").getElementsByTagName("span")[0]; cand.style.fontWeight="bold"; cand.setAttribute("class","link"); cand.addEventListener("mouseover",function(event){ toolTip.show(event,getText("toSGH")); },false); cand.addEventListener("click",showSGH,false); cand=$("cartsubmit"); createElement("div",{"id":"cartsubmitPerc","style":"position:absolute;top:-35px;width:70px;padding:2px;text-align:right;font-size:20px;font-weight:bold;"},cand); if(type==1){ cand=cand.querySelector(".farmcartsumamount").parentNode; cand.id="cartsubmitPoints"; cand.addEventListener("mouseover",function(event){ toolTip.show(event,this.getAttribute("mouseOverText")); },false); } cand=null; // (re-)build the table function buildTable(){ try{ var cartContent,newtable,newtr,newtd,span; cartContent=$("cartcontent"); cartContent.innerHTML=""; var prod,menge,wert,sum=0,priceMissing=false; thisFarmiData["cart"].sort(function(a,b){return (b[2]-a[2]);}); newtable=createElement("table",{"border":"0","cellspacing":"0","cellpadding":"2","style":"margin:0 auto;"},cartContent); for(var v=0;v<thisFarmiData["cart"].length;v++){ prod=thisFarmiData["cart"][v][0]; menge=thisFarmiData["cart"][v][1]; wert=thisFarmiData["cart"][v][2]; sum += wert; newtr=createElement("tr",{"class":((prodStock[0][prod]<menge)?("farmicart_missing"):((prodStock[0][prod]-menge<prodMinRack[0][prod]-((valMinRackFarmis&&totalFarmis[0]&&totalFarmis[0][prod])?totalFarmis[0][prod]:0))?"farmicart_lowrack":"")),"prod":prod},newtable); produktPic(0,prod,createElement("td",{},newtr)); createElement("td",{"style":"width:34px;text-align:right;font-size:16px;font-weight:bold;"},newtr,numberFormat(menge)); newtd=createElement("td",{"class":"link","style":"width:200px;"},newtr); newtd.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.parentNode.getAttribute("prod")); },false); newtd.addEventListener("click",function(){showMarket(this.parentNode.getAttribute("prod"));},false); span=createElement("span",{"style":"font-size:16px;font-weight:bold;white-space:nowrap;"},newtd,prodName[0][prod]); span.style.fontSize=16*Math.min(1,200/span.offsetWidth)+"px"; newtd=createElement("td",{"class":"link","nr":v,"style":"width:82px;text-align:right;font-size:14px;"},newtr); if(wert>0){ newtd=createElement("div",{"style":"position:relative;height:100%;padding-left:5px;padding-right:5px;"},newtd); createElement("div",{"style":"position:absolute;left:0;height:100%;width:"+Math.ceil(100*wert/thisFarmiData["cart"][0][2])+"%;background-color:grey;opacity:0.6;z-index:-1;"},newtd); createElement("span",{"style":"width:100%;"},newtd,moneyFormatInt(wert)); }else{ newtd.style.backgroundColor="red"; priceMissing=true; } newtd.addEventListener("mouseover",function(event){ toolTip.show(event,getText("editPrice")); },false); newtd.addEventListener("click",function(){ var cell,newtable,newt,newtdr cell=this; while(cell.nodeName!="TD"){ cell=cell.parentNode; } var v=cell.getAttribute("nr"); cell=$("cartcontentEditPrice"); if(cell){ removeElement(cell); } newtable=createElement("div",{"id":"cartcontentEditPrice","style":"z-index:10;position:absolute;right:0;top:0;display:block;border-radius:5px;","class":"blackbox"},$("cartcontent")); newtable=createElement("table",{"cellspacing":"0","cellpadding":"0","border":"0","nr":v},newtable); newtr=createElement("tr",{},newtable); createElement("td",{"colspan":"2","style":"color:black;text-align:center;padding-bottom:2px;white-space:nowrap;"},newtr,getText("editPrice")); newtr=createElement("tr",{},newtable); createElement("td",{"colspan":"2","style":"color:black;border-bottom:1px solid black;text-align:center;padding-bottom:2px;white-space:nowrap;"},newtr,numberFormat(thisFarmiData["cart"][v][1])+" "+prodName[0][thisFarmiData["cart"][v][0]]); newtr=createElement("tr",{},newtable); createElement("td",{"style":"color:black;text-align:left;padding-top:2px;padding-right:10px;"},newtr,getText("marketPrice")); createElement("td",{"style":"color:black;text-align:right;padding-top:2px;"},newtr,moneyFormat(gut[thisFarmiData["cart"][v][0]])); newtr=createElement("tr",{},newtable); createElement("td",{"style":"color:black;text-align:left;padding-right:10px;"},newtr,getText("NPCprice")); createElement("td",{"style":"color:black;text-align:right;"},newtr,isNaN(NPC[0][thisFarmiData["cart"][v][0]])?"-":moneyFormat(NPC[0][thisFarmiData["cart"][v][0]])); newtr=createElement("tr",{"style":"height:22px;"},newtable); createElement("td",{"style":"color:black;text-align:left;padding-right:10px;"},newtr,getText("single")); newtd=createElement("td",{},newtr); cell=createElement("input",{"class":"text","type":"text","style":"color:black;text-align:right;width:60px;","value":numberFormat(thisFarmiData["cart"][v][2]/thisFarmiData["cart"][v][1],2),"maxlength":"8"},newtd); cell.addEventListener("change",function(){ var help=parseFloat(this.value.replace(regDelimThou,"").replace(regDelimDeci,"."),10); if(!isNaN(help)){ if(help<0){ help*=-1; } help=Math.round(100*help)/100; this.value=numberFormat(help,2); var v=this.parentNode.parentNode.parentNode.getAttribute("nr"); thisFarmiData["cart"][v][2]=help*thisFarmiData["cart"][v][1]; this.parentNode.parentNode.nextElementSibling.children[1].firstElementChild.value=numberFormat(thisFarmiData["cart"][v][2],2); } },false); newtr=createElement("tr",{"style":"height:22px;"},newtable); createElement("td",{"style":"color:black;text-align:left;padding-right:10px;"},newtr,getText("total")); newtd=createElement("td",{},newtr); cell=createElement("input",{"class":"text","type":"text","style":"color:black;text-align:right;width:60px;","value":numberFormat(thisFarmiData["cart"][v][2],2),"maxlength":"9"},newtd); cell.addEventListener("change",function(){ var help=parseFloat(this.value.replace(regDelimThou,"").replace(regDelimDeci,"."),10); if(!isNaN(help)){ if(help<0){ help*=-1; } help=Math.round(100*help)/100; this.value=numberFormat(help,2); var v=this.parentNode.parentNode.parentNode.getAttribute("nr"); thisFarmiData["cart"][v][2]=help; this.parentNode.parentNode.previousElementSibling.children[1].firstElementChild.value=numberFormat(thisFarmiData["cart"][v][2]/thisFarmiData["cart"][v][1],2); } },false); newtr=createElement("tr",{"style":"height:22px;"},newtable); newtd=createElement("td",{"colspan":"2","style":"color:black;border-top:1px solid black;text-align:center;padding-top:2px;"},newtr); cell=createElement("button",{"class":"link","type":"button","style":"color:black;"},newtd,getText("ok")); cell.addEventListener("click",function(){ removeElement(this.parentNode.parentNode.parentNode.parentNode); buildTable(); },false); cell=null;newtable=null;newtr=null;newtd=null; },false); } newtr=createElement("tr",{},newtable); createElement("td",{"colspan":"3"},newtr); newtd=createElement("td",{"style":"padding-left:5px;padding-right:5px;border-top:1px solid #336;text-align:right;color:#336;font-size:14px;","mouseOverText":"90%: "+moneyFormatInt(0.9*sum)},newtr,moneyFormatInt(sum)); newtd.addEventListener("mouseover",function(event){ toolTip.show(event,this.getAttribute("mouseOverText")); },false); newtd=$("cartsubmitPerc"); if(priceMissing){ newtd.style.border="4px inset #336"; newtd.style.color="#336"; newtd.style.backgroundColor="transparent"; newtd.innerHTML="--%"; }else{ if(100*thisFarmiData["money"]<valFarmiLimits[0]*sum){ var col="red";var col2="#fcc"; } else if(100*thisFarmiData["money"]<valFarmiLimits[1]*sum){ var col="#d80";var col2="#ff9"; } else{ var col="green";var col2="#80ff80"; } newtd.style.border="4px inset "+col; newtd.style.color=col; newtd.style.backgroundColor=col2; newtd.innerHTML=Math.round(100*thisFarmiData["money"]/sum)+"%"; } if(thisFarmiData["points"]){ span=$("cartsubmitPoints"); if(thisFarmiData["money"]<sum){ newtable=createElement("div",{}); newtable=createElement("table",{},newtable); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"style":"text-align:right;"},newtable,"100%: "); newtd=createElement("td",{"style":"text-align:right;"},newtable,numberFormat(1000*(sum-thisFarmiData["money"])/thisFarmiData["points"])); newtd=createElement("td",{},newtable,getText("gamecurrency")+"/"+numberFormat(1000)+getText("points")); newtr=createElement("tr",{},newtable); newtd=createElement("td",{"style":"text-align:right;"},newtable,"90%: "); if(thisFarmiData["money"]<0.9*sum){ newtd=createElement("td",{"style":"text-align:right;"},newtable,numberFormat(1000*(0.9*sum-thisFarmiData["money"])/thisFarmiData["points"])); newtd=createElement("td",{},newtable,getText("gamecurrency")+"/"+numberFormat(1000)+getText("points")); }else{ newtd=createElement("td",{"colspan":2},newtable,"---"); } span.setAttribute("mouseOverText",newtable.parentNode.innerHTML); }else{ span.setAttribute("mouseOverText","-"); } } cartContent=null;newtable=null;newtr=null;newtd=null;span=null; }catch(err){GM_logError("showCart.buildTable\n"+err);} } buildTable(); }catch(err){GM_logError("showCart\n"+err);} }); // Farmis displayed unsafeOverwriteFunction("setFarmis",function(){ try{ unsafeWindow._setFarmis(); }catch(err){GM_logError("_setFarmis\n"+err);} try{ calcFarmiCost(); calcTotalFarmis(); doFarmis(); }catch(err){GM_logError("setFarmis\n"+err);} }); // Reallocate Buildings err_trace="Reallocate Buildings"; unsafeOverwriteFunction("reallocateBuilding",function(set){ try{ unsafeWindow._reallocateBuilding(set); }catch(err){GM_logError("_reallocateBuilding\n"+err);} try{ //reallocateBuilding('farm1,zone1,farm2,zone2'); var building1=(6*set[0])+set[1]; var building2=(6*set[2])+set[3]; zones.swap(building1,building2); unsafeData.reallocateBuildingSet=[building1,building2]; raiseEvent("gameReallocateBuilding"); }catch(err){GM_logError("reallocateBuilding\n"+err);} }); // Farmersmarket function doFarmersMarketData(){ try{ var err_trace="zones"; var nowServer=unsafeWindow.Zeit.Server; var item,zoneNrF,zoneNrS,tempZoneProductionData,tempZoneProductionDataSlot,iProd,iTime,iWaterTime,iPoints,iAmount,currBlock; if(unsafeWindow.farmersmarket_data){ if(unsafeWindow.farmersmarket_data.flower_slots){ zoneNrF="farmersmarket-0"; zones.setBlock(zoneNrF,""); zones.setBonus(zoneNrF,0); tempZoneProductionData=[[{}],BUILDING_SIZE[zones.getBuilding(zoneNrF)],BUILDING_SIZE[zones.getBuilding(zoneNrF)],true]; if(unsafeWindow.farmersmarket_data.flower_slots.slots){ for(var slot in unsafeWindow.farmersmarket_data.flower_slots.slots){ if(!unsafeWindow.farmersmarket_data.flower_slots.slots.hasOwnProperty(slot)){continue;} item=unsafeWindow.farmersmarket_data.flower_slots.slots[slot]; iProd=parseInt(item["pid"],10); if(item["remain"]){ tempZoneProductionData[1]--; if(item["remain"]>0){ iTime=nowServer+parseInt(item["remain"],10); iWaterTime=nowServer+parseInt(item["waterremain"],10); }else{ iTime=nowServer+parseInt(item["remain"],10); iWaterTime=NEVER; } }else{ iTime=NEVER; iWaterTime=NEVER; } iAmount=1; iPoints=parseInt(item["points"],10); if(tempZoneProductionData[0][0][iProd]){ var notfound=true; for(var i=0;i<tempZoneProductionData[0][0][iProd].length;i++){ if((tempZoneProductionData[0][0][iProd][i][2]==iTime)&&(tempZoneProductionData[0][0][iProd][i][3]==iWaterTime)){ tempZoneProductionData[0][0][iProd][i][0]+=iAmount; tempZoneProductionData[0][0][iProd][i][1]+=iPoints; notfound=false;break; } } if(notfound){ tempZoneProductionData[0][0][iProd].push([iAmount,iPoints,iTime,iWaterTime]); } }else{ tempZoneProductionData[0][0][iProd]=[[iAmount,iPoints,iTime,iWaterTime]]; } } } zones.setProduction(zoneNrF,tempZoneProductionData.clone()); } zoneNrF="farmersmarket-1"; if(unsafeWindow.farmersmarket_data.flower_bonus&&unsafeWindow.farmersmarket_data.flower_bonus.pid&&(unsafeWindow.farmersmarket_data.flower_bonus.remain>0)){ zones.setBonusSpecial(zoneNrF,[unsafeWindow.farmersmarket_data.flower_bonus.pid,parseInt(unsafeWindow.flowerarea_dailybonus_percent,10)]); }else{ zones.setBonusSpecial(zoneNrF,null); } if(unsafeWindow.farmersmarket_data.pos){ for(var w=1;w<=6;w++) { if(item=unsafeWindow.farmersmarket_data.pos[w]){ zoneNrF="farmersmarket-"+w; currBlock=(item["block"]&&item["cost"]?"b":""); // locked due to missing payment currBlock+=(item["block"]&&item["level"]?"l"+item["level"]:""); // locked due to level requirement switch(w){ case 1:{ // Flower meadow tempZoneProductionData=[[{}],BUILDING_SIZE[zones.getBuilding(zoneNrF)],BUILDING_SIZE[zones.getBuilding(zoneNrF)],true]; zones.setBonus(zoneNrF,5); if(unsafeWindow.farmersmarket_data.flower_area){ for(var slot in unsafeWindow.farmersmarket_data.flower_area){ if(!unsafeWindow.farmersmarket_data.flower_area.hasOwnProperty(slot)){continue;} item=unsafeWindow.farmersmarket_data.flower_area[slot]; iProd=parseInt(item["pid"],10); if(item["remain"]){ tempZoneProductionData[1]--; if(item["remain"]>0){ //production busy, "duration" is reduced by watering iTime=parseInt(item["duration"],10)+parseInt(item["createdate"],10); if(zones.getBonus(zoneNrF)>0){ iWaterTime=parseInt(item["waterdate"],10); iWaterTime=((item["water_remain"]<0)?parseInt(item["createdate"],10):(item["water_remain"]<item["remain"]?item["water_remain"]+nowServer:NEVER)); }else{ iWaterTime=NEVER; } }else{ iTime=parseInt(item["duration"],10)+parseInt(item["createdate"],10); iWaterTime=NEVER; } }else{ iTime=NEVER; iWaterTime=NEVER; } iAmount=prodYield[0][iProd]; iPoints=prodPoints[0][iProd]; if(tempZoneProductionData[0][0][iProd]){ var notfound=true; for(var i=0;i<tempZoneProductionData[0][0][iProd].length;i++){ if((tempZoneProductionData[0][0][iProd][i][2]==iTime)&&(tempZoneProductionData[0][0][iProd][i][3]==iWaterTime)){ tempZoneProductionData[0][0][iProd][i][0]+=iAmount; tempZoneProductionData[0][0][iProd][i][1]+=iPoints; notfound=false;break; } } if(notfound){ tempZoneProductionData[0][0][iProd].push([iAmount,iPoints,iTime,iWaterTime]); } }else{ tempZoneProductionData[0][0][iProd]=[[iAmount,iPoints,iTime,iWaterTime]]; } } } zones.setProduction(zoneNrF,tempZoneProductionData.clone()); break;} case 2:{ // Flower workshop zones.setBonus(zoneNrF,0); if((!currBlock)&&(unsafeWindow.farmersmarket_data.nursery&&unsafeWindow.farmersmarket_data.nursery.slots)){ tempZoneProductionData=[[{},{}],0,0,true]; for(var slot=1;slot<=3;slot++){ zoneNrS=zoneNrF+"."+slot; zones.setBlock(zoneNrS,""); tempZoneProductionDataSlot=[[{},{}],0,0,true]; if(item=unsafeWindow.farmersmarket_data.nursery.slots[slot]){ if(item["block"]){ zones.setBlock(zoneNrS,"b"); }else{ iProd=(item["pid"]?parseInt(item["pid"],10):null); if(isNaN(iProd)){ iProd=null; } if((iProd!=null)&&(item["ready"])){ // production ready iTime=nowServer; }else if((iProd!=null)&&(item["remain"])){ // production busy iTime=nowServer+item["remain"]; }else{ iTime=NEVER; tempZoneProductionData[1]++; tempZoneProductionDataSlot[1]++; } tempZoneProductionData[2]++; tempZoneProductionDataSlot[2]++; if(iProd!=null){ iAmount=prodYield[0][iProd]; iPoints=iAmount*prodPoints[0][iProd]; if(!tempZoneProductionData[0][0][iProd]){ tempZoneProductionData[0][0][iProd]=[]; } tempZoneProductionData[0][0][iProd].push([iAmount,iPoints,iTime,NEVER]); if(!tempZoneProductionDataSlot[0][0][iProd]){ tempZoneProductionDataSlot[0][0][iProd]=[]; } tempZoneProductionDataSlot[0][0][iProd].push([iAmount,iPoints,iTime,NEVER]); } } } zones.setProduction(zoneNrS,tempZoneProductionDataSlot.clone()); } zones.setProduction(zoneNrF,tempZoneProductionData.clone()); } break;} default:{ currBlock="blpqs"; } } zones.setBlock(zoneNrF,currBlock); } } } } calcTotalZones(); }catch(err){GM_logError("doFarmersMarketData ("+err_trace+")\n"+err);} }; if(unsafeWindow.farmersmarket_data){ doFarmersMarketData(); } unsafeOverwriteFunction("farmersMarketHandler",function(response){ try{ unsafeWindow._farmersMarketHandler(response); }catch(err){GM_logError("_farmersMarketHandler\n"+err);} try{ doFarmersMarketData() }catch(err){GM_logError("farmersMarketHandler\n"+err);} }); function doFarmersMarket(){ try{ var div,div1,divZone; var zoneNrF; for(var w=1;w<=6;w++){ zoneNrF="farmersmarket-"+w; divZone=$("farmersmarket_pos"+w); if(!divZone.classList.contains("listenerMouseOver")){ divZone.classList.add("listenerMouseOver"); divZone.addEventListener("mouseout",function(){ hideBlase(); hideLagerZeitZiel(); },false); divZone.addEventListener("mouseover",function(){ var help = /^farmersmarket_pos(\d+)$/.exec(this.id); help="farmersmarket-"+help[1]; showBlase(help); showLagerZeitZiel(help); },true); } if(div=$("farmersmarket_pos"+w+"_progress")){ if(!div.classList.contains("listenerMouseOver")){ div.classList.add("listenerMouseOver"); div.addEventListener("mouseover",function(event){ var help=/^farmersmarket_pos(\d+)_progress$/.exec(this.id); help="farmersmarket-"+help[1]; toolTip.show(event,toolTipZoneProduction(help)); },false); } } switch(w){ case 1:{ // Flower meadow // Production if(!(div=$("farmersmarket_pos"+w+"_running"))){ if(div1=$("farmersmarket_pos"+w+"_progress")){ div1.style.display="block"; div=createElement("div",{"id":"farmersmarket_pos"+w+"_running","style":"position:absolute;right:0px;top:10px;"},div1); } } if(div){ div.setAttribute("class","v"+zones.getMainproduct(zoneNrF)); } break;} } } div=null; }catch(err){GM_logError("doFarmersMarket\n"+err);} } if($("farmersmarket_pos1")){ doFarmersMarket(); } unsafeOverwriteFunction("setFarmersMarket",function(){ try{ unsafeWindow._setFarmersMarket(); }catch(err){GM_logError("_setFarmersMarket\n"+err);} try{ doFarmersMarket(); }catch(err){GM_logError("setFarmersMarket\n"+err);} }); unsafeOverwriteFunction("initFlowerArea",function(){ try{ unsafeWindow._initFlowerArea(); }catch(err){GM_logError("_initFlowerArea\n"+err);} try{ showLagerZeitZiel("farmersmarket-1"); raiseEvent("gameFarmersmarketOpened1"); }catch(err){GM_logError("initFlowerArea\n"+err);} }); unsafeOverwriteFunction("closeFlowerArea",function(){ try{ unsafeWindow._closeFlowerArea(); }catch(err){GM_logError("_closeFlowerArea\n"+err);} try{ hideLagerZeitZiel("farmersmarket-1"); }catch(err){GM_logError("closeFlowerArea\n"+err);} }); unsafeOverwriteFunction("initNursery",function(){ try{ unsafeWindow._initNursery(); }catch(err){GM_logError("_initNursery\n"+err);} try{ raiseEvent("gameFarmersmarketOpened2"); }catch(err){GM_logError("initNursery\n"+err);} }); unsafeOverwriteFunction("dialogNursery",function(mode,c,t,h){ try{ unsafeWindow._dialogNursery(mode,c,t,h); }catch(err){GM_logError("_dialogNursery\n"+err);} try{ switch(mode){ case "production": raiseEvent("gameFarmersmarketSlotOpened"); case "production_commit": raiseEvent("gameFarmersmarketDialogCommit"); } }catch(err){GM_logError("dialogNursery\n"+err);} }); unsafeOverwriteFunction("dialogFlowerArea",function(mode,l){ try{ unsafeWindow._dialogFlowerArea(mode,l); }catch(err){GM_logError("_dialogFlowerArea\n"+err);} try{ switch(mode){ case "autoplant": raiseEvent("gameFarmersmarketDialogStart"); } }catch(err){GM_logError("dialogFlowerArea\n"+err);} }); // events forestry ============================================================================== err_trace="events forestry"; /* $("globalcommitbox").addEventListener ("DOMAttrModified", function(event){ try{ var help; if ((this==event.target)&&(this.style.display == "block") && (help=$("forestry_questentry_value"))){ var max = $("globalcommitbox").innerHTML.match(/chkForestryQuestEntryValue\(\d+,\d+,(\d+)\)/i); GM_log("max:"+implode(max)); if (max && max[1]){ help.value = max[1]; keyup(help); } } }catch(err){GM_logError("globalcommitbox \n"+err);} },false); Arrays: forestry_area_run : >0 if growing forestry_area_time : seconds till end of growing forestry_area_watertime : seconds till next watering (<=0 if water needed) forestry_area_name : Name of tree if growing forestry_area_pid : tree id {1,2,3,...} */ /* unsafeOverwriteFunction("forestryAjaxAction",function(action,position,pid,slot){ // GM_log("forestryAjaxAction action="+action+" position="+position+" pid="+pid+" slot="+slot); // GM_log("currentslot="+unsafeWindow.currentslot); // open menu again // if((position==1)||(position==2)){ if(position==2){ if((action=="startproduction")||(action=="cancelproduction")||(action=="cropproduction")){ document.addEventListener("gameOpenForestry",function(position){ return function(){ document.removeEventListener("gameOpenForestry",arguments.callee,false); var div=$("forestry_building_click"+position); if(div){ click(div); } div=null; }}(position),false); } } unsafeWindow._forestryAjaxAction(action,position,pid,slot); }); */ unsafeOverwriteFunction("initForestryResponse",function(request,mode,C,r,type){ try{ if(DEVMODE_FUNCTION){ var trackingHandle = tracking.start("berater","initForestryResponse"); } unsafeWindow._initForestryResponse(request,mode,C,r,type); // initForestryResponse(request,uprack,upmenu,action,pos,tutorialstep,position); var result = checkRequest(request); if(result && result[0]!=0){ unsafeWindow.farm=""; //Hack for the scripts unsafeWindow.city=""; //Hack for the scripts // GM_log("forestry: result:\n"+implode(result)); if(unsafeWindow.forestry_unlock){ try{ /* forestry_production_products{stock}{iProd} {0} = 36000 // Time {1}{1}{1} = 30 //points you get with harwisting this product {1}{1}{2} = 1 //amount it will produce {1}{1}{3} = 1 //stock number {1}{1}{4}{0} = 1 //campain number after which it can be used {1}{1}{4}{1} = 3 //quest number after which it can be used {1}{1}{5} = 21 //What can i make of this: stock 2 =[{0:product,1:amount}]; stock 1 = product; stock 3,4 = 0; {1}{1}{6} = 0 //What do i need for this: stock 4 =[{0:product,1:amount}]; stock 1 to 3 = 0 {1}{1}{7} = 3 //something with the price.. but this could change dayly {1}{1}{8} = 0 //stock 5: [prod,amount] to be payed to get this forestry_area[][block] of the field. {1}{1}{9} = Fijnspar //NAME {1}{1}{10}{0} = 1 //only at stock 1 {1}{1}{10}{1} = 2 //only at stock 1 {1}{1}{11} = 0 ->stock 3: fid needed to produce {1}{1}{12} = 0 //item for in the farmbuilding */ //make prodName[1] && prodYield[1] && prodRequire[1] = [[type,fId,amount]] var store,stock,fId,bChanged=false,help,building; for(var stock in result[4]){ //forestry_production_products==initForestryResponce->result[4] if (!result[4].hasOwnProperty(stock)){ continue; } for(var fId in result[4][stock]){ if (!result[4][stock].hasOwnProperty(fId)){ continue; } help=result[4][stock][fId]; // if (!prodName[1][fId]){ // prodName[1][fId] = help[9]; // set prodName[1] // //GM_log("initForestryResponse ADD prodName production fId:"+fId+" name:"+prodName[1][fId]); // bChanged=true; // } prodTyp[1][fId]="f"+stock; prodPoints[1][fId]=help[1]; //GM_log("prodYield fId:"+fId+" [5]:"+typeof help[5]); building=getForestryUserBuilding(stock-1); prodStockMax[1][fId]=building?unsafeWindow.forestry_user_buildings[building]["capacity"]:0; if(stock==1){ prodYield[1][fId]=1; prodYield[1][help[5]]=1; delete prodRequire[1][fId]; //[[1,parseInt(fId,10),1]]; prodRequire[1][help[5]]=[[1,parseInt(fId,10),1]]; prodGrowTime[1][fId]=help[0]/60; }else if(stock==2){//forestry // [4]{2}{23}[5][0][0] = 47 //id // [4]{2}{23}[5][0][1] = 7 //# // for(var i=0;i<help[5].length;i++){ //prodYield[1][help[5][i][0]]=help[5][i][1]; //prodRequire[1][help[5][i][0]]=[[1,parseInt(fId,10),1]]; // } }else if(stock==3){//sawmill prodYield[1][fId]=help[2]; prodRequire[1][fId]=[[1,help[11],1]]; building=getForestryUserBuilding(1); if(!prodGrowTime[1][fId]){ if(building&&unsafeWindow.forestry_user_buildings[building]["boni"]){ prodGrowTime[1][fId]=((help[0]*100)/(100-unsafeWindow.forestry_user_buildings[building]["boni"]))/60; }else{ prodGrowTime[1][fId]=help[0]/60; } } }else if(stock==4){//carpentry //[4]{4}{101}[6][0][0] = 41 //id //[4]{4}{101}[6][0][1] = 4 //# prodYield[1][fId]=1; prodRequire[1][fId]=new Array(); for(var i=0;i<help[6].length;i++){ prodRequire[1][fId].push([1,help[6][i][0],help[6][i][1]]); } building=getForestryUserBuilding(2); if(!prodGrowTime[1][fId]){ if(building&&unsafeWindow.forestry_user_buildings[building]["boni"]){ prodGrowTime[1][fId]=((help[0]*100)/(100-unsafeWindow.forestry_user_buildings[building]["boni"]))/60; }else{ prodGrowTime[1][fId]=help[0]/60; } } } } } stock=null;fId=null;help=null; // prodPoints[1].sortObj(); // GM_log("initForestryResponse prodPoints:"+implode(prodPoints,"prodPoints")); GM_setValueCache(COUNTRY+"_"+SERVER+"_prodPoints",implode(prodPoints,"initForestryResponse\prodPoints")); // prodTyp[1].sortObj(); // GM_log("initForestryResponse prodTyp:"+implode(prodTyp,"prodTyp")); GM_setValueCache(COUNTRY+"_"+SERVER+"_prodTyp",implode(prodTyp,"initForestryResponse\prodTyp")); // prodYield[1].sortObj(); // GM_log("initForestryResponse prodYield:"+implode(prodYield,"prodYield")); GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodYield",implode(prodYield,"initForestryResponse\prodYield")); // prodRequire[1].sortObj(); // GM_log("initForestryResponse prodRequire:"+implode(prodRequire,"prodRequire")); GM_setValueCache(COUNTRY+"_"+SERVER+"_prodRequire",implode(prodRequire,"initForestryResponse\prodRequire")); // prodGrowTime[1].sortObj(); // GM_log("initForestryResponse prodGrowTime:"+implode(prodGrowTime,"prodGrowTime")); GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodGrowTime",implode(prodGrowTime,"initForestryResponse\prodGrowTime")); // prodStockMax[1].sortObj(); // GM_log("initForestryResponse prodStockMax:"+implode(prodStockMax,"prodStockMax")); GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodStockMax",implode(prodStockMax,"initForestryResponse\prodStockMax")); // make prodName[1] && forestry_stock prodStock[1]=new Object(); for(store in result[3]){ //forestry_stock if (!result[3].hasOwnProperty(store)){ continue; } for(fId in result[3][store]){ if (!result[3][store].hasOwnProperty(fId)){ continue; } // if (!prodName[1][fId]){ // prodName[1][fId] = result[3][store][fId]["name"]; // set prodName[1] // //GM_log("initForestryResponse ADD prodName stock fId:"+fId+" name:"+prodName[1][fId]); // bChanged=true; // } if(!prodStock[1][fId]) prodStock[1][fId]=0; prodStock[1][fId] += parseInt(result[3][store][fId]["amount"],10); } } for(fId in prodName[1]){ if (!prodName[1].hasOwnProperty(fId)){ continue; } if(!prodStock[1][fId]){ prodStock[1][fId]=0; } } //GM_log("initForestryResponse prodStock:"+implode(prodStock,"prodStock")); GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodStock",implode(prodStock,"initForestryResponse\prodStock")); for(fId in prodName[1]){ if(!prodName[1].hasOwnProperty(fId)){continue;} stock=prodTyp[1][fId].replace("f",""); if(!!prodTyp[1][fId]&&!(result[4][stock]&&result[4][stock][fId])&&!prodBlock[1][fId].match(/b/)){ prodBlock[1][fId]+="b"; } } store=null;fId=null; // prodStock[1].sortObj(); GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodStock",implode(prodStock)); //forestry_farmis var farmi, i; totalFarmis[1]=new Object(); for(farmi in result[5]){ //forestry_farmis==initForestryResponce->result[5] if (!result[5].hasOwnProperty(farmi)){ continue; } for(i in result[5][farmi]["products"]){ if (!result[5][farmi]["products"].hasOwnProperty(i)){ continue; } fId = result[5][farmi]["products"][i]["product"]; // if (!prodName[1][fId]){ // prodName[1][fId] = result[5][farmi]["products"][i]["name"]; // set prodName[1] // //GM_log("initForestryResponse ADD prodName farmis fId:"+fId+" name:"+prodName[1][fId]); // bChanged=true; // } if(!totalFarmis[1][fId]) totalFarmis[1][fId]=0; totalFarmis[1][fId] += parseInt(result[5][farmi]["products"][i]["amount"],10); } } // totalFarmis[1].sortObj(); // GM_log("initForestryResponse totalFarmis:"+implode(totalFarmis)); GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_totalFarmis",implode(totalFarmis)); if(bChanged){ // prodName[1].sortObj(); // GM_log("initForestryResponse bChanged:"+ bChanged+" prodName:"+implode(prodName)); GM_setValueCache(COUNTRY+"_"+SERVER+"_prodName",implode(prodName)); } }catch(err){GM_logError("initForestryResponse \n"+err);} var zoneNrF; switch(type){ case 1: zoneNrF="sawmill"; break; case 2: zoneNrF="carpentry"; break; } updateProductDataForestry(); doForestry(); switch(mode){ case "cropproduction": raiseEvent("game"+zoneNrF.capitalize()+"Cropped"); break; case "startproduction": raiseEvent("game"+zoneNrF.capitalize()+"Started"); break; default: raiseEvent("gameOpenForestry"); } } calcProdMinRack(); } if(DEVMODE_FUNCTION){ tracking.end("berater",trackingHandle); } }catch(err){GM_logError("initForestryResponse \n"+err);} }); /* var container = $("forestry_sawmill_productbox"); var treeContainer, el1, el2; // Redesign sawmill for(var treeId=1;treeId<=5;treeId++){ treeContainer = createElement("div",{"id":"forestry_sawmill_productbox_tree"+treeId,"style":"height:40px;"},container); el1 = createElement("div",{"id":"forestry_sawmill_productbox_log"+treeId,"class":"forestry_slot_product f_symbol"+(20+treeId),"style":"display:block;border-right:2px solid black;"},treeContainer); createElement("div",{"id":"forestry_sawmill_productbox_log"+treeId+"_amount","style":"position:absolute;top:-13px;"},el1) for(var i=-2;i<=0;i++){ if(el1=$("forestry_slot_products"+(treeId*3+i))){ treeContainer.appendChild(el1); createElement("div",{"id":"forestry_slot_products"+(treeId*3+i)+"_amount","style":"position:absolute;top:-13px;"},el1); if(el2=$("forestry_slot_products_name"+(treeId*3+i))){ el1.addEventListener("mouseover",function(){ // $(this.id+"_endtime").innerHTML=0; var nr=this.id.replace("forestry_slot_products",""); var div=$("forestry_slot_products"+nr+"_endtime"); if(!div){ if(div=$("forestry_slot_products_name"+nr)){ div=createElement("div",{},div); createElement("img",{"src":GFX+"adtime.gif","style":"width:14px;height:14px;vertical-align:text-bottom;margin-right:5px;"},div); div=createElement("div",{"id":"forestry_slot_products"+nr+"_endtime","style":"display:inline-block;"},div); } } if(div){ var iProd = parseInt(/f_symbol(\d+)/.exec(this.getAttribute("class"))[1],10); var iTime=calcProductionTime("sawmill",1,iProd,1-zones.getBonus("sawmill")/100); div.innerHTML=getDaytimeStr(now+iTime)+" "+getText("shortOClock"); iProd=null;iTime=null; } nr=null;div=null; },false); } } } } // Redesign Carpentry for(var i=1;i<=20;i++){ el1=$("forestry_productiondialog_content_item_amount"+i); if(el1){ el1.style.width = "150px"; container = el1.parentNode; // $("forestry_productiondialog_content_item_con"+i); container.style.position = "relative"; container.style.height = "28px"; container.style.marginBottom = "5px"; container.className = "hoverBgLightbrown"; container.addEventListener("mouseover",function(evt){ try{ var prod = parseInt(/f_symbol(\d+)/.exec($(this.id.replace("forestry_productiondialog_content_item_con","forestry_productiondialog_content_item")).getAttribute("class"))[1],10); var container,newTable,newTr,newTd; container=createElement("div"); newTable=createElement("table",{},container); // name newTr=createElement("tr",{},newTable); newTd=createElement("th",{"colspan":"2"},newTr,prodName[1][prod]); if(prodTyp[1][prod]=="f5"){ newTr=createElement("tr",{},newTable); newTd=createElement("td",{"colspan":"2","style":"font-weight:bold;"},newTr,unsafeWindow.forestry_production_farmhouseitem_info_head); }else{ // rack amount newTr=createElement("tr",{},newTable); newTd=createElement("td",{},newTr,getText("stock")); newTd=createElement("td",{},newTr,numberFormat(prodStock[1][prod])); } toolTip.show(evt,container.innerHTML); }catch(err){ GM_logError("listener carpentryItem.mouseover\nprod="+prod+"\n"+err); } },false); // createElement("div",{"id":"forestry_productiondialog_content_item_rackamount"+i,"style":"position:absolute;top:25px;left:0px;"},container,"0"); el1=insertAfter(createElement("div",{"class":"forestry_productiondialog_content_item_main_amount","style":"width:150px;"}),el1); el2=createElement("div",{"style":"display:inline-block;height:15px;width:15px;margin-right:1px;"},el1); createElement("img",{"src":GFX+"lager/wachstum.gif","style":"width:14px;height:14px;vertical-align:text-bottom;"},el2); createElement("div",{"id":"forestry_productiondialog_content_item_times"+i,"style":"display:inline-block;width:58px;"},el1,"0"); el2=createElement("div",{"style":"display:inline-block;height:15px;width:15px;margin-left:2px;margin-right:1px;"},el1); createElement("img",{"src":GFX+"adtime.gif","style":"width:14px;height:14px;vertical-align:text-bottom;"},el2); createElement("div",{"id":"forestry_productiondialog_content_item_endtimes"+i,"style":"display:inline-block;width:58px;"},el1,"0"); } } container=null;treeContainer=null;el1=null;el2=null; */ // Redesign Forest Stock var div,div2,span,iProd,iTime; for(var v=1;v<=8;v++){ if(div=$("f_stock_item"+v)){ iProd=parseInt(/f_symbol(\d+)/.exec(div.firstElementChild.className)[1],10); if(iProd&&(div=$("f_stock_growing_"+v))){ iTime=calcProductionTime("forest",1,iProd,1-zones.getBonus("forest")/100); div.innerHTML=getTimeStr(iTime,true)+" "+getText("shortHours"); div.parentNode.parentNode.style.height="44px"; div2=createElement("div",{"style":"float:left;height:15px;width:15px;margin-right:5px;"},div.parentNode); createElement("img",{"src":GFX+"adtime.gif","style":"width:14px;height:14px;"},div2); div2=createElement("div",{"class":"forestry_stockitem_time"},div.parentNode); span=createElement("span",{},div2); clocks.add("forestItem_"+iProd,span,iTime); createElement("span",{},div2," "+getText("shortOClock")); createElement("div",{"class":"clear"},div.parentNode); } } } unsafeOverwriteFunction("showForestryProductionBox",function(type){ try{ unsafeWindow._showForestryProductionBox(type); }catch(err){GM_logError("_showForestryProductionBox\n"+err);} try{ if(DEVMODE){ GM_log("showForestryProductionBox type="+type); } return; switch(type){ case 1:{// sawmill var container,prod,classStr,flagDisplay,div; var zoneNrF="sawmill"; for(var treeId=1;treeId<=5;treeId++){ try{ container = $("forestry_sawmill_productbox_tree"+treeId); classStr = container.children[0].getAttribute("class"); prod = parseInt(/f_symbol(\d+)/.exec(classStr)[1],10); $(container.children[0].id+"_amount").innerHTML = numberFormat(prodStock[1][prod]); flagDisplay = "none"; for(var i=1;i<=3;i++){ if(container.children[i].style.display!="none"){ flagDisplay = "block"; classStr = container.children[i].getAttribute("class"); prod = parseInt(/f_symbol(\d+)/.exec(classStr)[1],10); if(!classStr.match(/ link$/)){ container.children[i].setAttribute("class",classStr+" link"); } $(container.children[i].id+"_amount").innerHTML = numberFormat(prodStock[1][prod]); } } container.style.display = flagDisplay; }catch(err){ GM_logError("showForestryProductionBox sawmill\ntreeId="+treeId+"\n"+err); } } //auto-cropping for(var slot=1;slot<=3;slot++){ try{ if((top.unsafeData.autoAction==null) && valAutoCrop["forestry"] && (div=$("forestry_slot_crop"+slot)) && (div.style.display=="block")){ top.unsafeData.autoAction="berater: sawmill crop"; document.addEventListener("gameOpenGlobalCommitBox",function(){ document.removeEventListener("gameOpenGlobalCommitBox",arguments.callee,false); window.setTimeout(function(){ click($("globalcommitboxfooter").firstElementChild); top.unsafeData.autoAction=null; },500); }); window.setTimeout(function(div){ click(div); },500,div); } div=null; }catch(err){ GM_logError("showForestryProductionBox sawmill\nslot="+slot+"\n"+err); } } container=null;prod=null;classStr=null;flagDisplay=null; raiseEvent("gameSawmillOpened"); break;} case 2:{ // carpentry var container,icon,prod,help; for(var i=1;i<=20;i++){ try{ container=$("forestry_productiondialog_content_item_con"+i); icon=$("forestry_productiondialog_content_item"+i); if(container&&icon&&(container.style.display=="block")){ prod = parseInt(/f_symbol(\d+)/.exec(icon.getAttribute("class"))[1],10); // show rack amount // $("forestry_productiondialog_content_item_rackamount"+i).innerHTML = numberFormat(prodStock[1][prod]); // check required products help=true; for(var j=0;j<prodRequire[1][prod].length;j++){ if(prodStock[1][prodRequire[1][prod][j][1]]<prodRequire[1][prod][j][2]){ help=false; } } if(help){ if(icon.childElementCount>0){ removeElement(icon.children[0]); } } else { if(icon.childElementCount==0){ createElement("img",{"alt":"X","style":"width:25px;height:25px;","src":GFX+"cursors/cursor_forbidden.gif"},icon); } } // show times help=calcProductionTime("carpentry",1,prod,1-zones.getBonus("carpentry")/100); if(icon=$("forestry_productiondialog_content_item_amount"+i)){ icon.innerHTML = prodName[1][prod]; } if(icon=$("forestry_productiondialog_content_item_times"+i)){ icon.innerHTML = getTimeStr(help,true)+" "+getText("shortHours"); } if(icon=$("forestry_productiondialog_content_item_endtimes"+i)){ icon.innerHTML = getDaytimeStr(now+help,true,true)+" "+getText("shortOClock"); } } }catch(err){ GM_logError("showForestryProductionBox carpentry\ni="+i+"\n"+err); } } //auto-cropping for(var slot=1;slot<=3;slot++){ try{ if((top.unsafeData.autoAction==null) && valAutoCrop["forestry"] && (div=$("forestry_slot_crop"+slot)) && (div.style.display=="block")){ top.unsafeData.autoAction="berater: carpentry crop"; document.addEventListener("gameOpenGlobalCommitBox",function(){ document.removeEventListener("gameOpenGlobalCommitBox",arguments.callee,false); window.setTimeout(function(){ click($("globalcommitboxfooter").firstElementChild); top.unsafeData.autoAction=null; },500); }); window.setTimeout(function(div){ click(div); },500,div); } div=null; }catch(err){ GM_logError("showForestryProductionBox carpentry\nslot="+slot+"\n"+err); } } container=null;icon=null;prod=null;help=null; raiseEvent("gameCarpentryOpened"); break;} } }catch(err){GM_logError("showForestryProductionBox\n"+err);} }); unsafeOverwriteFunction("showForestrySelection",function(type,slot){ try{ unsafeWindow._showForestrySelection(type,slot); }catch(err){GM_logError("_showForestrySelection\n"+err);} try{ if(!type){ type=1; } if(!slot){ slot=1; } var container,div; var zoneNrF,iProd,iTime; switch(type){ case 1: zoneNrF="sawmill"; break; case 2: zoneNrF="carpentry"; break; } container=$("forestry_selectproduction_scrollcontent"); for(var i=container.childElementCount-1;i>=0;i--){ div=container.children[i].firstElementChild; iProd=parseInt(/f_symbol(\d+)/.exec(div.className)[1],10); iTime=calcProductionTime(zoneNrF,1,iProd,1-zones.getBonus(zoneNrF)/100); div2=createElement("div",{"style":"float:left;margin-right:10px;"}); div.parentNode.insertBefore(div2,div); div.removeAttribute("style"); div2.appendChild(div); createElement("div",{},div2,numberFormat(prodStock[1][iProd])); div=container.children[i].children[1].children[1]; div.innerHTML=""; div.style.height="14px"; div2=createElement("div",{"class":"forestry_growing"},div); createElement("div",{"style":"float:left;margin-right:5px;"},div,getTimeStr(iTime,true)+" "+getText("shortHours")); div2=createElement("div",{"style":"float:left;height:15px;width:15px;margin-right:5px;"},div); createElement("img",{"src":GFX+"adtime.gif","style":"width:14px;height:14px;"},div2); div2=createElement("div",{"style":"float:left;"},div); clocks.add("forestrySelection_"+iProd,div2,iTime); } raiseEvent("game"+zoneNrF.capitalize()+"SlotOpened"); }catch(err){GM_logError("showForestrySelection\n"+err);} }); unsafeOverwriteFunction("showForestryBuildingInner",function(type){ try{ unsafeWindow._showForestryBuildingInner(type); }catch(err){GM_logError("_showForestryBuildingInner\n"+err);} try{ switch(type){ case 1:{// sawmill raiseEvent("gameSawmillOpened"); break;} case 2:{ // carpentry raiseEvent("gameCarpentryOpened"); break;} } }catch(err){GM_logError("showForestryBuildingInner\n"+err);} }); /* createElement("div",{"id":"analyzediv","style":"position: fixed; top: 0px; right: 0px; z-index: 995; display: block;","class":"blackbox"},ALL); $("analyzediv").addEventListener("click",function(){this.innerHTML="";},false); unsafeOverwriteFunction("forestrySetStatus",function(position,status,product){ unsafeWindow._forestrySetStatus(position,status,product); var str = 'forestry_area_run = '+unsafeWindow.forestry_area_run [position]+'<br>'+ 'forestry_area_time = '+unsafeWindow.forestry_area_time [position]+'<br>'+ 'forestry_area_watertime = '+unsafeWindow.forestry_area_watertime[position]+'<br>'+ 'forestry_area_name = '+unsafeWindow.forestry_area_name [position]+'<br>'+ 'forestry_area_pid = '+unsafeWindow.forestry_area_pid [position]; for(var j = 0 ; j < unsafeWindow.forestry_area.length ; j++) { if(unsafeWindow.forestry_area[j]) { if(unsafeWindow.forestry_area[j]['position'] == position){ str ="forestry_area["+j+"]="+implode(unsafeWindow.forestry_area[j]); } } } GM_log(str); $("analyzediv").innerHTML=str; }); */ function doForestry(){ try{ gameLocation=["forestry",null]; unsafeData.gameLocation=gameLocation.clone(); var nowServer=unsafeWindow.Zeit.Server; var zoneNrF,zoneNrS,tempZoneProductionData,tempZoneProductionDataSlot,currBlock,currBonus; // GM_log("forestry_slots:\n"+print_r(unsafeWindow.forestry_slots,"",true,"\n")); // Sawmill and carpentry var err_trace="forestry_user_buildings"; if(unsafeWindow.forestry_user_buildings){ var res,iProd,iAmount,iPoints,iTime,maxCapacity,iSlotCount; for(var building in unsafeWindow.forestry_user_buildings){ //forestry_user_buildings==initForestryResponce->result[2] if(!unsafeWindow.forestry_user_buildings.hasOwnProperty(building)){continue;} switch(building){ case "1": zoneNrF="sawmill";break; case "2": zoneNrF="carpentry";break; default: continue; } // GM_log("forestry_user_buildings["+building+"]:\n"+print_r(unsafeWindow.forestry_user_buildings[building],"",true,"\n")); //building=getForestryUserBuilding(i); currBlock=(unsafeWindow.forestry_user_buildings[building]["locked"]?"q":""); zones.setBlock(zoneNrF,currBlock); if(zones.isMultiSlot(zoneNrF)){ iSlotCount=3; if(!currBlock){ for(var slot=1;slot<=3;slot++){ zoneNrS=zoneNrF+"."+slot; zones.setBlock(zoneNrS,((slot==1)||(unsafeWindow.forestry_slots[building]&&unsafeWindow.forestry_slots[building][slot]))?"":"b"); } } }else{ iSlotCount=0; } if(!currBlock){ zones.setBonus(zoneNrF,unsafeWindow.forestry_user_buildings[building]["boni"]?unsafeWindow.forestry_user_buildings[building]["boni"]:0); // maxCapacity=unsafeWindow.forestry_user_buildings[building]?unsafeWindow.forestry_user_buildings[building]["capacity"]:100; res=(unsafeWindow.forestry_user_buildings[building]&&unsafeWindow.forestry_user_buildings[building]["slots"])?unsafeWindow.forestry_user_buildings[building]["slots"]:{}; tempZoneProductionData=[[{},{}],0,0,true]; for(var slot=1;slot<=(iSlotCount==0?1:iSlotCount);slot++){ if(DEVMODE){ GM_log("doForestry zoneNrF="+zoneNrF+" slot="+slot+" res["+slot+"]="+implode(res[slot],"res")); } if(iSlotCount>0){ zoneNrS=zoneNrF+"."+slot; }else{ zoneNrS=zoneNrF; } if(!zones.getBlock(zoneNrS)){ tempZoneProductionDataSlot=[[{},{}],0,0,true]; if(res[slot]){ iProd=(res[slot]["productid"]?parseInt(res[slot]["productid"],10):null); if(isNaN(iProd)){ iProd=null; } // &&maxCapacity<(prodStock[1][iProd]+((iStock+1)*prodYield[1][iProd]))){ // tempZoneProductionData["block"][slot]=true; // if(tempZoneProductionData["block"].length()==1){ // logBubble.add("Max stock capacity reached for<br>"+prodName[1][iProd],10,"red"); // } if((iProd!=null)&&(res[slot]["ready"]==2)){ // production busy iTime=nowServer+res[slot]["remain"]; }else if((iProd!=null)&&(res[slot]["ready"]==1)){ // production ready iTime=nowServer; }else{ iTime=NEVER; tempZoneProductionData[1]++; tempZoneProductionDataSlot[1]++; } tempZoneProductionData[2]++; tempZoneProductionDataSlot[2]++; if(iProd!=null){ iAmount=prodYield[1][iProd]; iPoints=iAmount*prodPoints[1][iProd]; if(!tempZoneProductionData[0][1][iProd]){ tempZoneProductionData[0][1][iProd]=[]; } tempZoneProductionData[0][1][iProd].push([iAmount,iPoints,iTime,NEVER]); if(!tempZoneProductionDataSlot[0][1][iProd]){ tempZoneProductionDataSlot[0][1][iProd]=[]; } tempZoneProductionDataSlot[0][1][iProd].push([iAmount,iPoints,iTime,NEVER]); } } if(iSlotCount>0){ zones.setProduction(zoneNrS,tempZoneProductionDataSlot.clone()); } } } zones.setProduction(zoneNrF,tempZoneProductionData.clone()); //auto-cropping if(iSlotCount=0){ var div; if((top.unsafeData.autoAction==null) && valAutoCrop["forestry"] && (zones.getEndtime(zoneNrF)<=unsafeWindow.Zeit.Server) && (div=$("forestry_building_click"+building))){ top.unsafeData.autoAction="berater: forestry building crop"; document.addEventListener("gameOpenGlobalCommitBox",function(){ document.removeEventListener("gameOpenGlobalCommitBox",arguments.callee,false); window.setTimeout(function(){ click($("globalcommitboxfooter").firstElementChild); top.unsafeData.autoAction=null; },500); }); window.setTimeout(function(div){ click(div); },500,div); } div=null; } createZoneTimer("zoneTimer_"+zoneNrF,zoneNrF,"zonetimer","position:absolute;top:5px;left:50px;",$("forestry_building"+building)); } } building=null;res=null;iProd=null;iTime=null;maxCapacity=null; } // Forest zoneNrF="forest"; err_trace="forest"; if(unsafeWindow.forestry_unlock){ var res,zoneNrF,iProd,iProd2,iTime,iWaterTime,building,maxCapacity,div; //GM_log("doForestry zoneNrF:"+zoneNrF); //maxCapacity=((building=getForestryUserBuilding(1))&&unsafeWindow.forestry_user_buildings[building])?unsafeWindow.forestry_user_buildings[building]['capacity']:100; tempZoneProductionData=[[{},{}],BUILDING_SIZE["forest"],BUILDING_SIZE["forest"],true]; zones.setBlock(zoneNrF,""); currBonus=((div=$("forestry_forest_button1_info_locked"))&&(div.style.display=="block")?0:5); if(questData["forestry"]["1"]["nr"]>75){ currBonus+=5; } zones.setBonus(zoneNrF,currBonus); for(var slot in unsafeWindow.forestry_area){ //forestry_area==initForestryResponce->result[1] if(!unsafeWindow.forestry_area.hasOwnProperty(slot)){continue;} //if(DEVMODE){ GM_log("doFestry zoneNrF:"+zoneNrF+" slot:"+slot+" res:"+implode(res,"res")); } res=unsafeWindow.forestry_area[slot]; iProd=parseInt(res["productid"],10); // the saplings if(unsafeWindow.forestry_production_products[res["category"]]){ iProd2=unsafeWindow.forestry_production_products[res["category"]][iProd][5]; // the tree }else{ iProd2=null; } if(res["category"]==0){ // garbage if(!tempZoneProductionData[0][1][iProd]){ tempZoneProductionData[0][1][iProd]=0; } tempZoneProductionData[0][1][iProd]++; tempZoneProductionData[1]--; tempZoneProductionData[2]--; }else{ // if(maxCapacity<(prodStock[1][iProd2]+((iStock+1)*prodYield[1][iProd2]))){ // //TODO maybe maxCapacity needed for wood-cuttings // iTime=NEVER; // iWaterTime=NEVER; // if(tempZoneProductionData["block"].length()==1){ // logBubble.add("Max stock capacity reached for<br>"+prodName[1][iProd2],10,"red"); // } if(res["block"]>0){ //production has animal on it tempZoneProductionData[1]--; iTime=NEVER; iWaterTime=NEVER; }else if(res["ready"]){ tempZoneProductionData[1]--; if(res["ready"]==2){ //production busy, "duration" is reduced by watering iTime=parseInt(res["duration"],10)+parseInt(res["createdate"],10); if(zones.getBonus(zoneNrF)>0){ iWaterTime=parseInt(res["waterdate"],10); iWaterTime=((iWaterTime==0)?parseInt(res["createdate"],10):(iWaterTime+86400<iTime?iWaterTime+86400:NEVER)); }else{ iWaterTime=NEVER; } }else if(res["ready"]==1){ //production ready iTime=parseInt(res["duration"],10)+parseInt(res["createdate"],10); iWaterTime=NEVER; }else{ // does this case exist? iTime=NEVER; iWaterTime=NEVER; } }else{ iTime=NEVER; iWaterTime=NEVER; } iAmount=prodYield[1][iProd]; iPoints=iAmount*prodPoints[1][iProd]; if(tempZoneProductionData[0][1][iProd]){ var notfound=true; for(var i=0;i<tempZoneProductionData[0][1][iProd].length;i++){ if((tempZoneProductionData[0][1][iProd][i][2]==iTime)&&(tempZoneProductionData[0][1][iProd][i][3]==iWaterTime)){ tempZoneProductionData[0][1][iProd][i][0]+=iAmount; tempZoneProductionData[0][1][iProd][i][1]+=iPoints; notfound=false;break; } } if(notfound){ tempZoneProductionData[0][1][iProd].push([iAmount,iPoints,iTime,iWaterTime]); } }else{ tempZoneProductionData[0][1][iProd]=[[iAmount,iPoints,iTime,iWaterTime]]; } if(iProd2!=null){ iAmount=prodYield[1][iProd2]; iPoints=iAmount*prodPoints[1][iProd2]; if(tempZoneProductionData[0][1][iProd2]){ var notfound=true; for(var i=0;i<tempZoneProductionData[0][1][iProd2].length;i++){ if((tempZoneProductionData[0][1][iProd2][i][2]==iTime)&&(tempZoneProductionData[0][1][iProd2][i][3]==iWaterTime)){ tempZoneProductionData[0][1][iProd2][i][0]+=iAmount; tempZoneProductionData[0][1][iProd2][i][1]+=iPoints; notfound=false;break; } } if(notfound){ tempZoneProductionData[0][1][iProd2].push([iAmount,iPoints,iTime,iWaterTime]); } }else{ tempZoneProductionData[0][1][iProd2]=[[iAmount,iPoints,iTime,iWaterTime]]; } } } } zones.setProduction(zoneNrF,tempZoneProductionData.clone()); // auto-watering if((top.unsafeData.autoAction==null)&&valAutoWater["forestry"]&&(zones.getWatertime(zoneNrF)<=unsafeWindow.Zeit.Server)&&(zones.getBonus(zoneNrF)>0)&&(zones.getProduction(zoneNrF)[1]==0)&&(div=$("forestry_forest_button1"))){ top.unsafeData.autoAction="berater: forest water"; window.setTimeout(function(div){ click(div); top.unsafeData.autoAction=null; },500,div); } //auto-cropping if((top.unsafeData.autoAction==null)&&valAutoCrop["forestry"]&&(zones.getEndtime(zoneNrF)<=unsafeWindow.Zeit.Server) && (!((div=$("forestry_forest_button2_premium"))&&(div.style.display=="block")))&&(div=$("forestry_forest_button2"))){ top.unsafeData.autoAction="berater: forest crop"; window.setTimeout(function(div){ click(div); top.unsafeData.autoAction=null; },500,div.firstElementChild); } //zonetimer div=$("forestry_forest"); createZoneTimer("zoneTimer_"+zoneNrF,zoneNrF,"zonetimer","position:absolute;top:-20px;right:0;",div); if(zones.getBonus(zoneNrF)>0){ createZoneTimer("zoneTimerWater_"+zoneNrF,zoneNrF,"zoneTimerWater","position:absolute;top:-40px;right:0;",div); } // stock unsafeWindow.forestrySetStockItem(1,Math.max(1,unsafeWindow.forestry_plant),Math.max(1,unsafeWindow.forestry_plant)); for(var v=1;v<=8;v++){ if(div=$("f_stock_item"+v)){ iProd=parseInt(/f_symbol(\d+)/.exec(div.firstElementChild.className)[1],10); if(iProd&&(div=$("f_stock_growing_"+v))){ iTime=calcProductionTime("forest",1,iProd,1-zones.getBonus("forest")/100); div.innerHTML=getTimeStr(iTime,true)+" "+getText("shortHours"); } } } // farmies for(var i=0;i<unsafeWindow.forestry_farmis.length;i++){ // GM_log("unsafeWindow.forestry_farmis["+i+"]:\n"+print_r(unsafeWindow.forestry_farmis[i],"",true,"\n")); iTime=[0,0]; for(var j=0;j<unsafeWindow.forestry_farmis[i]["products"].length;j++){ iProd = unsafeWindow.forestry_farmis[i]["products"][j]["product"]; if(prodTyp[1][iProd]=="f3"){ iTime[0]+=calcProductionTime("sawmill",1,iProd,1-zones.getBonus("sawmill")/100)*unsafeWindow.forestry_farmis[i]["products"][j]["amount"]/prodYield[1][iProd]; } else if(prodTyp[1][iProd]=="f4"){ iTime[1]+=calcProductionTime("carpentry",1,iProd,1-zones.getBonus("carpentry")/100)*unsafeWindow.forestry_farmis[i]["products"][j]["amount"]/prodYield[1][iProd]; } if(typeof prodRequire[1][iProd]=="object"){ for(var k=0;k<prodRequire[1][iProd].length;k++){ iProd2=prodRequire[1][iProd][k]; if(prodTyp[iProd2[0]][iProd2[1]]=="f3"){ iTime[0]+=calcProductionTime("sawmill",iProd2[0],iProd2[1],1-zones.getBonus("sawmill")/100)*unsafeWindow.forestry_farmis[i]["products"][j]["amount"]*iProd2[2]/prodYield[iProd2[0]][iProd2[1]]; } else if(prodTyp[iProd2[0]][iProd2[1]]=="f4"){ iTime[1]+=calcProductionTime("carpentry",iProd2[0],iProd2[1],1-zones.getBonus("carpentry")/100)*unsafeWindow.forestry_farmis[i]["products"][j]["amount"]*iProd2[2]/prodYield[iProd2[0]][iProd2[1]]; } } } } div=$("forestry_farmi_info"+(1+i)); if(div&&div.parentNode){ newDiv=$("forestry_farmi_info"+(i+1)+"_createdate"); if(!newDiv){ newDiv=createElement("div",{"id":"forestry_farmi_info"+(i+1)+"_createdate"}); div.insertBefore(newDiv,div.firstElementChild); } newDiv.innerHTML=getDateStr(unsafeWindow.forestry_farmis[i]["createdate"]); } div=$("forestry_farmi_info_price"+(1+i)); if(div&&div.parentNode){ newDiv=$("forestry_farmi_info"+(i+1)+"_time_sawmill"); if(!newDiv){ newDiv=createElement("div",{"id":"forestry_farmi_info"+(i+1)+"_time_sawmill"}); div.parentNode.parentNode.insertBefore(newDiv,div.parentNode); } newDiv.innerHTML=getText("sawmill")+": "+getTimeStr(iTime[0],true)+" "+getText("shortHours"); newDiv=$("forestry_farmi_info"+(i+1)+"_time_carpentry"); if(!newDiv){ newDiv=createElement("div",{"id":"forestry_farmi_info"+(i+1)+"_time_carpentry"}); div.parentNode.parentNode.insertBefore(newDiv,div.parentNode); } newDiv.innerHTML="("+getText("carpentry")+": "+getTimeStr(iTime[1],true)+" "+getText("shortHours")+")"; newDiv=$("forestry_farmi_info_price"+(i+1)+"_norm"); if(!newDiv){ newDiv=createElement("span",{"id":"forestry_farmi_info_price"+(i+1)+"_norm","style":"font-size:8pt;"},div.parentNode); } newDiv.innerHTML=" ("+moneyFormatInt(unsafeWindow.forestry_farmis[i]["price"]*86400/iTime[0])+"/d)"; } div=$("forestry_farmi_info_points"+(1+i)); if(div&&div.parentNode){ div.innerHTML=numberFormat(unsafeWindow.forestry_farmis[i]["points"]); newDiv=$("forestry_farmi_info_points"+(i+1)+"_norm"); if(!newDiv){ newDiv=createElement("span",{"id":"forestry_farmi_info_points"+(i+1)+"_norm","style":"font-size:8pt;"},div.parentNode); } newDiv.innerHTML=" ("+numberFormat(unsafeWindow.forestry_farmis[i]["points"]*86400/iTime[0])+"/d)"; } } res=null;pos=null;iProd=null;iProd2=null;iTime=null;iWaterTime=null;iStock=null;building=null;maxCapacity=null; }else{ zones.setBlock(zoneNrF,"q"); zones.setBonus(zoneNrF,0); } zoneNrF=null;tempZoneProductionData=null;tempZoneProductionDataSlot=null; calcTotalZones(); err_trace="saving"; publishProductData(); }catch(err){GM_logError("doForestry ("+err_trace+")\n"+err);} } function forestryScrapTreeLog(step,treeId,amount){ // GM_log("forestryScrapTreeLog BEGIN step="+step+" treeId="+treeId); var action=null,listeningEvent=null; switch(step){ case 1: // click the production icon if(amount>0){ logBubble.add("Scrapping Tree Log: tree "+treeId+", left "+amount); listeningEvent="gameOpenGlobalCommitBox"; action=function(){ click($("forestry_slot_products"+(3*treeId-2))); }; } break; case 2: // click OK. sawmill will be reopened listeningEvent="gameSawmillOpened"; action=function(){ click($("globalcommitboxfooter").children[0]); }; break; case 3: // click Abort listeningEvent="gameOpenGlobalCommitBox"; action=function(){ click($("forestry_slot_cancel"+unsafeWindow.currentslot)); }; break; case 4: // click OK. sawmill will be reopened listeningEvent="gameSawmillOpened"; action=function(){ click($("globalcommitboxfooter").children[0]); }; break; case 5: // open production menu again amount--;step=0; listeningEvent="gameSawmillSlotOpened"; action=function(){ click($("forestry_slot"+unsafeWindow.currentslot)); }; break; } if(listeningEvent){ document.addEventListener(listeningEvent,function(listeningEvent,step,treeId,amount){ return function(){ document.removeEventListener(listeningEvent,arguments.callee,false); window.setTimeout(function(){ forestryScrapTreeLog(step+1,treeId,amount); },300); }; }(listeningEvent,step,treeId,amount),false); } if(action){ action(); } listeningEvent=null;action=null; } unsafeOverwriteFunction("forestryBuySlotResponse",function(request,b){ try{ unsafeWindow._forestryBuySlotResponse(request,b); }catch(err){GM_logError("_forestryBuySlotResponse\n"+err);} try{ var result = checkRequest(request); if(result){ if(DEVMODE){ GM_log("forestryBuySlotResponse result:"+implode(result)); } doForestry(); calcProdMinRack(); } }catch(err){GM_logError("forestryBuySlotResponse \n"+err);} }); unsafeOverwriteFunction("initCampaignsResponse",function(request,update){ try{ unsafeWindow._initCampaignsResponse(request,update); }catch(err){GM_logError("_initCampaignsResponse\n"+err);} try{ var result = checkRequest(request); if(result&&result[0]!=0){ if(DEVMODE){ GM_log("initCampaignsResponse"); } // GM_log("initCampaignsResponse result="+implode(result)); //if(DEVMODE){ GM_log("campaign: result:"+print_r(result)); } for(campaign in QUESTS["forestry"]){ if(!QUESTS["forestry"].hasOwnProperty(campaign)){continue;} if(result[1][campaign]){ if(result[1][campaign]==0){ // campaign not available var newforestryQuestNr = 0; if(questData["forestry"][campaign]["nr"]!=newforestryQuestNr){ questData["forestry"][campaign]["nr"]=newforestryQuestNr; if(questData["forestry"][campaign]["calcTo"]!=0){ setCalcToQuest("forestry",campaign,0); } } }else{ // quest available /* GM_log("initCampaignsResponse\ncampaign="+campaign+"\nresult[1][campaign]:\n"+print_r(result[1][campaign],"",true,"\n")); [1]{1}{1}[0]{8} = 300 [1]{1}{1}[0]{6} = 2000 [1]{1}{entries}{1}[0]{productid} = 8 [1]{1}{entries}{1}[0]{sum} = 300 [1]{1}{entries}{1}[0]{type} = 1 [1]{1}{1}[0]{24} = 1800 [1]{1}{1}[1]{21} = 12 [1]{1}{1}[1]{41} = 10 [1]{1}{entries}{1}[0]{productid} = 24 [1]{1}{entries}{1}[0]{sum} = 1800 [1]{1}{entries}{1}[0]{type} = 1 [1]{1}{entries}{2}[0]{productid} = 21 [1]{1}{entries}{2}[0]{sum} = 12 [1]{1}{entries}{2}[0]{type} = 2 [1]{1}{entries}{2}[1]{productid} = 41 [1]{1}{entries}{2}[1]{sum} = 9 [1]{1}{entries}{2}[1]{type} = 2 */ // Time if(result[1][campaign]["remain"]){ questData["forestry"][campaign]["time"] = now+result[1][campaign]["remain"]; }else if(now<questData["forestry"][campaign]["time"]){ questData["forestry"][campaign]["time"] = now; } // Given questData["forestry"][campaign]["given"] = new Object(); if(result[1][campaign]["entries"]){ for(var t in result[1][campaign]["entries"]){ if(!result[1][campaign]["entries"].hasOwnProperty(t)){continue;} for(var i=0;i<result[1][campaign]["entries"][t].length;i++){ var prod = result[1][campaign]["entries"][t][i]["productid"]; var type = parseInt(t,10)-1; if(!questData["forestry"][campaign]["given"][type]){ questData["forestry"][campaign]["given"][type] = new Object(); } if(!questData["forestry"][campaign]["given"][type][prod]){ questData["forestry"][campaign]["given"][type][prod] = 0; } questData["forestry"][campaign]["given"][type][prod] += parseInt(result[1][campaign]["entries"][t][i]["sum"],10); } } } // Number var newforestryQuestNr = parseInt(result[1][campaign]["questid"],10); if((questData["forestry"][campaign]["nr"]!=newforestryQuestNr)||(typeof questData["forestry"][campaign]["nr"]!=typeof newforestryQuestNr)){ questData["forestry"][campaign]["nr"]=newforestryQuestNr; if((0<questData["forestry"][campaign]["calcTo"])&&(questData["forestry"][campaign]["calcTo"]<questData["forestry"][1]["nr"])){ setCalcToQuest("forestry",campaign,questData["forestry"][campaign]["nr"]); } } // Data calcQuestData("forestry",campaign); } }else{ // all quests solved var newforestryQuestNr = QUESTS["forestry"][campaign].length; if(questData["forestry"][campaign]["nr"]!=newforestryQuestNr){ questData["forestry"][campaign]["nr"]=newforestryQuestNr; if(questData["forestry"][campaign]["calcTo"]!=0){ setCalcToQuest("forestry",campaign,0); } } } } handleQuestLine(); GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_questData",implode(questData)); unsafeData.questData=questData.clone(); //GM_log("onclick:"+$('forestry_quest_entry' + forestryCampaignNr + '_' + questData["forestry"][1]["nr"] + '_1_6').onclick); //make prodName[1] && forestry_stock //GM_log("initCampaignsResponse bChanged:"+ bChanged+" prodName:"+implode(prodName)); try{ var store, fId, bChanged=false; prodStock[1]= new Object(); for(store in result[3]){ //forestry_stock if (!result[3].hasOwnProperty(store)){ continue; } for(fId in result[3][store]){ if (!result[3][store].hasOwnProperty(fId)){ continue; } // if (!prodName[1][fId]){ // prodName[1][fId] = result[3][store][fId]["name"]; // set prodName[1] // //GM_log("initCampaignsResponse ADD prodName stock fId:"+fId+" name:"+prodName[1][fId]); // bChanged=true; // } if(!prodStock[1][fId]) prodStock[1][fId]=0; prodStock[1][fId] += parseInt(result[3][store][fId]["amount"],10); } } for(fId in prodName[1]){ if (!prodName[1].hasOwnProperty(fId)){ continue; } if(!prodStock[1][fId]){ prodStock[1][fId]=0; } } store=null;fId=null; // GM_log("initCampaignsResponse bChanged:"+ bChanged+" prodName:"+implode(prodName)); if(bChanged){ // prodName[1].sortObj(); GM_setValueCache(COUNTRY+"_"+SERVER+"_prodName",implode(prodName)); } // prodStock[1].sortObj(); GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodStock",implode(prodStock)); }catch(err){GM_logError("initCampaignsResponse \n"+err);} updateProductDataForestry(); calcProdMinRack(); raiseEvent("gameOpenCampaign"); } }catch(err){GM_logError("initCampaignsResponse\n"+err);} }); // events city 1 ============================================================================== err_trace="events city 1"; unsafeOverwriteFunction("cityActionResponse",function(request,mode,f,e,d,c){ try{ unsafeWindow._cityActionResponse(request,mode,f,e,d,c); }catch(err){GM_logError("_cityActionResponse\nj="+mode+"\n"+err);} try{ var result = checkRequest(request); if((result!=0)&&(result[0]!=0)){ switch(mode){ case "windmillinit": raiseEvent("gameOpenWindmill"); break; case "windmillcrop": raiseEvent("gameWindmillCropped"); break; case "windmillstartproduction": raiseEvent("gameWindmillStarted"); break; } } }catch(err){GM_logError("cityActionResponse\nmode="+mode+"\n"+err);} }); unsafeOverwriteFunction("cityArrived",function(questbox){ try{ unsafeWindow._cityArrived(questbox); }catch(err){GM_logError("_cityArrived\n"+err);} try{ gameLocation=["city",unsafeWindow.city]; unsafeData.gameLocation=gameLocation.clone(); raiseEvent("gameCity"+unsafeWindow.city); }catch(err){GM_logError("cityArrived\n"+err);} }); // unsafeOverwriteFunction("initCity",function(e, c, d){ // try{ // unsafeWindow._initCity(e, c, d); // }catch(err){GM_logError("_initCity\ne="+e+"\nc="+c+"\nd="+d+"\n"+err);} // }); // Werbung unsafeOverwriteFunction("fillAdColumn",function(){ try{ unsafeWindow._fillAdColumn(); }catch(err){GM_logError("_fillAdColumn\n"+err);} try{ var images=$("adzonetooltip1").getElementsByTagName("img"); if(COUNTRY=="SE"){ $("adzonetooltip1").firstElementChild.innerHTML=$("adzonetooltip1").firstElementChild.innerHTML.replace(/\.(\d\d) /,",$1 "); } var preis=parseFloat(/ (.*)/.exec($("adzonetooltip1").firstElementChild.innerHTML)[1].replace(regDelimThou,"").replace(regDelimDeci,"."),10); createElement("div",{},$("adzonetooltip1"),"<img width='12' height='12' src='"+images[0].getAttribute("src")+"'>/<img width='12' height='12' src='"+images[2].getAttribute("src")+"'> "+moneyFormatInt(preis/8)); var preis=gut[0]*parseInt(/ (\d*)/.exec($("adzonetooltip2").firstElementChild.innerHTML)[1],10); createElement("div",{},$("adzonetooltip2"),"<img width='12' height='12' src='"+images[0].getAttribute("src")+"'>/<img width='12' height='12' src='"+images[2].getAttribute("src")+"'> "+moneyFormatInt(preis/16)); $("adzonetooltip2").firstElementChild.innerHTML +=" ("+moneyFormatInt(preis)+")"; var preis=gut[0]*parseInt(/ (\d*)/.exec($("adzonetooltip3").firstElementChild.innerHTML)[1],10); createElement("div",{},$("adzonetooltip3"),"<img width='12' height='12' src='"+images[0].getAttribute("src")+"'>/<img width='12' height='12' src='"+images[2].getAttribute("src")+"'> "+moneyFormatInt(preis/24)); $("adzonetooltip3").firstElementChild.innerHTML +=" ("+moneyFormatInt(preis)+")"; images=null; }catch(err){GM_logError("fillAdColumn\n"+err);} }); // Marktschreier unsafeOverwriteFunction("openMarktschreiberResponse",function(response){ try{ unsafeWindow._openMarktschreiberResponse(response); }catch(err){GM_logError("_openMarktschreiberResponse\n"+err);} try{ var div,container; container=$("marktschreierinnercontent"); for(var v=0;v<container.childElementCount;v++){ if(container.children[v].nodeName=="DIV"){ div=container.children[v].getElementsByTagName("div")[1]; var player=(/\?to=(.*)';/).exec(div.getElementsByTagName("img")[0].getAttribute("onclick"))[1]; stats(player,div); } } div=null;container=null; }catch(err){GM_logError("openMarktschreiberResponse\n"+err);} }); // Competition unsafeOverwriteFunction("setCityWBWContentResponse",function(request){ try{ unsafeWindow._setCityWBWContentResponse(request); }catch(err){GM_logError("_setCityWBWContentResponse\n"+err);} try{ var result=checkRequest(request); if(result){ window.setTimeout(function(result){ if(result[1]['open']==1){ var product=parseInt(result[1]['wettbewerb_produkt'],10); GM_setValue(COUNTRY+"_"+SERVER+"_competition",implode([product,result[1]['wettbewerb_ende']])); }else{ var help=explode(GM_getValue(COUNTRY+"_"+SERVER+"_competition","[]"),"setCityWBWContentResponse/competition",[]); if(help[1]==result[1]["wettbewerb_ende"]){ var product=help[0]; }else{ var product=-1; } } if(product>-1){ $('localwbwproduct').innerHTML='<div class="kp' + product + '" style="position:absolute; width:15px; height:15px;"></div>'; $('localwbwproductname').innerHTML=prodName[0][product]; } cand=document.querySelectorAll("#wbwcontent2ranking>div"); var newdiv,c,sum=0; for(var v=1;v<cand.length;v++){ newdiv=cand[v].getElementsByTagName("div"); igm(newdiv[2].innerHTML.replace(/ .*/,""),newdiv[2]); newdiv[newdiv.length-2].style.textAlign="right"; c=parseInt(newdiv[newdiv.length-2].innerHTML,10); newdiv[newdiv.length-2].innerHTML=numberFormat(c); sum += c; } if(cand.length>1){ cand[1].style.borderBottom="1px solid black"; } if(cand.length>15){ cand[15].style.borderBottom="1px solid black"; } if(cand.length>50){ cand[50].style.borderBottom="1px solid black"; } newdiv=null; $("localwbwproductname").innerHTML += " ("+sign_sum+" "+numberFormat(sum)+")"; if(result[1]['open']!=1){ nextproduct=parseInt(result[1]['wettbewerb_produkt'],10); if(nextproduct>0){ $("localwbwproductname").innerHTML += " (→"+prodName[0][nextproduct]+"?)"; } } },0,result); } }catch(err){GM_logError("setCityWBWContentResponse\n"+err);} }); // events city 2 ============================================================================== err_trace="events city 2"; if(USERLEVEL>=8){ // arrival in city2 err_trace="events city 2: arrival in city2"; document.addEventListener("gameCity2",function(){ try{ createZoneTimer("zoneTimer_windmill","windmill","zonetimer","position:absolute;top:80px;left:0px;",$("cityzone_2_1")); /* //QUESTS["forestry"]["campaign"]["nr"][[type,id,amount],waittime,points,more|undefined] //more: //0,id of type 1 product //1,id of type 2 product //2,special name // Generate QUESTS["forestry"] var cand,camp,qnr,inf,maxi,help,help2, forest_quest=new Array(),foresty_prods_after_quest=new Object(); var cells = $("forestry_questlist_container").querySelectorAll("div[id^=\"forestry_questlist_item\"]"); for(var i=0;i<cells.length;i++){ inf = cells[i].id.replace("forestry_questlist_item","").split("_"); camp = inf[0]; qnr = inf[1]; if (!forest_quest[camp]) forest_quest[camp]= new Array(); if (!forest_quest[camp][qnr]) forest_quest[camp][qnr]= [[],,0,[]]; cand = $("forestry_quest_require"+camp+"_"+qnr); for(var k=0;k<cand.childElementCount;k=k+2){ inf = cand.children[k].id.replace("forestry_quest_entry","").split("_"); maxi = $("forestry_quest_amount_max"+camp+"_"+qnr+"_"+inf[2]+"_"+inf[3]).innerHTML; forest_quest[camp][qnr][0].push([parseInt(inf[2],10)-1,parseInt(inf[3],10),parseInt(maxi,10)]); //$("forestry_tt_"+camp+"_"+qnr+"_"+inf[2]+"_"+inf[3]) } cand = $("forestry_quest_reward"+camp+"_"+qnr); for(var k=1;k<cand.childElementCount;k++){ cand2 = cand.children[k]; if(cand2.childElementCount==1){ forest_quest[camp][qnr][3].push([2,cand2.children[0].innerHTML]); }else if(cand2.childElementCount==3){ if(help = cand2.children[0].className.match(/kp(\d+)/i)){//Not used yet maxi = cand2.children[1].innerHTML.match(/ (\d+)x ([A-z]*)/i); forest_quest[camp][qnr][3].push([0,parseInt(help[1],10),parseInt((maxi&&maxi[1]?maxi[1]:1),10)]); }else if(help = cand2.children[0].className.match(/f_m_symbol(\d+)/i)){ maxi = cand2.children[1].innerHTML.match(/ (\d+)x ([A-z]*)/i); forest_quest[camp][qnr][3].push([1,parseInt(help[1],10),parseInt((maxi&&maxi[1]?maxi[1]:1),10)]); foresty_prods_after_quest[parseInt(help[1],10)]= qnr; }else if(help=cand2.children[1].innerHTML.match(/\ (\d+)\ punten/i)){ forest_quest[camp][qnr][2]=parseInt(help[1],10); }else{ forest_quest[camp][qnr][3].push([2,cand2.children[1].innerHTML]); } } } } cells=null;cand=null;inf=null;help=null;cand2=null; GM_log("forest_quest"+implode(forest_quest)); GM_log("foresty_prods_after_quest"+implode(foresty_prods_after_quest)); */ //make forestry naming /* var cand,camp,qnr,inf,maxi,help,help2,bChanged=false; var cells = $("forestry_questlist_container").querySelectorAll("div[id^=\"forestry_questlist_item\"]"); for(var i=0;i<cells.length;i++){ inf = cells[i].id.replace("forestry_questlist_item","").split("_"); camp = inf[0]; qnr = inf[1]; cand = $("forestry_quest_require"+camp+"_"+qnr); for(var k=0;k<cand.childElementCount;k=k+2){ inf = cand.children[k].id.replace("forestry_quest_entry","").split("_"); if(inf[2]==2){ prodName[1][inf[3]] = $("forestry_tt_"+camp+"_"+qnr+"_"+inf[2]+"_"+inf[3]).innerHTML; // set prodName[1] //GM_log("gameCity2 ADD prodName quest1 fId:"+inf[3]+" name:"+prodName[1][inf[3]]); bChanged=true; } } cand = $("forestry_quest_reward"+camp+"_"+qnr); for(var k=0;k<cand.childElementCount;k=k+2){ inf = cand.children[k].id.replace("forestry_quest_entry","").split("_"); if(inf[2]==2){ prodName[1][inf[3]] = $("forestry_tt_"+camp+"_"+qnr+"_"+inf[2]+"_"+inf[3]).innerHTML; // set prodName[1] //GM_log("gameCity2 ADD prodName quest2 fId:"+inf[3]+" name:"+prodName[1][inf[3]]); bChanged=true; } } cand = $("forestry_quest_reward"+camp+"_"+qnr); for(var k=1;k<cand.childElementCount;k++){ cand2 = cand.children[k]; if(cand2.childElementCount==3){ if(help = cand2.children[0].className.match(/f_m_symbol(\d+)/i)){ maxi = cand2.children[1].innerHTML.match(/ ((\d+)?x?\s?)?(.*)/i); //OLD ((\d+)x\s)?([A-z\s]*)/i); if(maxi[3]){ prodName[1][help[1]] = maxi[3]; // set prodName[1] //GM_log("gameCity2 ADD prodName quest3 fId:"+help[1]+" name:"+prodName[1][help[1]]+" maix:"+implode(maxi)); bChanged=true; } } } } } cells=null;cand=null;inf=null;help=null; //GM_log("gameCity2 bChanged:"+ bChanged+" prodName:"+implode(prodName)); if(bChanged){ prodName[1].sortObj(); GM_setValueCache(COUNTRY+"_"+SERVER+"_prodName",implode(prodName)); } */ }catch(err){GM_logError("city2 \n"+err+"\n"+cand.innerHTML);} },false); // windmill production err_trace="events city 2: windmillSlots"; unsafeOverwriteFunction("windmillSlots",function(){ try{ unsafeWindow._windmillSlots(); }catch(err){ GM_logError("_windmillSlots\n"+err); } try{ var zoneNrF="windmill"; var zoneNrS; zones.setBlock(zoneNrF,""); var tempZoneProductionData,tempZoneProductionDataSlot,iProd,iAmount,iPoints,iTime,currBlock; var iPrTyp=3; tempZoneProductionData=[[],0,0,true]; tempZoneProductionData[0][iPrTyp]={}; for(var slot=1;slot<=2;slot++){ zoneNrS=zoneNrF+"."+slot; currBlock=(((slot==2)&&(unsafeWindow.windmill_slotremain<=0))?"b":""); zones.setBlock(zoneNrS,currBlock); if(!currBlock){ tempZoneProductionDataSlot=[[],0,0,true]; tempZoneProductionDataSlot[0][iPrTyp]={}; if(unsafeWindow.windmill_slots[slot]){ iProd=(unsafeWindow.windmill_slots[slot]["formula"]?parseInt(unsafeWindow.windmill_slots[slot]["formula"],10):null); if(isNaN(iProd)){ iProd=null; } if((iProd!=null)&&(unsafeWindow.windmill_slots[slot]["end"])){ // production ready or busy iTime=parseInt(unsafeWindow.windmill_slots[slot]["end"],10); }else{ // no production iTime=NEVER; tempZoneProductionData[1]++; tempZoneProductionDataSlot[1]++; } // iAmount=(res[slot]["amount"]?res[slot]["amount"]:null); tempZoneProductionData[2]++; tempZoneProductionDataSlot[2]++; if(iProd!=null){ iAmount=prodYield[iPrTyp][iProd]; iPoints=iAmount*prodPoints[iPrTyp][iProd]; if(!tempZoneProductionData[0][iPrTyp][iProd]){ tempZoneProductionData[0][iPrTyp][iProd]=[]; } tempZoneProductionData[0][iPrTyp][iProd].push([iAmount,iPoints,iTime,NEVER]); tempZoneProductionDataSlot[0][iPrTyp][iProd]=[]; tempZoneProductionDataSlot[0][iPrTyp][iProd].push([iAmount,iPoints,iTime,NEVER]); } } zones.setProduction(zoneNrS,tempZoneProductionDataSlot.clone()); } } zones.setProduction(zoneNrF,tempZoneProductionData.clone()); calcTotalZones(); publishProductData(); }catch(err){ GM_logError("windmillSlots\n"+err); } }); // windmill stock err_trace="events city 2: windmillStock"; unsafeOverwriteFunction("windmillStock",function(){ try{ unsafeWindow._windmillStock(); }catch(err){GM_logError("_windmillStock\n"+err);} try{ for(var i=0;i<prodStock[2].length;i++){ prodStock[2][i]=0; } if (unsafeWindow.windmill_stock) { for (var prodId in unsafeWindow.windmill_stock) { prodStock[2][parseInt(prodId,10)]=parseInt(unsafeWindow.windmill_stock[prodId]["amount"],10); } } //updateProductDataWindmill(); unsafeData.prodStock = prodStock.clone(); GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodStock",implode(prodStock,"windmillStock\prodStock")); }catch(err){ GM_logError("windmillStock\n"+err); } }); // windmill dialog err_trace="events city 2: windmillDialog"; unsafeOverwriteFunction("windmillDialog",function(mode,q,a){ try{ unsafeWindow._windmillDialog(mode,q,a) ; }catch(err){ GM_logError("_windmillDialog\n"+err); } try{ switch(mode){ case "windmillstartproduction": { raiseEvent("gameWindmillDialogStart"); break; } case "windmillstartproductioncommit": { var currAmount,currProd; if (unsafeWindow.formulas[0][a] && unsafeWindow.formulas[0][a][3].length) { var m = unsafeWindow.formulas[0][a][3]; for (var b = 0; b < m.length; b++) { currProd= m[b][0]; currAmount= m[b][1]; if(prodStock[0][currProd]-currAmount<prodMinRack[0][currProd]){ createElement("div",{"class":"blackbox alertbox","style":"position:absolute;left:0;top:240px;"},$("windmill_paper_headline"),getText("alertWillLowRack")); break; } } } raiseEvent("gameWindmillDialogCommit"); break; } } }catch(err){GM_logError("windmillDialog\n"+err);} }); // Clothing donation err_trace="events city 2: showClothingDonation"; unsafeOverwriteFunction("showClothingDonation",function(){ try{ unsafeWindow._showClothingDonation() ; }catch(err){GM_logError("_showClothingDonation\n"+err);} try{ var data = unsafeWindow.clothingdonation_data.data.data; var goodsValue = [0,0]; var div; var prodId; // input var container=$("clothingdonation_inner_left_inner"); for (var b in data["in"]) { prodId=parseInt(b,10); div=container.querySelector(".l"+prodId).nextElementSibling; div.parentNode.setAttribute("prod",prodId); div.parentNode.setAttribute("class","link"); div.parentNode.addEventListener("click",function(event){ showMarket(this.getAttribute("prod")); },false); div.parentNode.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.getAttribute("prod")); },false); if(gut[prodId]){ goodsValue[0]+=data["in"][b].amount*gut[prodId]; div.innerHTML+="<br>"+moneyFormatInt(data["in"][b].amount*gut[prodId]); }else{ goodsValue[0]=0; break; } } createElement("div",{"class":"blackbox","style":"position:absolute;top:70px;left:5px;;"},container,goodsValue[0]>0?moneyFormatInt(goodsValue[0]):"---"); // output container=$("clothingdonation_inner_right_inner"); for (var b in data["out"]) { prodId=parseInt(b,10); div=container.querySelector(".l"+prodId).nextElementSibling; div.parentNode.setAttribute("prod",prodId); div.parentNode.setAttribute("class","link"); div.parentNode.addEventListener("click",function(event){ showMarket(this.getAttribute("prod")); },false); div.parentNode.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.getAttribute("prod")); },false); if(gut[prodId]){ goodsValue[1]+=data["out"][b].amount*gut[prodId]; div.innerHTML+="<br>"+moneyFormatInt(data["out"][b].amount*gut[prodId]); }else{ goodsValue[1]=0; break; } } createElement("div",{"class":"blackbox","style":"position:absolute;top:70px;right:5px;;"},container,goodsValue[0]>0?moneyFormatInt(goodsValue[1]):"---"); // Level percent div=$("clothingdonation_level_percentage"); if(!div){ div=createElement("div",{"id":"clothingdonation_level_percentage","class":"blackbox","style":"position:absolute;top:5px;right:100px;;"},$("clothingdonation_levelouter")); } div.innerHTML = numberFormat(unsafeWindow.clothingdonation_data.data.percent)+"%"; div=null; container=null; }catch(err){ GM_logError("showClothingDonation\nprodId="+prodId+"\n"+err); } }); // Recipedealer err_trace="events city 2: Recipedealer"; document.addEventListener("gameUpdateFormuladealerOffers", function(event){ var newdiv,newtable,newtr,newtd; for(var v=1;v<4;v++){ newdiv=$("formuladealerproduct"+v); newdiv.setAttribute("class",""); newdiv=newdiv.getElementsByTagName("div")[0]; var str=newdiv.getAttribute("class"); newdiv.setAttribute("class","link "+str); var formula=parseInt(str.replace("fm",""),10); newdiv=$("formuladealerproduct"+v+"berater"); if(newdiv){ newdiv.innerHTML=""; }else{ newdiv=createElement("div",{"id":"formuladealerproduct"+v+"berater","class":"blackbox","style":"position:absolute;top:70px;"},$("formuladealerproduct"+v)); } var sum=0; newtable=createElement("table",{"cellspacing":"0","style":"text-align:right;"},newdiv); newtr=createElement("tr",{"class":"hoverBgCc9"},newtable); newtr.addEventListener("mouseover",function(event){ toolTip.show(event,getText("price")); },false); createElement("td",{},newtr,"-"); newtd=createElement("td",{},newtr); if(unsafeWindow.formulas[0][formula][6]>0){ newtd.innerHTML=numberFormat(unsafeWindow.formulas[0][formula][6]); sum -= unsafeWindow.formulas[0][formula][6]; }else if(unsafeWindow.formulas[0][formula][7]>0){ newtd.innerHTML=numberFormat(unsafeWindow.formulas[0][formula][7]*gut[0]); sum -= unsafeWindow.formulas[0][formula][7]*gut[0]; } var sum1=0; str='<table>'; str += '<tr><th colspan="4" class="lightBg">'+getText("ingredients")+'</th></tr>'; for(var w=0;w<unsafeWindow.formulas[0][formula][3].length;w++){ sum1 += unsafeWindow.formulas[0][formula][3][w][1]*gut[unsafeWindow.formulas[0][formula][3][w][0]]; str += '<tr><td>'+produktPic(0,unsafeWindow.formulas[0][formula][3][w][0],createElement("div")).parentNode.innerHTML+'</td>'; str += '<td style="text-align:right;">'+numberFormat(unsafeWindow.formulas[0][formula][3][w][1])+' '+sign_mult+'</td>'; str += '<td style="text-align:right;">'+moneyFormat(gut[unsafeWindow.formulas[0][formula][3][w][0]])+' =</td>'; str += '<td style="text-align:right;">'+moneyFormatInt(unsafeWindow.formulas[0][formula][3][w][1]*gut[unsafeWindow.formulas[0][formula][3][w][0]])+'</td></tr>'; } str += '</table>'; newtr=createElement("tr",{"class":"hoverBgCc9","mouseOverText":str},newtable); newtr.addEventListener("mouseover",function(event){ toolTip.show(event,this.getAttribute("mouseOverText")); },false); createElement("td",{},newtr,"-"); createElement("td",{},newtr,numberFormat(sum1)); sum -= sum1; if(unsafeWindow.formulas[0][formula][5][0]!=0){ sum1=unsafeWindow.formulas[0][formula][5][0][1]*gut[unsafeWindow.formulas[0][formula][5][0][0]]; sum += sum1; str='<table>'; str += '<tr><th colspan="3" class="lightBg">'+getText("gain")+'</th></tr>'; str += '<tr><td>'+produktPic(0,unsafeWindow.formulas[0][formula][5][0][0],createElement("div")).parentNode.innerHTML+'</td>'; str += '<td style="text-align:right;">'+numberFormat(unsafeWindow.formulas[0][formula][5][0][1])+' '+sign_mult+'</td>'; str += '<td style="text-align:right;">'+moneyFormat(gut[unsafeWindow.formulas[0][formula][5][0][0]])+'</td>'; str += '</table>'; newtr=createElement("tr",{"class":"hoverBgCc9","mouseOverText":str},newtable); newtr.addEventListener("mouseover",function(event){ toolTip.show(event,this.getAttribute("mouseOverText")); },false); createElement("td",{},newtr,"+"); createElement("td",{},newtr,numberFormat(sum1)); } if(unsafeWindow.formulas[0][formula][5][1]!=0){ var c=0; for(var i=0;i<ALL_ZONES["farm"].length;i++){ var zoneNr=ALL_ZONES["farm"][i]; if((!zones.getBlock(zoneNr))&&(zones.getBuilding(zoneNr)==1)){ c += Math.ceil(calcGrowTimes(60*prodGrowTime[0][unsafeWindow.formulas[0][formula][5][1][0]],unsafeWindow.formulas[0][formula][5][1][2],1-(zones.getBonus(zoneNr)/100)))*BUILDING_SIZE["1"]/prodPlantSize[0][unsafeWindow.formulas[0][formula][5][1][0]]; } } sum1=c*unsafeWindow.formulas[0][formula][5][1][1]*gut[unsafeWindow.formulas[0][formula][5][1][0]]; sum += sum1; str='<table>'; str += '<tr><th colspan="4" class="lightBg">'+getText("gain")+'</th></tr>'; str += '<tr><td>'+produktPic(0,unsafeWindow.formulas[0][formula][5][1][0],createElement("div")).parentNode.innerHTML+'</td>'; str += '<td style="text-align:right;">'+numberFormat(c)+' '+sign_mult+'</td>'; str += '<td style="text-align:right;">'+numberFormat(unsafeWindow.formulas[0][formula][5][1][1])+' '+sign_mult+'</td>'; str += '<td style="text-align:right;">'+moneyFormat(gut[unsafeWindow.formulas[0][formula][5][1][0]])+'</td>'; str += '</table>'; newtr=createElement("tr",{"class":"hoverBgCc9","mouseOverText":str},newtable); newtr.addEventListener("mouseover",function(event){ toolTip.show(event,this.getAttribute("mouseOverText")); },false); createElement("td",{},newtr,"+"); createElement("td",{},newtr,numberFormat(sum1)); } newtr=createElement("tr",{},newtable); createElement("td",{"colspan":"2","style":"border-top:1px solid black;"},newtr,numberFormat(sum)); if(unsafeWindow.formulas[0][formula][5][2]!=0){ var c=0; for(var i=0;i<ALL_ZONES["farm"].length;i++){ var zoneNr=ALL_ZONES["farm"][i]; if((!zones.getBlock(zoneNr))&&(zones.getBuilding(zoneNr)==1)){ c += Math.ceil(calcGrowTimes(60*prodGrowTime[0][unsafeWindow.formulas[0][formula][5][2][0]],unsafeWindow.formulas[0][formula][5][2][2],1-(zones.getBonus(zoneNr)/100)))*BUILDING_SIZE["1"]/prodPlantSize[0][unsafeWindow.formulas[0][formula][5][2][0]]; } } sum1=c*unsafeWindow.formulas[0][formula][5][2][1]; str='<table>'; str += '<tr><th colspan="2" class="lightBg">'+getText("points")+'</th></tr>'; str += '<tr><td style="text-align:right;">'+numberFormat(c)+' '+sign_mult+'</td>'; str += '<td style="text-align:right;">'+pointsFormat(unsafeWindow.formulas[0][formula][5][2][1],"span",createElement("div")).parentNode.innerHTML+'</td>'; str += '</table>'; newtr=createElement("tr",{"class":"hoverBgCc9","mouseOverText":str},newtable); newtr.addEventListener("mouseover",function(event){ toolTip.show(event,this.getAttribute("mouseOverText")); },false); newtd=createElement("td",{"colspan":"2"},newtr); pointsFormat(sum1,"div",newtd); } newtr=createElement("tr",{"class":"hoverBgCc9"},newtable); newtd=createElement("td",{"colspan":"2"},newtr); pointsFormat(unsafeWindow.formulas[0][formula][8],"div",newtd); } // Powerups if(unsafeWindow.poweruprack){ newdiv=$("powerups"); if(newdiv){ newdiv.innerHTML=""; }else{ createElement("div",{id:"powerupsbackground",style:"background-color:black;width:560px;right:0;opacity:0.5;position:absolute;bottom:0;height:80px;"},$("formuladealer")); newdiv=createElement("div",{id:"powerups",style:"height:80px;bottom:0;right:0;position:absolute;vertical-align:top;"},$("formuladealer")); } var newRID; for(var v in unsafeWindow.poweruprack){ if(!unsafeWindow.poweruprack.hasOwnProperty(v)){continue;} aMount=parseInt(unsafeWindow.poweruprack[v]["rack"],10); rId=parseInt(unsafeWindow.poweruprack[v][0],10); newRID=createElement("div",{onmouseout:"$('formuladealerproductinfo').innerHTML=''; hideDiv('formuladealerproductinfo');",onmouseover:"$('formuladealerproductinfo').innerHTML=showFormulaInfos("+rId+"); showDiv('formuladealerproductinfo');",style:"height: 25px; width: 25px; position: relative; margin-top: 7px; float: right; margin-right: 10px;"}); newdiv.insertBefore(newRID, newdiv.firstElementChild); createElement("div", {"class":"fmm"+rId},newRID); createElement("div", {style:"position:absolute;bottom:-2px;right:-2px;font-weight:normal;color:white;"},newRID,aMount); } newRID=null; } newdiv=null;newtable=null;newtr=null;newtd=null; },false); unsafeOverwriteFunction("setFormulaDealerFormulas",function(){ try{ unsafeWindow._setFormulaDealerFormulas(); }catch(err){GM_logError("_setFormulaDealerFormulas\n"+err);} try{ raiseEvent("gameUpdateFormuladealerOffers"); }catch(err){GM_logError("setFormulaDealerFormulas\n"+err);} }); unsafeOverwriteFunction("setFormulaDealerRack",function(rack){ try{ unsafeWindow._setFormulaDealerRack(rack); }catch(err){GM_logError("_setFormulaDealerRack\n"+err);} try{ for(var i=0;i<prodStock[2].length;i++){ prodStock[2][i]=0; } for(var i=0;i<rack.length;i++){ prodStock[2][parseInt(rack[i]["fid"],10)]=parseInt(rack[i]["amount"],10); } unsafeData.prodStock = prodStock.clone(); GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_prodStock",implode(prodStock,"setFormulaDealerRack\prodStock")); raiseEvent("gameUpdateFormuladealerRack"); }catch(err){GM_logError("setFormulaDealerRack\n"+err);} }); // Lottery err_trace="events city 2: Lottery"; // lotteryLog[]=[day,id of daily lot,exchanged products|null|undefined,id's of bought lots|undefined] lotteryLog=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_lotteryLog","[]"),"do_main/lotteryLog",[]); if(!(lotteryLog instanceof Array)){ lotteryLog = []; } function setLotteryLogId(){ lotteryLog.sort(sortObjFunctions["date"]); for(lotteryLogId=lotteryLog.length-1;lotteryLogId>=0;lotteryLogId--){ if(lotteryLog[lotteryLogId][0]==todayServerStr){ return; } } lotteryLog.push([todayServerStr]); setLotteryLogId(); } setLotteryLogId(); if($top("lotterycontainer")){ function showGoToLottery(){ nodes["goToLottery"]=new Object(); nodes["goToLottery"]["node"]=createElement("div",{"id":"divGoToLottery","class":"link blinking","style":"height:70px;width:70px;background:url('"+GFX+"city/city2_back2.jpg') 440px 430px;border:2px solid black;border-radius:35px;margin-bottom:5px;opacity:1;","mouseOverText":getText("goToLottery")},$("fixedDivRight")); nodes["goToLottery"]["node"].addEventListener("mouseover",function(event){ toolTip.show(event,getText("goToLottery")); },false); nodes["goToLottery"]["node"].addEventListener("click",function(event){ showLottery(); },false); raiseEvent("gameLotteryDailyLotAvailable"); } if(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_lotteryLastLot")!=todayStr){ showGoToLottery(); } function hideGoToLottery(){ GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_lotteryLastLot",todayStr); if(nodes["goToLottery"]){ if(nodes["goToLottery"]["node"]){ removeElement(nodes["goToLottery"]["node"]); } delete nodes["goToLottery"]; } } unsafeOverwriteFunction("updateLotRack",function(){ try{ unsafeWindow._updateLotRack(); }catch(err){GM_logError("_updateLotRack\n"+err);} window.setTimeout(function(){ try{ if(unsafeData.lotteryCollectForPrize){ var lotteryCollectForPrize=unsafeData.lotteryCollectForPrize.clone(); }else{ var lotteryCollectForPrize=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_lotteryCollectForPrize", "{}"),"updateLotRack/lotteryCollectForPrize",{}); } if (!lotteryCollectForPrize["total"]){ lotteryCollectForPrize["total"]=new Array(); } var newdiv; var lrack=$("lotsrack"); for(var v=0;v<lrack.childElementCount;v++){ var lotid=lrack.children[v].style.backgroundImage.match(/lot_(\d+).png/i)[1]; if (!lotteryCollectForPrize["total"][lotid]){ lotteryCollectForPrize["total"][lotid]=0; } //if (!$("lotlack"+lotid)){ newdiv=createElement("div",{"id":"lotlack"+lotid,"style":"position:absolute;right:8px;top:5px;font-size:14px;font-weight:bold;color:#fff;padding:2px;"},lrack.children[v]); var help=(unsafeWindow.lotrack[lotid]?unsafeWindow.lotrack[lotid]:0)-lotteryCollectForPrize["total"][lotid]; if(help<=0){ newdiv.innerHTML=help; newdiv.style.backgroundColor="#AA0000"; }else{ newdiv.innerHTML="+"+help; newdiv.style.backgroundColor="green"; } } lrack=null; newdiv=null; }catch(err){GM_log("updateLotRack error:"+err);} },0); }); unsafeOverwriteFunction("updateLotteryPrizes",function(item){ try{ unsafeWindow._updateLotteryPrizes(item); }catch(err){GM_logError("_updateLotteryPrizes\n"+err);} window.setTimeout(function(){ try{ if(unsafeData.lotteryCollectForPrize){ var lotteryCollectForPrize=unsafeData.lotteryCollectForPrize.clone(); }else{ var lotteryCollectForPrize=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_lotteryCollectForPrize", "{}"),"updateLotteryPrizes/lotteryCollectForPrize",{}); } // delete collecting of missing prizes for(var v in lotteryCollectForPrize){ if(!lotteryCollectForPrize.hasOwnProperty(v)){ continue; } if(isNaN(v)){ continue; } if(!unsafeWindow.lotteryprizes[v]){ lotteryCollectForPrize[v]=false; //Calc new totals lotteryCollectForPrize["total"]=new Array(); for(var prizeId in unsafeWindow.lotteryprizes){ if(!unsafeWindow.lotteryprizes.hasOwnProperty(prizeId)){ continue; } if (lotteryCollectForPrize[prizeId]){ for(var v in unsafeWindow.lotteryprizes[prizeId][1]){ if(!unsafeWindow.lotteryprizes[prizeId][1].hasOwnProperty(v)){ continue; } var flid=unsafeWindow.lotteryprizes[prizeId][1][v][0]; if (!lotteryCollectForPrize["total"][flid]) lotteryCollectForPrize["total"][flid]=0; lotteryCollectForPrize["total"][flid] += unsafeWindow.lotteryprizes[prizeId][1][v][1]; flid=null; } v=null; } } } } var divLotteryprizes=$("lotteryprizes"); var cell; for(var v=0;v<divLotteryprizes.childElementCount;v++){ if(!divLotteryprizes.children[v].id.match(/lotteryprize\d+/)){ continue; } var prizeId=parseInt(divLotteryprizes.children[v].id.replace("lotteryprize",""),10); if (lotteryCollectForPrize[prizeId]==undefined){ lotteryCollectForPrize[prizeId]=false; } cell=createElement("input",{"id":"inputLotteryCollectForPrize"+prizeId,"class":"link","type":"checkbox","checked":lotteryCollectForPrize[prizeId],"style":"position:absolute;top:35px;left:10px;"},divLotteryprizes.children[v].firstElementChild); cell.addEventListener("click",function(){ var prizeId=parseInt(this.id.replace("inputLotteryCollectForPrize",""),10); var lotteryCollectForPrize=unsafeData.lotteryCollectForPrize.clone(); lotteryCollectForPrize[prizeId]=this.checked; //Calc new totals lotteryCollectForPrize["total"]=new Array(); for(var prizeId in unsafeWindow.lotteryprizes){ if(!unsafeWindow.lotteryprizes.hasOwnProperty(prizeId)){ continue; } if (lotteryCollectForPrize[prizeId]){ for(var v in unsafeWindow.lotteryprizes[prizeId][1]){ if(!unsafeWindow.lotteryprizes[prizeId][1].hasOwnProperty(v)){ continue; } var flid=unsafeWindow.lotteryprizes[prizeId][1][v][0]; if (!lotteryCollectForPrize["total"][flid]) lotteryCollectForPrize["total"][flid]=0; lotteryCollectForPrize["total"][flid] += unsafeWindow.lotteryprizes[prizeId][1][v][1]; flid=null; } v=null; } } prizeId=null; // lotteryCollectForPrize.sortObj(); GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_lotteryCollectForPrize", implode(lotteryCollectForPrize)); unsafeData.lotteryCollectForPrize=lotteryCollectForPrize.clone(); unsafeWindow.updateLotRack(); },false); // position:absolute; top:0px; left:0px; width:40px; height:40px; // mouseover-div cell=divLotteryprizes.children[v].children[1].firstElementChild; for(var w=0;w<unsafeWindow.lotteryprizes[prizeId][1].length;w++){ var help=(unsafeWindow.lotrack[unsafeWindow.lotteryprizes[prizeId][1][w][0]]?unsafeWindow.lotrack[unsafeWindow.lotteryprizes[prizeId][1][w][0]]:0); // cell.children[w].children[1].innerHTML += "<br>"+help; help=Math.min(100,Math.round(100*help/unsafeWindow.lotteryprizes[prizeId][1][w][1])); createElement("div",{"style":"position:absolute;top:0;left:0;height:5px;width:"+help+"%;background:green;"},cell.children[w]); createElement("div",{"style":"position:absolute;top:0;right:0;height:5px;width:"+(100-help)+"%;background:#c00;"},cell.children[w]); } } divLotteryprizes=null; cell=null; unsafeData.lotteryCollectForPrize=lotteryCollectForPrize.clone(); }catch(err){GM_logError("updateLotteryPrizes\n"+err);} },0); }); unsafeOverwriteFunction("initLotteryResponse",function(response){ try{ unsafeWindow._initLotteryResponse(response); }catch(err){GM_logError("_initLotteryResponse\n"+err);} window.setTimeout(function(response){ try{ // [1(isOk), [...](lotrack), 1(dailyLotTaken), 0(id), {...}(lotteryprizes), 0(won products)] if(response[2]!=0){ hideGoToLottery(); } // Log-Button var button=createElement("button",{"class":"link button_new","style":"position:absolute;bottom:120px;right:30px;"},$("lotterycontainer"),getText("lotteryLog")); button.addEventListener("click",function(){ unsafeWindow.buildInfoPanel("lottery"); },false); button=null; //unsafeWindow.updateLotRack(); raiseEvent("gameLotteryOpen"); }catch(err){GM_log("initLotteryResponse error:"+err);} },0,response); }); unsafeOverwriteFunction("dailyLotResponse",function(response){ try{ unsafeWindow._dailyLotResponse(response); }catch(err){GM_logError("_dailyLotResponse\n"+err);} try{ hideGoToLottery(); if(response[3]){ lotteryLog[lotteryLogId][1]=response[3]; GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_lotteryLog",implode(lotteryLog)); raiseEvent("gameLotteryGotDailyLot"); } }catch(err){GM_logError("dailyLotResponse\n"+err);} }); unsafeOverwriteFunction("showLotDecision",function(lotid){ try{ unsafeWindow._showLotDecision(lotid); }catch(err){GM_logError("_showLotDecision\n"+err);} window.setTimeout(function(lotid){ try{ if(unsafeData.lotteryCollectForPrize){ var lotteryCollectForPrize=unsafeData.lotteryCollectForPrize.clone(); }else{ var lotteryCollectForPrize=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_lotteryCollectForPrize", "{}"),"showLotDecision/lotteryCollectForPrize",{}); } if(!lotteryCollectForPrize["total"]){ lotteryCollectForPrize["total"]=new Array(); } if(!lotteryCollectForPrize["total"][lotid]){ lotteryCollectForPrize["total"][lotid]=0; } var newdiv=createElement("div",{"id":"currentlotAdvise","style":"position:absolute;right:8px;top:5px;font-size:14px;font-weight:bold;color:#fff;padding:2px;"},$("currentlot")); var help=(unsafeWindow.lotrack[lotid]?unsafeWindow.lotrack[lotid]:0)-lotteryCollectForPrize["total"][lotid]; if(help<=0){ newdiv.innerHTML=help; newdiv.style.backgroundColor="#AA0000"; }else{ newdiv.innerHTML="+"+help; newdiv.style.backgroundColor="green"; } newdiv=null; raiseEvent("gameLotteryGotLot"); }catch(err){GM_logError("showLotDecision\n"+err);} },0,lotid); }); unsafeOverwriteFunction("lotGetPrizeResponse",function(response){ try{ unsafeWindow._lotGetPrizeResponse(response); }catch(err){GM_logError("_lotGetPrizeResponse\n"+err);} try{ if(response[5]){ lotteryLog[lotteryLogId][2]=response[5]; GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_lotteryLog",implode(lotteryLog)); raiseEvent("gameLotteryGotPrize"); } }catch(err){GM_logError("lotGetPrizeResponse\n"+err);} }); unsafeOverwriteFunction("buyNewLotResponse",function(response){ try{ unsafeWindow._buyNewLotResponse(response); }catch(err){GM_logError("_buyNewLotResponse\n"+err);} try{ if(response[5]&response[3]){ lotteryLog[lotteryLogId][3].push(response[3]); GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_lotteryLog",implode(lotteryLog)); raiseEvent("gameLotteryGotPrize"); } }catch(err){GM_logError("buyNewLotResponse\n"+err);} }); } // Waltraud err_trace="Donkey Waltraud"; // logDonkey[]=[day,points,[received gifts]] // same pattern as QUESTS logDonkey=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_logDonkey","[]"),"do_main/logDonkey",[]); if(!(logDonkey instanceof Array)){ logDonkey = []; } function showGoToDonkey(){ try{ var showDonkey=true; if(!unsafeWindow.donkey_isset){ showDonkey=false; }else{ for(var i=logDonkey.length-1;i>=0;i--){ if(logDonkey[i][0]==todayServerStr){ showDonkey=false; break; } } } if(showDonkey){ nodes["goToDonkey"]=new Object(); nodes["goToDonkey"]["node"]=createElement("div",{"id":"divGoToDonkey","class":"link blinking","style":"height:70px;width:70px;background:url('"+GFX+"donkey_dialog.gif') 65px -15px / 300%;border:2px solid black;border-radius:35px;margin-bottom:5px;opacity:1;"},$("fixedDivRight")); nodes["goToDonkey"]["node"].addEventListener("mouseover",function(event){ toolTip.show(event,getText("goToDonkey")); },false); nodes["goToDonkey"]["node"].addEventListener("click",function(event){ goToDonkey(); },false); raiseEvent("gameDonkeyAvailable"); } }catch(err){GM_logError("showGoToDonkey\n"+err);} } function hideGoToDonkey(){ try{ if(nodes["goToDonkey"]){ if(nodes["goToDonkey"]["node"]){ removeElement(nodes["goToDonkey"]["node"]); } delete nodes["goToDonkey"]; } }catch(err){GM_logError("hideGoToDonkey\n"+err);} } showGoToDonkey(); unsafeOverwriteFunction("dailyDonkeyResult",function(response){ try{ unsafeWindow._dailyDonkeyResult(response); raiseEvent("gameDonkeyResponse"); }catch(err){GM_logError("_dailyDonkeyResult\n"+err);} try{ if (response[0]!=2) { hideGoToDonkey(); var newElem=[todayServerStr,0,[]]; newElem[1]=response[1]; if(response[7]>0){ newElem[2].push([5,1]); }else if(response[2]>0){ newElem[2].push([1,0,0,1]); }else if(response[4]>0){ newElem[2].push([13,response[4]]); }else if(response[6]>0){ newElem[2].push([12,response[6]]); }else if(response[5]>0){ newElem[2].push([1,0,response[5],1]); }else if(response[3]){ for(pid in response[3]){ if(!response[3].hasOwnProperty(pid)){ continue; } newElem[2].push([1,0,parseInt(pid,10),response[3][pid]]); } } logDonkey.push(newElem); GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_logDonkey",implode(logDonkey)); } }catch(err){GM_logError("dailyDonkeyResult\n"+err);} }); } // on load execute ============================================================================ err_trace="on load execute"; newdiv1=$("buildingmain"); var newdiv2; // TODO! farm is already filled unsafeWindow.farmBuildPositions(); unsafeWindow.farmMove(1); calcFarmiCost(); calcTotalFarmis(); calcProdMinRackInit(); // this calls finally doBuyNotepad, doFarmis //doFarmis(); saveProductData(); if(unsafeWindow.showQuests){ //FastFix2012/01/18 unsafeWindow.showQuests(); //TODO review } if(COUNTRY=="SE"){ $("bar").innerHTML=$("bar").innerHTML.replace(/\.(\d\d) /,",$1 "); } GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_bargeld",$("bar").innerHTML.replace(" "+getText("gamecurrency"),"").replace(regDelimThou,"").replace(regDelimDeci,".")); err_trace="global timer"; if(USERLEVEL>=8){ createZoneTimer("globalZoneTimer_windmill","windmill","zonetimer","position:relative;",$("timeHolder")); } if(unsafeWindow.forestry_unlock!=undefined){ createZoneTimer("globalZoneTimer_forest","forest","zonetimer","position:relative;",$("timeHolder")); if(zones.getBonus("forest")>0){ createZoneTimer("globalZoneTimerWater_forest","forest","zoneTimerWater","position:relative;",$("timeHolder")); } createZoneTimer("globalZoneTimer_sawmill","sawmill","zonetimer","position:relative;",$("timeHolder")); createZoneTimer("globalZoneTimer_carpentry","carpentry","zonetimer","position:relative;",$("timeHolder")); } for(var v=1;v<=4;v++){ createZoneTimer("globalZoneTimer_foodworld-"+v,"foodworld-"+v,"zonetimer","position:relative;",$("timeHolder")); } for(var v=1;v<=6;v++){ createZoneTimer("globalZoneTimer_farmersmarket-"+v,"farmersmarket-"+v,"zonetimer","position:relative;",$("timeHolder")); } // looping ==================================================================================== err_trace="looping"; function loop1(){ if(DEVMODE_FUNCTION){ var trackingHandle = tracking.start("berater","loop1"); } try{ //timeMeasureStart("loop1"); // test session if (unsafeWindow.rid!=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_session","")){ unsafeWindow.initZones(1); } else{ GM_setValue2(COUNTRY+"_"+SERVER+"_sessionlost",false,74); } now=Math.floor((new Date()).getTime()/1000); todayStr=getDateStr(now,2,false); nowServerOff=unsafeWindow.Zeit.Server+valServerTimeOffset; var help=getDateStr(nowServerOff,2,false); if(help!=todayServerStr){ todayServerStr=help; setLevelLogId(); setLotteryLogId(); getDailyRanking(); showGoToLottery(); raiseEvent("gameNewDay"); } // clock nodes["serverTime"]["node"].innerHTML=todayServerStr+" "+getDaytimeStr(nowServerOff); if(valSessionEndtime){ nodes["sessionTimeLeft"]["node"].innerHTML="("+getTimeStr(valSessionEndtime-now)+")"; } if(DEVMODE){ nodes["sessionTimeNow"]["node"].innerHTML="("+getDaytimeStr(now)+")"; } // questline updateQuestLineTimer(); // powerupsymbols for(var v=nodes["containerPowerupSymbols"]["node"].childElementCount-1;v>=0;v--){ help=parseInt(nodes["containerPowerupSymbols"]["node"].children[v].getAttribute("end"),10)-unsafeWindow.Zeit.Server; if(help>0){ nodes["containerPowerupSymbols"]["node"].children[v].lastElementChild.innerHTML=getTimeStr(help); } else{ removeElement(nodes["containerPowerupSymbols"]["node"].children[v]); } } // timers timer.run(); clocks.run(); // slots var readyZoneAdded=0; for(var i in ALL_SLOTS){ if(!ALL_SLOTS.hasOwnProperty(i)){ continue; } if(!zones.getBlock(i)){ readyZoneAdded+=zones.checkReady(i); } } if(readyZoneAdded>0){ raiseEvent("gameZoneReady"); // GM_log("unsafeData.readyZone:\n"+print_r(unsafeData.readyZone,"",true,"\n")); if(DEVMODE){ GM_log("readyZone="+implode(unsafeData.readyZone)); } } if (totalEndtime==-1){ help=getText("cropped").toUpperCase(); }else if(totalEndtime+unsafeWindow.Zeit.Verschiebung<=now){ help=getText("finished").toUpperCase(); }else{ help=getTimeStr(totalEndtime+unsafeWindow.Zeit.Verschiebung-now); } var cell; if((cell=$("mainmenue2_incoming"))&&(cell.style.display=="block")){ help+=" - !"; }else if((cell=$("mainmenue3_incoming"))&&(cell.style.display=="block")){ help+=" - !"; } cell=null; document.title=help+documentTitle; //raising events of other pages var raisedEvents=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_raisedEvents","{}"),"loop1/raisedEvents",{}); for(var v in raisedEvents){ if(!raisedEvents.hasOwnProperty(v)){ continue; } raiseEvent(v); GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_raisedEvents","{}"); } // timeMeasureStop("loop1"); // 4ms }catch(err){ GM_logError("loop1\n"+err); } if(DEVMODE_FUNCTION){ tracking.end("berater",trackingHandle); } } function loop60(){ unsafeWindow.updateMenu(); } window.setInterval(loop1,1000); window.setInterval(loop60,60000); // First run if (GM_getValue("tutorial",0)==0){ click($("mainmenue5")); // Fix Seberoth } newinput=null;newdiv=null;newdiv1=null;newbutton=null;newimg=null; }catch(err){ GM_logError("do_main ("+err_trace+")\n"+err); } } //*********************************************************************************************************** function do_vertraege_head(){ try{ //GM_log("do_vertraege_head"); var candtr=document.getElementsByTagName("table")[0].getElementsByTagName("tr"); for(var v=0;v<candtr[0].childElementCount;v++){ candtr[0].children[v].setAttribute("class","bordered link hoverBgLightbrown"); candtr[0].children[v].firstElementChild.setAttribute("class","link"); } var newtd=createElement("td",{"class":"bordered link hoverBgLightbrown","align":"center"},candtr[0]); var newa=createElement("a",{"style":"font-weight:bold;"},newtd,getText("oldOnes")); newa.addEventListener("click",function(){ window.setTimeout(function(){ GM_setValue(COUNTRY+"_"+SERVER+"_pagedataVertraegeOverview",implode({"contractview":"old"})); if (PAGE=="vertraege/overview"){ do_vertraege_overview(); } else{ location.href="overview.php"; } },0); },false); candtr=null;newtd=null;newa=null; }catch(err){GM_logError("do_vertraege_head\n"+err);} } function do_vertraege_new(){ try{ var err_trace="init"; loadProductData(); var candtable=document.getElementsByTagName("table"); candtable[0].firstElementChild.firstElementChild.firstElementChild.bgColor="lightblue"; var candinput=candtable[1].getElementsByTagName("input"); candtable=null; var newdiv; if (candinput.length>0){ // contract submit page err_trace="contract submit page"; var neuvertrag=new Array(); neuvertrag[3]=new Array(); for(var v=0;v<candinput.length;v++){ if (candinput[v].name=="contract_to"){ neuvertrag[2]=candinput[v].value; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_lastContractTo",candinput[v].value); } else if (candinput[v].name.search("prod")!=-1){ neuvertrag[3][/(\d+)/.exec(candinput[v].name)[1]]=[parseInt(candinput[v].value,10),,]; } else if (candinput[v].name.search("anz")!=-1){ neuvertrag[3][/(\d+)/.exec(candinput[v].name)[1]][1]=parseInt(candinput[v].value,10); } else if (candinput[v].name.search("preis")!=-1){ neuvertrag[3][/(\d+)/.exec(candinput[v].name)[1]][2]=parseFloat(candinput[v].value,10); } } if(neuvertrag[2].toLowerCase()!=USERNAME){ var vertraegeOut=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_vertraegeOut","[]"),"do_vertraege_new/vertraegeOut",[]); var vertraegeOutIndex={}; var valContractLogAmount=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valContractLogAmount",200); neuvertrag[0]=0; neuvertrag[1]= Math.round((new Date()).getTime()/1000); for(var v=0;v<vertraegeOut.length;v++){ if(isNaN(vertraegeOut[v][0])||(vertraegeOutIndex[vertraegeOut[v][0]]>-1)){ vertraegeOut.splice(v,1); v--; }else{ vertraegeOutIndex[vertraegeOut[v][0]]=v; neuvertrag[0]=Math.max(neuvertrag[0],vertraegeOut[v][0]); } } neuvertrag[0]++; vertraegeOut.push(neuvertrag); vertraegeOut.sort(function(a,b){return (a[1]-b[1]);}); vertraegeOut.splice(0,vertraegeOut.length-valContractLogAmount); // shrink on storage amount GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_vertraegeOut",implode(vertraegeOut)); var contractPrices=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_vertraegePreise","[]"),"do_vertraege_new/vertraegePreise",[]); for(var v=0;v<neuvertrag[3].length;v++){ contractPrices[neuvertrag[3][v][0]]=neuvertrag[3][v][2]; } GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_vertraegePreise",implode(contractPrices)); } // multi submit err_trace="multi submit"; var submitButton=document.getElementsByName("confirm_contract")[0]; submitButton.style.display="none"; var newdiv=createElement("div",{"style":"position:absolute;width:300px;height:50px;bottom:135px;left:150px;text-align:center;"},document.getElementsByName("form_confirmcontract")[0].parentNode); var newbutton=createElement("input",{"type":"button","class":"link msg_input","id":"multiSubmit","name":"1","value":submitButton.value},newdiv); newbutton.addEventListener("click",function(){ try{ var submitForm=document.getElementsByName("form_confirmcontract")[0]; var help=submitForm.getElementsByTagName("input"); var str=""; for(var v=0;v<help.length;v++){ str += help[v].getAttribute("name")+"="+help[v].value+"&"; } str=str.slice(0,str.length-1); var c=parseInt(this.getAttribute("name"),10); for(var d=1;d<c;d++){ window.setTimeout(function(d){ GM_xmlhttpRequest({ method: "POST", url: "http://s"+SERVER+"."+GAMEPAGES[COUNTRY]+submitForm.getAttribute("action"), headers: {"Content-type": "application/x-www-form-urlencoded"}, data: str, onload: function(response){ try{ logBubble.add(getText("sentContractNrX").replace(/%1%/,d)); }catch(err){GM_logError("contractMultiSubmit.onload\n"+err);} }, onerror: function(response){ GM_logError("contractMultiSubmit.onerror\n"+response.responseText); }, timeout: function(response){ GM_logError("contractMultiSubmit.timeout\n"+response.responseText); } }); },d*100,d); } window.setTimeout(function(c){ var submitButton=document.getElementsByName("confirm_contract")[0]; click(submitButton); logBubble.add(getText("sentContractNrX").replace(/%1%/,c)); submitButton=null;submitForm=null; },c*100,c); }catch(err){GM_logError("#multiSubmit.click\n"+err);} },false); createElement("div",{},newdiv); newbutton=createElement("input",{"type":"button","class":"link msg_input","value":"-"},newdiv); newbutton.addEventListener("click",function(){ var submitButton=document.getElementsByName("confirm_contract")[0]; var multiSubmitButton=$("multiSubmit"); multiSubmitButton.setAttribute("name",Math.max(1,parseInt(multiSubmitButton.getAttribute("name"),10)-1)); if (multiSubmitButton.getAttribute("name")=="1"){ multiSubmitButton.value=submitButton.value; } else{ multiSubmitButton.value=multiSubmitButton.getAttribute("name")+"x "+submitButton.value; } submitButton=null;multiSubmitButton=null; },false); newbutton=createElement("input",{"type":"button","class":"link msg_input","value":"+"},newdiv); newbutton.addEventListener("click",function(){ var submitButton=document.getElementsByName("confirm_contract")[0]; var multiSubmitButton=$("multiSubmit"); multiSubmitButton.setAttribute("name",parseInt(multiSubmitButton.getAttribute("name"),10)+1); multiSubmitButton.value=multiSubmitButton.getAttribute("name")+"x "+submitButton.value; submitButton=null;multiSubmitButton=null; },false); newdiv=null;newbutton=null;submitButton=null; }else{ // contract edit page err_trace="contract edit page"; var pagedata=explode(GM_getValue(COUNTRY+"_"+SERVER+"_pagedataVertraegeNew","{}"),"do_vertraege_new/pagedataVertraegeNew",{}); GM_setValue(COUNTRY+"_"+SERVER+"_pagedataVertraegeNew","{}"); var candtr=$("addproduct").getElementsByTagName("tr"); var newtr=createElement("tr"); candtr[4].parentNode.insertBefore(newtr,candtr[4]); createElement("td",{},newtr); createElement("td",{},newtr,getText("value")); var newtd=createElement("td",{"align":"left"},newtr); err_trace="contract edit page/addproductWert"; newdiv=createElement("input",{"id":"addproductWert","class":"text msg_input","type":"text","style":"width:100px;"},newtd); newdiv.addEventListener("keyup",function(event){ var preis=parseFloat($("neu_preis").value.replace(regDelimDeci,"."),10); if (preis>0){ $("neu_anzahl").value=Math.floor(0.01+parseFloat(this.value.replace(regDelimThou,"").replace(regDelimDeci,"."),10)/preis); } if (event.keyCode==13){ click($("btn_add_product")); } },false); // newdiv.addEventListener("focus",function(){this.style.border="1px solid #555555";},false); newdiv.addEventListener("blur",function(){ this.value=numberFormat(parseInt($("neu_anzahl").value,10)*parseFloat($("neu_preis").value.replace(regDelimDeci,"."),10),2);this.style.border="1px solid #aaa"; },false); err_trace="contract edit page/neu_anzahl"; if(newdiv=$("neu_anzahl")){ // newdiv.addEventListener("focus",function(){this.style.border="1px solid #555555";},false); newdiv.addEventListener("keyup",function(event){ var anzahl=parseInt(this.value.replace(/\D/g,""),10); $("addproductWert").value=numberFormat(anzahl*parseFloat($("neu_preis").value.replace(regDelimDeci,"."),10),2); this.value=(anzahl>0?anzahl:""); if (event.keyCode==13){ click($("btn_add_product")); } },false); // newdiv.addEventListener("blur",function(){this.style.border="1px solid #aaa";},false); } err_trace="contract edit page/neu_preis"; if(newdiv=$("neu_preis")){ // newdiv.addEventListener("focus",function(){this.style.border="1px solid #555";},false); newdiv.addEventListener("keyup",function(event){ $("addproductWert").value=numberFormat(parseInt($("neu_anzahl").value,10)*parseFloat(this.value.replace(regDelimDeci,"."),10),2); if (event.keyCode==13){ click($("btn_add_product")); } },false); // newdiv.addEventListener("blur",function(){this.style.border="1px solid #aaa";},false); } /* // selected products err_trace="selected products"; for(var v=0;v<=7;v++){ $("delbtn_"+v).addEventListener("mouseover",function(event){ toolTip.show(event,getText("delete")); },false); $("platzhalter_"+v).addEventListener("mouseover",function(event){ var currNr=this.id.replace(/platzhalter_/,""); prod=parseInt($("produkt_"+currNr).value,10); var amount=parseInt($("anzahl_"+currNr).value,10); var price=parseFloat($("preis_"+currNr).value.replace(regDelimDeci,"."),10); var str='<table class="white" cellspacing="0">'; str += '<tr><th colspan="2" class="lightBg">'+prodName[0][prod]+'</td></tr>'; str += '<tr><td style="text-align:right;">'+numberFormat(amount)+' '+sign_mult+'</td><td style="text-align:right;">'+moneyFormat(price)+'</td></tr>'; str += '<tr><td style="text-align:right;">=</td><td style="text-align:right;">'+moneyFormat(amount*price)+'</td></tr>'; str += '</table>'; toolTip.show(event,str); },false); } */ err_trace="currContract"; var currContract=new Object(); createElement("div",{"id":"preis_total","style":"position:absolute;top:215px;left:480px;padding:2px;color:black;background-color:#b8a789;border:1px solid black;border-radius:5px;"},ALL); // Change of the contract //unsafeWindow._buildCart=unsafeWindow.buildCart; unsafeOverwriteFunction("buildCart",function(){ // try{ // unsafeWindow._buildCart(); // }catch(err){ GM_logError("_buildCart\n"+err); } try{ var html = ''; var count = -1; var sum=0,amount,price; var newdiv,newdiv1,newdiv2; currContract=new Object(); newdiv=$("contract_cart"); newdiv.innerHTML = ""; for(var prod in unsafeWindow.cart){ if(!unsafeWindow.cart.hasOwnProperty(prod)){ continue; } amount=parseInt(unsafeWindow.cart[prod]["anzahl_neu"],10); price=parseFloat(unsafeWindow.cart[prod]["preis_neu"].replace(regDelimDeci,"."),10); currContract[prod]=[amount,price]; sum += amount*price; count++; newdiv1=createElement("div",{"prod":prod,"style":"position:relative;float:left;margin:0 0 5px 5px;"},newdiv); newdiv2=createElement("div",{"onclick":"addItem("+prod+")","class":"v"+prod+" link"},newdiv1); newdiv2.addEventListener("mouseover",function(event){ var prod=this.parentNode.getAttribute("prod"); var amount=currContract[prod][0]; var price=currContract[prod][1]; var str='<table cellspacing="0">'; str += '<tr><th colspan="2" class="lightBg">'+prodName[0][prod]+'</td></tr>'; str += '<tr><td style="text-align:right;">'+numberFormat(amount)+' '+sign_mult+'</td><td style="text-align:right;">'+moneyFormat(price)+'</td></tr>'; str += '<tr><td style="text-align:right;">=</td><td style="text-align:right;">'+moneyFormat(amount*price)+'</td></tr>'; str += '</table>'; toolTip.show(event,str); },false); newdiv2=createElement("div",{"class":"link","onclick":"removeItem("+prod+")","style":"background:url(http://mff.wavecdn.de/mff/popin/contracts/delete.gif);width:11px; height:11px; position:absolute; top:-2px; right:-2px;"},newdiv1); newdiv2.addEventListener("mouseover",function(event){ toolTip.show(event,getText("delete")); },false); newdiv2=createElement("input",{"type":"hidden","name":"prod["+count+"]","id":"produkt_"+count,"value":prod},newdiv1); newdiv2=createElement("input",{"type":"hidden","name":"anz["+count+"]","id":"anzahl_"+count,"value":unsafeWindow.cart[prod].anzahl_neu},newdiv1); newdiv2=createElement("input",{"type":"hidden","name":"preis["+count+"]","id":"preis_"+count,"value":unsafeWindow.cart[prod].preis_neu},newdiv1); } createElement("div",{"style":"clear:both;"},newdiv); $("preis_total").innerHTML=getText("total")+":<br>"+moneyFormat(sum); newdiv=null;newdiv1=null;newdiv2=null; }catch(err){GM_logError("buildCart\n"+err);} }); unsafeWindow.buildCart(); // Filling data err_trace="Filling data"; unsafeWindow.fillContract = function(player,data){ try{ // player: string or null // data: {prod:[amount,single-price],...} // set receiver if(player){ $("to_player").value=player; } // clear data unsafeWindow.cart = new Object(); // fill data for(var v in data){ if(!data.hasOwnProperty(v)){ continue; } if(prodStock[0][v]>0){ unsafeWindow.cart[v] = new Object(); unsafeWindow.cart[v]["anzahl_neu"]=numberFormat(Math.min(prodStock[0][v],data[v][0]),0,".",""); unsafeWindow.cart[v]["preis_neu"]=numberFormat(data[v][1],2,".",""); } } // call displaying unsafeWindow.buildCart(); }catch(err){ GM_logError("fillContract\n"+err); } }; newdiv=$("to_player"); if (newdiv){ if(pagedata["to"]){ newdiv.value=pagedata["to"]; }else if(newdiv.value==""){ newdiv.value=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_lastContractTo",""); } } if(pagedata["fillContract"]){ unsafeWindow.fillContract(null,pagedata["fillContract"]); } // last message panel err_trace="last message panel"; newdiv=createElement("div",{"id":"lastMessage","style":"position:absolute;top:110px;right:-403px;width:413px;height:134px;padding:5px;background-color:#b8a789;border:2px solid black;border-radius:10px 0px 0px 10px;z-index:101;z-index:15;color:black;overflow:auto;"},ALL,GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_nachrichten_letzte","")); newdiv.addEventListener("mouseover",function(){this.style.right="0";},false); newdiv.addEventListener("mouseout",function(){this.style.right="-403px";},false); // set remembered price err_trace="set remembered price"; unsafeOverwriteFunction("addItem",function(pid){ try{ unsafeWindow._addItem(pid); }catch(err){ GM_logError("_addItem\npid="+pid+"\n"+err); } try{ window.setTimeout(function(){ var contractPrices=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_vertraegePreise","[]"),"do_vertraege_new/addproduct/vertraegePreise",[]); var cell=$("neu_preis"); if(cell&&(cell.value=="0")){ var new_produkt=parseInt(unsafeWindow.addboxid,10); if(contractPrices[new_produkt]){ cell.value=numberFormat(contractPrices[new_produkt],2,delimDeci,""); keyup(cell); }else if(gut[new_produkt]){ cell.value=numberFormat(gut[new_produkt],2,delimDeci,""); keyup(cell); }else if(!isNaN(NPC[0][new_produkt])){ cell.value=numberFormat(NPC[0][new_produkt],2,delimDeci,""); keyup(cell); } } cell=null; },0); }catch(err){GM_logError("addItem\npid="+pid+"\n"+err);} }); // save contract, [target user,{"prod":[amount,price],...}] err_trace="save contract"; var contractSave=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_contractSave","[]"),"do_vertraege_new/contractSave",[]); var top=345; var right=120; for(var v=0;v<10;v++){ right -= 20; if(right<=0){ top += 20; right=100; } newdiv=createElement("div",{"id":"contractSave"+v,"class":"link hoverBgLightblue","style":"position:absolute;top:"+top+"px;right:"+right+"px;width:13px;padding:1px;color:black;text-align:center;border:2px inset black;border-radius:10px;"+(contractSave[v]?"background-color:#bb7;":"")},ALL,v+1); newdiv.addEventListener("mouseover",function(event){ try{ var contractSave=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_contractSave","[]"),"do_vertraege_new/contractSave/mouseover",[]); var currNr=parseInt(this.id.replace(/contractSave/,""),10); var str='<table cellspacing="0" cellpadding="0" style="width:100%;">'; if(contractSave[currNr]){ str += '<tr><td>'+getText("click")+': </td><td>'+getText("load")+'</td></tr>'; } str += '<tr><td style="border-bottom:1px solid black;">'+getText("clickCtrl")+': </td><td style="border-bottom:1px solid black;">'+getText("save")+'</td></tr>'; str += '</table><table cellspacing="0" cellpadding="0" style="line-height:15px;width:100%;">'; if(contractSave[currNr]){ if(contractSave[currNr][0]!=""){ str += '<tr><td colspan="3">→ '+contractSave[currNr][0]+'</td></tr>'; } for(var v in contractSave[currNr][1]){ if(!contractSave[currNr][1].hasOwnProperty(v)){ continue; } str += '<tr><td style="text-align:right;padding-right:3px;">'+numberFormat(contractSave[currNr][1][v][0])+'</td><td style="padding-right:3px;">'+produktPic(0,v,createElement("div")).parentNode.innerHTML+prodName[0][v]+'</td><td style="text-align:right;">'+moneyFormat(contractSave[currNr][1][v][1])+'</td></tr>'; } }else{ str += '<tr><td colspan="3">---</td></tr>'; } str += '</table>'; toolTip.show(event,str); }catch(err){ GM_logError("contractSave.mouseover\n"+err); } },false); newdiv.addEventListener("click",function(event){ try{ var contractSave=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_contractSave","[]"),"do_vertraege_new/contractSave/click",[]); var currNr=parseInt(this.id.replace(/contractSave/,""),10); if(event.ctrlKey){ // save this contract contractSave[currNr]=[$("to_player").value,currContract]; if((contractSave[currNr][0]=="")&&(contractSave[currNr][1].isEmpty())){ delete contractSave[currNr]; this.style.backgroundColor=""; }else{ this.style.backgroundColor="#bb7"; } GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_contractSave",implode(contractSave)); toolTip.adjust(this); }else{ // load contract if(contractSave[currNr]){ unsafeWindow.fillContract(contractSave[currNr][0]==""?null:contractSave[currNr][0],contractSave[currNr][1]); } } }catch(err){ GM_logError("contractSave.click\n"+err); } },false); } newtr=null;newtd=null;candtr=null;candinput=null; raiseEventTop("gameWindowContractNew"); } newdiv=null; }catch(err){ GM_logError("do_vertraege_new ("+err_trace+")\n"+err); } } function buildAlteVertraege(mode){ try{ //GM_log("buildAlteVertraege:"+mode); loadProductData(); var vertraege; if (mode=="In"){ vertraege=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_vertraegeIn","[]"),"do_vertraege_overview/vertraegeIn",[]); } else{ vertraege=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_vertraegeOut","[]"),"do_vertraege_overview/vertraegeOut",[]); } var container=document.getElementsByTagName("table")[1].parentNode; container.innerHTML=""; container.setAttribute("mode",mode); var newtable=createElement("table",{"style":"width:100%;margin-bottom:3px;"},container); var newtr=createElement("tr",{},newtable); var newtd=createElement("td",{"class":"link tnormal hoverBgLightbrown","align":"center","style":"color:black;font-weight:bold;"},newtr,getText("contractsReceived")); if (mode=="In"){ newtd.bgColor="lightblue"; } newtd.addEventListener("click",function(){buildAlteVertraege("In");},false); newtd=createElement("td",{"class":"link tnormal hoverBgLightbrown","align":"center","style":"color:black;font-weight:bold;"},newtr,getText("contractsSent")); if (mode=="Out"){ newtd.bgColor="lightblue"; } newtd.addEventListener("click",function(){buildAlteVertraege("Out");},false); newdiv=createElement("div",{"style":"width:100%;height:280px;overflow-x:hidden;overflow-y:scroll;"},container); newtable=createElement("table",{"style":"width:100%;","cellspacing":"0"},newdiv); var newtablehead=createElement("thead",{},newtable); var newtablebody=createElement("tbody",{"class":"hoverRowBgLightbrown","style":"height:290px;overflow-x:hidden;overflow-y:scroll;"},newtable); var newtd1,newtd2,newimg; var help; var sendContractAgain=((mode=="Out")&&($top("multiframe"))); for(var v=vertraege.length-1;v>=0;v--){ newtr=createElement("tr",{},newtablebody); newtd=createElement("td",{},newtr); if(sendContractAgain&&(typeof vertraege[v][3]=="object")){ newtd.setAttribute("class","link borderTop"); help=new Object(); help["to"]=vertraege[v][2]; help["fillContract"]=new Object(); for(var w=0;w<vertraege[v][3].length;w++){ help["fillContract"][vertraege[v][3][w][0]]=[vertraege[v][3][w][1],vertraege[v][3][w][2]]; } newtd.setAttribute("data",implode(help)); newtd.addEventListener("mouseover",function(event){ toolTip.show(event,getText("sendContractAgain")); },false); newtd.addEventListener("click",function(){ GM_setValue(COUNTRY+"_"+SERVER+"_pagedataVertraegeNew",this.getAttribute("data")); location.href="http://s"+SERVER+"."+GAMEPAGES[COUNTRY]+"/vertraege/new.php"; },false); }else{ newtd.setAttribute("class","borderTop"); } if (vertraege[v][1]>0){ newtd.innerHTML=getFormattedDateStr(vertraege[v][1])+",<br>"+getDaytimeStr(vertraege[v][1],1)+" "+getText("shortOClock"); }else{ newtd.innerHTML="---"; } newtd=createElement("td",{"class":"borderTop"},newtr,vertraege[v][2]); newdiv=createElement("div",{},newtd); igm(vertraege[v][2],newdiv); stats(vertraege[v][2],newdiv); vertrag(vertraege[v][2],newdiv); newtd=createElement("td",{"class":"borderTop"},newtr); newtd1=createElement("td",{"class":"borderTop","style":"text-align:right;"},newtr); newtd2=createElement("td",{"class":"borderTop","style":"text-align:right;"},newtr); if(typeof vertraege[v][3]=="object"){ var sum=0; for(var w=0;w<vertraege[v][3].length;w++){ newdiv=createElement("div",{"class":"link hoverBgLightblue","style":"line-height:16px;white-space:nowrap;","prod":vertraege[v][3][w][0]},newtd); newdiv.addEventListener("mouseover",function(event){ showGoToMarketToolTip(event,this.getAttribute("prod")); },false); newdiv.addEventListener("click",function(){showMarket(this.getAttribute("prod"));},false); produktPic(0,vertraege[v][3][w][0],newdiv); createElement("span",{},newdiv,numberFormat(vertraege[v][3][w][1],0) +" "+ prodName[0][vertraege[v][3][w][0]]); createElement("div",{"style":"line-height:16px;white-space:nowrap;"},newtd1,moneyFormat(vertraege[v][3][w][2])); createElement("div",{"style":"line-height:16px;white-space:nowrap;"},newtd2,moneyFormatInt(vertraege[v][3][w][1]*vertraege[v][3][w][2])); sum += vertraege[v][3][w][1]*vertraege[v][3][w][2]; } if (vertraege[v][3].length>1){ createElement("div",{},newtd," "); createElement("div",{},newtd1," "); createElement("div",{"style":"border-top:1px solid black;text-align:right;"},newtd2,moneyFormatInt(sum)); } }else{ createElement("div",{"style":"line-height:16px;white-space:nowrap;"},newtd2,moneyFormatInt(vertraege[v][3])); } newtd=createElement("td",{"class":"borderTop","style":"text-align:right;padding-right:20px;"},newtr); newimg=createElement("img",{"objId":vertraege[v][0],"src":GFX+"popin/contracts/anullieren.gif","class":"link2","style":"width:16px;height:16px;"},newtd); newimg.addEventListener("mouseover",function(event){ toolTip.show(event,getText("delete")); },false); newimg.addEventListener("click",function(){ var objId=this.getAttribute("objId"); var mode=this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getAttribute("mode"); alert2(getText("delete")+"?",getText("yes"),getText("no"),function(){ return function(mode){ if (mode=="In"){ var vertraegeIn=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_vertraegeIn","[]"),"do_vertraege_overview/vertraegeIn",[]); for(var v=vertraegeIn.length-1;v>=0;v--){ if(vertraegeIn[v][0]==objId){ break; } } if(v>=0){ vertraegeIn.splice(v,1); GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_vertraegeIn",implode(vertraegeIn)); } }else{ var vertraegeOut=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_vertraegeOut","[]"),"do_vertraege_overview/vertraegeOut",[]); for(var v=vertraegeOut.length-1;v>=0;v--){ if(vertraegeOut[v][0]==objId){ break; } } if(v>=0){ vertraegeOut.splice(v,1); GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_vertraegeOut",implode(vertraegeOut)); } } buildAlteVertraege(mode); }(mode)}); },false); } container=null;newtable=null;newtablehead=null;newtablebody=null;newtr=null;newtd=null;newtd1=null;newtd2=null;newimg=null;newdiv=null; }catch(err){GM_logError("buildAlteVertraege\nv="+v+"\n"+err);} } function do_vertraege_overview(){ try{ //GM_log("do_vertraege_overview"); var pagedata=explode(GM_getValue(COUNTRY+"_"+SERVER+"_pagedataVertraegeOverview","{}"),"do_vertraege_overview/pagedataVertraegeOverview",{}); GM_setValue(COUNTRY+"_"+SERVER+"_pagedataVertraegeOverview","{}"); var candtable=document.getElementsByTagName("table"); candtable[1].parentNode.style.height="310px"; var candtd=candtable[0].getElementsByTagName("td"); if (pagedata["contractview"]){ candtd[1].bgColor=""; candtd[2].bgColor="lightblue"; buildAlteVertraege("In"); }else{ loadProductData(); candtd[1].bgColor="lightblue"; var candtr=candtable[1].getElementsByTagName("tr"); var canda,user,newContract; var sumTotalOut=0; var valContractLogAmount=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valContractLogAmount",200); // vertraegeX[id]=[time,person,[[prod,amount,single price],...]] var vertraegeIn=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_vertraegeIn","[]"),"do_vertraege_overview/vertraegeIn",[]); var vertraegeInIndex={}; for(var v=0;v<vertraegeIn.length;v++){ if(isNaN(vertraegeIn[v][0])||(vertraegeInIndex[vertraegeIn[v][0]]>-1)){ vertraegeIn.splice(v,1); v--; }else{ vertraegeInIndex[vertraegeIn[v][0]]=v; } } for(var v=0;v<candtr.length;v++){ candtd=candtr[v].getElementsByTagName("td"); canda=candtr[v].getElementsByTagName("a"); if (canda[0]){ var help=/'(\d+)',%20'(.*?)'%20/.exec(canda[0].href); if (help[2] == "in"){ if(COUNTRY=="SE"){ candtd[3].innerHTML=candtd[3].innerHTML.replace(/\.(\d\d)&/,",$1&"); } if (vertraegeInIndex[help[1]]>-1){ vertraegeIn[vertraegeInIndex[help[1]]][1]=getFormattedTime(candtd[0].innerHTML); }else{ user=/(.*?) /.exec(candtd[2].innerHTML+" ")[1]; if(user.toLowerCase()!=USERNAME){ newContract=new Array(); newContract[0]=parseInt(help[1],10); newContract[1]=getFormattedTime(candtd[0].innerHTML); newContract[2]=user; var help2=candtd[1].firstElementChild.innerHTML.replace(' style=""',"").replace("<b>","").replace("</b>",""); var preis=parseFloat(candtd[3].innerHTML.replace(/ /g+getText("gamecurrency"),"").replace(regDelimThou,"").replace(regDelimDeci,"."),10); if (help2.search(",")==-1){ var help3=help2.split(" x "); newContract[3]=[[prodId[0][help3[1]],parseInt(help3[0],10),preis/parseInt(help3[0],10)]]; }else{ newContract[3]=preis; } vertraegeIn.push(newContract); vertraegeInIndex[newContract[0]]=vertraegeIn.length-1; } } }else if(help[2] == "out"){ if(COUNTRY=="SE"){ candtd[3].innerHTML=candtd[3].innerHTML.replace(/\.(\d\d)&/,",$1&"); } sumTotalOut += parseFloat(candtd[3].innerHTML.replace(regDelimThou,"").replace(regDelimDeci),10); } } } createElement("td",{"colspan":"3"},candtable[1]); createElement("td",{"style":"border-top:1px solid black;text-align:right;"},candtable[1],moneyFormatInt(sumTotalOut)); vertraegeIn.sort(function(a,b){return (a[1]-b[1]);}); vertraegeIn.splice(0,vertraegeIn.length-valContractLogAmount); // shrink on storage amount GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_vertraegeIn",implode(vertraegeIn)); candtr=null;canda=null; } candtable=null;candtd=null; }catch(err){GM_logError("do_vertraege_overview\n"+err);} } function do_vertraege_show(){ try{ var spanError=ALL.getElementsByClassName("error"); if (spanError.length>0){ spanError[0].parentNode.style.height="25px"; spanError[0].parentNode.style.top="262px"; } spanError=null; loadProductData(); var vertraegeIn=false,vertraegeInId; var candtable=document.getElementsByTagName("table"); var candtr=candtable[1].getElementsByTagName("tr"); var candtd; candtable[1].previousElementSibling.appendChild(candtable[1]); candtable[1].setAttribute("style","height:250px;margin-left:auto;margin-right:auto;"); //centering the table removeElement(candtable[1].getElementsByTagName("colgroup")[0]); candtable[1].firstElementChild.insertBefore(createElement("tr",{"style":"height: 20px;"}),candtable[1].firstElementChild.firstElementChild); createElement("td",{"colspan":"3","style":"border-top:1px solid #aaa;padding-right:5px;padding-left:5px;"},candtr[0]); createElement("td",{"colspan":"2","style":"border-top:1px solid #aaa;border-left:1px dashed black;padding-right:5px;padding-left:5px;"},candtr[0],getText("price")); createElement("td",{"style":"border-top:1px solid #aaa;border-left:1px dashed black;padding-right:5px;padding-left:5px;"},candtr[0]); createElement("td",{"colspan":"2","style":"border-top:1px solid #aaa;border-left:1px dashed black;padding-right:5px;padding-left:5px;"},candtr[0],getText("marketPrice")); if (pageZusatz["typ"]=="in"){ vertraegeIn=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_vertraegeIn","[]"),"do_vertraege_show/vertraegeIn",[]); for(vertraegeInId=vertraegeIn.length-1;vertraegeInId>=0;vertraegeInId--){ if(vertraegeIn[vertraegeInId][0]==pageZusatz["v"]){ break; } } if(vertraegeInId==-1){ vertraegeInId=(vertraegeIn.push([]))-1; vertraegeIn[vertraegeInId][0]=pageZusatz["v"]; vertraegeIn[vertraegeInId][1]=now; vertraegeIn[vertraegeInId][2]=/\s*(.*) /.exec(candtable[1].parentNode.innerHTML)[1]; } vertraegeIn[vertraegeInId][3]=new Array(); } var sum=0; var borderStr; for(var w=1;w<candtr.length-2;w++){ candtr[w].setAttribute("class","hoverBgLightbrown"); candtd=candtr[w].getElementsByTagName("td"); if(COUNTRY=="SE"){ candtd[4].innerHTML=candtd[4].innerHTML.replace(/\.(\d\d)\&/,",$1&"); } var thisData=[prodId[0][candtd[2].innerHTML],parseInt(candtd[0].innerHTML,10),parseFloat(candtd[4].innerHTML.replace(regDelimThou,"").replace(regDelimDeci,"."),10)]; if(vertraegeIn){ vertraegeIn[vertraegeInId][3].push(thisData); } borderStr="border-bottom:"+candtd[0].style.borderBottom+";border-top:"+candtd[0].style.borderTop+";"; candtd[0].innerHTML=numberFormat(thisData[1]); candtd[0].style.paddingRight="5px"; candtd[1].innerHTML=""; produktPic(0,thisData[0],candtd[1]); removeElement(candtd[3]); candtd[2].style.paddingRight="5px"; candtd[3].style.borderLeft="1px dashed black"; candtd[3].style.paddingLeft="5px"; candtd[3].style.paddingRight="5px"; candtd[3].innerHTML=numberFormat(thisData[2],2)+" :"; createElement("td",{"style":borderStr+"padding-right:5px;padding-left:5px;text-align:right;"},candtr[w],numberFormat(thisData[1]*thisData[2],2)); createElement("td",{"style":borderStr+"border-left:1px dashed black;padding-right:5px;padding-left:5px;text-align:right;"},candtr[w],numberFormat(100*thisData[2]/gut[thisData[0]],1)+"%"); createElement("td",{"style":borderStr+"border-left:1px dashed black;padding-right:5px;padding-left:5px;text-align:right;"},candtr[w],numberFormat(gut[thisData[0]],2)+" :"); var help=thisData[1]*gut[thisData[0]]; createElement("td",{"style":borderStr+"padding-right:5px;padding-left:5px;text-align:right;"},candtr[w],numberFormat(help,2)); sum += help; } candtd=candtr[candtr.length-2].getElementsByTagName("td"); //removeElement(candtd[0]); candtd[0].style.paddingRight="5px"; candtd[0].align="left"; var preis=parseFloat(candtd[1].firstElementChild.innerHTML.replace(regDelimThou,"").replace(regDelimDeci,"."),10); candtd[1].firstElementChild.innerHTML=numberFormat(preis,2); candtd[1].style.paddingRight="5px"; createElement("td",{"style":"border-left:1px dashed black;padding-right:5px;padding-left:5px;text-align:right;"},candtr[w],numberFormat(100*preis/sum,1)+"%"); createElement("td",{"style":"border-left:1px dashed black;padding-right:5px;padding-left:5px;text-align:right;","colspan":"2"},candtr[w],numberFormat(sum,2)); if(vertraegeIn){ vertraegeIn.sort(function(a,b){return (a[1]-b[1]);}); GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_vertraegeIn",implode(vertraegeIn)); } candtable=null;canddiv=null;candtr=null;candtd=null; }catch(err){GM_logError("do_vertraege_show\n"+err);} } //*********************************************************************************************************** function do_hilfe(){ var canddiv=new Array(); for(var v=0;v<ALL.childElementCount;v++){ if(ALL.children[v].id=="") canddiv.push(ALL.children[v]); } canddiv[1].id="helpmenu"; canddiv[1].style.left="0"; canddiv[1].style.width="155px"; canddiv[1].style.overflowX="hidden"; canddiv[1].style.overflowY="auto"; canddiv[2].id="helpbody"; canddiv=$("helpmenu").getElementsByTagName("div"); for(var v=0;v<canddiv.length;v++){ if(canddiv[v].getAttribute("class")=="list_header"){ break; }} var newdiv=createElement("div",{"id":"helpmenuLinks","style":"margin-bottom:10px;"}); $("helpmenu").insertBefore(newdiv,canddiv[v]); newdiv=createElement("div",{},newdiv); var newa=createElement("a",{"class":"list_header","href":"#"},newdiv,getText("adviser")); newa.addEventListener("click",function(){ try{ var div,help,i=0; var container=$("helpbody"); container.innerHTML=""; div=createElement("div",{"class":"tnormal"},container); createElement("b",{},div,getText("adviser")); while(help=getText("help_"+(i++))){ div=createElement("div",{"class":"tmenu"},container); if(help[0]){ createElement("b",{},div,help[0]); } if(help[1]){ createElement("p",{},div,help[1]); } } container=null;div=null; }catch(err){GM_logError("help.click\n"+err);} },false); if (GM_getValue("tutorial",0)==0){ click(newa); GM_setValue("tutorial",1); } switch(pageZusatz["item"]){ case "18":{ // Questlist loadProductData(); top.unsafeData.questData=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_questData"),"help/questData",INIT_questData); var nodes = {}; nodes["helpbody"]=$("helpbody"); nodes["questinfos_select"]=createElement("select",{"id":"questinfos_select","class":"link"},nodes["helpbody"].children[0]); nodes["questinfos_select"].addEventListener("click",function(){ for(var v=0;v<this.childElementCount;v++){ if(this.children[v].value==this.value){ $("questinfos_"+this.children[v].value).style.display="block"; do_hilfe_questlist(this.children[v].value); }else{ $("questinfos_"+this.children[v].value).style.display="none"; } } },false); nodes["questinfos"]=$("questinfos"); removeElement(nodes["questinfos"].children[nodes["questinfos"].childElementCount-1]); /* var normal_quest=new Array(); var cand, canddiv, qnr=0, prodId, amount; for(var v=0;v<$("questinfos").childElementCount;v++){ try{ cand = $("questinfos").children[v]; if(cand.childElementCount<2){ GM_log("Questlist: "+implode(normal_quest)); normal_quest=new Array(); continue; } qnr = parseInt(cand.children[0].innerHTML.replace(".",""),10); if(!normal_quest[qnr]){ normal_quest[qnr]= new Array(); } if(!normal_quest[qnr][0]){ normal_quest[qnr][0] = new Array(); } if(!normal_quest[qnr][3]){ normal_quest[qnr][3] = new Array(); } canddiv=cand.children[1];//.getElementsByTagName("div"); for(var k=0;k<canddiv.childElementCount;k++){ prodId = parseInt(canddiv.children[k].children[0].getAttribute("class").replace("kp",""),10); amount = parseInt(canddiv.children[k].children[1].innerHTML.replace(/[x*| |\.]/gi,""),10); normal_quest[qnr][0].push([0,prodId,amount]); } normal_quest[qnr][1] = (v<100?1:2); for(var k=0;k<cand.children[2].childElementCount;k++){ canddiv = cand.children[2].children[k]; if(canddiv.innerHTML.indexOf("points.gif")>=0){ normal_quest[qnr][2] = parseInt(canddiv.innerHTML.replace(/.* /,"").replace(/\./g,""),10); }else if(canddiv.innerHTML.indexOf("money.gif")>=0){ //normal_quest[qnr][3].push([0,parseInt(canddiv.innerHTML.replace(/.* /,"").replace(/\./g,""),10)]); normal_quest[qnr][3]=[0,parseInt(canddiv.innerHTML.replace(/.* /,"").replace(/\./g,""),10)]; }else if(canddiv.innerHTML.indexOf("adbonus.gif")>=0){ //normal_quest[qnr][3].push([5,1]); normal_quest[qnr][3]=[5,1]; }else if(canddiv.className.indexOf("kp")>=0 && cand.children[2].children[k+1].innerHTML.toLowerCase().indexOf("minuten")>=0){ //change to language where reading //normal_quest[qnr][3].push([4,parseInt(canddiv.className.replace("kp",""),10),parseInt(cand.children[2].children[k+1].innerHTML.replace(/[A-z ] /,""),10)]); normal_quest[qnr][3]=[4,parseInt(canddiv.className.replace("kp",""),10),parseInt(cand.children[2].children[k+1].innerHTML.replace(/[A-z ] /,""),10)]; k++; }else if(canddiv.innerHTML.toLowerCase().indexOf("boerderij")>=0){ //change to language where reading //normal_quest[qnr][3].push([3,parseInt(canddiv.innerHTML.replace(/\.[A-z ] /,""),10)]); normal_quest[qnr][3]=[3,parseInt(canddiv.innerHTML.replace(/\.[A-z ] /,""),10)]; }else if(canddiv.innerHTML.toLowerCase().indexOf("voorraadkast")>=0){ //change to language where reading //normal_quest[qnr][3].push([2,parseInt(canddiv.innerHTML.replace(/\.[A-z ] /,""),10)]); normal_quest[qnr][3]=[2,parseInt(canddiv.innerHTML.replace(/\.[A-z ] /,""),10)]; }else if(canddiv.className.indexOf("kp")>=0){ //normal_quest[qnr][3].push([1,parseInt(canddiv.className.replace("kp",""),10)]); normal_quest[qnr][3]=[1,parseInt(canddiv.className.replace("kp",""),10)]; } } if(normal_quest[qnr][3].length==0){ delete normal_quest[qnr][3];} }catch(err){GM_logError("at quest nr:"+qnr+" k:"+k+"\n"+err+"\n"+cand.innerHTML);} } GM_log("Questlist: "+implode(normal_quest)); */ var line,cell,help; var type,prod,amount,item,questCurr,quCamp=1,quNr=0; // initial prepare of the tables nodes["questinfos_"+quCamp]=createElement("div",{"id":"questinfos_"+quCamp,"style":"color:black;display:block;height:325px;overflow-x:hidden;overflow-y:scroll;"},nodes["helpbody"]); createElement("option",{"value":quCamp},nodes["questinfos_select"],quCamp); //*task_new_quest*/ var ALL_GEN_QUESTS=""; while(nodes["questinfos"].childElementCount>0){ line=nodes["questinfos"].children[0]; if(line.childElementCount==0){ quCamp++; nodes["questinfos_"+quCamp]=createElement("div",{"id":"questinfos_"+quCamp,"style":"color:black;display:none;height:325px;overflow-x:hidden;overflow-y:scroll;"},nodes["helpbody"]); createElement("option",{"value":quCamp},nodes["questinfos_select"],quCamp); quNr=0; removeElement(line); } else { quNr++; if(QUESTS["main"][quCamp]&&QUESTS["main"][quCamp][quNr]){ line.addEventListener("click",function(){ var quCamp=this.parentNode.id.replace("questinfos_",""); top.unsafeData.questData["main"][quCamp]["nr"]=parseInt(this.children[0].innerHTML,10); GM_setValueCache(COUNTRY+"_"+SERVER+"_"+USERNAME+"_questData",implode(top.unsafeData.questData)); do_hilfe_questlist(quCamp); if((0<top.unsafeData.questData["main"][quCamp]["calcTo"])&&(top.unsafeData.questData["main"][quCamp]["calcTo"]<top.unsafeData.questData["main"][quCamp]["nr"])){ setCalcToQuest("main",quCamp,top.unsafeData.questData["main"][quCamp]["nr"]); } },false); questCurr=QUESTS["main"][quCamp][quNr]; for(var j=0;j<questCurr[0].length;j++){ if(typeof questCurr[0][j][0]=="object"){ for(var k=0;k<questCurr[0][j].length;k++){ if(isNaN(NPC[questCurr[0][j][k][0]][questCurr[0][j][k][1]])){ questCurr[0][j][k][3]=Math.round(questCurr[0][j][k][2]*gut[questCurr[0][j][k][1]]*100)/100; }else{ questCurr[0][j][k][3]=Math.round(questCurr[0][j][k][2]*Math.min(gut[questCurr[0][j][k][1]],NPC[questCurr[0][j][k][0]][questCurr[0][j][k][1]])*100)/100; } questCurr[0][j][k][4]=true; for(var l=0;l<k;l++){ if(questCurr[0][j][l][3]>questCurr[0][j][k][3]){ questCurr[0][j][l][4]=false; } else { questCurr[0][j][k][4]=false; } } } }else{ if(isNaN(NPC[questCurr[0][j][0]][questCurr[0][j][1]])){ questCurr[0][j][3]=Math.round(questCurr[0][j][2]*gut[questCurr[0][j][1]]*100)/100; }else{ questCurr[0][j][3]=Math.round(questCurr[0][j][2]*Math.min(gut[questCurr[0][j][1]],NPC[questCurr[0][j][0]][questCurr[0][j][1]])*100)/100; } questCurr[0][j][4]=true; } } for(var i=0;i<line.children[1].childElementCount;i++){ cell = line.children[1].children[i]; cell.style.backgroundColor = ""; type=0; prod=parseInt(cell.children[0].getAttribute("class").replace("kp",""),10); amount=parseInt(cell.children[1].innerHTML.replace(/ /g,"").replace("x",""),10); item=null; for(var j=0;j<questCurr[0].length;j++){ if(typeof questCurr[0][j][0]=="object"){ for(var k=0;k<questCurr[0][j].length;k++){ if((type==questCurr[0][j][k][0])&&(prod==questCurr[0][j][k][1])){ item=questCurr[0][j][k]; } } }else{ if((type==questCurr[0][j][0])&&(prod==questCurr[0][j][1])){ item=questCurr[0][j]; } } } if(item){ if(!item[4]){ cell.children[1].style.textDecoration="line-through"; cell.children[2].style.textDecoration="line-through"; } cell.setAttribute("value",implode(item)); cell.addEventListener("mouseover",function(event){ var help=explode(this.getAttribute("value"),"questlist/mouseover",[]); toolTip.show(event,numberFormat(help[2])+" "+prodName[help[0]][help[1]]+" ("+moneyFormatLimit(help[3]/help[2],100)+") = "+moneyFormatLimit(help[3],10000)); },false); if(amount!=item[2]){ GM_log("Questlist-Help: Quest main."+quCamp+"."+quNr+". Amount of product "+prodName[type][prod]+ " wrong! data="+numberFormat(item[2])+" read="+numberFormat(amount)); } }else{ GM_log("Questlist-Help: Quest main."+quCamp+"."+quNr+". Data of product "+prodName[type][prod]+ " unknown! [i="+i+", prod="+prod+"]"); } if(amount>=10000){ cell.children[1].innerHTML=" "+numberFormat(amount/1000)+"k "; } else { cell.children[1].innerHTML=" "+numberFormat(amount)+" "; } if(prodBlock[type][prod]){ cell.children[2].style.backgroundColor="red"; } createElement("span",{"style":"color:red;"},cell.children[2]); } }else{ GM_log("Questlist-Help: Quest main."+quCamp+"."+quNr+" unknown!"); //*task_new_quest*/ var GEN_QUESTS=[[],,0]; //*task_new_quest*/ for(var i=0;i<line.children[1].childElementCount;i++){ //*task_new_quest*/ cell = line.children[1].children[i]; //*task_new_quest*/ type=0; //*task_new_quest*/ prod=parseInt(cell.children[0].getAttribute("class").replace("kp",""),10); //*task_new_quest*/ amount=parseInt(cell.children[1].innerHTML.replace(/ /g,"").replace("x",""),10); //*task_new_quest*/ GEN_QUESTS[0].push([type,prod,amount]); //*task_new_quest*/ } //*task_new_quest*/ GEN_QUESTS[2]=line.children[2].innerHTML; //*task_new_quest*/ ALL_GEN_QUESTS+="GEN_QUESTS main."+quCamp+"."+quNr+"="+implode(GEN_QUESTS)+"\n"; } nodes["questinfos_"+quCamp].appendChild(line); } } //*task_new_quest*/ GM_log(ALL_GEN_QUESTS); removeElement(nodes["helpbody"].getElementsByTagName("table")[0]); createElement("div",{"id":"questcalculation","style":"position:fixed;top:7px;right:3px;width:80px;"},nodes["helpbody"]); var newsel=createElement("select",{"id":"selectQuestCalcTo","style":"position:absolute;top:7px;left:0;width:50px;height:18px;"},$("questcalculation")); createElement("div",{"id":"queststocks","style":"position:absolute;top:28px;left:0;width:80px;height:220px;border:1px solid #6c441e;overflow-y:auto;overflow-x:hidden;"},$("questcalculation")); var newinp=createElement("input",{"id":"questvsrack","type":"checkbox","class":"link","checked":true,"style":"position:absolute;top:250px;right:3px;"},$("questcalculation")); newdiv.addEventListener("mouseover",function(event){ toolTip.show(event,getText("showMissingProducts")); },false); newinp.addEventListener("click",function(){change($("selectQuestCalcTo"));},false); newsel.addEventListener("change",function(){ var questinfos_select=$("questinfos_select"); for(var v=0;v<questinfos_select.childElementCount;v++){ if($("questinfos_"+questinfos_select.children[v].value).style.display=="block"){ top.unsafeData.setCalcToQuest("main",questinfos_select.children[v].value,this.value); fill_hilfe_calcToQuest(questinfos_select.children[v].value); break; } } questinfos_select=null; },false); function fill_hilfe_calcToQuest(quCamp){ var cell=$("queststocks"); cell.innerHTML=""; var prd=new Object(); var cand,prod,help=null; for(var v=top.unsafeData.questData["main"][quCamp]["nr"]-1;v<top.unsafeData.questData["main"][quCamp]["calcTo"];v++){ cand=$("questinfos_"+quCamp).children[v].children[1]; for(var i=0;i<cand.childElementCount;i++){ help=cand.children[i].getAttribute("value"); if(help){ help=explode(help,"fill_hilfe_calcToQuest"); if(help[4]){ if (!prd[help[1]]){ prd[help[1]]=0; } prd[help[1]] += help[2]; } } } } var counter=0; for(var v=0;v<prodNameSort[0].length;v++){ prod = prodNameSort[0][v]; //if ($("questvsrack").checked && (prodStock[0][v] > prd[v])) continue; if((!prodBlock[0][prod].match(/t/))&&(!prodBlock[0][prod].match(/l/))&&prd[prod]){ var newdiv=createElement("div",{"style":"display:inline-block;width:100%;background-color:"+(prodBlock[0][prod]?"red":((counter%2)?"#ad9e7d;":"#a59574;"))},cell); produktPic(0,prod,newdiv); if($("questvsrack").checked){ if(prodStock[0][prod] < prd[prod]){ createElement("span",{"style":"color:"+(prodBlock[0][prod]?"black":"red")+ ";"},newdiv,"-"+numberFormat(prd[prod]-prodStock[0][prod])); }else{ createElement("span",{"style":"color:black;"},newdiv,"+"+numberFormat(prodStock[0][prod]-prd[prod])); } }else{ createElement("span",{"style":"color:black;"},newdiv,numberFormat(prd[prod])); } counter++; } } cell=null;newdiv=null;v=null;prd=null;counter=null;cand=null;help=null;prod=null; } function do_hilfe_questlist(quCamp){ var questinfos=$("questinfos_"+quCamp); var line; for(var v=0;v<top.unsafeData.questData["main"][quCamp]["nr"]-1;v++){ line=questinfos.children[v]; if(line.style.opacity!="0.5"){ line.style.opacity="0.5"; } if(line.getAttribute("class")!="hoverBgCc9"){ line.setAttribute("class","hoverBgCc9"); } // cand=line.getElementsByTagName("div"); // if(cand[1].style.backgroundColor!=""){ cand[1].style.backgroundColor=""; } // if(cand[2].style.backgroundColor!=""){ cand[2].style.backgroundColor=""; } // if(cand[5].style.backgroundColor!=""){ cand[5].style.backgroundColor=""; } // if(cand[6].style.backgroundColor!=""){ cand[6].style.backgroundColor=""; } } if(top.unsafeData.questData["main"][quCamp]["nr"]<=questinfos.childElementCount){ var newsel=$("selectQuestCalcTo"); newsel.innerHTML=""; var prodcounter=new Object(); createElement("option",{"value":0},newsel,"--"); for(var v=top.unsafeData.questData["main"][quCamp]["nr"]-1;v<questinfos.childElementCount;v++){ createElement("option",{"value":v+1},newsel,v+1); line = questinfos.children[v]; if(line.style.opacity!="1"){ line.style.opacity="1"; } if(line.getAttribute("class")!="hoverBgCc9"){ line.setAttribute("class","hoverBgCc9"); } for(var i=0;i<line.children[1].childElementCount;i++){ help=line.children[1].children[i].getAttribute("value"); if(help){ help=explode(help,"do_hilfe_questlist",[]); if(help[4]){ if(!prodBlock[help[0]][help[1]]){ if (!prodcounter[help[1]]){ prodcounter[help[1]]=0; } prodcounter[help[1]] += help[2]; if(v==top.unsafeData.questData["main"][quCamp]["nr"]-1){ if(top.unsafeData.questData["main"][quCamp]["given"][help[0]]&&top.unsafeData.questData["main"][quCamp]["given"][help[0]][help[1]]){ prodcounter[help[1]] -= top.unsafeData.questData["main"][quCamp]["given"][help[0]][help[1]]; } } if(prodStock[help[0]][help[1]] < prodcounter[help[1]]){ if(prodcounter[help[1]]-prodStock[help[0]][help[1]]>10000){ line.children[1].children[i].children[2].children[0].innerHTML = " (" + numberFormat((prodcounter[help[1]]-prodStock[help[0]][help[1]])/1000) + "k)"; }else{ line.children[1].children[i].children[2].children[0].innerHTML = " (" + numberFormat(prodcounter[help[1]]-prodStock[help[0]][help[1]]) + ")"; } } } } } } } questinfos.children[top.unsafeData.questData["main"][quCamp]["nr"]-1].setAttribute("class","divCurrentQuest"); if(questinfos.children[top.unsafeData.questData["main"][quCamp]["nr"]-2]){ questinfos.scrollTop=questinfos.children[top.unsafeData.questData["main"][quCamp]["nr"]-2].offsetTop; } if(top.unsafeData.questData["main"][quCamp]["calcTo"]>0){ newsel.value=Math.max(top.unsafeData.questData["main"][quCamp]["nr"],Math.min(questinfos.childElementCount,top.unsafeData.questData["main"][quCamp]["calcTo"])); } fill_hilfe_calcToQuest(quCamp); newsel=null; }else{ questinfos.scrollTop=questinfos.lastChildElement.offsetTop; } questinfos=null;line=null; } do_hilfe_questlist("1"); line=null;cell=null;help=null; newsel=null;prodcounter=null;newinp=null; break; } } newdiv=null;newa=null;canddiv=null; } //*********************************************************************************************************** function do_multiframe(){ if($top("multiframe")){ if(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valDrag",false)){ makeDraggable(ALL,true,true,"multiframe"); } } } //*********************************************************************************************************** // Dragging var valMouseXY=["",0,0,0,0]; var dragPos=new Object(); var doDrag=new Object(); function makeDraggable(appendTo,doDragX,doDragY,dragObjId){ if(typeof(doDragX)!="boolean") doDragX=true; if(typeof(doDragY)!="boolean") doDragY=true; if(typeof(dragObjId)!="string") dragObjId=appendTo.id; //GM_log("makeDraggable:"+appendTo+":"+doDragX+":"+doDragY+":"+dragObjId); doDrag[dragObjId]=[doDragX,doDragY]; var help=GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_dragPos_"+dragObjId,""); var dragObj=$top(dragObjId); if (help){ dragPos[dragObjId]=help.split("|"); if(doDragX) dragObj.style.left=dragPos[dragObjId][0]+"px"; if(doDragY) dragObj.style.top=dragPos[dragObjId][1]+"px"; dragObj.style.margin=""; dragObj.style.marginLeft=""; dragObj.style.marginTop=""; }else{ x=parseInt(dragObj.style.left+"0",10)+parseInt(dragObj.style.marginLeft+"0",10); y=parseInt(dragObj.style.top+"0",10)+parseInt(dragObj.style.marginTop+"0",10); if(doDragX) dragObj.style.left=x+"px"; if(doDragY) dragObj.style.top=y+"px"; dragObj.style.margin=""; dragObj.style.marginLeft=""; dragObj.style.marginTop=""; dragPos[dragObjId]=[x,y]; } var newdiv=createElement("div",{"id":dragObjId+"Drag","style":"cursor:move;position:absolute;top:0;left:0;width:10px;height:20px;background-color:blue;opacity:0.4;"},appendTo); newdiv.addEventListener("mousedown", function(event){ valMouseXY=[this.id.replace("Drag",""),"x","y"]; top.window.addEventListener("mousemove", mousemoveDrag ,false); top.window.addEventListener("mouseup", mouseupDrag ,false); var dragObj=$top(valMouseXY[0]); createElement("div",{"id":"divDragHelper","style":"position:absolute;display:block;z-index:200;height:"+dragObj.style.height+";width:"+dragObj.style.width+";top:"+dragObj.style.top+";left:"+dragObj.style.left+";background-color:blue;"},dragObj.parentNode); dragObj=null; },false); dragObj=null;newdiv=null; } mousemoveDrag = function(event){ //GM_log("mousemoveDrag"); if (valMouseXY[0] != ""){ if(valMouseXY[1]=="x") valMouseXY=[valMouseXY[0],event.pageX,event.pageY]; // init var dragObj=$top(valMouseXY[0]); var divDragHelper=$top("divDragHelper"); if(doDrag[valMouseXY[0]][0]){ dragObj.style.left=(parseInt(dragObj.style.left+"0",10) + (event.pageX - valMouseXY[1]))+'px'; divDragHelper.style.left=dragObj.style.left; } if(doDrag[valMouseXY[0]][1]){ dragObj.style.top= (parseInt(dragObj.style.top+"0",10) + (event.pageY - valMouseXY[2]))+'px'; divDragHelper.style.top=dragObj.style.top; } valMouseXY=[valMouseXY[0],event.pageX,event.pageY]; dragObj=null;divDragHelper=null; } }; mouseupDrag = function(event){ //GM_log("mouseupDrag"); top.window.removeEventListener("mousemove", mousemoveDrag ,false); if (valMouseXY[0] != ""){ var dragObj=$top(valMouseXY[0]); dragPos[valMouseXY[0]]=[parseInt(dragObj.style.left+"0",10),parseInt(dragObj.style.top+"0",10)]; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_dragPos_"+valMouseXY[0],dragPos[valMouseXY[0]].join("|")); removeElement($top("divDragHelper")); dragObj=null; } valMouseXY=["",0,0,0,0]; top.window.removeEventListener("mouseup", mouseupDrag ,false); }; //*********************************************************************************************************** function resetVariables(){ /* createElement("div",{"id":"transp100","mode":"","style":"z-index:100;background-color:black;opacity:0.7;position:absolute;top:0;left:0;width:100%;height:100%;display:block;"},$("main_container")); newdiv=createElement("div",{"id":"infoPanel","mode":"","style":"position:absolute;top:50px;left:240px;width:660px;height:580px;background-color:#b8a789;z-index:101;display:block;"},$("main_container")); createElement("img",{"src":GFX+"guild/help_back.jpg","style":"position:absolute;top:0;left:0;width:100%;height:100%;z-index:-1;"},newdiv); createElement("div",{"id":"infoPanelInner","class":"tnormal","style":"position:absolute;width:595px;height:89%;margin:5%;overflow:auto;"},newdiv); var newimg=createElement("img",{"id":"infoPanelClose","class":"link","src":GFX+"close.jpg","style":"position:absolute;top:8px;right:8px;width:20px;height:20px;"},newdiv); newimg.addEventListener("click",function(){ $("transp100").style.display = "none"; $("infoPanel").style.display = "none"; },false); try{ var loginStr = new Array(new Object(), new Object(), new Object(), new Object());//[0]=global,[1]=server,[2]=user,[3]=vars over var listVars = cloneInto(GM_listValues(), unsafeWindow); var found = false; try{logindata=explode(GM_getValue("logindata","[]"),"resetVariables\logindata"); for(var v=0;v<logindata.length;v++){ loginStr[0][logindata[v][0]]=true; loginStr[1][logindata[v][0]+"_"+logindata[v][1]]=true; loginStr[2][logindata[v][0]+"_"+logindata[v][1]+"_"+logindata[v][2]]=true; } loginStr[0].sortObj(); GM_log("loginStr[0]:"+implode(loginStr[0])); loginStr[1].sortObj(); GM_log("loginStr[1]:"+implode(loginStr[1])); loginStr[2].sortObj(); GM_log("loginStr[2]:"+implode(loginStr[2])); for(var v in listVars){ if(!listVars.hasOwnProperty(v)){continue;} found=false; for(var elm in loginStr[2]){ if(!loginStr[2].hasOwnProperty(elm)){continue;} if(help=listVars[v].match(new RegExp("^"+elm+"_(.*)"))){ found=true; loginStr[3][help[1]]=true; } } if(!found){ for(var elm in loginStr[1]){ if(!loginStr[1].hasOwnProperty(elm)){continue;} if(help=listVars[v].match(new RegExp("^"+elm+"_[^_]*_(.*)"))){ found=true; loginStr[3][help[1]]=true; } } } if(found){ delete listVars[v]; } } loginStr[3].sortObj(); GM_log("loginStr[3]:"+implode(loginStr[3])); listVars.sort(); GM_log("listVars:"+implode(listVars)); }catch(err){GM_log("1:"+err);} }catch(err){GM_log("2:"+err);} return false; */ if(confirm("Do you really want to reset zone data?")){ var help=cloneInto(GM_listValues(), unsafeWindow); var help2; for(var v=0;v<help.length;v++){ if(help[v].match(/_gut$/)){if(GM_getValue(help[v],"").indexOf("|")>0){ GM_deleteValue(help[v]); }} if(help[v].match(/_gutBeob$/)){if(GM_getValue(help[v],"").indexOf("|")>0){ GM_deleteValue(help[v]); }} if(help[v].match(/_prodName$/)){GM_deleteValue(help[v]);} if(help[v].match(/_prodNameSort$/)){GM_deleteValue(help[v]);} if(help[v].match(/_valGlobalTimeAdd$/)){GM_deleteValue(help[v]);} if(help[v].match(/_lodgeQuestData$/)){GM_deleteValue(help[v]);} if(help[v].match(/_prodStock$/)){GM_deleteValue(help[v]);} if(help[v].match(/_prodMinRack$/)){GM_deleteValue(help[v]);} if(help[v].match(/_prodMinRackInit$/)){GM_deleteValue(help[v]);} if(help[v].match(/_totalForestryFarmis$/)){GM_deleteValue(help[v]);} if(help[v].match(/_prodYield$/)){GM_deleteValue(help[v]);} if(help[v].match(/_prodRequire$/)){GM_deleteValue(help[v]);} if(help[v].match(/_changedata$/)){GM_deleteValue(help[v]);} } // GM_log(print_r(total)); GM_deleteValue("loginbusy"); if(GAMEPAGES[COUNTRY]){ location.href="http://www."+GAMEPAGES[COUNTRY]+"/login.php?start=1"; } } } function manageVariables(){ // 1: historic data - not reproducible! // 2: collectable data // 3: options, settings // 4: temporary data = 2? // 5: useless, old data function buildManageVariables(){ try{ var container=$("divManageVariablesInner"); container.innerHTML=""; var containerPart = createElement("div",{"style":"height:10%;"},container); createElement("div",{"style":"font-weight:bold;"},containerPart,"Variable Management "+getText("adviser")); var newinput=createElement("select",{"class":"link"},containerPart); createElement("option",{"value":"GLOBAL"},newinput,"GLOBAL"); createElement("option",{"value":"ALL"},newinput,"ALL"); createElement("option",{"value":"UNKNOWN"},newinput,"UNKNOWN"); createElement("option",{"value":"USELESS"},newinput,"USELESS"); newinput.addEventListener("click",function(){ buildExportTable(this.value); },false); var variables = {}; variables["GLOBAL"] = []; var help = cloneInto(GM_listValues(), unsafeWindow); help.sort(); var help2; for(var v=0;v<help.length;v++){ help2 = (/^([A-Z]{2}_\d+_.+?_)(.*)$/).exec(help[v]); // COUNTRY_SERVER_USER_... if(!help2){ help2 = (/^([A-Z]{2}_\d+_)(.*)$/).exec(help[v]); // COUNTRY_SERVER_... if(!help2){ help2 = (/^([A-Z]{2}_)(.*)$/).exec(help[v]); // COUNTRY_... } } if(help2){ if(!variables[help2[1]]){ variables[help2[1]] = []; createElement("option",{"value":help2[1]},newinput,help2[1]); } variables[help2[1]].push(help2[2]); } else { variables["GLOBAL"].push(help[v]); // GLOBAL } } newinput=createElement("button",{"class":"link","style":"margin-left:20px;"},containerPart,"Select all"); newinput.addEventListener("click",function(){ var container=$("divManageVariablesInner"); var rows = container.children[1].getElementsByTagName("tr"); var checkedNew; if(this.innerHTML=="Select all"){ checkedNew = true; this.innerHTML="Unselect all"; } else { checkedNew = false; this.innerHTML="Select all"; } for (var v=0;v<rows.length;v++){ rows[v].children[0].children[0].checked = checkedNew; } },false); newinput=createElement("button",{"class":"link","style":"margin-left:20px;"},containerPart,"Delete"); newinput.addEventListener("click",function(){ var container=$("divManageVariablesInner"); var rows = container.children[1].getElementsByTagName("tr"); var variables = []; var acc, varname; var str = "Delete following variables:"; for (var v=0;v<rows.length;v++){ if(rows[v].children[0].children[0].checked){ acc = rows[v].children[1].innerHTML; varname = rows[v].children[2].innerHTML; variables.push(acc+varname); if(variables.length<11){ str += "\n"+acc+varname; } } } if(variables.length>0){ if(variables.length>10){ str += "\n..." } if(confirm(str)){ for (var v=0;v<variables.length;v++){ GM_deleteValue(variables[v]); } buildManageVariables(); } } else { alert("Nothing selected"); } },false); newinput=createElement("button",{"class":"link","style":"margin-left:20px;"},containerPart,"Create storage string"); newinput.addEventListener("click",function(){ var container=$("divManageVariablesInner"); var rows = container.children[1].getElementsByTagName("tr"); var variables = []; var acc, varname; for (var v=0;v<rows.length;v++){ if(rows[v].children[0].children[0].checked){ acc = rows[v].children[1].innerHTML; varname = rows[v].children[2].innerHTML; variables.push([acc+varname,GM_getValue(acc+varname)]); } } if(variables.length>0){ prompt("Copy this string to a text-file", implode(variables)); } else { alert("Nothing selected"); } },false); newinput=createElement("button",{"class":"link","style":"margin-left:20px;"},containerPart,"Import storage string"); newinput.addEventListener("click",function(){ var data = prompt("Enter storage string"); if(data){ try{ data = explode(data,"buildImportTable/storageString"); buildImportTable(data); }catch(err){ alert("Sorry. Can't read the entered string.\n"+err); } } },false); newinput=createElement("button",{"class":"link","style":"margin-left:20px;"},containerPart,"Import OLD storage string"); newinput.addEventListener("click",function(){ var data = prompt("Enter storage string"); var user = prompt("Enter prefix like 'de_7_Johnny_' if needed"); if(data){ try{ data=data.split("::"); for(var v=0;v<data.length;v++){ data[v] = [,data[v].split(":")]; data[v][0] = user+data[v][1].splice(0,1)[0]; var impType=data[v][1].splice(0,1)[0]; data[v][1] = data[v][1].join(":"); if(impType == "n"){ data[v][1] = parseFloat(data[v][1],10); } else if(impType == "b"){ data[v][1] = (data[v][1]=="true"); } } buildImportTable(data); }catch(err){ alert("Sorry. Can't read the entered string.\n"+err); } } },false); containerPart = createElement("div",{"style":"height:90%;overflow-y:scroll;"},container); function buildExportTable(filter){ try{ var container=$("divManageVariablesInner"); container.children[1].innerHTML = ""; var newtable=createElement("table",{"border":"1","class":"hoverRowBgCc9","style":"width:100%"},container.children[1]); var newtr,newtd; var help3=cloneInto(GM_listValues(), unsafeWindow); var help=[],help2; for(var v=0;v<help3.length;v++){ help2 = (/^([A-Z]{2}_\d+_.+?_)(.*)$/).exec(help3[v]); // COUNTRY_SERVER_USER_... if(help2){ help[v] = [help2[1],help2[2],"USER"]; } else { help2 = (/^([A-Z]{2}_\d+_)(.*)$/).exec(help3[v]); // COUNTRY_SERVER_... if(help2){ help[v] = [help2[1],help2[2],"SERVER"]; } else { help2 = (/^([A-Z]{2}_)(.*)$/).exec(help3[v]); // COUNTRY_... if(help2){ help[v] = [help2[1],help2[2],"COUNTRY"]; } else { help[v] = ["",help3[v],"GLOBAL"]; } } } } help.sort(function(a,b){ if(a[0]==b[0]){ return ((a[1]>b[1])-(a[1]<b[1])); } else{ return ((a[0]>b[0])-(a[0]<b[0])); } }); for(var v=0;v<help.length;v++){ switch(filter){ case "ALL": break; case "GLOBAL":if(help[v][0]!=""){ continue; } break; case "UNKNOWN":if(VARIABLES[help[v][2]][help[v][1]]){ continue; } break; case "USELESS":if((!VARIABLES[help[v][2]][help[v][1]])||(VARIABLES[help[v][2]][help[v][1]][1]!=5)){ continue; } break; default: if(help[v][0]!=filter){ continue; } } help[v][4] = GM_getValue(help[v][0]+help[v][1]); help[v][3] = "s"; // if(help[v][4]==""){ help[v][4]=" "; } if(typeof help[v][4]=="number"){ help[v][3]="n"; } else if(typeof help[v][4]=="boolean"){ help[v][3]="b"; } else{ // help[v][4] = help[v][4].replace(/(:+)/g,":"); if(help[v][4].length>100){ help[v][4] = help[v][4].substr(0,97)+"..."; } } newtr=createElement("tr",{},newtable); newtd = createElement("td",{},newtr); createElement("input",{"type":"checkbox","class":"link","checked":false},newtd); createElement("td",{},newtr,help[v][0]); createElement("td",{},newtr,help[v][1]); createElement("td",{},newtr,help[v][3]); if(VARIABLES[help[v][2]][help[v][1]]){ createElement("td",{},newtr,VARIABLES[help[v][2]][help[v][1]][0]); createElement("td",{},newtr,[,"historic data - not reproducible!","collectable data","options, settings","temporary data","useless, old data"][VARIABLES[help[v][2]][help[v][1]][1]]); } else { createElement("td",{},newtr,"unknown"); createElement("td",{},newtr,""); } createElement("td",{},newtr,help[v][4]); } container=null;newtable=null;newtr=null;newtd=null; }catch(err){ GM_logError("buildExportTable\n"+err); } } buildExportTable("GLOBAL"); function buildImportTable(data){ try{ var container=$("divManageVariablesInner"); container.children[1].innerHTML = ""; var newinput=createElement("button",{"class":"link"},container.children[1],"SAVE !"); newinput.addEventListener("click",function(){ var container=$("divManageVariablesInner"); var rows = container.children[1].getElementsByTagName("tr"); var variables = []; var acc, varname; for (var v=0;v<rows.length;v++){ if(rows[v].children[0].children[0].checked){ GM_setValue(data[v][0]+data[v][1],data[v][3]); } } buildManageVariables(); },false); var newtable=createElement("table",{"border":"1","class":"hoverRowBgCc9","style":"width:100%"},container.children[1]); var newtr,newtd; var help2; var dataLevel; for(var v=0;v<data.length;v++){ help2 = (/^([A-Z]{2}_\d+_.+?_)(.*)$/).exec(data[v][0]); // COUNTRY_SERVER_USER_... if(help2){ dataLevel = "USER"; data[v] = [help2[1],help2[2],"s",data[v][1]]; } else { help2 = (/^([A-Z]{2}_\d+_)(.*)$/).exec(data[v][0]); // COUNTRY_SERVER_... if(help2){ dataLevel = "SERVER"; data[v] = [help2[1],help2[2],"s",data[v][1]]; } else { help2 = (/^([A-Z]{2}_)(.*)$/).exec(data[v][0]); // COUNTRY_... if(help2){ dataLevel = "COUNTRY"; data[v] = [help2[1],help2[2],"s",data[v][1]]; } else { dataLevel = "GLOBAL"; data[v] = ["",data[v][0],"s",data[v][1]]; } } } if(typeof data[v][3]=="number"){ data[v][2]="n"; } else if(typeof data[v][3]=="boolean"){ data[v][2]="b"; } newtr=createElement("tr",{},newtable); newtd = createElement("td",{},newtr); createElement("input",{"type":"checkbox","class":"link","checked":true},newtd); createElement("td",{},newtr,data[v][0]); createElement("td",{},newtr,data[v][1]); createElement("td",{},newtr,data[v][2]); if(VARIABLES[dataLevel][data[v][1]]){ createElement("td",{},newtr,VARIABLES[dataLevel][data[v][1]][0]); createElement("td",{},newtr,[,"historic data - not reproducible!","collectable data","options, settings","temporary data","useless, old data"][VARIABLES[dataLevel][data[v][1]][1]]); } else { createElement("td",{},newtr,"unknown"); createElement("td",{},newtr,""); } if(data[v][3].length>100){ createElement("td",{},newtr,data[v][3].substr(0,97)+"..."); } else { createElement("td",{},newtr,data[v][3]); } } container=null;newtable=null;newtr=null;newtd=null;newinput=null; }catch(err){ GM_logError("buildImportTable\n"+err); } } container=null;containerPart=null;newselect=null; newdiv=null;newinput=null; }catch(err){ GM_logError("buildManageVariables\n"+err); } } if($("divManageVariables")){ return false; } var newdiv=createElement("div",{"id":"divManageVariables","mode":"","style":"position:fixed;top:0;left:0;width:100%;height:100%;background-color:#b8a789;z-index:1000;display:block;"},ALL); createElement("img",{"src":GFX+"guild/help_back.jpg","style":"position:absolute;top:0;left:0;width:100%;height:100%;z-index:-1;"},newdiv); createElement("div",{"id":"divManageVariablesInner","class":"tnormal","style":"position:absolute;top:6%;left:5%;width:90%;height:88%;overflow:auto;"},newdiv); var newimg=createElement("img",{"id":"infoPanelClose","class":"link","src":GFX+"close.jpg","style":"position:absolute;top:8px;right:8px;width:20px;height:20px;"},newdiv); newimg.addEventListener("click",function(){ removeElement(this.parentNode); },false); newdiv = null;newimg=null; buildManageVariables(); } function do_login(){ try{ if(top!=self){ return; } if((location.pathname.match(/^\/login\.php$/))&&(pageZusatz["logout"]=="1")){ GM_log("Logout-page found ("+location.href+").\nReturn to login-page."); if(GAMEPAGES[COUNTRY]){ window.setTimeout(function(){ location.href="http://www."+GAMEPAGES[COUNTRY]+"/login.php?start=1"; },1000); // go to login-page after logout (old page) } }else if($("login_container")){ do_login_old(); }else if($("loginbar")){ GM_log("Login-page found ("+location.href+")\npagedata="+implode(pagedata)); // account data var logindata=explode(GM_getValue("logindata","[]"),"do_login/logindata",[]); var c=0; var servers=new Object(); // servers["language_serverNr"]=[logindataNr,logindataNr,...] for(var v=0;v<logindata.length;v++){ if(logindata[v][4]){ c++; if(!servers[logindata[v][0]+"_"+logindata[v][1]]){ servers[logindata[v][0]+"_"+logindata[v][1]]=new Array(); } servers[logindata[v][0]+"_"+logindata[v][1]].push(v); } } // listener login-form to store username $("loginelements").querySelector("#loginbutton").parentNode.addEventListener("submit",function(){ try{ var currServer=this.querySelector("#loginserver").value; var currUser=this.querySelector("#loginusername").value.toLowerCase(); GM_log("Login submitted. Server="+currServer+", user="+currUser); GM_setValueCache(COUNTRY+"_"+currServer+"_username",currUser.toLowerCase()); }catch(err){ GM_logError("loginform.submit\n"+err); } },false); // listener portal login-form to store username $("portal").querySelector("#portalmiddle").parentNode.addEventListener("submit",function(){ try{ var currServer=this.querySelector("#portalserver").value; var currUser=this.querySelector("#portalusername").value.toLowerCase(); GM_log("Portal login submitted. Server="+currServer+", user="+currUser); GM_setValueCache(COUNTRY+"_"+currServer+"_username",currUser.toLowerCase()); }catch(err){ GM_logError("portalform.submit\n"+err); } },false); // execute login function submit_login(accNr){ window.setTimeout(function(){ try{ var logindata=explode(GM_getValue("logindata"),"submit_login/logindata",[]); if(logindata[accNr][0]==COUNTRY){ if(logindata[accNr][5]){ click($("portalicon")); var login_container=$("portal"); login_container.querySelector("#portalserver").value=logindata[accNr][1]; login_container.querySelector("#portalusername").value=logindata[accNr][2]; login_container.querySelector("#portalpassword").value=enc(logindata[accNr][3],-4242); GM_setValueCache(COUNTRY+"_"+logindata[accNr][1]+"_username",logindata[accNr][2].toLowerCase()); click(login_container.querySelector("#portalbutton")); login_container=null; }else{ var login_container=$("loginelements"); login_container.querySelector("#loginserver").value=logindata[accNr][1]; login_container.querySelector("#loginusername").value=logindata[accNr][2]; login_container.querySelector("#loginpassword").value=enc(logindata[accNr][3],-4242); GM_setValueCache(COUNTRY+"_"+logindata[accNr][1]+"_username",logindata[accNr][2].toLowerCase()); click(login_container.querySelector("#loginbutton")); login_container=null; } }else if(GAMEPAGES[logindata[accNr][0]]){ var help=explode(GM_getValue(logindata[accNr][0]+"_pagedataLogin","{}"),"submit_login/pagedataLogin",{}); if(!(help["dologin"]&&(typeof help["dologin"]=="object"))){ help["dologin"]=new Object(); } help["dologin"][accNr]=true; GM_setValue(logindata[accNr][0]+"_pagedataLogin",implode(help)); location.href="http://www."+GAMEPAGES[logindata[accNr][0]]+"/login.php?start=1"; } }catch(err){ GM_logError("submit_login("+accNr+")\n"+err); } },0); } var currDoLogin=null; var currDoServer=null; var pagedata=explode(GM_getValue(COUNTRY+"_pagedataLogin","{}"),"do_login/pagedataLogin",{}); if(pagedata["doserver"]){ if(typeof pagedata["doserver"]=="object"){ for(var v in pagedata["doserver"]){ if(!pagedata["doserver"].hasOwnProperty(v)){ continue; } currDoServer=v; delete pagedata["doserver"][v]; break; } if(pagedata["doserver"].isEmpty()){ delete pagedata["doserver"]; } }else{ delete pagedata["doserver"]; } }else if(pagedata["dologin"]){ if(typeof pagedata["dologin"]=="object"){ for(var v in pagedata["dologin"]){ if(!pagedata["dologin"].hasOwnProperty(v)){ continue; } currDoLogin=v; delete pagedata["dologin"][v]; break; } if(pagedata["dologin"].isEmpty()){ delete pagedata["dologin"]; } }else{ delete pagedata["dologin"]; } } GM_setValue(COUNTRY+"_pagedataLogin",implode(pagedata)); if(currDoServer!=null){ var help=GM_getValue(COUNTRY+"_"+currDoServer+"_username",""); for(var v=0;v<logindata.length;v++){ if((logindata[v][4])&&(logindata[v][0]==COUNTRY)&&(logindata[v][1]==currDoServer)&&(logindata[v][2].toLowerCase()==help)){ currDoLogin=v; break; } } if(currDoLogin!=null){ for(var v=0;v<logindata.length;v++){ if((logindata[v][4])&&(logindata[v][0]==COUNTRY)&&(logindata[v][1]==currDoServer)){ currDoLogin=v; break; } } } } if(currDoLogin!=null){ submit_login(currDoLogin); }else{ var newdiv,newbutton; // Buttons newdiv=createElement("div",{"id":"divBeraterButtons"},ALL); newdiv.addEventListener("mouseover",function(event){ var node=event.target; var mouseOverText=node.getAttribute("mouseOverText"); while((node!=this)&&(!mouseOverText)){ node=node.parentNode; mouseOverText=node.getAttribute("mouseOverText"); } if(mouseOverText){ toolTip.show(event,mouseOverText); } node=null;mouseOverText=null; },false); newdiv.addEventListener("click",function(){ if($("divInfo")){ click($("divInfo")); } },false); // Button manage accounts newbutton=createElement("div",{"class":"link beraterButtonIcon hoverBgGreen","mouseOverText":getText("accounts")},newdiv); createElement("img",{"src":IMAGES["settings"],"style":"position:relative;top:-3px;left:-1px;;width:32px;height:32px;"},newbutton); newbutton.addEventListener("click",function(){ unsafeWindow.buildInfoPanel("menu","accounts"); },false); // Button manage variables newbutton=createElement("div",{"class":"link beraterButtonIcon hoverBgGold","mouseOverText":getText("manageVariables")+" ("+getText("adviser")+")"},newdiv); createElement("img",{"src":IMAGES["floppyDisk"],"style":"position:relative;top:3px;left:3px;;width:24px;height:24px;"},newbutton); newbutton.addEventListener("click",manageVariables,false); // Buttons accounts newdiv=createElement("div",{"style":"position:absolute;left:50%;margin-left:250px;top:205px;height:263px;overflow-x:hidden;overflow-y:auto;padding-right:17px;"},$("content")); for(var v=0;v<logindata.length;v++){ if(logindata[v][4]){ newbutton=createElement("div",{"class":"link loginbutton hoverBgLightblue","id":"autologin"+v},newdiv,getText("server")+" "+logindata[v][1]+"."+logindata[v][0]+": "+logindata[v][2]); newbutton.addEventListener("click",function(){ if($("divInfo")){ click($("divInfo")); } submit_login(this.id.replace("autologin","")); },false); }} // Autologin var lastbusy=GM_getValue("loginbusy",0); if (isNaN(lastbusy) || now<lastbusy){ lastbusy=0; } if (GM_getValue("valAutoLogin",false) && (c>0) && (now-lastbusy>15)){ GM_setValue("loginbusy",now); newdiv=createElement("div",{"id":"divInfo","class":"round transp shadow","style":"position:absolute;left:50%;margin-left:-150px;top:470px;height:130px;width:300px;z-index:200;"},$("content")); createElement("div",{"class":"buttontext4","style":""},newdiv,getText("autologinChecking").replace(/%1%/,"5")); newdiv.addEventListener("click",function(){ removeElement(this); },false); for(var v in servers){ if(!servers.hasOwnProperty(v)){ continue; } GM_setValue(v+"_sessionlost",true); } var counter=5; function autologinLoop(){ counter -= 0.5; if(!$("divInfo")){ return false; } if(counter>0){ $("divInfo").firstElementChild.innerHTML=getText("autologinChecking").replace(/%1%/,Math.ceil(counter)); var c=0; for(var v in servers){ if(!servers.hasOwnProperty(v)){ continue; } if (GM_getValue(v+"_sessionlost",true)){ c++; }else{ var help=GM_getValue(v+"_username",""); for(var w=0;w<servers[v].length;w++){ $("autologin"+servers[v][w]).style.backgroundColor=(logindata[servers[v][w]][2].toLowerCase()==help?"#00ff00":"#008800"); } //delete servers[v]; } } if(c==0){ counter=0; } window.setTimeout(autologinLoop,500); }else{ var c=null; for(var v in servers){ if(!servers.hasOwnProperty(v)){ continue; } if (GM_getValue(v+"_sessionlost",true)){ if (c==null){ c=servers[v][0]; }else if(GAMEPAGES[logindata[servers[v][0]][0]]){ var help=explode(GM_getValue(logindata[servers[v][0]][0]+"_pagedataLogin","{}"),"autologinLoop/pagedataLogin",{}); if(!(help["dologin"]&&(typeof help["dologin"]=="object"))){ help["dologin"]=new Object(); } help["dologin"][servers[v][0]]=true; GM_setValue(logindata[servers[v][0]][0]+"_pagedataLogin",implode(help)); window.open("http://www."+GAMEPAGES[logindata[servers[v][0]][0]]+"/login.php?start=1"); } } } if (c==null){ // all logged in $("divInfo").firstElementChild.innerHTML=getText("autologinAllOk"); window.setTimeout(function(){ for(var v in servers){ if(!servers.hasOwnProperty(v)){ continue; } for(var w=0;w<servers[v].length;w++){ $("autologin"+servers[v][w]).style.backgroundColor="white"; } GM_setValue(v+"_sessionlost",true); } now=Math.floor((new Date()).getTime()/1000); GM_setValue("loginbusy",now); counter=5; autologinLoop(); },5000); }else{ GM_setValue("loginbusy",0); submit_login(c); } } } window.setTimeout(autologinLoop,500); } newdiv=null;newbutton=null; } } }catch(err){ GM_logError("do_login\n"+err); } } function do_login_old(){ try{ GM_log("Old login-page found ("+location.href+")"); //paypal var newform=createElement("form",{"id":"paypalForm","action":"https://www.paypal.com/cgi-bin/webscr","method":"post","style":"position:absolute;top:30px;left:117px;"},ALL); createElement("input",{"type":"hidden","name":"cmd","value":"_donations"},newform); createElement("input",{"type":"hidden","name":"business","value":"jessicakanaan@web.de"},newform); createElement("input",{"type":"hidden","name":"lc","value":((LANGUAGE=="de")?"DE":"US")},newform); createElement("input",{"type":"hidden","name":"item_name","value":"MyFreeFarm Script"},newform); createElement("input",{"type":"hidden","name":"no_note","value":"0"},newform); createElement("input",{"type":"hidden","name":"currency_code","value":"EUR"},newform); createElement("input",{"type":"hidden","name":"bn","value":"PP-DonationsBF:btn_donate_LG.gif:NonHostedGuest"},newform); createElement("input",{"type":"image","border":"0","src":"https://www.paypal.com/"+((LANGUAGE=="de")?"de_DE/DE":"en_US")+"/i/btn/btn_donate_LG.gif","name":"submit",alt:"PayPal"},newform); createElement("img",{"alt":"","border":"0","src":"https://www.paypal.com/en_US/i/scr/pixel.gif","width":"1","height":"1"},newform); newform=null; //login var logindata=explode(GM_getValue("logindata","[]"),"do_login/logindata",[]); var c=0; var servers=new Object(); // servers["language_serverNr"]=[logindataNr,logindataNr,...] for(var v=0;v<logindata.length;v++){ if(logindata[v][4]){ c++; if(!servers[logindata[v][0]+"_"+logindata[v][1]]){ servers[logindata[v][0]+"_"+logindata[v][1]]=new Array(); } servers[logindata[v][0]+"_"+logindata[v][1]].push(v); } } $("login_container").querySelector("#submitlogin").addEventListener("click",function(){ try{ var login_container=$("login_container"); var currServer=login_container.querySelector("#loginserver").value; var currUser=login_container.querySelector("#loginusername").value.toLowerCase(); GM_setValueCache(COUNTRY+"_"+currServer+"_username",currUser.toLowerCase()); login_container=null; }catch(err){ GM_logError("login_container listener\n"+err); } },false); function submit_login(accNr){ window.setTimeout(function(){ try{ var logindata=explode(GM_getValue("logindata"),"submit_login/logindata",[]); if(logindata[accNr][0]==COUNTRY){ var login_container=$("login_container"); login_container.querySelector("#loginserver").value=logindata[accNr][1]; login_container.querySelector("#loginusername").value=logindata[accNr][2]; login_container.querySelector("#loginpassword").value=enc(logindata[accNr][3],-4242); GM_setValueCache(COUNTRY+"_"+logindata[accNr][1]+"_username",logindata[accNr][2].toLowerCase()); click(login_container.querySelector("#submitlogin")); login_container=null; }else if(GAMEPAGES[logindata[accNr][0]]){ var help=explode(GM_getValue(logindata[accNr][0]+"_pagedataLogin","{}"),"submit_login/pagedataLogin",{}); if(!(help["dologin"]&&(typeof help["dologin"]=="object"))){ help["dologin"]=new Object(); } help["dologin"][accNr]=true; GM_setValue(logindata[accNr][0]+"_pagedataLogin",implode(help)); location.href="http://www."+GAMEPAGES[logindata[accNr][0]]+"/login.php?start=1"; } }catch(err){ GM_logError("submit_login("+accNr+")\n"+err); } },0); } var currDoLogin=null; var currDoServer=null; var pagedata=explode(GM_getValue(COUNTRY+"_pagedataLogin","{}"),"do_login/pagedataLogin",{}); GM_log("This is do_login_old@"+location.href+". pagedata:"+implode(pagedata)); if(pagedata["doserver"]){ if(typeof pagedata["doserver"]=="object"){ for(var v in pagedata["doserver"]){ if(!pagedata["doserver"].hasOwnProperty(v)){ continue; } currDoServer=v; delete pagedata["doserver"][v]; break; } if(pagedata["doserver"].isEmpty()){ delete pagedata["doserver"]; } }else{ delete pagedata["doserver"]; } }else if(pagedata["dologin"]){ if(typeof pagedata["dologin"]=="object"){ for(var v in pagedata["dologin"]){ if(!pagedata["dologin"].hasOwnProperty(v)){ continue; } currDoLogin=v; delete pagedata["dologin"][v]; break; } if(pagedata["dologin"].isEmpty()){ delete pagedata["dologin"]; } }else{ delete pagedata["dologin"]; } } GM_setValue(COUNTRY+"_pagedataLogin",implode(pagedata)); if(currDoServer!=null){ var help=GM_getValue(COUNTRY+"_"+currDoServer+"_username",""); for(var v=0;v<logindata.length;v++){ if((logindata[v][4])&&(logindata[v][0]==COUNTRY)&&(logindata[v][1]==currDoServer)&&(logindata[v][2].toLowerCase()==help)){ currDoLogin=v; break; } } if(currDoLogin!=null){ for(var v=0;v<logindata.length;v++){ if((logindata[v][4])&&(logindata[v][0]==COUNTRY)&&(logindata[v][1]==currDoServer)){ currDoLogin=v; break; } } } } if(currDoLogin!=null){ submit_login(currDoLogin); }else{ var newdiv=createElement("div",{"style":"position:relative;top:-400px;left:300px;"},$("login_container")); var newbutton; newbutton=createElement("div",{"id":"GM_manageVariables","style":"position:absolute;top:-200px;"},newdiv); newbutton=createElement("div",{"class":"link loginbutton hoverBgLightblue","style":"background-color:orange;"},newbutton,getText("manageVariables")+" ("+getText("adviser")+")"); newbutton.addEventListener("click",function(){ if($("divInfo")){ click($("divInfo")); } manageVariables(); },false); for(var v=0;v<logindata.length;v++){ if(logindata[v][4]){ newbutton=createElement("div",{"class":"link loginbutton hoverBgLightblue","id":"autologin"+v},newdiv,getText("server")+" "+logindata[v][1]+"."+logindata[v][0]+": "+logindata[v][2]); newbutton.addEventListener("click",function(){ if($("divInfo")){ click($("divInfo")); } submit_login(this.id.replace("autologin","")); },false); }} //Autologin var lastbusy=GM_getValue("loginbusy",0); if (isNaN(lastbusy) || now<lastbusy){ lastbusy=0; } if (GM_getValue("valAutoLogin",false) && (c>0) && (now-lastbusy>15)){ GM_setValue("loginbusy",now); newdiv=createElement("div",{"id":"divInfo","style":"position:absolute;top:190px;left:455px;height:200px;width:280px;background-color:#842;border:4px solid black;z-index:200;"},$("main_container"),"<h1>"+getText("autologinChecking").replace(/%1%/,"5")+"</h1>"); newdiv.addEventListener("click",function(){ removeElement(this); },false); for(var v in servers){ if(!servers.hasOwnProperty(v)){ continue; } GM_setValue(v+"_sessionlost",true); } var counter=5; function autologinLoop(){ counter -= 0.5; if(!$("divInfo")){ return false; } if(counter>0){ $("divInfo").innerHTML="<h1>"+getText("autologinChecking").replace(/%1%/,Math.ceil(counter))+"</h1>"; var c=0; for(var v in servers){ if(!servers.hasOwnProperty(v)){ continue; } if (GM_getValue(v+"_sessionlost",true)){ c++; }else{ var help=GM_getValue(v+"_username",""); for(var w=0;w<servers[v].length;w++){ $("autologin"+servers[v][w]).style.backgroundColor=(logindata[servers[v][w]][2].toLowerCase()==help?"#00ff00":"#008800"); } //delete servers[v]; } } if(c==0){ counter=0; } window.setTimeout(autologinLoop,500); }else{ var c=null; for(var v in servers){ if(!servers.hasOwnProperty(v)){ continue; } if (GM_getValue(v+"_sessionlost",true)){ if (c==null){ c=servers[v][0]; }else if(GAMEPAGES[logindata[servers[v][0]][0]]){ var help=explode(GM_getValue(logindata[servers[v][0]][0]+"_pagedataLogin","{}"),"autologinLoop/pagedataLogin",{}); if(!(help["dologin"]&&(typeof help["dologin"]=="object"))){ help["dologin"]=new Object(); } help["dologin"][servers[v][0]]=true; GM_setValue(logindata[servers[v][0]][0]+"_pagedataLogin",implode(help)); window.open("http://www."+GAMEPAGES[logindata[servers[v][0]][0]]+"/login.php?start=1"); } } } if (c==null){ // all logged in $("divInfo").innerHTML="<h1>"+getText("autologinAllOk")+"</h1>"; window.setTimeout(function(){ for(var v in servers){ if(!servers.hasOwnProperty(v)){ continue; } for(var w=0;w<servers[v].length;w++){ $("autologin"+servers[v][w]).style.backgroundColor="white"; } GM_setValue(v+"_sessionlost",true); } now=Math.floor((new Date()).getTime()/1000); GM_setValue("loginbusy",now); counter=5; autologinLoop(); },5000); }else{ GM_setValue("loginbusy",0); submit_login(c); } } } window.setTimeout(autologinLoop,500); } newdiv=null;newbutton=null; } }catch(err){ GM_logError("do_login\n"+err); } } //*********************************************************************************************************** // DOMContentLoaded function startScript(){ try{ var err_trace="init"; unsafeData.beraterVersion=VERSION; err_trace="Localization"; if(top.unsafeData.COUNTRY){ COUNTRY=top.unsafeData.COUNTRY; LANGUAGE=top.unsafeData.LANGUAGE; delimThou=top.unsafeData.delimThou; regDelimThou=top.unsafeData.regDelimThou; regDelimThouShift=top.unsafeData.regDelimThouShift; regDelimThouDelete=top.unsafeData.regDelimThouDelete; delimDeci=top.unsafeData.delimDeci; regDelimDeci=top.unsafeData.regDelimDeci; dateFormatDM=top.unsafeData.dateFormatDM; dateFormatDMY=top.unsafeData.dateFormatDMY; }else{ if(location.hostname.match(/^(|www\.|s\d+\.)myfreefarm.de$/)){ COUNTRY="DE"; LANGUAGE="de"; }else if(location.hostname.match(/^(|www\.|s\d+\.)au\.myfreefarm.com$/)){ COUNTRY="AU"; LANGUAGE="en"; delimThou=","; regDelimThou=","; regDelimThouShift="([\\d,])(\\d),(\\d{1,2}\\D)"; regDelimThouDelete="(\\d),(,*)(\\d{1,2}\\D)"; delimDeci="."; regDelimDeci="\\."; }else if(location.hostname.match(/^(|www\.|s\d+\.)myfreefarm.ir$/)){ COUNTRY="IR"; LANGUAGE="en"; delimThou=","; regDelimThou=","; regDelimThouShift="([\\d,])(\\d),(\\d{1,2}\\D)"; regDelimThouDelete="(\\d),(,*)(\\d{1,2}\\D)"; delimDeci="."; regDelimDeci="\\."; }else if(location.hostname.match(/^(|www\.|s\d+\.)myfreefarm.co.nz$/)){ COUNTRY="NZ"; LANGUAGE="en"; delimThou=","; regDelimThou=","; regDelimThouShift="([\\d,])(\\d),(\\d{1,2}\\D)"; regDelimThouDelete="(\\d),(,*)(\\d{1,2}\\D)"; delimDeci="."; regDelimDeci="\\."; }else if(location.hostname.match(/^(|www\.|s\d+\.)myfreefarm.co.uk$/)){ COUNTRY="UK"; LANGUAGE="en"; delimThou=","; regDelimThou=","; regDelimThouShift="([\\d,])(\\d),(\\d{1,2}\\D)"; regDelimThouDelete="(\\d),(,*)(\\d{1,2}\\D)"; delimDeci="."; regDelimDeci="\\."; }else if(location.hostname.match(/^(|www\.|s\d+\.)myfreefarm.com$/)){ COUNTRY="US"; LANGUAGE="en"; delimThou=","; regDelimThou=","; regDelimThouShift="([\\d,])(\\d),(\\d{1,2}\\D)"; regDelimThouDelete="(\\d),(,*)(\\d{1,2}\\D)"; delimDeci="."; regDelimDeci="\\."; }else{ GM_logWarning("Language pack is missing!"); } top.unsafeData.COUNTRY=COUNTRY; top.unsafeData.LANGUAGE=LANGUAGE; top.unsafeData.delimThou=delimThou; top.unsafeData.regDelimThou=regDelimThou; top.unsafeData.regDelimThouShift=regDelimThouShift; top.unsafeData.regDelimThouDelete=regDelimThouDelete; top.unsafeData.delimDeci=delimDeci; top.unsafeData.regDelimDeci=regDelimDeci; top.unsafeData.dateFormatDM=dateFormatDM; top.unsafeData.dateFormatDMY=dateFormatDMY; } err_trace="Texts"; if(top.unsafeData.texte==undefined){ top.unsafeData.texte=texte; }else{ texte=top.unsafeData.texte; } if(top.unsafeData.texte["de"]==undefined){ texte["de"]=new Object(); texte["de"]["msgMarketsaleContent"]="(.*) hat am Marktplatz (\\d+)x (.*?) von dir<br> für (.*?) kT gekauft\\."; texte["de"]["msgContractsaleContent"]="(.*) hat einen Vertrag von dir unterzeichnet!<br><br> Folgende Produkte wurden verkauft:<br>(.*?)<br> Die Vertragssumme von (.*?) kT wurde deinem Konto gutgeschrieben\\."; texte["de"]["msgContractsaleList"]="(\\d+)x (.+?)<br>"; texte["de"]["msgFriend"]="(.+) m"+o_dots+"chte dich als Freund hinzuf"+u_dots+"gen"; texte["de"]["above"]="davor"; texte["de"]["absolute"]="absolut"; texte["de"]["accountActive"]="Account aktiv"; texte["de"]["accounts"]="Accounts"; texte["de"]["activation"]="Freischaltung"; texte["de"]["additionalFarmi"]="%1% Zusatzfarmi t"+a_dots+"glich"; texte["de"]["additionalForestFarmiSlot"]="%1% Zusatzplatz in der Waldfarmi-Warteschlange"; texte["de"]["additionalLogCapacity"]="Erh"+o_dots+"hung der Lagerkapazit"+a_dots+"t St"+a_dots+"mme um %1%"; texte["de"]["advertisingEnds"]="Werbung endet heute"; texte["de"]["adviser"]="Berater"; texte["de"]["afterFee"]="abzgl Geb"+u_dots+"hr"; texte["de"]["alertSetPriceNone"]="M"+o_dots+"chtest du wirklich keinen Preis f"+u_dots+"r %PRODUCT% setzen?"; texte["de"]["alertSetPriceOverNPC"]="M"+o_dots+"chtest du wirklich den Preis %PRICE% f"+u_dots+"r %PRODUCT% setzen?<br>Dieser ist h"+o_dots+"her als der NPC-Preis %NPC%."; texte["de"]["alertSetPriceOverObs"]="M"+o_dots+"chtest du wirklich den Preis %PRICE% f"+u_dots+"r %PRODUCT% setzen?<br>Dieser ist viel h"+o_dots+"her als der beobachtete Preis %OBS%."; texte["de"]["alertSetPriceUnderObs"]="M"+o_dots+"chtest du wirklich den Preis %PRICE% f"+u_dots+"r %PRODUCT% setzen?<br>Dieser ist viel niedriger als der beobachtete Preis %OBS%."; texte["de"]["alertWillLowRack"]="Achtung! Dies wird deinen Lagerbestand unter den Minimalwert bringen!"; texte["de"]["all"]="Alle"; texte["de"]["autologinAllOk"]="Alle Accounts eingeloggt."; texte["de"]["autologinChecking"]="Ermittle aktive Sessions.<br>Bitte %1% Sekunden warten<br>..."; texte["de"]["boughtTickets"]="Gekaufte Tickets"; texte["de"]["buy"]="Kauf"; texte["de"]["buyers"]="K"+a_dots+"ufer"; texte["de"]["calcTo"]="Berechne bis"; texte["de"]["carpentry"]="Schreinerei"; texte["de"]["city"]="Stadt"; texte["de"]["change"]=A_dots+"nderung"; texte["de"]["clearFilter"]="Filter entfernen"; texte["de"]["click"]="Klick"; texte["de"]["clickAlt"]="Alt+Klick"; texte["de"]["clickCtrl"]="Strg+Klick"; texte["de"]["clickDouble"]="Doppel-Klick"; texte["de"]["clickToChange"]="Klick um zu "+a_dots+"ndern"; texte["de"]["commission"] = "Geb"+u_dots+"hr"; texte["de"]["coins"]=unsafeWindow.t_coins; texte["de"]["confirmUseObservedPrices"]="Es werden die beobachteten Preise eingetragen. Die eigenen gehen dabei verloren ..."; texte["de"]["confirmChangelogVersion"]="Du hast eine neue Version des Berater-Scriptes installiert.<br>Die Version %1% beinhaltet folgende "+A_dots+"nderungen:"; texte["de"]["contract"]="Vertrag"; texte["de"]["contractsReceived"]="Erhaltene Vertr"+a_dots+"ge"; texte["de"]["contractsSent"]="Gesendete Vertr"+a_dots+"ge"; texte["de"]["couldNotGetPlace"]="Dein Platz konnte nicht bestimmt werden."; texte["de"]["couldNotGetUpdateInfoOfX"]="Update-Informationen f"+u_dots+"r %1% konnten nicht bestimmt werden." texte["de"]["cropped"]="Geerntet"; texte["de"]["currentOffers"]="Aktuelle Angebote"; texte["de"]["dailyRuns"]="T"+a_dots+"gl L"+a_dots+"ufe"; texte["de"]["dailyTicket"]="T"+a_dots+"gliches Ticket"; texte["de"]["dailyYield"]="T"+a_dots+"gl Ertrag"; texte["de"]["date"]="Datum"; texte["de"]["day"]="Tag"; texte["de"]["day0"]="Heute"; texte["de"]["day1"]="Morgen"; texte["de"]["day2"]=U_dots+"bermorgen"; texte["de"]["default"]="Default"; texte["de"]["delete"]="L"+o_dots+"schen"; texte["de"]["demand"]="Forderung"; texte["de"]["detail"]="Detail"; texte["de"]["donkey"]="Waltraud"; texte["de"]["duration"]="Dauer"; texte["de"]["editPrice"]="Preis "+a_dots+"ndern"; texte["de"]["emptyField"]="Feld leer!"; texte["de"]["exchangedLots"]="Eingel"+o_dots+"ste Lose"; texte["de"]["farm"]="Farm"; texte["de"]["farmersmarket"]=unsafeWindow.t_farmers_market; texte["de"]["farmX"]="%1%. Farm"; texte["de"]["farmi"]="Farmi"; texte["de"]["farmis"]="Farmis"; texte["de"]["farmpedia"]="FarmPedia"; texte["de"]["farmpediaUrl"]="http://farmpedia.myfreefarm.de/"; texte["de"]["farmzone"]="Bauplatz %1% der %2%. Farm"; texte["de"]["feed"]="Futter"; texte["de"]["filter"]="Filter"; texte["de"]["filterForX"]="Nach %1% filtern"; texte["de"]["finished"]="Fertig"; texte["de"]["foodworld"]=unsafeWindow.foodworld_title; texte["de"]["forest"]="Wald"; texte["de"]["forestry"]="Baumerei"; texte["de"]["formatNumbers"]="Formatiere Zahlen"; texte["de"]["formulaType"]=["Prod","+val","+pts"]; // TODO texte texte["de"]["fl1"]="Blumenwiese"; texte["de"]["fl2"]="Blumenwerkstatt"; texte["de"]["fl3"]="Monsterfruchtzucht"; texte["de"]["fl6"]="Wettmampfen"; texte["de"]["fw1"]="Getr"+a_dots+"nkebude"; texte["de"]["fw2"]="Imbissbude"; texte["de"]["fw3"]="Konditorei"; texte["de"]["gamecurrency"]=unsafeWindow.gamecurrency; texte["de"]["gain"]="Erzeugnis"; texte["de"]["general"]="Allgemein"; texte["de"]["given"]="Gegeben"; texte["de"]["goToDonkey"]="Zum Goldesel Waltraud"; texte["de"]["goToLottery"]="Zur Lotterie"; texte["de"]["goToMarket"]="Zum Markt"; texte["de"]["goToMarketOfX"]="Zum %1%-Markt"; texte["de"]["goToMarketstall"]="Zum Marktstand"; texte["de"]["goToPage"]="gehe zu Seite"; texte["de"]["goToRank"]="Gehe zu Platz"; texte["de"]["goToZoneX"]="Gehe zur Zone %1%"; texte["de"]["goods"]="Waren"; texte["de"]["hide"]="ausblenden"; texte["de"]["highlightProducts"]="Produkte am Markt markieren"; texte["de"]["highlightUser"]="User am Markt markieren"; texte["de"]["hotkeys"]="Hotkeys"; texte["de"]["idle"]="unbesch"+a_dots+"ftigt !!"; texte["de"]["inStock"]="im Lager"; texte["de"]["informationIsMissing"]="Es fehlen Informationen." texte["de"]["ingredients"]="Zutaten"; texte["de"]["invalidServer"]="Ung"+u_dots+"ltiger Server"; texte["de"]["inventory"]="Bestand"; texte["de"]["keptLots"]="Behaltene Lose"; texte["de"]["level"]="Level"; texte["de"]["levelTooLow"]="Dein Level ist zu niedrig"; texte["de"]["levelXneeded"]="Level %1% ben"+o_dots+"tigt"; texte["de"]["load"]="Laden"; texte["de"]["loading"]="Lade"; texte["de"]["localTime"]="Lokale Zeit"; texte["de"]["lodge"]="Forsth"+u_dots+"tte"; texte["de"]["login"]="Umloggen"; texte["de"]["logDonkey"]="Goldesel Waltraud Log"; texte["de"]["lotteryLog"]="Lotterie Log"; texte["de"]["lvl"]="Lvl"; texte["de"]["manageVariables"]="Variablen verwalten"; texte["de"]["market"]="Markt"; texte["de"]["marketPrice"]="Marktpreis"; texte["de"]["marketplace"]="Marktplatz"; texte["de"]["marketstall"]="Marktstand"; texte["de"]["megafield"]="G"+u_dots+"terhof"; texte["de"]["messages"]="Nachrichten"; texte["de"]["minRack"]="Min Lager"; texte["de"]["minRackamount"]="Minimaler Lagerbestand"; texte["de"]["missing"]="Fehlt"; texte["de"]["money"]="Geld"; texte["de"]["msgUpdateX"]="Es ist eine neue Version von %1% verf"+u_dots+"gbar. M"+o_dots+"chtest du diese installieren?"; texte["de"]["name"]="Name"; texte["de"]["newLevelReached"]="Herzlichen Gl"+u_dots+"ckwunsch!<br>Du bist ein Level aufgestiegen!"; texte["de"]["nextMessage"]="n"+a_dots+"chste Nachricht"; texte["de"]["no"]="Nein"; texte["de"]["NPC"]="NPC"; texte["de"]["NPCprice"]="NPC-Preis"; texte["de"]["nr"]="Nr"; texte["de"]["observed"]="beobachtet"; texte["de"]["ok"]="OK"; texte["de"]["oldOnes"]="Alte"; texte["de"]["options"]="Optionen"; texte["de"]["overNPCprice"]=u_dots+"ber NPC-Preis"; texte["de"]["overX"]=u_dots+"ber %1%"; texte["de"]["overview"]=U_dots+"bersicht"; texte["de"]["password"]="Passwort"; texte["de"]["pleaseOpenX"]="Bitte %1% "+o_dots+"ffnen."; texte["de"]["pleaseWait"]="Bitte warten."; texte["de"]["portalLogin"]="Portal-Login"; texte["de"]["points"]="Punkte"; texte["de"]["powerups"]="Power-Ups"; texte["de"]["previousMessage"]="vorige Nachricht"; texte["de"]["price"]="Preis"; texte["de"]["prices"]="Preise"; texte["de"]["product"]="Produkt"; texte["de"]["productOverview"]="Produkt "+U_dots+"bersicht"; texte["de"]["productTimeSaving"]="%1% Minuten Zeitersparnis auf %2%"; texte["de"]["production"]="Produktion"; texte["de"]["products"]="Produkte"; texte["de"]["profit"]="Gewinn"; texte["de"]["profitTable"]="Profit pro Zone pro Tag"; texte["de"]["quantity"]="Menge"; texte["de"]["quest_foodworld"]="Picknickarea-Questreihe"; texte["de"]["quest_forestry"]="Baumerei-Questreihe"; texte["de"]["quest_main"]="Farm-Questreihe"; texte["de"]["questfoodworld1"]="Picknickarea-Questreihe"; texte["de"]["questforestry1"]="1. Baumerei-Questreihe"; texte["de"]["questforestry2"]="2. Baumerei-Questreihe"; texte["de"]["questmain1"]="1. Farm-Questreihe"; texte["de"]["questmain2"]="2. Farm-Questreihe"; texte["de"]["quests"]="Quests"; texte["de"]["rackX"]="%1%. Regal"; texte["de"]["rank"]="Platz"; texte["de"]["readAll"]="Alle lesen"; texte["de"]["readyAtX"]="Fertig um %1%"; texte["de"]["readyAtX_day1"]="Morgen fertig um %1%"; texte["de"]["readyAtX_day2"]=U_dots+"bermorgen fertig um %1%"; texte["de"]["readySinceX"]="Fertig seit %1%"; texte["de"]["recipes"]="Rezepte"; texte["de"]["recursive"]="Rekursiv ben"+o_dots+"tigt"; texte["de"]["relative"]="relativ"; texte["de"]["relogin"]="Session endet bald.<br>Neuer Login in %1%."; texte["de"]["requestingUpdateInfoOfX"]="Fordere Update-Informationen f"+u_dots+"r %1% an ..." texte["de"]["requestingUserStatistic"]="Fordere Benutzer-Statistik an ..."; texte["de"]["requirement"]="Bedarf"; texte["de"]["requirementPerProduction"]="Bedarf pro Produktion"; texte["de"]["reward"]="Belohnung"; texte["de"]["salesLog"]="Verk"+a_dots+"ufe Log"; texte["de"]["save"]="Speichern"; texte["de"]["saveAsTemplate"]="als Vorlage speichern"; texte["de"]["sawmill"]="S"+a_dots+"gewerk"; texte["de"]["scriptHomepage"]="Scripthomepage"; texte["de"]["searchPlayer"]="Spieler suchen"; texte["de"]["sendContract"]="Vertrag schicken"; texte["de"]["sendContractAgain"]="Vertrag noch einmal schicken"; texte["de"]["sentContractNrX"]="Vertrag Nr %1% gesendet." texte["de"]["sendingXObservedPricesToServer"]="Sende %1% beobachtete Preise an Server ..."; texte["de"]["server"]="Server"; texte["de"]["serverTime"]="Zeit des Servers"; texte["de"]["sessionEnd"]="Ende der Session um %1%<br>Klick f"+u_dots+"r neuen Login"; texte["de"]["SGH"]="SGH"; // Short for the seller of plants texte["de"]["shadowboxitem"]="Setzkastenitem"; texte["de"]["shortHours"]="h"; texte["de"]["shortOClock"]="Uhr"; texte["de"]["shouldReload"]="Du solltest die Seite neu laden."; texte["de"]["showAll"]="Alle zeigen"; texte["de"]["showChangelog"]="Zeige ChangeLog"; texte["de"]["showLog"]="Zeige Log"; texte["de"]["showMissingProducts"]="Zeige fehlende Produkte"; texte["de"]["showPasswords"]="zeige Passw"+o_dots+"rter"; texte["de"]["sinceX"]="seit %1%"; texte["de"]["single"]="Einzel"; texte["de"]["start"]="Start"; texte["de"]["stat_days1"]="1 Tag"; texte["de"]["stat_days3"]="3 Tage"; texte["de"]["stat_days5"]="5 Tage"; texte["de"]["stat_days7"]="7 Tage"; texte["de"]["stat_gamefield"]="Spielfeld zeigen"; texte["de"]["stat_stats"]="Statistik zeigen"; texte["de"]["statistics"]="Statistik"; texte["de"]["stock"]="Lager"; texte["de"]["stockValue"]="Lagerwert"; texte["de"]["stockXlow"]="Lagerbestand %1% niedrig"; texte["de"]["stockXmissing"]="Lagerbestand %1% fehlt!!!"; texte["de"]["storeXinContract"]="%1% im Vertrag auslagern"; texte["de"]["summarize"]="Summiere"; texte["de"]["takeObservedPrices"]="Nimm beobachtete Preise"; texte["de"]["time"]="Zeit"; texte["de"]["title"]="Titel"; texte["de"]["toMessage"]="zur Nachricht"; texte["de"]["toSGH"]="Zum Saatguth"+a_dots+"ndler"; texte["de"]["total"]="Total"; texte["de"]["turnover"]="Umsatz"; texte["de"]["unitPrice"]="St"+u_dots+"ckpreis"; texte["de"]["updateOfXAvailable"]="Es ist eine neue Version von %1% verf"+u_dots+"gbar. Die Installation hast du abgelehnt." texte["de"]["upgradeForX"]="ausbauen f"+u_dots+"r %1%"; texte["de"]["upgradeLevel"]="Ausbaustufe"; texte["de"]["upjersAdvertising"]="Upjers-Werbung"; texte["de"]["useQuestProducts"]= "Nimm aktuelle Quest-Waren"; texte["de"]["useWildcard"]= "Verwende * um einen oder mehrere Buchstaben zu entsprechen."; texte["de"]["value"]="Wert"; texte["de"]["version"]="Version"; texte["de"]["waterBonus"]="%1%% Gie"+sz+"bonus"; texte["de"]["waterNeeded"]="Wasser ben"+o_dots+"tigt"; texte["de"]["waterNeededAtX"]="Wasser ben"+o_dots+"tigt um %1%"; texte["de"]["waterNeededAtX_day1"]="Morgen Wasser ben"+o_dots+"tigt um %1%"; texte["de"]["wateringFeature"]="Gie"+sz+"funktion"; texte["de"]["windmill"]="M"+u_dots+"hle"; texte["de"]["writeMessage"]="Nachricht schreiben"; texte["de"]["XIsUpToDate"]="%1% ist up-to-date." texte["de"]["yes"]="Ja"; texte["de"]["yield"]="Ertrag"; texte["de"]["yieldPerProduction"]="Ertrag pro Produktion"; texte["de"]["youAreOnRankX"]="Du bist auf Platz %1%."; // category texte["de"]["category_c"]=texte["de"]["coins"]; texte["de"]["category_v"]="Pflanzen"; texte["de"]["category_e"]="Fortgeschrittene Produkte"; texte["de"]["category_z"]=unsafeWindow.rack_deco; texte["de"]["category_o"]=unsafeWindow.rack_oil; texte["de"]["category_fw"]=unsafeWindow.rack_foodworld; texte["de"]["category_fw1"]="Getr"+a_dots+"nke"; texte["de"]["category_fw2"]="Speisen"; texte["de"]["category_fw3"]="Torten und Kuchen"; texte["de"]["category_fw4"]="noch nicht verf"+u_dots+"gbar"; texte["de"]["category_fl"]="Blumen"; texte["de"]["category_fla"]="Gestecke"; texte["de"]["category_f1"]="Setzlinge"; texte["de"]["category_f2"]="St"+a_dots+"mme"; texte["de"]["category_f3"]="S"+a_dots+"gewerk Produkte"; texte["de"]["category_f4"]="Schreinerei Produkte"; texte["de"]["category_f5"]="Bauernhaus Holzprodukte"; texte["de"]["category_r0"]="Rezepte Produkt"; texte["de"]["category_r1"]="Rezepte Erh"+o_dots+"hung Ertrag"; texte["de"]["category_r2"]="Rezepte Erh"+o_dots+"hung Punkte"; texte["de"]["category_p0"]="Power-Ups Produkt"; texte["de"]["category_p1"]="Power-Ups Erh"+o_dots+"hung Ertrag"; texte["de"]["category_p2"]="Power-Ups Erh"+o_dots+"hung Punkte"; // settings texte["de"]["settings_valAutoWater"]=["Automatisch gie"+sz+"en","Sagt ja der Name schon: Nach dem Pflanzen wird automatisch gegossen, wenn du den 'Alles gie"+sz+"en' besitzt (Premium)."]; texte["de"]["settings_valAssumeWater"]=["Gie"+sz+"en annehmen","Dies ist wichtig f"+u_dots+"r Pflanzen, die l"+a_dots+"nger als 24h wachsen. Die Berechnung der Ernte-Zeit nimmt an, dass stets gegossen wird."]; texte["de"]["settings_valAutoCrop"]=["Automatisch ernten","Wie zuvor auch: Es wird beim "+O_dots+"ffnen der Ackers geerntet, falls n"+o_dots+"tig."]; texte["de"]["settings_valWaterNeeded"]=["Gie"+sz+"en n"+o_dots+"tig","Soll angezeigt werden, dass dein Acker nicht gegossen ist?"]; texte["de"]["settings_valCropMsg"]=["Erntemeldung klicken","Du magst die l"+a_dots+"stige Erntemeldung mit dem Schwein nicht? Hier wirst du sie los."]; texte["de"]["settings_valLimitEmptyFields"]=["Leere Felder","Es werden unbepflanzte Felder auf deinem Acker erkannt. Sind dies mehr als hier angegeben, wird der Acker als unbenutzt gemeldet."]; texte["de"]["settings_valLimitEmptyFields_forest"]=["Leere Felder Wald","If the number of unplanted areas in your field exceeds this number, the field will be shown as empty."]; texte["de"]["settings_valMoveAnimals"]=["Bewege Tiere",""]; texte["de"]["settings_valContractLogAmount"]=["Anzahl gemerkte Vertr"+a_dots+"ge","Deine letzten erhaltenen und gesendeten Vertr"+a_dots+"ge werden gespeichert und somit kann ein Verlauf angezeigt werden."]; texte["de"]["settings_valFarmiLimits"]=["Farmi Grenzen","Die Farmis sind in 3 F"+a_dots+"lle markiert, je nachdem wie gut ihre Bezahl-Rate ist."]; texte["de"]["settings_valFarmiMiniInfo"]=["Farmi Mini Info","Zeigt einen kleinen Kreis unter jedem Farmi mit der jeweiligen Klasse der Bezahl-Rate."]; texte["de"]["settings_valMinRackMan"]=["Detail Konfiguration","Du editierst die Anzahl selbst *hier*"]; texte["de"]["settings_valMinRack"]=[,"Ein Produkt wird markiert, falls der Lagerbestand unter diese Grenze f"+a_dots+"llt. Du kannst verschiedene Werte abh"+a_dots+"ngig von der Kategorie einstellen."]; texte["de"]["settings_valMinRackPlantsize"]=["Pflanzengr"+o_dots+sz+"e einrechnen","Zum Beispiel braucht Getreide nur den halben Bestand."]; texte["de"]["settings_valMinRackGrowing"]=["Ernteprodukte","Beachtet zus"+a_dots+"tzlich die Produkte in Produktion und in den fertigen Powerups."]; texte["de"]["settings_valMinRackQuest"]=["Quest-Produkte","Beachtet zus"+a_dots+"tzlich die Menge der Questprodukte."]; texte["de"]["settings_valMinRackRecursive"]=["Recursive products","Add the required products needed to make missing products, and calculate these again for the required proucts.(used by forestry products)"]; texte["de"]["settings_valMinRackFarmis"]=["Farmi-Produkte","Beachtet zus"+a_dots+"tzlich die Menge der Produkte, die deine Farmis verlangen. Dabei gelten nur diejenigen, die besser als die untere Grenze bezahlen."]; texte["de"]["settings_valMinRackForestryFarmis"]=["Forestry farmie products","Adds the amount of the products wanted by the forestry farmies."]; texte["de"]["settings_protectMinRack"]=["Marktschutz","Verhindert, dass die Warenmenge beim Marktverkauf den minimalen Lagerbestand unterschreitet."]; texte["de"]["settings_valBuyingLimitDown"]=["Untere Kaufmarkierung",""]; texte["de"]["settings_valBuyingLimit"]=["Obere Kaufgrenze","Du kannst am Markt nur Produkte kaufen die maximal der Prozentgrenze entsprechen. Dies sch"+u_dots+"tzt dich vor dem versehentlichen Kauf "+u_dots+"bertrieben teurer Waren."]; texte["de"]["settings_valBuyingLimitNPC"]=["Nur billiger als NPC kaufen",""]; texte["de"]["settings_valSellingLimit"]=["Verkaufgrenzen","Auch dein Verkauf wird gesch"+u_dots+"tzt, so dass du weder zu billig noch zu teuer verkaufst."]; texte["de"]["settings_valJoinPrices"]=["Ein Preisfeld","Verbindet die Preis-Eingabefelder beim Marktstand"]; texte["de"]["settings_valQuicklinks"]=["Quicklinks am Markt anzeigen","Quicklinks am Markt anzeigen"]; texte["de"]["settings_valUseObservedPrices"]=["Benutze beobachtete Preise","Wenn du dich durch den Markt klickst, werden die Preise beobachtet. Ein berechneter Preis ist in der Preisliste zu sehen. Soll dieser automatisch "+u_dots+"bernommen werden?"]; texte["de"]["settings_valSendStatistics"]=["Sende Statistiken","Unterst"+u_dots+"tze den <a href='http://mff.metrax.eu/' target='_blank'>Statistik-Server</a>. Es werden keine privaten Daten gesendet!"]; texte["de"]["settings_valPrivateMessages"]=["Anzahl gemerkte Privatnachrichten","Deine letzten privaten Nachrichten werden gespeichert und somit kann ein Nachrichten-Verlauf mit einem Kontakt angezeigt werden."]; texte["de"]["settings_valMarketMessages"]=["Anzahl gemerkte Marktnachrichten","Es bleiben auch alte System-Nachrichten in diesem Speicher, selbst wenn sie "+a_dots+"lter als die maximalen 7 Tage sind."]; texte["de"]["settings_valMessageRe"]=["Betreff k"+u_dots+"rzen","Ersetzt im Betreff \"Re:Re:\" durch \"Re:\", wenn du eine Antwort schreibst."]; texte["de"]["settings_valMessagesSystemMarkRead"]=["Systemnachrichten lesen","Systemnachrichten werden automatisch als gelesen markiert."]; texte["de"]["settings_valFoodworldFarmiPlacing"]=["Picknickarea Farmis platzieren","Angenommene Picknickarea Farmis werden automatisch auf einen freien Sitzplatz gewiesen."]; texte["de"]["settings_valAutoLogin"]=["Automatisch einloggen","Sobald Nutzerdaten und Passwort eingegeben sind, werden die Accounts wieder eingeloggt. Somit kann wieder gef"+u_dots+"ttert, geerntet, gegossen und gepflanzt werden. Es m"+u_dots+"ssen Popups erlaubt werden bei mehreren Accounts."]; texte["de"]["settings_valUpdate"]=["Update","Es wird gepr"+u_dots+"ft, ob eine neuere Version dieses Scriptes verf"+u_dots+"gbar ist."]; texte["de"]["settings_valServerTimeOffset"]=["Zeit des Servers",""]; texte["de"]["settings_valGamecursor"]=["Spiel-Cursor","Benutze die spieleigenen Cursor an Stelle deiner System-Cursor."]; texte["de"]["settings_valDrag"]=["Verschieben","Erlaube das Bewegen der Fenster (obere linke Ecke)."]; texte["de"]["settings_valClickErrorbox"]=["Verstecke Fehlerbox","Einige Spieler haben Probleme mit der Fehlerbox. Beachte, dass diese Meldung normalerweise sinnvoll ist!"]; texte["de"]["settings_valHotkeys"]=["Hotkeys","Benutze Hotkeys um schnell durch das Spiel zu navigieren. Schau in die Hilfe."]; texte["de"]["settings_hotkeymap"]={"prevPage":"vorige Nachricht, Zone, ...","nextPage":"n"+a_dots+"chste Nachricht, Zone, ...","farm1":"1. Farm","farm2":"2. Farm","farm3":"3. Farm","guild":"Club","city1":"Klein Muhstein","city2":"Teichlingen","farmilog":"Farmi-Log","help":"Hilfe","market":"Marktplatz","marketstand":"Marktstand","messages":"Nachrichten","options":"Optionen","profit":"Profit Kalkulation","sgh":"Saatguth"+a_dots+"ndler","overview":U_dots+"bersicht","contract":"Vertr"+a_dots+"ge","systemmessage":"(n"+a_dots+"chste ungelesene) Systemnachricht"}; texte["de"]["settings_valzoneAddToGlobalTime"]=["Integration","Soll die Zeit in die Global-Zeit einbezogen werden?"]; texte["de"]["settings_valGlobaltimeShowCroppedZone"]=["Beachte geerntete Zonen","Sollen geerntete Zonen in die globale Zeit einbezogen werden?"]; texte["de"]["settings_cacheReset"]=["Cache reset","Alle Informationen "+u_dots+"ber deine Zonen werden gel"+o_dots+"scht ..."]; // help texte["de"]["help_0"]=[,"This is small introduction to the functions of the Adviser-Script. Not all changes are written here, go find them yourself ... Sometimes a mouse-over helps. <br>At the bottom you see a button to visit the <a href=\""+GM_Home+"\" target=\"_blank\">homepage</a>. Next to it, there is the button for the options. You should look at them and configure as you desire.<br>Generally the script only knows what you have seen. So just visit the field if something is wrong."]; texte["de"]["help_1"]=["The Zones","The fields are observed while you see them. The script saves the plants, times and watering. So on the farm view this can be displayed. Each zone has a time counter at its top to show you when it is ready.<br>If you own the planting helper, you can access it directly from opened field. At the top of an opened zone you can navigate directly to zones of the same type."]; texte["de"]["help_2"]=["The Overview","Click the pig on the top and you will see an overview of your complete farm. Each zone, its output (product and points) and the next time of work are displayed. Also your total crop is shown. Below you see the wishes of your farmies. You can click each zone or farmie to navigate there. If you are run out of a product, it can take you directly to the market place."]; texte["de"]["help_3"]=["Blue Bar","Your points are kept daily. At the bottom you see a bar displaying the current and past level. Each white and red (sunday) line is a day. If you click it you get a detailed table and perhaps a hint if you are lack of a product."]; texte["de"]["help_4"]=["Shelf","Here informations of prices and value are added. The amount are reformatted to better style. At the bottom you have an input to seach an other player."]; texte["de"]["help_5"]=["Profit Calculation","Next to the bottom of the shelf you can click <img src=\""+GFX+"buildingupdatebutton_off.png\" style=\"width: 15px;height: 15px;\">. This shows you a table calculating times and profits of your products. Click the stars to change the upgrade levels. Click the headline to sort."]; texte["de"]["help_6"]=["Farmies","The bubbles of the farmies are expanded by a calculation if they pay enough. If your product amount runs too low, the product is marked. Click the house next to the farmies to see the ones of the last month. At the blue bar on the right you can set which farmies you send away. At the top a calculation is made, so you can decide if an advertising is profitable."]; texte["de"]["help_7"]=["Hotkeys","You can quickly move to a place by pressing <i>Alt</i>+... See the options!"]; texte["de"]["help_8"]=["Market place","On the market place you are \"protected\", means that you can't buy a product more expensive than in the retailer or by options set. If activated, you can directly switch to a product page by the incoming window on the right. At the top you can step to the next/previous product and see your current amount.<br>You find at the bottom a very important button: the prices. It gives you a table listing your product amounts, values and the prices that are everywhere used. So keep attention they are set right! An \"observed\" price is kept when you visit a market page of a single product.<br>On your market stall a few usefull values are displayed and your last offer was kept and is set now."]; texte["de"]["help_9"]=["Messages","Your sales are kept and directly displayed - no need to open a message two times! Note the \"Read all\" and \"Log\" buttons. Your private messages are kept, too. So no need to look for the last messages of the current contact."]; texte["de"]["help_10"]=["Contracts","They are kept, too. While creating a contact an input displays the value of the entered product. Enter first the price and then the amount to get inverse the amount. You can submit the same contract multiple times!"]; texte["de"]["help_11"]=["Account Managing","You can save all your accounts in the options. So you can login easily in each one by the displayed buttons on the starting page. Note that you can switch directly the accounts at the same server."]; } if(top.unsafeData.texte["en"]==undefined){ texte["en"]=new Object(); texte["en"]["msgMarketsaleContent"]="(.*) bought (\\d+)x (.*?) for<br> (.*?) pD from you\\."; // The text where the information is stated. The information has to be replaced by "(.*?)". texte["en"]["msgContractsaleContent"]="(.*) has signed a contract of yours!<br><br> The following products have been sold:<br>(.*?)<br> The amount of (.*?) pD has been credited to your account\\."; // The text where the general information is stated. The information has to be replaced by "(.*?)". texte["en"]["msgContractsaleList"]="(\\d+)x (.*?)<br>"; // The line-pattern for the detailed selling list texte["en"]["msgFriend"]="(.+) would like to add you as a friend"; // The subject. The person has to be replaced by "(.+)" texte["en"]["above"]="above"; texte["en"]["absolute"]="absolute"; texte["en"]["accountActive"]="Account active"; texte["en"]["accounts"]="Accounts"; texte["en"]["activation"]="Activation"; texte["en"]["additionalFarmi"]="%1% additional farmie daily"; texte["en"]["additionalForestFarmiSlot"]="%1% additional place in the forest farmi waiting queue"; texte["en"]["additionalLogCapacity"]="Rack capacity for logs increases of %1%"; texte["en"]["advertisingEnds"]="Advertising ends today"; texte["en"]["adviser"]="Adviser"; texte["en"]["afterFee"]="After Fee"; texte["en"]["alertSetPriceNone"]="Do you really want to set no price for %PRODUCT%?"; texte["en"]["alertSetPriceOverNPC"]="Do you really want to set the price of %PRICE% for %PRODUCT%?<br>It is higher than the NPC-value of %NPC%."; texte["en"]["alertSetPriceOverObs"]="Do you really want to set the price of %PRICE% for %PRODUCT%?<br>It is much higher than the observed value of %OBS%."; texte["en"]["alertSetPriceUnderObs"]="Do you really want to set the price of %PRICE% for %PRODUCT%?<br>It is much lower than the observed value of %OBS%."; texte["en"]["alertWillLowRack"]="Attention! This will drop your stock below the minimal value!"; texte["en"]["all"]="All"; texte["en"]["autologinAllOk"]="All accounts logged in."; texte["en"]["autologinChecking"]="Checking active sessions. Please wait %1% seconds<br>..."; texte["en"]["boughtTickets"]="Bought tickets"; texte["en"]["buy"]="Buy"; texte["en"]["buyers"]="Buyers"; texte["en"]["calcTo"]="Calculate to"; texte["en"]["carpentry"]="Carpentry"; texte["en"]["city"]="City"; texte["en"]["change"]="Change"; texte["en"]["clearFilter"]="Clear filter"; texte["en"]["click"]="Click"; texte["en"]["clickAlt"]="Alt+Click"; texte["en"]["clickCtrl"]="Ctrl+Click"; texte["en"]["clickDouble"]="Double-Click"; texte["en"]["clickToChange"]="Click to change"; texte["en"]["coins"]=unsafeWindow.t_coins; texte["en"]["commission"] = "Commission"; texte["en"]["confirmUseObservedPrices"]="The observed prices will overwrite previously saved market prices ..."; texte["en"]["confirmChangelogVersion"]="You have installed a new version of the Adviser script.<br>The version %1% contains the following changes:"; texte["en"]["contract"]="Contract"; texte["en"]["contractsReceived"]="Contracts received"; texte["en"]["contractsSent"]="Contracts sent"; texte["en"]["couldNotGetRank"]="Your rank could not be determined."; texte["en"]["couldNotGetUpdateInfoOfX"]="Update information for %1% could not be determined." texte["en"]["cropped"]="Cropped"; texte["en"]["currentOffers"]="Current offers"; texte["en"]["dailyRuns"]="Daily runs"; texte["en"]["dailyTicket"]="Daily ticket"; texte["en"]["dailyYield"]="Daily yield"; texte["en"]["date"]="Date"; texte["en"]["day"]="Day"; texte["en"]["day0"]="Today"; texte["en"]["day1"]="Tomorrow"; // texte["day2"]="Day after tomorrow"; // comment it if not used in the language texte["en"]["default"]="Default"; texte["en"]["delete"]="Delete"; texte["en"]["demand"]="Demand"; texte["en"]["detail"]="Detail"; texte["en"]["donkey"]="Donkey"; texte["en"]["duration"]="duration"; texte["en"]["editPrice"]="Edit price"; texte["en"]["emptyField"]="Empty field!"; texte["en"]["exchangedLots"]="Exchanged lots"; texte["en"]["farm"]="Farm"; texte["en"]["farmersmarket"]=unsafeWindow.t_farmers_market; texte["en"]["farmX"]="%1%. farm"; texte["en"]["farmi"]="Farmie"; texte["en"]["farmis"]="Farmies"; texte["en"]["farmpedia"]="FarmPedia"; texte["en"]["farmpediaUrl"]="http://farmpedia.myfreefarm.de/"; texte["en"]["farmzone"]="Building place %1% of %2%. farm"; texte["en"]["feed"]="Feed"; texte["en"]["filter"]="Filter"; texte["en"]["filterForX"]="Filter for %1%"; texte["en"]["finished"]="Finished"; texte["en"]["foodworld"]=unsafeWindow.foodworld_title; texte["en"]["forest"]="Forest"; texte["en"]["forestry"]="Forestry"; texte["en"]["formatNumbers"]="Format numbers"; texte["en"]["formulaType"]=["Prod","+val","+pts"]; texte["en"]["fl1"]="Flower meadow"; texte["en"]["fl2"]="Flower workshop"; texte["en"]["fl3"]="Monster fruit culture"; texte["en"]["fl6"]="Speed eating"; texte["en"]["fw1"]="Soda stall"; texte["en"]["fw2"]="Snack booth"; texte["en"]["fw3"]="Pastry shop"; texte["en"]["gain"]="Gain"; texte["en"]["gamecurrency"]=unsafeWindow.gamecurrency; texte["en"]["general"]="General"; texte["en"]["given"]="Given"; texte["en"]["goToDonkey"]="Go to donkey Luke"; texte["en"]["goToLottery"]="Go to lottery"; texte["en"]["goToMarket"]="Go to market"; texte["en"]["goToMarketOfX"]="Go to market of %1%"; texte["en"]["goToMarketstall"]="Go to market stall"; texte["en"]["goToPage"]="Go to page"; texte["en"]["goToRank"]="Go to rank"; texte["en"]["goToZoneX"]="Go to zone %1%"; texte["en"]["goods"]="Goods"; texte["en"]["hide"]="hide"; texte["en"]["highlightProducts"]="Highlight products at market"; texte["en"]["highlightUser"]="Highlight user at market"; texte["en"]["hotkeys"]="Hotkeys"; texte["en"]["idle"]="idle !!"; texte["en"]["inStock"]="in stock"; texte["en"]["informationIsMissing"]="Information is missing." texte["en"]["ingredients"]="Ingredients"; texte["en"]["invalidServer"]="Invalid Server"; texte["en"]["inventory"]="Inventory"; texte["en"]["keptLots"]="Kept lots"; texte["en"]["level"]="Level"; texte["en"]["levelTooLow"]="Your level is too low"; texte["en"]["levelXneeded"]="Level %1% needed"; texte["en"]["load"]="Load"; texte["en"]["loading"]="Loading"; texte["en"]["localTime"]="Local time"; texte["en"]["lodge"]="Log cabin"; texte["en"]["login"]="Login"; texte["en"]["logDonkey"]="Donkey Luke Log"; texte["en"]["lotteryLog"]="Lottery Log"; texte["en"]["lvl"]="Lvl"; texte["en"]["manageVariables"]="Manage variables"; texte["en"]["market"]="Market"; texte["en"]["marketPrice"]="Market Price"; texte["en"]["marketplace"]="Market place"; texte["en"]["marketstall"]="Market stall"; texte["en"]["megafield"]="Megafield"; texte["en"]["messages"]="Messages"; texte["en"]["minRack"]="Min rack"; texte["en"]["minRackamount"]="Minimal rackamount"; texte["en"]["missing"]="Need"; texte["en"]["money"]="Offered"; texte["en"]["msgUpdate"]="There is a new script version of the Adviser. Install?"; texte["en"]["msgUpdateX"]="A new script version of %1% is available. Do you want to install it?"; texte["en"]["name"]="Name"; texte["en"]["newLevelReached"]="Congratulations!<br>You have reached the next level!"; texte["en"]["nextMessage"]="next message"; texte["en"]["no"]="No"; texte["en"]["NPC"]="NPC"; texte["en"]["NPCprice"]="NPC-Price"; texte["en"]["nr"]="Nr"; texte["en"]["observed"]="Observed"; texte["en"]["ok"]="OK"; texte["en"]["oldOnes"]="Old"; texte["en"]["options"]="Options"; texte["en"]["overNPCprice"]="over NPC-price"; texte["en"]["overX"]="over %1%"; texte["en"]["overview"]="overview"; texte["en"]["password"]="Password"; texte["en"]["pleaseOpenX"]="Please open %1%."; texte["en"]["points"]="Points"; texte["en"]["portalLogin"]="Portal-Login"; texte["en"]["powerups"]="Power-Ups"; texte["en"]["previousMessage"]="previous message"; texte["en"]["price"]="Price"; texte["en"]["prices"]="Prices"; texte["en"]["product"]="Product"; texte["en"]["productOverview"]="Product overview"; texte["en"]["productTimeSaving"]="%1% minutes saving for %2%"; texte["en"]["production"]="Production"; texte["en"]["products"]="Products"; texte["en"]["profit"]="Profit"; texte["en"]["profitTable"]="Profit per Zone per Day"; texte["en"]["quantity"]="Quantity"; texte["en"]["quest_foodworld"]="Picnic area quest series"; texte["en"]["quest_forestry"]="Series of quests (forestry)"; texte["en"]["quest_main"]="Series of quests (farm)"; texte["en"]["questfoodworld1"]="Picnic area quest series"; texte["en"]["questforestry1"]="1st series of quests (forestry)"; texte["en"]["questforestry2"]="2nd series of quests (forestry)"; texte["en"]["questmain1"]="1st series of quests (farm)"; texte["en"]["questmain2"]="2nd series of quests (farm)"; texte["en"]["quests"]="Quests"; texte["en"]["rackX"]="%1%. rack"; texte["en"]["rank"]="Rank"; texte["en"]["readAll"]="Read all"; texte["en"]["readyAtX"]="Ready at %1%"; // %1%=2:15+texte["shortOClock"] texte["en"]["readyAtX_day1"]="Tomorrow ready at %1%"; // texte["en"]["readyAtX_day2"]="Ready in 2days at %1%"; // comment it if not used in the language texte["en"]["readySinceX"]="Ready since %1%"; texte["en"]["recipes"]="Recipes"; texte["en"]["recursive"]="Recursive Needed"; texte["en"]["relative"]="relative"; texte["en"]["relogin"]="Session ends soon.<br>New login in %1%."; texte["en"]["requestingUpdateInfoOfX"]="Requesting update information for %1% ..." texte["en"]["requestingUserStatistic"]="Requesting user statistic ..."; texte["en"]["requirement"]="Need"; texte["en"]["requirementPerProduction"]="Requirement per production"; texte["en"]["reward"]="Reward"; texte["en"]["salesLog"]="Sales log"; texte["en"]["save"]="Save"; texte["en"]["saveAsTemplate"]="Save as template"; texte["en"]["sawmill"]="Sawmill"; texte["en"]["scriptHomepage"]="Script Homepage"; texte["en"]["searchPlayer"]="Search player"; texte["en"]["sendContract"]="Send contract"; texte["en"]["sendContractAgain"]="Send contract again"; texte["en"]["sentContractNrX"]="Sent contract no %1%." texte["en"]["sendingXObservedPricesToServer"]="Sending %1% observed prices to server ..."; texte["en"]["server"]="Server"; texte["en"]["serverTime"]="Time of server"; texte["en"]["sessionEnd"]="End of Session at %1%<br>Click for new login"; texte["en"]["SGH"]="SGH"; // Short for the seller of plants texte["en"]["shadowboxitem"]="Shadowbox item"; texte["en"]["shortHours"]="h"; texte["en"]["shortOClock"]="h"; texte["en"]["shouldReload"]="You should reload the page."; texte["en"]["showAll"]="Show all"; texte["en"]["showChangelog"]="Show changelog"; texte["en"]["showLog"]="Show log"; texte["en"]["showMissingProducts"]="Show product shortage"; texte["en"]["showPasswords"]="show passwords"; texte["en"]["sinceX"]="since %1%"; texte["en"]["single"]="Single"; texte["en"]["start"]="Start"; texte["en"]["stat_days1"]="1 day"; texte["en"]["stat_days3"]="3 days"; texte["en"]["stat_days5"]="5 days"; texte["en"]["stat_days7"]="7 days"; texte["en"]["stat_gamefield"]="Show game"; texte["en"]["stat_stats"]="Show statistics"; texte["en"]["statistics"]="Statistics"; texte["en"]["stock"]="Stock"; texte["en"]["stockValue"]="Stock value"; texte["en"]["stockXlow"]="Stock %1% low"; texte["en"]["stockXmissing"]="Stock %1% missing!!!"; texte["en"]["storeXinContract"]="Store %1% in contract"; texte["en"]["summarize"]="Summarize"; texte["en"]["takeObservedPrices"]="Take observed prices"; texte["en"]["time"]="Time"; texte["en"]["title"]="Title"; texte["en"]["toMessage"]="to message"; texte["en"]["toSGH"]="Go to shop"; texte["en"]["total"]="Total"; texte["en"]["turnover"]="Turnover"; texte["en"]["unitPrice"]="Unit price"; texte["en"]["updateOfXAvailable"]="A new script version of %1% is available. You refused to install it." texte["en"]["upgradeForX"]="upgrade for %1%"; texte["en"]["upgradeLevel"]="Upgrade level"; texte["en"]["upjersAdvertising"]="Upjers-Advertising"; texte["en"]["useQuestProducts"]= "Use current quest products"; texte["en"]["useWildcard"]= "Use * to match one or more letters."; texte["en"]["value"]="Value"; texte["en"]["version"]="Version"; texte["en"]["waterBonus"]="%1%% water bonus"; texte["en"]["waterNeeded"]="Water needed"; texte["en"]["waterNeededAtX"]="Water needed at %1%"; texte["en"]["waterNeededAtX_day1"]="Tomorrow water needed at %1%"; texte["en"]["wateringFeature"]="Watering feature"; texte["en"]["windmill"]="Windmill"; texte["en"]["writeMessage"]="write message"; texte["en"]["XIsUpToDate"]="%1% is up-to-date." texte["en"]["yes"]="Yes"; texte["en"]["yield"]="Yield"; texte["en"]["yieldPerProduction"]="Yield per production"; texte["en"]["youAreOnRankX"]="You are on rank %1%."; // category texte["en"]["category_c"]=texte["en"]["coins"]; texte["en"]["category_v"]="Plants"; texte["en"]["category_e"]="Advanced products"; texte["en"]["category_z"]=unsafeWindow.rack_deco; texte["en"]["category_o"]=unsafeWindow.rack_oil; texte["en"]["category_fw"]=unsafeWindow.rack_foodworld; texte["en"]["category_fw1"]="Drinks"; texte["en"]["category_fw2"]="Food"; texte["en"]["category_fw3"]="Cakes"; texte["en"]["category_fw4"]="not yet available"; texte["en"]["category_fl"]="Flowers"; texte["en"]["category_fla"]="Arrangements"; texte["en"]["category_f1"]="Saplings"; texte["en"]["category_f2"]="Logs"; texte["en"]["category_f3"]="Sawmill products"; texte["en"]["category_f4"]="Carpentry products"; texte["en"]["category_f5"]="Wooden farmhouse items"; texte["en"]["category_r0"]="Recipes product"; texte["en"]["category_r1"]="Recipes increade yield"; texte["en"]["category_r2"]="Recipes increade points"; texte["en"]["category_p0"]="Power-Ups Produkt"; texte["en"]["category_p1"]="Power-Ups increade yield"; texte["en"]["category_p2"]="Power-Ups increade points"; // settings texte["en"]["settings_valAutoWater"]=["Automatic watering","Plants will be watered after planting, if you have 'Water everything' (Premium)."]; texte["en"]["settings_valAssumeWater"]=["Assume watering","This is important for plants growing more than 24h. The calculation of the cropping time assumes watering when needed."]; texte["en"]["settings_valAutoCrop"]=["Automatic harvesting","After opening your field, crops will be harvested if necessary."]; texte["en"]["settings_valWaterNeeded"]=["Watering needed","Shall the necessity of watering be displayed?"]; texte["en"]["settings_valCropMsg"]=["Close harvest dialog","Don't like the annoying harvest notification with the pig? Get rid of it here."]; texte["en"]["settings_valLimitEmptyFields"]=["Empty areas","If the number of unplanted areas in your field exceeds this number, the field will be shown as empty."]; texte["en"]["settings_valLimitEmptyFields_forest"]=["Empty forest areas","If the number of unplanted areas in your field exceeds this number, the field will be shown as empty."]; texte["en"]["settings_valMoveAnimals"]=["Move animals",""]; texte["en"]["settings_valContractLogAmount"]=["Number contracts kept","Your last sent and received contracts are kept so that a history of them can be shown."]; texte["en"]["settings_valFarmiLimits"]=["Farmie Limits","The farmies are marked in 3 cases depending on their payment-rate."]; texte["en"]["settings_valFarmiMiniInfo"]=["Farmie Mini Info","Displays a small circle below each farmie showing its case of payment-rate."]; texte["en"]["settings_valMinRackMan"]=["Detail configuration","You edit the amount on your own *here*"]; texte["en"]["settings_valMinRack"]=[,"A product is marked if its amount in your rack is falling below this value. You can enter different values depending on the category."]; texte["en"]["settings_valMinRackPlantsize"]=["Aspect size of plant","For example grain needs only half of the value above."]; texte["en"]["settings_valMinRackGrowing"]=["Growing products","Adds the amount of products that are in production and ready by powerup."]; texte["en"]["settings_valMinRackQuest"]=["Quest products","Adds the amount of the quest products"]; texte["en"]["settings_valMinRackRecursive"]=["Recursive products","Add the required products needed to make missing products, and calculate these again for the required proucts.(used by forestry products)"]; texte["en"]["settings_valMinRackFarmis"]=["Farmie products","Adds the amount of the products wanted by the farmies which pay more than the lower limit."]; texte["en"]["settings_valMinRackForestryFarmis"]=["Lodge farmie products","Adds the amount of the products wanted by the lodge farmies."]; texte["en"]["settings_protectMinRack"]=["Selling protection","Prohibits to sell products at market below the minimal rackamount"]; texte["en"]["settings_valBuyingLimitDown"]=["Bottom buy highlight",""]; texte["en"]["settings_valBuyingLimit"]=["Top buy limit","You can only buy products at the Market up to the limit given. This protects you from accidentally purchasing very over-priced goods."]; texte["en"]["settings_valBuyingLimitNPC"]=["Only allow buy less than price of NPC",""]; texte["en"]["settings_valSellingLimit"]=["Sell limits","Your sales are also protected, so that you don't price your own goods too cheaply or too highly."]; texte["en"]["settings_valJoinPrices"]=["One input","Joins the price input fields at the market stand."]; texte["en"]["settings_valQuicklinks"]=["Show market quicklinks","Show Quicklinks at Market place"]; texte["en"]["settings_valUseObservedPrices"]=["Use observed prices","Prices are observed while clicking through the market place. A calculated price can be seen in the price list. Shall this automatically override your settings?"]; texte["en"]["settings_valSendStatistics"]=["Send statistics","Support the <a href='http://mff.metrax.eu/' target='_blank'>Statistik-Server</a>. No private data is sent!"]; texte["en"]["settings_valPrivateMessages"]=["Number private messages kept","Your last private messages are kept so that a message history of one contact can be shown."]; texte["en"]["settings_valMarketMessages"]=["Number market messages kept","Old messages remain in this archive, even if they are older than the maximum 7 days."]; texte["en"]["settings_valMessageRe"]=["Short subject","Replaces \"Re:Re:\" to \"Re:\" in the subject when you reply to a message."]; texte["en"]["settings_valMessagesSystemMarkRead"]=["Read system messages","System messages are marked read automatically."]; texte["en"]["settings_valFoodworldFarmiPlacing"]=["Locate picnic area farmis","Accepted picnic area farmis are located automatically to a vacant seat."]; texte["en"]["settings_valAutoLogin"]=["Automatic login","Once username and password information is given, all accounts will be logged in, so that they can be fed, harvested, watered, and planted. Popups must be allowed with multiple accounts."]; texte["en"]["settings_valUpdate"]=["Update","Checks whether an updated version of this Advisor script is available."]; texte["en"]["settings_valServerTimeOffset"]=["Time of server",""]; texte["en"]["settings_valGamecursor"]=["Game cursor","Use the game cursors instead of your system cursors."]; texte["en"]["settings_valDrag"]=["Dragging","Allow moving windows by clicking the upper left corner."]; texte["en"]["settings_valClickErrorbox"]=["Hide errorbox","Some users have problems with the error box. Keep in mind that this alert is normally useful!"]; texte["en"]["settings_valHotkeys"]=["Hotkeys","Use hotkeys to quicker navigate the game. See the help."]; texte["en"]["settings_hotkeymap"]={"prevPage":"previous Message, Zone, ...","nextPage":"next Message, Zone, ...","farm1":"1st farm","farm2":"2nd farm","farm3":"3rd farm","guild":"Club","city1":"First Village","city2":"Second Village","farmilog":"Farmi-Log","help":"Help","market":"Market place","marketstand":"Market stand","messages":"Messages","options":"Options","profit":"Profit Calculation","sgh":"Seed retailer","overview":"Overview","contract":"Contracts","systemmessage":"(next unread) system message"}; texte["en"]["settings_valzoneAddToGlobalTime"]=["Integrate","Shall the time be included to the global time?"]; texte["en"]["settings_valGlobaltimeShowCroppedZone"]=["Integrate cropped zone","Shall the ready-state of the cropped zones be included in the global time?"]; texte["en"]["settings_cacheReset"]=["Cache reset","All information about your farms will be deleted ..."]; //help texte["en"]["help_0"]=[,"This is small introduction to the functions of the Adviser-Script. Not all changes are written here, go find them yourself ... Sometimes a mouse-over helps. <br>At the bottom you see a button to visit the <a href=\"http://userscripts.org:8080/scripts/show/66964\" target=\"_blank\">homepage</a>. Next to it, there is the button for the options. You should look at them and configure as you desire.<br>Generally the script only knows what you have seen. So just visit the field if something is wrong."]; texte["en"]["help_1"]=["The Zones","The fields are observed while you see them. The script saves the plants, times and watering. So on the farm view this can be displayed. Each zone has a time counter at its top to show you when it is ready.<br>If you own the planting helper, you can access it directly from opened field. At the top of an opened zone you can navigate directly to zones of the same type."]; texte["en"]["help_2"]=["The Overview","Click the pig on the top and you will see an overview of your complete farm. Each zone, its output (product and points) and the next time of work are displayed. Also your total crop is shown. Below you see the wishes of your farmies. You can click each zone or farmie to navigate there. If you are run out of a product, it can take you directly to the market place."]; texte["en"]["help_3"]=["Blue Bar","Your points are kept daily. At the bottom you see a bar displaying the current and past level. Each white and red (sunday) line is a day. If you click it you get a detailed table and perhaps a hint if you are lack of a product."]; texte["en"]["help_4"]=["Shelf","Here informations of prices and value are added. The amount are reformatted to better style. At the bottom you have an input to seach an other player."]; texte["en"]["help_5"]=["Profit Calculation","Next to the bottom of the shelf you can click <img src=\""+GFX+"buildingupdatebutton_off.png\" style=\"width: 15px;height: 15px;\">. This shows you a table calculating times and profits of your products. Click the stars to change the upgrade levels. Click the headline to sort."]; texte["en"]["help_6"]=["Farmies","The bubbles of the farmies are expanded by a calculation if they pay enough. If your product amount runs too low, the product is marked. Click the house next to the farmies to see the ones of the last month. At the blue bar on the right you can set which farmies you send away. At the top a calculation is made, so you can decide if an advertising is profitable."]; texte["en"]["help_7"]=["Hotkeys","You can quickly move to a place by pressing <i>Alt</i>+... See the options!"]; texte["en"]["help_8"]=["Market place","On the market place you are \"protected\", means that you can't buy a product more expensive than in the retailer or by options set. If activated, you can directly switch to a product page by the incoming window on the right. At the top you can step to the next/previous product and see your current amount.<br>You find at the bottom a very important button: the prices. It gives you a table listing your product amounts, values and the prices that are everywhere used. So keep attention they are set right! An \"observed\" price is kept when you visit a market page of a single product.<br>On your market stall a few usefull values are displayed and your last offer was kept and is set now."]; texte["en"]["help_9"]=["Messages","Your sales are kept and directly displayed - no need to open a message two times! Note the \"Read all\" and \"Log\" buttons. Your private messages are kept, too. So no need to look for the last messages of the current contact."]; texte["en"]["help_10"]=["Contracts","They are kept, too. While creating a contact an input displays the value of the entered product. Enter first the price and then the amount to get inverse the amount. You can submit the same contract multiple times!"]; texte["en"]["help_11"]=["Account Managing","You can save all your accounts in the options. So you can login easily in each one by the displayed buttons on the starting page. Note that you can switch directly the accounts at the same server."]; } err_trace="MenuCommand"; GM_registerMenuCommand(getText("adviser")+" "+"Update", function(){ location.href=GM_Source; }); GM_registerMenuCommand(getText("adviser")+" "+getText("scriptHomepage"), function(){ window.open(GM_Home); }); if(location.href==GM_Home){ err_trace="Userscripts.org"; if($("content")&&$("install_script")){ var uso_version=/<p><b>Version:<\/b>(\d+\.\d+\.\d+)<\/p>/gi.exec($("content").innerHTML.replace(/\s/gi,""))[1]; if(compareVersions(uso_version,VERSION)<1){ $("install_script").firstElementChild.innerHTML="Already installed"; }else{ $("install_script").firstElementChild.innerHTML="Update ("+VERSION+" → "+uso_version+")"; } } return false; }else if(!COUNTRY||!GAMEPAGES[COUNTRY]||!location.hostname.match(GAMEPAGES[COUNTRY])){ err_trace="COUNTRY error"; createElement("div",{"style":"position:absolute;top:0;left:0;width:340px;padding:30px;background-color:yellow;border:3px solid black;border-radius:10px;z-index:1000;font-family:Verdana,sans-serif;color:#000000;font-size:12pt;font-weight:bold;"},document.getElementsByTagName("body")[0],"You have to install a language pack. Download one at <a href='http://userscripts.org:8080'>userscripts.org</a>.") }else{ err_trace="regular expressions"; regDelimThou=new RegExp(regDelimThou,"g"); regDelimThouShift=new RegExp(regDelimThouShift,"g"); regDelimThouDelete=new RegExp(regDelimThouDelete,"g"); regDelimDeci=new RegExp(regDelimDeci); regMsgMarketsaleContent=new RegExp(getText("msgMarketsaleContent")); regMsgContractsaleContent=new RegExp(getText("msgContractsaleContent")); regMsgContractsaleList=new RegExp(getText("msgContractsaleList")); regMsgFriend=new RegExp(getText("msgFriend")); err_trace="Events"; if(DEVMODE_EVENTS&&(self==top)){ var allEvents=new Array(); // list of events: allEvents.push("gameWindowContractNew"); // "create new contract"-frame is loaded allEvents.push("gameChangedProdMinRackInit"); // prodMinRackInit is saved (rack amount detail configuration, market-frame) allEvents.push("gameChangedProdMinRackAddon"); // prodMinRackAddon is saved allEvents.push("gameChangedGut"); // gut is saved (market-frame) allEvents.push("gameChangedBeobPrice"); // beobPrice is saved (market-frame) allEvents.push("gameChangedOwnMarketOffers"); // ownMarketOffers is saved allEvents.push("gameChangedLevelLog"); // levelLog is saved (message-frame) allEvents.push("gameOtherAccReady"); // another account needs to be worked allEvents.push("gameSessionEnds"); // the session ends soon (max 120s) allEvents.push("gameInfoPanelOpen"); // the infoPanel is opened and filled allEvents.push("gameInfoPanelOptions"); // the infoPanel has the option-tab loaded allEvents.push("gameUpdateRack"); // the rack has loaded allEvents.push("gameFieldModified"); // the plants on the opened field are loaded allEvents.push("gameFieldOpened"); // a field is opened allEvents.push("gameFieldPlanted"); // a field has been planted allEvents.push("gameFieldWatered"); // a field has been watered allEvents.push("gameFieldCropped"); // a field has been cropped allEvents.push("gameFieldDemolished"); // allEvents.push("gameFactoryKnittingStarted"); // a knitting factory has been started allEvents.push("gameFactoryKnittingCropped"); // a knitting factory has been cropped allEvents.push("gameFactoryKnittingDialogStart"); // a knitting factory has opened a production dialog allEvents.push("gameFarmLoaded"); // the farm is loaded allEvents.push("gameFarmOpened"); // the farm is opened allEvents.push("gameFarmersmarketCropped"); // the farmersmarket is cropped allEvents.push("gameFarmersmarketStarted"); // the farmersmarket has been started allEvents.push("gameFarmersmarketWatered"); // the farmersmarket has been watered allEvents.push("gameFarmersmarketOpened"); // the farmersmarket is opened allEvents.push("gameFarmersmarketOpened1"); // the farmersmarket building 1 is opened allEvents.push("gameFarmersmarketOpened2"); // the farmersmarket building 2 is opened allEvents.push("gameFarmersmarketSlotOpened"); // the farmersmarket building slot has been opened allEvents.push("gameFarmersmarketDialogStart"); // the farmersmarket building has opened a dialog allEvents.push("gameFarmersmarketDialogCommit"); // the farmersmarket building has requested for commit of a dialog allEvents.push("gameFarmiNew"); // a new farmi is appeared allEvents.push("gameFarmiResponse"); // a farmi is been rejected or accepted. allEvents.push("gameMegafieldTourStarted"); // a megafield tour has been started allEvents.push("gameOpenCampaign"); // Forestry Quest is opened allEvents.push("gameOpenStable"); // a stable is opened allEvents.push("gameOpenFactory"); // a factory is opened allEvents.push("gameOpenFactoryOil"); // an oil factory is opened allEvents.push("gameOpenFactoryKnitting"); // an knitting factory is opened allEvents.push("gameOpenMarket"); // the market is opened allEvents.push("gameOpenMegafield"); // the megafield is opened allEvents.push("gameOpenWindmill"); // the windmill is opened allEvents.push("gameOpenGlobalCommitBox"); // GlobalCommitBox is opened allEvents.push("gameOpenGlobalBox"); // GlobalBox is opened allEvents.push("gameOpenForestry"); // Forestry is opened allEvents.push("gameFoodworldCropped"); // Foodworld building has been cropped allEvents.push("gameFoodworldOpened"); // Foodworld is opened allEvents.push("gameFoodworldOpened1"); // Foodworld building 1 is opened allEvents.push("gameFoodworldOpened2"); // Foodworld building 2 is opened allEvents.push("gameFoodworldOpened3"); // Foodworld building 3 is opened allEvents.push("gameFoodworldOpened4"); // Foodworld building 4 is opened allEvents.push("gameFoodworldSlotOpened"); // Foodworld slot has been opened allEvents.push("gameFoodworldStarted"); // Foodworld building has been started allEvents.push("gameSawmillCropped"); // Sawmill has been cropped allEvents.push("gameSawmillOpened"); // Sawmill is opened allEvents.push("gameSawmillStarted"); // Sawmill has been started allEvents.push("gameSawmillSlotOpened"); // Sawmill-Slot is opened allEvents.push("gameCarpentryCropped"); // Carpentry has been cropped allEvents.push("gameCarpentryOpened"); // Carpentry is opened allEvents.push("gameCarpentryStarted"); // Carpentry has been started allEvents.push("gameCarpentrySlotOpened"); // Carpentry-Slot is opened allEvents.push("gameCity1"); // city 1 is opened allEvents.push("gameCity2"); // city 2 is opened allEvents.push("gameLotteryOpen"); // lottery frame is opened allEvents.push("gameLotteryGotDailyLot"); // daily lot is taken allEvents.push("gameLotteryGotLot"); // lot decision question is shown allEvents.push("gameLotteryGotPrize"); // got price allEvents.push("gameLotteryDailyLotAvailable"); // allEvents.push("gamePoweruprackUpdated"); // Powerup data updated allEvents.push("gameQuestNewAvailable"); // There is a new quest that can be played allEvents.push("gameQuestAccepted"); // Quest is accepted //allEvents.push("gameQuestActive"); // There is an activated quest allEvents.push("gameQuestFinished"); // Quest is finished allEvents.push("gameQuestSolvable"); allEvents.push("gameNewDay"); // a new day started allEvents.push("gameWindmillStarted"); // the windmill has been started allEvents.push("gameWindmillCropped"); // the windmill has been cropped allEvents.push("gameWindmillDialogStart"); // the windmill has opened a recipe dialog allEvents.push("gameWindmillDialogCommit"); // the windmill has requested for commit of a recipe dialog allEvents.push("gameZoneReady"); // a zone is ready. unsafeData.readyZone is set allEvents.push("gameUpdateFormuladealerOffers"); // the formuladealer has filled the offers allEvents.push("gameUpdateFormuladealerRack"); // the formuladealer has filled the recipes rack allEvents.push("gamePowerupActivated"); // a powerup has been executed allEvents.push("gameReallocateBuilding"); // 2 buildings are swapped. unsafeData.reallocateBuildingSet is set [1..18,1..18] allEvents.push("gameUserlevelUp"); // a new level is reached allEvents.push("beraterDone"); // script successfully executed for(var v=0;v<allEvents.length;v++){ document.addEventListener(allEvents[v],function(event){ logBubble.add("Event: "+event.type,10,"#099"); //GM_log("Event: "+event.type); },false); } allEvents=null; } err_trace="CSS"; GM_addStyle( "input:hover{background-color:#cc9!important;}\ input:focus{background-color:lightblue!important;}\ button:hover{background-color:#cc9!important;}\ button:hover{background-color:#cc9!important;}\ .white,.white td,.white th,.white div,.white span,.white a {color:white;}\ .black,.black td,.black th,.black div,.black span,.black a {color:black;}\ .grey,.grey td,.grey th,.grey div,.grey span,.grey a {color:grey;}\ .red,.red td,.red th,.red div,.red span,.red a {color:red;}\ th{font-weight:bold;border-bottom:1px dashed black;background-color:#b69162;}\ th.lightBg{background-color:#d5c0a5!important;}\ .borderTop1dashedWhite,.borderTop1dashedWhite>td,.borderTop1dashedWhite>th{border-top:1px dashed white!important;}\ .borderTop1dashedBlack,.borderTop1dashedBlack>td,.borderTop1dashedBlack>th{border-top:1px dashed black!important;}\ .borderBottom1White,.borderBottom1White>td,.borderBottom1White>th{border-bottom:1px solid white!important;}\ .borderBottom1Black,.borderBottom1Black>td,.borderBottom1Black>th{border-bottom:1px solid black!important;}\ .borderBottom1dashedBlack,.borderBottom1dashedBlack>td,.borderBottom1dashedBlack>th{border-bottom:1px dashed black!important;}\ .borderBottom1dashedGrey,.borderBottom1dashedGrey>td,.borderBottom1dashedGrey>th{border-bottom:1px dashed grey!important;}\ .blinking{animation-name:blink;animation-duration:1s;animation-timing-function:linear;animation-iteration-count:infinite;animation-direction:normal;animation-delay:0;animation-play-state:running;animation-fill-mode:forwards;}\ @keyframes blink{0%{opacity:1;}90%{opacity:0.4;}100%{opacity:1;}}\ .rotating{animation-name:rotate;animation-duration:3s;animation-timing-function:linear;animation-iteration-count:infinite;animation-direction:normal;animation-delay:0;animation-play-state:running;animation-fill-mode:forwards;}\ @keyframes rotate{0%{transform:rotate(0deg);}100%{transform:rotate(360deg);}}" ); GM_addStyle( ".alertbox{color:white;background-color:red;font-weight:bold;}\ .alertbubble{position:absolute;top:0;left:0;width:340px;padding:30px;background-color:yellow;border:3px solid black;border-radius:10px;z-index:1000;}\ .sortableColAsc{background-color:lightblue!important;}\ .sortableColDesc{background-color:lightblue!important;}\ .hoverBlack:hover,div.hoverBlack:hover div{color:black!important;}\ .hoverRowBgCc9 tr:hover{background-color:#cc9!important;}\ .hoverRowBgLightblue>tr:hover{background-color:lightblue!important;}\ .hoverRowBgLightbrown>tr:hover{background-color:#e4b55d!important;}\ .hoverBgBlue:hover{background-color:blue!important;}\ .hoverBgCc9:hover{background-color:#cc9!important;}\ .hoverBgDarkgreen:hover{background-color:#084200!important;}\ .hoverBgGreen:hover{background-color:green!important;}\ .hoverBgGold:hover{background-color:gold!important;}\ .hoverBgLightblue:hover{background-color:lightblue!important;}\ .hoverBgLightbrown:hover{background-color:#e4b55d!important;}\ .hoverBgRed:hover{background-color:red!important;}\ .hoverBgBlack:hover{background-color:black!important;}\ .hoverNoTextDecoration:hover,td.hoverNoTextDecoration:hover,span.hoverNoTextDecoration:hover{text-decoration:none!important;}" ); GM_addStyle( ".v97{background-position: -240px -120px!important;}\n" // Bugfix Poinsettia (Weihnachtsstern) +".v104{background-position: -180px -300px!important;}\n" // Bugfix Daffodil (Osterglocke) +".v107{background-position: -240px -300px!important;}\n" // Bugfix Grapes (Weintrauben) +".v129{background-position: 0px -390px!important;}\n" // Bugfix Tea (Tee) +".v158{background-position: 0px -480px!important;}\n" // Bugfix Tulips (Tulpen) ); GM_addStyle( ".playerMsg{float:left;margin-right:7px;background-image:url('"+GFX+"guild/mail.gif');background-position:0px -3px;}\ .playerMsg div{width:15px;height:12px;opacity:0.5;}\ .playerMsg div:hover{background-color:blue;}\ .playerContract{float:left;margin-right:5px;background-image:url('"+GFX+"guild/contract.gif');background-position:-2px 0px;}\ .playerContract div{width:11px;height:15px;opacity:0.5;}\ .playerContract div:hover{background-color:blue;}\ .playerStats{float:left;margin-right:5px;background-image:url('"+GFX+"stadt/stats_sf_black.gif');background-repeat:no-repeat;background-position:0px 2px;}\ .playerStats div{position:relative;top:1px;width:11px;height:9px;opacity:0.5;border-radius:5px;}\ .playerStats div:hover{background-color:blue;}\ .naviItem{float:left;padding:5px;text-align:center;font-weight:bold;border-radius:5px;background-color:#C3A75E;margin-right:5px;}\ .naviItem:hover{background-color:white;}\ .naviItemActive{float:left;padding:5px;text-align:center;font-weight:bold;border-radius:5px;background-color:#C3A75E;margin-right:5px;background-color:white;}\ .naviItemInactive{float:left;padding:5px;text-align:center;font-weight:bold;border-radius:5px;background-color:#C3A75E;margin-right:5px;color:grey;}" ); removeAllCSS(/reallocatebuilding_symbol_tt/); GM_addStyle( ".rackcat1v,.rackcat1v_active{background:url("+GFX+"rack_sort_top.png);width:27px;height:39px;}\ .rackcat1v{background-position:0px 0px;}\ .rackcat1v:hover{background-position:0px -39px;}\ .rackcat1v_active{background-position:0px -78px;}\ .rackcat1e,.rackcat1e_active{background:url("+GFX+"rack_sort_top.png);width:26px;height:39px;}\ .rackcat1e{background-position:-27px 0px;}\ .rackcat1e:hover{background-position:-27px -39px;}\ .rackcat1e_active{background-position:-27px -78px;}\ .rackcat21,.rackcat21_active{background:url("+GFX+"rack_sort_top.png);width:27px;height:20px;}\ .rackcat21{background-position:-106px 0px;}\ .rackcat21:hover{background-position:-106px -39px;}\ .rackcat21_active{background-position:-106px -78px;}\ .rackcat22,.rackcat22_active{background:url("+GFX+"rack_sort_top.png);width:27px;height:19px;}\ .rackcat22{background-position:-106px -20px;}\ .rackcat22:hover{background-position:-106px -59px;}\ .rackcat22_active{background-position:-106px -98px;}\ .rackcat23,.rackcat23_active{background:url("+GFX+"rack_sort_top.png);width:26px;height:20px;}\ .rackcat23{background-position:-133px 0px;}\ .rackcat23:hover{background-position:-133px -39px;}\ .rackcat23_active{background-position:-133px -78px;}\ .rackcat24,.rackcat24_active{background:url("+GFX+"rack_sort_top.png);width:26px;height:19px;}\ .rackcat24{background-position:-133px -20px;}\ .rackcat24:hover{background-position:-133px -59px;}\ .rackcat24_active{background-position:-133px -98px;}\ .rackcat30fl,.rackcat30fl_active{background:url("+GFX+"rack_sort_top.png);width:27px;height:39px;}\ .rackcat30fl{background-position:-212px 0px;}\ .rackcat30fl:hover{background-position:-212px -39px;}\ .rackcat30fl_active{background-position:-212px -78px;}\ .rackcat30fla,.rackcat30fla_active{background:url("+GFX+"rack_sort_top.png);width:26px;height:39px;}\ .rackcat30fla{background-position:-239px 0px;}\ .rackcat30fla:hover{background-position:-239px -39px;}\ .rackcat30fla_active{background-position:-239px -78px;};" ); // Script elements GM_addStyle( ".farmiInfo{position:absolute;height:35px;top:-47px;border-radius:5px;padding:5px;color:black;font-size:0.8em;}\ .farmiMiniInfo{position:absolute;top:45px;right:15px;height:7px;width:7px;display:block;border-radius:5px;}\ .questboxbarinPoss{position:absolute;top:0px;height:15px;background-color:green;opacity:0.5;}\ .fieldReady{background:url('"+GFX+"incoming.gif');position:absolute;top:30px;display:block!important;width:24px;height:57px;}\ .fieldWaterReady{background:url('"+GFX+"garten/gegossen_static.gif') -20px 0px no-repeat;position:absolute;top:60px;display:block!important;width:40px;height:40px;transform:scale(2,2);}\ .beraterButtonIcon{margin:3px;width:30px;height:30px;overflow:hidden;background-color:#936b52;border:1px groove #4d240e;border-radius: 20px;}\ .beraterButtonIcon:hover{transform:scale(1.1);}\ .opener{background:url('"+GFX+"questbarcontrols.png') 0px 0px no-repeat;width:20px;height:20px;}\ .leftarrow{height:26px;width:35px;border-radius:15px;background:url('"+IMAGES["leftarrow"]+"');}\ .leftarrow:hover{background:url('"+IMAGES["leftarrow_dark"]+"');}\ .rightarrow{height:26px;width:35px;border-radius:15px;background:url('"+IMAGES["rightarrow"]+"');}\ .rightarrow:hover{background:url('"+IMAGES["rightarrow_dark"]+"');}\ .formattedRackItem{position:absolute;top:3px;left:0;width:40px;font-size:7pt;color:#555555;text-align:center;}\ .farmicart_missing td{color:red!important;}\ .border1 td,.border1 th{border:1px solid black;}\ .borderTop2 td,.borderTop2 th{border-top:2px solid black;}\ .borderBottom2 td,.borderBottom2 th{border-bottom:2px solid black;}\ .fontWeightBold td,.fontWeightBold th{font-weight:bold;}\ .questlineicon1{background:url('"+GFX+"questlineicons.gif') no-repeat scroll 0 0 transparent;float:left;height:19px;left:2px;position:absolute;top:2px;width:19px;}\ .questboxlinecontent:hover{background-color:#8F6803;}\ .quests_status_bar_main1{background:url('"+GFX+"questbar_main1.png') repeat scroll 0 0 rgba(0, 0, 0, 0);}\ .quests_status_bar_main2{background:url('"+GFX+"questbar_main2.png') repeat scroll 0 0 rgba(0, 0, 0, 0);}\ .quests_status_bar_forestry1{background:url('"+GFX+"questbar_forestry1.png') repeat scroll 0 0 rgba(0, 0, 0, 0);}\ .quests_status_bar_forestry2{background:url('"+GFX+"questbar_forestry2.png') repeat scroll 0 0 rgba(0, 0, 0, 0);}\ .quests_status_bar_foodworld1{background:url('"+GFX+"questbar_foodworld1.png') repeat scroll 0 0 rgba(0, 0, 0, 0);}\ .quests_status_bar_main1_active{background:url('"+IMAGES["questActiveMain1"]+"') repeat scroll 0 0 rgba(0, 0, 0, 0);}\ .quests_status_bar_main2_active{background:url('"+IMAGES["questActiveMain2"]+"') repeat scroll 0 0 rgba(0, 0, 0, 0);}\ .quests_status_bar_forestry1_active{background:url('"+IMAGES["questActiveForestry1"]+"') repeat scroll 0 0 rgba(0, 0, 0, 0);}\ .quests_status_bar_forestry2_active{background:url('"+IMAGES["questActiveForestry2"]+"') repeat scroll 0 0 rgba(0, 0, 0, 0);}\ .quests_status_bar_foodworld1_active{background:url('"+IMAGES["questActiveFoodworld"]+"') repeat scroll 0 0 rgba(0, 0, 0, 0);}\ .category_f1,.category_f2,.category_f3,.category_f4,.category_f5,.category_f1_active,.category_f2_active,.category_f3_active,.category_f4_active,.category_f5_active{width:25px;height:25px;margin:1px;border-radius:9px;}\ .category_f1,.category_f2,.category_f3,.category_f4,.category_f5{border:2px solid #808080;background:url('"+GFX+"forestry/forestry_symbols6.gif') top left no-repeat;}\ .category_f1{background-position:-100px 0px;}\ .category_f2{background-position:-25px -25px;}\ .category_f3{background-position:-100px -100px;}\ .category_f4{background-position:-25px -150px;}\ .category_f5{background-position:0px -175px;}\ .category_f1_active,.category_f2_active,.category_f3_active,.category_f4_active,.category_f5_active{border:2px solid black;}\ .category_f1_active{background:url('"+IMAGES["category_f1_active"]+"') top left no-repeat;}\ .category_f2_active{background:url('"+IMAGES["category_f2_active"]+"') top left no-repeat;}\ .category_f3_active{background:url('"+IMAGES["category_f3_active"]+"') top left no-repeat;}\ .category_f4_active{background:url('"+IMAGES["category_f4_active"]+"') top left no-repeat;}\ .category_f5_active{background:url('"+IMAGES["category_f5_active"]+"') top left no-repeat;}\ .category_r0,.category_r1,.category_r2,.category_r0_active,.category_r1_active,.category_r2_active{width:42px;height:42px;margin:1px;border-radius:23px;}\ .category_r0,.category_r1,.category_r2{border:2px solid #808080;;}\ .category_r0{background:url('"+GFX+"powerup1.png') top left no-repeat;background-position:-9px -23px}\ .category_r1{background:url('"+GFX+"powerup2.png') top left no-repeat;background-position:-9px -23px}\ .category_r2{background:url('"+GFX+"powerup3.png') top left no-repeat;background-position:-9px -23px}\ .category_r0_active,.category_r1_active,.category_r2_active{border:2px solid black;}\ .category_r0_active{background:url('"+IMAGES["category_r0_active"]+"') top left no-repeat;}\ .category_r1_active{background:url('"+IMAGES["category_r1_active"]+"') top left no-repeat;}\ .category_r2_active{background:url('"+IMAGES["category_r2_active"]+"') top left no-repeat;}\ .category_f1:hover,.category_f2:hover,.category_f3:hover,.category_f4:hover,.category_f5:hover,.category_r0:hover,.category_r1:hover,.category_r2:hover,.category_f1_active:hover,.category_f2_active:hover,.category_f3_active:hover,.category_f4_active:hover,.category_f5_active:hover,.category_r0_active:hover,.category_r1_active:hover,.category_r2_active:hover{transform:scale(1.1);}\ .zoneBg70_1,.zoneBg70_2,.zoneBg70_3,.zoneBg70_4,.zoneBg70_5,.zoneBg70_6,.zoneBg70_7,.zoneBg70_8,.zoneBg70_9,.zoneBg70_10,.zoneBg70_11,.zoneBg70_12,.zoneBg70_13,.zoneBg70_14,.zoneBg70_15,.zoneBg70_16,.zoneBg70_17,.zoneBg70_18,.zoneBg70_fl1,.zoneBg70_fl2,.zoneBg70_fw1,.zoneBg70_fw2,.zoneBg70_fw3,.zoneBg70_sawmill,.zoneBg70_carpentry{width:70px;height:70px;}\ .zoneBg70_1,.zoneBg70_2,.zoneBg70_3,.zoneBg70_4,.zoneBg70_5,.zoneBg70_6,.zoneBg70_7,.zoneBg70_8,.zoneBg70_9,.zoneBg70_10,.zoneBg70_11,.zoneBg70_12,.zoneBg70_13,.zoneBg70_14,.zoneBg70_15,.zoneBg70_16,.zoneBg70_17,.zoneBg70_18{background:url('"+GFX+"maps/buildings18.gif') top left no-repeat;background-size: 420px 280px;}\ .zoneBg70_1{background-position:0px 0px;}\ .zoneBg70_2{background-position:-70px 0px;}\ .zoneBg70_3{background-position:-140px 0px;}\ .zoneBg70_4{background-position:-210px 0px;}\ .zoneBg70_5{background-position:-280px 0px;}\ .zoneBg70_6{background-position:-350px 0px;}\ .zoneBg70_7{background-position:0px -139px;}\ .zoneBg70_8{background-position:-350px -70px;}\ .zoneBg70_9{background-position:-70px -139px;}\ .zoneBg70_10{background-position:-140px -138px;}\ .zoneBg70_11{background-position:-210px -138px;}\ .zoneBg70_12{background-position:-280px -138px;}\ .zoneBg70_13{background-position:-350px -138px;}\ .zoneBg70_14{background-position:0px -209px;}\ .zoneBg70_15{background-position:-70px -209px;}\ .zoneBg70_16{background-position:-140px -209px;}\ .zoneBg70_17{background-position:-210px -209px;}\ .zoneBg70_18{background-position:-280px -209px;}\ .zoneBg70_fl1{background:url('"+GFX+"farm99_pos1.gif') no-repeat;background-position:0px 0px;background-size: 70px 70px;}\ .zoneBg70_fl2{background:url('"+GFX+"farm99_pos2.png') no-repeat;background-position:0px 0px;background-size: 70px 70px;}\ .zoneBg70_fw1{background:url('"+GFX+"foodworld/building1_5.jpg') no-repeat;background-position:0px 0px;background-size: 70px 70px;}\ .zoneBg70_fw2{background:url('"+GFX+"foodworld/building2_5.jpg') no-repeat;background-position:0px 0px;background-size: 70px 70px;}\ .zoneBg70_fw3{background:url('"+GFX+"foodworld/building3_5.jpg') no-repeat;background-position:0px 0px;background-size: 70px 70px;}\ .zoneBg70_sawmill{background:url('"+GFX+"forestry/building1.jpg') no-repeat;background-position:0px 0px;background-size: 70px 70px;}\ .zoneBg70_carpentry{background:url('"+GFX+"forestry/building2.jpg') no-repeat;background-position:0px 0px;background-size: 70px 70px;}\ .smallStatistic{position:relative;display:inline-block;height:214px;margin:5px;background-color:#bbe;}\ #imgNeedWater1,#imgNeedWater2,#imgNeedWater3,#imgNeedWater4,#imgNeedWater5,#imgNeedWater6{position:absolute;right:25px;height:63px;width:63px;}\ #zoneinfo1,#zoneinfo2,#zoneinfo3,#zoneinfo4,#zoneinfo5,#zoneinfo6{border:2px solid #6c441e;border-radius:10px;z-index:3;position:absolute;left:120px;top:20px;}\ #divErnteInfo{position:relative;float:left;top:120px;left:620px;padding:2px;border:2px inset white;background-color:#FFB876;display:none;}\ #divRightBorder>div{z-index:2;position:relative!important;top:0!important;margin-top:5px;}\ #buyNotepad,#marketoffersNotepad{white-space:nowrap;vertical-align:top;border:2px inset black;background-color:white;padding:3px;max-height:200px;;overflow:hidden;overflow-y:scroll;}\ #zoneNavi{position:absolute;top:9px;right:50px;z-index:25;}\ #zoneNavi div{float:left;}\ #divBeraterButtons{-moz-user-select:none;position:fixed;left:0;top:80px;width:40px;border:1px groove #4D240E;border-radius:0 10px 10px 0;z-index:500;background:url(\""+GFX+"guild/help_back.jpg\") -25px -25px;}\ .clearFilter{width:14px;height:13px;background:url(\""+GFX+"market/filter_del.gif\");}\ .loginbutton{background-color:white;color:black;text-align:center;font-weight:bold;width:250px;line-height:20px;margin:3px;border:3px solid #6c441e;border-radius:10px;}" ); // Game elements GM_addStyle( ".friendslineoptions{width:72px!important;}\ .forestry_slot_product{margin:15px 0 0 20px!important;}\ .forestry_sawmill_productbox{width:272px!important;height:208px!important;padding:10px!important;}\ .rackitem_tt_sack,.rackitem_tt_box,.rackitem_tt_bottle,.rackitem_tt_karton,.rackitem_tt_tupper{z-index:110!important;}\ .farm_button_destruct{display:none!important;}\ .farm_button_gardenspeedup{left:5px!important;}\ .farm_button_tt{width:150px!important;}\ .farm_button_tt{display:none!important;}\ .quests_status_bar_item_tt{display:none!important;}\ .messages_list_subject{width:385px!important;}\ .farm_production_timer{opacity:1!important;}\ .farmersmarket_pos_timer{opacity:1!important;}\ #cartsubmit{font-weight:bold!important;}\ #customerline{z-index:19!important;}\ #transp8{display:none!important;}\ #buildinginfo1,#buildinginfo2,#buildinginfo3,#buildinginfo4,#buildinginfo5,#buildinginfo6{display:none!important;}\ #buildinginfo_right3,#buildinginfo_right6{display:none!important;}\ #buildinginfo_left0,#buildinginfo_left1,#buildinginfo_left2,#buildinginfo_left4,#buildinginfo_left5{display:none!important;}\ #updateinfo1,#updateinfo2,#updateinfo3,#updateinfo4,#updateinfo5,#updateinfo6{display:none!important;}\ #autoplantinfo1,#autoplantinfo2,#autoplantinfo3,#autoplantinfo4,#autoplantinfo5,#autoplantinfo6{display:none!important;}\ #speedupgardenbuttoninfo1,#speedupgardenbuttoninfo2,#speedupgardenbuttoninfo3,#speedupgardenbuttoninfo4,#speedupgardenbuttoninfo5,#speedupgardenbuttoninfo6{display:none!important;}\ #bulldozetooltip1,#bulldozetooltip2,#bulldozetooltip3,#bulldozetooltip4,#bulldozetooltip5,#bulldozetooltip6{display:none!important;}\ #emptyfieldtooltip1,#emptyfieldtooltip2,#emptyfieldtooltip3,#emptyfieldtooltip4,#emptyfieldtooltip5,#emptyfieldtooltip6{display:none!important;}\ #timeevent1,#timeevent2,#timeevent3,#timeevent4,#timeevent5,#timeevent6{display:none!important;}\ #friendslist{width:280px!important;}\ #friendlistinfoblock li:hover{background-color:#e4b55d;}\ #speedlinks,#cityline{display:block!important;}\ #rackItems{-moz-user-select:none;}\ #traveltransp,#questline,#questlineopener,#speedlinks,#guildlink,#guildlink_tt,#cityline,#farmtooltip1,#farmtooltip2,#farmtooltip3,#citytooltip1,#citytooltip2{z-index:110!important;}\ #zone1,#zone2,#zone3,#zone4,#zone5,#zone6{z-index:1;}\ #zoneupdatebutton1,#zoneupdatebutton2,#zoneupdatebutton3,#zoneupdatebutton4,#zoneupdatebutton5,#zoneupdatebutton6{position:absolute;left:5px;top:72px;}\ #lager_wachsezeit,#lager_ertrag,#lager_ist1,#lager_ist2,#lager_zeit,#lager_ernte{margin:0 0 0 5px!important;}\ #memory_pack{left:50px!important;top:10px!important;z-index:2!important;}\ #questboxlineinfo1,#questboxlineinfo2{display:none!important;}\ #questboxline{position:relative!important;top:0!important;}\ #reallocatebuilding_symbol_tt,#reallocateanimals_symbol_tt,#poweruptimes_content{left:30px!important;}\ #cropbonus_symbol_tt,#carpentrybonus_content{left:40px!important;}\ #reallocatebuilding_symbol_tt,#reallocateanimals_symbol_tt{display:none;position:absolute;top:0px;}\ #game_control{display:none!important;}\ #food_cart_products{top:250px!important;left:115px!important;}\ #cartcontent{width:400px!important;}\ #gardencancel{right:5px!important;top:5px!important;}\ #rankingcontent{line-height:12px;}\ .help_content{margin:20px 0 0 0;width: 345px;!important}" ); GM_addStyle( ".market_buy{width:30px!important;}\n" +".market_delicon{height:15px!important;}" // Bugfix. Game-CSS sets 16px=dis-harmonic to class market_carticon. +".market_noicon{height:15px!important;}" // Bugfix. Game-CSS sets 16px=dis-harmonic to class market_carticon. ); GM_addStyle(".divCurrentQuest{background-color:lightblue!important;}"); if(!GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valGamecursor",true)){ GM_addStyle( "BODY,.normal,.normal2{cursor:default;}\ .link,.link2{cursor:pointer!important;}\ TEXTAREA,.text,.text2{cursor:text!important;}" ); } // ************************************************** // ChangeData Global // -->> add var to delete also to resetVariables err_trace="ChangeData Global"; try{ var changedata = GM_getValue("changedata",0); switch(changedata){ case 1:case 2:{ function old_enc(str) { var encoded = ""; for (i=0; i<str.length;i++) { encoded = encoded+String.fromCharCode(str.charCodeAt(i)^123); } return encoded; } var logindata = explode(GM_getValue("logindata",[]),"changedataGlobal/1/logindata",[]); for(var v=0;v<logindata.length;v++){ logindata[v][3] = enc(old_enc(logindata[v][3]),4242); } GM_setValue("logindata",implode(logindata)); } case 3:{ var help=cloneInto(GM_listValues(), unsafeWindow); var help2; for(var v=help.length-1;v>=0;v--){ if(help2=/^([a-z]{2})(_.*)$/.exec(help[v])){ GM_setValue(help2[1].toUpperCase()+help2[2],GM_getValue(help[v])); GM_deleteValue(help[v]); } } var help = explode(GM_getValue("logindata",[]),"changedataGlobal/3/logindata",[]); for(var v=help.length-1;v>=0;v--){ help[v][0] = help[v][0].toUpperCase(); } GM_setValue("logindata",implode(help)); } } if(changedata<4){ GM_setValue("changedata",4); } }catch(err){GM_logError("changedata global\n"+err);} // ************************************************** err_trace="Location exec"; var loc=new RegExp("s(\\d+)\\."+GAMEPAGES[COUNTRY].replace(/\./g,"\\."),"i").exec(location.hostname); if(loc){ SERVER=loc[1]; PAGE=location.pathname.replace(/^\//,"").replace(/\.php.*$/,""); if(DEVMODE){ GM_log("PAGE:"+PAGE+" location.pathname:"+location.pathname); } err_trace="User"; USERNAME=GM_getValue(COUNTRY+"_"+SERVER+"_username",""); unsafeData.username=USERNAME; FARMNAME=$top("username")?$top("username").innerHTML:GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_farmname",""); npcSaison=explode(GM_getValue(COUNTRY+"_"+SERVER+"_NpcSaison"),"npcSaison",null); if(npcSaison==null){ npcSaison=INIT_NPC_SAISON.clone(); GM_setValue(COUNTRY+"_"+SERVER+"_NpcSaison",implode(npcSaison,"npcSaison")); } css_styles = explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_css_styles","{}"),"css_styles",INIT_CSS_STYLES); //GM_log("css_styles length:"+css_styles.length()+" :"+implode(css_styles)); var changeFlag=false; for(tag in INIT_CSS_STYLES){ if(!INIT_CSS_STYLES.hasOwnProperty(tag)){ continue; } if(!css_styles[tag]){ changeFlag=true; css_styles[tag]=INIT_CSS_STYLES[tag]; } } if(changeFlag){ GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_css_styles",implode(css_styles)); } changeFlag=null; GM_addStyle( ".zoneTimer{z-index:3;position:absolute;padding:2px;margin:1px;"+css_styles["timer"][1]+"}\ .zoneTimerWater{z-index:3;position:absolute;padding:2px;margin:1px;"+css_styles["watertimer"][1]+"}\ .zoneTimerReady{z-index:3;position:absolute;padding:2px;margin:1px;"+css_styles["timer_ready"][1]+"}\ .lowrack{"+css_styles["lowrack"][1]+"}\ .farmicart_lowrack td{"+css_styles["farmicart_lowrack"][1]+"}\ .systemMsg_marketsale{"+css_styles["systemMsg_marketsale"][1]+"}\ .systemMsg_contractsale{"+css_styles["systemMsg_contractsale"][1]+"}\ #timeHolder{"+css_styles["timeholder"][1]+"}" ); // ************************************************** // ChangeData server // -->> add var to delte also to resetVariables err_trace="ChangeData server"; try{ changedata = GM_getValue(COUNTRY+"_"+SERVER+"_changedata",0); // switch(changedata){ // case 1:case 2: case 3:case 4:case 5:case 6:{ // } // } if(changedata<7){ GM_setValue(COUNTRY+"_"+SERVER+"_changedata",7); } }catch(err){GM_logError("changedata server\n"+err);} // ChangeData account err_trace="ChangeData account"; try{ changedata = GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_changedata",0); switch(changedata){ case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10: case 11:case 12:case 13:case 14:{ css_styles = INIT_CSS_STYLES; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_css_styles",implode(css_styles)); } case 15:case 16:case 17:{ css_styles["timeholder"] = INIT_CSS_STYLES["timeholder"]; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_css_styles",implode(css_styles)); } case 18:{ for(tag in css_styles){ if(!css_styles.hasOwnProperty(tag)){ continue; } css_styles[tag][1]=css_styles[tag][1].replace(/-moz-border-radius/g,"border-radius"); } GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_css_styles",implode(css_styles)); } case 19:{ // Converting object "kauf" to array var old_obj = explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_kauf","{}"),"ChangeData19/kauf",{}); var new_arr = []; for(var id in old_obj){ if(!old_obj.hasOwnProperty(id)){ continue; } old_obj[id].splice(0,0,parseInt(id,10)); new_arr.push(old_obj[id]); } GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_kauf",implode(new_arr)); // Converting object "farmiLog" to array var old_obj=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_farmiLog","[]"),"ChangeData19/farmiLog",[]); var new_arr = []; for(var id in old_obj){ if(!old_obj.hasOwnProperty(id)){ continue; } old_obj[id].splice(0,0,parseInt(id,10)); new_arr.push(old_obj[id]); } GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_farmiLog",implode(new_arr)); // Converting object "clubmemberLog" to array var old_obj=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_clubmemberLog","{}"),"ChangeData19/clubmemberLog",{}); var new_arr = []; for(var name in old_obj){ if(!old_obj.hasOwnProperty(name)){ continue; } var new_arr_name = [name,[]]; for(var date in old_obj[name]){ if(!old_obj[name].hasOwnProperty(date)){ continue; } var new_arr_date = [date,old_obj[name][date][0],[]]; for(var prod in old_obj[name][date][1]){ if(!old_obj[name][date][1].hasOwnProperty(prod)){ continue; } new_arr_date[2].push([parseInt(prod,10),old_obj[name][date][1][prod]]); } new_arr_name[1].push(new_arr_date); } new_arr.push(new_arr_name); } GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_clubmemberLog",implode(new_arr)); } case 20:{ // Converting object "lotteryLog" to array var old_obj = explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_lotteryLog","{}"),"ChangeData20/lotteryLog",{}); var new_arr = []; var day; for(var id in old_obj){ if(!old_obj.hasOwnProperty(id)){ continue; } if(id.match(/\d+\.\d+\.\d+/)){ day=id; }else if(id.match(/\d+\.\d+/)){ day=/(\d+)\.(\d+)/.exec(id); if(day[1].length==1){ day=day[2]+"-0"+day[1]; }else{ day=day[2]+"-"+day[1]; } }else{ contine; } old_obj[id].splice(0,0,day); new_arr.push(old_obj[id]); } GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_lotteryLog",implode(new_arr)); // Converting object "levelLog" to array var old_obj = explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_levelLog","{}"),"ChangeData20/levelLog",{}); var new_arr = []; var day; for(var id in old_obj){ if(!old_obj.hasOwnProperty(id)){ continue; } if(id.match(/\d+\.\d+\.\d+/)){ day=id; }else if(id.match(/\d+\.\d+/)){ day=/(\d+)\.(\d+)/.exec(id); if(day[1].length==1){ day=day[2]+"-0"+day[1]; }else{ day=day[2]+"-"+day[1]; } }else{ contine; } old_obj[id].splice(0,0,day); new_arr.push(old_obj[id]); } GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_levelLog",implode(new_arr)); } case 21:{ // Converting object "vertraegeIn" to array var old_obj = explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_vertraegeIn","{}"),"ChangeData21/vertraegeIn",{}); var new_arr = []; for(var id in old_obj){ if(!old_obj.hasOwnProperty(id)){ continue; } old_obj[id].splice(0,0,parseInt(id,10)); new_arr.push(old_obj[id]); } GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_vertraegeIn",implode(new_arr)); // Converting object "vertraegeOut" to array var old_obj = explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_vertraegeOut","{}"),"ChangeData21/vertraegeOut",{}); var new_arr = []; for(var id in old_obj){ if(!old_obj.hasOwnProperty(id)){ continue; } new_arr.push([,old_obj[id]]); } GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_vertraegeOut",implode(new_arr)); } case 22:{ css_styles["timer_ready"] = INIT_CSS_STYLES["timer_ready"]; GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_css_styles",implode(css_styles)); } } if(changedata<23){ GM_setValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_changedata",23); } changedata = null; }catch(err){GM_logError("changedata account\n"+err);} // ************************************************** //Hotkeys err_trace="Hotkeys"; if (GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_valHotkey",true)){ window.addEventListener("keydown",function(event){ if(event.keyCode==27){ // Esc if(unsafeWindow.city){ top.window.wrappedJSObject.initCity(unsafeWindow.city); event.preventDefault(); } else{ top.window.wrappedJSObject.showMain(); event.preventDefault(); } closeInfoPanel(); } if (event.altKey){ switch (event.keyCode){ case hotkeymap["prevPage"]: if(($top("zoneNavi"))&&($top("zoneNavi").firstElementChild)){ click($top("zoneNavi").firstElementChild); event.preventDefault();} else if($top("prevPage")){ click($top("prevPage")); event.preventDefault();} else if($("prevPage")){ click($("prevPage")); event.preventDefault();} break; case hotkeymap["nextPage"]: if(($top("zoneNavi"))&&($top("zoneNavi").lastChild)){ click($top("zoneNavi").lastChild); event.preventDefault();} else if($top("nextPage")){ click($top("nextPage")); event.preventDefault();} else if($("nextPage")){ click($("nextPage")); event.preventDefault();} break; case hotkeymap["farm1"]: top.window.wrappedJSObject.initZones(1); top.window.wrappedJSObject.showMain(); event.preventDefault(); break; // 1:Farm 1 case hotkeymap["farm2"]: if(parseInt(top.window.wrappedJSObject.farmamount,10)>1){ top.window.wrappedJSObject.initZones(2); top.window.wrappedJSObject.showMain(); event.preventDefault(); } break; // 2:Farm 2 case hotkeymap["farm3"]: if(parseInt(top.window.wrappedJSObject.farmamount,10)>2){ top.window.wrappedJSObject.initZones(3); top.window.wrappedJSObject.showMain(); event.preventDefault(); } break; // 3:Farm 3 case hotkeymap["guild"]: top.window.wrappedJSObject.showMain(); top.window.wrappedJSObject.initGuild(); event.preventDefault(); break; // 4:Club case hotkeymap["city1"]: if($top("speedlink_city1")){ click($top("speedlink_city1")); } else{ if($top("citymaincontainer").style.display=="block"){ if($top("cityzone_2_3")){ click($top("cityzone_2_3")); } }else{ click($top("mainmenue1")); } } event.preventDefault(); break; // 5:Dorf1 case hotkeymap["city2"]: if($top("speedlink_city2")){ click($top("speedlink_city2")); } else{ if($top("citymaincontainer").style.display=="block"){ if($top("cityzone_1_9")){ click($top("cityzone_1_9")); } }else{ click($top("mainmenue1")); var gotocitytimeout=window.setInterval(function(){ if($top("cityzone_1_9")){ click($top("cityzone_1_9")); clearTimeout(gotocitytimeout); } },200); } } event.preventDefault(); break; // 6:Dorf2 case hotkeymap["farmilog"]: click($top("customerstats")); event.preventDefault(); break; // F:FarmiLog case hotkeymap["help"]: click($top("mainmenue5")); event.preventDefault(); break; // H:Hilfe case hotkeymap["market"]: showMarket(); event.preventDefault(); break; // M:Markt case hotkeymap["marketstand"]: showMarketStall(); event.preventDefault(); break; // ,:Marktstand case hotkeymap["messages"]: click($top("mainmenue2")); event.preventDefault(); break; // N:Nachrichten case hotkeymap["options"]: click($top("berateroptionen")); event.preventDefault(); break; // O:Optionen case hotkeymap["profit"]: click($top("profitcalc")); event.preventDefault(); break; // P:Profit case hotkeymap["sgh"]: showSGH(); event.preventDefault(); break; // S:SGH case hotkeymap["overview"]: click($top("titlepig")); event.preventDefault(); break; // U:Uebersicht case hotkeymap["contract"]: click($top("mainmenue3")); event.preventDefault(); break; // V:Vertrag case hotkeymap["systemmessage"]: if (GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_nachrichten_doread","")){ var help=explode(GM_getValue(COUNTRY+"_"+SERVER+"_"+USERNAME+"_nachrichten_doread","[]"),"eventListener@keydown/nachrichten_doread",[]); showMessage("system","1",help[help.length-1],0); }else{ showMultiframePage("nachrichten/system.php"); } event.preventDefault(); break; // X:next Message/Systemmessages } } },false); } err_trace="Page switch"; if(DEVMODE){ GM_log("loading page:"+PAGE); } switch (PAGE){ case "stadt/shop": do_shop();break; case "stadt/stats": do_stats();break; case "stadt/wettbewerb": do_wettbewerb();break; case "main": do_main();break; case "vertraege/new": do_multiframe();do_vertraege_head();do_vertraege_new();break; case "vertraege/overview": do_multiframe();do_vertraege_head();do_vertraege_overview();break; case "vertraege/show": do_multiframe();do_vertraege_head();do_vertraege_show();break; case "nutzer/profil": do_multiframe();break; case "nutzer/usecoins": do_multiframe();break; case "hilfe": do_multiframe();do_hilfe();break; case "login": do_login();break; } }else{ do_login(); } window.setTimeout(function(){ unsafeData.beraterDone=true; raiseEvent("beraterDone"); },100); } }catch(err){ GM_logError("startScript ("+err_trace+")\npage="+location.href+"\n"+err); } } function initScript(time){ try{ var div; if((document.readyState=="complete")||(document.readyState=="loaded")){ if((self==top)&&(div=$("bubbleBeraterNotLoaded"))){ removeElement(div); } startScript(); }else{ if(time>0){ if(self==top){ div=$("bubbleBeraterNotLoaded"); if(!div){ div=createElement("div",{"id":"bubbleBeraterNotLoaded","style":"position:absolute;top:0;left:0;width:340px;padding:30px;background-color:yellow;border:3px solid black;border-radius:10px;z-index:1000;font-family:Verdana,sans-serif;color:#000000;font-size:12pt;font-weight:bold;"},document.getElementsByTagName("body")[0]); } div.innerHTML = "Page '"+location.href+"' is not completely loaded.<br><br>Reload in "+time+"sec."; } window.setTimeout(function(){ initScript(--time); },1000); }else{ location.href=location.href; } } }catch(err){GM_logError("initScript\n"+err);} } initScript(20);