Skip to content

Helyux/cs2pattern

Repository files navigation

Contributors Forks Stargazers Issues Downloads GPLv3 License

cs2pattern

Overview

cs2pattern is a python package used to identify different rare pattern from counter-strike skins given a pattern number.

Installation

pip install cs2pattern

Usage

Quick start

To check if your skin has a rare pattern:

from cs2pattern import check_rare

# Provide full item name and pattern number
result = check_rare("★ Karambit | Case Hardened (Factory New)", 269)
if result.rare:
    if result.ordered and result.order:
        rank, total = result.order
        print(f"Rare pattern: {result.name} (rank {rank}/{total})")
    else:
        print(f"Rare pattern: {result.name}")

#=> Rare pattern: gem_blue (rank 5/14)

Modular helpers

When you already know the skin family you care about, import the helper functions:

from cs2pattern import gem_black

patterns, ordered = gem_black("skeleton knife")
print(f"Patterns: {patterns} / Ordered: {ordered}")

#=> Patterns: [446, 791, 497, 28] / Ordered: True

Raw catalog access

Helper names match the pattern groups inside pattern.json, so you can discover what is available by calling get_pattern_dict() and inspecting the keys.

from cs2pattern import get_pattern_dict

catalog = get_pattern_dict()
scorched_ursus = catalog["scorched"]["ursus knife"][0]
print(scorched_ursus["pattern"])

#=> [446, 791]

Contributing

Contributions are welcome! Open an issue or submit a pull request.

License

GPLv3 License. See the LICENSE file for details.

About

Pattern utility for CS2 items

Topics

Resources

License

Stars

Watchers

Forks

Languages