diff --git a/server/WORKLOG.md b/server/WORKLOG.md index 7510c68a..3f970e8a 100644 --- a/server/WORKLOG.md +++ b/server/WORKLOG.md @@ -13,6 +13,8 @@ cost system for items design / implement specs combo specs round system for games + add cryps to player + find opponent or do pve ## SOON * clean up categories diff --git a/server/src/account.rs b/server/src/account.rs index 14ab4a68..23e21af0 100644 --- a/server/src/account.rs +++ b/server/src/account.rs @@ -11,7 +11,7 @@ use rpc::{AccountCreateParams, AccountLoginParams}; use cryp::{Cryp, CrypRecover, cryp_write, cryp_recover}; use game::Game; -use zone::{Zone, zone_delete}; +// use zone::{Zone, zone_delete}; use skill::{Skill}; use failure::Error; @@ -205,33 +205,33 @@ pub fn account_game_history(tx: &mut Transaction, account: &Account) -> Result Result { - let query = " - SELECT * - FROM zones - WHERE account = $1 - AND active = true; - "; +// pub fn account_zone(tx: &mut Transaction, account: &Account) -> Result { +// let query = " +// SELECT * +// FROM zones +// WHERE account = $1 +// AND active = true; +// "; - let result = tx - .query(query, &[&account.id])?; +// let result = tx +// .query(query, &[&account.id])?; - let returned = match result.iter().next() { - Some(row) => row, - None => return Err(err_msg("no active zone")), - }; +// let returned = match result.iter().next() { +// Some(row) => row, +// None => return Err(err_msg("no active zone")), +// }; - // tells from_slice to cast into a cryp - let bytes: Vec = returned.get("data"); - let zone = match from_slice::(&bytes) { - Ok(z) => z, - Err(_) => { - zone_delete(tx, returned.get("id"))?; - return Err(err_msg("invalid zone removed")) - }, - }; +// // tells from_slice to cast into a cryp +// let bytes: Vec = returned.get("data"); +// let zone = match from_slice::(&bytes) { +// Ok(z) => z, +// Err(_) => { +// zone_delete(tx, returned.get("id"))?; +// return Err(err_msg("invalid zone removed")) +// }, +// }; - return Ok(zone); -} +// return Ok(zone); +// } diff --git a/server/src/game.rs b/server/src/game.rs index 1f6e115f..3583ef6d 100644 --- a/server/src/game.rs +++ b/server/src/game.rs @@ -11,7 +11,7 @@ use account::Account; use rpc::{GameStateParams, GameSkillParams, GamePveParams}; use cryp::{Cryp, cryp_get}; use skill::{Skill, Cast, ResolutionResult}; -use zone::{node_finish}; +// use zone::{node_finish}; use mob::{generate_mob_team}; pub type Log = Vec; @@ -659,13 +659,13 @@ pub fn game_update(game: &Game, tx: &mut Transaction) -> Result<(), Error> { result.iter().next().ok_or(format_err!("game {:?} could not be written", game))?; - if game.finished() { - // check for zone update - if let Some((z, i)) = game.zone { - node_finish(game, z, i, tx)?; - } + // if game.finished() { + // // check for zone update + // if let Some((z, i)) = game.zone { + // node_finish(game, z, i, tx)?; + // } - } + // } return Ok(()); } diff --git a/server/src/main.rs b/server/src/main.rs index 1391afdb..9b43995c 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -5,7 +5,7 @@ extern crate env_logger; extern crate bcrypt; extern crate dotenv; -extern crate petgraph; +// extern crate petgraph; extern crate postgres; extern crate r2d2; extern crate r2d2_postgres; @@ -28,7 +28,7 @@ mod rpc; mod account; mod instance; mod player; -mod zone; +// mod zone; mod mob; mod vbox; diff --git a/server/src/rpc.rs b/server/src/rpc.rs index 33e0237d..f7310ea3 100644 --- a/server/src/rpc.rs +++ b/server/src/rpc.rs @@ -17,9 +17,9 @@ use failure::err_msg; use net::Db; use cryp::{Cryp, cryp_spawn, cryp_learn}; use game::{Game, game_state, game_pve, game_skill}; -use account::{Account, account_create, account_login, account_from_token, account_cryps, account_zone}; +use account::{Account, account_create, account_login, account_from_token, account_cryps}; use skill::{Skill}; -use zone::{Zone, zone_create, zone_join, zone_close}; +// use zone::{Zone, zone_create, zone_join, zone_close}; use spec::{Spec}; use player::{player_state, player_create, player_cryps_set, Player}; use instance::{instance_join}; @@ -64,7 +64,7 @@ impl Rpc { // auth methods "account_cryps" => Rpc::account_cryps(data, &mut tx, account.unwrap(), client), - "account_zone" => Rpc::account_zone(data, &mut tx, account.unwrap(), client), + // "account_zone" => Rpc::account_zone(data, &mut tx, account.unwrap(), client), "cryp_spawn" => Rpc::cryp_spawn(data, &mut tx, account.unwrap(), client), @@ -72,9 +72,9 @@ impl Rpc { "game_pve" => Rpc::game_pve(data, &mut tx, account.unwrap(), client), "game_skill" => Rpc::game_skill(data, &mut tx, account.unwrap(), client), - "zone_create" => Rpc::zone_create(data, &mut tx, account.unwrap(), client), - "zone_join" => Rpc::zone_join(data, &mut tx, account.unwrap(), client), - "zone_close" => Rpc::zone_close(data, &mut tx, account.unwrap(), client), + // "zone_create" => Rpc::zone_create(data, &mut tx, account.unwrap(), client), + // "zone_join" => Rpc::zone_join(data, &mut tx, account.unwrap(), client), + // "zone_close" => Rpc::zone_close(data, &mut tx, account.unwrap(), client), "instance_join" => Rpc::instance_join(data, &mut tx, account.unwrap(), client), "player_state" => Rpc::player_state(data, &mut tx, account.unwrap(), client), @@ -220,45 +220,45 @@ impl Rpc { }) } - fn account_zone(_data: Vec, tx: &mut Transaction, account: Account, _client: &mut WebSocket) -> Result { - Ok(RpcResponse { - method: "zone_state".to_string(), - params: RpcResult::ZoneState(account_zone(tx, &account)?) - }) - } + // fn account_zone(_data: Vec, tx: &mut Transaction, account: Account, _client: &mut WebSocket) -> Result { + // Ok(RpcResponse { + // method: "zone_state".to_string(), + // params: RpcResult::ZoneState(account_zone(tx, &account)?) + // }) + // } - fn zone_create(_data: Vec, tx: &mut Transaction, account: Account, _client: &mut WebSocket) -> Result { - // let _msg = from_slice::(&data).or(Err(err_msg("invalid params")))?; + // fn zone_create(_data: Vec, tx: &mut Transaction, account: Account, _client: &mut WebSocket) -> Result { + // // let _msg = from_slice::(&data).or(Err(err_msg("invalid params")))?; - let response = RpcResponse { - method: "zone_state".to_string(), - params: RpcResult::ZoneState(zone_create(tx, &account)?) - }; + // let response = RpcResponse { + // method: "zone_state".to_string(), + // params: RpcResult::ZoneState(zone_create(tx, &account)?) + // }; - return Ok(response); - } + // return Ok(response); + // } - fn zone_join(data: Vec, tx: &mut Transaction, account: Account, _client: &mut WebSocket) -> Result { - let msg = from_slice::(&data).or(Err(err_msg("invalid params")))?; + // fn zone_join(data: Vec, tx: &mut Transaction, account: Account, _client: &mut WebSocket) -> Result { + // let msg = from_slice::(&data).or(Err(err_msg("invalid params")))?; - let response = RpcResponse { - method: "game_state".to_string(), - params: RpcResult::GameState(zone_join(msg.params, tx, &account)?) - }; + // let response = RpcResponse { + // method: "game_state".to_string(), + // params: RpcResult::GameState(zone_join(msg.params, tx, &account)?) + // }; - return Ok(response); - } + // return Ok(response); + // } - fn zone_close(data: Vec, tx: &mut Transaction, account: Account, _client: &mut WebSocket) -> Result { - let msg = from_slice::(&data).or(Err(err_msg("invalid params")))?; + // fn zone_close(data: Vec, tx: &mut Transaction, account: Account, _client: &mut WebSocket) -> Result { + // let msg = from_slice::(&data).or(Err(err_msg("invalid params")))?; - let response = RpcResponse { - method: "zone_close".to_string(), - params: RpcResult::ZoneClose(zone_close(msg.params, tx, &account)?) - }; + // let response = RpcResponse { + // method: "zone_close".to_string(), + // params: RpcResult::ZoneClose(zone_close(msg.params, tx, &account)?) + // }; - return Ok(response); - } + // return Ok(response); + // } fn instance_join(data: Vec, tx: &mut Transaction, account: Account, _client: &mut WebSocket) -> Result { let msg = from_slice::(&data).or(Err(err_msg("invalid params")))?; @@ -371,8 +371,8 @@ pub enum RpcResult { Account(Account), CrypList(Vec), GameState(Game), - ZoneState(Zone), - ZoneClose(()), + // ZoneState(Zone), + // ZoneClose(()), PlayerState(Player), }