diff --git a/client/index.html b/client/index.html
index 0b63e453..07bab8f1 100644
--- a/client/index.html
+++ b/client/index.html
@@ -1,12 +1,13 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ cryps.gg - mnml pvp tbs
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/client/src/events.js b/client/src/events.js
index 2405adaa..3e7a45d9 100644
--- a/client/src/events.js
+++ b/client/src/events.js
@@ -115,9 +115,9 @@ function registerEvents(registry, events) {
],
});
- const prompt = document.querySelector('#login'); // Selector of your toast
events.once('ACCOUNT', function closeLoginCb() {
- toast.hide({ transitionOut: 'fadeOut' }, prompt, 'event');
+ const prompt = document.querySelector('#login'); // Selector of your toast
+ if (prompt) toast.hide({ transitionOut: 'fadeOut' }, prompt, 'event');
});
}
diff --git a/client/src/socket.js b/client/src/socket.js
index 6a89e103..648ec9da 100644
--- a/client/src/socket.js
+++ b/client/src/socket.js
@@ -15,8 +15,6 @@ function errorToast(err) {
function createSocket(events) {
let ws;
- let gameStateTimeout;
-
function connect() {
ws = new WebSocket(SOCKET_URL);
ws.binaryType = 'arraybuffer';
@@ -29,7 +27,7 @@ function createSocket(events) {
});
events.loginPrompt();
- if (!process.env.NODE_ENV === 'production') {
+ if (process.env.NODE_ENV !== 'production') {
send({ method: 'account_login', params: { name: 'ntr', password: 'grepgrepgrep' } });
}
});
@@ -64,9 +62,9 @@ function createSocket(events) {
account = login;
events.setAccount(login);
- send({ method: 'account_cryps', params: {} });
- send({ method: 'item_list', params: {} });
- console.log(account);
+ sendAccountItems();
+ sendAccountCryps();
+ sendGameJoinableList();
}
function accountCryps(response) {
@@ -86,15 +84,13 @@ function createSocket(events) {
function crypSpawn(response) {
const [structName, cryp] = response;
- console.log('got a new cryp', cryp);
}
function gamePve(response) {
const [structName, game] = response;
- console.log('got a new game', game);
}
- function itemList(response) {
+ function accountItems(response) {
const [structName, items] = response;
events.setItems(items);
}
@@ -116,6 +112,14 @@ function createSocket(events) {
send({ method: 'account_create', params: { name, password } });
}
+ function sendAccountCryps() {
+ send({ method: 'account_cryps', params: {} });
+ }
+
+ function sendAccountItems() {
+ send({ method: 'account_items', params: {} });
+ }
+
function sendCrypSpawn(name) {
send({ method: 'cryp_spawn', params: { name } });
}
@@ -170,15 +174,6 @@ function createSocket(events) {
events.setActiveItem(null);
}
-
- // -------------
- // Events
- // -------------
-
- function clearGameStateInterval() {
- clearInterval(gameStateTimeout);
- }
-
// -------------
// Handling
// -------------
@@ -192,7 +187,7 @@ function createSocket(events) {
account_login: accountLogin,
account_create: accountLogin,
account_cryps: accountCryps,
- item_list: itemList,
+ account_items: accountItems,
};
// decodes the cbor and
@@ -201,7 +196,6 @@ function createSocket(events) {
// decode binary msg from server
const blob = new Uint8Array(event.data);
const res = cbor.decode(blob);
- console.log(res);
// check for error and split into response type and data
if (res.err) return errorToast(res.err);
@@ -211,9 +205,10 @@ function createSocket(events) {
}
return {
- clearGameStateInterval,
sendAccountLogin,
sendAccountCreate,
+ sendAccountCryps,
+ sendAccountItems,
sendGameState,
sendGamePve,
sendGamePvp,
diff --git a/server/WORKLOG.md b/server/WORKLOG.md
index 14975ed4..f46ed28c 100755
--- a/server/WORKLOG.md
+++ b/server/WORKLOG.md
@@ -1,3 +1,18 @@
+Pve needs to be good, not many players early on
+Randomly generated PVE graph to traverse with scattered rewards
+
+Two types of XP -> Skill xp and Cryp XP
+Skill XP allocates points in skill tree
+Cryp XP allocates points in Cryp passive tree
+
+Skills can be customised via skill tree
+
+Cryp obiendience a deteoriating bar (placeholder name)
+Cryps gain obedience when playing with you in PVE, PVP or using items
+Obedience drains over time
+Obedience drains faster when training / missions
+Having obedience is desirable for getting good rewards
+
# Principles
* Experience something
* Express something
@@ -11,13 +26,9 @@
* skills
* handle setting account better maybe?
- * ensure cryp untargetable and doesn't resolve when KO
- * remove all statuses etc when KO
* calculate
* hp increase/decrease
* private fields for opponents
- * attack
- * can you attack yourself?
* write players row for every team+cryp added
* return results<>
* defensive
@@ -26,8 +37,6 @@
*
* Items
- * unselect item with esc + button
- * Grid reroll
* Colour scheme
* Missions
@@ -38,8 +47,6 @@
* delete games when a cryp is deleted
* does this need to happen? can have historical games
-* run nginx as not root
-
# Art Styles
* Aztec
* youkai
diff --git a/server/src/main.rs b/server/src/main.rs
index a52e5dfd..0176a073 100755
--- a/server/src/main.rs
+++ b/server/src/main.rs
@@ -1,36 +1,36 @@
-extern crate rand;
-extern crate uuid;
-extern crate tungstenite;
-extern crate env_logger;
-extern crate bcrypt;
-
-extern crate dotenv;
-extern crate petgraph;
-extern crate postgres;
-extern crate r2d2;
-extern crate r2d2_postgres;
-
-extern crate serde;
-extern crate serde_cbor;
-#[macro_use]
-extern crate serde_derive;
-
-#[macro_use] extern crate failure;
-// #[macro_use] extern crate failure_derive;
-
-mod cryp;
-mod game;
-mod net;
-mod skill;
-mod passives;
-mod rpc;
-mod account;
-mod item;
-
-use dotenv::dotenv;
-use net::{start};
-
-fn main() {
- dotenv().ok();
- start()
-}
+extern crate rand;
+extern crate uuid;
+extern crate tungstenite;
+extern crate env_logger;
+extern crate bcrypt;
+
+extern crate dotenv;
+extern crate petgraph;
+extern crate postgres;
+extern crate r2d2;
+extern crate r2d2_postgres;
+
+extern crate serde;
+extern crate serde_cbor;
+#[macro_use]
+extern crate serde_derive;
+
+#[macro_use] extern crate failure;
+// #[macro_use] extern crate failure_derive;
+
+mod cryp;
+mod game;
+mod net;
+mod skill;
+mod passives;
+mod rpc;
+mod account;
+mod item;
+
+use dotenv::dotenv;
+use net::{start};
+
+fn main() {
+ dotenv().ok();
+ start()
+}
diff --git a/server/src/rpc.rs b/server/src/rpc.rs
index d2f91bb4..e8954b39 100755
--- a/server/src/rpc.rs
+++ b/server/src/rpc.rs
@@ -63,10 +63,10 @@ impl Rpc {
"game_skill" => Rpc::game_skill(data, &mut tx, account.unwrap(), client),
"game_target" => Rpc::game_target(data, &mut tx, account.unwrap(), client),
"account_cryps" => Rpc::account_cryps(data, &mut tx, account.unwrap(), client),
- "item_list" => Rpc::item_list(data, &mut tx, account.unwrap(), client),
+ "account_items" => Rpc::account_items(data, &mut tx, account.unwrap(), client),
"item_use" => Rpc::item_use(data, &mut tx, account.unwrap(), client),
- _ => Err(err_msg("unknown method")),
+ _ => Err(format_err!("unknown method - {:?}", v.method)),
};
tx.commit()?;
@@ -258,9 +258,9 @@ impl Rpc {
})
}
- fn item_list(_data: Vec, tx: &mut Transaction, account: Account, _client: &mut WebSocket) -> Result {
+ fn account_items(_data: Vec, tx: &mut Transaction, account: Account, _client: &mut WebSocket) -> Result {
Ok(RpcResponse {
- method: "item_list".to_string(),
+ method: "account_items".to_string(),
params: RpcResult::ItemList(items_list(tx, &account)?)
})
}