mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew.git
synced 2025-05-13 11:37:33 -05:00
Give reward thing when you get a new old person
This commit is contained in:
parent
e735215141
commit
264df06a47
1 changed files with 16 additions and 0 deletions
|
@ -118,6 +118,22 @@ pub fn error_resp() -> HttpResponse {
|
||||||
pub fn give_character(id: String, user: &mut JsonValue) -> bool {
|
pub fn give_character(id: String, user: &mut JsonValue) -> bool {
|
||||||
for (_i, data) in user["card_list"].members().enumerate() {
|
for (_i, data) in user["card_list"].members().enumerate() {
|
||||||
if data["master_card_id"].to_string() == id {
|
if data["master_card_id"].to_string() == id {
|
||||||
|
let mut has = false;
|
||||||
|
for (_j, dataa) in user["item_list"].members_mut().enumerate() {
|
||||||
|
has = true;
|
||||||
|
if dataa["master_item_id"].as_i64().unwrap() == 19100001 {
|
||||||
|
dataa["amount"] = (dataa["amount"].as_i64().unwrap() + 10).into();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if !has {
|
||||||
|
user["item_list"].push(object!{
|
||||||
|
id: 19100001,
|
||||||
|
master_item_id: 19100001,
|
||||||
|
amount: 10,
|
||||||
|
expire_date_time: null
|
||||||
|
}).unwrap();
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue