DeadBoy24

Untitled

Mar 5th, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var mainLoader = '<img height="80px" src="/img/loader/loader.gif" class="imgLoader">',
  2.     closeGame = false,
  3.     isTrade = false,
  4.     ClassTrade = null,
  5.     ClassBattle = null,
  6.     assault = false,
  7.     UserPokList = [],
  8.     UserPokedex = null,
  9.     md5locList = '',
  10.     battleInfoRage = 0;
  11.  
  12.  
  13. var Aqua = {
  14.   struct: {
  15.     preloader: $('.preloader'),
  16.     locationPreLoader: $('#locationPreloader')
  17.     //model: $('<div />', {'class': 'model'})
  18.   },
  19.   notifications: {
  20.     mainAlert: function() {
  21.       Game.notifications.main('Неверный запрос!', 'error');
  22.     }
  23.   },
  24.   modals: {
  25.     creating: {
  26.       model: function(name) {
  27.         $('.model').remove();
  28.             $('<div />', {
  29.                 'class':'model'
  30.             }).appendTo('body');
  31.         $('<div />', {
  32.                 'class':'header',
  33.           'id': 'drgModel',
  34.                 html: name
  35.             }).appendTo('.model');
  36.         $('<span />', {
  37.                 html: '<i class="fa fa-close"></i>',
  38.           click: function() {
  39.             $('.model').remove();
  40.           }
  41.             }).appendTo('.model .header');
  42.         $('<div />', {
  43.                 'class':'content-model',
  44.           html: mainLoader
  45.             }).appendTo('.model');
  46.         $('.model').draggabilly({
  47.           handle: '#drgModel',
  48.           containment: true
  49.         });
  50.       }
  51.     }
  52.   },
  53.   users: {
  54.     edit: {
  55.       open: function() {
  56.         alert(123);
  57.       },
  58.       redact: function(type, val = false) {
  59.         switch(type){
  60.           case 'pass':
  61.             var oldPass = $('#oldPass').val(),
  62.                 newPass = $('#newPass').val(),
  63.                 dblNewPass = $('#dblNewPass').val();
  64.             if(oldPass.length != 0 || newPass.length != 0 || dblNewPass.length != 0) {
  65.               val = [oldPass, newPass, dblNewPass];
  66.             }else{
  67.               val = 2;
  68.             }
  69.           break;
  70.           case 'audio':
  71.             val = (val ? [val] : [2]);
  72.           break;
  73.           case 'team':
  74.             val = (val ? [val] : [2]);
  75.           break;
  76.           case 'color':
  77.             val = (val ? [val] : [100]);
  78.           break;
  79.         }
  80.         if(type && val) {
  81.           $.ajax({
  82.             url: "/do/aqua",
  83.             type: "POST",
  84.             data: {
  85.                 id: 'edit',
  86.                 type: type,
  87.                 val: val
  88.             },
  89.             success: function (response){
  90.               response = JSON.parse(response);
  91.               if(response.error == 1) {
  92.                 Game.notifications.main(response.text,"error");
  93.               }else{
  94.                 settings();
  95.                 Game.notifications.main("Изменения прошли успешно.","success");
  96.               }
  97.             }
  98.           });
  99.         }else{
  100.           Aqua.notifications.mainAlert();
  101.         }
  102.       }
  103.     }
  104.   },
  105.   loaders: {
  106.     main: function(a) {
  107.             Aqua.struct.preloader.find('span').html(a);
  108.             Aqua.struct.locationPreLoader.delay(500).fadeOut(200);
  109.     }
  110.   },
  111.   autoLoad: function() {
  112.     Aqua.loaders.main('Загрузка...');
  113.   }
  114. }
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122. function editStatus(t,e,s){!t?$("#statusUser").html('<textarea type="text" value="'+s+'" onkeydown="if(event.keyCode == 13){editStatus(\'status\',$(this).val());}" />'):$.ajax({url:"/do/trainers",type:"POST",data:{type:t,value:e},
  123. success:function(t){
  124.   t=JSON.parse(t),
  125.   $("#statusUser").html("<div class='Text'>"+t.text+"</div><div class='Pen' onclick=editStatus(false,false,"+t.text+");><i class='fa fa-pen-square'</div>")
  126. }
  127. })
  128. }
  129. document.onkeydown = function(e) {
  130.   if(e.keyCode == 27) {
  131.     if($('.DivNotification').html() != '') {
  132.       $('.DivNotification .noty').remove();
  133.     }else{
  134.       closeModal();
  135.     }
  136.     return false;
  137.   }
  138.   if((e.altKey && e.keyCode == 'P'.charCodeAt(0))) {
  139.     Game.modals.pokemons();
  140.   }
  141.   if((e.altKey && e.keyCode == 'I'.charCodeAt(0))) {
  142.     Game.modals.inventory('all');
  143.   }
  144.   if((e.altKey && e.keyCode == 'C'.charCodeAt(0))) {
  145.     openModal('craft');
  146.   }
  147.   if((e.altKey && e.keyCode == 'T'.charCodeAt(0))) {
  148.     openModal('trainers');
  149.   }
  150.   if((e.altKey && e.keyCode == 'A'.charCodeAt(0))) {
  151.     Game.modals.diary('quests');
  152.   }
  153. }
  154. $(document).mouseup(function (e) {
  155.     var container = $(".window.pokeInfo");
  156.     if (container.has(e.target).length === 0){
  157.         container.hide();
  158.     }
  159. });
  160. $(document).mouseup(function (e) {
  161.     var container = $(".BlockOtherContent");
  162.     if (container.has(e.target).length === 0){
  163.         container.hide();
  164.     }
  165. });
  166. $(document).mouseup(function (e) {
  167.     var container = $(".smileList");
  168.     if (container.has(e.target).length === 0){
  169.         container.hide();
  170.     }
  171. });
  172. $(document).mouseup(function (e) {
  173.     var container = $(".tooltip");
  174.     if (container.has(e.target).length === 0){
  175.         container.hide();
  176.     }
  177. });
  178. $(document).mouseup(function (e) {
  179.     var container = $(".MiniModal");
  180.     if (container.has(e.target).length === 0){
  181.         container.remove();
  182.     }
  183. });
  184. $(document).on('click', '.GiveDiv .wrap .PokList .PokBtn', function(e) {
  185.   var container = $(".GiveDiv");
  186.   container.remove();
  187. });
  188. $(document).mouseup(function (e) {
  189.     var container = $(".GiveDiv");
  190.     if (container.has(e.target).length === 0){
  191.       container.remove();
  192.     }
  193. });
  194. $(document).mouseup(function (e) {
  195.     var container = $(".TrainerGive");
  196.     if (container.has(e.target).length === 0){
  197.       container.remove();
  198.     }
  199. });
  200. function market_go(id,type,val=false) {
  201.   if(type == 'stavka_item') {
  202.     $('<div />', {
  203.       "class": 'MiniModal',
  204.       html: '<div class="Name" id="drgMini">Добавить лот</div><div class="Content"><div class="Settings"><center><b>Внимание, прочитайте!</b><br> За каждый лот вы платите 10.000 монет.<br>Введите значения <b>через запятую без пробелов</b> (Сначала начальную цену, затем количество предметов, затем цену шага, затем цену выкупа (если хотите без выкупа, то ставьте значение <b>0</b>), затем срок в днях).</center><div class="Step"><input placeholder="Начальная цена, кол-во, шаг, выкуп, срок" onkeydown="if(event.keyCode == 13){market_go('+id+',\'stavka_item_go\',$(this).val());}"></div></div></div>'
  205.       }).appendTo('body');
  206.     $('.MiniModal').draggabilly({
  207.       handle: '#drgMini',
  208.       containment: true
  209.     });
  210.   }else if(type == 'stavka_egg'){
  211.     $('<div />', {
  212.       "class": 'MiniModal',
  213.       html: '<div class="Name" id="drgMini">Добавить лот</div><div class="Content"><div class="Settings"><center><b>Внимание, прочитайте!</b><br> За каждый лот вы платите 10.000 монет.<br>Введите значения <b>через запятую без пробелов</b> (Сначала начальную цену, затем цену шага, затем цену выкупа (если хотите без выкупа, то ставьте значение <b>0</b>), затем срок в днях).</center><div class="Step"><input placeholder="Начальная цена, шаг, выкуп, срок" onkeydown="if(event.keyCode == 13){market_go('+id+',\'stavka_egg_go\',$(this).val());}"></div></div></div>'
  214.       }).appendTo('body');
  215.     $('.MiniModal').draggabilly({
  216.       handle: '#drgMini',
  217.       containment: true
  218.     });
  219.   }else if(type == 'stavka_pokemon'){
  220.     $('<div />', {
  221.       "class": 'MiniModal',
  222.       html: '<div class="Name" id="drgMini">Добавить лот</div><div class="Content"><div class="Settings"><center><b>Внимание, прочитайте!</b><br> За каждый лот вы платите 10.000 монет.<br>Введите значения <b>через запятую без пробелов</b> (Сначала начальную цену, затем цену шага, затем цену выкупа (если хотите без выкупа, то ставьте значение <b>0</b>), затем срок в днях).</center><div class="Step"><input placeholder="Начальная цена, шаг, выкуп, срок" onkeydown="if(event.keyCode == 13){market_go('+id+',\'stavka_pokemon_go\',$(this).val());}"></div></div></div>'
  223.       }).appendTo('body');
  224.     $('.MiniModal').draggabilly({
  225.       handle: '#drgMini',
  226.       containment: true
  227.     });
  228.   }else if(type == 'stavka') {
  229.     $('<div />', {
  230.       "class": 'MiniModal',
  231.       html: '<div class="Name" id="drgMini">Добавить ставку, лот №'+id+'</div><div class="Content"><div class="Settings"><div class="Step"><input placeholder="Количество монет..." onkeydown="if(event.keyCode == 13){market_go('+id+',\'stavka_go\',$(this).val());}"></div></div></div>'
  232.       }).appendTo('body');
  233.     $('.MiniModal').draggabilly({
  234.       handle: '#drgMini',
  235.       containment: true
  236.     });
  237.   }else{
  238.     $.ajax({
  239.       url: "/do/marketgo",
  240.       type: "POST",
  241.       data: {
  242.           id: id,
  243.           type: type,
  244.           val: val
  245.       },
  246.       success: function (response){
  247.         response = JSON.parse(response);
  248.         if(response['minus']) {
  249.           Game.notifications.main(response['minus'], 'minus');
  250.         }
  251.         if(response['plus']) {
  252.           Game.notifications.main(response['plus'], 'plus');
  253.         }
  254.         if(response['error'] == 1) {
  255.           Game.notifications.main(response['text'], 'error');
  256.         }else{
  257.           openMarket();
  258.           Game.notifications.main(response['text'], 'success');
  259.         }
  260.       }
  261.     });
  262.   }
  263. }
  264. function evenOn(){
  265.   $('.Events .Steps').toggle();
  266. }
  267. function createView(id) {
  268.   $('.ViewBattle').remove();
  269.   $('<div />', {
  270.     "class": 'ViewBattle',
  271.     html: function() {
  272.       var tpl = '';
  273.       tpl += '<div class="Name" id="drgView">Бой на локации (Beta)<div class="Close" onclick=$(".ViewBattle").remove()><i class="fa fa-close"></i></div></div>';
  274.       tpl += '<div class="Content"></div>';
  275.       return tpl;
  276.     }
  277.   }).appendTo('body');
  278.   $('.ViewBattle').draggabilly({
  279.     handle: '#drgView',
  280.     containment: true
  281.   });
  282.   setFightView(id);
  283. }
  284. function setFightView(id){
  285.  
  286.   $.ajax({
  287.     url: "/do/viewBattleView",
  288.     type: "POST",
  289.     data: "id=" + id,
  290.     success: function (response){
  291.       response = JSON.parse(response);
  292.       $('.ViewBattle .Content').html(response['html']);
  293.       setTimeout(function() {
  294.         setFightView(id);
  295.       }, 5000);
  296.     }
  297.   });
  298. }
  299. function setFight(){
  300.   $.ajax({
  301.     url: "/do/viewBattle",
  302.     type: "POST",
  303.     success: function (response){
  304.       response = JSON.parse(response);
  305.       $('<div />', {
  306.         "class": 'MiniModal',
  307.         html: function() {
  308.           var tpl = '';
  309.           tpl += '<div class="Name" id="drgMini">Бои на локации</div>';
  310.           tpl += '<div class="Content">';
  311.           tpl += '<div class="Settings">';
  312.           if(response['count'] == 0) {
  313.             tpl += '<div class="Step"><div class="fS">Боев нет</div></div>';
  314.           }else{
  315.             if(response['html']) {
  316.               tpl += response['html'];
  317.             }else{
  318.               tpl += '<div class="Step"><div class="fS">Боев нет</div></div>';
  319.             }
  320.           }
  321.           tpl += '</div>';
  322.           tpl += '</div>';
  323.           return tpl;
  324.         }
  325.       }).appendTo('body');
  326.       $('.MiniModal').draggabilly({
  327.         handle: '#drgMini',
  328.         containment: true
  329.       });
  330.     }
  331.   });
  332. }
  333. function showUserTooltip(o,e) {
  334.   e = window.event;
  335.     $.ajax({
  336.         url: "/do/tooltip",
  337.         type: "POST",
  338.         data: "user=" + o,
  339.         success: function(s) {
  340.             response = JSON.parse(s);
  341.             if (s && ( (s = $.parseJSON(s)).userTooltip && s.userTooltip.login)) {
  342.                 $("#chat_user_to").val(s.userTooltip.login);
  343.                 var i = $("<div />", {
  344.                         class: "TrainerGive"
  345.                     }),
  346.                     t = [];
  347.                 t.push('<div id="btnCardUser" onclick=\'Game.trenercard.opencard("' + s.userTooltip.login + "\");'><i class='fa fa-user'></i></div>"), s.userTooltip.delClan && t.push("<div id='btnClanDelUser' onclick='userAction(\"" + s.userTooltip.login + '","DeleteClan");\'><i class="fa fa-minus-circle"></i></div>'), s.userTooltip.addClan && t.push("<div id='btnClanPlusUser' onclick='userAction(\"" + s.userTooltip.login + '","AddClan");\'><i class="fa fa-plus-circle"></i></div>'), s.userTooltip.my ? t.push('<div id="btnSetUser" onclick="settings()"><i class="fa fa-cogs"></i></div>') : (
  348.                   // t.push($("<div />", {
  349.                   //     class: "PokBtn",
  350.                   //     html: 'Открыть диалог'
  351.                   // }).on("click", function() {
  352.                   //   var newChat = $("<div />", {
  353.                   //           class: "Active Button chat_move_channel_5"+o,
  354.                   //           html: '<div class="u-'+s.userTooltip.group+'">'+s.userTooltip.login+'</div>',
  355.                   //           "data-channel": '5'+o
  356.                   //       }),
  357.                   //       newChatBlock = $("<div />", {
  358.                   //               class: "Active Message-Block Channel_5"+o,
  359.                   //               "data-channel": '5'+o
  360.                   //           });
  361.                   //       $('.Chat .Category .Button').removeClass('Active');
  362.                   //       $('.Chat .Talk .Message-Block').removeClass('Active');
  363.                   //       newChat.appendTo('.Chat .Category');
  364.                   //       newChatBlock.appendTo('.Chat .Talk');
  365.                   // })),
  366.                 t.push($("<div />", {
  367.                     "id": 'btnTradeUser',
  368.                     html: '<i class="fa fa-handshake"></i>'
  369.                 }).on("click", function() {
  370.                     ClassInfo && ClassInfo._action({
  371.                         type: "offers",
  372.                         target: "trade",
  373.                         offerID: -1,
  374.                         userID: parseInt(s.userTooltip.id)
  375.                     }, function(o) {
  376.                         o.offersCreate && Game.notifications.main(Lang.notify_success_wait, "success")
  377.                     })
  378.                 })), t.push($("<div />", {
  379.                     "id": 'btnFightUser',
  380.                     html: '<i class="fa fa-hand-rock"></i>'
  381.                 }).on("click", function() {
  382.                     ClassInfo && ClassInfo._action({
  383.                         type: "offers",
  384.                         target: "battle",
  385.                         offerID: -1,
  386.                         userID: parseInt(s.userTooltip.id)
  387.                     }, function(o) {
  388.                         o.offersCreate && Game.notifications.main(Lang.notify_success_wait, "success")
  389.                     })
  390.                 })), s.userTooltip.friend ? t.push('<div id="btnFrndDelUser" onclick=\'userAction("' + s.userTooltip.login + '","DeleteFriend");\'><i class="fa fa-user-times"></i></div>') : t.push('<div id="btnFrndPlusUser" onclick=\'userAction("' + s.userTooltip.login + '", "friend");\'><i class="fa fa-user-plus"></i></div>')),
  391.                 i.append('<div class="Avatar" style="background-image: url(/img/avatars/mini/'+s.userTooltip.id+'.png);"></div>',
  392.                 $("<div />", {
  393.                     class: "Title"
  394.                 }).append(t)), i.appendTo("body");
  395.                 var left = (e.clientX - 100), top = (e.clientY - 50);
  396.                 if(left < 0) {
  397.                   left = 0;
  398.                 }
  399.                 if(top < 0) {
  400.                   top = 0;
  401.                 }
  402.                 Tipped.create('#btnFrndDelUser', 'Удалить из друзей');
  403.                 Tipped.create('#btnFrndPlusUser', 'Добавить в друзья');
  404.                 Tipped.create('#btnFightUser', 'Вызвать на бой');
  405.                 Tipped.create('#btnTradeUser', 'Обменяться');
  406.                 Tipped.create('#btnSetUser', 'Настройки');
  407.                 Tipped.create('#btnClanDelUser', 'Удалить из клана');
  408.                 Tipped.create('#btnClanPlusUser', 'Пригласить в клан');
  409.                 Tipped.create('#btnCardUser', 'Тренеркарта');
  410.                 $('.TrainerGive').css({"left": left+'px',"top": top+'px'});
  411.             }
  412.         }
  413.     })
  414. }
  415. function positionElement(t,o){
  416.   var n=$(t).position(),
  417.   p=$(t).offset(),
  418.   e=Math.round(p.left),
  419.   f=Math.round(p.top+n.top),
  420.   l = (e - 113),
  421.   t = (f + 63);
  422.   $(o).css({
  423.     left:l+"px",
  424.     top:t+"px"
  425.   })}
  426. function userAction(t,e){$.ajax({url:"/do/trainers",type:"POST",data:"type="+e+"&user="+t,success:function(t){1==(t=JSON.parse(t)).error?Game.notifications.main(t.text,"error"):Game.notifications.main(t.text,"success")}})}
  427. function setTrenerBlock(s,c){
  428.   $(".Tabses .Table").hide(),
  429.   $(".Tabses .Tabs div").css("color","#6c99ca"),
  430.   $(".Tabses .Tabs div").css("background","#fff"),
  431.   $("#"+s).show(),$(c).css("color","#fff"),
  432.   $("#"+s).show(),$(c).css("background","#6c99ca")
  433. }
  434. function closeMudol(t){mudol=$(".mudol"),1==t?($("#pokedex").css("display","none"),mudol.attr("id",""),$("#DexBtn").attr("class","flt")):2==t&&($(".CraftModal").css("display","none"),$("#CraftBtn").attr("class","flt"))}
  435. function goLocation(o){if(o<=0)return!1;$("#locationPreloader").show(),$.ajax({url:"/do/goLocation",type:"POST",data:{location_id:o},success:function(o){1==(o=JSON.parse(o)).error?($("#locationPreloader").delay(100).fadeOut(100),Game.notifications.main(o.text,"error")):($(".preloader span").html(Lang.loader_location),$("#locationPreloader").delay(100).fadeOut(100),updateLocation())}})}
  436. function openMarket() {
  437.   dex = $(".mudol"), 0 !== dex.length && dex.html(""), dexBtn = $("#MarketBtn"), dexBtn.attr("class", ""), dex.attr("id", "mark"), dex.css("display", "block"), dex.html('<center>' + mainLoader + '</center>');
  438.   $.ajax({
  439.     url: "/do/market",
  440.     type: "POST",
  441.     dataType: "json",
  442.     success: function(d) {
  443.       dex.html(d.html);
  444.     }
  445.   })
  446. }
  447. function openDex(i) {
  448.     dex = $(".mudol"), 0 !== dex.length && dex.html(""), i < 1 ? i = 807 : i > 807 && (i = 1), dexBtn = $("#DexBtn"), dexBtn.attr("class", ""), dex.attr("id", "pokedex"), dex.css("display", "block"), dex.html('<center>' + mainLoader + '</center>'), UserPokedex = i, $.ajax({
  449.         url: "/do/Pokedex",
  450.         type: "POST",
  451.         data: "dex=" + i,
  452.         dataType: "json",
  453.         success: function(d) {
  454.             var s = parseInt(d.id) + 1,
  455.                 e = "";
  456.             e += '<div class="Header">Покедекс<div class="Close" onclick="closeMudol(1)"><i class="fa fa-close"></i></div></div>',
  457.             e += '<div class="Content">',
  458.  
  459.             e += '<div class="Pokedex">',
  460.  
  461.             e += '<div class="Dex-Inputs">',
  462.             e += '<div onclick="openDex(' + parseInt(d.id - 1) + ')"><i class="fas fa-chevron-left"></i></div>',
  463.             e += '<input type="type" placeholder="Найти покемона..." onkeydown="if(event.keyCode == 13){openDex($(this).val());}">',
  464.             e += '<div onclick="openDex(' + s + ')"><i class="fas fa-chevron-right"></i></div>',
  465.             e += '</div>',
  466.  
  467.             e += '<div class="Dex-Left">',
  468.  
  469.             e += '<div class="Dex-Block">',
  470.             e += '<div class="Name">#'+d.numb+' '+d.name+'</div>',
  471.             e += '<div class="Content">',
  472.             e += '<div class="DexInfoPokemon">',
  473.             e += '<div class="Imagep" style="background-image: url(/img/pokemons/mini/normal/' + d.numb + '.png);"></div>',
  474.             e += '<div class="Typep">',
  475.             e += "not" != d.typeOne ? '<div style="background-image: url(/img/world/typs/' + d.typeOne + '.png);"></div>' : "",
  476.             e += "not" != d.typeTwo ? '<div style="background-image: url(/img/world/typs/' + d.typeTwo + '.png);"></div>' : "",
  477.             e += '</div>',
  478.             e += '<div class="Sexp"><span class="m"><i class="fas fa-mars"></i> '+d.m+'%</span><span class="f"><i class="fas fa-venus"></i> '+d.d+'%</span></div>',
  479.             e += '<div class="Heightp"><div>'+d.height+' м.</div><div>'+d.weight+' кг.</div></div>',
  480.             e += '<div class="Statp">',
  481.             e += '<div><span>Здр</span> '+d.hp+'</div>',
  482.             e += ' <div><span>Атк</span> '+d.atk+'</div>',
  483.             e += ' <div><span>Зщт</span> '+d.def+'</div>',
  484.             e += ' <div><span>Скр</span> '+d.sp+'</div>',
  485.             e += ' <div><span>САтк</span> '+d.sa+'</div>',
  486.             e += ' <div><span>СЗщт</span> '+d.sd+'</div>',
  487.             e += '</div>',
  488.             e += '<div class="Infop">Группа опыта: <b>'+d.go+'</b><br>В игре: <b>'+d.typeNormal+'</b><br>С уникальным окрасом в игре: <b>'+d.typeUnik+'</b></div>'
  489.             e += '</div>',
  490.             e += '</div>',
  491.             e += '</div>',
  492.  
  493.             e += '</div>',
  494.  
  495.             e += '<div class="Dex-Right">',
  496.  
  497.             e += '<div class="Dex-Block">',
  498.             e += '<div class="Name">Описание покемона</div>',
  499.             e += '<div class="Content">',
  500.             e += '<div class="AboutText">'+d.info+'</div>',
  501.             e += '</div>',
  502.             e += '</div>',
  503.  
  504.             e += '<div class="Dex-Block">',
  505.             e += '<div class="Name">Эволюции покемона</div>',
  506.             e += '<div class="Content">',
  507.             e += '<div class="AboutText"><div class="DexEvol">'+d.evolutions+'</div></div>',
  508.             e += '</div>',
  509.             e += '</div>',
  510.  
  511.             e += '</div>',
  512.  
  513.             e += '<div class="Dex-Block" style="margin-top: 270px;">',
  514.  
  515.             e += '<div class="Name">Атаки</div>',
  516.             e += '<div class="Content">',
  517.             e += '<div class="ButtonsDexAtk">',
  518.             e += '<div onclick="setTabDex(this,2);">По развитию</div>',
  519.             e += '<div onclick="setTabDex(this,3);">По TM и HM</div>',
  520.             e += '<div onclick="setTabDex(this,4);">По разведению</div>',
  521.             e += '<div onclick="setTabDex(this,5);">По обучению</div>',
  522.             e += '</div>',
  523.             e += '<div class="DexAtk"><div class="chsC">Выберите категорию слева.</div></div>',
  524.             e += '</div>',
  525.  
  526.             e += '</div>',
  527.  
  528.             e += '</div>',
  529.  
  530.             e += '</div>',
  531.             e += '';
  532.             dex.html(e);
  533.         }
  534.     })
  535. }
  536. var md5=new function(){var l="length",h=["0123456789abcdef",15,128,65535,1732584193,4023233417,2562383102,271733878],x=[[0,1,[7,12,17,22]],[1,5,[5,9,14,20]],[5,3,[4,11,16,23]],[0,7,[6,10,15,21]]],A=function(n,r,t){return(n>>16)+(r>>16)+((t=(n&h[3])+(r&h[3]))>>16)<<16|t&h[3]},B=function(n){for(var r=1+(n[l]+8>>6),t=new Array(1+16*r).join("0").split(""),u=0;u<n[l];u++)t[u>>2]|=n.charCodeAt(u)<<u%4*8;return t[u>>2]|=h[2]<<u%4*8,t[16*r-2]=8*n[l],t},R=function(n,r){return n<<r|n>>>32-r},C=function(n,r,t,u,o,f){return A(R(A(A(r,n),A(u,f)),o),t)},F=function(n,r,t,u,o,f,i){return C(r&t|~r&u,n,r,o,f,i)},G=function(n,r,t,u,o,f,i){return C(r&u|t&~u,n,r,o,f,i)},H=function(n,r,t,u,o,f,i){return C(r^t^u,n,r,o,f,i)},I=function(n,r,t,u,o,f,i){return C(t^(r|~u),n,r,o,f,i)},_=[function(n,r,t,u,o,f,i){return C(r&t|~r&u,n,r,o,f,i)},function(n,r,t,u,o,f,i){return C(r&u|t&~u,n,r,o,f,i)},function(n,r,t,u,o,f,i){return C(r^t^u,n,r,o,f,i)},function(n,r,t,u,o,f,i){return C(t^(r|~u),n,r,o,f,i)}],S=function(){with(Math)for(var i=0,a=[],x=pow(2,32);i<64;a[i]=floor(abs(sin(++i))*x));return a}(),X=function(n){for(var r=0,t="";r<4;r++)t+=h[0].charAt(n>>8*r+4&h[1])+h[0].charAt(n>>8*r&h[1]);return t};return function(n){for(var r,t,u,o=B(""+n),f=[0,1,2,3],i=[0,3,2,1],c=[h[4],h[5],h[6],h[7]],e=0,a=0,C=[].concat(c);e<o[l];e+=16,C=[].concat(c),a=0){for(r=0;r<4;r++)for(t=0;t<4;t++)for(u=0;u<4;u++,f.unshift(f.pop()))c[i[u]]=_[r](c[f[0]],c[f[1]],c[f[2]],c[f[3]],o[e+((4*t+u)*x[r][1]+x[r][0])%16],x[r][2][u],S[a++]);for(r=0;r<4;r++)c[r]=A(c[r],C[r])}return X(c[0])+X(c[1])+X(c[2])+X(c[3])}};
  537. function setTabDex(e, i) {
  538.     $.ajax({
  539.         url: "/do/Pokedex",
  540.         type: "POST",
  541.         data: "setTab=" + i + "&pok=" + UserPokedex,
  542.         beforeSend: function() {
  543.             $(".Content .DexAtk").html('<center>' + mainLoader + '</center>')
  544.         },
  545.         success: function(t) {
  546.             t = JSON.parse(t);
  547.             $(".actv").removeClass("actv");
  548.             $(e).addClass("actv");
  549.             if (t.error) return Game.notifications.main(t.text, "error");
  550.             var a = [],
  551.                 s = 0;
  552.                 if(t.t == 'tm') {
  553.                   a += t.tt;
  554.                 }else{
  555.                   $.each(t.atkList, function(e, o) {
  556.                     addTpl = 2 == i ? t.lvlList[s] + " " + Lang.text_lvl : "",
  557.                     a += '<div class="Move"><img src="/img/world/typs/' + o.type + '.png" onclick="viewDescriptionAttak(this,' + o.id + ');"> <div class="MoveInfo"><div class="Name MoveCategory' + ("physical" == o.category ? 1 : "special" == o.category ? 2 : 3) + '">'+o.name_rus+'</div><div class="PP">'+addTpl+'</div></div>',
  558.                     a += "</div>",
  559.                     s++
  560.                   });
  561.                 }
  562.                 a += $(".Content .DexAtk").html(a);
  563.         }
  564.     })
  565. }
  566. function byMax(e){$(".DivNpcBlock").remove(),$(".model").length&&$(".model").remove(),ClassInfo._byItemWindow(parseInt(e))}
  567. function closeModal(){$(".Modal").remove()}
  568. function setTab(e, t) {
  569.     $(e).addClass("active"), t = parseInt(t);
  570.     $.ajax({
  571.         url: "/do/modal",
  572.         type: "POST",
  573.         data: {
  574.             tab: t,
  575.             type: "trainers"
  576.         },
  577.         beforeSend: function() {
  578.             $(".Trainers .List").html('<center>' + mainLoader + '</center>')
  579.         },
  580.         success: function(e) {
  581.             e = JSON.parse(e), $(".Modal").html(e.html)
  582.         }
  583.     })
  584. }
  585.  
  586. function searchUser() {
  587.     var e = $("#searchUser").val();
  588.     $.ajax({
  589.         url: "/do/modal",
  590.         type: "POST",
  591.         data: {
  592.             tab: 9,
  593.             type: "trainers",
  594.             text: e
  595.         },
  596.         beforeSend: function() {
  597.             $(".Trainers .List").html('<center>' + mainLoader + '</center>')
  598.         },
  599.         success: function(e) {
  600.             e = JSON.parse(e), $(".Trainers .List").html(e.html)
  601.         }
  602.     })
  603. }
  604. function goPok(o){UserPokList.length;var s=UserPokList.indexOf(o),e=UserPokList[s-1]?UserPokList[s-1]:UserPokList[UserPokList.length-1],k=UserPokList[s+1]?UserPokList[s+1]:UserPokList[0];$(".prevPok").on("click",function(){Game.modals.pokemons()}),$(".nextPok").on("click",function(){Game.modals.pokemons()})}
  605. function PokemonTeamOpen(){pokemon=$(".BlockOtherContent"),pokemon.removeClass("updated"),pokemon.toggle(),pokemon.html('<center>'+mainLoader+'</center>'),pokemon.load("/do/PokemonTeam")}function openCraft(){craft=$(".CraftModal"),craft.toggle(),craftB=$("#CraftBtn"),craftB.attr("class",""),craft.load("/do/Craft")}
  606. function viewDescriptionAttak(t, s, i, e) {
  607.     $(".tooltip").html("").hide(), $.ajax({
  608.         url: "/do/pokemonsAction",
  609.         type: "POST",
  610.         data: "pokID=" + s + "&type=attackInfo",
  611.         success: function(a) {
  612.             if (a = JSON.parse(a), 0 == s) i && (d = '<div class="Buttons"><div onclick=addAttacks(this,"open",' + i + "," + e + ");>" + Lang.button_attack_learn + "</div></div>");
  613.             else {
  614.                 if (a.contact == 0) {
  615.                     var se = '';
  616.                 } else {
  617.                     var se = ', контакт';
  618.                 }
  619.         $(".GiveDiv").css({
  620.                 "z-index": 999
  621.             });
  622.                 var d = '<div class="w">';
  623.                 d += '<div class="t-a">' + a.nameRus + "</div>", d += '<div class="t-b">' + a.name + "<span>" + a.pp + " PP</span></div></div>", d += '<div class="t-c">' + a.title + "</div>", d += '<div class="t-d"><img src="/img/world/typs/' + a.type + '.png"></div>', d += '<div class="t-f">' + a.category + '' + se + '</div><div class="t-e">', 0 != a.accuracy && (d += "<span>" + Lang.text_accuracy + " " + a.accuracy + "%</span>"), 0 != a.power && (d += "<span>" + Lang.text_power + " " + a.power + "</span>"), d += "</div>", i && (d += '<div class="Buttons"><div onclick=addAttacks(this,"open",' + i + "," + e + ");>" + Lang.button_attack_swap + "</div></div>")
  624.             }
  625.             $("body");
  626.             var c = $(".tooltip"),
  627.                 o = ($(t).position(), $(t).offset()),
  628.                 p = Math.round(o.left - 50),
  629.                 n = Math.round(o.top + 50);
  630.             c.append(d), $(".tooltip").css({
  631.                 left: p + "px",
  632.                 top: n + "px"
  633.             }), c.show()
  634.         }
  635.     })
  636. }
  637. function opros() {
  638.   $.ajax({
  639.     url: "/do/opros",
  640.     type: "POST",
  641.     success: function (){
  642.       $('.Opros').remove();
  643.       Game.notifications.main('Отлично! Теперь вы можете заглянуть в «Акваритовый магазин»', 'info');
  644.     }
  645.   });
  646. }
  647. function setHunt(a){$(a).hasClass("NoActive")?($(a).removeClass("NoActive"),assault=!0,$(a).attr("data","\u0412\u044B\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u043D\u0430\u043F\u0430\u0434\u0435\u043D\u0438\u044F")):($(a).addClass("NoActive"),assault=!1,$(a).attr("data","\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u043D\u0430\u043F\u0430\u0434\u0435\u043D\u0438\u044F"))}
  648. function setStart(t){$.ajax({url:"/do/pokemonsAction",type:"POST",data:{pokID:t,type:"setStart"},success:function(o){1==(o=JSON.parse(o)).error?Game.notifications.main(o.text,"error"):(Game.notifications.main(o.text,"success"),Game.modals.pokemons())}})}
  649. function wentPok(o){$.ajax({url:"/do/pokemonsAction",type:"POST",data:{pokID:o,type:"wentPok"},beforeSend:function(){$("#locationPreloader span").html(Lang.loader_pokemon_walk),$("#locationPreloader").show()},success:function(e){1==(e=JSON.parse(e)).error?($("#locationPreloader").delay(500).fadeOut(200),Game.notifications.main(e.text,"error")):(Game.modals.pokemons(),$("#locationPreloader").delay(500).fadeOut(200),Game.notifications.main(e.text,"success"))}})}
  650. function openReproductionPoks(a,b){
  651.   $('.GiveDiv').remove();
  652.   var c='<div class="GiveDiv">';
  653.   c+='<div id="DivAbout">\u0420\u0430\u0437\u0432\u0435\u0434\u0435\u043D\u0438\u0435 \u043F\u043E\u043A\u0435\u043C\u043E\u043D\u043E\u0432</b></div>',
  654.   c+='<div class="wrap"><div class="PokList">',
  655.   $.ajax({
  656.     url:'/do/itemsAction',
  657.     type:'POST',
  658.     data:'type=reproductionList',
  659.     success:function(d){
  660.     if(0!=d){
  661.       d=JSON.parse(d);
  662.       var f='';
  663.       $.each(d.pokList,function(l,m){
  664.       var n=m.gen.split(',');
  665.       f+='<div class="PokeUse" onclick=AddReproductionPok('+m.id+','+b+',"'+m.type+'","'+m.basenum+'","'+m.gender+'");><img src="/img/pokemons/mini/'+m.type+'/'+m.basenum+'.png"></img> <div class="NameUse '+m.type+'-color">#'+m.basenum+' '+m.name+' <small><b>'+m.gender.charAt(0)+' ('+m.sparkaNumber+')</b></small><br /><small><u><i>h'+n[0]+'a'+n[1]+'d'+n[2]+'s'+n[3]+'sa'+n[4]+'sd'+n[5]+'</u></i></small></div></div>'}),c+=f}c+='</div></div></div>',$(c).appendTo('body');var g=$(a).position(),h=$(a).offset(),i=Math.round(h.left)+10,j=Math.round(g.top/10),k=Math.round(h.top+g.top/j+100);$('.GiveDiv').css({left:i+'px',top:k+'px'})}})}
  666. function issetAll(m,o,l=false,e){
  667.   e = window.event;
  668.   var a = $('.tooltip');
  669.   $.ajax({
  670.   url: "/do/Issets",
  671.   type: "POST",
  672.   data: 'type='+o+'&id='+m+'&other='+l,
  673.   beforeSend: function(){
  674.     var left = (e.clientX - 134), top = (e.clientY + 15);
  675.     if(left < 0) {
  676.       left = 0;
  677.     }
  678.     if(top < 0) {
  679.       top = 0;
  680.     }
  681.     a.css({"left": left+'px',"top": top+'px'});
  682.     a.html('<center>'+mainLoader+'</center>');a.show();},success: function (response) {response = JSON.parse(response);a.html(response['text']);}});}
  683. function btnCreateClan(){
  684.   var a = $("#clanCreateName").val(),
  685.   b = $("#clanCreateEmblem").val();
  686.   $.ajax({
  687.     url: "/do/clanAction",
  688.     type: "POST",
  689.     data: 'name='+a+'&object=createClan&emblem='+b,
  690.     success: function (response) {
  691.       response = JSON.parse(response);
  692.       if(response["minus"]) {
  693.         Game.notifications.main(response["minus"], 'minus');
  694.       }
  695.       Game.notifications.main(response["text"], response["error"]);
  696.     }
  697.   });
  698. }
  699. function openPanelDL(type){$('.model').remove();$.ajax({url: "/do/logAction",type: "POST",data: {type: type},beforeSend: function(){$('<div />', {'class':'model'}).appendTo('body');$('.model').html('<center>'+mainLoader+'</center>');},success: function (response) {response = JSON.parse(response);var tpl = '';tpl += '<div class="header">'+Lang.text_dl+'<span onclick="$(\'.model\').remove();"><i class="fa fa-close"></i></span></div>';tpl += '<div class="content-model">'+response['text']+'</div>';$('.model').html(tpl);$('.model').draggabilly({handle: '.header',containment: true});}});}
  700. function AddReproductionPok(a,b,c,d,f){
  701.   $('#Reproduction'+b).css('background-image','url(/img/pokemons/mini/'+c+'/'+d+'.png)').attr('data-pok',a)
  702. }
  703. function GetReproductionResult() {
  704.     var a = $('#Reproduction1').attr('data-pok'),
  705.         b = $('#Reproduction2').attr('data-pok');
  706.     a && b ? a == b ? Game.notifications.main(Lang.error_pokemon_different, 'error') : $.ajax({
  707.         url: '/do/reproduction',
  708.         type: 'POST',
  709.         data: 'pok1=' + a + '&pok2=' + b,
  710.         success: function(c) {
  711.  
  712.             c = JSON.parse(c), 1 == c.error ? Game.notifications.main(c.text, 'error') : Game.notifications.main(c.text, 'success');
  713.         }
  714.     }) : Game.notifications.main(Lang.error_pokemon_choose, 'error')
  715. }
  716. function setTrade(a,b){$.ajax({url:"/do/trade",type:"POST",data:"type="+a+"&id="+b,success:function(c){c=JSON.parse(c),1==c.error?Game.notifications.main(c.text,"error"):Game.notifications.main(c.text,"success")}})}
  717. function updNoticeDef(t){t&&$.each(t,function(t,o){o&&o.text&&Game.notifications.main(o.text,"success")})}
  718. function uploadImg() {
  719.     var u = $('#upload_file #file_name').prop('files')[0];
  720.     var s = new FormData();
  721.     s.append('file', u);
  722.     j = $('#upload_file').html();
  723.     $.ajax({
  724.         url: '/do/upload',
  725.         dataType: 'text',
  726.         cache: false,
  727.         contentType: false,
  728.         processData: false,
  729.         data: s,
  730.         type: 'POST',
  731.         beforeSend: function() {
  732.             $('#upload_file').html('<center><img height="20px" src="/img/loader/1.gif"></center>');
  733.             },
  734.         success: function(n){
  735.             if(n==''){
  736.                 $('#upload_file').html('<center><span style="color: green;font-weight: bold;">'+Lang.success_load_file+'</span></center>');
  737.             }else{
  738.                 Game.notifications.main(n);
  739.                 $('#upload_file').html(j);
  740.             }
  741.         }
  742.     });
  743.     return false;
  744. }
  745. var Game = {
  746.     title_tooltip: function() {
  747.         $('<div />', {
  748.             "class": 'Button',
  749.             html: '<i class="fa fa-paw"></i>'+Lang.title[5],
  750.             'click': function() {
  751.                 Game.modals.pokemons();
  752.             }
  753.         }).appendTo('.MidMenu');
  754.         $('<div />', {
  755.             "class": 'Button',
  756.             html: '<i class="fa fa-briefcase"></i>'+Lang.title[0],
  757.             'click': function() {
  758.                 Game.modals.inventory('all');
  759.             }
  760.         }).appendTo('.MidMenu');
  761.         $('<div />', {
  762.             "class": 'Button',
  763.             html: '<i class="fa fa-book"></i>'+Lang.title[1],
  764.             'click': function() {
  765.                 Game.modals.diary('quests');
  766.             }
  767.         }).appendTo('.MidMenu');
  768.         $('<div />', {
  769.             "class": 'Button',
  770.             html: '<i class="fa fa-users"></i>'+Lang.title[2],
  771.             'click': function() {
  772.                 openModal('trainers');
  773.             }
  774.         }).appendTo('.MidMenu');
  775.         $('<div />', {
  776.             "class": 'Button',
  777.             html: '<i class="fa fa-cog"></i>'+Lang.title[4],
  778.             'click': function() {
  779.                 openModal('craft');
  780.             }
  781.         }).appendTo('.MidMenu');
  782.     $('<div />', {
  783.             "class": 'Button',
  784.             html: '<i class="fa fa-bookmark"></i>'+Lang.title[3],
  785.             'click': function() {
  786.                 Game.modals.clans();
  787.             }
  788.         }).appendTo('.MidMenu');
  789.         Tipped.create('.TopMenu .RightMenu .Buttons .Button', Lang.hint_notify);
  790.         Tipped.create('.el_dex', Lang.hint_dex);
  791.     Tipped.create('.el_market', 'Межрегиональный аукцион');
  792.         Tipped.create('.el_fight', 'Бои на локации');
  793.         Tipped.create('.el_clear_chat', 'Очистить чат');
  794.     Tipped.create('.el_smile', 'Смайлики');
  795.     Tipped.create('.el_wild', 'Дикие покемоны');
  796.     },
  797.   updateUserLocation: function() {
  798.         $.post('/do/updateLocation', {updateUsers: true, userAssault: assault}, function(data){
  799.  
  800.       if(data.tw == 1) {
  801.         $('.TechWork').css('display','block');
  802.       }else{
  803.         $('.TechWork').css('display','none');
  804.       }
  805.  
  806.             if(VERSION != data.ver){
  807.                 setTimeout(function(){
  808.                     window.location.reload();
  809.                 }, 15000);
  810.                 if(!$('.DivNotification').find('.version').length){
  811.                     Game.notifications.main('<b>Системное оповещение</b><br>Внимание! Игра обновлена до версии '+data.ver+'. Через несколько секунд произойдет автоматическая перезагрузка страницы.','version');
  812.                 }
  813.             }
  814.  
  815.             if(data.usersDefNotice){
  816.                 updNoticeDef(data.usersDefNotice);
  817.             }
  818.  
  819.             if(md5locList != data.usersAtLocationHash){
  820.                 md5locList = data.usersAtLocationHash;
  821.                 if(ClassInfo){
  822.                     ClassInfo._upUsrLoc(data.usersAtLocation, (data.usersAtNotice || null));
  823.                 }
  824.             }
  825.       if(data.bafs) {
  826.         $('.TopMenu .Bafs').html(data.bafs);
  827.       }
  828.  
  829.       if(data.infoChat && ClassChat){
  830.                 ClassChat._update(data);
  831.             }
  832.  
  833.             if(data.serverTime){
  834.                 $('#map_time').html(data.serverTime);
  835.             }
  836.  
  837.             $('.Weather').attr({
  838.                 "style": 'background-image: url(/img/weather/'+data.WeatherId+'.png);'
  839.             });
  840.  
  841.             $('.WeatherName').html(Lang.time_day[$(".WeatherName").attr("data")]+', '+data.WeatherName);
  842.             if(ClassInfo && data.server_ver){
  843.                 ClassInfo._upVer(data.server_ver);
  844.             }
  845.  
  846.             if(data.battleInfo){
  847.                 if(!ClassBattle){
  848.                     ClassBattle = new GameBattle(data.battleInfo);
  849.                 }else{
  850.                     ClassBattle._open(data.battleInfo);
  851.                 }
  852.             }
  853.  
  854.             if(data.tradeInfo){
  855.                 if(!ClassTrade){
  856.                     ClassTrade = new Trade(data.tradeInfo);
  857.                 }else{
  858.                     ClassTrade._parseData(data.tradeInfo);
  859.                 }
  860.             }else{
  861.                 if(ClassTrade){
  862.                     ClassTrade._close(false);
  863.                     ClassTrade = null;
  864.                 }
  865.             }
  866.             setTimeout(Game.updateUserLocation, 3000);
  867.         }, 'json')
  868.     },
  869.     modals: {
  870.         modalLoad: function(n) {
  871.             Game.loaders.world();
  872.             $('.Modal').remove();
  873.             $('<div />', {
  874.                 "class": 'Modal',
  875.                 html: '<div class="Title"><div class="Name">'+Lang.title[n]+'</div></div>'
  876.             }).appendTo('body');
  877.             $('<div />', {
  878.                 "class": 'Close',
  879.                 html: '<i class="fa fa-close"></i>',
  880.                 'click': function() {
  881.                     $('.Modal').remove();
  882.                 }
  883.             }).appendTo('.Modal .Title');
  884.         },
  885.         modelLoad: function(d){
  886.             $('.model').remove();
  887.             $('<div />', {
  888.                 'class':'model'
  889.             }).appendTo('body');
  890.             $('<div />', {
  891.                 'class':'header',
  892.                 html: d
  893.             }).appendTo('.model');
  894.             $('<span />', {
  895.                 html: "<i class='fa fa-close'></i>",
  896.                 "click": function() {
  897.                     $('.model').remove();
  898.                 }
  899.             }).appendTo('.model .header');
  900.             $('<div />', {
  901.                 'class':'content-model',
  902.             }).appendTo('.model');
  903.             $('.model').draggabilly({
  904.                 handle: '.header',
  905.                 containment: true
  906.             });
  907.         },
  908.         itemsCategory: function() {
  909.             var el_qw = $('<div />', {
  910.                             'class':'Button',
  911.                             'id': 'allItems',
  912.                             html: 'Все',
  913.                             'click': function() {
  914.                                 Game.modals.inventory('all');
  915.                             }
  916.                         }),
  917.                 el_qr = $('<div />', {
  918.                             'class':'Button',
  919.                             'id': 'modificatorItems',
  920.                             html: 'Модификаторы',
  921.                             'click': function() {
  922.                                 Game.modals.inventory('modificator');
  923.                             }
  924.                         }),
  925.                 el_qt = $('<div />', {
  926.                             'class':'Button',
  927.                             'id': 'eggItems',
  928.                             html: 'Яйца',
  929.                             'click': function() {
  930.                                 Game.modals.inventory('egg');
  931.                             }
  932.                         }),
  933.                 el_qy = $('<div />', {
  934.                             'class':'Button',
  935.                             'id': 'evolverItems',
  936.                             html: 'Эволверы',
  937.                             'click': function() {
  938.                                 Game.modals.inventory('evolver');
  939.                             }
  940.                         }),
  941.                 el_qu = $('<div />', {
  942.                             'class':'Button',
  943.                             'id': 'craftItems',
  944.                             html: 'Крафтовые',
  945.                             'click': function() {
  946.                                 Game.modals.inventory('craft');
  947.                             }
  948.                         }),
  949.                 el_qi = $('<div />', {
  950.                             'class':'Button',
  951.                             'id': 'trophyItems',
  952.                             html: 'Награды',
  953.                             'click': function() {
  954.                                 Game.modals.inventory('trophy');
  955.                             }
  956.                         }),
  957.                 el_qo = $('<div />', {
  958.                             'class':'Button',
  959.                             'id': 'potionItems',
  960.                             html: 'Регенераторы',
  961.                             'click': function() {
  962.                                 Game.modals.inventory('potion');
  963.                             }
  964.                         }),
  965.                 el_qp = $('<div />', {
  966.                             'class':'Button',
  967.                             'id': 'ballItems',
  968.                             html: 'Покеболы',
  969.                             'click': function() {
  970.                                 Game.modals.inventory('ball');
  971.                             }
  972.                         }),
  973.                 el_qa = $('<div />', {
  974.                             'class':'Button',
  975.                             'id': 'tmItems',
  976.                             html: 'TM/HM',
  977.                             'click': function() {
  978.                                 Game.modals.inventory('tm');
  979.                             }
  980.                         }),
  981.                 el_qd = $('<div />', {
  982.                             'class':'Button',
  983.                             'id': 'questItems',
  984.                             html: 'Квестовые',
  985.                             'click': function() {
  986.                                 Game.modals.inventory('quest');
  987.                             }
  988.                         }),
  989.                 el_qg = $('<div />', {
  990.                             'class':'Button',
  991.                             'id': 'otherItems',
  992.                             html: 'Прочее',
  993.                             'click': function() {
  994.                                 Game.modals.inventory('other');
  995.                             }
  996.                         }),
  997.             el_zz = [el_qw, el_qr, el_qt, el_qy, el_qu, el_qi, el_qo, el_qp, el_qa, el_qd, el_qg];
  998.             $('.Inventory .Category').append(el_zz);
  999.         },
  1000.         questsCategory: function() {
  1001.             el_wq = $('<div />', {
  1002.                             'class':'Button',
  1003.                             'id': 'questsBook',
  1004.                             html: 'Задания',
  1005.                             'click': function() {
  1006.                                 Game.modals.diary('quests');
  1007.                             }
  1008.                         }),
  1009.             el_we = $('<div />', {
  1010.                                 'class':'Button',
  1011.                                 'id': 'locationBook',
  1012.                                 html: 'Локация',
  1013.                                 'click': function() {
  1014.                                     Game.modals.diary('location');
  1015.                                 }
  1016.                             }),
  1017.                   el_wj = $('<div />', {
  1018.                                         'class':'Button',
  1019.                                         'id': 'newsBook',
  1020.                                         html: 'Новости друзей',
  1021.                                         'click': function() {
  1022.                                             Game.modals.diary('news');
  1023.                                         }
  1024.                                     }),
  1025.                         el_wi = $('<div />', {
  1026.                                             'class':'Button',
  1027.                                             'id': 'raidBook',
  1028.                                             html: 'Рейды',
  1029.                                             'click': function() {
  1030.                                                 Game.modals.diary('raid');
  1031.                                             }
  1032.                                         }),
  1033.             el_zq = [el_wq, el_wi, el_we, el_wj];
  1034.             $('.AquaBook .Category').append(el_zq);
  1035.         },
  1036.         aquarits: function() {
  1037.             Game.modals.modalLoad(6);
  1038.             $.post('/do/modal', {type: 'AquaRits'}, function(data){
  1039.                 $('<div />', {'class': 'Inventory'}).appendTo('.Modal');
  1040.                 $('<div />', {'class': 'HeaderAqua',
  1041.                     html: data.html
  1042.                 }).appendTo('.Inventory');
  1043.                 $('<div />', {'class': 'ThingBuy'}).appendTo('.Inventory');
  1044.                 $.each(data.items, function(){
  1045.                     $('<div />', {
  1046.                         'class'     : 'Thing',
  1047.                         'data-id'   : this.id,
  1048.                         'click'     : function(t){
  1049.                             Game.modals.modalLoad(0);
  1050.                             $.post('/do/itemsAction', {itemID: $(this).data('id'), type: 'buyDonat'}, function(data){
  1051.                 data.plus ? Game.notifications.main(data.plus,'plus') : '';
  1052.                 data.minus ? Game.notifications.main(data.minus,'minus') : '';
  1053.                                 Game.notifications.main((data.error == 0 ? 'Предмет удачно куплен.' : 'Недостаточно акваритов.'),(data.error == 0 ? 'success' : 'error'));
  1054.                                 Game.modals.aquarits();
  1055.                             }, 'json')
  1056.                         },
  1057.                         html: '<img src="/img/world/items/little/'+this.item+'.png"><div class="Price">'+this.price+' акв.</div><div class="Name">'+this.name+'</div><div class="About">'+this.about+'</div>'
  1058.                     }).appendTo('.ThingBuy');
  1059.                 });
  1060.         $('<div />', {
  1061.           "class": 'AquaButton'
  1062.         }).appendTo('.Inventory');
  1063.         $('<div />', {
  1064.           "class": 'Button',
  1065.           html: 'Инвентарь',
  1066.           "click": function() {
  1067.             Game.modals.inventory('all');
  1068.           }
  1069.         }).appendTo('.AquaButton');
  1070.                 $('.Modal').css('left',(Math.round(offset = $('.MidMenu').offset().left) - 46)+'px');
  1071.                 //$('.DivAquarits .HeaderAqua input[type="number"]').on('input propertychange', function(){
  1072.                 //  if(parseInt($(this).val()) > 0){
  1073.                 //      $('.DivAquarits .HeaderAqua form label').text(parseInt($(this).val()) * 10 + ' р.')
  1074.                 //  }else{
  1075.                 //      $(this).val('1')
  1076.                 //  }
  1077.                 //})
  1078.                 Game.loaders.worldClose();
  1079.             }, 'json')
  1080.         },
  1081.         pokemons: function(){
  1082.             Game.modals.modalLoad(5);
  1083.             $.post('/do/PokemonTeam', {type: 'load'}, function(data){
  1084.                 $('<div/>', {'class': 'Pokemons'}).appendTo('.Modal');
  1085.                 $.each(data, function(){
  1086.           $('<div />',{
  1087.             'html'  : this.html,
  1088.             'class': 'PokemonBox '+this.start,
  1089.             'id': 'PokemonBox'+this.id
  1090.           }).appendTo('.Modal .Pokemons');
  1091.         });
  1092.         if((Math.round(offset = $('.MidMenu').offset().left) - 120) < 0) {
  1093.           var left = 1;
  1094.         }else{
  1095.           var left = (Math.round(offset = $('.MidMenu').offset().left) - 120);
  1096.         }
  1097.                 $('.Modal').css('left',left+'px');
  1098.                 Game.loaders.worldClose();
  1099.             }, 'json')
  1100.         },
  1101.         inventory: function(l) {
  1102.             $.ajax({
  1103.                 url: "/do/modal",
  1104.                 type: "POST",
  1105.                 data: "type=inventory&category="+l,
  1106.                 beforeSend: function(){
  1107.                     Game.modals.modalLoad(0);
  1108.                 },
  1109.                 success: function (response) {
  1110.                         response = JSON.parse(response);
  1111.                         $('<div />', {
  1112.                             "class": 'Inventory'
  1113.                         }).appendTo('.Modal');
  1114.                         $('<div />', {
  1115.                             "class": 'Category'
  1116.                         }).appendTo('.Inventory');
  1117.                         $('<div />', {
  1118.                             "class": 'Items',
  1119.               "id": 'Items'
  1120.                         }).appendTo('.Inventory');
  1121.                         $.each(response['eggList'], function(x,y){
  1122.                             $('<div />', {
  1123.                                 "class": 'Item',
  1124.                                 "click": function() {
  1125.                                     itemOpen(this,y['ctgMdl'],y['id'],'Яйцо '+y['name'],y['gen']+'<br />'+y['reborn'],54,1,0,false,false,false,true,false,false,y['ustatus'],true,y['loc']);
  1126.                                 },
  1127.                                 html: "<img id='imgItem' src='/img/world/items/little/54.png'><div class='Count'>1</div><div class='Name'>"+y['name']+"</div>"
  1128.                             }).appendTo('.Inventory .Items');
  1129.                         });
  1130.                         // $.each(response['itemList'], function(x,y){
  1131.                             // $('<div />', {
  1132.                                 // "class": 'Item',
  1133.                                 // "click": function() {
  1134.                                     // itemOpen(this,y['ctgMdl'],y['id'],y['name'],y['about'],y['img'],y['count'],y['itemWeight'],y['use'],y['dress'],a,y['trade'],y['give'],false,y['ustatus']);
  1135.                                 // },
  1136.                                 // html: '<img id="imgItem" src="/img/world/items/little/'+y['img']+'.png" onerror="$(this).attr(\'src\',\'/img/world/items/little/0.png\');"><span class="Bot">'+y['count2']+'</span>'
  1137.                             // }).appendTo('.InvItems');
  1138.                         // });
  1139.                         $('.Inventory .Items').append(response['html']);
  1140.             $('<div />', {
  1141.                             "class": 'AquaButton'
  1142.                         }).appendTo('.Inventory');
  1143.             $('<div />', {
  1144.                             "class": 'Button',
  1145.               html: 'Акваритовый магазин',
  1146.               "click": function() {
  1147.                 Game.modals.aquarits();
  1148.               }
  1149.                         }).appendTo('.AquaButton');
  1150.                         Game.modals.itemsCategory();
  1151.                         $('.Inventory .Category').find('#'+l+'Items').addClass('active');
  1152.                         $('.Modal').css('left',(Math.round(offset = $('.MidMenu').offset().left) - 46)+'px');
  1153.                         Game.loaders.worldClose();
  1154.                 }
  1155.             });
  1156.         },
  1157.         diary: function(i,s=false) {
  1158.             $.ajax({
  1159.                 url: "/do/modal",
  1160.                 type: "POST",
  1161.                 data: "type=diary&category="+i+"&pokID="+s,
  1162.                 beforeSend: function(){
  1163.                     Game.modals.modalLoad(1);
  1164.                 },
  1165.                 success: function (response) {
  1166.                         response = JSON.parse(response);
  1167.                         var ii = '';
  1168.             $('<div />', {
  1169.                             "class": 'AquaBook'
  1170.                         }).appendTo('.Modal');
  1171.             $('<div />', {
  1172.                             "class": 'Category'
  1173.                         }).appendTo('.AquaBook');
  1174.                         Game.modals.questsCategory();
  1175.                         $('<div />', {
  1176.                             "class": 'Quests'
  1177.                         }).appendTo('.AquaBook');
  1178.                         if(i == 'quests'){
  1179.                             $.each(response['questList'], function(x,y){
  1180.                 var cq;
  1181.                 if(y['check'] == 1) {
  1182.                   cq = '<div class="Check"><i class="fa fa-check"></i></div>';
  1183.                 }else if(y['check'] == 2) {
  1184.                   cq = '<div class="Nach"><i class="fa fa-exclamation"></i></div>';
  1185.                 }else{
  1186.                   cq = '';
  1187.                 }
  1188.                                 $('<div />', {
  1189.                                     "class": 'Quest',
  1190.                                     "click": function() {
  1191.                                         Game.modals.diary('questsList',y['id']);
  1192.                                     },
  1193.                                     html: cq+'<img src="/img/quests/'+y['id']+'.png" onerror="$(this).attr(\'src\',\'/img/world/items/little/0.png\');"><div class="Name">'+y['name']+'</div>'
  1194.                                 }).appendTo('.Quests');
  1195.                             });
  1196.                         }else if(i == 'questsList'){
  1197.                             $('<div />', {
  1198.                                 "class": 'QuestOne'
  1199.                             }).appendTo('.Quests');
  1200.                             $('<div />', {
  1201.                                 "class": 'QuestTop'
  1202.                             }).appendTo('.QuestOne');
  1203.                             $('<img />', {
  1204.                                 "src": '/img/quests/'+response['id']+'.png',
  1205.                                 "click": function() {
  1206.                                     Game.modals.diary('quests');
  1207.                                 }
  1208.                             }).appendTo('.QuestTop');
  1209.                             $('<div />', {
  1210.                                 "class": 'Name',
  1211.                                 html: response['name']
  1212.                             }).appendTo('.QuestTop');
  1213.                             $('.QuestTop').append(response['progress']);
  1214.                             $('<div />', {
  1215.                                 "class": 'QuestProgress'
  1216.                             }).appendTo('.QuestOne');
  1217.                             $.each(response['questList'], function(x,y){
  1218.                                 $('<div />', {
  1219.                                     "class": 'Step',
  1220.                                     html: '<div class="Title">Запись '+y['step']+'</div><div class="Text">'+y['text']+'</div>'
  1221.                                 }).appendTo('.QuestProgress');
  1222.                             });
  1223.                         }else if(i == 'news'){
  1224.               $('<div />', {
  1225.                                 "class": 'News',
  1226.                 html: response['newsBook']
  1227.                             }).appendTo('.Quests');
  1228.               // $.each(response['newsList'], function(x,y){
  1229.                             //  $('<div />', {
  1230.                             //      "class": 'New',
  1231.                             //      html: ''
  1232.                             //  }).appendTo('.Quests .News');
  1233.                             // });
  1234.                         }else if(i == 'location'){
  1235.               $('<div />', {
  1236.                                 "class": 'LocWeather',
  1237.                 html: response['htmlWeather']
  1238.                             }).appendTo('.Quests');
  1239.               $('<div />', {
  1240.                                 "class": 'LocBook'
  1241.                             }).appendTo('.Quests');
  1242.               $.each(response['pokList'], function(x,y){
  1243.                 if(y['hide'] != 1) {
  1244.                   $('<div />', {
  1245.                                     "class": 'PokemonBook '+y['catch'],
  1246.                                     html: '<div class="Name"><img src="/img/pokemons/mini/normal/'+y['num']+'.png"> #'+y['num']+' '+y['name']+' (от '+y['lvl1']+' до '+y['lvl2']+' ур.)</div><div class="Content"><span>Можно выбить: <b>'+y['drop']+'</b></span><span>Доп. условия встречи: <b>'+y['c_con']+'</b></span><span>Время: <b>'+y['time']+'</b></span></div>'
  1247.                                 }).appendTo('.LocBook');
  1248.                 }
  1249.                             });
  1250.                         }else if(i == 'raid') {
  1251.               $('<div />', {
  1252.                                 "class": 'Raids',
  1253.                 html: response['html']
  1254.                             }).appendTo('.Quests');
  1255.             }
  1256.             if(i == 'questsList') {
  1257.               i = 'quests';
  1258.             }
  1259.                         $('.AquaBook .Category').find('#'+i+'Book').addClass('active');
  1260.                         $('.Modal').css('left',(Math.round(offset = $('.MidMenu').offset().left) + 108)+'px');
  1261.                         Game.loaders.worldClose();
  1262.                 }
  1263.             });
  1264.         },
  1265.         clans: function() {
  1266.             $.ajax({
  1267.                 url: "/do/modal",
  1268.                 type: "POST",
  1269.                 data: "type=clans",
  1270.                 beforeSend: function(){
  1271.                     Game.modals.modalLoad(3);
  1272.                 },
  1273.                 success: function (response) {
  1274.                         response = JSON.parse(response);
  1275.             $('<div />', {
  1276.                             "class": 'Clans'
  1277.                         }).appendTo('.Modal');
  1278.             $('<div />', {
  1279.                             "class": 'Category',
  1280.               html: '<div class="Name">Лиги</div><div class="Button top1 active">Закрыто</div><div class="Button top2">Золотая</div><div class="Button top3">Закрыто</div><div class="Button top4">Закрыто</div>'
  1281.                         }).appendTo('.Clans');
  1282.             $('<div />', {
  1283.                             "class": 'ClanList'
  1284.                         }).appendTo('.Clans');
  1285.                         $.each(response['clansList'], function(x,y){
  1286.                             $('<div />', {
  1287.                                 "class": 'Clan',
  1288.                                 "click": function() {
  1289.                                     openClanCard(y['id']);
  1290.                                 },
  1291.                                 html: '<img src="/img/world/clans/'+y['id']+'.png"><div class="Top">'+y['rating']+'</div><div class="Name">'+y['name']+'</div>'
  1292.                             }).appendTo('.ClanList');
  1293.                         });
  1294.             $('<div />', {
  1295.                             "class": 'BottomClans'
  1296.                         }).appendTo('.Clans');
  1297.             $('<div />', {
  1298.                             "class": 'Buttons'
  1299.                         }).appendTo('.BottomClans');
  1300.                         $('<div />', {
  1301.                             "class": 'Button',
  1302.                             html: 'Создать клан',
  1303.                             "click": function() {
  1304.                                 Game.clan.createClan();
  1305.                             }
  1306.                         }).appendTo('.BottomClans .Buttons');
  1307.                         $('.Modal').css('left',(Math.round(offset = $('.MidMenu').offset().left) + 500)+'px');
  1308.                         Game.loaders.worldClose();
  1309.                 }
  1310.             });
  1311.         }
  1312.     },
  1313.     pokemonTeamTabs: function(i,r){
  1314.         $.ajax({
  1315.             url:"/do/PokemonTeam",
  1316.             type:"POST",
  1317.             data:"type="+r+"&other="+i,
  1318.             beforeSend: function(){
  1319.                 $('<div />', {
  1320.                     "class": 'Hidden',
  1321.                     id: 'Hidden'+i,
  1322.                     html: '<div id="HiddenLoad"></div>'
  1323.                 }).appendTo('#pokemonDivs'+i);
  1324.             },
  1325.             success:function(response){
  1326.                 if(r == 'info'){
  1327.                     response = JSON.parse(response);
  1328.           Game.modals.modalLoad(5);
  1329.           $('<div />', {
  1330.                         "class": 'Pokemons',
  1331.                         html: response['html']
  1332.                     }).appendTo('.Modal');
  1333.           if((Math.round(offset = $('.MidMenu').offset().left) - 120) < 0) {
  1334.             var left = 1;
  1335.           }else{
  1336.             var left = (Math.round(offset = $('.MidMenu').offset().left) - 120);
  1337.           }
  1338.                 $('.Modal').css('left',left+'px');
  1339.           Game.loaders.worldClose();
  1340.                 }else if(r == 'attack'){
  1341.                     response = JSON.parse(response);
  1342.                     $('#HiddenLoad').remove();
  1343.                     $('<div />', {
  1344.                         "class": 'Name',
  1345.                         html: '<i class="fa fa-close"></i> Атаки',
  1346.                         "click": function(){
  1347.                             $('#Hidden'+i).remove();
  1348.                         }
  1349.                     }).appendTo('#Hidden'+i);
  1350.                     $('<div />', {
  1351.                         "class": 'Attacks',
  1352.                         html: response['html']
  1353.                     }).appendTo('#Hidden'+i);
  1354.                 }else if(r == 'stats'){
  1355.                     response = JSON.parse(response);
  1356.                     $('#HiddenLoad').remove();
  1357.                     $('<div />', {
  1358.                         "class": 'Name',
  1359.                         html: '<i class="fa fa-close"></i> Статы',
  1360.                         "click": function(){
  1361.                             $('#Hidden'+i).remove();
  1362.                         }
  1363.                     }).appendTo('#Hidden'+i);
  1364.                     $('<div />', {
  1365.                         "class": 'StatsPokemon',
  1366.                         "id": 'StatsPokemon'+i,
  1367.                         html: '<div class="StatPokemon" id="hpStat'+i+'"><div class="Stat">Здоровье</div><span>'+response['statHp']+'</span></div><div class="StatPokemon" id="atkStat'+i+'"><div class="Stat">Атака</div><span>'+response['statAtk']+'</span></div><div class="StatPokemon" id="defStat'+i+'"><div class="Stat">Защита</div><span>'+response['statDef']+'</span></div><div class="StatPokemon" id="spdStat'+i+'"><div class="Stat">Скорость</div><span>'+response['statSpd']+'</span></div><div class="StatPokemon" id="saStat'+i+'"><div class="Stat">Спец. Атака</div><span>'+response['statSa']+'</span></div><div class="StatPokemon" id="sdStat'+i+'"><div class="Stat">Спец. Защита</div><span>'+response['statSd']+'</span></div>'
  1368.                     }).appendTo('#Hidden'+i);
  1369.                     $('<div />', {
  1370.                         "class": 'Ev',
  1371.                         html: response['evHp']+' ev <i class="fa fa-plus"></i>',
  1372.                         "click": function(){
  1373.                             if(!$('#InputStat_0').length){
  1374.                                 addEV("open",0,this,false,i);
  1375.                             }
  1376.                         }
  1377.                     }).appendTo('#hpStat'+i);
  1378.                     $('<div />', {
  1379.                         "class": 'Ev',
  1380.                         html: response['evAtk']+' ev <i class="fa fa-plus"></i>',
  1381.                         "click": function(){
  1382.                             if(!$('#InputStat_1').length){
  1383.                                 addEV("open",1,this,false,i);
  1384.                             }
  1385.                         }
  1386.                     }).appendTo('#atkStat'+i);
  1387.                     $('<div />', {
  1388.                         "class": 'Ev',
  1389.                         html: response['evDef']+' ev <i class="fa fa-plus"></i>',
  1390.                         "click": function(){
  1391.                             if(!$('#InputStat_2').length){
  1392.                                 addEV("open",2,this,false,i);
  1393.                             }
  1394.                         }
  1395.                     }).appendTo('#defStat'+i);
  1396.                     $('<div />', {
  1397.                         "class": 'Ev',
  1398.                         html: response['evSpd']+' ev <i class="fa fa-plus"></i>',
  1399.                         "click": function(){
  1400.                             if(!$('#InputStat_3').length){
  1401.                                 addEV("open",3,this,false,i);
  1402.                             }
  1403.                         }
  1404.                     }).appendTo('#spdStat'+i);
  1405.                     $('<div />', {
  1406.                         "class": 'Ev',
  1407.                         html: response['evSa']+' ev <i class="fa fa-plus"></i>',
  1408.                         "click": function(){
  1409.                             if(!$('#InputStat_4').length){
  1410.                                 addEV("open",4,this,false,i);
  1411.                             }
  1412.                         }
  1413.                     }).appendTo('#saStat'+i);
  1414.                     $('<div />', {
  1415.                         "class": 'Ev',
  1416.                         html: response['evSd']+' ev <i class="fa fa-plus"></i>',
  1417.                         "click": function(){
  1418.                             if(!$('#InputStat_5').length){
  1419.                                 addEV("open",5,this,false,i);
  1420.                             }
  1421.                         }
  1422.                     }).appendTo('#sdStat'+i);
  1423.                     $('<div />', {
  1424.                         "class": 'EvCount',
  1425.                         html: 'Доступно <b>'+response['ev']+'</b> EV'
  1426.                     }).appendTo('#StatsPokemon'+i);
  1427.                 }else{
  1428.                     Game.notifications.main('Ошибка. Попробуйте снова.',"error");
  1429.                 }
  1430.             }
  1431.         });
  1432.     },
  1433.     buyThingsAquarits: function(t) {
  1434.         $.ajax({
  1435.             url:"/do/itemsAction",
  1436.             type:"POST",
  1437.             data:"itemID="+t+"&type=buyDonat",
  1438.             success:function(response){
  1439.                 response = JSON.parse(response);
  1440.                 Game.notifications.main((response['error'] == 0 ? 'Предмет удачно куплен.' : 'Недостаточно акваритов.'),(response['error'] == 0 ? 'success' : 'error'));
  1441.             }
  1442.         });
  1443.     },
  1444.     setColor: function(t) {
  1445.         $.ajax({
  1446.             url:"/do/trainers",
  1447.             type:"POST",
  1448.             data:"type=setColor&color="+t,
  1449.             success:function(t){
  1450.                 Game.notifications.main('Вы успешно изменили цвет.',"success");
  1451.             }
  1452.         });
  1453.     },
  1454.     trenercard: {
  1455.         opencard: function(n,c = false) {
  1456.             var modal = $('.mudol');
  1457.             modal.hide();
  1458.             if(c == false){
  1459.                 c = 'trainercard';
  1460.             }
  1461.             if(modal.is(':hidden')){
  1462.                 modal.show();
  1463.                 Game.loaders.mudol();
  1464.                 $.post('/do/trainers', {type: c, user: n}, function(response){
  1465.           $('<div />', {
  1466.                         'class': 'Header',
  1467.             html: 'Тренеркарта',
  1468.                     }).appendTo(modal);
  1469.           $('<div />', {
  1470.                         'class': 'Close',
  1471.             html: '<i class="fa fa-close"></i>',
  1472.                         'click': function(){
  1473.                             modal.hide();
  1474.                         }
  1475.                     }).appendTo('.mudol .Header');
  1476.           $('<div />', {
  1477.                         'class': 'Content',
  1478.                     }).appendTo(modal);
  1479.           $('<div />', {
  1480.                         'class': 'Trainercard',
  1481.                     }).appendTo('.mudol .Content');
  1482.           if(response['clanUserCheck'] == 1) {
  1483.             $('<div />', {
  1484.               "class": 'ClanBlock',
  1485.               "click": function() {
  1486.                 openClanCard(response['clanUser']);
  1487.               },
  1488.               "style": "background-image:url(/img/world/clans/"+response['clanUser']+".png)"
  1489.             }).appendTo('.Trainercard');
  1490.           }
  1491.           $('<div />', {
  1492.                         'class': 'BallBlock',
  1493.                     }).appendTo('.Trainercard');
  1494.           $.each(response['ballList'], function(x,y){
  1495.             $('<'+y['styleball']+' />', {
  1496.               "style": 'background-image: url('+y['typeball']+''+y['ball']+'.png);'
  1497.             }).appendTo('.BallBlock');
  1498.           });
  1499.           $('<div />', {
  1500.                         'class': 'BigAvatar',
  1501.             html: '<div style="background-image: url('+response['bigAva']+');"></div>'
  1502.                     }).appendTo('.Trainercard');
  1503.           $('<div />', {
  1504.                         'class': 'Information'
  1505.           }).appendTo('.Trainercard');
  1506.           $('<div />', {
  1507.                         'class': 'UserInfo',
  1508.             html: function() {
  1509.               var tpl = '<div class="Position">'+response['region']+' <i class="fas fa-angle-right"></i> '+response['location']+'</div> <div class="TrainerBlock"><div class="Avatar" onclick=showUserTooltip("'+response['id']+'") style="background-image: url(/img/avatars/mini/'+response['miniIcon']+'.png);"> <div class="Status '+response['classOnl']+'"></div> </div> <div class="Title"><div class="Name"><div class="u-'+response['userGroup']+'">'+response['login']+'</div> </div><div class="Other u-'+response['userGroup']+'">'+response['rang']+'</div> </div></div>';
  1510.               return tpl;
  1511.             }
  1512.                     }).appendTo('.Trainercard .Information');
  1513.           $('<div />', {
  1514.             "class": 'Status',
  1515.             "id": 'statusUser',
  1516.             html: '<div class="Text">'+response['status']+'</div>'
  1517.           }).appendTo('.Trainercard .Information');
  1518.           if(response['editStatus'] == 1){
  1519.             $('<div />', {
  1520.               html: '<i class="fa fa-pen-square"></i>',
  1521.               "class": 'Pen',
  1522.               "click": function() {
  1523.                 editStatus(false,false,response['status']);
  1524.               }
  1525.             }).appendTo('#statusUser');
  1526.           }
  1527.           $('<div />', {
  1528.             "class": 'TimeOnl',
  1529.             html: 'В игре '+response['inGame']+''+response['lastGame']+''
  1530.           }).appendTo('.Trainercard .Information');
  1531.           $('<div />', {
  1532.             "class": 'Tabses'
  1533.           }).appendTo('.Trainercard .Information');
  1534.           $('<div />', {
  1535.             "class": 'Tabs',
  1536.             html: '<div style="color: #fff; background: #6c99ca;" id="trophyTab" onclick=setTrenerBlock("trophyBlock",this);>Награды</div> <div id="friendsTab" onclick=setTrenerBlock("friendBlock",this);>Друзья</div>'
  1537.           }).appendTo('.Tabses');
  1538.           $('<div />', {
  1539.             "class": 'Table',
  1540.             "id": 'trophyBlock'
  1541.           }).appendTo('.Tabses');
  1542.           $('<div />', {
  1543.             "class": 'Table',
  1544.             "id": 'friendBlock',
  1545.             "style": 'display:none'
  1546.           }).appendTo('.Tabses');
  1547.           $('<div />', {
  1548.             "class": 'Trophys',
  1549.             html: '<div class="Info">Турнирный рейтинг: '+response['classCount']+'</div>'
  1550.           }).appendTo('#trophyBlock');
  1551.           $('<div />', {
  1552.             "class": 'Friends',
  1553.             html: '<div class="Info">Друзей: '+response['friends']+'</div>'
  1554.           }).appendTo('#friendBlock');
  1555.           $.each(response['trophyList'], function(x,y){
  1556.             $('<div />', {
  1557.               "class": 'Trophy',
  1558.               "style": 'background-image: url(/img/world/items/little/'+y['trophy']+'.png)',
  1559.               "click": function() {
  1560.                 issetAll(y['info'],'item');
  1561.               }
  1562.             }).appendTo('.Trophys');
  1563.           });
  1564.           $('.Friends').append(response['friendsList']);
  1565.           $('<div />', {
  1566.             "class": 'Statistics',
  1567.             html: '<div><span>'+response['dex']+'</span>покедекс</div><div><span>'+response['shineDex']+'</span>шайнидекс</div><div><span>'+response['shadowDex']+'</span>шедоудекс</div><div><span>'+response['pver']+'</span>PVE очки</div>'
  1568.           }).appendTo('.Trainercard');
  1569.                     Game.loaders.mudolClose();
  1570.                 }, 'json')
  1571.             }
  1572.         }
  1573.     },
  1574.     clan: {
  1575.         createClan: function() {
  1576.             $('.model').remove();
  1577.             Game.loaders.world();
  1578.             Game.modals.modelLoad('Создание клана');
  1579.             $('.Modal').remove();
  1580.             $('<div />', {
  1581.                 'class': 'txtCM',
  1582.                 html: 'Стоимость создания клана составляет <b>1.500.000 монет</b>. Заявка рассматривается около недели. Вы получите уведомление об удачном или неудачном создании клана. <br>Денежные средства снимутся после успешной заявки. Если заявка не пройдет модерацию, монеты будут возвращены.'
  1583.             }).appendTo('.content-model');
  1584.             $('<div />', {
  1585.                 'class': 'createClan',
  1586.                 html: "<input type='text' class='createClanInput' id='clanCreateName' placeholder='Название клана'><br><input id='clanCreateEmblem' type='text' class='createClanInput' placeholder='Ссылка на эмблему (100x100, png или jpg)'>"
  1587.             }).appendTo('.content-model');
  1588.             $('<div />', {
  1589.                 'class': 'createClanBtn',
  1590.                 'click': function() {
  1591.                     btnCreateClan();
  1592.                 },
  1593.                 html: 'Подать заявку'
  1594.             }).appendTo('.createClan');
  1595.             Game.loaders.worldClose();
  1596.         }
  1597.     },
  1598.     random: {
  1599.         mainRand: function(min,max) {
  1600.             var rand = min + Math.random() * (max - min)
  1601.             rand = Math.round(rand);
  1602.             return rand;
  1603.         }
  1604.     },
  1605.     prize: {
  1606.         giveTreners: function(u,i) {
  1607.             $.ajax({
  1608.                 url: "/do/gift",
  1609.                 type: "POST",
  1610.                 data: {
  1611.                     user: u,
  1612.                     id: i
  1613.                 },
  1614.                 success: function (response) {
  1615.                     response = JSON.parse(response);
  1616.                     var a = (response['errorText'] == 1 ? 'Не хватает акваритов.' : 'Вы удачно отправили подарок.');
  1617.                     Game.notifications.main(a,response['error']);
  1618.                 }
  1619.             });
  1620.         }
  1621.     },
  1622.     autoLoadAtWorld: function() {
  1623.         Game.notifications.count();
  1624.     $('<div />', {
  1625.             "class": 'Button Smiles el_smile',
  1626.             html: '<i class="fas fa-smile"></i>'
  1627.         }).appendTo('.MiniButtons');
  1628.  
  1629.     $('<div />', {
  1630.             "class": 'Button el_clear_chat',
  1631.             html: '<i class="fas fa-eraser"></i>',
  1632.             'click': function() {
  1633.                 $('.Message-Block').html('');
  1634.             }
  1635.         }).appendTo('.MiniButtons');
  1636.  
  1637.     $('<div />', {
  1638.             "class": 'Button NoActive Dex el_dex',
  1639.             html: 'dex',
  1640.       'click': function() {
  1641.         openDex(1);
  1642.       }
  1643.         }).appendTo('.DivRightButtons .Wrap');
  1644.  
  1645.     $('<div />', {
  1646.             "class": 'Button NoActive el_market',
  1647.             html: '<i class="fas fa-gavel"></i>',
  1648.       'click': function() {
  1649.         openMarket();
  1650.       }
  1651.         }).appendTo('.DivRightButtons .Wrap');
  1652.  
  1653.     $('<div />', {
  1654.             "class": 'Line'
  1655.         }).appendTo('.DivRightButtons .Wrap');
  1656.  
  1657.     $('<div />', {
  1658.             "class": 'Button NoActive el_wild',
  1659.             html: '<i class="fas fa-paw"></i>',
  1660.       'click': function() {
  1661.         setHunt(this);
  1662.       }
  1663.         }).appendTo('.DivRightButtons .Wrap');
  1664.  
  1665.     $('<div />', {
  1666.             "class": 'Button NoActive el_fight',
  1667.             html: '<i class="fas fa-eye"></i>',
  1668.       'click': function() {
  1669.         setFight();
  1670.       }
  1671.         }).appendTo('.DivRightButtons .Wrap');
  1672.     },
  1673.     loadAtWorld: function() {
  1674.         $.ajax({
  1675.             url: "/do/init",
  1676.             type: "POST",
  1677.             success: function (response) {
  1678.                 response = JSON.parse(response);
  1679.                 if(response['data']['bonusMoney'] != '1'){
  1680.                     $('<div />', {
  1681.                         'id': 'moneyBonusTime',
  1682.                         html: '<i class="fa fa-database"></i><div>x'+response['data']['bonusMoneyReit']+'</div>',
  1683.                     }).prependTo('.Reits');
  1684.                     Tipped.create('#moneyBonusTime', 'Дроп монет х'+response['data']['bonusMoneyReit']+'. Закончится '+moment(response['data']['bonusMoney'],'YYYYMMDDhmmss').calendar());
  1685.                 }
  1686.                 if(response['data']['bonusDrop'] != '1'){
  1687.                     $('<div />', {
  1688.                         'id': 'dropBonusTime',
  1689.                         html: '<i class="fa fa-briefcase"></i><div>x'+response['data']['bonusDropReit']+'</div>',
  1690.                     }).prependTo('.Reits');
  1691.                     Tipped.create('#dropBonusTime', 'Дроп предметов х'+response['data']['bonusDropReit']+'. Закончится '+moment(response['data']['bonusDrop'],'YYYYMMDDhmmss').calendar());
  1692.                 }
  1693.                 if(response['data']['bonusExp'] != '1'){
  1694.                     $('<div />', {
  1695.                         'id': 'expBonusTime',
  1696.                         html: '<i class="fa fa-graduation-cap"></i><div>x'+response['data']['bonusExpReit']+'</div>',
  1697.                     }).prependTo('.Reits');
  1698.                     Tipped.create('#expBonusTime', 'Опыт х'+response['data']['bonusExpReit']+'. Закончится '+moment(response['data']['bonusExp'],'YYYYMMDDhmmss').calendar());
  1699.                 }
  1700.                 if(response['data']['bonusVolera'] != '1'){
  1701.                     $('<div />', {
  1702.                         'id': 'voleraBonusTime',
  1703.                         html: '<i class="fa fa-home"></i><div>x'+response['data']['bonusVoleraReit']+'</div>',
  1704.                     }).prependTo('.Reits');
  1705.                     Tipped.create('#voleraBonusTime', 'Встретить покемонов из вольера Богатого поместья х'+response['data']['bonusVoleraReit']+'. Закончится '+moment(response['data']['bonusVolera'],'YYYYMMDDhmmss').calendar());
  1706.                 }
  1707.                 if(response['data']['bonusUnik'] != '1'){
  1708.                     $('<div />', {
  1709.                         'id': 'unikBonusTime',
  1710.                         html: '<i class="fa fa-star"></i><div>x'+response['data']['bonusUnikReit']+'</div>',
  1711.                     }).prependTo('.Reits');
  1712.                     Tipped.create('#unikBonusTime', 'Встретить Shine и Shadow х'+response['data']['bonusUnikReit']+'. Закончится '+moment(response['data']['bonusUnik'],'YYYYMMDDhmmss').calendar());
  1713.                 }
  1714.                             $('<div />', {
  1715.                                             'class': 'Text',
  1716.                                             html: ' <div class="u-'+response['data']['user_group']+'">'+response['data']['login']+'</div> <span>'+response['data']['rang']+'</span>'
  1717.                                         }).prependTo('.TopMenu .LeftMenu');
  1718.                                         $('<div />', {
  1719.                                                         'class': 'Avatar',
  1720.                                                         'style': 'background-image: url(/img/avatars/mini/'+response['data']['img']+'.png)'
  1721.                                                     }).prependTo('.TopMenu .LeftMenu');
  1722.                             Tipped.create('.TopMenu .LeftMenu .Avatar',function(element){return{title:response['data']['login'],content:'<a onclick="Game.trenercard.opencard(\''+LOGIN+'\');">Тренеркарта</a><br><a onclick="settings();">Настройки профиля</a><br><a href="http://ru.aquaworld.wikia.com/wiki/%D0%9D%D0%B0%D1%87%D0%B0%D0%BB%D1%8C%D0%BD%D0%B0%D1%8F_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0" target="_blank">Аквапедия</a><br><a href="http://aquaworld.forum.wtf/" target="_blank">Форум</a><br><a href=".." target="_blank">Главная страница</a><br><a href="/?route=exit">Выход</a>'};});
  1723.             }
  1724.         });
  1725.     },
  1726.     loaders: {
  1727.         main: function() {
  1728.             $(".preloader").find('span').html(Lang.loader_load);
  1729.             $("#locationPreloader").delay(500).fadeOut(200);
  1730.         },
  1731.         world: function() {
  1732.             $('.loadWorld').fadeIn(0);
  1733.         },
  1734.         worldClose: function() {
  1735.             $('.loadWorld').fadeOut(100);
  1736.         },
  1737.         mudol: function() {
  1738.             $('.mudol').html('<center id="mainLoader">'+mainLoader+'</center>');
  1739.         },
  1740.         mudolClose: function() {
  1741.             $('#mainLoader').remove();
  1742.         }
  1743.     },
  1744.     notifications: {
  1745.         main: function(a,b){
  1746.             var rand = Game.random.mainRand(1,1000000),
  1747.                 rand = 'notyId'+rand,
  1748.                 icon;
  1749.             if(b == 'success'){
  1750.                 icon = 'check';
  1751.             }else if(b == 'error'){
  1752.                 icon = 'close';
  1753.             }else if(b == 'info' || b == 'admin' || b == 'version'){
  1754.                 icon = 'info';
  1755.             }else if(b == 'warning'){
  1756.                 icon = 'exclamation-triangle';
  1757.             }else if(b == 'plus'){
  1758.                 icon = 'plus';
  1759.             }else if(b == 'minus'){
  1760.                 icon = 'minus';
  1761.             }else if(b == 'quest'){
  1762.                 icon = '';
  1763.             }
  1764.             $('<div />', {
  1765.                 "class": 'noty '+b,
  1766.                 "id": rand,
  1767.                 html: '<div class="icon"><i class="fa fa-'+icon+'"></i></div> <div class="text">'+a+'</div>',
  1768.                 "click": function() {
  1769.                     $('#'+rand).fadeOut(500, function() {
  1770.                         $('#'+rand).remove();
  1771.                     });
  1772.                 }
  1773.             }).appendTo('.DivNotification');
  1774.             setTimeout(function() {
  1775.                 $('#'+rand).fadeOut(500, function() {
  1776.                     $('#'+rand).remove();
  1777.                 });
  1778.             }, 10000);
  1779.         },
  1780.         count: function() {
  1781.             $.ajax({
  1782.                 url: "/do/notifications",
  1783.                 type: "POST",
  1784.                 data: "type=count",
  1785.                 success: function (data){
  1786.                     $('#countNotif').html(data);
  1787.                     if($('#countNotif').html() > 0){
  1788.                         $('.TopMenu .RightMenu .Buttons span').css('background','#e37d72');
  1789.                     }else{
  1790.                         $('.TopMenu .RightMenu .Buttons span').css('background','#f3f3f3');
  1791.                     }
  1792.                 },
  1793.                 complete: function(){
  1794.                     setTimeout(function(){
  1795.                         Game.notifications.count();
  1796.                     }, 3000);
  1797.                 }
  1798.             });
  1799.         }
  1800.     },
  1801.   init: function(){
  1802.  
  1803.     if(REITS == 1) {
  1804.       $('.DivNotification').append('<div class="noty reits" onclick=$(this).fadeOut(500);><div class="icon"><i class="fa fa-star"></i></div> <div class="text">'+REITS_TEXT+'</div></div>');
  1805.     }
  1806.  
  1807.         Aqua.loaders.main('Загрузка...');
  1808.         Game.updateUserLocation();
  1809.         updateLocation();
  1810.  
  1811.         Game.autoLoadAtWorld();
  1812.         Game.loadAtWorld();
  1813.         Game.title_tooltip();
  1814.     }
  1815. }
  1816.  
  1817. function submitResponse(user,type,data){
  1818.     $('.BlockOtherContent').hide();
  1819.     if(type == 'friend' || type == 'clan'){
  1820.         $('.BlockOtherContent').removeClass('updated');
  1821.     }
  1822.     $.ajax({
  1823.         url: "/do/submitResponse",
  1824.         type: "POST",
  1825.         data: {
  1826.             type: type,
  1827.             data: data,
  1828.             user: user
  1829.         },
  1830.         success: function (response) {
  1831.             response = JSON.parse(response);
  1832.             if(response['error'] == 1){
  1833.                 Game.notifications.main(response['text'],'error');
  1834.             }else{
  1835.                 Game.notifications.main(response['text'],'success');
  1836.                 if(response['type'] == 'trade'){
  1837.                     openTrade();
  1838.                 }
  1839.             }
  1840.         }
  1841.     });
  1842. }
  1843. function nursery(type, basenum = false, e = false, sort = false){
  1844.     if(type=="back"){
  1845.         $('.pok-2').remove();
  1846.         $('.back').remove();
  1847.         $('#sortNursery').remove();
  1848.         $('.pok-1').show();
  1849.     }else if(type=="open"){
  1850.         $.ajax({
  1851.             url: "/do/modal",
  1852.             type: "POST",
  1853.             data: "type=nurseryList&basenum="+basenum+"&sort="+sort,
  1854.             beforeSend: function(){
  1855.                 $('.pok-1').hide();
  1856.             },
  1857.             success: function (response) {
  1858.                 response = JSON.parse(response);
  1859.                 var tpl = '<form id="sortNursery"><select><option disabled selected style="background: graytext; color: #000000b3;">'+Lang.pit_select_main+'</option><optgroup label="'+Lang.pit_select_lvl+'"><option value="0">&darr;</option><option value="1">&uarr;</option></optgroup><optgroup label="'+Lang.pit_select_spar+'"><option value="2">'+Lang.pit_select_spar_no+'</option><option value="5">'+Lang.pit_select_spar_yes+'</option></optgroup><optgroup label="'+Lang.pit_select_sex+'"><option value="3">'+Lang.pit_select_sex_m+'</option><option value="4">'+Lang.pit_select_sex_d+'</option></optgroup></select></form><div class="back" onclick=nursery("back");>&lt;&lt; '+Lang.button_back+'</div>';
  1860.                 tpl+= '<div class="pok-2">';
  1861.             $.each(response['html'], function(x,y){
  1862.                 gen = y['gen'].split(',');
  1863.                 tpl += '<div onclick=nursery("tooltip",'+y['id']+',this);>'; // Раз
  1864.                 tpl += '<img src="/img/pokemons/mini/'+y['type']+'/'+y['basenum']+'.png">';
  1865.                 tpl += '<div class="nameNur '+y['type']+'-color">#'+y['basenum']+' '+y['name']+' <b>'+y['lvl']+''+Lang.abb_lvl+'</b></div>';
  1866.                 tpl += '<span>'+y['gender']+' '+(y['sparka']==0?Lang.text_spar_yes:Lang.text_spar_no)+'('+y['sparkaNumber']+')';
  1867.                 tpl += '<br>h'+gen[0]+'a'+gen[1]+'d'+gen[2]+'s'+gen[3]+'sa'+gen[4]+'sd'+gen[5]+'</span>';
  1868.                 tpl += ''+Lang.text_character+': '+y['character']+'</div>';
  1869.             });
  1870.             tpl+= '</div>';
  1871.             $('.pit').append(tpl);
  1872.                 if(sort){
  1873.                     $("select [value='"+sort+"']").attr("selected", "selected");
  1874.                 }
  1875.                 $('select').on('change', function (){
  1876.                     $('.pok-2').remove();
  1877.                     $('.back').remove();
  1878.                     $('#sortNursery').remove();
  1879.                     nursery("open",basenum,false,this.value);
  1880.                 });
  1881.             }
  1882.         });
  1883.     }else if(type=="search"){
  1884.         var search = $('#pitInput').val();
  1885.         if(search==''){
  1886.             return Game.notifications.main(Lang.text_query_null);
  1887.         }
  1888.         $.ajax({
  1889.             url: "/do/Npc/nursery",
  1890.             type: "POST",
  1891.             data: "search="+search,
  1892.             success: function (response) {
  1893.                 response = JSON.parse(response);
  1894.                 $('.back').remove();
  1895.                 $('.pok-2').remove();
  1896.                 $('.pok-1').hide();
  1897.                 var tpl = '<div class="back" onclick=nursery("back");>&lt;&lt; '+Lang.button_back+'</div>';
  1898.                 tpl+= '<div class="pok-2">';
  1899.                 if(response['error'] == 1){
  1900.                     tpl+= '<center>'+Lang.text_category_null+'</center>';
  1901.                 }else{
  1902.                     $.each(response['pokList'], function(x,y){
  1903.                         gen = y['gen'].split(',');
  1904.                         tpl += '<div onclick=nursery("tooltip",'+x+',this);>';
  1905.                         tpl += '<img src="/img/pokemons/mini/'+(y['type'] != 'normal' ? 'shine' : 'normal')+'/'+y['basenum']+'.png">';
  1906.                         tpl += '<div class="nameNur '+y['type']+'-color">#'+y['basenum']+' '+y['name']+' <b>'+y['lvl']+''+Lang.abb_lvl+'</b></div>';
  1907.                         tpl += '<span>'+y['gender']+' '+(y['sparka']==0?Lang.text_spar_yes:Lang.text_spar_no)+'('+y['sparkaNumber']+')';
  1908.                         tpl += '<br>h'+gen[0]+'a'+gen[1]+'d'+gen[2]+'s'+gen[3]+'sa'+gen[4]+'sd'+gen[5]+'</span>';
  1909.                         tpl += ''+Lang.text_character+': '+y['character']+'</div>';
  1910.                     });
  1911.                 }
  1912.                 tpl+= '</div>';
  1913.                 $('.pit').append(tpl);
  1914.             }
  1915.         });
  1916.     }else if(type=="tooltip"){
  1917.         $('.GiveDiv').remove();
  1918.         var tpl = '<div class="GiveDiv">';
  1919.         tpl+= '<div id="DivAbout">'+Lang.text_info+'</b></div>';
  1920.         tpl+= '<div class="wrap"><div class="PokList">';
  1921.         tpl+= '<div class="PokBtn" onclick=nursery("get",'+basenum+');>'+Lang.button_take_pokemon_pit+'</div>';
  1922.         tpl+= '</div></div></div>';
  1923.         $(tpl).appendTo('body');
  1924.         var position = $(e).position();
  1925.         var offset = $(e).offset();
  1926.         var left = Math.round(offset.left+30);
  1927.         var top = Math.round(offset.top+15);
  1928.         $('.GiveDiv').css({
  1929.             "left": left+'px',
  1930.             "top": top+'px'
  1931.         });
  1932.     }else if(type=="get"){
  1933.         $.ajax({
  1934.             url: "/do/modal",
  1935.             type: "POST",
  1936.             data: "type=nurseryGet&basenum="+basenum,
  1937.             beforeSend: function(){
  1938.                 $('.pok-1').hide();
  1939.             },
  1940.             success: function (response) {
  1941.                 response = JSON.parse(response);
  1942.                 if(response['error'] == 1){
  1943.                     Game.notifications.main(response['html'],'error');
  1944.                 }else{
  1945.                     Game.notifications.main(response['html'],'success');
  1946.                     $('.back').remove();
  1947.                     $('.pok-2').remove();
  1948.                     $('#sortNursery').remove();
  1949.                     nursery('open',response['basenum']);
  1950.                 }
  1951.             }
  1952.         });
  1953.     }else{
  1954.  
  1955.     }
  1956. }
  1957. function updateLocation(){
  1958.     $.post('/do/updateLocation', {userAssault: assault}, function(data){
  1959.         tplLoc = [], tplNpc = [];
  1960.         $.each(data.roads, function(key, val){
  1961.             tplLoc.push(
  1962.                 $('<div />', {
  1963.                     'html': val['name'],
  1964.           'class': (val['event'] == 1 ? 'active' : ''),
  1965.                     'click': function(){
  1966.                         goLocation(val['id']);
  1967.                     }
  1968.                 })
  1969.             );
  1970.         });
  1971.         $.each(data.npc, function(key, val){
  1972.       if(val.name) {
  1973.         tplNpc.push(
  1974.                 $('<div />', {
  1975.                     'html': val['name'],
  1976.             'class': (val['event'] == 1 ? 'active' : ''),
  1977.                     'click': function(){
  1978.                         NpcDialog(val["id"],false);
  1979.                     }
  1980.                 })
  1981.             );
  1982.       }
  1983.         });
  1984.         $('.DivMap .Center .Name div').html(data.name);
  1985.         $('.ImageLoc .About .Text').html(data.description);
  1986.         $('.DivMap .Right .Steps').html(tplNpc);
  1987.     $('.DivMap .Right .Steps').append(data.pc);
  1988.         $('.DivMap .Left .Steps').html(tplLoc);
  1989.  
  1990.         (data.pokAtLocation == 1 ? $('.DivMap .Center .Other div').css('color','#b34d4d') : $('.DivMap .Center .Other div').css('color','#646464'));
  1991.     if(data.img > 0) {
  1992.       $('.DivMap .Center .ImageLoc').css('backgroundImage','url(/img/world/location/'+data.img+'.png)');
  1993.       //$('.ImageLoc .About').css('display','none');
  1994.     }else{
  1995.       $('.DivMap .Center .ImageLoc').css('backgroundImage','url(/img/world/location/undefined.png)');
  1996.       //$('.ImageLoc .About').css('display','block');
  1997.     }
  1998.     $('.DivNpcBlock').remove();
  1999.         $('.model').remove();
  2000.  
  2001.         if(data.usersDefNotice){
  2002.             updNoticeDef(data.usersDefNotice);
  2003.         }
  2004.  
  2005.         if(ClassInfo){
  2006.  
  2007.             ClassInfo._upUsrLoc(data.usersAtLocation, (data.usersAtNotice || null));
  2008.  
  2009.             if(data.server_ver){
  2010.                 ClassInfo._upVer(data.server_ver);
  2011.             }
  2012.  
  2013.         }
  2014.  
  2015.         if(data.battleInfo){
  2016.             if(!ClassBattle){
  2017.                 ClassBattle = new GameBattle(data.battleInfo);
  2018.             }else{
  2019.                 ClassBattle._open(data.battleInfo);
  2020.             }
  2021.         }
  2022.  
  2023.         if(data.tradeInfo){
  2024.             if(!ClassTrade){
  2025.                 ClassTrade = new Trade(data.tradeInfo);
  2026.             }else{
  2027.                 ClassTrade._parseData(data.tradeInfo);
  2028.             }
  2029.         }else{
  2030.             if(ClassTrade){
  2031.                 ClassTrade._close(false);
  2032.                 ClassTrade = null;
  2033.             }
  2034.         }
  2035.     }, 'json')
  2036. }
  2037.  
  2038. function openModal(type,id) {
  2039.     var modal = $('.Modal');
  2040.     $('.BlockOtherContent').hide();
  2041.     modal.remove();
  2042.     $.ajax({
  2043.         url: "/do/modal",
  2044.         type: "POST",
  2045.         data: "type="+type+"&pokID="+id,
  2046.         beforeSend: function(){
  2047.       Game.loaders.world();
  2048.       $('.Modal').remove();
  2049.             $("<div/>", {
  2050.                     "class": "Modal"
  2051.       }).appendTo("body");
  2052.         Game.loaders.world();
  2053.         },
  2054.         success: function (response) {
  2055.                 response = JSON.parse(response);
  2056.                 var offset = $('.MidMenu').offset();
  2057.                 var left = Math.round(offset.left);
  2058.                 if(type == 'trainers'){
  2059.                     var leftA = left + 310;
  2060.                 }else if(type == 'craft' || type == 'discovery'){
  2061.                     var leftA = left + 383;
  2062.                 }
  2063.                 $('.Modal').css('left',leftA+'px');
  2064.                 $('.Modal').append(response["html"]);
  2065.                 if(type == 'pokemons'){
  2066.                     goPok(id);
  2067.                 }
  2068.         Game.loaders.worldClose();
  2069.         }
  2070.     });
  2071. }
  2072. function editInfo(type, other = false){
  2073.     switch(type){
  2074.         case 'pass':
  2075.             var oldPass = $('#oldPass').val(),
  2076.                 newPass = $('#newPass').val(),
  2077.                 dblNewPass = $('#dblNewPass').val();
  2078.             if(oldPass == newPass){
  2079.                 return Game.notifications.main(Lang.error_password_is_used, "error");
  2080.             }else if(newPass !== dblNewPass){
  2081.         return Game.notifications.main(Lang.error_password_do_not_match, "error");
  2082.             }else if($('#oldPass').length == 0 || $('#dblNewPass').length == 0 || $('#newPass').length == 0){
  2083.         return Game.notifications.main('Поля не должны оставаться пустыми', "error");
  2084.             }else{
  2085.                 $.post('/do/edit', {type: type, pass: oldPass, newPass: newPass, dblNewPass: dblNewPass}, function(data){
  2086.                     if(data.error == 1){
  2087.                         return Game.notifications.main(data.text);
  2088.                     }else{
  2089.                         $('#oldPass').val('');
  2090.                         $('#newPass').val('');
  2091.                         $('#dblNewPass').val('');
  2092.                         Game.notifications.main(Lang.success_password_changed, "success");
  2093.                     }
  2094.                 }, 'json')
  2095.             }
  2096.             break;
  2097.         case 'closeNotifyAdmin':
  2098.             $.post('/do/edit', {type: type, idNotify: other}, function(data){
  2099.                 $('.notya-'+other+'').remove();
  2100.             }, 'json')
  2101.             break;
  2102.       case 'editSound':
  2103.             $.post('/do/edit', {type: type, set: other}, function(data){
  2104.                 UserAudio = other;
  2105.                 settings();
  2106.             }, 'json')
  2107.             break;
  2108.         case 'editColor':
  2109.                 $.post('/do/edit', {type: type, set: other}, function(data){
  2110.                     Game.notifications.main('Цвет успешно изменен.', "success");
  2111.                     settings();
  2112.                 }, 'json')
  2113.                 break;
  2114.           case 'editTeam':
  2115.                 $.post('/do/edit', {type: type, set: other}, function(data){
  2116.                     Game.notifications.main('Изменения прошли успешно.', "success");
  2117.                     settings();
  2118.                 }, 'json')
  2119.                 break;
  2120.         //case 'editSprite':
  2121.         //  $.post('/do/edit', {type: type, set: other}, function(data){
  2122.         //      UserAudio = other;
  2123.         //      settings();
  2124.         //  }, 'json')
  2125.         //  break;
  2126.     }
  2127.  
  2128. }
  2129. function editLang(lang){
  2130.     $.ajax({
  2131.         url: "/do/edit",
  2132.         type: "POST",
  2133.         data: "type="+lang,
  2134.         success: function (response) {
  2135.             response = JSON.parse(response);
  2136.             Game.notifications.main(Lang.success_edit_lang, 'success');
  2137.         }
  2138.     });
  2139. }
  2140. function itemOpen(e,typeM,item_id,name,description,id,count,weight,use,dress,drop,trade,give,type=false,status=false,egg,npc){
  2141.     var tlp = $('.tooltip'),
  2142.   e = window.event,
  2143.   element = $(e),
  2144.   left = (e.clientX - 134),
  2145.   top = (e.clientY + 15);
  2146.   if(left < 0) {
  2147.     left = 0;
  2148.   }
  2149.   $(tlp).css({
  2150.       "left": left+'px',
  2151.       "top": top+'px'
  2152.   });
  2153.     tlp.html('<center>'+mainLoader+'</center>');
  2154.  
  2155.     var tpl = [], el_count = element.find('.Count');
  2156.  
  2157.     count = (el_count.length ? el_count.text() : count);
  2158.  
  2159.     tpl.push('<div class="Name">'+name+' ('+count+' шт.)</div>');
  2160.     tpl.push('<div class="Image"><img id="imgItem" src="/img/world/items/big/'+id+'.png"></div>');
  2161.     tpl.push('<div class="About">'+description+'<br><span class="id_item_ab">id предмета: '+id+'</span></div>');
  2162.  
  2163.     var tpl_t_g = [], countItemInput;
  2164.  
  2165.     if(drop === true || dress === true || give === true){
  2166.         countItemInput = $('<input />', {
  2167.             'id':'countItemInput',
  2168.             'type':'number',
  2169.             'value':'1',
  2170.             'placeholder':Lang.text_count
  2171.         });
  2172.         tpl_t_g.push(countItemInput);
  2173.     }
  2174.  
  2175.     if(egg){
  2176.         countItemInput = $('<input />', {
  2177.             'id':'countItemInput',
  2178.             'type':'number',
  2179.             'value':'1',
  2180.             'placeholder':Lang.text_count
  2181.         });
  2182.     }
  2183.  
  2184.     if(give === true){
  2185.         tpl_t_g.push('<div onclick=\'itemAction('+id+',"give","'+name+'","'+typeM+'");\'>'+Lang.button_item_pokemon+'</div>');
  2186.     }
  2187.     if(dress === true){
  2188.         tpl_t_g.push(
  2189.             $('<div />', {
  2190.                 'html':Lang.button_item_dress,
  2191.                 'click':function(){
  2192.                     itemAction(item_id, 'dress', name,''+typeM+'');
  2193.                 }
  2194.             })
  2195.         );
  2196.     }
  2197.     if(use === true){
  2198.         tpl_t_g.push('<div onclick=itemAction('+id+',"use",false,"'+typeM+'");>'+Lang.button_item_use+'</div>');
  2199.     }
  2200.     if(trade === true && !egg) {
  2201.       tpl_t_g.push('<div onclick=market_go('+item_id+',"stavka_item");>Выставить на аукцион</div>');
  2202.     }
  2203.     if(drop === true && !isTrade){
  2204.         tpl_t_g.push('<div onclick=itemAction('+item_id+',"drop",false,"'+typeM+'");>'+Lang.button_drop+'</div>');
  2205.     }else if(egg){
  2206.         tpl_t_g.push('<div onclick=itemAction('+item_id+',"dropEgg",false,"'+typeM+'");>'+Lang.button_drop_egg+'</div>');
  2207.     tpl_t_g.push('<div onclick=itemAction('+item_id+',"incubEgg",false,"'+typeM+'");>Использовать инкубатор</div>');
  2208.     tpl_t_g.push('<div onclick=market_go('+item_id+',"stavka_egg");>Выставить на аукцион</div>');
  2209.         (npc > 0) ? tpl_t_g.push('<div onclick=itemAction('+item_id+',"giveEgg");>'+Lang.button_item_npc_give+'</div>') : '';
  2210.     }
  2211.   if(!egg && npc > 0) {
  2212.     tpl_t_g.push('<div onclick=itemAction('+item_id+',"giveEgg",true);>'+Lang.button_item_npc_give+'</div>');
  2213.   }
  2214.     if((trade === true || trade === 'true') && status == 'trade'){
  2215.         if(ClassTrade){
  2216.             tpl_t_g.push(
  2217.                 $('<div />', {
  2218.                     'html':Lang.button_trade_add,
  2219.                     'click':function(){
  2220.                         Game.modals.inventory('all');
  2221.                         if(ClassTrade && countItemInput){
  2222.                             var countTrade = parseInt(countItemInput.val());
  2223.                             ClassTrade._addObject((egg ? 'egg' : 'item'), item_id, countTrade,
  2224.                                 function(){
  2225.                                     if(element && element.length){
  2226.                                         var eCount = parseInt(element.find('span').text());
  2227.                                         if(eCount > 0){
  2228.                                             eCount -= countTrade;
  2229.                                             if(eCount > 0){
  2230.                                                 element.find('span').html(eCount);
  2231.                                                 return true;
  2232.                                             }
  2233.                                         }
  2234.                                         element.remove();
  2235.                                     }
  2236.                                 }, function(){
  2237.                                     tlp.hide();
  2238.                                 }
  2239.                             );
  2240.                         }
  2241.                     }
  2242.                 })
  2243.             );
  2244.         }
  2245.     }
  2246.  
  2247.     tpl.push(
  2248.         $('<div />', {
  2249.             'class':'Buttons'
  2250.         }).append(
  2251.             tpl_t_g
  2252.         )
  2253.     );
  2254.     tlp.empty().append(tpl).show();
  2255. }
  2256. function renamePok(type,e,id,name){
  2257.     if(type == "open"){
  2258.       $('<div />', {
  2259.         "class": 'MiniModal',
  2260.         html: function() {
  2261.           var tpl = '';
  2262.           tpl += '<div class="Name" id="drgMini">Дать имя покемону</div>';
  2263.           tpl += '<div class="Content">';
  2264.           tpl += '<div class="Settings"><div class="Step"><input placeholder="'+Lang.text_name_it+'" type="text" maxlength="15" onkeydown="if(event.keyCode == 13){renamePok(\'rename\',this,'+id+',$(this).val());}"></div></div>'
  2265.           tpl += '</div>';
  2266.           return tpl;
  2267.         }
  2268.       }).appendTo('body');
  2269.       $('.MiniModal').draggabilly({
  2270.         handle: '#drgMini',
  2271.         containment: true
  2272.       });
  2273.         $('#namePokemon'+id).html('<input placeholder="'+Lang.text_name_it+'" type="text" maxlength="15" onkeydown="if(event.keyCode == 13){renamePok(\'rename\',this,'+id+',$(this).val());}">').focus();
  2274.         $('#namePokemon'+id+' input').focus();
  2275.     }else{
  2276.         if(name < 1 || name > 15){
  2277.             Game.notifications.main(Lang.error_name_it,"error");
  2278.         }else{
  2279.             $.ajax({
  2280.                 url: "/do/pokemonsAction",
  2281.                 type: "POST",
  2282.                 data: {
  2283.                     pokID: id,
  2284.                     type: 'renamePok',
  2285.                     name: name
  2286.                 },
  2287.                 success: function (response) {
  2288.                     response = JSON.parse(response);
  2289.                     if(response['error'] == 1){
  2290.                         Game.notifications.main(response['text'],'error');
  2291.                     }else{
  2292.                         Game.notifications.main(response['text'],'success');
  2293.                         $('#namePokemon'+id).html(response['name']);
  2294.                         $('.MiniModal').remove();
  2295.                         Game.modals.pokemons();
  2296.                     }
  2297.                 }
  2298.             });
  2299.         }
  2300.     }
  2301. }
  2302.  
  2303. function deletePok(id){
  2304.     if(confirm(Lang.confirm_drop_pokemon)){
  2305.         $.ajax({
  2306.             url: "/do/pokemonsAction",
  2307.             type: "POST",
  2308.             data: {
  2309.                 pokID: id,
  2310.                 type: 'deletePok'
  2311.             },
  2312.             success: function (response) {
  2313.                 response = JSON.parse(response);
  2314.                 if(response['error'] == 1){
  2315.                     Game.notifications.main(response['text'],'error');
  2316.                 }else{
  2317.                     Game.notifications.main(response['text'],'success');
  2318.                     Game.notifications.main('<img src="/img/pokemons/anim/normal/'+response['pokId']+'.gif"> '+response['pokName']+'','minus');
  2319.                     closeModal();
  2320.                 }
  2321.             }
  2322.         });
  2323.     }else{
  2324.         return false;
  2325.     }
  2326. }
  2327. function putPok(id){
  2328.     $.ajax({
  2329.         url: "/do/pokemonsAction",
  2330.         type: "POST",
  2331.         data: {
  2332.             pokID: id,
  2333.             type: 'putPok'
  2334.         },
  2335.         success: function (response) {
  2336.             response = JSON.parse(response);
  2337.             if(response['error'] == 1){
  2338.                 Game.notifications.main(response['text'],'error');
  2339.             }else{
  2340.                 Game.notifications.main(response['text'],'success');
  2341.                 Game.modals.pokemons();
  2342.             }
  2343.         }
  2344.     });
  2345. }
  2346. function npcGiveItem(id,npc,type=false){
  2347.     var ctg = (type == false ? "egg" : "item");
  2348.     $.ajax({
  2349.         url: "/do/npcGiveItem",
  2350.         type: "POST",
  2351.         data: {
  2352.             npc: npc,
  2353.             category: ctg,
  2354.             id: id
  2355.         },
  2356.         success: function (response) {
  2357.             response = JSON.parse(response);
  2358.             if(response['minus']) {
  2359.               Game.notifications.main(response['minus'],'minus');
  2360.             }
  2361.             if(response['plus']) {
  2362.               Game.notifications.main(response['plus'],'plus');
  2363.             }
  2364.             if(response['text']) {
  2365.             Game.notifications.main(response['text'],response['error']);
  2366.             }
  2367.             Game.modals.inventory('all');
  2368.         }
  2369.     });
  2370. }
  2371.  
  2372. function pokAction(e,id,start,newName,num){
  2373.     $('.GiveDiv').remove();
  2374.  
  2375.     var elm = $('<div />', {'class':'GiveDiv'});
  2376.  
  2377.     var tpl = [];
  2378.  
  2379.     tpl.push('<div id="DivAbout">'+Lang.text_info+'</b></div>');
  2380.  
  2381.     tpl.push(
  2382.         $('<div />', {'class':'wrap'}).append(
  2383.             $('<div />', {'class':'PokList'}).append(
  2384.                 (ClassTrade ?  $('<div />', {
  2385.                     'class':'PokBtn',
  2386.                     'html':Lang.button_trade_add,
  2387.                     'click': function(){
  2388.                         if(ClassTrade){
  2389.                             ClassTrade._addObject('poke', id, 1,
  2390.                                 function(){
  2391.                                     $('#pokeTeam_'+id).remove();
  2392.                                     Game.modals.pokemons();
  2393.                                 }, function(){
  2394.                                     elm.remove();
  2395.                                 }
  2396.                             );
  2397.                         }
  2398.                     }
  2399.                 }) : ''),
  2400.                 '<div class="PokBtn" onclick=openDex('+num+')>'+Lang.button_pokedex+'</div>',
  2401.                 '<div class="PokBtn" onclick=market_go('+id+',"stavka_pokemon")>Выставить на аукцион</div>',
  2402.                 '<div class="PokBtn" onclick=renamePok("open",this,'+id+');>'+Lang.button_pokemon_name_add+'</div>',
  2403.                 '<div class="PokBtn" onclick="putPok('+id+');">'+Lang.button_drop_pokemon_pit+'</div>',
  2404.                 '<div class="PokBtn" onclick=wentPok('+id+');>'+Lang.button_pokemon_walk+'</div>',
  2405.                 (start == 0 ? '<div class="PokBtn" onclick="setStart('+id+');">'+Lang.button_pokemon_start+'</div>' : ''),
  2406.                 '<div class="PokBtn" onclick="deletePok('+id+');">'+Lang.button_let_go+'</div>'
  2407.             )
  2408.         )
  2409.     );
  2410.  
  2411.     elm.empty().append(tpl);
  2412.  
  2413.     elm.appendTo('body');
  2414.  
  2415.     positionElement(e, elm[0]);
  2416. }
  2417. function itemAction(id,type,name,typeM,pok){
  2418.     $('.GiveDiv').remove();
  2419.     var count = ($('#countItemInput').val()?$('#countItemInput').val():1);
  2420.     if(type == 'giveEgg'){
  2421.         $('.GiveDiv').remove();
  2422.         var tpl = '<div class="GiveDiv">';
  2423.         tpl+= '<div id="DivAbout"><b>'+Lang.text_npc_add_item+'</b></div>';
  2424.         tpl+= '<div class="wrap"><div class="PokList">';
  2425.         $.ajax({
  2426.             url: "/do/modal",
  2427.             type: "POST",
  2428.             data: 'type=giveEggNpc',
  2429.             success: function (response) {
  2430.                 response = JSON.parse(response);
  2431.                 if(!response['error']){
  2432.                     var NPC = '';
  2433.                     $.each(response['npc'], function(x,y){
  2434.                         NPC += '<div class="PokeUse" onMouseOver="$(this).css(\'background\',\'#e8e8e8\');" onclick="npcGiveItem('+id+','+y['id']+','+name+');"><div class="NameUse" style="padding: 5px;color: #5f5f5f;">'+y['name']+'</div></div>';
  2435.                     });
  2436.                     tpl += NPC;
  2437.                 }
  2438.                 tpl+= '</div></div></div>';
  2439.                 $(tpl).appendTo('body');
  2440.                 var position = $('.tooltip').position();
  2441.                 var offset = $('.tooltip').offset();
  2442.                 var left = Math.round(offset.left)+20;
  2443.                 var positionTop = Math.round(position.top/100);
  2444.                 var top = Math.round(offset.top+(position.top/positionTop)+100);
  2445.                 $('.GiveDiv').css({
  2446.                     "left": left+'px',
  2447.                     "top": top+'px'
  2448.                 });
  2449.             }
  2450.         });
  2451.     }else if(type == 'give' || type == 'dress'){
  2452.         if(type == 'give'){
  2453.             var typeAction = 'GivePok';
  2454.             var Action = Lang.button_item_use;
  2455.         }else{
  2456.             var typeAction = 'DressPok';
  2457.             var Action = Lang.button_item_dress;
  2458.         }
  2459.         $('.GiveDiv').remove();
  2460.         var tpl = '<div class="GiveDiv">';
  2461.         tpl+= '<div id="DivAbout">'+Action+' <b>'+name+'</b></div>';
  2462.         tpl+= '<div class="wrap"><div class="PokList">';
  2463.         $.ajax({
  2464.             url: "/do/itemsAction",
  2465.             type: "POST",
  2466.             data: 'type=pokList',
  2467.             success: function (response) {
  2468.                 if(response != 0){
  2469.                     response = JSON.parse(response);
  2470.                     var team = '';
  2471.                     $.each(response['pokList'], function(x,y){
  2472.                         team+= '<div class="PokeUse '+y['class']+'" onclick=itemAction('+id+',"'+typeAction+'",false,"'+typeM+'",'+y['id']+');><img src="/img/pokemons/mini/'+y['type']+'/'+y['basenum']+'.png"></img> <div class="NameUse '+y['type']+'-color">#'+y['basenum']+' '+y['name']+'</div></div>';
  2473.                     });
  2474.                     tpl+=team;
  2475.                 }
  2476.                 tpl+= '</div></div></div>';
  2477.                 $(tpl).appendTo('body');
  2478.                 var position = $('.tooltip').position();
  2479.                 var offset = $('.tooltip').offset();
  2480.                 var left = Math.round(offset.left)+10;
  2481.                 var positionTop = Math.round(position.top/100);
  2482.                 var top = Math.round(offset.top+(position.top/positionTop)+100);
  2483.                 $('.GiveDiv').css({
  2484.                     "left": left+'px',
  2485.                     "top": top+'px'
  2486.                 });
  2487.             }
  2488.         });
  2489.     }else if(type == 'eggDrop'){
  2490.             $.ajax({
  2491.         url: "/do/itemsAction",
  2492.             type: "POST",
  2493.             data: {
  2494.                 itemID: id
  2495.             },
  2496.             beforeSend: function(){
  2497.                 $('.tooltip').hide();
  2498.             },
  2499.             success: function (response) {
  2500.                 Game.notifications.main(response['text'],'success');
  2501.             }
  2502.         });
  2503.     }else{
  2504.         $.ajax({
  2505.             url: "/do/itemsAction",
  2506.             type: "POST",
  2507.             data: {
  2508.                 itemID: id,
  2509.                 type: type,
  2510.                 count: count,
  2511.                 pokID: pok
  2512.             },
  2513.             beforeSend: function(){
  2514.                 $('.tooltip').hide();
  2515.             },
  2516.             success: function (response) {
  2517.                 response = JSON.parse(response);
  2518.                 if(response['text'] && response['error'] == 0){
  2519.                     if(id == 7 && type == 'GivePok' || id == 9 && type == 'GivePok' || id == 8 && type == 'GivePok'){
  2520.                         $('body').append('<div class="animationImage"><div class="eat"></div></div>');
  2521.                         setTimeout(function(){
  2522.                             $( ".animationImage" ).fadeOut( "slow", function() {
  2523.                                 $('.animationImage').remove();
  2524.                                 Game.notifications.main(response['text'],'success');
  2525.                             });
  2526.                         }, 2000);
  2527.                     }else if(type == 'GivePok' && id > 18 && id < 24 || type == 'GivePok' && id > 24 && id < 29 || type == 'GivePok' && id > 33 && id < 37 || type == 'GivePok' && id > 50 && id < 54 || type == 'GivePok' && id > 64 && id < 75 || type == 'GivePok' && id > 95 && id < 101){
  2528.                         if(response['other'] != 0){
  2529.               if(response['other'] <= 9) {
  2530.                 var ip = '00'+response['other'];
  2531.               }else if(response['other'] >= 10 && response['other'] <= 99) {
  2532.                 var ip = '0'+response['other'];
  2533.               }else{
  2534.                 var ip = response['other'];
  2535.               }
  2536.               if(response['other2'] <= 9) {
  2537.                 var ip2 = '00'+response['other2'];
  2538.               }else if(response['other2'] >= 10 && response['other2'] <= 99) {
  2539.                 var ip2 = '0'+response['other2'];
  2540.               }else{
  2541.                 var ip2 = response['other2'];
  2542.               }
  2543.                             $('body').append('<div class="animationImage"><div class="evol" style="background-image: url(/img/pokemons/full/normal/'+ip+'.png);"></div></div>');
  2544.                             $( ".animationImage .evol" ).fadeOut(3000, function() {
  2545.                                 $('.evol').remove();
  2546.                             });
  2547.                             setTimeout(function(){
  2548.                                     $('.animationImage').append('<div class="evol" style="background-image: url(/img/pokemons/full/normal/'+ip2+'.png);"></div>');
  2549.                                     setTimeout(function(){
  2550.                                         $('.animationImage').remove();
  2551.                                         Game.notifications.main(response['text'],'success');
  2552.                                     }, 3000);
  2553.                             }, 3100);
  2554.                         }else{
  2555.                             Game.notifications.main(response['text'],'success');
  2556.                         }
  2557.                     }else if(id == 95 && type == 'GivePok'){
  2558.                         if(response['other'] == 0){
  2559.                             Game.notifications.main(response['text'],'success');
  2560.                         }else{
  2561.                             $('body').append('<div class="animationImage"><div class="pika"></div><div class="tren"><div class="text" style="display:none;">'+Lang.text_fail+'</div><div class="a">'+Lang.stat[2]+'</div><div class="d">'+Lang.stat[3]+'</div><div class="s">'+Lang.stat[4]+'</div><div class="sa">'+Lang.stat[5]+'</div><div class="sd">'+Lang.stat[6]+'</div></div></div>');
  2562.                                 function getRandomFloat(min, max) {
  2563.                                     return Math.random() * (max - min) + min;
  2564.                                 }
  2565.                                 if(response['other'] == 1){
  2566.                                     setTimeout(function () { $(".tren .d").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2567.                                     setTimeout(function () { $(".tren .s").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2568.                                     setTimeout(function () { $(".tren .sa").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2569.                                     setTimeout(function () { $(".tren .sd").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2570.                                 }else if(response['other'] == 2){
  2571.                                     setTimeout(function () { $(".tren .a").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2572.                                     setTimeout(function () { $(".tren .s").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2573.                                     setTimeout(function () { $(".tren .sa").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2574.                                     setTimeout(function () { $(".tren .sd").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2575.                                 }else if(response['other'] == 3){
  2576.                                     setTimeout(function () { $(".tren .a").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2577.                                     setTimeout(function () { $(".tren .d").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2578.                                     setTimeout(function () { $(".tren .sa").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2579.                                     setTimeout(function () { $(".tren .sd").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2580.                                 }else if(response['other'] == 4){
  2581.                                     setTimeout(function () { $(".tren .a").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2582.                                     setTimeout(function () { $(".tren .s").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2583.                                     setTimeout(function () { $(".tren .d").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2584.                                     setTimeout(function () { $(".tren .sd").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2585.                                 }else if(response['other'] == 5){
  2586.                                     setTimeout(function () { $(".tren .a").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2587.                                     setTimeout(function () { $(".tren .s").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2588.                                     setTimeout(function () { $(".tren .sa").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2589.                                     setTimeout(function () { $(".tren .d").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2590.                                 }else if(response['other'] == 6){
  2591.                                     setTimeout(function () { $(".tren .a").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2592.                                     setTimeout(function () { $(".tren .d").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2593.                                     setTimeout(function () { $(".tren .s").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2594.                                     setTimeout(function () { $(".tren .sa").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2595.                                     setTimeout(function () { $(".tren .sd").fadeOut("slow"); }, getRandomFloat(1000,8000));
  2596.                                     setTimeout(function () { $(".tren .text").fadeIn("slow"); }, 8000);
  2597.                                 }
  2598.                                 setTimeout(function(){
  2599.                                     $( ".animationImage" ).fadeOut( "slow", function() {
  2600.                                         $('.animationImage').remove();
  2601.                                         Game.notifications.main(response['text'],'success');
  2602.                                     });
  2603.                                 }, 9000);
  2604.                         }
  2605.                     }else{
  2606.                         if($.isArray(response['text'])){
  2607.                             var countInf = 0;
  2608.                             $.each(response['text'], function(key, val){
  2609.                                 ++countInf;
  2610.                                 if(val && countInf < 50){
  2611.                                     Game.notifications.main(val,'success');
  2612.                                 }
  2613.                             })
  2614.                         }else{
  2615.                             Game.notifications.main(response['text'],'success');
  2616.                         }
  2617.  
  2618.                     }
  2619.                     if(type == 'remove'){
  2620.                         Game.notifications.main('<img src="img/world/items/little/'+id+'.png" class="item"> '+response['nameItem']+' (1 шт.)','plus');
  2621.                         Game.modals.pokemons();
  2622.                     }else{
  2623.                         Game.modals.inventory(typeM);
  2624.                     }
  2625.                     if(response['minus']) {
  2626.                       Game.notifications.main(response['minus'],'minus');
  2627.                     }
  2628.                     if(response['plus']) {
  2629.                       Game.notifications.main(response['plus'],'plus');
  2630.                     }
  2631.                 }else{
  2632.                     Game.notifications.main(response['text'],'error');
  2633.                 }
  2634.             }
  2635.         });
  2636.     }
  2637. }
  2638. function addEV(type,stat,e,count=false,pokID){
  2639.     if(type=='open'){
  2640.       $('<div />', {
  2641.         "class": 'MiniModal',
  2642.         html: '<div class="Name" id="drgMini">Добавить покемону EV</div><div class="Content"><div class="Settings"><div class="Step"><input placeholder="Количество EV..." onkeydown="if(event.keyCode == 13){addEV(\'add\','+stat+',this,$(this).val(),'+pokID+');}"></div></div></div>'
  2643.         }).appendTo('body');
  2644.       $('.MiniModal').draggabilly({
  2645.         handle: '#drgMini',
  2646.         containment: true
  2647.       });
  2648.     }else if(type=="add"){
  2649.         count = parseInt(count);
  2650.         var pattern = /^[0-9]+$/i;
  2651.         if(count > 126 || count <= 0){
  2652.             Game.notifications.main(Lang.error_ev_count,'error');
  2653.         }else if(!pattern.test(count)){
  2654.             Game.notifications.main(Lang.error_natural_numbers,'error');
  2655.         }else{
  2656.             $.ajax({
  2657.                 url: "/do/pokemonsAction",
  2658.                 type: "POST",
  2659.                 data: {
  2660.                     type: 'addEV',
  2661.                     stat: stat,
  2662.                     pokID: pokID,
  2663.                     count: count
  2664.                 },
  2665.                 success: function (response) {
  2666.                     response = JSON.parse(response);
  2667.                     if(response['text'] && response['error'] == 0){
  2668.                         Game.notifications.main(response['text'],'success');
  2669.                         Game.modals.pokemons();
  2670.                     }else if(response['error'] == 1){
  2671.                         Game.notifications.main(response['text'],'error');
  2672.                     }else{
  2673.                         Game.notifications.main(response['text'],'error');
  2674.                     }
  2675.                 }
  2676.             });
  2677.         }
  2678.         $('.MiniModal').remove();
  2679.     }
  2680. }
  2681. function NpcDialog(id,step = false){
  2682.     var npcBlock = $('.DivNpcBlock');
  2683.     if(npcBlock.length && !step){
  2684.         npcBlock.remove();
  2685.     }else{
  2686.         if(npcBlock.length === 0){
  2687.             $('body').append("<div class='DivNpcBlock'></div>");
  2688.             $('.DivNpcBlock').css("top",'110px');
  2689.         }
  2690.     }
  2691.     $.ajax({
  2692.         url: "/do/Npc/",
  2693.         type: "post",
  2694.         data: {
  2695.             npc: id,
  2696.             step: step
  2697.         },
  2698.         beforeSend: function(){
  2699.           $('.DivNpcBlock').css({
  2700.             "left": '40%',
  2701.             "top": '10%'
  2702.           });
  2703.             $('.loadWorld').css('display','block');
  2704.         },
  2705.         success: function (response) {
  2706.             response = JSON.parse(response);
  2707.             Game.loaders.worldClose();
  2708.             if(!response['error']){
  2709.                 if(response['action'] == 'updateLocation'){
  2710.                     $('.DivNpcBlock').remove();
  2711.                     updateLocation();
  2712.                 }
  2713.                 if(response['actionQuest']){
  2714.                     Game.notifications.main(response['actionQuest'],'quest');
  2715.                 }
  2716.                 if(response['actionQuestPlus']){
  2717.                   Game.notifications.main(response['actionQuestPlus'],'plus');
  2718.                 }
  2719.                 if(response['actionQuestMinus']){
  2720.                   Game.notifications.main(response['actionQuestMinus'],'minus');
  2721.                 }
  2722.                 if(response['question'] == '{{makasimka}}'){
  2723.                     byMax(response['npc_id']);
  2724.                     return;
  2725.                 }
  2726.                 if(response['question'] != '{{new}}'){
  2727.                     var answer = '';
  2728.                     if(response['answer']){
  2729.                         $.each(response['answer'], function(x,y){
  2730.  
  2731.                             if(x == 'by'){
  2732.                                 answer+= "<div onclick='byMax("+y['npc_id']+");'>"+y['title']+"</div>";
  2733.                             }else{
  2734.                                 answer+= "<div onclick='NpcDialog("+id+","+x+",event);'>"+y+"</div>";
  2735.                             }
  2736.                         });
  2737.                     }
  2738.                     var tpl = "";
  2739.                     tpl+= "<div class='Info'><div class='Image' style='background-image: url(/img/world/npc/"+id+".png);''></div> <div class='Name'><div id='drgNpc'>"+response['name']+"</div></div></div> <div class='Text'><div class='Close' onclick=$('.DivNpcBlock').remove();><i class='fa fa-close'></i></div> <div class='Dialog'>"+response['question']+"</div> <div class='Answer'>"+answer+"</div></div>";
  2740.                     $(".DivNpcBlock").html(tpl);
  2741.                 }else{
  2742.                     $('.DivNpcBlock').remove();
  2743.                     if($('.model').length){
  2744.                         $('.model').remove();
  2745.                     }
  2746.                     NpcObject(response['type']);
  2747.                 }
  2748.             }else if(response['error'] == 1){
  2749.                 alert(Lang.error_npc_unavailable);
  2750.                 $('.DivNpcBlock').remove();
  2751.             }else{
  2752.                 alert(Lang.error_npc_unlocation);
  2753.                 $('.DivNpcBlock').remove();
  2754.             }
  2755.             $('.DivNpcBlock').draggabilly({
  2756.               handle: '#drgNpc',
  2757.               containment: true
  2758.             });
  2759.         }
  2760.     });
  2761. }
  2762. function NpcObject(type){
  2763.     $.ajax({
  2764.         url: "/do/Npc/",
  2765.         type: "post",
  2766.         data: {
  2767.             type: type
  2768.         },
  2769.         success: function (response) {
  2770.             response = JSON.parse(response);
  2771.             if(!response['error']){
  2772.                 var tpl = '<div class="model"><div class="header">'+response['title']+'<span onclick=$(".model").remove();><i class="fa fa-close"></i></span></div>';
  2773.                 tpl += '<div class="content-model">';
  2774.                 if(response['type'] == 'pokemarket'){
  2775.                     tpl+= response['html'];
  2776.                 }else if(response['type'] == 'reproduction'){
  2777.                     tpl+= response['html'];
  2778.                 }else if(response['type'] == 'lombard'){
  2779.                     tpl+= response['html'];
  2780.                 }else{
  2781.                     tpl+= '<div class="pit"><input id="pitInput" placeholder="'+Lang.search_pokemon+'" onkeypress=if(event.keyCode==13)nursery("search"); type="text">';
  2782.                     tpl+= '<div class="pok-1">'+response['html'];
  2783.                     tpl+= '';
  2784.                     tpl+= '</div></div></div>';
  2785.                 }
  2786.                 tpl += '</div>';
  2787.                 $("body").append(tpl);
  2788.                     $('.model').draggabilly({
  2789.                         handle: '.header',
  2790.                         containment: true
  2791.                     });
  2792.             }else{
  2793.                 alert(Lang.error_no_way);
  2794.             }
  2795.         }
  2796.     });
  2797. }
  2798. function showNotify(e){
  2799.     $('.BlockOtherContent').toggle();
  2800.     if($('.BlockOtherContent').is(':visible')){
  2801.         $.ajax({
  2802.             url: "/do/notifications",
  2803.             type: "POST",
  2804.             data: "type=load",
  2805.             beforeSend: function(){
  2806.                 Game.loaders.world();
  2807.             },
  2808.             success: function (data) {
  2809.                 Game.loaders.worldClose();
  2810.                 if(data != '0'){
  2811.                     $('.BlockOtherContent .DivNotifyBlock').html(data);
  2812.                 }
  2813.                 if(!$('.BlockOtherContent').hasClass('updated')){
  2814.                     $('.BlockOtherContent').addClass('updated');
  2815.                 }
  2816.             }
  2817.         });
  2818.     }
  2819. }
  2820.  
  2821. function openTrade(){
  2822.  
  2823.     if(ClassTrade){
  2824.         ClassTrade._close(false);
  2825.  
  2826.         return setTimeout(function(){
  2827.             ClassTrade = null;
  2828.  
  2829.             openTrade();
  2830.  
  2831.         }, 100);
  2832.     }
  2833.  
  2834.     $.ajax({
  2835.  
  2836.         url: "/do/trade",
  2837.         type: "POST",
  2838.         data: {
  2839.             type:'view'
  2840.         },
  2841.  
  2842.         success: function (response) {
  2843.             response = JSON.parse(response);
  2844.             if(response['error'] == 1){
  2845.                 Game.notifications.main(response['text'],'error');
  2846.             }else{
  2847.                 ClassTrade = new Trade(response);
  2848.             }
  2849.         }
  2850.     });
  2851. }
  2852. function addTrade(id,type){
  2853.     var count = ($('#countItemInput').val()?$('#countItemInput').val():1);
  2854.     $.ajax({
  2855.         url: "/do/trade",
  2856.         type: "POST",
  2857.         data: "id="+id+"&typePut="+type+"&type=add&count="+count,
  2858.         success: function (response) {
  2859.             response = JSON.parse(response);
  2860.             if(response['error'] == 1){
  2861.                 Game.notifications.main(response['text'],'error');
  2862.             }else{
  2863.                 if(response['update'] == 0){
  2864.                     var tpl = '<div class="slot" id=slot_'+response['data']['id']+'>';
  2865.                     tpl+= '<img src="/img/world/items/little/'+response['data']['id']+'.png">';
  2866.                     tpl+= '<div class="text">'+response['data']['name']+' ('+response['data']['count']+' шт.)</div>';
  2867.                     tpl+= '</div>';
  2868.                     $('.userOne .itemsTrade').append(tpl);
  2869.                 }else{
  2870.                     alert(response['data']['count']);
  2871.                     var tpl = '<img src="/img/world/items/little/'+response['data']['id']+'.png">';
  2872.                     tpl+= '<div class="text">'+response['data']['name']+' ('+response['data']['count']+' шт.)</div>';
  2873.                     $('#slot_'+response['data']['id']).html(tpl);
  2874.                 }
  2875.             }
  2876.         }
  2877.     });
  2878. }
  2879. function evolutionPok(id){
  2880.     var pokID = parseInt($("#pokID").val());
  2881.      $.ajax({
  2882.         url: "/do/Npc/"+id+".php",
  2883.         type: "POST",
  2884.         data: 'pokID='+pokID,
  2885.         success: function (response) {
  2886.             response = JSON.parse(response);
  2887.             response['error'] == 1 ? Game.notifications.main(response['text'],'error') : Game.notifications.main(response['text'],'success');
  2888.             if(response['minus']) {
  2889.               Game.notifications.main(response['minus'],'minus');
  2890.             }
  2891.         }
  2892.     });
  2893. }
  2894. //function discoveryGo(type){
  2895. //    var pokID = parseInt($("#pokID").val());
  2896. //     $.ajax({
  2897. //        url: "/do/DiscoveryItem",
  2898.   //      type: "POST",
  2899.   //      data: 'pokID='+pokID+'&type='+type,
  2900.   //      success: function (response) {
  2901.   //          response = JSON.parse(response);
  2902.   //          Game.notifications.main(response["html"], response["error"]);
  2903.   //      }
  2904.   //  });
  2905. //}
  2906. function ngBox(type, refresh, rare){
  2907.     if(!rare) rare = 0;
  2908.     $.ajax({
  2909.         url: "/do/ngbox",
  2910.         type: "POST",
  2911.         data: 'type='+type+'&ref='+(refresh || 0)+'&rare='+rare,
  2912.         success: function (response) {
  2913.             response = JSON.parse(response);
  2914.  
  2915.             if(refresh){
  2916.                 $('.model').empty().append(response['html']);
  2917.             }else{
  2918.                 $('.model').remove();
  2919.                 $('body').append(response['html']);
  2920.                 $('.model').draggabilly({
  2921.                     handle: '.header',
  2922.                     containment: true
  2923.                 });
  2924.             }
  2925.  
  2926.  
  2927.         }
  2928.     });
  2929. }
  2930. //function giveDiscovery(id){
  2931. //     $.ajax({
  2932. //        url: "/do/Discovery",
  2933. //        type: "POST",
  2934. //        data: 'id_discovery='+id,
  2935. //        success: function (response) {
  2936.   //          response = JSON.parse(response);
  2937.   //          Game.notifications.main(response["html"], response["error"]);
  2938.     //      if(response["error"] == 'success'){
  2939.     //          $('.CraftContent').html('<div class="discovery"><span>'+response['prize']+'</span></div>');
  2940.     //      }
  2941. //        }
  2942.   //  });
  2943. //}
  2944. function addAttacks(e,type,id,atkID){
  2945.     $('.GiveDiv').remove();
  2946.     if(type == 'open'){
  2947.         $.ajax({
  2948.             url: "/do/pokemonsAction",
  2949.             type: "POST",
  2950.             data: {
  2951.                     pokID: id,
  2952.                     attackID: atkID,
  2953.                     type: type
  2954.                 },
  2955.             success: function (response) {
  2956.                 response = JSON.parse(response);
  2957.                 if(response['error'] == 1){
  2958.                     Game.notifications.main(response['text'],'error');
  2959.                 }else{
  2960.                     var attacks = '';
  2961.                     $.each(response['attacks'], function(x,y){
  2962.                         var data = y.split(',');
  2963.             attacks += '<div class="Move"><div class="PlusAtk" onclick=\'addAttacks('+data[2]+',"add",'+data[1]+','+x+');\'><i class="fa fa-plus"></i></div><img src="/img/world/typs/'+data[3]+'.png" onclick="viewDescriptionAttak(this,'+data[6]+');"><div class="MoveInfo"><div class="Name MoveCategory3">'+data[0]+'</div><div class="PP">'+data[4]+'/'+data[4]+' PP</div></div></div>';
  2964.                     });
  2965.                     var tpl = '<div class="GiveDiv">';
  2966.                     tpl+= '<div id="DivAbout">'+Lang.text_atk_learn+'</b></div>';
  2967.                     tpl+= '<div class="wrap"><div class="PokList">';
  2968.                     tpl+= attacks;
  2969.                     tpl+= '</div></div></div>';
  2970.                     $(tpl).appendTo('body');
  2971.                     var position = $(e).position();
  2972.                     var offset = $(e).offset();
  2973.                     var left = Math.round(offset.left+30);
  2974.                     var top = Math.round(offset.top-200);
  2975.                     $('.GiveDiv').css({
  2976.                         "left": left+'px',
  2977.                         "top": top+'px'
  2978.                     });
  2979.           $('.tooltip').hide();
  2980.                 }
  2981.             }
  2982.         });
  2983.  
  2984.     }else if(type == 'add'){
  2985.         $.ajax({
  2986.             url: "/do/pokemonsAction",
  2987.             type: "POST",
  2988.             data: {
  2989.                     positionAtk: e,
  2990.                     pokID: id,
  2991.                     attackID: atkID,
  2992.                     type: type
  2993.                 },
  2994.             success: function (response) {
  2995.                 response = JSON.parse(response);
  2996.                 response['error'] == 1 ? Game.notifications.main(response['text'],'error') : Game.notifications.main(response['text'],'success');
  2997.                 Game.modals.pokemons();
  2998.             }
  2999.         });
  3000.     }
  3001. }
  3002. function policeNPC(){
  3003.     var subject = $('#subjectPolice').val();
  3004.     var text = $('#textPolice').val();
  3005.         $.ajax({
  3006.             url: "/do/Npc/jess",
  3007.             type: "POST",
  3008.             data: {
  3009.                 subject: subject,
  3010.                 text: text
  3011.             },
  3012.             success: function (response) {
  3013.                 response = JSON.parse(response);
  3014.                 response['error'] == 1 ? Game.notifications.main(response['text'],'error') : Game.notifications.main(response['text'],'success');
  3015.             }
  3016.         });
  3017. }
  3018. function upgradeClan(type){
  3019.     if(type == 'goLeaderClan'){
  3020.         var a = $("#goLeaderClan").val();
  3021.     }else if(type == 'goUnleaderClan'){
  3022.         var a = $("#goUnleaderClan").val();
  3023.     }else if(type == 'goDeleteClan'){
  3024.         var a = $("#goDeleteClan").val();
  3025.     }else if(type == 'goStatusClan'){
  3026.         var a = $("#goStatusClanLogin").val(),
  3027.             b = $("#goStatusClanText").val();
  3028.     }else if(type == 'goNotifyClan'){
  3029.         var a = $("#goNotifyClan").val();
  3030.     }
  3031.     $.ajax({
  3032.         url: "/do/clanAction",
  3033.         type: "POST",
  3034.         data: 'object='+type+'&name='+a+'&other='+b,
  3035.         success: function (response) {
  3036.             response = JSON.parse(response);
  3037.             Game.notifications.main(response["text"], response["error"]);
  3038.         }
  3039.     });
  3040. }
  3041. function openClanCard(id){
  3042.     id = parseInt(id);
  3043.     if($('.mudol').length){
  3044.         $('.mudol').remove();
  3045.     }
  3046.     $.ajax({
  3047.         url: "/do/modal",
  3048.         type: "POST",
  3049.         data: 'id='+id+'&type=clanCard',
  3050.         beforeSend: function(){
  3051.             $('.Modal').remove();
  3052.             $('<div />', {
  3053.                     'class':'mudol'
  3054.                 }).prependTo('body');
  3055.            $('.mudol').html('<center>'+mainLoader+'</center>');
  3056.         },
  3057.         success: function (response) {
  3058.             response = JSON.parse(response);
  3059.             if(response['text']){
  3060.                 $('.mudol').remove();
  3061.                 return Game.notifications.main(response['text'],'error');
  3062.             }
  3063.             var info = JSON.parse(response['info']);
  3064.             var tpl = '', member = false, leader = false;
  3065.             tpl+='<div class="Header">'+Lang.text_clancard+'<div class="Close" onclick=$(".mudol").hide();><i class="fa fa-close"></i></div></div>';
  3066.  
  3067.       tpl+='<div class="Content">';
  3068.  
  3069.       tpl+='<div class="Clancard">';
  3070.  
  3071.       tpl+='<div class="LeftClan">';
  3072.  
  3073.       tpl+='<div class="ClanName"><img src="/img/world/clans/'+id+'.png"><span>'+info['name']+'</span></div>';
  3074.       tpl+='<div class="ClanAbout">'+info['description']+'</div>';
  3075.  
  3076.       tpl+='<div class="ClanMembers">';
  3077.       tpl+='<span>Участники</span>';
  3078.       tpl+='<div class="MembersList">';
  3079.       $.each(response['users'], function(x,y){
  3080.                 var data = y.split(',');
  3081.                 var raiting = (data[2].indexOf('-') ? '<span class="plus">'+data[2]+'</span>' : '<span class="minus">'+data[2]+'</span>');
  3082.                 var classUser = (data[4] == 1 ? 'lead' : (data[4] == 2 ? 'moder' : ''));
  3083.                 tpl+='<div class="'+classUser+'"><div class="user-link"><div onclick="showUserTooltip('+x+')" class="Info-Link sexm"><i class="fa fa-info"></i></div> <div class="u-'+data[1]+'">'+data[0]+'</div></div> <div class="zvan">'+data[3]+'</div> '+raiting+' '+(x == info['Creater'] ? '<div class="gl"></div>' : '')+'</div>';
  3084.                 leader = (data[5] == data[6] ? (data[7] == 1 ? true : false) : false),
  3085.                 member = (data[5] == data[6] ? true : false);
  3086.  
  3087.             });
  3088.       tpl+='</div>';
  3089.       tpl+='</div>';
  3090.  
  3091.       tpl+='</div>';
  3092.  
  3093.       tpl+='<div class="RightClan">';
  3094.  
  3095.       tpl+='<div class="ClanInfo">';
  3096.       tpl+='<div>'+info['dateCreate']+'<span>Создан</span></div>';
  3097.       tpl+='<div>'+response['position']+'<span>Позиция</span></div>';
  3098.       tpl+='<div>'+response['rating']+'<span>Рейтинг</span></div>';
  3099.       tpl+='<div>'+response['countUsers']+'<span>Участников</span></div>';
  3100.       tpl+='</div>';
  3101.       tpl+='<div class="ClanLog">';
  3102.       $.each(response['log'],function(x,y){
  3103.                 var data = JSON.parse(y['info']);
  3104.                 var clan_action;
  3105.                 if(y['type'] == 'ADD_CLAN_USER'){
  3106.                     clan_action = Lang.clan_user_entered;
  3107.                 }else if(y['type'] == 'ADD_CLAN_MONEY'){
  3108.                     clan_action = (member == true ? Lang.clan_user_add_money+' <b>'+data['count']+'</b> '+Lang.currency_money : true);
  3109.                 }else if(y['type'] == 'TAKE_CLAN_MONEY'){
  3110.                     clan_action = (member == true ? Lang.clan_user_take_money+' <b>'+data['count']+'</b> '+Lang.currency_money : true);
  3111.                 }else if(y['type'] == 'CLAN_CREATE'){
  3112.                     clan_action = Lang.clan_user_create;
  3113.                 }else if(y['type'] == 'ADD_CLAN_STATUS'){
  3114.                     clan_action = Lang.clan_user_status+' <b>'+data['status']+'</b>';
  3115.                 }else if(y['type'] == 'ADD_CLAN_NOTICE'){
  3116.                     clan_action = (member == true ? Lang.clan_user_notify+' <b>'+data['notice']+'</b>' : true);
  3117.                 }else if(y['type'] == 'ADD_CLAN_ADMIN'){
  3118.                     clan_action = Lang.clan_user_leader;
  3119.                 }else if(y['type'] == 'DELETE_CLAN_ADMIN'){
  3120.                     clan_action = Lang.clan_user_unleader;
  3121.                 }else if(y['type'] == 'LEFT_CLAN'){
  3122.                     clan_action = Lang.clan_user_leave;
  3123.                 }else if(y['type'] == 'LEFT_CLAN_ALERT'){
  3124.                     clan_action = Lang.clan_user_excluded;
  3125.                 }else if(y['type'] == 'ABOUT_CLAN_ALERT'){
  3126.                     clan_action = Lang.clan_user_clan_status;
  3127.                 }
  3128.                 if(clan_action == true){
  3129.                     tpl+='';
  3130.                 }else{
  3131.                     tpl+='<div><div class="time">'+data['date']+'</div> <div class="user-link"><div class="u-'+data['user_group']+'">'+data['user_new']+'</div></div> <span>'+clan_action+'</span></div>';
  3132.                 }
  3133.             });
  3134.       tpl+='</div>';
  3135.  
  3136.       tpl+='</div>';
  3137.  
  3138.       tpl+='<div class="ClanBot">';
  3139.  
  3140.       tpl+='<div class="LeftBotClan"><span>Контролирует локацию</span><div>-</div></div>';
  3141.       if(member == true){
  3142.         tpl+='<div class="RightBotClan">';
  3143.         if(leader == true){
  3144.                     tpl+='<div class="BtnLeadClan" onclick="openClanControl('+id+')">Управление</div>';
  3145.                 }
  3146.         tpl+='<div class="BtnLeavClan" onclick=actionClan("left");>'+Lang.button_clan_leave+'</div>';
  3147.         tpl+='<div class="MoneyClan">';
  3148.         tpl+='Монета (<b>'+info['Money']+'</b> шт.)<input id="countMoney" style="display:none;"><div class="BtnMoneyClan" id="addMoney" onclick=actionClan("openMoney");>Пополнить</div> <div class="BtnMoneyClan" id="getMoney" onclick=actionClan("addMoneys");>Вывести</div>';
  3149.         tpl+='</div>';
  3150.         tpl+='</div>';
  3151.             }
  3152.  
  3153.       tpl+='</div>';
  3154.  
  3155.       tpl+='</div>';
  3156.  
  3157.       tpl+='</div>';
  3158.  
  3159.             $('.mudol').html(tpl);
  3160.         }
  3161.     });
  3162. }
  3163. function openClanControl(id){
  3164.     id = parseInt(id);
  3165.     if($('.model').length){
  3166.         $('.model').remove();
  3167.     }
  3168.     $.ajax({
  3169.         url: "/do/modal",
  3170.         type: "POST",
  3171.         data: 'id='+id+'&type=clanCardControl',
  3172.         beforeSend: function(){
  3173.             $('<div />', {
  3174.                     'class':'model'
  3175.                 }).appendTo('body');
  3176.            $('.model').html('<center>'+mainLoader+'</center>');
  3177.         },
  3178.         success: function (response) {
  3179.             response = JSON.parse(response);
  3180.             $('.model').html(response['html']);
  3181.             $('.model').draggabilly({
  3182.                 handle: '.header',
  3183.                 containment: true
  3184.             });
  3185.         }
  3186.     });
  3187. }
  3188. function actionClan(obj){
  3189.     obj = [obj];
  3190.     if(obj == 'openMoney'){
  3191.         $('#addMoney').hide();
  3192.         $('#countMoney').show();
  3193.         $('#getMoney').replaceWith('<input type="button" class="btnA" value="'+Lang.button_clan_add_money+'" onclick=\'actionClan("addMoney");\'>');
  3194.         return false;
  3195.     }else if(obj == 'addMoneys'){
  3196.         $('#addMoney').hide();
  3197.         $('#countMoney').show();
  3198.         $('#getMoney').replaceWith('<input type="button" class="btnA" value="'+Lang.text_get+'" onclick=\'actionClan("minusMoney");\'>');
  3199.         return false;
  3200.     }else if(obj == 'minusMoney'){
  3201.         var count = (/[^[0-9]/.test($("#countMoney").val()) || $("#countMoney").val() < 0 ? null : parseInt($("#countMoney").val()));
  3202.         if(count == null){
  3203.             return false;
  3204.         }
  3205.         obj = obj+','+count;
  3206.     }else if(obj == 'addMoney'){
  3207.         var count = (/[^[0-9]/.test($("#countMoney").val()) || $("#countMoney").val() < 0 ? null : parseInt($("#countMoney").val()));
  3208.         if(count == null){
  3209.             return false;
  3210.         }
  3211.         obj = obj+','+count;
  3212.     }else if(obj == 'clanAbout'){
  3213.         var count = $("#clanAbout").val();
  3214.         if(count == null){
  3215.             return false;
  3216.         }
  3217.         obj = obj+','+count;
  3218.     }
  3219.     $.ajax({
  3220.         url: "/do/clanAction",
  3221.         type: "POST",
  3222.         data: 'object='+obj,
  3223.         success: function (response) {
  3224.             response = JSON.parse(response);
  3225.       if(response['error'] == 1) {
  3226.         Game.notifications.main(response['text'],'error');
  3227.       }else{
  3228.         Game.notifications.main(response['text'],'success');
  3229.       }
  3230.             if(response['action'] == 'updateClan'){
  3231.                 openClanCard(response['id']);
  3232.             }
  3233.         }
  3234.     });
  3235. }
  3236. function clanAdmin(type,id){
  3237.     $.ajax({
  3238.         url: "/do/clanAction",
  3239.         type: "POST",
  3240.         data: 'object='+type+'&name='+id,
  3241.         success: function (response) {
  3242.             response = JSON.parse(response);
  3243.             response['error'] == 1 ? Game.notifications.main(response['text'],'error') : Game.notifications.main(response['text'],'success');
  3244.         }
  3245.     });
  3246. }
  3247. function craftCategory(type,id_isset=false,e){
  3248.     if(id_isset){
  3249.         $.ajax({
  3250.             url: "/do/Craft",
  3251.             type: "POST",
  3252.             data: "category="+type,
  3253.             beforeSend: function(){
  3254.                 $('.CraftItemNow').html('<center>'+mainLoader+'</center>');
  3255.             },
  3256.             success: function (response) {
  3257.                 response = JSON.parse(response);
  3258.                 $('.CraftItemNow').html(response["html"]);
  3259.             }
  3260.         });
  3261.     }else{
  3262.         $('.CraftCategory .Button').removeClass('active');
  3263.         $('.'+type+'').addClass('active');
  3264.         $.ajax({
  3265.             url: "/do/Craft",
  3266.             type: "POST",
  3267.             data: "category="+type,
  3268.             beforeSend: function(){
  3269.                 $('.CraftContent').html('<center>'+mainLoader+'</center>');
  3270.             },
  3271.             success: function (response) {
  3272.                 response = JSON.parse(response);
  3273.                 $('.CraftContent').html(response["html"]);
  3274.             }
  3275.         });
  3276.     }
  3277. }
  3278. //function discoveryCategory(type,e){
  3279. //  $('.ctgCraft').removeClass('active');
  3280.     //$('.'+type+'').addClass('active');
  3281.     //$.ajax({
  3282.     //  url: "/do/Discovery",
  3283.     //  type: "POST",
  3284.     //  data: "category="+type,
  3285.     //  beforeSend: function(){
  3286.     //      $('.CraftContent').html('<center>'+mainLoader+'</center>');
  3287.     //  },
  3288.     //  success: function (response) {
  3289.     //      response = JSON.parse(response);
  3290.     //      $('.CraftContent').html(response["html"]);
  3291.     //  }
  3292.     //});
  3293. //}
  3294. function craftItem(id){
  3295.     var count = $('#CountCraft').val();
  3296.     $.ajax({
  3297.         url: "/do/CraftItems",
  3298.         type: "POST",
  3299.         data: "item="+id+"&count="+count,
  3300.         beforeSend: function(){
  3301.             $('.CraftItemNow').html('<center>'+mainLoader+'</center>');
  3302.         },
  3303.         success: function (response) {
  3304.             response = JSON.parse(response);
  3305.             Game.notifications.main(response["html"], response["error"]);
  3306.       if(response['plus']) {
  3307.         Game.notifications.main(response["plus"], 'plus');
  3308.       }
  3309.       if(response['minus']) {
  3310.         Game.notifications.main(response["minus"], 'minus');
  3311.       }
  3312.             $('.CraftItemNow').html('');
  3313.         }
  3314.     });
  3315. }
  3316. function rand(min, max){
  3317.       var r = Math.random() * (max - min) + min;
  3318.       return r;
  3319. }
  3320. function scrollGift(response){
  3321.     var gift_width  = $('.gifts .innerGift').outerHeight();
  3322.  
  3323.     $('<li />', {'html': '<img src="/img/world/items/little/'+response['id']+'.png">'}).appendTo('.innerGift');
  3324.         $('.innerGift li:first').animate({
  3325.                                 'marginTop':'-'+(gift_width+10)+'px'
  3326.                             }, rand(8000,12000)).queue(function(){
  3327.                     $('.goRoll').html('<p style="color: #0e39b9c7;"><b>Вы получили: '+response['name']+' ('+response['count']+' шт.)</b></p>');
  3328.                     Game.notifications.main('<img src="img/world/items/little/'+response['id']+'.png" class="item"> '+response['name']+' ('+response['count']+' шт.)','plus');
  3329.         });
  3330. }
  3331. function uploadImg() {
  3332.     var u = $('#upload_file #file_name').prop('files')[0];
  3333.     var s = new FormData();
  3334.     s.append('file', u);
  3335.     j = $('#upload_file').html();
  3336.     $.ajax({
  3337.         url: '/do/upload',
  3338.         dataType: 'text',
  3339.         cache: false,
  3340.         contentType: false,
  3341.         processData: false,
  3342.         data: s,
  3343.         type: 'POST',
  3344.         beforeSend: function() {
  3345.             $('#upload_file').html('<center><img height="40px" src="/img/loader/loader.gif"></center>');
  3346.         },
  3347.         success: function(n){
  3348.       $('#upload_file').html('');
  3349.             if(n==''){
  3350.         Game.notifications.main(Lang.success_load_file, "success");
  3351.             }else{
  3352.                 Game.notifications.main(n, "error");
  3353.                 $('#upload_file').html(j);
  3354.             }
  3355.         }
  3356.     });
  3357.     return false;
  3358. }
  3359. function settings() {
  3360.   $.ajax({
  3361.         url: "/do/trainers",
  3362.         type: "POST",
  3363.         data: "type=setting",
  3364.         success: function (response) {
  3365.             response = JSON.parse(response);
  3366.         $('.MiniModal').remove();
  3367.         $('<div />', {
  3368.           "class": 'MiniModal',
  3369.           html: function() {
  3370.             var snd = (response['sound'] == 0 ? 'Включить' : 'Выключить'),
  3371.                 team = (response['team'] == 0 ? 'Открыть' : 'Закрыть'),
  3372.                 tpl = '';
  3373.             tpl += '<div class="Name" id="drgMini">Настройки профиля</div>';
  3374.             tpl += '<div class="Content">';
  3375.             tpl += '<div class="Settings">';
  3376.             tpl += '<div class="Step">';
  3377.             tpl += '<div class="Name">Смена пароля</div>';
  3378.             tpl += '<input type="password" id="oldPass" placeholder="Старый пароль">';
  3379.             tpl += '<input type="password" id="newPass" placeholder="Новый пароль">';
  3380.             tpl += '<input type="password" id="dblNewPass" placeholder="Новый пароль еще раз">';
  3381.             tpl += '<div class="Button" onclick=Aqua.users.edit.redact("pass")>Применить</div>';
  3382.             tpl += '</div>';
  3383.             tpl += '<div class="Step">';
  3384.             tpl += '<div class="Name">Звуковые оповещения</div>';
  3385.             tpl += '<div class="Button" onclick=Aqua.users.edit.redact("audio",'+response['soundTwo']+')>'+snd+'</div>';
  3386.             tpl += '</div>';
  3387.             tpl += '<div class="Step">';
  3388.             tpl += '<div class="Name">Команда покемонов в тренеркарте</div>';
  3389.             tpl += '<div class="Button" onclick=Aqua.users.edit.redact("team",'+response['team']+')>'+team+'</div>';
  3390.             tpl += '</div>';
  3391.             tpl += '<div class="Step">';
  3392.             tpl += '<div class="Name">Цвет текста в чате</div>';
  3393.             tpl += '<div class="Color" onclick=Aqua.users.edit.redact("color",1) style="background: #d1d1d1;"></div><div class="Color" onclick=Aqua.users.edit.redact("color",2) style="background: #923838;"></div><div class="Color" onclick=Aqua.users.edit.redact("color",3) style="background: #257b34;"></div><div class="Color" onclick=Aqua.users.edit.redact("color",4) style="background: #252b7b;"></div><div class="Color" onclick=Aqua.users.edit.redact("color",5) style="background: #891f85;"></div><div class="Color" onclick=Aqua.users.edit.redact("color",6) style="background: #896520;"></div>';
  3394.             tpl += '</div>';
  3395.             tpl += '<div class="Step">';
  3396.             tpl += '<div class="Name">Изменить аватарку</div>';
  3397.             tpl += '<form enctype="multipart/form-data" action="do/upload" method="post" id="upload_file" name="MAX_FILE_SIZE" value="1"><input type="file" name="file_name" id="file_name"/></form><div class="Button" onclick=uploadImg();>Сохранить</div>';
  3398.             tpl += '</div>';
  3399.             tpl += '</div>';
  3400.             tpl += '</div>';
  3401.             return tpl;
  3402.           }
  3403.         }).appendTo('body');
  3404.         $('.MiniModal').draggabilly({
  3405.           handle: '#drgMini',
  3406.           containment: true
  3407.         });
  3408.         }
  3409.     });
  3410. }
Add Comment
Please, Sign In to add comment