Skip to content

Commit

Permalink
set up file structure for treasure hunt remake
Browse files Browse the repository at this point in the history
  • Loading branch information
mngmay committed Feb 13, 2020
1 parent eb91108 commit 706e81a
Show file tree
Hide file tree
Showing 31 changed files with 30,447 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# keys
.env

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
14,150 changes: 14,150 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "treasure-hunt",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"axios": "^0.19.2",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-scripts": "3.3.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Binary file added public/favicon.ico
Binary file not shown.
39 changes: 39 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Explore a world full of treasures" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Treasure Hunt</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
25 changes: 25 additions & 0 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
3 changes: 3 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
7 changes: 7 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from "react";

function App() {
return <div className="App">Treasure Hunt!</div>;
}

export default App;
1 change: 1 addition & 0 deletions src/actions/general.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// examine, take, drop, sell
3 changes: 3 additions & 0 deletions src/actions/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "./general";
export * from "./mining";
export * from "./movement";
1 change: 1 addition & 0 deletions src/actions/mining.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// get last proof, mine (submits proof), get balance
Empty file added src/actions/movement.js
Empty file.
9 changes: 9 additions & 0 deletions src/contexts/StateContext.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React, { createContext, useReducer } from "react";

export const StateContext = createContext();

export const StateProvider = ({ reducer, initialState, children }) => (
<StateContext.Provider value={useReducer(reducer, initialState)}>
{children}
</StateContext.Provider>
);
4 changes: 4 additions & 0 deletions src/hooks/useStateValue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { useContext } from "react";
import { StateContext } from "../contexts/StateContext";

export const useStateValue = () => useContext(StateContext);
13 changes: 13 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
6 changes: 6 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";

ReactDOM.render(<App />, document.getElementById("root"));
8 changes: 8 additions & 0 deletions src/reducers/gameReducer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {} from "../actions";

export const gameReducer = (state, { type, payload }) => {
switch (type) {
default:
return state;
}
};
6 changes: 6 additions & 0 deletions src/reducers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export * from "./rootReducer";
export * from "./initialState";
export * from "./miningReducer";
export * from "./playerReducer";
export * from "./gameReducer";
export * from "./itemReducer";
60 changes: 60 additions & 0 deletions src/reducers/initialState.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
export const initialState = {
// status endpoint impacts player
playerState: {
name: "", // status
encumbrance: 0, //How much are you carrying?
strength: 10, //How much can you carry?
speed: 10, //How fast do you travel?
gold: 0,
bodywear: null,
footwear: null,
inventory: [],
abilities: [], // abilities like fly, dash, carry
status: [],
has_mined: false,
messages: [],
errors: [],
cooldown: null,
snitches: 0,
isLoading: false
},
gameState: {
room_id: 0,
title: "",
description: "",
coordinates: "",
exits: [],
cooldown: 1.0,
errors: [],
messages: [],
elevation: 0,
terrain: "",
players: [],
items: [],
isLoading: false,
coins: 0
},
miningState: {
index: 0,
transactions: "",
proof: 0,
previous_hash: "",
cooldown: 0,
messages: [],
errors: [],
difficulty: 0
},
// occurs only if someone examines a specific item
itemState: {
name: "",
description: "",
weight: 0,
itemtype: "",
level: 0,
exp: 0,
attributes: "",
cooldown: 0,
errors: [],
messages: []
}
};
8 changes: 8 additions & 0 deletions src/reducers/itemReducer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {} from "../actions";

export const itemReducer = (state, { type, payload }) => {
switch (type) {
default:
return state;
}
};
8 changes: 8 additions & 0 deletions src/reducers/miningReducer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {} from "../actions";

export const miningReducer = (state, { type, payload }) => {
switch (type) {
default:
return state;
}
};
9 changes: 9 additions & 0 deletions src/reducers/playerReducer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {} from "../actions";

export const playerReducer = (state, { type, payload }) => {
// status endpoint
switch (type) {
default:
return state;
}
};
16 changes: 16 additions & 0 deletions src/reducers/rootReducer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {
gameReducer,
playerReducer,
itemReducer,
miningReducer
} from "./index";

export const rootReducer = (
{ gameState, playerState, itemState, miningState },
action
) => ({
gameState: gameReducer(gameState, action),
playerState: playerReducer(playerState, action),
itemState: itemReducer(itemState, action),
miningState: miningReducer(miningState, action)
});
1 change: 1 addition & 0 deletions src/util/autoGold.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// automatically traverse, pick up, go back to shop, sell treasures
1 change: 1 addition & 0 deletions src/util/autoMining.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// auto go to well, examine, decode, go to room, get last proof, find valid proof, submit proof
1 change: 1 addition & 0 deletions src/util/autoSnitching.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// be in darkworld, go to well, examine, decode, go to room, grab snitch
13 changes: 13 additions & 0 deletions src/util/axiosWIthAuth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import axios from "axios";

export const axiosWithAuth = () => {
return axios.create({
headers: {
"Content-Type": "application/json",
Authorization: `Token ${process.env.REACT_APP_KEY}`
// Authorization: `Token ${process.env.REACT_APP_TEST_KEY}`
},
baseURL: "https://lambda-treasure-hunt.herokuapp.com/api/"
// baseURL: "http://127.0.0.1:8000/api/"
});
};
Loading

0 comments on commit 706e81a

Please sign in to comment.