diff options
author | munvoseli <60828599+munvoseli@users.noreply.github.com> | 2023-06-10 09:05:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-10 09:05:51 -0400 |
commit | fb8300d51afad21fb307422f54f150ba98dcd5e3 (patch) | |
tree | c8a1452fed05e21c9b6fb09dd765090246c0af9a | |
parent | 5d116c1e8237636a7ffba7cdcb1c83b1c3af00c6 (diff) | |
parent | 54c282a5a52b73cda4208826b9cdd8350eb88746 (diff) |
Merge branch 'ostracod:master' into master
-rw-r--r-- | LICENSE | 21 | ||||
-rw-r--r-- | package.json | 4 | ||||
-rw-r--r-- | utils/game.js | 18 |
3 files changed, 37 insertions, 6 deletions
@@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 John Eisenmann and other contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/package.json b/package.json index 1230445..204e90f 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "start": "node breadQuest.js" }, "dependencies": { - "bcrypt": "^2.0.1", + "bcrypt": "^5.0.0", "body-parser": "~1.17.1", "cookie-parser": "~1.4.3", "debug": "~2.6.3", @@ -14,7 +14,7 @@ "express-session": "^1.15.2", "express-ws": "^4.0.0", "jade": "~1.11.0", - "morgan": "~1.8.1", + "morgan": "~1.10.0", "mustache-express": "^1.2.4", "rootpath": "^0.1.2", "serve-favicon": "~2.4.2" diff --git a/utils/game.js b/utils/game.js index 0f27dcf..4f91131 100644 --- a/utils/game.js +++ b/utils/game.js @@ -357,6 +357,10 @@ function addSetGuidelinePosCommand(player, commandList) { }); } +function isDirection(direction) { + return (direction === 0 || direction === 1 || direction === 2 || direction === 3); +} + function performStartPlayingCommand(command, player, commandList, done, errorHandler) { accountUtils.acquireLock(function() { accountUtils.findAccountByUsername(player.username, function(error, index, result) { @@ -386,7 +390,8 @@ function performGetTilesCommand(command, player, commandList) { } function performWalkCommand(command, player, commandList) { - player.walk(command.direction); + if (isDirection(command.direction)) + player.walk(command.direction); } function performAssertPosCommand(command, player, commandList) { @@ -455,7 +460,8 @@ function performGetOnlinePlayersCommand(command, player, commandList) { } function performRemoveTileCommand(command, player, commandList) { - player.removeTile(command.direction); + if (isDirection(command.direction)) + player.removeTile(command.direction); } function performGetInventoryChangesCommand(command, player, commandList) { @@ -466,6 +472,8 @@ function performGetInventoryChangesCommand(command, player, commandList) { } function performPlaceTileCommand(command, player, commandList) { + if (!isDirection(command.direction)) + return; var tempResult = player.placeTile(command.direction, command.tile); if (!tempResult) { addSetInventoryCommand(player.inventory, commandList); @@ -473,7 +481,8 @@ function performPlaceTileCommand(command, player, commandList) { } function performCollectTileCommand(command, player, commandList) { - player.collectTile(command.direction); + if (isDirection(command.direction)) + player.collectTile(command.direction); } function performGetRespawnPosChangesCommand(command, player, commandList) { @@ -499,7 +508,8 @@ function performGetAvatarChangesCommand(command, player, commandList) { } function performPlaceSymbolTileCommand(command, player, commandList) { - player.placeSymbolTile(command.tile); + if (typeof(command.tile) == "number") + player.placeSymbolTile(command.tile); } function performSetGuidelinePosCommand(command, player, commandList) { |