menu
This commit is contained in:
@@ -170,7 +170,7 @@ pub fn player_state(params: PlayerStateParams, tx: &mut Transaction, account: &A
|
||||
player_get(tx, account.id, params.instance_id)
|
||||
}
|
||||
|
||||
pub fn player_cryps_set(params: PlayerCrypsSetParams, tx: &mut Transaction, account: &Account) -> Result<Player, Error> {
|
||||
pub fn player_mm_cryps_set(params: PlayerCrypsSetParams, tx: &mut Transaction, account: &Account) -> Result<Player, Error> {
|
||||
if params.cryp_ids.len() != 3 {
|
||||
return Err(err_msg("team size is 3"));
|
||||
}
|
||||
@@ -183,6 +183,7 @@ pub fn player_cryps_set(params: PlayerCrypsSetParams, tx: &mut Transaction, acco
|
||||
match player_get(tx, account.id, Uuid::nil()) {
|
||||
Ok(mut p) => {
|
||||
p.cryps = cryps;
|
||||
p.vbox = Vbox::new(account.id, Uuid::nil());
|
||||
player_update(tx, p, false)
|
||||
},
|
||||
Err(_) => {
|
||||
|
||||
+4
-4
@@ -21,7 +21,7 @@ use account::{Account, account_create, account_login, account_from_token, accoun
|
||||
use skill::{Skill};
|
||||
// use zone::{Zone, zone_create, zone_join, zone_close};
|
||||
use spec::{Spec};
|
||||
use player::{Score, player_state, player_cryps_set, Player};
|
||||
use player::{Score, player_state, player_mm_cryps_set, Player};
|
||||
use instance::{instance_join, instance_ready, instance_scores};
|
||||
use vbox::{Var, vbox_accept, vbox_apply, vbox_discard, vbox_combine, vbox_reclaim, vbox_unequip};
|
||||
|
||||
@@ -82,7 +82,7 @@ impl Rpc {
|
||||
"instance_scores" => Rpc::instance_scores(data, &mut tx, account.unwrap(), client),
|
||||
|
||||
"player_state" => Rpc::player_state(data, &mut tx, account.unwrap(), client),
|
||||
"player_cryps_set" => Rpc::player_cryps_set(data, &mut tx, account.unwrap(), client),
|
||||
"player_mm_cryps_set" => Rpc::player_mm_cryps_set(data, &mut tx, account.unwrap(), client),
|
||||
"player_vbox_accept" => Rpc::player_vbox_accept(data, &mut tx, account.unwrap(), client),
|
||||
"player_vbox_apply" => Rpc::player_vbox_apply(data, &mut tx, account.unwrap(), client),
|
||||
"player_vbox_combine" => Rpc::player_vbox_combine(data, &mut tx, account.unwrap(), client),
|
||||
@@ -307,12 +307,12 @@ impl Rpc {
|
||||
return Ok(response);
|
||||
}
|
||||
|
||||
fn player_cryps_set(data: Vec<u8>, tx: &mut Transaction, account: Account, _client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
|
||||
fn player_mm_cryps_set(data: Vec<u8>, tx: &mut Transaction, account: Account, _client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
|
||||
let msg = from_slice::<PlayerCrypsSetMsg>(&data).or(Err(err_msg("invalid params")))?;
|
||||
|
||||
let response = RpcResponse {
|
||||
method: "player_state".to_string(),
|
||||
params: RpcResult::PlayerState(player_cryps_set(msg.params, tx, &account)?)
|
||||
params: RpcResult::PlayerState(player_mm_cryps_set(msg.params, tx, &account)?)
|
||||
};
|
||||
|
||||
return Ok(response);
|
||||
|
||||
Reference in New Issue
Block a user