Advertisement
Danetty

MERCADO

Feb 19th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1. javascript:
  2. var ofertas = 0;
  3. var viagem = 10;
  4. var redirecionar = 1;
  5. /*
  6. * @author Insanidade
  7. * @update: moms1983
  8. */
  9. if (game_data.player.premium == false) {
  10. alert("Para utilizar esse script é necessário uma Conta Premium.");
  11. end();
  12. }
  13. if (typeof viagem === 'undefined')
  14. viagem = 10;
  15. var doc = document;
  16. if (window.frames.length > 0)
  17. doc = window.main.document;
  18. url = document.URL;
  19. var start = url.indexOf("village");
  20. var end = url.indexOf('&', start);
  21. var id;
  22. if (end > 0)
  23. id = url.substring(start, end);
  24. elseid = url.substring(start);
  25. if (url.indexOf('screen=market') == -1 || url.indexOf('mode=own_offer') == -1) {
  26. if (redirecionar == 0) {
  27. alert('Redirecionando para a página correta. \n Por favor, execute novamente o script.');
  28. }
  29.  
  30. location.search = '?screen=market&mode=own_offer&' + id;
  31. }
  32. else {
  33. var wood = parseInt($('span[id=wood]').html());
  34. var clay = parseInt($('span[id=stone]').html());
  35. var iron = parseInt($('span[id=iron]').html());
  36.  
  37. e = $('input[id=res_sell_wood]');
  38. e[e.length - 1].checked = wood > clay && wood > iron;
  39. e = $('input[id=res_sell_stone]');
  40. e[e.length - 1].checked = clay > wood && clay > iron;
  41. e = $('input[id=res_sell_iron]');
  42. e[e.length - 1].checked = iron > clay && iron > wood;
  43. e = $('input[id=res_buy_wood]');
  44. e[e.length - 1].checked = wood < clay && wood < iron;
  45. e = $('input[id=res_buy_stone]');
  46. e[e.length - 1].checked = clay < wood && clay < iron;
  47. e = $('input[id=res_buy_iron]');
  48. e[e.length - 1].checked = iron < clay && iron < wood;
  49. wood = Math.round(wood / 1000);
  50. clay = Math.round(clay / 1000);
  51. iron = Math.round(iron / 1000);
  52. offers = Math.max(Math.max(wood, clay), iron) - Math.min(Math.min(wood, clay), iron);
  53. offers = Math.round(offers / 2);
  54. $('input[value=Criar]').focus();
  55. $('input[name=multi]').val(ofertas > 0 ? ofertas : offers);
  56. $('input[name=max_time]').val(viagem);
  57. $('input[name=sell]:not([id$=Amount])').val(1000);
  58. $('input[name=buy]:not([id$=Amount])').val(1000);
  59. }
  60.  
  61. var max = Number($("#content_value th:contains('Quantidade')").text().split(": ")[1]);
  62.  
  63. if (Number($("input[name='sell']:not([id$=Amount])").val()) > max) {
  64. $("input[name='sell']:not([id$=Amount])").val(Number($("#content_value th:contains('Quantidade')").text().split(": ")[1]));
  65. $("input[name='buy']:not([id$=Amount])").val(Number($("#content_value th:contains('Quantidade')").text().split(": ")[1]));
  66. }
  67.  
  68. var qtd_vender = Number($("input[name='sell']:not([id$=Amount])").val());
  69.  
  70. if ((Number($("input[name='multi']").val()) * qtd_vender) > max)
  71. $("input[name='multi']").val(Math.floor(max / qtd_vender))
  72.  
  73. void(0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement