diff --git a/README.md b/README.md index a55eb54..070a55b 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,28 @@ # Much-Assembly-Required-Frontend Files for https://muchassemblyrequired.com/ frontend. -Requires a PHP environnment and a MySQL server (Database installation script: [database.sql](https://github.com/simon987/Much-Assembly-Required-Frontend/blob/master/database.sql)). +Requires a PHP environnment and a MySQL server (Database installation script: [database.sql](https://github.com/simon987/Much-Assembly-Required-Frontend/blob/master/database.sql)). + +Easiest way to configure the database: +```bash +$ pwd +~/Much-Assembly-Required-Frontend/ +$ mysql -u root -p +Enter password: # type your MySQL root user password + +MariaDB [(none)]> +MariaDB [(none)]> CREATE DATABASE mar; +MariaDB [(none)]> GRANT ALL PRIVILEGES ON mar.* to 'mar'@'localhost' identified by 'mar'; +MariaDB [(none)]> FLUSH PRIVILEGES; +MariaDB [(none)]> USE mar; +MariaDB [mar]> \. database.sql +MariaDB [(none)]> exit +Bye +$ # if '\. database.sql' failed you were not in the right directory. make sure you are in the repo root directory +$ # before running these commands +``` Make sure to change the configuration in /include/config.php. +> Tough if you used the snippet above there is nothing to change (except the title if you want) More information about the game [here.](https://github.com/simon987/Much-Assembly-Required) HTML template by ajlkn diff --git a/mar/editor.js b/mar/editor.js index 8fe5b21..f88dcd5 100644 --- a/mar/editor.js +++ b/mar/editor.js @@ -257,7 +257,7 @@ function parseInstruction(line, result, currentLine) { if (!parseDWInstruction(line, result, currentLine)) { if (new RegExp('\\b(?:mov|add|sub|and|or|test|cmp|shl|shr|mul|push|pop|div|xor|hwi|hwq|nop|neg|' + - 'call|ret|jmp|jnz|jg|jl|jge|jle|int|jz|js|jns|brk|not|jc|jnc|ror|rol|sal|sar)\\b').test(mnemonic.toLowerCase())) { + 'call|ret|jmp|jnz|jg|jl|jge|jle|int|jz|js|jns|brk|not|jc|jnc|ror|rol|sal|sar|jo|jno)\\b').test(mnemonic.toLowerCase())) { if (line.indexOf(",") !== -1) { @@ -315,7 +315,7 @@ function parseInstruction(line, result, currentLine) { strO1 = line.substring(line.indexOf(mnemonic) + mnemonic.length).trim(); //Validate operand number - if (!new RegExp('\\b(?:push|mul|pop|div|neg|call|jnz|jg|jl|jge|jle|hwi|hwq|jz|js|jns|ret|jmp|not|jc|jnc)\\b').test(mnemonic.toLowerCase())) { + if (!new RegExp('\\b(?:push|mul|pop|div|neg|call|jnz|jg|jl|jge|jle|hwi|hwq|jz|js|jns|ret|jmp|not|jc|jnc|jo|jno)\\b').test(mnemonic.toLowerCase())) { result.annotations.push({ row: currentLine, column: 0, @@ -404,4 +404,4 @@ function editorClick() { document.getElementById("gameBtns").setAttribute("style", "display: none"); } -editor.on("change", parse); \ No newline at end of file +editor.on("change", parse); diff --git a/mar/editor.min.js b/mar/editor.min.js index 2c3ddcf..0898478 100644 --- a/mar/editor.min.js +++ b/mar/editor.min.js @@ -10,8 +10,8 @@ function parseDWInstruction(a,c,b){a=a.trim();if("dw"===a.substr(0,2).toLowerCas column:0,text:"Usage: DW IMM, IMM ...",type:"error"});break}}return!0}return!1} function getOperandType(a,c){a=a.trim();if(""===a)return OPERAND_INVALID;if(!isNaN(Number(a))&&Number(a)===Math.floor(Number(a))&&-1===a.indexOf("o")&&-1===a.indexOf("e"))return OPERAND_IMM;if(/^(a|b|c|d|x|y|bp|sp)$/.test(a.toLowerCase()))return OPERAND_REG;for(b=0;b= 40) { + + //Split the line... + var subLines = lines[i].match(/.{1,40}/g); + + for (var j = 0; j < subLines.length; j++) { + + //Don't put a newline at the end + if (j !== subLines.length - 1) { + tmpBuffer += "\n"; + } + } + + } else { + tmpBuffer += lines[i] + "\n"; + } + } + + myConsole.innerHTML = tmpBuffer; + mar.lastLines = str; + + //Autoscroll + myConsole.scrollTop = myConsole.scrollHeight; + } } } diff --git a/mar/phaser/mar.min.js b/mar/phaser/mar.min.js index 01c08f3..9edf3f8 100644 --- a/mar/phaser/mar.min.js +++ b/mar/phaser/mar.min.js @@ -1,36 +1,37 @@ -DIR_NORTH=0;DIR_EAST=1;DIR_SOUTH=2;DIR_WEST=3;WORLD_HEIGHT=WORLD_WIDTH=16;var colorScheme={tileTint:16777215,wallTint:14540253,cubotHoverTint:65280,cubotTint:16777215,textFill:"#FFFFFF",textStroke:"#9298a8",biomassTint:6535263,biomassHoverTint:65280,tileHoverTint:65280,itemIron:4408129,itemCopper:13139256,hologramFill:"#0aced6",hologramStroke:"#12FFB0",hologramAlpha:.9},mar={kbBuffer:[],kbBufferText:"",animationFrames:{},controlledUnitVisible:!1};CUBOT_WALK_FRAMES={south:240,north:194,west:254,east:164}; -HARVESTER_WALK_FRAMES={south:347,north:317,west:377,east:287};LOW_ENERGY=100;fullscreen?(RENDERER_WIDTH=window.innerWidth-4,RENDERER_HEIGHT=window.innerHeight-4):(RENDERER_WIDTH=document.getElementById("game").clientWidth,RENDERER_HEIGHT=window.innerHeight/1.25);var game=new Phaser.Game(RENDERER_WIDTH,RENDERER_HEIGHT,Phaser.AUTO,"game",null,!0,!1); +DIR_NORTH=0;DIR_EAST=1;DIR_SOUTH=2;DIR_WEST=3;WORLD_HEIGHT=WORLD_WIDTH=16;var colorScheme={tileTint:16777215,wallTint:14540253,cubotHoverTint:65280,cubotTint:16777215,textFill:"#FFFFFF",textStroke:"#9298a8",biomassTint:6535263,biomassHoverTint:65280,tileHoverTint:65280,itemIron:4408129,itemCopper:13139256,hologramFill:"#0aced6",hologramStroke:"#12FFB0",hologramAlpha:.9},mar={kbBuffer:[],kbBufferText:"",animationFrames:{},controlledUnitVisible:!1,lastLines:""}; +CUBOT_WALK_FRAMES={south:240,north:194,west:254,east:164};HARVESTER_WALK_FRAMES={south:347,north:317,west:377,east:287};LOW_ENERGY=100;fullscreen?(RENDERER_WIDTH=window.innerWidth-4,RENDERER_HEIGHT=window.innerHeight-4):(RENDERER_WIDTH=document.getElementById("game").clientWidth,RENDERER_HEIGHT=window.innerHeight/1.25);var game=new Phaser.Game(RENDERER_WIDTH,RENDERER_HEIGHT,Phaser.AUTO,"game",null,!0,!1); function dispatchTileLeave(a,b){for(var c=0;c=a.keyCode||116===a.keyCode||32===a.keyCode)&&a.preventDefault(),"guest"!==mar.client.username&&16>=mar.kbBuffer.length&&(mar.client.sendKeypress(a.keyCode), mar.kbBuffer.push(a.keyCode),mar.kbBufferText=formattedKeyBuffer(mar.kbBuffer)))},game.input.onDown.add(function(){document.getElementById("game").focus()})))}function objectListener(a){"object"===a.t&&mar.world.updateObjects(a.objects)}function floppyListener(a){document.getElementById("floppyDown").innerHTML=' ';a=new Blob([a.data],{type:"application/octet-stream"});saveAs(a,"floppy.bin")} -function tickListener(a){"tick"===a.t&&(mar.client.socket.send(JSON.stringify({t:"object",x:mar.worldX,y:mar.worldY})),void 0!==a.keys&&(mar.kbBuffer=a.keys,mar.kbBufferText=formattedKeyBuffer(mar.kbBuffer)))} +function tickListener(a){if("tick"===a.t){mar.client.socket.send(JSON.stringify({t:"object",x:mar.worldX,y:mar.worldY}));void 0!==a.keys&&(mar.kbBuffer=a.keys,mar.kbBufferText=formattedKeyBuffer(mar.kbBuffer));var b=document.getElementById("console");0===a.cm&&(b.innerHTML="",mar.lastLines="");if(void 0!==a.c){for(var c=mar.lastLines,d=0;d 20) { $msg->setCookie(); header("Location: login.php#register"); -} else if (strlen($password) < 8 || strlen($password) > 32) { +} else if (strlen($password) < 8 || strlen($password) > 96) { - (new MessageCookie("Password must be 8-32 characters", "register"))->setCookie(); + (new MessageCookie("Password must be 8-96 characters", "register"))->setCookie(); header("Location: login.php#register"); } else {