mirror of
https://github.com/bra1n/townsquare.git
synced 2025-04-04 14:14:38 +00:00
fixing lint errors
This commit is contained in:
parent
c257ef998e
commit
1bde7a6688
2 changed files with 27 additions and 27 deletions
|
@ -32,7 +32,7 @@ class LiveSession {
|
|||
);
|
||||
this._socket.addEventListener("message", this._handleMessage.bind(this));
|
||||
this._socket.onopen = this._onOpen.bind(this);
|
||||
this._socket.onclose = (err) => {
|
||||
this._socket.onclose = err => {
|
||||
this._socket = null;
|
||||
clearInterval(this._pingTimer);
|
||||
this._pingTimer = null;
|
||||
|
@ -105,7 +105,7 @@ class LiveSession {
|
|||
this._isSpectator
|
||||
? this._store.state.session.playerId
|
||||
: Object.keys(this._players).length,
|
||||
"latency",
|
||||
"latency"
|
||||
]);
|
||||
clearTimeout(this._pingTimer);
|
||||
this._pingTimer = setTimeout(this._ping.bind(this), this._pingInterval);
|
||||
|
@ -255,7 +255,7 @@ class LiveSession {
|
|||
*/
|
||||
sendGamestate(playerId = "", isLightweight = false) {
|
||||
if (this._isSpectator) return;
|
||||
this._gamestate = this._store.state.players.players.map((player) => ({
|
||||
this._gamestate = this._store.state.players.players.map(player => ({
|
||||
name: player.name,
|
||||
id: player.id,
|
||||
isDead: player.isDead,
|
||||
|
@ -263,12 +263,12 @@ class LiveSession {
|
|||
pronouns: player.pronouns,
|
||||
...(player.role && player.role.team === "traveler"
|
||||
? { roleId: player.role.id }
|
||||
: {}),
|
||||
: {})
|
||||
}));
|
||||
if (isLightweight) {
|
||||
this._sendDirect(playerId, "gs", {
|
||||
gamestate: this._gamestate,
|
||||
isLightweight,
|
||||
isLightweight
|
||||
});
|
||||
} else {
|
||||
const { session, grimoire } = this._store.state;
|
||||
|
@ -283,8 +283,8 @@ class LiveSession {
|
|||
lockedVote: session.lockedVote,
|
||||
isVoteInProgress: session.isVoteInProgress,
|
||||
markedPlayer: session.markedPlayer,
|
||||
fabled: fabled.map((f) => (f.isCustom ? f : { id: f.id })),
|
||||
...(session.nomination ? { votes: session.votes } : {}),
|
||||
fabled: fabled.map(f => (f.isCustom ? f : { id: f.id })),
|
||||
...(session.nomination ? { votes: session.votes } : {})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ class LiveSession {
|
|||
lockedVote,
|
||||
isVoteInProgress,
|
||||
markedPlayer,
|
||||
fabled,
|
||||
fabled
|
||||
} = data;
|
||||
const players = this._store.state.players.players;
|
||||
// adjust number of players
|
||||
|
@ -325,7 +325,7 @@ class LiveSession {
|
|||
const player = players[x];
|
||||
const { roleId } = state;
|
||||
// update relevant properties
|
||||
["name", "id", "isDead", "isVoteless", "pronouns"].forEach((property) => {
|
||||
["name", "id", "isDead", "isVoteless", "pronouns"].forEach(property => {
|
||||
const value = state[property];
|
||||
if (player[property] !== value) {
|
||||
this._store.commit("players/update", { player, property, value });
|
||||
|
@ -340,14 +340,14 @@ class LiveSession {
|
|||
this._store.commit("players/update", {
|
||||
player,
|
||||
property: "role",
|
||||
value: role,
|
||||
value: role
|
||||
});
|
||||
}
|
||||
} else if (!roleId && player.role.team === "traveler") {
|
||||
this._store.commit("players/update", {
|
||||
player,
|
||||
property: "role",
|
||||
value: {},
|
||||
value: {}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -359,11 +359,11 @@ class LiveSession {
|
|||
votes,
|
||||
votingSpeed,
|
||||
lockedVote,
|
||||
isVoteInProgress,
|
||||
isVoteInProgress
|
||||
});
|
||||
this._store.commit("session/setMarkedPlayer", markedPlayer);
|
||||
this._store.commit("players/setFabled", {
|
||||
fabled: fabled.map((f) => this._store.state.fabled.get(f.id) || f),
|
||||
fabled: fabled.map(f => this._store.state.fabled.get(f.id) || f)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -381,7 +381,7 @@ class LiveSession {
|
|||
}
|
||||
this._sendDirect(playerId, "edition", {
|
||||
edition: edition.isOfficial ? { id: edition.id } : edition,
|
||||
...(roles ? { roles } : {}),
|
||||
...(roles ? { roles } : {})
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -422,7 +422,7 @@ class LiveSession {
|
|||
const { fabled } = this._store.state.players;
|
||||
this._send(
|
||||
"fabled",
|
||||
fabled.map((f) => (f.isCustom ? f : { id: f.id }))
|
||||
fabled.map(f => (f.isCustom ? f : { id: f.id }))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -434,7 +434,7 @@ class LiveSession {
|
|||
_updateFabled(fabled) {
|
||||
if (!this._isSpectator) return;
|
||||
this._store.commit("players/setFabled", {
|
||||
fabled: fabled.map((f) => this._store.state.fabled.get(f.id) || f),
|
||||
fabled: fabled.map(f => this._store.state.fabled.get(f.id) || f)
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -454,7 +454,7 @@ class LiveSession {
|
|||
this._send("player", {
|
||||
index,
|
||||
property,
|
||||
value: value.id,
|
||||
value: value.id
|
||||
});
|
||||
} else if (this._gamestate[index].roleId) {
|
||||
// player was previously a traveler
|
||||
|
@ -484,7 +484,7 @@ class LiveSession {
|
|||
this._store.commit("players/update", {
|
||||
player,
|
||||
property: "role",
|
||||
value: {},
|
||||
value: {}
|
||||
});
|
||||
} else {
|
||||
// load role, first from session, the global, then fail gracefully
|
||||
|
@ -495,7 +495,7 @@ class LiveSession {
|
|||
this._store.commit("players/update", {
|
||||
player,
|
||||
property: "role",
|
||||
value: role,
|
||||
value: role
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
@ -535,7 +535,7 @@ class LiveSession {
|
|||
player,
|
||||
property: "pronouns",
|
||||
value,
|
||||
isFromSockets: true,
|
||||
isFromSockets: true
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -556,12 +556,12 @@ class LiveSession {
|
|||
}
|
||||
}
|
||||
// remove claimed seats from players that are no longer connected
|
||||
this._store.state.players.players.forEach((player) => {
|
||||
this._store.state.players.players.forEach(player => {
|
||||
if (player.id && !this._players[player.id]) {
|
||||
this._store.commit("players/update", {
|
||||
player,
|
||||
property: "id",
|
||||
value: "",
|
||||
value: ""
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -635,7 +635,7 @@ class LiveSession {
|
|||
this._store.commit("players/update", {
|
||||
player: players[oldIndex],
|
||||
property,
|
||||
value: "",
|
||||
value: ""
|
||||
});
|
||||
}
|
||||
// add playerId to new seat
|
||||
|
@ -659,7 +659,7 @@ class LiveSession {
|
|||
if (player.id && player.role) {
|
||||
message[player.id] = [
|
||||
"player",
|
||||
{ index, property: "role", value: player.role.id },
|
||||
{ index, property: "role", value: player.role.id }
|
||||
];
|
||||
}
|
||||
});
|
||||
|
@ -757,7 +757,7 @@ class LiveSession {
|
|||
this._send("vote", [
|
||||
index,
|
||||
this._store.state.session.votes[index],
|
||||
!this._isSpectator,
|
||||
!this._isSpectator
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -836,7 +836,7 @@ class LiveSession {
|
|||
}
|
||||
}
|
||||
|
||||
export default (store) => {
|
||||
export default store => {
|
||||
// setup
|
||||
const session = new LiveSession(store);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = {
|
||||
// if the app is supposed to run on Github Pages in a subfolder, use the following config:
|
||||
// publicPath: process.env.NODE_ENV === "production" ? "/townsquare/" : "/"
|
||||
publicPath: process.env.NODE_ENV === "production" ? "/townsquare/" : "/",
|
||||
publicPath: process.env.NODE_ENV === "production" ? "/townsquare/" : "/"
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue