Fix claiming points from box

This commit is contained in:
Ethan O'Brien 2024-04-29 10:40:03 -05:00
parent dbcec25ffd
commit 63419afacc
3 changed files with 12 additions and 8 deletions

View file

@ -236,6 +236,16 @@ pub fn gift_item(item: &JsonValue, reason: &str, user: &mut JsonValue) -> JsonVa
return to_push; return to_push;
} }
pub fn gift_item_basic(id: i32, value: i64, ty_pe: i32, reason: &str, user: &mut JsonValue) -> JsonValue {
gift_item(&object!{
id: timestamp(),
type: ty_pe,
level: 0,
amount: value,
value: id
}, reason, user)
}
pub fn lp_modification(user: &mut JsonValue, change_amount: u64, remove: bool) { pub fn lp_modification(user: &mut JsonValue, change_amount: u64, remove: bool) {
let max = get_user_rank_data(user["user"]["exp"].as_i64().unwrap())["maxLp"].as_u64().unwrap(); let max = get_user_rank_data(user["user"]["exp"].as_i64().unwrap())["maxLp"].as_u64().unwrap();

View file

@ -22,13 +22,7 @@ pub fn serial_code(req: HttpRequest, body: String) -> HttpResponse {
let item; let item;
if body["input_code"].to_string() == "SIF2REVIVALREAL!" { if body["input_code"].to_string() == "SIF2REVIVALREAL!" {
item = global::gift_item(&object!{ item = global::gift_item_basic(1, 10000, 4, "You typed in code!!!!!!!!!", &mut user);
id: global::timestamp(),
type: 4,
level: 0,
amount: 100000,
value: 1
}, "You typed in code", &mut user);
} else { } else {
let resp = object!{ let resp = object!{
"code": 0, "code": 0,

View file

@ -92,7 +92,7 @@ pub fn gift(req: HttpRequest, body: String) -> HttpResponse {
limit_reached = global::give_item(data["value"].as_i64().unwrap(), data["amount"].as_i64().unwrap(), &mut userr); limit_reached = global::give_item(data["value"].as_i64().unwrap(), data["amount"].as_i64().unwrap(), &mut userr);
} else if data["reward_type"].to_string() == "4" { } else if data["reward_type"].to_string() == "4" {
// basically moraa!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // basically moraa!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
limit_reached = global::give_points(data["reward_type"].as_i64().unwrap(), data["amount"].as_i64().unwrap(), &mut userr); limit_reached = global::give_points(data["value"].as_i64().unwrap(), data["amount"].as_i64().unwrap(), &mut userr);
} else { } else {
println!("Redeeming reward not implimented for reward type {}", data["reward_type"].to_string()); println!("Redeeming reward not implimented for reward type {}", data["reward_type"].to_string());
limit_reached = true; limit_reached = true;