mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew
synced 2026-07-14 01:32:19 +08:00
Add coins/primogems and item limits
This commit is contained in:
@@ -354,22 +354,30 @@ pub fn cheat(req: HttpRequest, _body: String) -> HttpResponse {
|
||||
}
|
||||
let key = key.unwrap();
|
||||
let mut user = userdata::get_acc_home(&key);
|
||||
|
||||
|
||||
for item in ITEM.entries() {
|
||||
let id = item.0.parse::<i32>().unwrap_or(0);
|
||||
let data = item.1;
|
||||
if id == 0 {
|
||||
continue;
|
||||
}
|
||||
items::gift_item_basic(id, items::LIMIT_ITEMS, data["reward_type"].as_i32().unwrap(), "You have cheated. Here are \"gifts\"", &mut user);
|
||||
let reward_type = data["reward_type"].as_i32().unwrap();
|
||||
let limit = if reward_type == 4 {
|
||||
items::LIMIT_COINS
|
||||
} else if reward_type == 1 {
|
||||
items::LIMIT_PRIMOGEMS
|
||||
} else {
|
||||
items::LIMIT_ITEMS
|
||||
};
|
||||
items::gift_item_basic(id, limit, reward_type, "You have cheated. Here are \"gifts\".", &mut user);
|
||||
}
|
||||
|
||||
|
||||
userdata::save_acc_home(&key, user);
|
||||
|
||||
let resp = object!{
|
||||
result: "OK"
|
||||
};
|
||||
|
||||
|
||||
HttpResponse::Ok()
|
||||
//.insert_header(("Access-Control-Allow-Origin", FRONTEND_DOMAIN))
|
||||
//.insert_header(("Access-Control-Allow-Credentials", "true"))
|
||||
|
||||
Reference in New Issue
Block a user