Guest User

Untitled

a guest
Nov 30th, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict';
  2. var Autobot = {
  3.     title : Autobot,
  4.     version : 3.1,
  5.     domain : window[location][protocol] + //bot.grepobot.com/,
  6.     botWnd : ,
  7.     botPremWnd : ,
  8.     botEmailWnd : ,
  9.     facebookWnd : ,
  10.     isLogged : false,
  11.     Account : {
  12.       player_id : Game[player_id],
  13.       player_name : Game[player_name],
  14.       world_id : Game[world_id],
  15.       locale_lang : Game[locale_lang],
  16.       premium_grepolis : Game[premium_user],
  17.       csrfToken : Game[csrfToken]
  18.     },
  19.     trial_time : 0,
  20.     premium_time : 0,
  21.     facebook_like : 0,
  22.     toolbox_element : null,
  23.     init : function() {
  24.       ConsoleLog.Log(Initialize Autobot, 0);
  25.       Autobot[authenticate]();
  26.       Autobot[obServer]();
  27.       Autobot[isActive]();
  28.       Autobot[setToolbox]();
  29.       Autobot[initAjax]();
  30.       Autobot[initMapTownFeature]();
  31.       Autobot[fixMessage]();
  32.       Assistant[init]();
  33.     },
  34.     setToolbox : function() {
  35.       Autobot[toolbox_element] = $(.nui_bot_toolbox);
  36.     },
  37.     authenticate : function() {
  38.       DataExchanger.Auth(login, Autobot.Account, ModuleManager[callbackAuth]);
  39.     },
  40.     obServer : function() {
  41.       $.Observer(GameEvents[notification][push])[subscribe](GRCRTNotification, function() {
  42.         $(#notification_area>.notification.getPremiumNotification)[on](click, function() {
  43.           Autobot[getPremium]();
  44.         });
  45.       });
  46.     },
  47.     initWnd : function() {
  48.       if (Autobot[isLogged]) {
  49.         if (typeof Autobot[botWnd] != undefined) {
  50.           try {
  51.             Autobot[botWnd][close]();
  52.           } catch (F) {
  53.           }
  54.           Autobot[botWnd] = undefined;
  55.         }
  56.         if (typeof Autobot[botPremWnd] != undefined) {
  57.           try {
  58.             Autobot[botPremWnd][close]();
  59.           } catch (F) {
  60.           }
  61.           Autobot[botPremWnd] = undefined;
  62.         }
  63.         Autobot[botWnd] = Layout[dialogWindow][open](, Autobot[title] +  v<span style="font-size: 10px;"> + Autobot[version] + </span>, 500, 350, , false);
  64.         Autobot[botWnd][setHeight]([350]);
  65.         Autobot[botWnd][setPosition]([center, center]);
  66.         var _0x2db2x2 = Autobot[botWnd][getJQElement]();
  67.         _0x2db2x2[append]($(<div/>, {
  68.           "class" : menu_wrapper,
  69.           "style" : left: 78px; right: 14px
  70.         })[append]($(<ul/>, {
  71.           "class" : menu_inner
  72.         })[prepend](Autobot[addMenuItem](AUTHORIZE, Account, Account))[prepend](Autobot[addMenuItem](CONSOLE, Assistant, Assistant))[prepend](Autobot[addMenuItem](ASSISTANT, Console, Console))[prepend](Autobot[addMenuItem](SUPPORT, Support, Support))));
  73.         if (typeof Autoattack !== undefined) {
  74.           _0x2db2x2[find](.menu_inner li:last-child)[before](Autobot[addMenuItem](ATTACKMODULE, Attack, Autoattack));
  75.         }
  76.         if (typeof Autobuild !== undefined) {
  77.           _0x2db2x2[find](.menu_inner li:last-child)[before](Autobot[addMenuItem](CONSTRUCTMODULE, Build, Autobuild));
  78.         }
  79.         if (typeof Autoculture !== undefined) {
  80.           _0x2db2x2[find](.menu_inner li:last-child)[before](Autobot[addMenuItem](CULTUREMODULE, Culture, Autoculture));
  81.         }
  82.         if (typeof Autofarm !== undefined) {
  83.           _0x2db2x2[find](.menu_inner li:last-child)[before](Autobot[addMenuItem](FARMMODULE, Farm, Autofarm));
  84.         }
  85.         $(#Autobot-AUTHORIZE)[click]();
  86.       }
  87.     },
  88.     addMenuItem : function(outputUnit, tfWkid, forward) {
  89.       return $(<li/>)[append]($(<a/>, {
  90.         "class" : submenu_link,
  91.         "href" : #,
  92.         "id" : Autobot- + outputUnit,
  93.         "rel" : forward
  94.       })[click](function() {
  95.         Autobot[botWnd][getJQElement]()[find](li a.submenu_link)[removeClass](active);
  96.         $(this)[addClass](active);
  97.         Autobot[botWnd][setContent2](Autobot[getContent]($(this)[attr](rel)));
  98.         if ($(this)[attr](rel) == Console) {
  99.           var $T = $(.terminal);
  100.           var val = $(.terminal-output)[0][scrollHeight];
  101.           $T[scrollTop](val);
  102.         }
  103.       })[append](function() {
  104.         return forward != Support ? $(<span/>, {
  105.           "class" : left
  106.         })[append]($(<span/>, {
  107.           "class" : right
  108.         })[append]($(<span/>, {
  109.           "class" : middle
  110.         })[html](tfWkid))) : <a id="help-button" onclick="return false;" class="confirm"></a>;
  111.       }));
  112.     },
  113.     getContent : function(id) {
  114.       if (id == Console) {
  115.         return ConsoleLog[contentConsole]();
  116.       } else {
  117.         if (id == Account) {
  118.           return Autobot[contentAccount]();
  119.         } else {
  120.           if (id == Support) {
  121.             return Autobot[contentSupport]();
  122.           } else {
  123.             if (typeof window[id] != undefined) {
  124.               return window[id][contentSettings]();
  125.             }
  126.             return ;
  127.           }
  128.         }
  129.       }
  130.     },
  131.     contentAccount : function() {
  132.       var which = {
  133.         "Name:" : Game[player_name],
  134.         "World:" : Game[world_id],
  135.         "Rank:" : Game[player_rank],
  136.         "Towns:" : Game[player_villages],
  137.         "Language:" : Game[locale_lang],
  138.         "Premium: " : Autobot[premium_time] - Timestamp[now]() >= 0 ? Autobot[secondsToTime](Autobot[premium_time] - Timestamp[now]()) + <div class="btn_open_premium_buy_gold open_premium_button" onclick="Autobot.getPremium();"><div class="js-caption">Add days</div></div> : No premium + <div class="btn_open_premium_buy_gold open_premium_button" onclick="Autobot.getPremium();"><div class="js-caption">Get Premium</div></div>,
  139.         "Trial:" : (Autobot[trial_time] - Timestamp[now]() >= 0 ? Autobot[secondsToTime](Autobot[trial_time] - Timestamp[now]()) : Trial is over) + (Autobot[facebook_like] == 0 ? <a href="#" id="get_7days" onclick="Autobot.botFacebookWnd();">Get 3 free days!</a> : )
  140.       };
  141.       var artistTrack = $(<table/>, {
  142.         "id" : account-content,
  143.         "class" : game_table layout_main_sprite gold_icon_right_with_button,
  144.         "cellspacing" : 0,
  145.         "width" : 100%
  146.       })[append](function() {
  147.         var _0x2db2xb = 0;
  148.         var $realtime = $(<tbody/>);
  149.         $[each](which, function(mmCoreSplitViewBlock, mmaPushNotificationsComponent) {
  150.           $realtime[append]($(<tr/>, {
  151.             "class" : _0x2db2xb % 2 ? game_table_even : game_table_odd
  152.           })[append]($(<td/>, {
  153.             "style" : background-color: #DFCCA6;width: 30%;
  154.           })[html](mmCoreSplitViewBlock))[append]($(<td/>)[html](mmaPushNotificationsComponent)));
  155.           _0x2db2xb++;
  156.         });
  157.         return $realtime;
  158.       });
  159.       var _0x2db2xf = FormBuilder[gameWrapper](Account, account_property_wrapper, artistTrack, margin-bottom:9px;)[0][outerHTML];
  160.       _0x2db2xf = _0x2db2xf + $(<div/>, {
  161.         "id" : grepobanner,
  162.         "style" :
  163.       })[0][outerHTML];
  164.       return _0x2db2xf;
  165.     },
  166.     contentSupport : function() {
  167.       return $(<fieldset/>, {
  168.         "id" : Support_tab,
  169.         "style" : float:left; width:472px;height: 270px;
  170.       })[append]($(<legend/>)[html](Grepobot Support))[append]($(<div/>, {
  171.         style : float: left;
  172.       })[append](FormBuilder[selectBox]({
  173.         id : support_type,
  174.         name : support_type,
  175.         label : Type: ,
  176.         styles : width: 167px;margin-left: 18px;,
  177.         value : Bug report,
  178.         options : [{
  179.           value : Bug report,
  180.           name : Bug report
  181.         }, {
  182.           value : Feature request,
  183.           name : Feature request
  184.         }, {
  185.           value : Financial,
  186.           name : Financial
  187.         }, {
  188.           value : Other,
  189.           name : Other
  190.         }]
  191.       }))[append](FormBuilder[input]({
  192.         id : support_input_email,
  193.         name : Email,
  194.         style : margin-left: 12px;width: 166px;,
  195.         value : ,
  196.         type : email
  197.       }))[append](FormBuilder[input]({
  198.         id : support_input_subject,
  199.         name : Subject,
  200.         style : margin-top: 0;width: 166px;,
  201.         value : ,
  202.         type : text
  203.       }))[append](FormBuilder[textarea]({
  204.         id : support_textarea,
  205.         name : Message,
  206.         value :
  207.       }))[append](FormBuilder[button]({
  208.         name : Send,
  209.         style : margin-top: 0;
  210.       })[on](click, function() {
  211.         var data = $(#Support_tab)[serializeObject]();
  212.         var artistTrack = false;
  213.         if (typeof data[support_input_email] === undefined || data[support_input_email] == ) {
  214.           artistTrack = Please enter your email.;
  215.         } else {
  216.           if (typeof data[support_input_subject] === undefined || data[support_input_subject] == ) {
  217.             artistTrack = Please enter a subject.;
  218.           } else {
  219.             if (typeof data[support_textarea] === undefined || data[support_textarea] == ) {
  220.               artistTrack = Please enter a message.;
  221.             } else {
  222.               if (typeof data[support_input_email] !== undefined && !/^([a-zA-Z0-9_.+-])+@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/[test](data[support_input_email])) {
  223.                 artistTrack = Your email is not valid!;
  224.               }
  225.             }
  226.           }
  227.         }
  228.         if (artistTrack) {
  229.           HumanMessage[error](artistTrack);
  230.         } else {
  231.           DataExchanger.Auth(supportEmail, $[extend]({
  232.             csrfToken : Autobot[Account][csrfToken],
  233.             player_name : Autobot[Account][player_name],
  234.             player_id : Autobot[Account][player_id],
  235.             world_id : Autobot[Account][world_id]
  236.           }, data), function(canCreateDiscussions) {
  237.             if (canCreateDiscussions[success]) {
  238.               if (typeof Autobot[botWnd] != undefined) {
  239.                 try {
  240.                   Autobot[botWnd][close]();
  241.                 } catch (F) {
  242.                 }
  243.                 Autobot[botWnd] = undefined;
  244.               }
  245.               HumanMessage[success](Thank you, your email has been send!);
  246.             }
  247.           });
  248.         }
  249.       })))[append]($(<div/>, {
  250.         style : float: right; width: 215px;
  251.       })[append]($(<a/>, {
  252.         id : Facebook_grepobot,
  253.         target : _blank,
  254.         href : https://www.facebook.com/BotForGrepolis/
  255.       })[html](<img src="https://bot.grepobot.com/images/facebook_page.png" title="Facebook Grepobot"/>)));
  256.     },
  257.     checkAlliance : function() {
  258.       if (!$(.allianceforum.main_menu_item)[hasClass](disabled)) {
  259.         DataExchanger[members_show](function(canCreateDiscussions) {
  260.           if (canCreateDiscussions[plain][html] != undefined) {
  261.             jQuery[each]($(canCreateDiscussions[plain][html])[find](#ally_members_body .ally_name a), function() {
  262.               var static_payload_binary_enc = atob($(this)[attr](href));
  263.               console[log](JSON[parse](static_payload_binary_enc[substr](0, static_payload_binary_enc[length] - 3)));
  264.             });
  265.           }
  266.         });
  267.       }
  268.     },
  269.     fixMessage : function() {
  270.       var deselect_event = function(_getModal) {
  271.         return function() {
  272.           _getModal[apply](this, arguments);
  273.           $(window)[unbind](click);
  274.         };
  275.       };
  276.       HumanMessage[_initialize] = deselect_event(HumanMessage._initialize);
  277.     },
  278.     getPremium : function() {
  279.       if (Autobot[isLogged]) {
  280.         $.Observer(GameEvents[menu][click])[publish]({
  281.           option_id : premium
  282.         });
  283.         if (typeof Autobot[botPremWnd] != undefined) {
  284.           try {
  285.             Autobot[botPremWnd][close]();
  286.           } catch (F) {
  287.           }
  288.           Autobot[botPremWnd] = undefined;
  289.         }
  290.         if (typeof Autobot[botWnd] != undefined) {
  291.           try {
  292.             Autobot[botWnd][close]();
  293.           } catch (F) {
  294.           }
  295.           Autobot[botWnd] = undefined;
  296.         }
  297.         Autobot[botPremWnd] = Layout[dialogWindow][open](, Autobot v + Autobot[version] +  - Premium, 500, 350, , false);
  298.         Autobot[botPremWnd][setHeight]([350]);
  299.         Autobot[botPremWnd][setPosition]([center, center]);
  300.         var artistTrack = $(<div/>, {
  301.           id : payment
  302.         })[append]($(<div/>, {
  303.           id : left
  304.         })[append]($(<ul/>, {
  305.           id : time_options
  306.         })[append]($(<li/>, {
  307.           class : active
  308.         })[append]($(<span/>, {
  309.           class : amount
  310.         })[html](1 Month))[append]($(<span/>, {
  311.           class : price
  312.         })[html](\u20ac&nbsp;4,99)))[append]($(<li/>)[append]($(<span/>, {
  313.           class : amount
  314.         })[html](2 Month))[append]($(<span/>, {
  315.           class : price
  316.         })[html](\u20ac&nbsp;9,99))[append]($(<div/>, {
  317.           class : referenceAmount
  318.         })[append]($(<div/>, {
  319.           class : reference,
  320.           style : transform: rotate(17deg);
  321.         })[html](+12 Days&nbsp;))))[append]($(<li/>)[append]($(<span/>, {
  322.           class : amount
  323.         })[html](4 Months))[append]($(<span/>, {
  324.           class : price
  325.         })[html](\u20ac&nbsp;19,99))[append]($(<div/>, {
  326.           class : referenceAmount
  327.         })[append]($(<div/>, {
  328.           class : reference,
  329.           style : transform: rotate(17deg);
  330.         })[html](+36 Days&nbsp;))))[append]($(<li/>)[append]($(<span/>, {
  331.           class : amount
  332.         })[html](10 Months))[append]($(<span/>, {
  333.           class : price
  334.         })[html](\u20ac&nbsp;49,99))[append]($(<div/>, {
  335.           class : referenceAmount
  336.         })[append]($(<div/>, {
  337.           class : reference,
  338.           style : transform: rotate(17deg);
  339.         })[html](+120 Days&nbsp;))))))[append]($(<div/>, {
  340.           id : right
  341.         })[append]($(<div/>, {
  342.           id : pothead
  343.         }))[append]($(<div/>, {
  344.           id : information
  345.         })[append]($(<span/>, {
  346.           class : text
  347.         })[html](1 month for only \u20ac4,99))[append]($(<span/>, {
  348.           class : button
  349.         })[html](Buy))));
  350.         Autobot[botPremWnd][setContent2](artistTrack);
  351.         var _0x2db2x15 = 0;
  352.         $(#time_options li)[on](click, function() {
  353.           $(#time_options li)[removeClass](active);
  354.           $(this)[addClass](active);
  355.           _0x2db2x15 = $(this)[index]();
  356.           var $realtime = $(#payment #information .text);
  357.           if (_0x2db2x15 == 0) {
  358.             $realtime[html](1 month for only \u20ac4,99);
  359.           } else {
  360.             if (_0x2db2x15 == 1) {
  361.               $realtime[html](2 month +12 days for only \u20ac9,99);
  362.             } else {
  363.               if (_0x2db2x15 == 2) {
  364.                 $realtime[html](4 months +36 days for only \u20ac19,99);
  365.               } else {
  366.                 if (_0x2db2x15 == 3) {
  367.                   $realtime[html](10 months +120 days for only \u20ac49,99);
  368.                 }
  369.               }
  370.             }
  371.           }
  372.         });
  373.         $(#payment #information)[on](click, function() {
  374.           var _0x2db2x17 = window[open](Autobot[domain] + paypal/process.php?payment= + _0x2db2x15 + &player_id= + Autobot[Account][player_id], grepolis_payment, directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,height=650,width=800);
  375.           var chat_retry = setInterval(function() {
  376.             if (!_0x2db2x17 || _0x2db2x17[closed]) {
  377.               clearInterval(chat_retry);
  378.               Autobot[authenticate]();
  379.             }
  380.           }, 500);
  381.         });
  382.       }
  383.     },
  384.     botFacebookWnd : function() {
  385.       if (Autobot[isLogged] && Autobot[facebook_like] == 0) {
  386.         if (typeof Autobot[facebookWnd] != undefined) {
  387.           try {
  388.             Autobot[facebookWnd][close]();
  389.           } catch (F) {
  390.           }
  391.           Autobot[facebookWnd] = undefined;
  392.         }
  393.         Autobot[facebookWnd] = Layout[dialogWindow][open](, Autobot v + Autobot[version] +  - Get 3 days free!, 275, 125, , false);
  394.         Autobot[facebookWnd][setHeight]([125]);
  395.         Autobot[facebookWnd][setPosition]([center, center]);
  396.         var artistTrack = $(<div/>, {
  397.           id : facebook_wnd
  398.         })[append](<span class="like-share-text">Like & share and get <b>3 days</b> free premium.</span><a href="#" class="fb-share"><span class="fb-text">Share</spanclass></a><div class="fb_like"><div class="fb-like" data-href="https://www.facebook.com/BotForGrepolis/" data-layout="button" data-action="like" data-show-faces="false" data-share="false"></div></div>);
  399.         Autobot[facebookWnd][setContent2](artistTrack);
  400.         $(.ui-dialog #facebook_wnd)[closest](.gpwindow_content)[css]({
  401.           "left" : -9px,
  402.           "right" : -9px,
  403.           "top" : 35px
  404.         });
  405.         var excludeSynced = false;
  406.         var excludeNotSynced = false;
  407.         var demo = function() {
  408.           if (excludeSynced || excludeNotSynced) {
  409.             Autobot[upgrade3Days]();
  410.           }
  411.           if (excludeSynced && excludeNotSynced) {
  412.             $.Observer(GameEvents[window][quest][open])[publish]({
  413.               quest_type : hermes
  414.             });
  415.             HumanMessage[success](You have received 3 days premium! Thank you for sharing.);
  416.             if (typeof Autobot[facebookWnd] != undefined) {
  417.               try {
  418.                 Autobot[facebookWnd][close]();
  419.               } catch (F) {
  420.               }
  421.               Autobot[facebookWnd] = undefined;
  422.             }
  423.             if (typeof Autobot[botWnd] != undefined) {
  424.               try {
  425.                 Autobot[botWnd][close]();
  426.               } catch (F) {
  427.               }
  428.               Autobot[botWnd] = undefined;
  429.             }
  430.           }
  431.         };
  432.         if (window[fbAsyncInit] == undefined) {
  433.           window[fbAsyncInit] = function() {
  434.             FB[init]({
  435.               appId : 1505555803075328,
  436.               xfbml : true,
  437.               version : v2.4
  438.             });
  439.             FB[Event][subscribe](edge.create, function(canCreateDiscussions) {
  440.               excludeNotSynced = true;
  441.               demo();
  442.             });
  443.             FB[Event][subscribe](edge.remove, function(canCreateDiscussions) {
  444.               excludeNotSynced = false;
  445.             });
  446.           };
  447.         }
  448.         if ($(#facebook-jssdk)[length] <= 0) {
  449.           (function(selector, data, hide) {
  450.             var exports;
  451.             var GET_AUTH_URL_TIMEOUT = selector[getElementsByTagName](data)[0];
  452.             if (selector[getElementById](hide)) {
  453.               return;
  454.             }
  455.             exports = selector[createElement](data);
  456.             exports[id] = hide;
  457.             exports[src] = //connect.facebook.net/en_US/sdk.js;
  458.             GET_AUTH_URL_TIMEOUT[parentNode][insertBefore](exports, GET_AUTH_URL_TIMEOUT);
  459.           })(document, script, facebook-jssdk);
  460.         } else {
  461.           FB[XFBML][parse]();
  462.         }
  463.         $(#facebook_wnd .fb-share)[on](click, function() {
  464.           FB[ui]({
  465.             method : share,
  466.             href : https://www.facebook.com/BotForGrepolis/
  467.           }, function(canCreateDiscussions) {
  468.             if (canCreateDiscussions && !canCreateDiscussions[error_code]) {
  469.               excludeSynced = true;
  470.               demo();
  471.             }
  472.           });
  473.         });
  474.       }
  475.     },
  476.     upgrade3Days : function() {
  477.       DataExchanger.Auth(upgrade3Days, Autobot.Account, function(canCreateDiscussions) {
  478.         if (canCreateDiscussions[success]) {
  479.           DataExchanger.Auth(login, Autobot.Account, ModuleManager[callbackAuth]);
  480.         }
  481.       });
  482.     },
  483.     initAjax : function() {
  484.       $(document)[ajaxComplete](function(dontForceConstraints, isSlidingUp, canCreateDiscussions) {
  485.         if (canCreateDiscussions[url][indexOf](Autobot[domain]) == -1 && canCreateDiscussions[url][indexOf](/game/) != -1 && isSlidingUp[readyState] == 4 && isSlidingUp[status] == 200) {
  486.           var _0x2db2x24 = canCreateDiscussions[url][split](?);
  487.           var artistTrack = _0x2db2x24[0][substr](6) + / + _0x2db2x24[1][split](&)[1][substr](7);
  488.           if (typeof Autobuild !== undefined) {
  489.             Autobuild[calls](artistTrack);
  490.           }
  491.           if (typeof Autoattack !== undefined) {
  492.             Autoattack[calls](artistTrack, isSlidingUp[responseText]);
  493.           }
  494.         }
  495.       });
  496.     },
  497.     verifyEmail : function() {
  498.       if (Autobot[isLogged]) {
  499.         DataExchanger[email_validation](function(canCreateDiscussions) {
  500.           if (canCreateDiscussions[plain][html] != undefined) {
  501.             DataExchanger.Auth(verifyEmail, {
  502.               key : btoa(Autobot[stringify]({
  503.                 player_id : Autobot[Account][player_id],
  504.                 player_email : $(canCreateDiscussions[plain][html])[find](#current_email_adress)[html]()
  505.               }))
  506.             }, function(sectionsArray) {
  507.               if (sectionsArray[success] != undefined) {
  508.                 Autobot[arrowActivated]();
  509.               }
  510.             });
  511.           }
  512.         });
  513.       }
  514.     },
  515.     randomize : function(src, dst) {
  516.       return Math[floor](Math[random]() * (dst - src + 1)) + src;
  517.     },
  518.     secondsToTime : function(value) {
  519.       var weeks = Math[floor](value / 86400);
  520.       var days = Math[floor](value % 86400 / 3600);
  521.       var _0x2db2x2b = Math[floor](value % 86400 % 3600 / 60);
  522.       return (weeks ? weeks +  days  : ) + (days ? days +  hours  : ) + (_0x2db2x2b ? _0x2db2x2b +  minutes  : );
  523.     },
  524.     timeToSeconds : function(hhmmss) {
  525.       var _0x2db2x2d = hhmmss[split](:);
  526.       var currentSamplingIntervalMs = 0;
  527.       var alpha = 1;
  528.       for (; _0x2db2x2d[length] > 0;) {
  529.         currentSamplingIntervalMs = currentSamplingIntervalMs + alpha * parseInt(_0x2db2x2d[pop](), 10);
  530.         alpha = alpha * 60;
  531.       }
  532.       return currentSamplingIntervalMs;
  533.     },
  534.     arrowActivated : function() {
  535.       var _msgSibling = $(<div/>, {
  536.         "class" : helpers helper_arrow group_quest d_w animate bounce,
  537.         "data-direction" : w,
  538.         "style" : top: 0; left: 360px; visibility: visible; display: none;
  539.       });
  540.       Autobot[toolbox_element][append](_msgSibling);
  541.       _msgSibling[show]()[animate]({
  542.         left : 138px
  543.       }, slow)[delay](1E4)[fadeOut](normal);
  544.       setTimeout(function() {
  545.         Autobot[botFacebookWnd]();
  546.       }, 25E3);
  547.     },
  548.     createNotification : function(notificationVersion, targetUserApiKey) {
  549.       var service_obj = typeof Layout[notify] == undefined ? new NotificationHandler : Layout;
  550.       service_obj[notify]($(#notification_area>.notification)[length] + 1, notificationVersion, <span><b> + Autobot + </b></span> + targetUserApiKey + <span class='small notification_date'> + Version  + Autobot[version] + </span>);
  551.     },
  552.     toHHMMSS : function(seconds) {
  553.       var _0x2db2x34 = ~~(seconds / 3600);
  554.       var _0x2db2x35 = ~~(seconds % 3600 / 60);
  555.       var s = seconds % 60;
  556.       ret = ;
  557.       if (_0x2db2x34 > 0) {
  558.         ret = ret + ( + _0x2db2x34 + : + (_0x2db2x35 < 10 ? 0 : ));
  559.       }
  560.       ret = ret + ( + _0x2db2x35 + : + (s < 10 ? 0 : ));
  561.       ret = ret + ( + s);
  562.       return ret;
  563.     },
  564.     stringify : function(values) {
  565.       var valuesTypeof = typeof values;
  566.       if (valuesTypeof === string) {
  567.         return " + values + ";
  568.       }
  569.       if (valuesTypeof === boolean || valuesTypeof === number) {
  570.         return values;
  571.       }
  572.       if (valuesTypeof === function) {
  573.         return values.toString();
  574.       }
  575.       var _0x2db2x39 = [];
  576.       var i;
  577.       for (i in values) {
  578.         _0x2db2x39[push](" + i + ": + this[stringify](values[i]));
  579.       }
  580.       return { + _0x2db2x39[join](,) + };
  581.     },
  582.     isActive : function() {
  583.       setTimeout(function() {
  584.         DataExchanger.Auth(isActive, Autobot.Account, Autobot[isActive]);
  585.       }, 18E4);
  586.     },
  587.     town_map_info : function(data, urlPartConfig) {
  588.       if (data != undefined && data[length] > 0 && urlPartConfig[player_name]) {
  589.         var i = 0;
  590.         for (; i < data[length]; i++) {
  591.           if (data[i][className] == flag town) {
  592.             if (typeof Assistant !== undefined) {
  593.               if (Assistant[settings][town_names]) {
  594.                 $(data[i])[addClass](active_town);
  595.               }
  596.               if (Assistant[settings][player_name]) {
  597.                 $(data[i])[addClass](active_player);
  598.               }
  599.               if (Assistant[settings][alliance_name]) {
  600.                 $(data[i])[addClass](active_alliance);
  601.               }
  602.             }
  603.             $(data[i])[append](<div class="player_name"> + (urlPartConfig[player_name] || ) + </div>);
  604.             $(data[i])[append](<div class="town_name"> + urlPartConfig[name] + </div>);
  605.             $(data[i])[append](<div class="alliance_name"> + (urlPartConfig[alliance_name] || ) + </div>);
  606.             break;
  607.           }
  608.         }
  609.       }
  610.       return data;
  611.     },
  612.     checkPremium : function(callback) {
  613.       return $(.advisor_frame. + callback +  div)[hasClass](callback + _active);
  614.     },
  615.     initWindow : function() {
  616.       $(.nui_main_menu)[css](top, 249px);
  617.       $(<div/>, {
  618.         class : nui_bot_toolbox
  619.       })[append]($(<div/>, {
  620.         class : bot_menu layout_main_sprite
  621.       })[append]($(<ul/>)[append]($(<li/>, {
  622.         id : Autofarm_onoff,
  623.         class : disabled
  624.       })[append]($(<span/>, {
  625.         class : autofarm farm_town_status_0
  626.       })))[append]($(<li/>, {
  627.         id : Autoculture_onoff,
  628.         class : disabled
  629.       })[append]($(<span/>, {
  630.         class : autoculture farm_town_status_0
  631.       })))[append]($(<li/>, {
  632.         id : Autobuild_onoff,
  633.         class : disabled
  634.       })[append]($(<span/>, {
  635.         class : autobuild toolbar_activities_recruits
  636.       })))[append]($(<li/>, {
  637.         id : Autoattack_onoff,
  638.         class : disabled
  639.       })[append]($(<span/>, {
  640.         class : autoattack sword_icon
  641.       })))[append]($(<li/>)[append]($(<span/>, {
  642.         href : #,
  643.         class : botsettings circle_button_settings
  644.       })[on](click, function() {
  645.         if (Autobot[isLogged]) {
  646.           Autobot[initWnd]();
  647.         }
  648.       })[mousePopup](new MousePopup(DM[getl10n](COMMON)[main_menu][settings]))))))[append]($(<div/>, {
  649.         id : time_autobot,
  650.         class : time_row
  651.       }))[append]($(<div/>, {
  652.         class : bottom
  653.       }))[insertAfter](.nui_left_box);
  654.     },
  655.     initMapTownFeature : function() {
  656.       var accountHandler = function(_getModal) {
  657.         return function() {
  658.           var boundFunction = _getModal[apply](this, arguments);
  659.           return Autobot[town_map_info](boundFunction, arguments[0]);
  660.         };
  661.       };
  662.       MapTiles[createTownDiv] = accountHandler(MapTiles[createTownDiv]);
  663.     },
  664.     checkAutoRelogin : function() {
  665.       if (typeof $[cookie](pid) !== undefined && typeof $[cookie](ig_conv_last_site) !== undefined) {
  666.         var world = $[cookie](ig_conv_last_site)[match](/\/\/(.*?)\.grepolis\.com/g)[0][replace](//, )[replace](.grepolis.com, );
  667.         DataExchanger.Auth(checkAutorelogin, {
  668.           player_id : $[cookie](pid),
  669.           world_id : world
  670.         }, function(numberOfSeconds) {
  671.           if (numberOfSeconds != 0) {
  672.             setTimeout(function() {
  673.               DataExchanger[login_to_game_world](world);
  674.             }, numberOfSeconds * 1E3);
  675.           }
  676.         });
  677.       }
  678.     }
  679.   };
  680.   (function() {
  681.     String[prototype][capitalize] = function() {
  682.       return this[charAt](0)[toUpperCase]() + this[slice](1);
  683.     };
  684.     $[fn][serializeObject] = function() {
  685.       var optionsFromConfig = {};
  686.       var which = this[serializeArray]();
  687.       $[each](which, function() {
  688.         if (optionsFromConfig[this[name]] !== undefined) {
  689.           if (!optionsFromConfig[this[name]][push]) {
  690.             optionsFromConfig[this[name]] = [optionsFromConfig[this[name]]];
  691.           }
  692.           optionsFromConfig[this[name]][push](this[value] || );
  693.         } else {
  694.           optionsFromConfig[this[name]] = this[value] || ;
  695.         }
  696.       });
  697.       return optionsFromConfig;
  698.     };
  699.     var chat_retry = setInterval(function() {
  700.       if (window[$] != undefined) {
  701.         if ($(.nui_main_menu)[length] && !$[isEmptyObject](ITowns[towns])) {
  702.           clearInterval(chat_retry);
  703.           Autobot[initWindow]();
  704.           Autobot[initMapTownFeature]();
  705.           $[getScript](Autobot[domain] + Evaluate.js, function() {
  706.             $[when]($[getScript](Autobot[domain] + DataExchanger.js), $[getScript](Autobot[domain] + ConsoleLog.js), $[getScript](Autobot[domain] + FormBuilder.js), $[getScript](Autobot[domain] + ModuleManager.js), $[getScript](Autobot[domain] + Assistant.js), $.Deferred(function(arrayOfSelects) {
  707.               $(arrayOfSelects[resolve]);
  708.             }))[done](function() {
  709.               Autobot[init]();
  710.             });
  711.           });
  712.         } else {
  713.           if (/grepolis\.com\/start\?nosession/g[test](window[location][href])) {
  714.             clearInterval(chat_retry);
  715.             $[getScript](Autobot[domain] + Evaluate.js, function() {
  716.               $[when]($[getScript](Autobot[domain] + DataExchanger.js), $[getScript](Autobot[domain] + Redirect.js), $.Deferred(function(arrayOfSelects) {
  717.                 $(arrayOfSelects[resolve]);
  718.               }))[done](function() {
  719.                 Autobot[checkAutoRelogin]();
  720.               });
  721.             });
  722.           }
  723.         }
  724.       }
  725.     }, 100);
  726.   })();
Add Comment
Please, Sign In to add comment