empty equip

This commit is contained in:
ntr 2019-05-21 11:32:44 +10:00
parent 2c532aa7d1
commit 246489c342
4 changed files with 34 additions and 26 deletions

View File

@ -26,6 +26,7 @@
.opponent { .opponent {
grid-area: opponent; grid-area: opponent;
transform: perspective(23rem);
} }
.opponent .combat-text { .opponent .combat-text {
@ -294,8 +295,18 @@ CRYP DAMAGE
position: relative; position: relative;
height: 100%; height: 100%;
min-width: 200px; min-width: 200px;
/*animation: rotate 1s infinite ease-in-out alternate;*/
} }
/*@keyframes rotate {
0% {
transform: rotateY(0deg);
}
100% {
transform: rotateY(50deg);
}
}
*/
.resolving .skills button { .resolving .skills button {
display: none; display: none;
} }

View File

@ -108,6 +108,9 @@ function Equipment(props) {
} return false; } return false;
}); });
if (skills.every(s => !s)) skills.push(<button disabled={true}>&nbsp;</button>);
if (specs.every(s => !s)) specs.push(<figure key={0}>&nbsp;</figure>);
return ( return (
<div className="equip" > <div className="equip" >
<div className={skillClass} onClick={e => unequipClick(e)} onMouseOver={e => hoverInfo(e, 'equipSkills')} > <div className={skillClass} onClick={e => unequipClick(e)} onMouseOver={e => hoverInfo(e, 'equipSkills')} >

View File

@ -9,8 +9,6 @@ use serde_cbor::{to_vec};
use std::env; use std::env;
use std::thread::{spawn, sleep}; use std::thread::{spawn, sleep};
use std::time::{Instant, Duration}; use std::time::{Instant, Duration};
use std::any::Any;
use std::panic;
use r2d2::{Pool}; use r2d2::{Pool};
use r2d2::{PooledConnection}; use r2d2::{PooledConnection};
@ -35,8 +33,8 @@ struct RpcErrorResponse {
err: String err: String
} }
fn receive(db: Db, rpc: &Rpc, msg: Message, client: &mut WebSocket<TcpStream>) -> Result<String, Error> { fn receive(db: Db, begin: Instant, rpc: &Rpc, msg: Message, client: &mut WebSocket<TcpStream>) -> Result<String, Error> {
match rpc.receive(msg, &db, client) { match rpc.receive(msg, begin, &db, client) {
Ok(reply) => { Ok(reply) => {
let response = to_vec(&reply) let response = to_vec(&reply)
.expect("failed to serialize response"); .expect("failed to serialize response");
@ -62,18 +60,18 @@ pub fn db_connection(url: String) -> Pool<PostgresConnectionManager> {
.expect("Failed to create pool.") .expect("Failed to create pool.")
} }
fn print_panic_payload(ctx: &str, payload: &(Any + Send + 'static)) { // fn print_panic_payload(ctx: &str, payload: &(Any + Send + 'static)) {
let d = format!("{:?}", payload); // let d = format!("{:?}", payload);
let s = if let Some(s) = payload.downcast_ref::<String>() { // let s = if let Some(s) = payload.downcast_ref::<String>() {
&s // &s
} else if let Some(s) = payload.downcast_ref::<&str>() { // } else if let Some(s) = payload.downcast_ref::<&str>() {
s // s
} else { // } else {
// "PAYLOAD IS NOT A STRING" // // "PAYLOAD IS NOT A STRING"
d.as_str() // d.as_str()
}; // };
info!("{}: PANIC OCCURRED: {}", ctx, s); // info!("{}: PANIC OCCURRED: {}", ctx, s);
} // }
pub fn start() { pub fn start() {
// panic::set_hook(Box::new(|panic_info| { // panic::set_hook(Box::new(|panic_info| {
@ -120,13 +118,8 @@ pub fn start() {
Ok(msg) => { Ok(msg) => {
let begin = Instant::now(); let begin = Instant::now();
let db_connection = db.get().expect("unable to get db connection"); let db_connection = db.get().expect("unable to get db connection");
match receive(db_connection, &rpc, msg, &mut websocket) { match receive(db_connection, begin, &rpc, msg, &mut websocket) {
Ok(method) => { Ok(_) => (),
match method.as_ref() {
"pong" => (),
_ => info!("response sent. total duration: {:?}", begin.elapsed()),
}
},
Err(e) => warn!("{:?}", e), Err(e) => warn!("{:?}", e),
} }
}, },

View File

@ -6,6 +6,7 @@ use std::net::{TcpStream};
// demo // demo
use std::iter; use std::iter;
use std::time::Instant;
use rand::{thread_rng, Rng}; use rand::{thread_rng, Rng};
use rand::distributions::{Alphanumeric}; use rand::distributions::{Alphanumeric};
@ -28,7 +29,7 @@ use item::{Item, ItemInfoCtr, item_info};
pub struct Rpc; pub struct Rpc;
impl Rpc { impl Rpc {
pub fn receive(&self, msg: Message, db: &Db, client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> { pub fn receive(&self, msg: Message, begin: Instant, db: &Db, client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
// consume the ws data into bytes // consume the ws data into bytes
let data = msg.into_data(); let data = msg.into_data();
@ -51,8 +52,6 @@ impl Rpc {
None => "none".to_string(), None => "none".to_string(),
}; };
info!("method={:?} account={:?}", v.method, account_name);
// check the method // check the method
// if no auth required // if no auth required
match v.method.as_ref() { match v.method.as_ref() {
@ -104,6 +103,8 @@ impl Rpc {
tx.commit()?; tx.commit()?;
info!("method={:?} account={:?} duration={:?}", v.method, account_name, begin.elapsed());
return response; return response;
}, },
Err(e) => { Err(e) => {