Ignore /api/tutorial requests when tutorial is already completed
This commit is contained in:
parent
6a98949f77
commit
21849b2322
@ -8,12 +8,13 @@ pub fn tutorial(req: HttpRequest, body: String) -> Option<JsonValue> {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let mut user = userdata::get_acc(&key);
|
||||
|
||||
user["tutorial_step"] = body["step"].clone();
|
||||
user["stamina"]["stamina"] = (100).into();
|
||||
user["stamina"]["last_updated_time"] = global::timestamp().into();
|
||||
|
||||
userdata::save_acc(&key, user);
|
||||
|
||||
if user["tutorial_step"].as_i32().unwrap() < 130 {
|
||||
user["tutorial_step"] = body["step"].clone();
|
||||
user["stamina"]["stamina"] = (100).into();
|
||||
user["stamina"]["last_updated_time"] = global::timestamp().into();
|
||||
userdata::save_acc(&key, user);
|
||||
}
|
||||
|
||||
Some(array![])
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user