X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FHall.vue;h=ebb4675368f90060e17155bd96af56fcfde805ff;hb=4a2093139089632727de4f510127ef186cab528e;hp=0e4d574b0539b61f5666691a2b87f6e69e247040;hpb=2fb22896fd3a519c6864cd5a5d97326bad376634;p=vchess.git diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index 0e4d574b..ebb46753 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -441,7 +441,8 @@ export default { } } ); - } else addChallenges(); + } + else addChallenges(); } } ); @@ -563,11 +564,7 @@ export default { // o: challenge or game classifyObject: function(o) { // No imported games here - return ( - o.cadence.indexOf("d") >= 0 - ? "corr" - : (o.cadence.indexOf("/") >= 0 ? "simul" : "live") - ); + return (o.cadence.indexOf("d") >= 0 ? "corr" : "live"); }, setDisplay: function(letter, type, e) { this[letter + "display"] = type; @@ -705,7 +702,8 @@ export default { // For self multi-connects tests: this.newConnect[data.from[0]] = true; this.send("askidentity", { target: data.from[0], page: page }); - } else { + } + else { this.people[data.from[0]].tmpIds[data.from[1]] = { page: page, focus: true }; this.$forceUpdate(); //TODO: shouldn't be required @@ -737,7 +735,8 @@ export default { "all" ); } - } else { + } + else { // Remove the matching live game if now unreachable const gid = data.page.match(/[a-zA-Z0-9]+$/)[0]; // Corr games are always reachable: @@ -857,10 +856,6 @@ export default { } break; } - case "entersimul": - // TODO: confirm box accept/refuse. - // If accept, update seat (array in this case) - break; case "game": // Individual request case "newgame": { const game = data.data; @@ -956,7 +951,8 @@ export default { ); }); this.games = this.games.concat(moreGames); - } else this.hasMore = false; + } + else this.hasMore = false; } } ); @@ -1024,7 +1020,8 @@ export default { position: parsedFen.position //,orientation: parsedFen.turn }); - } else this.newchallenge.diag = ""; + } + else this.newchallenge.diag = ""; }, newChallFromPreset(pchall) { this.partialResetNewchallenge(); @@ -1162,7 +1159,8 @@ export default { if (ctype == "live") { // Live challenges have a random ID finishAddChallenge(null); - } else { + } + else { // Correspondence game: send challenge to server ajax( "/challenges", @@ -1201,7 +1199,8 @@ export default { else // Corr challenge: just remove the challenge this.send("deletechallenge_s", { data: { cid: c.id } }); - } else { + } + else { const oppsid = this.getOppsid(c); if (!!oppsid) this.send("refusechallenge", { data: c.id, target: oppsid }); @@ -1225,13 +1224,6 @@ export default { alert(this.st.tr["Please log in to accept corr challenges"]); return; } - if (c.type == "simul") { - // Just notify that I wanna enter the simultaneous game(s) - // TODO: dans défi, indiquer si positions aleatoires, si tjours blancs ou noirs - // --> /w30 ou b1h ou juste 30 (random, sans préfixe). - // => message "entersimul" to c.from - return; - } else { c.accepted = true; await import("@/variants/" + c.vname + ".js") @@ -1262,19 +1254,12 @@ export default { { data: { id: c.id } } ); } - else if (c.type == "simul" && !!c.seat && Array.isArray(c.seat)) - // TODO: if some players entered, start game - this.launchSimultaneous(c); this.send("deletechallenge_s", { data: { cid: c.id } }); } // In all cases, the challenge is consumed: ArrayFun.remove(this.challenges, ch => ch.id == c.id); }, // NOTE: when launching game, the challenge is already being deleted - // TODO: adapt for simultaneous games, or just write a new function (better) - launchSimultaneous: function(c) { - // TODO - }, launchGame: function(c) { // White player index 0, black player index 1: let players = @@ -1322,7 +1307,14 @@ export default { if (c.type == "live") { notifyNewgame(); this.startNewGame(gameInfo); - } else { + // Increment game stats counter in DB + ajax( + "/gamestat", + "POST", + { data: { vid: gameInfo.vid } } + ); + } + else { // corr: game only on server ajax( "/games", @@ -1372,7 +1364,7 @@ export default { new Audio("/sounds/newgame.flac").play().catch(() => {}); notify( "New live game", - { body: "vs " + game.players[1-myIdx].name || "@nonymous" } + { body: "vs " + (game.players[1-myIdx].name || "@nonymous") } ); } this.$router.push("/game/" + gameInfo.id);