Esempio n. 1
0
def get_game_room_json():
    DA= DataAccess()
    characters = DA.getGameCharacters(request.args.get('game_id', 0, type=str))
    game_owner = DA.getGameOwner(request.args.get('game_id', 0, type=str))
    user = request.args.get('user_id', 0, type=str)
    #print game_owner
    #print user
    charList = {}

    for char in characters:
        charList[char.id] = {}
        charList[char.id]['owner_id'] = char.user_id
        charList[char.id]['char_name'] = char.name
        charList[char.id]['char_id'] = char.id
        if user == char.user_id:
            charList[char.id]['can_edit'] = 'Y'
        else:
            charList[char.id]['can_edit'] = 'N'
        if user == game_owner:
            charList[char.id]['can_remove'] = 'Y'
        else:
            charList[char.id]['can_remove'] = 'N'

    return jsonify(charList)
Esempio n. 2
0
#DA.printFlaws()
#DA.printPerks()
#addDummyClientCharacter2()
#addDummyClientCharacter3()
#addDummyClientCharacter4()

for char in DA.getCharacters('*****@*****.**'):
    cchar = CDA.getClientCharacter(char.id)
    printClientCharacter(cchar)

print 'Game Stuff'
#DA.addGame('*****@*****.**', 'anotherWorkingGame')
DA.addCharacterToGame(7, 3)
DA.addCharacterToGame(7, 2)
DA.addCharacterToGame(7, 4)

#DA.removeCharacterFromGame(6, 4)
#DA.deleteGame(1)

for game in DA.getGames():
    print str(game.id) + ":" + game.name + " " + game.owner_id
    for char in DA.getGameCharacters(game.id):
        print char.name
 
#updateDummyClientCharacter4(4)
#CDA.deleteClientCharacter(1)