Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] Add a button to hide inventory cards #178

Open
darkdroider opened this issue Mar 29, 2023 · 1 comment
Open

[Suggestion] Add a button to hide inventory cards #178

darkdroider opened this issue Mar 29, 2023 · 1 comment

Comments

@darkdroider
Copy link

Add a button to hide inventory cards.
Some cards you reserve for crafting badges or for collecting, and don't want to sell them. It would be interesting to be able to hide them, in order to leave only the tradable cards showing. Thus facilitating, visualize and sell with the script.

@darkdroider darkdroider changed the title [Sugestion] Add a button to hide inventory cards [Suggestion] Add a button to hide inventory cards Apr 3, 2023
@disanyixing
Copy link

(function ($, async) {
    $.noConflict(true);

    var NotSellCard = {
        1: {//account1
            218410: true,
            619390: true,
            1186460: true,
            399120: true,
        },
        2: {//account2
            766280: true,
            548840: true,
        },
    }
    ……
})(jQuery, async);
function sellAllCards() {
    loadAllInventories().then(function () {
        var items = getInventoryItems();
        var filteredItems = [];

        items.forEach(function (item) {
            if (!getIsTradingCard(item) || !item.marketable) {
                return;
            }

            let str = item.description.market_hash_name;
            let index = str.indexOf('-');
            let gameid = str.slice(0, index);
            let result = {};
            let flag = 0;
            for (let key in NotSellCard) {
                result[key] = {};
                for (let subKey in NotSellCard[key]) {
                    if (subKey == gameid) {
                        flag = 1;
                    }
                }
            }

            if (flag == 1) {
                console.log('Do not sell ' + gameid + ' card.');
            } else {
                filteredItems.push(item);
            }
        });

        sellItems(filteredItems);
    }, function () {
        logDOM('Could not retrieve the inventory...');
    });
}

When the game ID in NotSellCard, you click 'Sell All Cards' button, which will not sell the game ID cards.

The above code will not sell all cards with game ID 218410,619390,1186460,399120,766280,548840.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants