diff --git a/README.md b/README.md index 4be8238c9..dd71b6b93 100644 --- a/README.md +++ b/README.md @@ -39,9 +39,9 @@ Ubuntu $ sudo apt-get update $ sudo apt-get upgrade - $ sudo apt-get install g++ make memcached libncurses5 redis-server git -y + $ sudo apt-get install g++ make memcached libncurses5 redis-server git curl -y $ curl -sL https://deb.nodesource.com/setup | sudo bash - - $ sudo apt-get install nodejs + $ sudo apt-get install nodejs -y Clone the git repo: diff --git a/client/js/game.js b/client/js/game.js index da4d0701f..e394cdc28 100644 --- a/client/js/game.js +++ b/client/js/game.js @@ -1,8 +1,9 @@ + define(['infomanager', 'bubble', 'renderer', 'map', 'animation', 'sprite', 'tile', 'warrior', 'gameclient', 'audio', 'updater', 'transition', 'pathfinder', 'item', 'mob', 'npc', 'player', 'character', 'chest', - 'mobs', 'exceptions', 'config', 'guild', '../../shared/js/gametypes'], + 'mobs', 'exceptions', 'config', 'guild', '../shared/js/gametypes'], function(InfoManager, BubbleManager, Renderer, Map, Animation, Sprite, AnimatedTile, Warrior, GameClient, AudioManager, Updater, Transition, Pathfinder, Item, Mob, Npc, Player, Character, Chest, Mobs, Exceptions, config, @@ -69,7 +70,7 @@ function(InfoManager, BubbleManager, Renderer, Map, Animation, Sprite, AnimatedT // debug this.debugPathing = false; - + // pvp this.pvpFlag = false; @@ -393,7 +394,7 @@ function(InfoManager, BubbleManager, Renderer, Map, Animation, Sprite, AnimatedT else { this.targetColor = "rgba(255, 255, 255, 0.5)"; } - + if(this.hoveringPlayer && this.started) { if(this.pvpFlag) this.setCursor("sword"); @@ -407,7 +408,7 @@ function(InfoManager, BubbleManager, Renderer, Map, Animation, Sprite, AnimatedT this.hoveringTarget = false; this.hoveringPlayer = false; this.targetCellVisible = false; - + } else if(this.hoveringNpc && this.started) { this.setCursor("talk"); @@ -644,7 +645,7 @@ function(InfoManager, BubbleManager, Renderer, Map, Animation, Sprite, AnimatedT this.userpw = userpw; this.email = email; }, - + loadAudio: function() { this.audioManager = new AudioManager(this); }, @@ -1296,7 +1297,7 @@ function(InfoManager, BubbleManager, Renderer, Map, Animation, Sprite, AnimatedT item.blink(150); } }); - + self.client.onGuildError(function(errorType, info) { if(errorType === Types.Messages.GUILDERRORTYPE.BADNAME){ self.showNotification(info + " seems to be an inappropriate guild name…"); @@ -1314,21 +1315,21 @@ function(InfoManager, BubbleManager, Renderer, Map, Animation, Sprite, AnimatedT self.showNotification(info+" is ALREADY a member of “"+self.player.getGuild().name+"”"); } }); - + self.client.onGuildCreate(function(guildId, guildName) { self.player.setGuild(new Guild(guildId, guildName)); self.storage.setPlayerGuild(self.player.getGuild()); self.showNotification("You successfully created and joined…"); setTimeout(function(){self.showNotification("…" + self.player.getGuild().name)},2500); }); - + self.client.onGuildInvite(function(guildId, guildName, invitorName) { self.showNotification(invitorName + " invited you to join “"+guildName+"”."); self.player.addInvite(guildId); setTimeout(function(){$("#chatinput").attr("placeholder", "Do you want to join "+guildName+" ? Type /guild accept yes or /guild accept no"); self.app.showChat();},2500); }); - + self.client.onGuildJoin(function(playerName, id, guildId, guildName) { if(typeof id === "undefined"){ self.showNotification(playerName + " failed to answer to your invitation in time."); @@ -1347,7 +1348,7 @@ function(InfoManager, BubbleManager, Renderer, Map, Animation, Sprite, AnimatedT self.showNotification(playerName+" is now a jolly member of “"+guildName+"”.");//#updateguild } }); - + self.client.onGuildLeave(function(name, playerId, guildName) { if(self.player.id===playerId){ if(self.player.hasGuild()){ @@ -1363,7 +1364,7 @@ function(InfoManager, BubbleManager, Renderer, Map, Animation, Sprite, AnimatedT self.showNotification(name + " has left “"+guildName+"”.");//#updateguild } }); - + self.client.onGuildTalk(function(name, id, message) { if(id===self.player.id){ self.showNotification("YOU: "+message); @@ -1376,11 +1377,11 @@ function(InfoManager, BubbleManager, Renderer, Map, Animation, Sprite, AnimatedT self.client.onMemberConnect(function(name) { self.showNotification(name + " connected to your world.");//#updateguild }); - + self.client.onMemberDisconnect(function(name) { self.showNotification(name + " lost connection with your world."); }); - + self.client.onReceiveGuildMembers(function(memberNames) { self.showNotification(memberNames.join(", ") + ((memberNames.length===1) ? " is " : " are ") +"currently online.");//#updateguild }); @@ -1459,7 +1460,7 @@ function(InfoManager, BubbleManager, Renderer, Map, Animation, Sprite, AnimatedT self.player.level = level; self.player.experience = exp; self.updateExpBar(); - + self.infoManager.addDamageInfo("+"+mobExp+" exp", self.player.x, self.player.y - 15, "exp", 3000); var expInThisLevel = self.player.experience - Types.expForLevel[self.player.level-1]; @@ -1595,7 +1596,7 @@ function(InfoManager, BubbleManager, Renderer, Map, Animation, Sprite, AnimatedT self.nbplayers_callback(worldPlayers, totalPlayers); } }); - + self.client.onGuildPopulation(function(guildName, guildPopulation) { if(self.nbguildplayers_callback) { self.nbguildplayers_callback(guildName, guildPopulation); @@ -2255,7 +2256,7 @@ function(InfoManager, BubbleManager, Renderer, Map, Animation, Sprite, AnimatedT onCharacterUpdate: function(character) { var time = this.currentTime, self = this; - + // If mob has finished moving to a different tile in order to avoid stacking, attack again from the new position. if(character.previousTarget && !character.isMoving() && character instanceof Mob) { var t = character.previousTarget; @@ -2467,7 +2468,7 @@ function(InfoManager, BubbleManager, Renderer, Map, Animation, Sprite, AnimatedT this.showNotification("“guild accept” is a YES or NO question!!"); } break; - } + } } this.client.sendChat(message); }, @@ -2574,7 +2575,7 @@ function(InfoManager, BubbleManager, Renderer, Map, Animation, Sprite, AnimatedT onNbPlayersChange: function(callback) { this.nbplayers_callback = callback; }, - + onGuildPopulationChange: function(callback) { this.nbguildplayers_callback = callback; }, @@ -2622,7 +2623,7 @@ function(InfoManager, BubbleManager, Renderer, Map, Animation, Sprite, AnimatedT this.updatetarget_callback(target); } }, - + getDeadMobPosition: function(mobId) { var position; diff --git a/client/js/gameclient.js b/client/js/gameclient.js index ea4f7999b..537d644da 100644 --- a/client/js/gameclient.js +++ b/client/js/gameclient.js @@ -51,7 +51,7 @@ define(['player', 'entityfactory', 'lib/bison'], function(Player, EntityFactory, }, connect: function(dispatcherMode) { - var url = "ws://"+ this.host +":"+ this.port +"/", + var url = "ws://"+ this.host +":"+ 8080 +"/browserquest/", self = this; log.info("Trying to connect to server : "+url); @@ -394,7 +394,7 @@ define(['player', 'entityfactory', 'lib/bison'], function(Player, EntityFactory, this.pvp_callback(pvp); } }, - + receiveGuildError: function(data) { var errorType = data[1]; var guildName = data[2]; @@ -402,7 +402,7 @@ define(['player', 'entityfactory', 'lib/bison'], function(Player, EntityFactory, this.guilderror_callback(errorType, guildName); } }, - + receiveGuild: function(data) { if( (data[1] === Types.Messages.GUILDACTION.CONNECT) && this.guildmemberconnect_callback ){ @@ -430,7 +430,7 @@ define(['player', 'entityfactory', 'lib/bison'], function(Player, EntityFactory, this.guildpopulation_callback(data[2], data[3]);//name, count } else if( (data[1] === Types.Messages.GUILDACTION.JOIN) && - this.guildjoin_callback){ + this.guildjoin_callback){ this.guildjoin_callback(data[2], data[3], data[4], data[5]);//name, (id, (guildId, guildName)) } else if( (data[1] === Types.Messages.GUILDACTION.LEAVE) && @@ -540,39 +540,39 @@ define(['player', 'entityfactory', 'lib/bison'], function(Player, EntityFactory, onGuildError: function(callback) { this.guilderror_callback = callback; }, - + onGuildCreate: function(callback) { this.guildcreate_callback = callback; }, - + onGuildInvite: function(callback) { this.guildinvite_callback = callback; }, - + onGuildJoin: function(callback) { this.guildjoin_callback = callback; }, - + onGuildLeave: function(callback) { this.guildleave_callback = callback; }, - + onGuildTalk: function(callback) { this.guildtalk_callback = callback; }, - + onMemberConnect: function(callback) { this.guildmemberconnect_callback = callback; }, - + onMemberDisconnect: function(callback) { this.guildmemberdisconnect_callback = callback; }, - + onReceiveGuildMembers: function(callback) { this.guildonlinemembers_callback = callback; }, - + onGuildPopulation: function(callback) { this.guildpopulation_callback = callback; }, @@ -672,28 +672,28 @@ define(['player', 'entityfactory', 'lib/bison'], function(Player, EntityFactory, this.sendMessage([Types.Messages.CHECK, id]); }, - + sendWho: function(ids) { ids.unshift(Types.Messages.WHO); this.sendMessage(ids); }, - + sendNewGuild: function(name) { this.sendMessage([Types.Messages.GUILD, Types.Messages.GUILDACTION.CREATE, name]); }, - + sendGuildInvite: function(invitee) { this.sendMessage([Types.Messages.GUILD, Types.Messages.GUILDACTION.INVITE, invitee]); }, - + sendGuildInviteReply: function(guild, answer) { this.sendMessage([Types.Messages.GUILD, Types.Messages.GUILDACTION.JOIN, guild, answer]); }, - + talkToGuild: function(message){ this.sendMessage([Types.Messages.GUILD, Types.Messages.GUILDACTION.TALK, message]); }, - + sendLeaveGuild: function(){ this.sendMessage([Types.Messages.GUILD, Types.Messages.GUILDACTION.LEAVE]); } diff --git a/client/js/lib/css3-mediaqueries.js b/client/js/lib/css3-mediaqueries.js index 1ea806dd7..76bc26048 100644 --- a/client/js/lib/css3-mediaqueries.js +++ b/client/js/lib/css3-mediaqueries.js @@ -776,4 +776,4 @@ document.execCommand("BackgroundImageCache",false,true); } catch(e){ } - + diff --git a/package.json b/package.json index 59d209145..0fcde6fea 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "type": "git", "url": "https://github.com/browserquest/BrowserQuest.git" }, + "license": "LicenseRef-LICENSE", "version": "0.0.1", "dependencies": { "bcrypt": ">=0", diff --git a/server/config_local.json-dist b/server/config_local.json-dist index f338eb35e..5f0e3e6d6 100644 --- a/server/config_local.json-dist +++ b/server/config_local.json-dist @@ -5,4 +5,4 @@ "nb_worlds": 5, "map_filepath": "./server/maps/world_server.json", "metrics_enabled": false -} \ No newline at end of file +} diff --git a/server/js/main.js b/server/js/main.js index 16ef52b6c..71fea1bef 100644 --- a/server/js/main.js +++ b/server/js/main.js @@ -129,8 +129,8 @@ function getConfigFile(path, callback) { }); } -var defaultConfigPath = './server/config.json'; -var customConfigPath = './server/config_local.json'; +var defaultConfigPath = __dirname + '/../config.json'; +var customConfigPath = __dirname + '/../config_local.json'; process.argv.forEach(function (val, index, array) { if(index === 2) { diff --git a/server/js/ws.js b/server/js/ws.js index e82b6114a..021268e88 100644 --- a/server/js/ws.js +++ b/server/js/ws.js @@ -115,6 +115,7 @@ WS.WebsocketServer = Server.extend({ // Generate (on the fly) the pages needing special treatment app.use(function handleDynamicPageRequests(request, response) { var path = url.parse(request.url).pathname; + console.log("DEY WANT A PATH: ", path); switch (path) { case '/status': // The server status page @@ -210,7 +211,9 @@ WS.WebsocketServer = Server.extend({ }); } - this._ioServer = new socketio(this._httpServer); +console.log(socketio); + + this._ioServer = new socketio(this._httpServer, {path: '/browserquest'}); this._ioServer.on('connection', function webSocketListener(socket) { log.info('Client socket connected from ' + socket.conn.remoteAddress); // Add remoteAddress property