- getSid: function(pname) {
- const pIdx = this.people.findIndex(pl => pl.name == pname);
- return (pIdx === -1 ? null : this.people[pIdx].sid);
- },
- getPname: function(sid) {
- const pIdx = this.people.findIndex(pl => pl.sid == sid);
- return (pIdx === -1 ? null : this.people[pIdx].name);
+ whatPlayerDoes: function(p) {
+ if (this.games.some(g => g.players.some(pl => pl.sid == p.sid)))
+ return "Playing";
+ return "Challenge"; //player is available