Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
3464d64
Create find-strat.node.js
Spaceface16518 Jan 12, 2018
a4098bf
Create strats.csv
Spaceface16518 Jan 12, 2018
c0d10ca
Update strats.csv
Spaceface16518 Jan 12, 2018
9b7e3f5
Added header
Spaceface16518 Jan 12, 2018
52e0470
Removed python find strat file
Spaceface16518 Jan 12, 2018
e7a2c62
renamed strats to strats-table
Spaceface16518 Jan 12, 2018
84c08a4
Transfered strats from text file to table (csv) file
Spaceface16518 Jan 12, 2018
bfcb7c0
create strats database file
Spaceface16518 Jan 12, 2018
0246820
Added sqlite3-node file skeleton
Spaceface16518 Jan 12, 2018
d2b7384
Rename strats table to strats
Spaceface16518 Jan 12, 2018
1b460ae
delete strats database
Spaceface16518 Jan 12, 2018
4aa3dd5
renamed find-strat to fetch (module
Spaceface16518 Jan 12, 2018
050dfa9
Added support for write module
Spaceface16518 Jan 12, 2018
3d5566b
Added random number and write modules
Spaceface16518 Jan 12, 2018
91148b5
added highest id node module
Spaceface16518 Jan 12, 2018
2fde799
added better import statements
Spaceface16518 Jan 12, 2018
ca7cb3a
replaced python function with new fetch strat node function
Spaceface16518 Jan 12, 2018
d37a758
Update and rename strats.csv to strats.tsv
Spaceface16518 Jan 12, 2018
14fcc0b
Update strats.tsv
Spaceface16518 Jan 12, 2018
bd45b17
Update strats.tsv
Spaceface16518 Jan 12, 2018
836d38a
Rename LICENSE to LICENSE.txt
Spaceface16518 Jan 12, 2018
929b0e2
Remove strats tsv
Spaceface16518 Jan 13, 2018
bb5904f
Changed database location
Spaceface16518 Jan 13, 2018
ea11214
Initial fetch function completed
Spaceface16518 Jan 13, 2018
092104d
Create strats.db
Spaceface16518 Jan 14, 2018
8f8feae
Corrected database startup statement
Spaceface16518 Jan 14, 2018
44011ae
Fixed error message in highest ID module
Spaceface16518 Jan 14, 2018
1ee611e
Write module: added and exported clear function
Spaceface16518 Jan 14, 2018
f71550a
add support for clear function.
Spaceface16518 Jan 14, 2018
0c319e0
Format corrected
Spaceface16518 Jan 14, 2018
2a9c14e
Add cvs>database websit
Spaceface16518 Jan 15, 2018
89c774e
Patched spelling error from last commit
Spaceface16518 Jan 15, 2018
06eace7
Rename index.html to src/index.html
Spaceface16518 Jan 24, 2018
295320c
Rename main.js to src/index.js
Spaceface16518 Jan 24, 2018
007447c
Rename style.css to assets/css/index.css
Spaceface16518 Jan 24, 2018
cf775c9
Rename data/strats.db to assets/data/strats.db
Spaceface16518 Jan 24, 2018
94d3d8b
Rename modules/Fetch.js to assets/modules/Fetch.js
Spaceface16518 Jan 24, 2018
7c85bbc
Rename modules/HighestID.js to assets/modules/HighestID.js
Spaceface16518 Jan 24, 2018
1f3e58e
Rename modules/RandNum.js to assets/modules/RandNum.js
Spaceface16518 Jan 24, 2018
a24cf77
Rename modules/Write.js to assets/modules/Write.js
Spaceface16518 Jan 24, 2018
74cc84e
Added electron skeleton
Spaceface16518 Jan 24, 2018
3ff6d43
Fixed script and stylesheet souces
Spaceface16518 Jan 24, 2018
899eeb2
Remove internal css page
Spaceface16518 Jan 29, 2018
0a4ba16
Update strats database
Spaceface16518 Jan 29, 2018
efbd31e
Fix sqlite import
Spaceface16518 Jan 29, 2018
471ef55
Remove Electron skeleton
Spaceface16518 Jan 29, 2018
1375230
Implement w3.css on current objects
Spaceface16518 Jan 29, 2018
519369e
Import statments on one line
Spaceface16518 Jan 29, 2018
6cfe316
Add button click detectors
Spaceface16518 Jan 29, 2018
9af9a4d
Add return value to fetch function
Spaceface16518 Jan 29, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE → LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ 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.
SOFTWARE.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Strat-Roulette

A roulette style game type picker for FPS games.

[Here](http://www.sqlitetutorial.net/sqlite-import-csv/) is a website explaining how to upload `csv` into a database.
Empty file added assets/css/index.css
Empty file.
Binary file added assets/data/strats.db
Binary file not shown.
28 changes: 28 additions & 0 deletions assets/modules/Fetch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module.exports.fetchStrat = (paramID) => {
const sqlite = require('sqlite');
let id = paramID;
let db = new sqlite.Database('../data/strats.db', (err) => {
if (err) {
console.error(err);
}
console.log("Connected to the Strats Database")
});

db.serialize((id) => {
db.get('SELECT * FROM Strats WHERE id === $ID_place_holder', {
$ID_place_holder: id
}, (err, rows) => {
if (err) {
console.error(err);
}
return rows;
})
})

db.close((err) => {
if (err) {
console.error(err.message);
}
console.log('Disconnected from the Strats Database');
});
}
23 changes: 23 additions & 0 deletions assets/modules/HighestID.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports.getHighestID = () => {
const sqlite = require('sqlite');
let db = new sqlite.Database('../data/strats.db', (err) => {
if (err) {
console.error(err);
}
console.log("Connected to the Strats Database")
});

db.get('SELECT MAX(id) AS max_id FROM Strats', (err, row) => {
if (err) {
console.error(err);
}
return row.max_id;
})

db.close((err) => {
if (err) {
console.error(err);
}
console.log('Disconnected from the Strats Database');
});
}
14 changes: 14 additions & 0 deletions assets/modules/RandNum.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
generateRandNum = (min, max) => {
let randomNumber = Math.round((max - min) * Math.random() + min);
return randomNumber;
}

testConnection = () => {
console.log("Connection confirmed: RandNum")
}


export {
generateRandNum,
testConnection
};
17 changes: 17 additions & 0 deletions assets/modules/Write.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
write = (text) => {
$(".write-WriteTo").text(text);
console.log("Write: " + "\"" + text + "\" " + "was written on the page");
}
testConnection = () => {
console.log("Connection confirmed: Write")
}
clear = () => {
let html = $(".write-WriteTo").html()
$(".write-WriteTo").text("");
console.log("Write: " + "Cleared " + html)
}
export {
write,
testConnection,
clear
}
3 changes: 0 additions & 3 deletions data/strats.txt

This file was deleted.

14 changes: 0 additions & 14 deletions find-strat.py

This file was deleted.

20 changes: 0 additions & 20 deletions main.js

This file was deleted.

14 changes: 5 additions & 9 deletions index.html → src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,17 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Strat Roulette</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="style.css" />
<link rel="stylesheet" type="text/css" href="../assets/css/index.css" />
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<script src="main.js"></script>
<script src="./index.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!--
<script src="https://gist.github.com/Spaceface16518/f91d67bf0745cead14dc6f81d015e187.js"></script>
I'm not sure if I need this or not
-->
</head>

<body>
<button type="button" id="chooseButton">Display a new strat</button>
<button type="button" id="chooseButton" class="w3-btn w3-black">Display a new strat</button>
</br>
<button type="button" id="resetButton">Clear</button>
<div id="strat"></div>
<button type="button" id="resetButton" class="w3-btn w3-black">Clear</button>
<div class="write-writeTo w3-panel w3-blue"></div>
</body>

</html>
34 changes: 34 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { write, testConnection, clear } from "../assets/modules/Write.js";
import { generateRandNum, testConnection } from "../assets/modules/RandNum.js";
const fetch = require("./modules/Fetch.js");
const highestID = require("./modules/HighestID.js")

function fetchStrat() {
let highestID = highestID.getHighestID();
let id = generateRandNum(1, highestID);
let strat = fetch.fetchStrat(id)
return strat
}

function displayStrat(strat) {
console.log("Displaying strat: " + strat);
write(strat)
}

function clearStrat() {
clear()
}

$(document).ready(function(){
$("#chooseButton").click(function(){
console.log("Choose button clicked")
let strat = fetchStrat();
displayStrat(strat);
});
$("#resetButton").click(function(){
console.log("reset button clicked");
clearStrat();
});
})

console.log("Init")
11 changes: 0 additions & 11 deletions style.css

This file was deleted.