fix pvp instance state push notification
This commit is contained in:
parent
3a382eb97d
commit
2728be796e
@ -6,6 +6,7 @@
|
|||||||
* serde serialize privatise
|
* serde serialize privatise
|
||||||
* DO postgres
|
* DO postgres
|
||||||
* mobile styles
|
* mobile styles
|
||||||
|
* can't reset password without knowing password =\
|
||||||
|
|
||||||
* treats
|
* treats
|
||||||
* constructs jiggle when clicked
|
* constructs jiggle when clicked
|
||||||
@ -17,6 +18,7 @@
|
|||||||
|
|
||||||
|
|
||||||
* bot game grind
|
* bot game grind
|
||||||
|
* stress test
|
||||||
|
|
||||||
* change score to enum
|
* change score to enum
|
||||||
* pct based translates for combat animation
|
* pct based translates for combat animation
|
||||||
|
|||||||
@ -185,8 +185,9 @@ pub fn set_password(tx: &mut Transaction, id: Uuid, current: &String, password:
|
|||||||
let id: Uuid = row.get(0);
|
let id: Uuid = row.get(0);
|
||||||
let db_pw: String = row.get(1);
|
let db_pw: String = row.get(1);
|
||||||
|
|
||||||
|
// return bad request to prevent being logged out
|
||||||
if !verify(current, &db_pw)? {
|
if !verify(current, &db_pw)? {
|
||||||
return Err(MnmlHttpError::PasswordNotMatch);
|
return Err(MnmlHttpError::BadRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
let rounds = 8;
|
let rounds = 8;
|
||||||
|
|||||||
@ -724,7 +724,7 @@ pub fn instance_ready(tx: &mut Transaction, account: &Account, instance_id: Uuid
|
|||||||
Ok(RpcMessage::InstanceState(instance_update(tx, instance)?))
|
Ok(RpcMessage::InstanceState(instance_update(tx, instance)?))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn instance_state(tx: &mut Transaction, _account: &Account, instance_id: Uuid) -> Result<RpcMessage, Error> {
|
pub fn instance_state(tx: &mut Transaction, instance_id: Uuid) -> Result<RpcMessage, Error> {
|
||||||
let instance = instance_get(tx, instance_id)?;
|
let instance = instance_get(tx, instance_id)?;
|
||||||
|
|
||||||
if let Some(game_id) = instance.current_game_id() {
|
if let Some(game_id) = instance.current_game_id() {
|
||||||
|
|||||||
@ -88,7 +88,7 @@ fn handle_notification(n: Notification, pool: &PgPool, events: &Sender<Event>) {
|
|||||||
Table::Accounts =>
|
Table::Accounts =>
|
||||||
Some(Event::Push(n.id, RpcMessage::AccountState(account::select(&db, n.id).unwrap()))),
|
Some(Event::Push(n.id, RpcMessage::AccountState(account::select(&db, n.id).unwrap()))),
|
||||||
Table::Instances =>
|
Table::Instances =>
|
||||||
Some(Event::Push(n.id, RpcMessage::InstanceState(instance::instance_get(&mut tx, n.id).unwrap()))),
|
Some(Event::Push(n.id, instance::instance_state(&mut tx, n.id).unwrap())),
|
||||||
Table::Games =>
|
Table::Games =>
|
||||||
Some(Event::Push(n.id, RpcMessage::GameState(game::game_get(&mut tx, n.id).unwrap()))),
|
Some(Event::Push(n.id, RpcMessage::GameState(game::game_get(&mut tx, n.id).unwrap()))),
|
||||||
_ => {
|
_ => {
|
||||||
|
|||||||
@ -180,7 +180,7 @@ impl Connection {
|
|||||||
RpcRequest::InstanceReady { instance_id } =>
|
RpcRequest::InstanceReady { instance_id } =>
|
||||||
Ok(instance_ready(&mut tx, account, instance_id)?),
|
Ok(instance_ready(&mut tx, account, instance_id)?),
|
||||||
RpcRequest::InstanceState { instance_id } =>
|
RpcRequest::InstanceState { instance_id } =>
|
||||||
Ok(instance_state(&mut tx, account, instance_id)?),
|
Ok(instance_state(&mut tx, instance_id)?),
|
||||||
|
|
||||||
RpcRequest::VboxAccept { instance_id, group, index } =>
|
RpcRequest::VboxAccept { instance_id, group, index } =>
|
||||||
Ok(RpcMessage::InstanceState(vbox_accept(&mut tx, account, instance_id, group, index)?)),
|
Ok(RpcMessage::InstanceState(vbox_accept(&mut tx, account, instance_id, group, index)?)),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user