fix broken server
This commit is contained in:
parent
cc0312b357
commit
ad26bba835
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
*node_modules/*
|
||||
*dist/*
|
||||
|
|
2
dist/env.js
vendored
2
dist/env.js
vendored
|
@ -1,2 +0,0 @@
|
|||
export const port = 8082;
|
||||
//# sourceMappingURL=env.js.map
|
1
dist/env.js.map
vendored
1
dist/env.js.map
vendored
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"env.js","sourceRoot":"","sources":["../server/src/env.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC"}
|
37
dist/game.js
vendored
37
dist/game.js
vendored
|
@ -1,37 +0,0 @@
|
|||
import { Player } from "./player.js";
|
||||
import { roomManager } from "./roomManager.js";
|
||||
import { World } from "./world/world.js";
|
||||
export class Game {
|
||||
constructor(id, options) {
|
||||
this.id = id;
|
||||
this.players = [];
|
||||
this.world = new World(options);
|
||||
}
|
||||
addPlayer(id, name, color) {
|
||||
// if (this.getAllNames().includes(name)) return false
|
||||
const player = new Player(id, name, color);
|
||||
this.players.push(player);
|
||||
return player;
|
||||
}
|
||||
removePlayerByID(id) {
|
||||
this.players = this.players.filter(obj => obj.id != id);
|
||||
if (this.players.length < 1) {
|
||||
roomManager.removeGameByID(this.id);
|
||||
}
|
||||
}
|
||||
getAllIDs() {
|
||||
let ids = [];
|
||||
for (let i = 0; i < this.players.length; i++) {
|
||||
ids.push(this.players[i].id);
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
getAllNames() {
|
||||
let names = [];
|
||||
for (let i = 0; i < this.players.length; i++) {
|
||||
names.push(this.players[i].name);
|
||||
}
|
||||
return names;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=game.js.map
|
1
dist/game.js.map
vendored
1
dist/game.js.map
vendored
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"game.js","sourceRoot":"","sources":["../server/src/game.ts"],"names":[],"mappings":"AAAA,OAAO,E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KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC5C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;SACjC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;CACF"}
|
7
dist/main.js
vendored
7
dist/main.js
vendored
|
@ -1,7 +0,0 @@
|
|||
import "./roomManager.js";
|
||||
import "./server/netcode.js";
|
||||
setInterval(function () { updateInfo(); }, 5000);
|
||||
function updateInfo() {
|
||||
console.log("running...");
|
||||
}
|
||||
//# sourceMappingURL=main.js.map
|
1
dist/main.js.map
vendored
1
dist/main.js.map
vendored
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"main.js","sourceRoot":"","sources":["../server/src/main.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAA;AACzB,OAAO,qBAAqB,CAAA;AAG5B,WAAW,CAAC,cAAY,UAAU,EAAE,CAAA,CAAA,CAAC,EAAC,IAAI,CAAC,CAAA;AAC3C,SAAS,UAAU;IACjB,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;AAC3B,CAAC"}
|
8
dist/player.js
vendored
8
dist/player.js
vendored
|
@ -1,8 +0,0 @@
|
|||
export class Player {
|
||||
constructor(id, name, color) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=player.js.map
|
1
dist/player.js.map
vendored
1
dist/player.js.map
vendored
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"player.js","sourceRoot":"","sources":["../server/src/player.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,MAAM;IAIjB,YAAY,EAAS,EAAE,IAAW,EAAE,KAAY;QAC9C,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF"}
|
61
dist/roomManager.js
vendored
61
dist/roomManager.js
vendored
|
@ -1,61 +0,0 @@
|
|||
import { Game } from "./game.js";
|
||||
import * as util from "./util.js";
|
||||
class RoomManager {
|
||||
constructor() {
|
||||
this.games = [];
|
||||
}
|
||||
getGameByID(id) {
|
||||
const game = this.games.filter(obj => obj.id == id)[0];
|
||||
return game;
|
||||
}
|
||||
addGame(id, options) {
|
||||
const game = new Game(id, options);
|
||||
this.games.push(game);
|
||||
return game;
|
||||
}
|
||||
removeGameByID(id) {
|
||||
this.games = this.games.filter(obj => obj.id != id);
|
||||
}
|
||||
getAllPlayerIDs() {
|
||||
let ids = [];
|
||||
for (let i = 0; i < this.games.length; i++) {
|
||||
for (let j = 0; j < this.games[i].players.length; j++) {
|
||||
ids.push(this.games[i].players[j].id);
|
||||
}
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
getAllGameIDs() {
|
||||
let ids = [];
|
||||
for (let i = 0; i < this.games.length; i++) {
|
||||
ids.push(this.games[i].id);
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
playerJoinGame(roomCode, playerName, playerColor, playerID) {
|
||||
// See if the client is already in a game
|
||||
if (this.getAllPlayerIDs().includes(playerID)) {
|
||||
}
|
||||
if (!this.getAllGameIDs().includes(roomCode)) {
|
||||
}
|
||||
const game = this.getGameByID(roomCode);
|
||||
const player = game.addPlayer(playerID, playerName, playerColor);
|
||||
// See if player name is taken already
|
||||
// if (player === false) {
|
||||
// this.removeGameByID(game.id)
|
||||
// }
|
||||
return [game, player];
|
||||
}
|
||||
playerCreateGame(options, playerName, playerColor, playerID) {
|
||||
if (this.getAllPlayerIDs().includes(playerID)) {
|
||||
// return new IllegalAction(playerID, 22)
|
||||
}
|
||||
console.log(options);
|
||||
const id = util.createCode();
|
||||
const game = this.addGame(id, options);
|
||||
const player = game.addPlayer(playerID, playerName, playerColor);
|
||||
return [game, player];
|
||||
}
|
||||
}
|
||||
export var roomManager = new RoomManager();
|
||||
//# sourceMappingURL=roomManager.js.map
|
1
dist/roomManager.js.map
vendored
1
dist/roomManager.js.map
vendored
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"roomManager.js","sourceRoot":"","sources":["../server/src/roomManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,MAAM,WAAW;IAEf;QACE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IACD,WAAW,CAAC,EAAS;QACnB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;QACtD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,CAAC,EAAS,EAAE,OAAW;QAC5B,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QACnC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtB,OAAO,IAAI,CAAA;IACb,CAAC;IACD,cAAc,CAAC,EAAS;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAEtD,CAAC;IAED,eAAe;QACb,IAAI,GAAG,GAAG,EAAE,CAAA;QACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACrD,G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B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;QACtC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;QACjE,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAEvB,CAAC;CAEF;AAGD,MAAM,CAAC,IAAI,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC"}
|
12
dist/server/illegalAction.js
vendored
12
dist/server/illegalAction.js
vendored
|
@ -1,12 +0,0 @@
|
|||
import { io } from "./io.js";
|
||||
export class IllegalAction {
|
||||
constructor(id, action) {
|
||||
this.action = action;
|
||||
this.id = id;
|
||||
this.sendIllegalAction();
|
||||
}
|
||||
sendIllegalAction() {
|
||||
io.to(this.id).emit('illegalAction', this.action);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=illegalAction.js.map
|
1
dist/server/illegalAction.js.map
vendored
1
dist/server/illegalAction.js.map
vendored
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"illegalAction.js","sourceRoot":"","sources":["../../server/src/server/illegalAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,EAAC,MAAM,SAAS,CAAA;AAC1B,MAAM,OAAO,aAAa;IAGxB,YAAY,EAAS,EAAE,MAAa;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;QACZ,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IACD,iBAAiB;QACf,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IACnD,CAAC;CACF"}
|
4
dist/server/io.js
vendored
4
dist/server/io.js
vendored
|
@ -1,4 +0,0 @@
|
|||
import { webServer } from "./server.js";
|
||||
import { Server } from "socket.io";
|
||||
export const io = new Server(webServer, {});
|
||||
//# sourceMappingURL=io.js.map
|
1
dist/server/io.js.map
vendored
1
dist/server/io.js.map
vendored
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"io.js","sourceRoot":"","sources":["../../server/src/server/io.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC"}
|
56
dist/server/netcode.js
vendored
56
dist/server/netcode.js
vendored
|
@ -1,56 +0,0 @@
|
|||
import { IllegalAction } from "./illegalAction.js";
|
||||
import { roomManager } from "../roomManager.js";
|
||||
import { io } from "./io.js";
|
||||
io.on('connection', function (client) {
|
||||
connected(client);
|
||||
});
|
||||
function connected(client) {
|
||||
client.sync = function () {
|
||||
const tempWorld = client.game.world.obfuscate();
|
||||
io.to(client.game.id).emit('sync', { world: tempWorld });
|
||||
};
|
||||
client.sendMeta = function () {
|
||||
const roomID = client.game.id;
|
||||
const roomPlayers = client.game.players; // Dont send client id's to everyone, TODO
|
||||
const metadata = { players: roomPlayers, roomID: roomID };
|
||||
io.to(client.game.id).emit('metadata', metadata);
|
||||
const id = client.game.id;
|
||||
client.emit('message', id);
|
||||
};
|
||||
client.game = "";
|
||||
client.player = "";
|
||||
client.on('disconnect', function () {
|
||||
if (!roomManager.getAllPlayerIDs().includes(client.id))
|
||||
return new IllegalAction(client.id, 22);
|
||||
client.game.removePlayerByID(client.id);
|
||||
client.sendMeta();
|
||||
});
|
||||
client.on('joinGame', function (data) {
|
||||
const info = roomManager.playerJoinGame(data.room, data.name, data.color, client.id);
|
||||
client.join(info[0].id);
|
||||
client.game = info[0];
|
||||
client.player = info[1];
|
||||
client.sync();
|
||||
client.emit('inGame', true);
|
||||
client.sendMeta();
|
||||
});
|
||||
client.on('createGame', function (data) {
|
||||
const info = roomManager.playerCreateGame(data.options, data.name, data.color, client.id);
|
||||
client.join(info[0].id);
|
||||
client.game = info[0];
|
||||
client.player = info[1];
|
||||
client.emit('inGame', true);
|
||||
client.sync();
|
||||
client.sendMeta();
|
||||
});
|
||||
client.on('leaveGame', function (data) {
|
||||
client.game.removePlayerByID(client.id);
|
||||
});
|
||||
client.on('clickCanvas', function (data) {
|
||||
if (!roomManager.getAllPlayerIDs().includes(client.id))
|
||||
return new IllegalAction(client.id, 1);
|
||||
client.game.world.click(data.tilePosition[0], data.tilePosition[1], data.mode, client.player);
|
||||
client.sync();
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=netcode.js.map
|
1
dist/server/netcode.js.map
vendored
1
dist/server/netcode.js.map
vendored
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"netcode.js","sourceRoot":"","sources":["../../server/src/server/netcode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAC,EAAE,EAAC,MAAM,SAAS,CAAA;AAE1B,EAAE,CAAC,EAAE,CAAC,YAAY,EAAE,UAAS,MAAU;IACrC,SAAS,CAAC,MAAM,CAAC,CAAA;AACnB,CAAC,CAAC,CAAC;AAGH,SAAS,SAAS,CAAC,MAAU;IACzB,MAAM,CAAC,IAAI,GAAG;QACZ,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;QAChD,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,EAAC,EAAC,KAAK,EAAE,SAAS,EAAC,CAAC,CAAA;IACvD,CAAC,CAAA;IAED,MAAM,CAAC,QAAQ,GAAG;QAChB,MAAM,MAAM,GAAU,MAAM,CAAC,IAAI,CAAC,EAAE,CAAA;QACpC,MAAM,WAAW,GAAK,MAAM,CAAC,IAAI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AAC,MAAM,CAAC,CAAA;QAC5F,MAAM,CAAC,IAAI,EAAE,CAAA;IACf,CAAC,CAAC,CAAA;AACN,CAAC"}
|
9
dist/server/server.js
vendored
9
dist/server/server.js
vendored
|
@ -1,9 +0,0 @@
|
|||
import path from 'path';
|
||||
import express from "express";
|
||||
import { port } from "../env.js";
|
||||
var app = express();
|
||||
const __dirname = path.resolve(path.dirname(''));
|
||||
app.use(express.static(__dirname + '/www/'));
|
||||
export var webServer = app.listen(port, function () {
|
||||
});
|
||||
//# sourceMappingURL=server.js.map
|
1
dist/server/server.js.map
vendored
1
dist/server/server.js.map
vendored
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../server/src/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,IAAI,GAAG,GAAG,OAAO,EAAE,CAAA;AAEnB,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AACjD,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC;AAC7C,MAAM,CAAC,IAAI,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE;AACxC,CAAC,CAAC,CAAC"}
|
12
dist/util.js
vendored
12
dist/util.js
vendored
|
@ -1,12 +0,0 @@
|
|||
import crypto from "crypto";
|
||||
export function randomNumber(min, max) {
|
||||
return Math.floor(Math.random() * (max - min) + min);
|
||||
}
|
||||
export function clamp(number, min, max) {
|
||||
return Math.max(min, Math.min(number, max));
|
||||
}
|
||||
export function createCode() {
|
||||
const randomString = crypto.randomBytes(3).toString("hex").toUpperCase();
|
||||
return randomString;
|
||||
}
|
||||
//# sourceMappingURL=util.js.map
|
1
dist/util.js.map
vendored
1
dist/util.js.map
vendored
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"util.js","sourceRoot":"","sources":["../server/src/util.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,MAAM,UAAU,YAAY,CAAC,GAAU,EAAE,GAAU;IAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;AACzD,CAAC;AACD,MAAM,UAAU,KAAK,CAAC,MAAa,EAAE,GAAU,EAAE,GAAU;IACzD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAA;IACxE,OAAO,YAAY,CAAA;AACrB,CAAC"}
|
21
dist/world/flagger.js
vendored
21
dist/world/flagger.js
vendored
|
@ -1,21 +0,0 @@
|
|||
export function flag(x, y, data, player) {
|
||||
let tile = data[x][y];
|
||||
if (!tile.mask || tile.flag === 0)
|
||||
return data;
|
||||
const color = +player.color;
|
||||
console.log(player);
|
||||
switch (tile.flag) {
|
||||
case (0):
|
||||
tile.flag = color;
|
||||
break;
|
||||
case (color):
|
||||
tile.flag = color + 16;
|
||||
break;
|
||||
default:
|
||||
tile.flag = 0;
|
||||
}
|
||||
console.log(tile.flag);
|
||||
data[x][y] = tile;
|
||||
return data;
|
||||
}
|
||||
//# sourceMappingURL=flagger.js.map
|
1
dist/world/flagger.js.map
vendored
1
dist/world/flagger.js.map
vendored
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"flagger.js","sourceRoot":"","sources":["../../server/src/world/flagger.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,IAAI,CAAC,CAAQ,EAAE,CAAQ,EAAE,IAAc,EAAE,MAAa;IACpE,IAAI,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAErB,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IAC9C,MAAM,KAAK,GAAU,CAAC,MAAM,CAAC,KAAK,CAAA;IAClC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IAEnB,QAAQ,IAAI,CAAC,IAAI,EAAE;QACjB,KAAK,CAAC,CAAC,CAAC;YACJ,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;YACpB,MAAM;QACR,KAAK,CAAC,KAAK,CAAC;YACR,IAAI,CAAC,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;YACzB,MAAM;QACR;YACI,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;KACnB;IACC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACxB,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;IACjB,OAAO,IAAI,CAAC;AACd,CAAC"}
|
34
dist/world/generator.js
vendored
34
dist/world/generator.js
vendored
|
@ -1,34 +0,0 @@
|
|||
import * as util from "../util.js";
|
||||
const searchLoc = [
|
||||
[-1, 1], [0, 1], [1, 1],
|
||||
[-1, 0], [1, 0],
|
||||
[-1, -1], [0, -1], [1, -1]
|
||||
];
|
||||
export function generate(avoidX, avoidY, world) {
|
||||
var minesPlanted = 0;
|
||||
while (minesPlanted < world.mines || !(minesPlanted <= world.width * world.height - 15)) {
|
||||
const x = util.randomNumber(0, world.width);
|
||||
const y = util.randomNumber(0, world.height);
|
||||
var suitable = true;
|
||||
searchLoc.forEach(loc => {
|
||||
const tempx = x + loc[0];
|
||||
const tempy = y + loc[1];
|
||||
if (tempx === avoidX && tempy === avoidX) {
|
||||
suitable = false;
|
||||
}
|
||||
});
|
||||
if (x == avoidX && y == avoidY) {
|
||||
suitable = false;
|
||||
}
|
||||
if (world.data[x][y].type == 5) {
|
||||
suitable = false;
|
||||
}
|
||||
if (suitable) {
|
||||
world.data[x][y].type = 5;
|
||||
minesPlanted++;
|
||||
}
|
||||
}
|
||||
world.isGenerated = true;
|
||||
return world;
|
||||
}
|
||||
//# sourceMappingURL=generator.js.map
|
1
dist/world/generator.js.map
vendored
1
dist/world/generator.js.map
vendored
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../server/src/world/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAA;AAGlC,MAAM,SAAS,GACf;IACE,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAS,CAAC,CAAC,EAAC,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;CACtB,CAAA;AAED,MAAM,UAAU,QAAQ,CAAC,MAAa,EAAE,MAAa,EAAE,KAAW;IAChE,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,OAAO,YAAY,GAAG,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,YAAY,IAAI,KAAK,CAAC,KAAK,GAAC,KAAK,CAAC,MAAM,GAAC,EAAE,CAAC,EAAE;QACnF,MAAM,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,EAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QAC1C,MAAM,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,EAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QAC3C,IAAI,QAAQ,GAAG,IAAI,CAAC;QACpB,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACtB,MAAM,KAAK,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;YACxB,MAAM,KAAK,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;YACxB,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,MAAM,EAAE;gBACtC,QAAQ,GAAG,KAAK,CAAC;aACpB;QACH,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,IAAI,MAAM,EAAI;YAAE,QAAQ,GAAG,KAAK,CAAA;SAAE;QACtD,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,EAAI;YAAE,QAAQ,GAAG,KAAK,CAAA;SAAE;QAEtD,IAAI,QAAQ,EAAE;YACZ,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAA;YACzB,YAAY,EAAE,CAAC;SAChB;KACF;IAED,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;IACzB,OAAO,KAAK,CAAC;AACf,CAAC"}
|
30
dist/world/marker.js
vendored
30
dist/world/marker.js
vendored
|
@ -1,30 +0,0 @@
|
|||
const searchLoc = [
|
||||
[-1, 1], [0, 1], [1, 1],
|
||||
[-1, 0], [1, 0],
|
||||
[-1, -1], [0, -1], [1, -1]
|
||||
];
|
||||
// Place Numbers
|
||||
export function mark(world) {
|
||||
for (let x = 0; x < world.width; x++) {
|
||||
for (let y = 0; y < world.height; y++) {
|
||||
if (world.data[x][y].type === 1) {
|
||||
var counter = 0;
|
||||
searchLoc.forEach(location => {
|
||||
const tempx = x + location[0];
|
||||
const tempy = y + location[1];
|
||||
if (tempx >= 0 && tempy >= 0 && tempx < world.width && tempy < world.height) {
|
||||
if (world.data[tempx][tempy].type === 5) {
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (counter !== 0) {
|
||||
world.data[x][y].type = 15 + counter;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
world.isMarked = true;
|
||||
return world;
|
||||
}
|
||||
//# sourceMappingURL=marker.js.map
|
1
dist/world/marker.js.map
vendored
1
dist/world/marker.js.map
vendored
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"marker.js","sourceRoot":"","sources":["../../server/src/world/marker.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GACf;IACE,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAS,CAAC,CAAC,EAAC,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;CACtB,CAAA;AACD,gBAAgB;AAChB,MAAM,UAAU,IAAI,CAAC,KAAW;IAEhC,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,EAAC;QAClC,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAC;YACnC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE;gBACjC,IAAI,OAAO,GAAG,CAAC,CAAC;gBAChB,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;oBAC3B,MAAM,KAAK,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;oBAC7B,MAAM,KAAK,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;oBAC7B,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE;wBAC3E,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE;4BACvC,OAAO,EAAE,CAAC;yBACX;qBACF;gBACH,CAAC,CAAC,CAAC;gBACH,IAAI,OAAO,KAAK,CAAC,EAAE;oBACnB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,GAAG,OAAO,CAAA;iBACnC;aACA;SACF;KACF;IACC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC;IACtB,OAAO,KAAK,CAAC;AAEf,CAAC"}
|
14
dist/world/obfuscator.js
vendored
14
dist/world/obfuscator.js
vendored
|
@ -1,14 +0,0 @@
|
|||
export function obfuscate(world) {
|
||||
let tempWorld = world;
|
||||
for (let x = 0; x < tempWorld.width; x++) {
|
||||
for (let y = 0; y < tempWorld.height; y++) {
|
||||
if (tempWorld.data[x][y].mask === true) {
|
||||
tempWorld.data[x][y].type = 0;
|
||||
}
|
||||
;
|
||||
tempWorld.isObfuscated = true;
|
||||
}
|
||||
}
|
||||
return tempWorld;
|
||||
}
|
||||
//# sourceMappingURL=obfuscator.js.map
|
1
dist/world/obfuscator.js.map
vendored
1
dist/world/obfuscator.js.map
vendored
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"obfuscator.js","sourceRoot":"","sources":["../../server/src/world/obfuscator.ts"],"names":[],"mappings":"AACA,MAAM,UAAU,SAAS,CAAC,KAAW;IACnC,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,EAAC;QACtC,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAC;YAEvC,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,EAAE;gBAEtC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;aAC/B;YAAA,CAAC;YACF,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC;SAE/B;KACF;IACG,OAAO,SAAS,CAAC;AACvB,CAAC"}
|
13
dist/world/placer.js
vendored
13
dist/world/placer.js
vendored
|
@ -1,13 +0,0 @@
|
|||
import * as revealer from "./revealer.js";
|
||||
export function place(x, y, data) {
|
||||
let tile = data[x][y];
|
||||
if (tile.mask === true) {
|
||||
if (tile.mask && tile.flag === 0) {
|
||||
tile.mask = false;
|
||||
}
|
||||
data[x][y] = tile;
|
||||
revealer.reveal(x, y, data);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
//# sourceMappingURL=placer.js.map
|
1
dist/world/placer.js.map
vendored
1
dist/world/placer.js.map
vendored
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"placer.js","sourceRoot":"","sources":["../../server/src/world/placer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AAGzC,MAAM,UAAU,KAAK,CAAC,CAAQ,EAAE,CAAQ,EAAE,IAAc;IACtD,IAAI,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtB,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE;QACxB,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,EAAE;YAChC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;SACnB;QAED,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;QAClB,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA;KAC1B;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
36
dist/world/revealer.js
vendored
36
dist/world/revealer.js
vendored
|
@ -1,36 +0,0 @@
|
|||
const searchLoc = [
|
||||
[-1, 1], [0, 1], [1, 1],
|
||||
[-1, 0], [1, 0],
|
||||
[-1, -1], [0, -1], [1, -1]
|
||||
];
|
||||
export function reveal(x, y, data) {
|
||||
if (data[x][y].type === 5)
|
||||
return data;
|
||||
var toSearch = [];
|
||||
var searchedLocations = [];
|
||||
toSearch.push([x, y]);
|
||||
if (data[x][y].type === 1) {
|
||||
while (toSearch.length > 0) {
|
||||
const x = toSearch[0][0];
|
||||
const y = toSearch[0][1];
|
||||
searchedLocations.push(toSearch[0]);
|
||||
toSearch.shift();
|
||||
searchLoc.forEach(loc => {
|
||||
const tempx = x + loc[0];
|
||||
const tempy = y + loc[1];
|
||||
if (tempx >= 0 && tempy >= 0 && tempx < data.length && tempy < data[0].length) {
|
||||
if (data[tempx][tempy].type === 1 && data[tempx][tempy].mask === true) {
|
||||
if (!toSearch.includes([tempx, tempy]) && !searchedLocations.includes([tempx, tempy])) {
|
||||
toSearch.push([tempx, tempy]);
|
||||
}
|
||||
}
|
||||
if (data[tempx][tempy].type !== 5) {
|
||||
data[tempx][tempy].mask = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
//# sourceMappingURL=revealer.js.map
|
1
dist/world/revealer.js.map
vendored
1
dist/world/revealer.js.map
vendored
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"revealer.js","sourceRoot":"","sources":["../../server/src/world/revealer.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GACf;IACE,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,C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C,CAAC,CAAC,CAAC,MAAM,EAAE;oBAE7E,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,IAAI,EAAE;wBAErE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAC,KAAK,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAC,KAAK,CAAC,CAAC,EAAE;4BACnF,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,EAAC,KAAK,CAAC,CAAC,CAAA;yBAC7B;qBACF;oBACH,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE;wBACjC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC;qBACjC;iBACF;YACD,CAAC,CAAC,CAAA;SACL;KACF;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
53
dist/world/world.js
vendored
53
dist/world/world.js
vendored
|
@ -1,53 +0,0 @@
|
|||
import * as obfuscater from "./obfuscator.js";
|
||||
import * as generator from "./generator.js";
|
||||
import * as marker from "./marker.js";
|
||||
import * as flagger from "./flagger.js";
|
||||
import * as placer from "./placer.js";
|
||||
export class World {
|
||||
constructor(options) {
|
||||
this.mines = options.mines;
|
||||
this.width = options.width * 1;
|
||||
this.height = options.height * 1;
|
||||
this.isGenerated = false;
|
||||
this.isObfuscated = false;
|
||||
this.isMarked = false;
|
||||
this.data = Array.from(Array(this.width), () => new Array(this.height));
|
||||
for (let x = 0; x < this.width; x++) {
|
||||
for (let y = 0; y < this.height; y++) {
|
||||
this.data[x][y] = { type: 1, flag: 0, mask: true };
|
||||
}
|
||||
}
|
||||
}
|
||||
click(x, y, mode, player) {
|
||||
if (this.isGenerated) {
|
||||
if (mode === 2) {
|
||||
this.data = flagger.flag(x, y, this.data, player);
|
||||
}
|
||||
if (mode === 0) {
|
||||
this.data = placer.place(x, y, this.data);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.generate(x, y).mark();
|
||||
this.data = placer.place(x, y, this.data);
|
||||
}
|
||||
}
|
||||
generate(x, y) {
|
||||
if (this.isGenerated)
|
||||
return console.log("Already Generated");
|
||||
return generator.generate(x, y, this);
|
||||
}
|
||||
mark() {
|
||||
if (this.isMarked)
|
||||
return console.log("Already Marked!");
|
||||
return marker.mark(this);
|
||||
}
|
||||
obfuscate() {
|
||||
if (this.isObfuscated)
|
||||
return console.log("already done");
|
||||
const tempWorld = JSON.parse(JSON.stringify(this));
|
||||
;
|
||||
return obfuscater.obfuscate(tempWorld);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=world.js.map
|
1
dist/world/world.js.map
vendored
1
dist/world/world.js.map
vendored
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"world.js","sourceRoot":"","sources":["../../server/src/world/world.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAMrC,MAAM,OAAO,KAAK;IAQhB,YAAY,OAAW;QACrB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;QAC1B,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,GAAC,CAAC,CAAA;QAC5B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,GAAC,CAAC,CAAA;QAC9B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC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YAAE,OAAO,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QAC9D,OAAO,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,IAAI;QACF,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QACzD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,SAAS;QACP,IAAI,IAAI,CAAC,YAAY;YAAE,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;QACzD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAAA,CAAC;QACpD,OAAO,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;CAEF"}
|
|
@ -1,8 +1,2 @@
|
|||
import "./roomManager.js"
|
||||
import "./server/netcode.js"
|
||||
import {roomManager} from "./roomManager.js"
|
||||
|
||||
setInterval(function(){ updateInfo()},5000)
|
||||
function updateInfo() {
|
||||
console.log("running...")
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import { port } from "../env.js"
|
|||
var app = express()
|
||||
|
||||
const __dirname = path.resolve(path.dirname(''));
|
||||
app.use(express.static(__dirname + '../server/www/'));
|
||||
app.use(express.static(path.normalize(__dirname + '/client/www/')));
|
||||
console.log(path.normalize(__dirname + '/client/www/'))
|
||||
export var webServer = app.listen(port, function () {
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue