diff --git a/src/router/global.rs b/src/router/global.rs index 4339796..aa5e077 100644 --- a/src/router/global.rs +++ b/src/router/global.rs @@ -236,6 +236,16 @@ pub fn gift_item(item: &JsonValue, reason: &str, user: &mut JsonValue) -> JsonVa 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) { let max = get_user_rank_data(user["user"]["exp"].as_i64().unwrap())["maxLp"].as_u64().unwrap(); diff --git a/src/router/serial_code.rs b/src/router/serial_code.rs index cfeaf67..1495123 100644 --- a/src/router/serial_code.rs +++ b/src/router/serial_code.rs @@ -22,13 +22,7 @@ pub fn serial_code(req: HttpRequest, body: String) -> HttpResponse { let item; if body["input_code"].to_string() == "SIF2REVIVALREAL!" { - item = global::gift_item(&object!{ - id: global::timestamp(), - type: 4, - level: 0, - amount: 100000, - value: 1 - }, "You typed in code", &mut user); + item = global::gift_item_basic(1, 10000, 4, "You typed in code!!!!!!!!!", &mut user); } else { let resp = object!{ "code": 0, diff --git a/src/router/user.rs b/src/router/user.rs index cefdf16..0786f8f 100644 --- a/src/router/user.rs +++ b/src/router/user.rs @@ -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); } else if data["reward_type"].to_string() == "4" { // 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 { println!("Redeeming reward not implimented for reward type {}", data["reward_type"].to_string()); limit_reached = true;