diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-03-08 17:57:57 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-03-08 17:57:57 +0900 |
| commit | 155012846d8f142515390adb2754b45cdfbb74ef (patch) | |
| tree | 13b237f9464a7df918fee7f35ba6871d08c1ed1c /src/api/endpoints/othello/match.ts | |
| parent | Fix bug (diff) | |
| download | misskey-155012846d8f142515390adb2754b45cdfbb74ef.tar.gz misskey-155012846d8f142515390adb2754b45cdfbb74ef.tar.bz2 misskey-155012846d8f142515390adb2754b45cdfbb74ef.zip | |
#1200
Diffstat (limited to 'src/api/endpoints/othello/match.ts')
| -rw-r--r-- | src/api/endpoints/othello/match.ts | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/api/endpoints/othello/match.ts b/src/api/endpoints/othello/match.ts index cb094bbc65..05b87a541a 100644 --- a/src/api/endpoints/othello/match.ts +++ b/src/api/endpoints/othello/match.ts @@ -3,6 +3,7 @@ import Matching, { pack as packMatching } from '../../models/othello-matching'; import Game, { pack as packGame } from '../../models/othello-game'; import User from '../../models/user'; import { publishOthelloStream } from '../../event'; +import { eighteight } from '../../../common/othello/maps'; module.exports = (params, user) => new Promise(async (res, rej) => { // Get 'user_id' parameter @@ -26,16 +27,21 @@ module.exports = (params, user) => new Promise(async (res, rej) => { _id: exist._id }); - const parentIsBlack = Math.random() > 0.5; - - // Start game + // Create game const game = await Game.insert({ created_at: new Date(), - black_user_id: parentIsBlack ? exist.parent_id : user._id, - white_user_id: parentIsBlack ? user._id : exist.parent_id, - turn_user_id: parentIsBlack ? exist.parent_id : user._id, + user1_id: exist.parent_id, + user2_id: user._id, + user1_accepted: false, + user2_accepted: false, + is_started: false, is_ended: false, - logs: [] + logs: [], + settings: { + map: eighteight, + bw: 'random', + is_llotheo: false + } }); // Reponse |