mission stuff idk

This commit is contained in:
Ethan O'Brien
2026-07-24 21:20:19 -05:00
parent 59ac1f55c3
commit 4ebcc06d56
2 changed files with 31 additions and 18 deletions

View File

@@ -223,6 +223,18 @@ lazy_static! {
pub static ref MISSION_REWARD: JsonValue = index_by(&t("mission_reward"), "id");
pub static ref MISSION_REWARDS: JsonValue = {
let mut info = object! {};
for data in t("mission_reward").members() {
let id = data["id"].to_string();
if info[&id].is_null() {
info[&id] = array![];
}
info[&id].push(data.clone()).unwrap();
}
info
};
pub static ref ITEM_INFO: JsonValue = index_by(&t("item"), "id");
pub static ref MUSIC: JsonValue = {

View File

@@ -70,27 +70,28 @@ async fn receive(req: HttpRequest, Session { key, body }: Session) -> impl Respo
for mission in body["master_mission_ids"].members() {
let mid = mission.as_i64().unwrap();
let mission_info = databases::MISSION_LIST[mid.to_string()].clone();
let master = databases::MISSION_REWARD[mission_info["masterMissionRewardId"].to_string()].clone();
let reward_type = master["type"].as_i64().unwrap();
for master in databases::MISSION_REWARDS[mission_info["masterMissionRewardId"].to_string()].members() {
let reward_type = master["type"].as_i64().unwrap();
rewards.push(object!{
give_type: master["giveType"].clone(),
type: master["type"].clone(),
value: master["value"].clone(),
level: master["level"].clone(),
amount: master["amount"].clone()
}).unwrap();
rewards.push(object!{
give_type: master["giveType"].clone(),
type: master["type"].clone(),
value: master["value"].clone(),
level: master["level"].clone(),
amount: master["amount"].clone()
}).unwrap();
items::give_gift(&object!{
reward_type: reward_type,
value: master["value"].clone(),
amount: master["amount"].clone()
}, &mut user, &mut missions, &mut array![], &mut chats);
items::give_gift(&object!{
reward_type: reward_type,
value: master["value"].clone(),
amount: master["amount"].clone()
}, &mut user, &mut missions, &mut array![], &mut chats);
match reward_type {
1 => touched_gem = true,
4 => touched_coin = true,
_ => { touched_items.push(master["value"].clone()).unwrap(); }
match reward_type {
1 => touched_gem = true,
4 => touched_coin = true,
_ => { touched_items.push(master["value"].clone()).unwrap(); }
}
}
let mut variable = false;