This commit is contained in:
ntr
2018-11-29 20:19:17 +11:00
parent 0dd96ae961
commit 38af55aacd
6 changed files with 85 additions and 82 deletions
+36 -36
View File
@@ -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()
}
+4 -4
View File
@@ -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<u8>, tx: &mut Transaction, account: Account, _client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
fn account_items(_data: Vec<u8>, tx: &mut Transaction, account: Account, _client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
Ok(RpcResponse {
method: "item_list".to_string(),
method: "account_items".to_string(),
params: RpcResult::ItemList(items_list(tx, &account)?)
})
}