Esempio n. 1
0
import gameLibFunctions
import cgi
cgitb.enable()

print '<!DOCTYPE html><html><head><title>Bits n Bolts</title></head><body>'

query = cgi.FieldStorage()
userName = query['ooser'].value
buttonThing = query['submit'].value

openString = 'dirOfAccounts/a' + userName + '.txt'
f = open(openString)
s = f.read()
f.close
gameLibFunctions.updateEnergy(openString)
pyDict = gameLibFunctions.getRecentDict(openString)

g = open('items.txt')
storeStuff = g.read()
g.close

storeStuff = storeStuff.strip()
storeStuff = storeStuff.split('\n')
titles = storeStuff[0].split(',')
store = storeStuff[1:]

storeDict = {}

for items in store:
    items = items.split(',')
    count = 0
Esempio n. 2
0
import cgi
cgitb.enable()

print '<!DOCTYPE html><html><head><title>The Mechanic</title></head><body background="http://thumbs.dreamstime.com/t/illustration-weights-fitness-cartoon-36813258.jpg">'

query = cgi.FieldStorage()

userName = query['ooser'].value

statString = 'dirOfAccounts/a' + userName + '.txt'
f = open(statString)
s = f.read()
f.close

gameLibFunctions.updateEnergy(statString)
pyDict = gameLibFunctions.getRecentDict(statString)

print '<img src="' + pyDict['robohashLink'] + '">'
print '<table border="1" bgcolor="white"><tr><th>Battery Life</th><td>' + pyDict[
    'energy'] + '</td></tr>'
print '<tr><th>AttackPwr</th><td>' + pyDict['attack'] + '</td></tr>'
print '<tr><th>Force Field Capacity</th><td>' + pyDict['defence'] + '</td></tr>'
print '<tr><th>Speed</th><td>' + pyDict['speed'] + '</td></tr>'
print '<tr><th>Bolts</th><td>' + pyDict['money'] + '</td></tr>'
print '<tr><th>Level</th><td>' + pyDict['level'] + '</td></tr>'
print '<tr><th>Armor/HP</th><td>' + pyDict['hp'] + '</td></tr>'
print '</table>'

print '<form action="planetfitness.py" method="POST">'
print '<input type="hidden" name="ooser" value="' + userName + '">'
print '<input type="submit" name="attackPlus" value="Upgrade torque (+AttackPwr)">'
Esempio n. 3
0
import cgi
import cgitb
import gameLibFunctions

cgitb.enable()

query = cgi.FieldStorage()
userName = query['ooser'].value

print '<!DOCTYPE html><head><title>Work</title></head><body style="background-color:#ffe6b3;">'

openstring = 'dirOfAccounts/a' + userName + '.txt'
openstring2 = 'secondaryDir/a' + userName + '.txt'

primaryDict = gameLibFunctions.getRecentDict(openstring)
secondaryDict = gameLibFunctions.getRecentDict(openstring2)

print 'The amount of money you have now is ' + primaryDict['money'] + '<br>'
print 'The amount of battery left in you is ' + primaryDict[
    'energy'] + '<br><br>'


def formJobMaker(buttonValue, energyCost, userName, moneyMade):
    print '<form action="work.py" method="GET">'
    print '<input type="hidden" name="ooser" value="' + userName + '">'
    print '<input type="submit" name="' + buttonValue + '" value="' + buttonValue + '">'
    print '<br>This job costs ' + str(energyCost) + ' energy to do' + '<br>'
    print 'This job will return ' + str(
        moneyMade) + ' bolts for your effort<br><br>'
    print '</form>'
Esempio n. 4
0
print 'content-type:text/html \n'
print '<!DOCTYPE html><html><head></head><body>'

import cgi
import cgitb
import os
import gameLibFunctions
import random

cgitb.enable()

query = cgi.FieldStorage()
userName = query['ooser'].value
enemy = query['Enemy'].value

userDict = gameLibFunctions.getRecentDict('dirOfAccounts/a' + userName +
                                          '.txt')
