Beispiel #1
0
if __name__=="__main__":


    player = Player(nickname='Arseni', email='*****@*****.**', password='******')
    print("{}Information about the player.\n".format(player))
    player.save_to_db()
    print("{}Player was inserted to db.\n".format(player))


    admin = Admin(nickname='admin_arseni', email='*****@*****.**', password='******')
    print("{}Information about the player.\n".format(admin))
    admin.save_to_db()
    print("{}Admin was inserted to db.\n".format(admin))


    moderator = Moderator(nickname='moderator_arseni', email='*****@*****.**', password='******')
    print("{}Information about the player.\n".format(moderator))
    moderator.save_to_db()
    print("{}Moderator was inserted to db.\n".format(moderator))


    player_info = Player()
    player_info.load_from_db("*****@*****.**")
    print("{}Player was loaded from db.\n".format(player_info))


    player_changes = Player()
    player_changes.load_from_db("*****@*****.**")
    player_changes.nickname = "Lesha"
    player_changes.save_to_db()
    print("{}Player was updated in db.\n".format(player_changes))
       except SyntaxError:
           print '\n####################################\n' \
                 'You have typed  nothing.\n' \
                 'Try again or type 3 to exit...\n'

########################################################################################################################

   gold   = Money(code=GOLD,   amount=9999)
   silver = Money(code=SILVER, amount=99999)
   copper = Money(code=COPPER, amount=999999)

   admin_wallet = Wallet(gold, silver, copper)


   Alex  = Admin(nickname='Alex', email='*****@*****.**', password='******', wallet=admin_wallet)
   Alex2 = Moderator(nickname='Alex2', email='*****@*****.**', password='******', wallet=admin_wallet)

   print(u"\nAdministrator:"
         u"\n#################################################\n" \
         u"{}"
         u"\n#################################################\n".format(Alex))
   Alex.save(open("admin_alex.txt", "w"))

   Alex.ban_player("users.txt", 'arseni2')
   print'\n'
   Alex.unban_player("users.txt", 'arseni2')
   # Alex.delete_player("arseni_player.txt")

   print(u"\nModerator:"
         u"\n#################################################\n" \
         u"{}"