mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew.git
synced 2025-05-13 11:37:33 -05:00
implement live skip
This commit is contained in:
parent
880758b8e1
commit
7148c5627f
2 changed files with 54 additions and 0 deletions
|
@ -142,6 +142,9 @@ async fn live_start(req: HttpRequest, body: String) -> HttpResponse { router::li
|
|||
#[post("/api/live/end")]
|
||||
async fn live_end(req: HttpRequest, body: String) -> HttpResponse { router::live::end(req, body) }
|
||||
|
||||
#[post("/api/live/skip")]
|
||||
async fn live_skip(req: HttpRequest, body: String) -> HttpResponse { router::live::skip(req, body) }
|
||||
|
||||
#[post("/api/live/retire")]
|
||||
async fn live_retire(req: HttpRequest, body: String) -> HttpResponse { router::live::retire(req, body) }
|
||||
|
||||
|
@ -327,6 +330,7 @@ async fn main() -> std::io::Result<()> {
|
|||
.service(live_clearrate)
|
||||
.service(live_start)
|
||||
.service(live_end)
|
||||
.service(live_skip)
|
||||
.service(live_retire)
|
||||
.service(chat_home)
|
||||
.service(chat_end)
|
||||
|
|
|
@ -246,6 +246,55 @@ pub fn update_live_data(user: &mut JsonValue, data: &JsonValue) -> JsonValue {
|
|||
rv
|
||||
}
|
||||
|
||||
pub fn skip(req: HttpRequest, body: String) -> HttpResponse {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
let mut user2 = userdata::get_acc_home(&key);
|
||||
let mut user = userdata::get_acc(&key);
|
||||
|
||||
global::gift_item_basic(1, 10000, 4, "You skipped a live!", &mut user2);
|
||||
global::gift_item_basic(16005003, 10, 3, "You skipped a live!", &mut user2);
|
||||
global::gift_item_basic(17001003, 2, 3, "You skipped a live!", &mut user2);
|
||||
|
||||
global::give_exp(10, &mut user);
|
||||
|
||||
let live = update_live_data(&mut user, &object!{
|
||||
master_live_id: body["master_live_id"].clone(),
|
||||
level: 1,
|
||||
live_score: {
|
||||
score: 1,
|
||||
max_combo: 1
|
||||
}
|
||||
});
|
||||
|
||||
userdata::save_acc(&key, user.clone());
|
||||
userdata::save_acc_home(&key, user2.clone());
|
||||
|
||||
let resp = object!{
|
||||
"code": 0,
|
||||
"server_time": global::timestamp(),
|
||||
"data": {
|
||||
"gem": user["gem"].clone(),
|
||||
"high_score": live["high_score"].clone(),
|
||||
"item_list": user["item_list"].clone(),
|
||||
"point_list": user["point_list"].clone(),
|
||||
"live": live,
|
||||
"clear_master_live_mission_ids": [],
|
||||
"user": user["user"].clone(),
|
||||
"stamina": user["stamina"].clone(),
|
||||
"character_list": user["character_list"].clone(),
|
||||
"reward_list": [],
|
||||
"gift_list": user2["home"]["gift_list"].clone(),
|
||||
"clear_mission_ids": user2["clear_mission_ids"].clone(),
|
||||
"event_point_reward_list": [],
|
||||
"ranking_change": [],
|
||||
"event_member": [],
|
||||
"event_ranking_data": []
|
||||
}
|
||||
};
|
||||
global::send(resp)
|
||||
}
|
||||
|
||||
pub fn end(req: HttpRequest, body: String) -> HttpResponse {
|
||||
let key = global::get_login(req.headers(), &body);
|
||||
let body = json::parse(&encryption::decrypt_packet(&body).unwrap()).unwrap();
|
||||
|
@ -272,6 +321,7 @@ pub fn end(req: HttpRequest, body: String) -> HttpResponse {
|
|||
"server_time": global::timestamp(),
|
||||
"data": {
|
||||
"gem": user["gem"].clone(),
|
||||
"high_score": live["high_score"].clone(),
|
||||
"item_list": user["item_list"].clone(),
|
||||
"point_list": user["point_list"].clone(),
|
||||
"live": live,
|
||||
|
|
Loading…
Add table
Reference in a new issue