added more functionality ig

This commit is contained in:
BuildTools 2024-05-10 23:31:40 +02:00
parent fbd1f367af
commit 73a20a09ef

View file

@ -9,7 +9,7 @@ use std::fs;
use crate::{net::PlayerSession, util};
pub async fn on_get_bag_cs_req(session: &PlayerSession, _: &GetBagCsReq) -> Result<()> {
let json_data = fs::read_to_string("PATH HERE").expect("Failed to read inventory.json");
let json_data = fs::read_to_string("C:/Users/Al-Shebli/Downloads/HSR 2.3 beta/JadeSR-masters/jadesr/gameserver/src/net/handlers/inventory.json").expect("Failed to read inventory.json");
let json_value: Value = serde_json::from_str(&json_data).expect("Failed to parse JSON data");
// Extract ranks
@ -18,7 +18,11 @@ pub async fn on_get_bag_cs_req(session: &PlayerSession, _: &GetBagCsReq) -> Resu
let t1: u32 = json_value[0]["tid"].as_i64().expect("Failed") as u32;
let t2: u32 = json_value[1]["tid"].as_i64().expect("Failed") as u32;
let l1: u32 = json_value[0]["level"].as_i64().expect("Failed") as u32;
let l2: u32 = json_value[0]["level"].as_i64().expect("Failed") as u32;
let l2: u32 = json_value[1]["level"].as_i64().expect("Failed") as u32;
let ip1: u32 = json_value[0]["is_protected"].as_i64().expect("Failed") as u32;
let ip2: u32 = json_value[1]["is_protected"].as_i64().expect("Failed") as u32;
let p1: u32 = json_value[0]["promotion"].as_i64().expect("Failed") as u32;
let p2: u32 = json_value[1]["promotion"].as_i64().expect("Failed") as u32;
//let e_rank3: u32 = json_value[2]["rank"].as_i64().expect("Failed to get rank for Equipment3") as u32;
session
.send(
@ -29,8 +33,8 @@ pub async fn on_get_bag_cs_req(session: &PlayerSession, _: &GetBagCsReq) -> Resu
lgjeabihdpn: vec![],
retcode: 0,
equipment_list: vec![
Equipment {tid: t1, rank: r1, exp: 0, unique_id: 57, promotion: 6, level: l1, base_avatar_id: 0, is_protected: true, ..Default::default()},
Equipment {tid: t2, rank: r2, exp: 0, unique_id: 58, promotion: 6, level: l2, base_avatar_id: 0, is_protected: true, ..Default::default()},
Equipment {tid: t1, rank: r1, exp: 0, unique_id: 57, promotion: p1, level: l1, base_avatar_id: 0, is_protected: ip1, ..Default::default()},
Equipment {tid: t2, rank: r2, exp: 0, unique_id: 58, promotion: p2, level: l2, base_avatar_id: 0, is_protected: ip2, ..Default::default()},
Equipment {tid: 23024, rank: 5, exp: 0, unique_id: 59, promotion: 6, level: 80, base_avatar_id: 0, is_protected: true, ..Default::default()},
Equipment {tid: 23024, rank: 5, exp: 0, unique_id: 60, promotion: 6, level: 80, base_avatar_id: 0, is_protected: true, ..Default::default()},
Equipment {tid: 23024, rank: 5, exp: 0, unique_id: 61, promotion: 6, level: 80, base_avatar_id: 0, is_protected: true, ..Default::default()},
@ -57,14 +61,14 @@ pub async fn on_get_bag_cs_req(session: &PlayerSession, _: &GetBagCsReq) -> Resu
gddpphikjae: vec![],
macfjibhfad: vec![],
clkjaanbfpp: vec![ 101 ],
// .iter()
// .map(|id| {
// // {
// // tid: *id,
// // num: 500
// // }
// })
// .collect(),
// .iter()
// .map(|id| {
// // {
// // tid: *id,
// // num: 500
// // }
// })
// .collect(),
biahmcppikj: vec![],
}
)