const DoubleLinkedList = require("../Utility/DoubleLinkedList"); const PQ = require("../Utility/Q"); const maps = []; for (let i = 0; i < 20; i++) maps.push(require(`../Maps/Map_${i + 1}`)); const game = { players: {}, packets: new DoubleLinkedList(), guilds: {}, guildIslands: [], events: new PQ(), eventsFixed: new PQ(), maps, getTopic: function (topicName) { const topic = this.packets.getElement(topicName); if (topic) return topic; return this.packets.addItem(topicName, []); }, addPlayer: function (player) { this.players[player.id] = player; }, /* testDestroyAll: function() { this.maps.forEach(map => map.npcs.forEach(npc => npc)) },*/ disconnectAll: function() { this.state = 0; this.maps.forEach(map => map.players.forEach(player => player.disconnect(() => { socket.sockets[player.sessionID].end(2); delete this.players[player.id]; delete socket.sockets[player.sessionID]; }, true))) // socket.us_listen_socket_close(this.listeningServer); // this.listeningServer = null; }, listeningServer: null, state: 1 }; module.exports = game;