Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.09 KB | None | 0 0
  1. // 用 Chrome 在开箱页面按 F12,然后粘贴以下所有代码,再按正常方式点击开箱
  2. // 以下代码是原网页代码,经过一些删改,去除了开箱请求和实际开箱结果,点击开箱按钮之后不会花费余额
  3.  
  4. $('.but-open').off("click").click(function () {
  5.  
  6. // 所开箱子类型和价格
  7. currentCase = 'random-awp';
  8. currentCasePrice = 4.99;
  9.  
  10. // 枪的型号、稀有度、图片等数据
  11. var data = {
  12. weapon: {
  13. firstname: "AWP",
  14. secondname: "Dragon Lore",
  15. stattrak: false,
  16. rarity: "covert",
  17. price: "1800",
  18. percent: 70,
  19. image: "-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpot621FAR17P7NdTRH-t26q4SZlvD7PYTQgXtu5cB1g_zMu9zw3g2yrkVtZ2r6IoSVdAU-ZVrY_lS6lb_ogsDqu57NmCQ27iJx53nD30vgUTXWscs"
  20. },
  21. success: true
  22. };
  23.  
  24. var caseOpenAudio = new Audio();
  25. //caseOpenAudio.src = "/audio/open.wav";
  26. caseOpenAudio.src = "/content/audio/open.wav?lastupdate=24-06-2017-22-14-46";
  27. caseOpenAudio.volume = 0.5;
  28.  
  29. var caseCloseAudio = new Audio();
  30. caseCloseAudio.src = "/content/audio/close.wav?lastupdate=24-06-2017-22-14-46";
  31. caseCloseAudio.volume = 0.2;
  32.  
  33. var caseScrollAudio = new Audio();
  34. caseScrollAudio.src = "/content/audio/scroll.wav?lastupdate=24-06-2017-22-14-46";
  35. caseScrollAudio.volume = 0.2;
  36.  
  37.  
  38.  
  39. var getImage = function(url, width, height, f)
  40. {
  41. f = typeof f !== 'undefined' ? f : false;
  42. if (url.indexOf('/') == 0) {
  43. return '/content' + url;
  44. } else {
  45. return '//steamcommunity-a.akamaihd.net/economy/image/' + url + '/' + width + 'fx' + height + (f ? 'f' : '') + '/';
  46. }
  47.  
  48. }
  49.  
  50. var casesCarusel = $('#casesCarusel');
  51.  
  52. function fillCarusel2() {
  53.  
  54. if (currentCase == 'random_knife' || currentCase == 'random_consumer' || currentCase == 'random_industrial' || currentCase == 'keys_and_cases' || currentCase == 'all_in' || currentCase == 'drakepoop_case' || currentCase == 'drakedick_case' || currentCase == 'lake' || currentCase == 'pank' || currentCase == 'cobblestone' || currentCase == 'dust2' || currentCase == 'italy' || currentCase == 'epic_case' || currentCase == 'bad_chicken' || currentCase == 'bomb_has_been_planted' || currentCase == 'bad_chicken_case' || currentCase == 'bomb_has_been_planted_new' || currentCase == 'easy_gloves' || currentCase == 'dragon_lore_case' || currentCase == 'cyrex_case' || currentCase == 'hyper_beast_case' || currentCase == 'asiimov_case')
  55. {
  56. var arr = cases[currentCase].mul(20).shuffle();
  57. } else {
  58. var a1 = cases[currentCase].filter(function(weapon) { return weapon[2] == 'milspec' }).slice(0).mul(5).shuffle()
  59. var a2 = cases[currentCase].filter(function(weapon) { return weapon[2] == 'restricted' }).slice(0).mul(5).shuffle()
  60. var a3 = cases[currentCase].filter(function(weapon) { return weapon[2] == 'classified' }).slice(0).mul(4).shuffle()
  61. var a4 = cases[currentCase].filter(function(weapon) { return weapon[2] == 'covert' }).slice(0).mul(4).shuffle()
  62. var a5 = cases[currentCase].filter(function(weapon) { return weapon[2] == 'rare' }).slice(0).mul(2).shuffle()
  63.  
  64.  
  65. var arr = a1.concat(a2, a3, a4, a5).shuffle().shuffle().shuffle()
  66. }
  67.  
  68. if (arr.length > 40) {
  69. arr = arr.slice(0, 40);
  70. }
  71.  
  72. var el = '';
  73.  
  74.  
  75. arr.forEach(function(item, index) {
  76. var stattrak = "";
  77.  
  78. el += '<div class="weaponblock weaponblock2 '+item[2]+'">'+
  79. '<img src="'+getImage(item[3], 125, 125, true)+'" />'+
  80. '<div class="weaponblockinfo"><span>'+getName(item[0])+'<br/>'+getName(item[1])+'</span></div>'+
  81. '</div>'
  82. })
  83. casesCarusel.css("transform", "translate(0px, 0px)");
  84. casesCarusel.html(el);
  85. }
  86.  
  87. var el = ''
  88. cases[currentCase].forEach(function(item, index) {
  89. el += '<li class="weaponblock weaponblock1 '+item[2]+'">'+
  90. '<img src="'+getImage(item[3], 125, 125)+'" />'+
  91. '<div class="weaponblockinfo"><span>'+getName(item[0])+'<br/>'+getName(item[1])+'</span></div>'+
  92. '</li>'
  93. });
  94.  
  95. console.log('Opening case check');
  96. if (openingCase) return;
  97. console.log('Opening case check done');
  98. openingCase = true;
  99. console.log('HTML data done');
  100. fillCarusel2();
  101. console.log('Carusel filling done');
  102. $('#scrollerContainer').addClass('hidden');
  103. $('.caseContainer').addClass('loading');
  104. $('#scrollerContainer').fadeIn();
  105.  
  106. console.log('Containers updated');
  107. console.log('Running ajax...');
  108. console.log('Ajax done');
  109. $('.caseContainer').addClass('hidden');
  110. $('#scrollerContainer').removeClass('hidden');
  111. $('.svg-box').addClass('hidden');
  112. $('.case-arrow-class').hide();
  113. console.log('Containers updated (2)');
  114. if (data.success)
  115. {
  116. console.log('Data - success');
  117.  
  118.  
  119. console.log('Reaching goal');
  120. if (typeof yaCounter37343975 != 'undefined') {
  121. yaCounter37343975.reachGoal('open_case');
  122. }
  123. console.log('Pushing');
  124. //dataLayer.push({'Case': 'open'});
  125. //dataLayer.push({'event': 'case-popup-open', 'eventCategory' : 'one_case', 'eventAction' : 'open_js'});
  126. //goog_report_conversion ('');
  127. console.log('Reaching goal and pushing done');
  128. caseOpenAudio.play();
  129. console.log('Loading balance');
  130. load_balance();
  131. console.log('Load balance done');
  132. var weapon = data.weapon;
  133. last_weapon = weapon;
  134. var weaponName = weapon.firstname + ' | ' + weapon.secondname;
  135. //$('#casesCarusel > div:nth-child(30)').css('visibility', 'hidden');
  136. $('#casesCarusel > div:nth-child(30), #weaponBlock .recweap').removeClass('milspec restricted classified covert rare industrial consumer money').addClass(weapon.rarity);
  137.  
  138. $('#casesCarusel > div:nth-child(30) .weaponblockinfo span').html((weapon.stattrak ? 'StatTrak™ ' : '') + weaponName.replace(' | ', '<br/>'))
  139. $('#casesCarusel > div:nth-child(30)').find('img').attr('src', getImage(weapon.image, 100, 100, true))
  140.  
  141.  
  142. $('#modal-drop .drop-img-wrap').toggleClass('stattrak', !!weapon.stattrak)
  143. $('#modal-drop .drop-name').text(weaponName)
  144. $('#modal-drop .drop-img').attr('src', getImage(weapon.image, 384, 384, true));
  145. $('#modal-drop .modal-drop-case').removeClass('milspec restricted classified covert rare industrial consumer money').addClass(weapon.rarity);
  146.  
  147. $('#modal-drop .sell-for').text(weapon.price);
  148. $('#modal-drop .sell-for').parent().attr('onclick', 'sell_by_win_id(' + data.win_id + ', this); return false;');
  149. $('#modal-drop .sell-for').parent().attr('data-price', (weapon.price * weapon.percent / 100).toFixed(2));
  150. $('#modal-drop .sell-for').parent().attr('data-percent', (weapon.percent).toFixed(2));
  151.  
  152.  
  153. var weapon_width = $('#casesCarusel .weaponblock').eq(0)[0].clientWidth;
  154.  
  155. carusel_width = $('#scrollerContainer')[0].clientWidth;
  156. carusel_width_2 = $('#aCanvas')[0].clientWidth;
  157.  
  158. if (carusel_width_2 < carusel_width)
  159. {
  160. carusel_width = carusel_width_2;
  161. }
  162.  
  163. full_spin = carusel_width / weapon_width;
  164. spins_count = 30 / full_spin;
  165.  
  166.  
  167. stop_interval = get_random_int(weapon_width * 0.1, weapon_width * 0.9);
  168. console.log('Params updated');
  169. caseScrollAudio.play();
  170.  
  171. var a = $('#casesCarusel > div:nth-child(30)')[0].offsetLeft - 312.5 + stop_interval;
  172.  
  173. socket.disconnect();
  174. var indexesSounded = [];
  175.  
  176. console.log('Setting up interval');
  177. var interval = setInterval(function() {
  178.  
  179. $('#casesCarusel > div').each(function(index, item) {
  180. if (indexesSounded[index]) { return; }
  181. if ($(item).position().left-6 <= $('#caruselLine')[0].offsetLeft) {
  182. //console.log($(item).position().left + ' VS ' + $('#caruselLine')[0].offsetLeft);
  183. indexesSounded[index] = true;
  184. caseScrollAudio.pause();
  185. caseScrollAudio.currentTime = 0;
  186. caseScrollAudio.play();
  187.  
  188. }
  189. });
  190. }, 30);
  191. console.log('Starting transition');
  192.  
  193. $('#casesCarusel').transition({ x: -1 * a}, {
  194. duration: 10000,
  195. easing: 'swing',
  196. complete: function() {
  197.  
  198. clearInterval(interval);
  199. console.log('complete');
  200. openingCase = false;
  201. caseCloseAudio.play();
  202.  
  203.  
  204. setTimeout(function() {
  205.  
  206. socket.connect();
  207. $('#modal-drop').modal('show');
  208. $('#scrollerContainer').addClass('hidden');
  209. $('.caseContainer').removeClass('loading').removeClass('hidden');
  210. $('.svg-box').removeClass('hidden');
  211. $('.case-arrow-class').fadeIn();
  212. }, 100);
  213. }
  214. });
  215. } else {
  216. openingCase = false;
  217. alert('undefined error (353)');
  218. }
  219. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement