mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew
synced 2026-07-12 00:32:20 +08:00
Add coins/primogems and item limits
This commit is contained in:
@@ -77,9 +77,9 @@ pub fn check_for_region(user: &mut JsonValue, headers: &HeaderMap) {
|
|||||||
// true - limit reached
|
// true - limit reached
|
||||||
// false - all good
|
// false - all good
|
||||||
pub const GIFT_LIMIT: usize = 100000;
|
pub const GIFT_LIMIT: usize = 100000;
|
||||||
pub const LIMIT_ITEMS: i64 = 200000000;
|
pub const LIMIT_ITEMS: i64 = 9999999;
|
||||||
pub const LIMIT_COINS: i64 = 2000000000;
|
pub const LIMIT_COINS: i64 = 999999999;
|
||||||
pub const LIMIT_PRIMOGEMS: i64 = 1000000;
|
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 {
|
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() {
|
for data in array.members_mut() {
|
||||||
|
|||||||
@@ -354,22 +354,30 @@ pub fn cheat(req: HttpRequest, _body: String) -> HttpResponse {
|
|||||||
}
|
}
|
||||||
let key = key.unwrap();
|
let key = key.unwrap();
|
||||||
let mut user = userdata::get_acc_home(&key);
|
let mut user = userdata::get_acc_home(&key);
|
||||||
|
|
||||||
for item in ITEM.entries() {
|
for item in ITEM.entries() {
|
||||||
let id = item.0.parse::<i32>().unwrap_or(0);
|
let id = item.0.parse::<i32>().unwrap_or(0);
|
||||||
let data = item.1;
|
let data = item.1;
|
||||||
if id == 0 {
|
if id == 0 {
|
||||||
continue;
|
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);
|
userdata::save_acc_home(&key, user);
|
||||||
|
|
||||||
let resp = object!{
|
let resp = object!{
|
||||||
result: "OK"
|
result: "OK"
|
||||||
};
|
};
|
||||||
|
|
||||||
HttpResponse::Ok()
|
HttpResponse::Ok()
|
||||||
//.insert_header(("Access-Control-Allow-Origin", FRONTEND_DOMAIN))
|
//.insert_header(("Access-Control-Allow-Origin", FRONTEND_DOMAIN))
|
||||||
//.insert_header(("Access-Control-Allow-Credentials", "true"))
|
//.insert_header(("Access-Control-Allow-Credentials", "true"))
|
||||||
|
|||||||
@@ -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": {
|
"15010001": {
|
||||||
"reward_type": 3,
|
"reward_type": 3,
|
||||||
"en": "1x Scout Ticket",
|
"en": "1x Scout Ticket",
|
||||||
|
|||||||
Reference in New Issue
Block a user