Ignore:
Timestamp:
07/16/22 21:31:18 (2 years ago)
Author:
anastasovv <simon@…>
Branches:
main
Children:
e903234
Parents:
55701f0
Message:

Now you need to activate your account via email & also added mail sending after server crash

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pages/api/roulette/gameStates.js

    r55701f0 re007fcd  
    2626    game.status = '_1_ongoing_timer';
    2727
     28    let inactivePlayers = []
     29
    2830    game.players.forEach(player => {
    2931        player.whichBets = [];
     
    3739        player.status = '_1_no_placed_bet';
    3840        player.gotResults = false;
     41
     42        const d = Date.now();
     43
     44        if (d - player.lastActivity > 200000) {
     45            inactivePlayers.push(player);
     46        }
    3947    })
     48
     49    for (let i = 0; i < inactivePlayers.length; i++) {
     50        if (game.players.indexOf(inactivePlayers[i]) !== -1) {
     51            game.players.splice(game.players.indexOf(inactivePlayers[i]), 1);
     52        }
     53    }
    4054}
    4155
     
    6882}
    6983
    70 export function addPlayer(session_id, name) {
     84export function addPlayer(session_id, name, username) {
    7185    if (game.players.map(e=>e.session_id).indexOf(session_id) === -1) {
    7286        game.players.push({
     87            lastActivity: Date.now(),
    7388            session_id: session_id,
     89            username: username,
    7490            name: name,
    7591            whichBets: [],
Note: See TracChangeset for help on using the changeset viewer.