Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions routes/socket/game/policy-powers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const { sendGameList } = require('../user-requests');
const { completeGame } = require('./end-game.js');
const { assassinateMerlin } = require('./assassination');

const selectBurnCard = module.exports.selectBurnCard; // site crashes without this line xd

/**
* @param {object} game - game to act on.
*/
Expand Down Expand Up @@ -554,8 +556,6 @@ module.exports.selectBurnCard = (passport, game, data, socket) => {
}
};

const selectBurnCard = module.exports.selectBurnCard; // site crashes without this line xd

/**
* @param {object} game - game to act on.
*/
Expand Down
12 changes: 6 additions & 6 deletions routes/socket/game/start-game.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ const beginGame = game => {
} else if (game.general.avalonSH?.withPercival) {
return { cardName: el % 3 === 1 ? 'morgana' : 'fascist', icon: el, team: 'fascist' };
} else if (game.general.monarchistSH) {
if (el % 3 === 0) return { cardName: 'monarchist', icon: undefined, team: 'fascist' };
return { cardName: 'fascist', icon: el, team: 'fascist' };
if (el % 3 === 0) return { cardName: 'monarchist', icon: undefined, team: 'fascist' };
return { cardName: 'fascist', icon: el, team: 'fascist' };
} else {
return { cardName: 'fascist', icon: el, team: 'fascist' };
}
Expand Down Expand Up @@ -155,7 +155,8 @@ const beginGame = game => {
{ text: '.' }
]
});
} if (game.general.monarchistSH) {
}
if (game.general.monarchistSH) {
player.gameChats.push({
gameChat: true,
timestamp: new Date(),
Expand Down Expand Up @@ -757,9 +758,8 @@ const beginGame = game => {
fascists.forEach(p => (player.playersState[seatedPlayers.indexOf(p)].nameStatus = 'fascist'));
} else if (game.general.avalonSH?.withPercival && cardName === 'percival') {
const hasMorgana = seatedPlayers.some(player => player.role.cardName === 'morgana');
const candidates = seatedPlayers.filter(player =>
player.role.cardName === 'merlin' ||
(hasMorgana ? player.role.cardName === 'morgana' : player.role.cardName === 'monarchist')
const candidates = seatedPlayers.filter(
player => player.role.cardName === 'merlin' || (hasMorgana ? player.role.cardName === 'morgana' : player.role.cardName === 'monarchist')
);

player.gameChats.push({
Expand Down
2 changes: 1 addition & 1 deletion routes/socket/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ module.exports.socketRoutes = () => {
console.log(passport);
console.log(data);
console.log(socket);
//handleUpdatedTruncateGame(data);
// handleUpdatedTruncateGame(data);
});
socket.on('addNewGameChat', data => {
const game = findGame(data);
Expand Down
2 changes: 1 addition & 1 deletion routes/socket/user-events/flappy-hitler.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports.handleFlappyEvent = (data, game) => {
return;
return;
if (!io.sockets.adapter.rooms[game.general.uid]) {
return;
}
Expand Down
10 changes: 5 additions & 5 deletions routes/socket/user-events/join-game.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ const updateSeatedUser = (socket, passport, data) => {
// Authentication Assured in routes.js
// In-game Assured in routes.js
const game = games[data?.uid];

if (!data?.uid) {
console.log("BAD DATA")
console.log(data)
console.log(socket)
console.log(passport)
console.log('BAD DATA');
console.log(data);
console.log(socket);
console.log(passport);
}
// prevents race condition between 1) taking a seat and 2) the game starting

Expand Down
2 changes: 1 addition & 1 deletion routes/socket/user-events/moderation.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports.handleModerationAction = (socket, passport, data, skipCheck, modU
if (!data) {
return;
}

if (data.userName) {
data.userName = data.userName.trim();
}
Expand Down
32 changes: 16 additions & 16 deletions routes/socket/user-events/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ const { sendUserList } = require('../user-requests');
* @param {object} data - from socket emit.
*/
module.exports.handleUpdatedTheme = (socket, passport, data) => {
console.log(data, 'data')
if (data && typeof data === 'object' && typeof data.field === 'string') {

const fields = ['primaryColor', 'secondaryColor', 'tertiaryColor', 'backgroundColor', 'textColor'];
console.log(data, 'data');
if (data && typeof data === 'object' && typeof data.field === 'string') {
const fields = ['primaryColor', 'secondaryColor', 'tertiaryColor', 'backgroundColor', 'textColor'];

Account.findOne({ username: passport && passport.user }).then(account => {
if (!account) {
return;
}
Account.findOne({ username: passport && passport.user }).then(account => {
if (!account) {
return;
}

for (const field of fields) {
if (data[field] && typeof data[field] === 'string') account[field] = data[field];
else {
console.log("BAD DATA - " + passport.user) }
}
for (const field of fields) {
if (data[field] && typeof data[field] === 'string') account[field] = data[field];
else {
console.log('BAD DATA - ' + passport.user);
}
}

account.save();
});
}
account.save();
});
}
};

/**
Expand Down
31 changes: 15 additions & 16 deletions routes/socket/user-requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,17 +255,17 @@ module.exports.sendUserGameSettings = socket => {
* @param {object} data - data about the request
*/
module.exports.sendPlayerNotes = (socket, data) => {
if (data) {
PlayerNote.find({ userName: data?.userName, notedUser: { $in: data?.seatedPlayers } })
.then(notes => {
if (notes) {
socket.emit('notesUpdate', notes);
}
})
.catch(err => {
console.log(err, 'err in getting playernotes');
});
}
if (data) {
PlayerNote.find({ userName: data?.userName, notedUser: { $in: data?.seatedPlayers } })
.then(notes => {
if (notes) {
socket.emit('notesUpdate', notes);
}
})
.catch(err => {
console.log(err, 'err in getting playernotes');
});
}
};

/**
Expand Down Expand Up @@ -352,12 +352,11 @@ const updateUserStatus = (module.exports.updateUserStatus = (passport, game, ove
* @param {string} uid - uid of game.
*/
module.exports.sendGameInfo = (socket, uid) => {
if (typeof uid !== 'string') {
return;
}

if (typeof uid !== 'string') {
return;
}

const game = games[uid];
const game = games[uid];
const { passport } = socket.handshake.session;

if (game && game.publicPlayersState && game.general) {
Expand Down
2 changes: 0 additions & 2 deletions src/frontend-scripts/components/menu/Menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { viewPatchNotes } from '../../actions/actions';
import { Popup } from 'semantic-ui-react';
import Swal from 'sweetalert2';
import socket from '../../socket';

const mapStateToProps = ({ version }) => ({ version });

Expand Down
5 changes: 3 additions & 2 deletions src/frontend-scripts/components/section-main/Gamechat.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ const mapDispatchToProps = dispatch => ({
const mapStateToProps = ({ notesActive }) => ({ notesActive });

const ClaimButton = ({ cards, onClick }) => {
let i = 0;
return (
<div className="card-container" onClick={onClick}>
{['fascist', 'liberal'].includes(cards) ? (
<div className={`card ${cards}`}></div>
) : (
cards.split('').map(card => {
if (card === 'r') {
return <div className="card fascist"></div>;
return <div className="card fascist" key={i++}></div>;
} else {
return <div className="card liberal"></div>;
return <div className="card liberal" key={i++}></div>;
}
})
)}
Expand Down
2 changes: 0 additions & 2 deletions src/frontend-scripts/components/section-main/GamesList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import React from 'react'; // eslint-disable-line
import DisplayLobbies from './DisplayLobbies.jsx';
import PropTypes from 'prop-types';
import { Checkbox } from 'semantic-ui-react';
import moment from 'moment';
import { CURRENTSEASONNUMBER } from '../../constants';
import { Message } from 'semantic-ui-react';
import { processEmotes } from '../../emotes';

Expand Down
2 changes: 1 addition & 1 deletion src/scss/players.scss
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ $eloValues: (1500 0.3 1 0.3) (1600 0.3 1 0.5) (1849 0 1 0.7) (1850 1 1 0.7) (190
}

.player-container.carl {
box-shadow: 0 0 5px 2px #726EFF !important;
box-shadow: 0 0 5px 2px #726eff !important;
}

.player-container.rose {
Expand Down