enemyDict = gameLibFunctions.getRecentDict('dirOfAccounts/a' + enemy + '.txt')

originUserDict = {}
for x in userDict:
    originUserDict[x] = userDict[x]

userDict.pop('robohashLink')
enemyDict.pop('robohashLink')

for x in userDict:
    userDict[x] = float(userDict[x])

for x in enemyDict:
    enemyDict[x] = float(enemyDict[x])
Esempio n. 5
0
import cgitb
import gameLibFunctions
import os

cgitb.enable()

query = cgi.FieldStorage()
userName = query['ooser'].value

openString = 'dirOfAccounts/a' + userName + '.txt'
f = open(openString)
s = f.read()
f.close()

gameLibFunctions.updateEnergy(openString)
pyDict = gameLibFunctions.getRecentDict(openString)

listOfFiles = os.listdir('dirOfAccounts')

#Removes archaic files from being processed
listNoOld = []
for x in listOfFiles:
    if x[0] == 'a':
        listNoOld.append(x)

listOfFilesWithAboutSameLevel = []

#shows players that are at less than 5 levels away
for x in listNoOld:
    subDict = gameLibFunctions.getRecentDict('dirOfAccounts/' + x)
    theLevel = subDict['level']
Esempio n. 6
0
import codeify
import gameLibFunctions
import os

cgitb.enable()

query = cgi.FieldStorage()
userName = query['ooser'].value
buttonTest = query['submit'].value

openString = 'dirOfAccounts/a' + userName + '.txt'
f = open(openString)
s = f.read()
f.close()

pyDict = gameLibFunctions.getRecentDict(openString)

print '<img src="' + pyDict['robohashLink'] + '">'
print '<br><b>' + 'Battery:' + pyDict['energy']
print '<br>' + 'Bolts:' + pyDict['money'] + '</b>'
print '<center><h1 style="position:absolute;top:0;background-color:#80dfff;"> Welcome to Robotville ' + userName + ' </h1></center>'
print '<form action="game.py" method="POST">'
print '<input type="hidden" name="ooser" value="' + userName + '"/>'
print '<input type="submit" name="home" value="Head home"/></form>'
print '<form action="arena.py" method="POST">'
print '<input type = "hidden" name ="ooser" value="' + userName + '"/>'
print '<input type="submit" name="arena" value="Head to the arena"/></form>'
print '<form action="planetfitness.py" method="POST">'
print '<input type = "hidden" name = "ooser" value="' + userName + '"/>'
print '<input type = "submit" name ="submit" value="head to the gym"></form>'
print '<form action="school.py" ethod="POST">'
Esempio n. 7
0
f = open('dirOfAccounts/' + 'a' + userName + '.txt')
r = f.read()
r = r.strip()
f.close()
gameLibFunctions.updateEnergy('dirOfAccounts/' + 'a' + userName + '.txt')
r = r.split('\n')
pyDict = {}

lastLogin = r[len(r) - 1]
lastLogin = lastLogin.split(',')
titles = r[0]
titles = titles.split(',')
counter = 0

secondaryDict = gameLibFunctions.getRecentDict('secondaryDir/a' + userName +
                                               '.txt')

for something in titles:
    pyDict[something] = lastLogin[counter]
    counter += 1

print '<center>'
print '<img src="' + pyDict['robohashLink'] + '">'
print '<table border="1" bgcolor="#a9e788" ><tr><th>Battery Life</th><td>' + pyDict[
    'energy'] + '</td></tr>'
print '<tr><th>AttackPwr</th><td>' + pyDict['attack'] + '</td></tr>'
print '<tr><th>Force Field Capacity</th><td>' + pyDict['defence'] + '</td></tr>'
print '<tr><th>Speed</th><td>' + pyDict['speed'] + '</td><tr>'
print '<tr><th>Bolts</th><td>' + pyDict['money'] + '</td></tr>'
print '<tr><th>Level</th><td>' + pyDict['level'] + '</td></tr>'
print '<tr><th>Armor/HP</th><td>' + pyDict['hp'] + '</td></tr>'