Ejemplo n.º 1
0
 def create(args):
     if args is None:
         do_help(user, ['table', 'create'])
         return
     table_name = colour.strip_tokens(' '.join(args))
     table_ = objects.Table(user, table_name)
     table_.start_time = int(mud.tick_count)
     #mud.add_tick(table_.round_timer, table_.start_time+50*60, repeat=False)
     mud.tables.append(table_)
     user.room.tables.append(table_)
     do_table(user, ['join', table_name])
Ejemplo n.º 2
0
 def create(args):
     if args is None:
         do_help(user, ['room'])
         return
     room_name = colour.strip_tokens(' '.join(args))
     # Check the database for duplicate name, rather than the server.rooms list,
     # as we may not want to load rooms for some reason later
     if db.session.query(db.models.Room).filter_by(name=room_name).first() is not None:
         user.presenter.show_msg("The room name '{}' is already taken, sorry.".format(room_name))
         return
     room = db.models.Room(name=str(room_name))
     vroom = objects.Room.load(room)
     mud.rooms.append(vroom)
     db.session.add(room)
     db.session.commit()
     user.presenter.show_msg("Room created: {}".format(room_name))
Ejemplo n.º 3
0
 def create(args):
     if args is None:
         do_help(user, ['deck'])
         return
     deck_name = colour.strip_tokens(' '.join(args))
     for d in user.decks:
         if d.name == deck_name:
             user.presenter.show_msg("You already have a deck named '{}'.".format(deck_name))
             return
     new_deck = db.models.Deck(
         name = deck_name,
         user_id = user.db.id,
         cards = {}
     )
     db.session.add(new_deck)
     user.decks.append(new_deck)
     db.session.commit()
     user.deck = new_deck
     user.presenter.show_msg("Created new deck '{}'.".format(new_deck.name))