Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 用 Chrome 在开箱页面按 F12,然后粘贴以下所有代码,再按正常方式点击开箱
- // 以下代码是原网页代码,经过一些删改,去除了开箱请求和实际开箱结果,点击开箱按钮之后不会花费余额
- $('.but-open').off("click").click(function () {
- // 所开箱子类型和价格
- currentCase = 'random-awp';
- currentCasePrice = 4.99;
- // 枪的型号、稀有度、图片等数据
- var data = {
- weapon: {
- firstname: "AWP",
- secondname: "Dragon Lore",
- stattrak: false,
- rarity: "covert",
- price: "1800",
- percent: 70,
- image: "-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpot621FAR17P7NdTRH-t26q4SZlvD7PYTQgXtu5cB1g_zMu9zw3g2yrkVtZ2r6IoSVdAU-ZVrY_lS6lb_ogsDqu57NmCQ27iJx53nD30vgUTXWscs"
- },
- success: true
- };
- var caseOpenAudio = new Audio();
- //caseOpenAudio.src = "/audio/open.wav";
- caseOpenAudio.src = "/content/audio/open.wav?lastupdate=24-06-2017-22-14-46";
- caseOpenAudio.volume = 0.5;
- var caseCloseAudio = new Audio();
- caseCloseAudio.src = "/content/audio/close.wav?lastupdate=24-06-2017-22-14-46";
- caseCloseAudio.volume = 0.2;
- var caseScrollAudio = new Audio();
- caseScrollAudio.src = "/content/audio/scroll.wav?lastupdate=24-06-2017-22-14-46";
- caseScrollAudio.volume = 0.2;
- var getImage = function(url, width, height, f)
- {
- f = typeof f !== 'undefined' ? f : false;
- if (url.indexOf('/') == 0) {
- return '/content' + url;
- } else {
- return '//steamcommunity-a.akamaihd.net/economy/image/' + url + '/' + width + 'fx' + height + (f ? 'f' : '') + '/';
- }
- }
- var casesCarusel = $('#casesCarusel');
- function fillCarusel2() {
- 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')
- {
- var arr = cases[currentCase].mul(20).shuffle();
- } else {
- var a1 = cases[currentCase].filter(function(weapon) { return weapon[2] == 'milspec' }).slice(0).mul(5).shuffle()
- var a2 = cases[currentCase].filter(function(weapon) { return weapon[2] == 'restricted' }).slice(0).mul(5).shuffle()
- var a3 = cases[currentCase].filter(function(weapon) { return weapon[2] == 'classified' }).slice(0).mul(4).shuffle()
- var a4 = cases[currentCase].filter(function(weapon) { return weapon[2] == 'covert' }).slice(0).mul(4).shuffle()
- var a5 = cases[currentCase].filter(function(weapon) { return weapon[2] == 'rare' }).slice(0).mul(2).shuffle()
- var arr = a1.concat(a2, a3, a4, a5).shuffle().shuffle().shuffle()
- }
- if (arr.length > 40) {
- arr = arr.slice(0, 40);
- }
- var el = '';
- arr.forEach(function(item, index) {
- var stattrak = "";
- el += '<div class="weaponblock weaponblock2 '+item[2]+'">'+
- '<img src="'+getImage(item[3], 125, 125, true)+'" />'+
- '<div class="weaponblockinfo"><span>'+getName(item[0])+'<br/>'+getName(item[1])+'</span></div>'+
- '</div>'
- })
- casesCarusel.css("transform", "translate(0px, 0px)");
- casesCarusel.html(el);
- }
- var el = ''
- cases[currentCase].forEach(function(item, index) {
- el += '<li class="weaponblock weaponblock1 '+item[2]+'">'+
- '<img src="'+getImage(item[3], 125, 125)+'" />'+
- '<div class="weaponblockinfo"><span>'+getName(item[0])+'<br/>'+getName(item[1])+'</span></div>'+
- '</li>'
- });
- console.log('Opening case check');
- if (openingCase) return;
- console.log('Opening case check done');
- openingCase = true;
- console.log('HTML data done');
- fillCarusel2();
- console.log('Carusel filling done');
- $('#scrollerContainer').addClass('hidden');
- $('.caseContainer').addClass('loading');
- $('#scrollerContainer').fadeIn();
- console.log('Containers updated');
- console.log('Running ajax...');
- console.log('Ajax done');
- $('.caseContainer').addClass('hidden');
- $('#scrollerContainer').removeClass('hidden');
- $('.svg-box').addClass('hidden');
- $('.case-arrow-class').hide();
- console.log('Containers updated (2)');
- if (data.success)
- {
- console.log('Data - success');
- console.log('Reaching goal');
- if (typeof yaCounter37343975 != 'undefined') {
- yaCounter37343975.reachGoal('open_case');
- }
- console.log('Pushing');
- //dataLayer.push({'Case': 'open'});
- //dataLayer.push({'event': 'case-popup-open', 'eventCategory' : 'one_case', 'eventAction' : 'open_js'});
- //goog_report_conversion ('');
- console.log('Reaching goal and pushing done');
- caseOpenAudio.play();
- console.log('Loading balance');
- load_balance();
- console.log('Load balance done');
- var weapon = data.weapon;
- last_weapon = weapon;
- var weaponName = weapon.firstname + ' | ' + weapon.secondname;
- //$('#casesCarusel > div:nth-child(30)').css('visibility', 'hidden');
- $('#casesCarusel > div:nth-child(30), #weaponBlock .recweap').removeClass('milspec restricted classified covert rare industrial consumer money').addClass(weapon.rarity);
- $('#casesCarusel > div:nth-child(30) .weaponblockinfo span').html((weapon.stattrak ? 'StatTrak™ ' : '') + weaponName.replace(' | ', '<br/>'))
- $('#casesCarusel > div:nth-child(30)').find('img').attr('src', getImage(weapon.image, 100, 100, true))
- $('#modal-drop .drop-img-wrap').toggleClass('stattrak', !!weapon.stattrak)
- $('#modal-drop .drop-name').text(weaponName)
- $('#modal-drop .drop-img').attr('src', getImage(weapon.image, 384, 384, true));
- $('#modal-drop .modal-drop-case').removeClass('milspec restricted classified covert rare industrial consumer money').addClass(weapon.rarity);
- $('#modal-drop .sell-for').text(weapon.price);
- $('#modal-drop .sell-for').parent().attr('onclick', 'sell_by_win_id(' + data.win_id + ', this); return false;');
- $('#modal-drop .sell-for').parent().attr('data-price', (weapon.price * weapon.percent / 100).toFixed(2));
- $('#modal-drop .sell-for').parent().attr('data-percent', (weapon.percent).toFixed(2));
- var weapon_width = $('#casesCarusel .weaponblock').eq(0)[0].clientWidth;
- carusel_width = $('#scrollerContainer')[0].clientWidth;
- carusel_width_2 = $('#aCanvas')[0].clientWidth;
- if (carusel_width_2 < carusel_width)
- {
- carusel_width = carusel_width_2;
- }
- full_spin = carusel_width / weapon_width;
- spins_count = 30 / full_spin;
- stop_interval = get_random_int(weapon_width * 0.1, weapon_width * 0.9);
- console.log('Params updated');
- caseScrollAudio.play();
- var a = $('#casesCarusel > div:nth-child(30)')[0].offsetLeft - 312.5 + stop_interval;
- socket.disconnect();
- var indexesSounded = [];
- console.log('Setting up interval');
- var interval = setInterval(function() {
- $('#casesCarusel > div').each(function(index, item) {
- if (indexesSounded[index]) { return; }
- if ($(item).position().left-6 <= $('#caruselLine')[0].offsetLeft) {
- //console.log($(item).position().left + ' VS ' + $('#caruselLine')[0].offsetLeft);
- indexesSounded[index] = true;
- caseScrollAudio.pause();
- caseScrollAudio.currentTime = 0;
- caseScrollAudio.play();
- }
- });
- }, 30);
- console.log('Starting transition');
- $('#casesCarusel').transition({ x: -1 * a}, {
- duration: 10000,
- easing: 'swing',
- complete: function() {
- clearInterval(interval);
- console.log('complete');
- openingCase = false;
- caseCloseAudio.play();
- setTimeout(function() {
- socket.connect();
- $('#modal-drop').modal('show');
- $('#scrollerContainer').addClass('hidden');
- $('.caseContainer').removeClass('loading').removeClass('hidden');
- $('.svg-box').removeClass('hidden');
- $('.case-arrow-class').fadeIn();
- }, 100);
- }
- });
- } else {
- openingCase = false;
- alert('undefined error (353)');
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement