Esempio n. 1
0
def update_player_position(args, latitude, longitude):
    player_id = get_player_id(args)
    Player.update(
        latitude=latitude,
        longitude=longitude,
        last_modified=datetime.now()
    ).where(Player.player_id == player_id).execute()
Esempio n. 2
0
def initialize_player_position(args):
    player_id = get_player_id(args)
    start_position = get_pos_by_name(args.location)

    if len(Player.select().where(Player.player_id == player_id)) == 0:
        Player.create(
            player_id=player_id,
            name=args.username,
            enabled=True,
            last_modified=datetime.now(),
            start_latitude=start_position[0],
            start_longitude=start_position[1]
        )
    else:
        Player.update(
            last_modified=datetime.now(),
            start_latitude=start_position[0],
            start_longitude=start_position[1]
        ).where(Player.player_id == player_id).execute()