mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew
synced 2026-07-12 00:32:20 +08:00
Compare commits
2 Commits
8a666a56b5
...
d61b27af8f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d61b27af8f | ||
|
|
8e4300a7ea |
@@ -43,33 +43,43 @@ pub fn get_region(headers: &HeaderMap) -> bool {
|
||||
}
|
||||
|
||||
pub fn check_for_region(user: &mut JsonValue, headers: &HeaderMap) {
|
||||
let items = if user["data"]["updated_value_list"]["item_list"].is_empty() {user["data"]["item_list"].clone()} else {user["data"]["updated_value_list"]["item_list"].clone()};
|
||||
let is_jp = get_region(headers);
|
||||
if !is_jp || items.is_empty() {
|
||||
// returns true if jp
|
||||
if !get_region(headers) {
|
||||
return;
|
||||
}
|
||||
let mut id = 0;
|
||||
for (i, data) in items.members().enumerate() {
|
||||
if data["master_item_id"] == 15570008 {
|
||||
id = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if id > 0 {
|
||||
if user["data"]["updated_value_list"]["item_list"].is_empty() {
|
||||
user["data"]["item_list"].array_remove(id - 1);
|
||||
} else {
|
||||
user["data"]["updated_value_list"]["item_list"].array_remove(id - 1);
|
||||
}
|
||||
|
||||
let targets = [
|
||||
15570001, 15570002, 15570003, 15570004,
|
||||
15570005, 15570006, 15570007, 15570008
|
||||
];
|
||||
|
||||
let list = if !user["data"]["updated_value_list"]["item_list"].is_empty() {
|
||||
&mut user["data"]["updated_value_list"]["item_list"]
|
||||
} else {
|
||||
&mut user["data"]["item_list"]
|
||||
};
|
||||
|
||||
let mut to_remove: Vec<usize> = list
|
||||
.members()
|
||||
.enumerate()
|
||||
.filter(|(_, item)| {
|
||||
targets.contains(&item["master_item_id"].as_i64().unwrap_or(0))
|
||||
})
|
||||
.map(|(i, _)| i)
|
||||
.collect();
|
||||
|
||||
to_remove.reverse();
|
||||
for i in to_remove {
|
||||
list.array_remove(i);
|
||||
}
|
||||
}
|
||||
|
||||
// true - limit reached
|
||||
// false - all good
|
||||
pub const GIFT_LIMIT: usize = 100000;
|
||||
pub const LIMIT_ITEMS: i64 = 200000000;
|
||||
pub const LIMIT_COINS: i64 = 2000000000;
|
||||
pub const LIMIT_PRIMOGEMS: i64 = 1000000;
|
||||
pub const LIMIT_ITEMS: i64 = 9999999;
|
||||
pub const LIMIT_COINS: i64 = 999999999;
|
||||
pub const LIMIT_PRIMOGEMS: i64 = 9999999;
|
||||
|
||||
fn give(array: &mut JsonValue, shop_id: &str, master_item_id: i64, limit: i64, count_id: &str, count: i64, default_push: JsonValue) -> bool {
|
||||
for data in array.members_mut() {
|
||||
|
||||
@@ -349,7 +349,7 @@ pub fn cheat(req: HttpRequest, _body: String) -> HttpResponse {
|
||||
return error("Not logged in");
|
||||
}
|
||||
let key = userdata::webui_login_token(&token.unwrap());
|
||||
if key.is_some() {
|
||||
if key.is_none() {
|
||||
return error("Not logged in");
|
||||
}
|
||||
let key = key.unwrap();
|
||||
@@ -361,7 +361,15 @@ pub fn cheat(req: HttpRequest, _body: String) -> HttpResponse {
|
||||
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);
|
||||
@@ -375,5 +383,4 @@ pub fn cheat(req: HttpRequest, _body: String) -> HttpResponse {
|
||||
//.insert_header(("Access-Control-Allow-Credentials", "true"))
|
||||
.insert_header(ContentType::json())
|
||||
.body(json::stringify(resp))
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,14 @@
|
||||
{
|
||||
"1": {
|
||||
"reward_type": 4,
|
||||
"en": "Coin",
|
||||
"jp": "Coin"
|
||||
},
|
||||
"1000": {
|
||||
"reward_type": 1,
|
||||
"en": "Primogem (idk what its actually called)",
|
||||
"jp": "Primogem (idk what its actually called)"
|
||||
},
|
||||
"15010001": {
|
||||
"reward_type": 3,
|
||||
"en": "1x Scout Ticket",
|
||||
|
||||
Reference in New Issue
Block a user