shashumga 3000

shashumga 3000 buff autobuy

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         shashumga 3000
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  shashumga 3000 buff autobuy
// @author       You
// @match        https://buff.163.com/goods/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=163.com
// @grant        none
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/axios.min.js
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    let amountBought = 0

    const req = (sell_order_id, goods_id, price) => {
        axios({
            method: 'post',
            url: 'https://buff.163.com/api/market/goods/buy',
            data: {
                "game":"csgo",
                "goods_id":goods_id,
                "sell_order_id":sell_order_id,
                "price":price,
                "pay_method":3,
                "allow_tradable_cooldown":0,
                "token":"",
                "cdkey_id":""
            },
            headers: {
                "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/116.0",
                "Accept": "application/json, text/javascript, */*; q=0.01",
                "Accept-Language": "pl,en-US;q=0.7,en;q=0.3",
                "Accept-Encoding": "gzip, deflate, br",
                "Content-Type": "application/json",
                "X-CSRFToken": localStorage.getItem("csrf"),
                "X-Requested-With": "XMLHttpRequest",
                "Origin": "https://buff.163.com",
                "Connection": "keep-alive",
                "Referer": `https://buff.163.com/goods/${goods_id}`,
                "Sec-Fetch-Dest": "empty",
                "Sec-Fetch-Mode": "cors",
                "Sec-Fetch-Site": "same-origin"
            },
            withCredentials: true // This ensures cookies are sent with the request
        })
            .then(response => {
            if(response.data.code === 'OK'){
                console.log(`%c${++amountBought}`, 'font-size: 40px; color: red');
            } else {
                console.log(`error: `, response.data)
            }
        })
            .catch(error => {
            console.error("Error sending request:", error);
        });
    }

    const autobuy = (newCsrf) => {
        newCsrf && localStorage.setItem("csrf", newCsrf)

        let timeout = 0
        document.querySelectorAll('.btn-buy-order').forEach((element) => {
            setTimeout(()=> {
                req(element.getAttribute('data-orderid'), element.getAttribute('data-goodsid'), element.getAttribute('data-price'))
            }, timeout)
            timeout += 750
        })
        setTimeout(()=> {
            location.reload()
        }, timeout + 2000)
    }

    window.autobuy = autobuy
})();