case open (CS GO)

This is the place to post any code that you want to share with the community. Only completed scripts should be posted here.
Note: posts here are not necessarily endorsed by the community, and may represent amateur or even bad practices.

case open (CS GO)

Postby saberali04 » Mon Sep 05, 2016 11:47 pm

Code: Select all
import random
cases = {
    'wildfire' : {
        'blue' : ['Tec-9 | Jambiya', 'USP-S | Lead Conduit', 'SSG 08 | Necropos', 'Dual Berettas | Cartel', 'MAC-10 | Lapis Gator', 'PP-Bizon | Photic Zone'],
        'purple' : ['MAG-7 | Praetorian', 'FAMAS | Valence', 'Five-SeveN | Triumvirate', 'Glock-18 | Royal Legion'],
        'pink' : ['Desert Eagle | Kumicho Dragon', 'Nova | Hyper Beast', 'AWP | Elite Build'],
        'red' : ['AK-47 | Fuel Injector', 'M4A4 | The Battlestar'],
    'chroma 2' : {
        'blue' : ['AK-47 | Elite Build', 'MP7 | Armor Core', 'Desert Eagle | Bronze Deco', 'P250 | Valence', 'Sawed-Off | Origami'],
        'purple' : ['AWP | Worm God', 'MAG-7 | Heat', 'CZ75-Auto | Pole Position', 'UMP-45 | Grand Prix'],
        'pink' : ['Five-SeveN | Monkey Business', 'Galil AR | Eco', 'FAMAS | Dijinn'],
        'red' : ['M4A1-S | Hyper Beast', 'MAC-10 | Neon Rider'],
knives=['Karambit', 'Flip knife', 'M9 Bayonet', 'Bayonet', 'Flachion', 'Shaddow Daggers', 'Bowie Knife']
wear = ['battle scarred', 'well worn', 'field tested', 'minimal wear', 'factory new']
#First keys in dictionary are cases which can be selected by user
#The keys in cases dictionary are scaled from common to uncommon (top to bottom)
#Values in the cases dictionary are the skins.
case_keys = 10
chance1 = random.randint(1, 100)
#case_keys are used to open cases
print "Hello! Welcome to CS GO case lottery!"
print "Available cases: Wildfire, Chroma 2"
print "Winning a purple skin gives you 1 additional key!"
print "Winning a pink skin gives you 3 additional keys!"
print "Winning a red skin gives you 7 additional keys!"
print "Winning a knife gives you 15 additional keys!"
def skin_wear():
    return x
while case_keys >0:
    resp=raw_input("Which case would you like to open? ")
    for i in cases:
        if resp.lower() == i:
            case_keys -= 1
            colours= cases[i].values()
            skin_rarity = cases[i].keys()
            chance = random.randint(1, 100)
            for x, y in enumerate([25, 10, 5, 2]):
                if chance >=y:
                    skin = random.choice(colours[x])
                    skin_colour = skin_rarity[x]               
                    print "You've won a %s (%s) (%s skin)" % (skin, skin_wear(), skin_colour)
                    print "With a chance of %s" % chance
                    if skin_colour == 'purple':
                        case_keys += 1
                    elif skin_colour == 'pink':
                        case_keys += 3
                    elif skin_colour == 'red':
                        case_keys += 7
                    print "Keys left: %s" % case_keys
                elif chance ==1:
                    print "You've won a %s, Congratulations!" % random.choice(knives)
                    print "With a chance of %s" % chance
                    print "Nice! 15 more keys!"
                    case_keys += 15
                    print "Keys left: %s" % case_keys

    if resp.lower() != i:
        print "Please see list for cases"
    print "You've run out of keys"

Two cases are available you can add more if you like.
Tested and works with python 2.6
Posts: 12
Joined: Thu Aug 11, 2016 1:52 am

Return to Completed Scripts

Who is online

Users browsing this forum: No registered users and 1 guest