Beispiel #1
0
def main(args): #if swag == over.9000:
    """The program entry point."""
    with open(sharedVars.ppPath, "r") as ppFile: #open pp
        ppJson = json.load(ppFile) #reading them json
    if sharedVars.username in ppJson: #is this motherfucked registered
        with open(sharedVars.inventoryPath, "r") as inventoryFile:
            invJson = json.load(inventoryFile)
    if args:

        if args[0] == "help":
            ppHelp.helpText() #sick 360 camelCase
        if args[0] == "aon":

                maxrange = 33
                if sharedVars.username in invJson:
                    if "5%ext" in invJson[sharedVars.username]:
                        maxrange += 5
                    if "5%ext2" in invJson[sharedVars.username]:
                        maxrange += 5
                aon = random.randint(1,100)
                if aon in range(1,maxrange):
                    newPp = ppJson[sharedVars.username] + ppJson[sharedVars.username]
                else:
                    newPp = 0
                if newPp > ppJson[sharedVars.username]:
                    ppDiff = str(newPp - ppJson[sharedVars.username])
                    print sharedVars.alias + " has gained " + ppDiff + "pp.",
                else:
                    ppDiff = str(ppJson[sharedVars.username] - newPp)
                    print sharedVars.alias + " has lost " + ppDiff + "pp.",
                with open(sharedVars.ppPath, "w") as ppFile:
                    ppJson[sharedVars.username] = newPp
                    json.dump(ppJson,ppFile,indent=1)

    else:
        with open(sharedVars.ppPath, "r") as ppFile: #open pp
            ppJson = json.load(ppFile)
        if sharedVars.username in ppJson:
            if sharedVars.username in invJson:
                nofail = "nofail" in invJson[sharedVars.username]
            else:
                nofail = False

            roll(ppJson, nofail)
            if sharedVars.username in invJson:
                if "double_roll" in invJson[sharedVars.username] and not nofail:
                    roll(ppJson, nofail)

        else:
            ppHelp.register(sharedVars.username, ppJson)
Beispiel #2
0
def main(args):  # define main program body
    """The program entry point."""

    if args:
        if args[0] == "help":
            ppHelp.helpText()
        elif len(args) == 2:
            target = args[1]
            amount = int(args[0])
            with open(sharedVars.ppPath, "r") as ppFile:  # open pp
                ppJson = json.load(ppFile)
            if sharedVars.username in ppJson:
                if target in ppJson:
                    if ppJson[sharedVars.username] >= sharedVars.boostCost + amount:
                        ppJson[sharedVars.username] = (ppJson[sharedVars.username] - sharedVars.boostCost) - amount
                        ppJson[target] = ppJson[target] + amount
                        with open(sharedVars.ppPath, "w") as ppFile:
                            json.dump(ppJson, ppFile, indent=1)
                        print "{} has given {} {}pp!".format(sharedVars.alias, target, amount)
                    else:
                        print "Sorry, you can't afford that! (Remember this service costs {} extra pp to use.)".format(
                            sharedVars.boostCost
                        )
                else:
                    print "Sorry, the target is not registered."
            else:
                ppHelp.register(sharedVars.username, ppJson)

        else:
            ppHelp.helpText()
    else:
        ppHelp.helpText()
Beispiel #3
0
def main(args): #define main program body
	with open(sharedVars.ppPath, "r") as ppFile:
		ppJson = json.load(ppFile)
	if args:
		if args[0] in ppJson:
			print "{} has {} pp.".format(args[0], ppJson[args[0]])
		else:
			ppHelp.helpText()
	else:
		if sharedVars.username in ppJson:
			if ppJson[sharedVars.username] >= 0 and ppJson[sharedVars.username] < 200:
				print "You (" + sharedVars.alias + ") have only " + str(ppJson[sharedVars.username]) + "pp. What a scrublord." #show it to the user
			if ppJson[sharedVars.username] >= 200 and ppJson[sharedVars.username] < 600:
				print "You (" + sharedVars.alias + ") have " + str(ppJson[sharedVars.username]) + "pp. Not so bad, but still bad." #show it to the user
			if ppJson[sharedVars.username] >= 600 and ppJson[sharedVars.username] < 1000:
				print "You (" + sharedVars.alias + ") have " + str(ppJson[sharedVars.username]) + "pp. You're decent!" #show it to the user
			if ppJson[sharedVars.username] >= 1000 and ppJson[sharedVars.username] < 3000:
				print "Wow! You (" + sharedVars.alias + ") have a whopping amount of " + str(ppJson[sharedVars.username]) + "pp! Noice!" #show it to the user
			if ppJson[sharedVars.username] >= 3000:
				print "Incredible! You (" + sharedVars.alias + ") have " + str(ppJson[sharedVars.username]) + "pp. New cokiez confirmed xd" #show it to the user
		else:
			ppHelp.register(sharedVars.username, ppJson)
Beispiel #4
0
def main(args): #if swag == over.9000:
	"""The program entry point."""
	if args:
		with open(sharedVars.shopPath, "r") as shopFile: #open shop
			shopJson = json.load(shopFile)
		with open(sharedVars.ppPath, "r") as ppFile:
			ppJson = json.load(ppFile)
		with open(sharedVars.inventoryPath, "r") as inventoryFile:
			invJson = json.load(inventoryFile)
		if sharedVars.username in invJson:
			if args[0] == "help":
				ppHelp.helpText() #sick 360 camelCase
			elif args[0] == "list":
				i = 0
				willPrint = "List of shop items: \n"
				for entry in shopJson:
					i += 1
					willPrint = willPrint + entry +": {} Cost: {}pp \n".format(shopJson[entry]["description"],shopJson[entry]["price"])
				print willPrint
			elif args[0] == "buy":
				if args[1] in shopJson:
					item = args[1]
					if ppJson[sharedVars.username] >= shopJson[item]["price"]:
						if item not in invJson[sharedVars.username]:
							ppJson[sharedVars.username] -= shopJson[args[1]]["price"]
							invJson[sharedVars.username][item] = 1
							print "Purchase complete."
							saveChanges(ppJson,invJson)
						else: print "You already have this item."
					else: print "You can't afford this."
				else: print "Item not found."
				
			elif args[0] == "sell":
				if args[1] in shopJson:
					if args[1] in invJson[sharedVars.username]:
						del invJson[sharedVars.username][args[1]]
						print "Sold {}.".format(args[1])
						saveChanges(ppJson,invJson)
					else:
						print "You don't have this item."
				else:
					print "Check your spelling."
					
			elif args[0] == "inventory":
				i = 0
				willPrint = "Stuff in your inventory: \n"
				for item in invJson[sharedVars.username]:
					i += 1
					willPrint = willPrint + item +"\n"
				print willPrint
			else:
				ppHelp.helpText()
				
		else:
			invJson[sharedVars.username] = {}
			saveChanges(ppJson, invJson)
			main(args)
	else: ppHelp.helpText()