Remove redundant check for number of games
This commit is contained in:
parent
bfb2f55374
commit
44e04a01bf
10
commands.py
10
commands.py
|
@ -166,16 +166,14 @@ def need_role(role, errormessage):
|
|||
#@need_args(1, 'Please specify the game name like this: `/newgame <name>`.')
|
||||
@check_too_many_games
|
||||
@read_args('How are we going to call the game?', 'name')
|
||||
def newgame(handler, name):
|
||||
if db.number_of_games(handler.dbc, handler.sender_id) > 10:
|
||||
handler.send('You exceeded the maximum number of games. Please close some first.')
|
||||
return False
|
||||
gameid = db.new_game(handler.dbc, handler.sender_id, handler.username, name, handler.chat_id, handler.groupname, 'fae')
|
||||
@choose_template('Please choose a game template. This will only affect the default character sheets and dices.', 'template')
|
||||
def newgame(handler, name, template):
|
||||
gameid = db.new_game(handler.dbc, handler.sender_id, handler.username, name, handler.chat_id, handler.groupname, template)
|
||||
if gameid is None:
|
||||
handler.send(newgame_already_started_usage())
|
||||
return False
|
||||
|
||||
db.add_default_items(handler.dbc, handler.sender_id, gameid, 'fae')
|
||||
db.add_default_items(handler.dbc, handler.sender_id, gameid, template)
|
||||
handler.send('New game created: {}.'.format(name))
|
||||
|
||||
|
||||
|
|
11
db.py
11
db.py
|
@ -188,6 +188,17 @@ def add_default_items(db, userid, gameid, template):
|
|||
update_item(db, gameid, userid, 'approaches', 'forceful', '0', False)
|
||||
update_item(db, gameid, userid, 'approaches', 'quick', '0', False)
|
||||
update_item(db, gameid, userid, 'approaches', 'sneaky', '0', False)
|
||||
elif template == 'dnd':
|
||||
update_item(db, gameid, userid, 'gen', 'class', 'Your class.', False)
|
||||
update_item(db, gameid, userid, 'gen', 'race', 'Your race.', False)
|
||||
update_item(db, gameid, userid, 'gen', 'alignment', 'Your alignment.', False)
|
||||
update_item(db, gameid, userid, 'gen', 'level', '1', False)
|
||||
update_item(db, gameid, userid, 'attributes', 'strength', '14', False)
|
||||
update_item(db, gameid, userid, 'attributes', 'dexterity', '14', False)
|
||||
update_item(db, gameid, userid, 'attributes', 'constitution', '14', False)
|
||||
update_item(db, gameid, userid, 'attributes', 'intelligence', '14', False)
|
||||
update_item(db, gameid, userid, 'attributes', 'wisdom', '14', False)
|
||||
update_item(db, gameid, userid, 'attributes', 'charisma', '14', False)
|
||||
|
||||
|
||||
def number_of_games(db, user):
|
||||
|
|
Loading…
Reference in New Issue