diff --git a/gameserver/src/net/handlers/avatar.rs b/gameserver/src/net/handlers/avatar.rs index 6006444..f393bbf 100644 --- a/gameserver/src/net/handlers/avatar.rs +++ b/gameserver/src/net/handlers/avatar.rs @@ -1,12 +1,12 @@ -use crate::net::tools::{JsonData, Lightcone}; +use crate::net::tools::JsonData; use super::*; static UNLOCKED_AVATARS: [u32; 54] = [ - 8001, 8002, 8003, 8004, 8005, 8006, 1001, 1002, 1003, 1004, 1005, 1006, 1008, 1009, 1013, 1101, 1102, 1103, 1104, 1105, 1106, - 1107, 1108, 1109, 1110, 1111, 1112, 1201, 1202, 1203, 1204, 1205, 1206, 1207, 1208, 1209, 1210, - 1211, 1212, 1213, 1214, 1215, 1217, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1312, - 1315, + 8001, 8002, 8003, 8004, 8005, 8006, 1001, 1002, 1003, 1004, 1005, 1006, 1008, 1009, 1013, 1101, + 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1201, 1202, 1203, 1204, 1205, + 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1217, 1301, 1302, 1303, 1304, 1305, + 1306, 1307, 1308, 1309, 1312, 1315, ]; pub async fn on_get_avatar_data_cs_req( @@ -22,13 +22,26 @@ pub async fn on_get_avatar_data_cs_req( is_all: body.is_get_all, avatar_list: UNLOCKED_AVATARS .iter() - .map(|id| json.avatars.get(id).map(|v|v.to_avatar_proto(Option::<&Lightcone>::None, vec![])).unwrap_or(Avatar { - base_avatar_id: *id, - level: 80, - promotion: 6, - rank: 6, - ..Default::default() - })) + .map(|id| { + json.avatars + .get(id) + .map(|v| { + v.to_avatar_proto( + json.lightcones.iter().find(|v| v.equip_avatar == *id), + json.relics + .iter() + .filter(|v| v.equip_avatar == *id) + .collect(), + ) + }) + .unwrap_or(Avatar { + base_avatar_id: *id, + level: 80, + promotion: 6, + rank: 6, + ..Default::default() + }) + }) .collect(), ..Default::default() }, diff --git a/gameserver/src/net/handlers/inventory.rs b/gameserver/src/net/handlers/inventory.rs new file mode 100644 index 0000000..7abf2f0 --- /dev/null +++ b/gameserver/src/net/handlers/inventory.rs @@ -0,0 +1,68 @@ +use anyhow::Result; +use proto::*; + +use crate::net::{tools::JsonData, PlayerSession}; + +use super::Dummy; + +pub async fn on_get_bag_cs_req(session: &mut PlayerSession, _: &GetBagCsReq) -> Result<()> { + let player = JsonData::load().await; + + session + .send( + CMD_GET_BAG_SC_RSP, + GetBagScRsp { + equipment_list: player + .lightcones + .iter() + .map(|v| v.to_equipment_proto()) + .collect(), + relic_list: player.relics.iter().map(|v| v.to_relic_proto()).collect(), + ..Default::default() + }, + ) + .await +} + +pub async fn on_get_archive_data_cs_req( + session: &mut PlayerSession, + _: &GetArchiveDataCsReq, +) -> Result<()> { + session + .send( + CMD_GET_ARCHIVE_DATA_SC_RSP, + GetArchiveDataScRsp { + archive_data: Some(ArchiveData::default()), + retcode: 0, + }, + ) + .await +} + +pub async fn on_oakankcfbec(session: &mut PlayerSession, _: &Oakankcfbec) -> Result<()> { + // ? + session + .send(CMD_DRESS_RELIC_AVATAR_SC_RSP, Dummy::default()) + .await +} + +pub async fn on_cnpajjnhfpa(session: &mut PlayerSession, _: &Cnpajjnhfpa) -> Result<()> { + // ? + session + .send(CMD_TAKE_OFF_RELIC_SC_RSP, Dummy::default()) + .await +} + +pub async fn on_copkgioejac(session: &mut PlayerSession, _: &Copkgioejac) -> Result<()> { + // ? + session + .send(CMD_DRESS_AVATAR_SC_RSP, Dummy::default()) + .await +} + +pub async fn on_aafgmacgenl(session: &mut PlayerSession, _: &Aafgmacgenl) -> Result<()> { + // ? + session + .send(CMD_TAKE_OFF_EQUIPMENT_SC_RSP, Dummy::default()) + .await +} diff --git a/gameserver/src/net/handlers/mod.rs b/gameserver/src/net/handlers/mod.rs index dd64dda..9591f80 100644 --- a/gameserver/src/net/handlers/mod.rs +++ b/gameserver/src/net/handlers/mod.rs @@ -6,6 +6,7 @@ mod mission; mod player; mod scene; mod tutorial; +mod inventory; use anyhow::Result; use paste::paste; @@ -23,10 +24,11 @@ pub use mission::*; pub use player::*; pub use scene::*; pub use tutorial::*; +pub use inventory::*; use proto::{ Aaihejacdpk::*, Achkcddkkkj::*, Bancodieeof::*, CmdActivityType::*, CmdBattleType::*, - CmdItemType::*, CmdPlayerType::*, Cmpepmnekko::*, Cpbdjpocnai::*, Ddhbjcelmjp::*, + CmdPlayerType::*, Cmpepmnekko::*, Cpbdjpocnai::*, Ddhbjcelmjp::*, Eegmjpcijbc::*, Emhbkpkpjpa::*, Fdkapmfjgjl::*, Gaifgoihffa::*, Galijhmhgcg::*, Gdjpnkniijf::*, Hfjpennlffa::*, Hmnbojnkleh::*, Ieoildlcdkb::*, Kfmpmaojchm::*, Lopidcokdih::*, Lpegmiilfjm::*, Mbnnmfkffbo::*, Mkeclbphcol::*, Niinikapdpg::*, Pfokmnnfiap::*, Pjmghcfmmge::*, Pnjfenbhbhg::*, @@ -89,7 +91,7 @@ dummy! { GetShareData, GetTreasureDungeonActivityData, PlayerReturnInfoQuery, - GetBag, + // GetBag, GetPlayerBoardData, GetActivityScheduleConfig, GetMissionData, diff --git a/gameserver/src/net/packet.rs b/gameserver/src/net/packet.rs index de9d23d..78ea2da 100644 --- a/gameserver/src/net/packet.rs +++ b/gameserver/src/net/packet.rs @@ -194,12 +194,12 @@ trait_handler! { // TakePrestigeRewardScRsp 4768; // GetUpdatedArchiveDataScRsp 2388; // GetArchiveDataScRsp 2348; - // GetArchiveDataCsReq 2334; + GetArchiveDataCsReq 2334; // GetUpdatedArchiveDataCsReq 2362; // UnlockSkilltreeScRsp 309; - // DressRelicAvatarCsReq 359; + Oakankcfbec 359;// DressRelicAvatarCsReq 359; // TakeOffRelicScRsp 337; - // DressAvatarCsReq 386; + Copkgioejac 386; // DressAvatarCsReq 386; // MarkAvatarScRsp 328; // TakePromotionRewardScRsp 316; // RankUpAvatarCsReq 306; @@ -211,7 +211,7 @@ trait_handler! { // TakePromotionRewardCsReq 339; // DressAvatarScRsp 329; // TakeOffAvatarSkinScRsp 363; - // TakeOffRelicCsReq 342; + Cnpajjnhfpa 342;// TakeOffRelicCsReq 342; // TakeOffEquipmentScRsp 368; // AvatarExpUpCsReq 362; // DressAvatarSkinScRsp 385; @@ -219,7 +219,7 @@ trait_handler! { // PromoteAvatarCsReq 319; // RankUpAvatarScRsp 333; // GetAvatarDataScRsp 348; - // TakeOffEquipmentCsReq 345; + Aafgmacgenl 345;// TakeOffEquipmentCsReq 345; // DressRelicAvatarScRsp 395; // PromoteAvatarScRsp 343; // AddAvatarScNotify 396; @@ -624,7 +624,7 @@ trait_handler! { // DestroyItemScRsp 597; // GeneralVirtualItemDataNotify 565; // ExpUpEquipmentScRsp 568; - // GetBagCsReq 534; + GetBagCsReq 534; // RankUpEquipmentCsReq 586; // DiscardRelicCsReq 589; // RelicRecommendScRsp 592; diff --git a/gameserver/src/net/tools.rs b/gameserver/src/net/tools.rs index d6a589f..531fb90 100644 --- a/gameserver/src/net/tools.rs +++ b/gameserver/src/net/tools.rs @@ -1,9 +1,8 @@ use proto::*; -use proto::{Avatar, AvatarSkillTree, BattleAvatar}; use serde::{Deserialize, Serialize}; use std::collections::{BTreeMap, HashMap}; -use super::tools_res::{MapEntrance, MazePlane, SimpleLevelGroup, GAME_RESOURCES}; +use super::tools_res::{MapEntrance, MazePlane, SimpleLevelGroup, GAME_RESOURCES, RELIC_TYPE}; // AVATAR #[derive(Serialize, Deserialize, Debug, Clone)] @@ -50,10 +49,12 @@ impl AvatarJson { }) .collect::>(), equipment_unique_id: if let Some(lc) = lightcone { - lc.internal_uid + // ? + 2000 + lc.internal_uid } else { 0 }, + ojneijnggfo: 1712924677, amafpakcckf: relics .iter() .map(|v| v.to_equipment_relic_proto()) @@ -201,13 +202,15 @@ impl Lightcone { pub fn to_equipment_proto(&self) -> Equipment { Equipment { base_avatar_id: self.equip_avatar, + imhlbinfhlh: self.equip_avatar, exp: 0, is_protected: false, level: self.level, promotion: self.promotion, rank: self.rank, tid: self.item_id, - unique_id: self.internal_uid, + // ? + unique_id: 2000 + self.internal_uid, ..Default::default() } } @@ -253,12 +256,14 @@ impl Relic { pub fn to_relic_proto(&self) -> proto::Relic { proto::Relic { base_avatar_id: self.equip_avatar, + imhlbinfhlh: self.equip_avatar, exp: 0, is_protected: false, level: self.level, main_affix_id: self.main_affix_id, tid: self.relic_id, - unique_id: self.internal_uid, + // ? + unique_id: 1 + self.internal_uid, sub_affix_list: self .sub_affixes .iter() @@ -293,8 +298,9 @@ impl Relic { pub fn to_equipment_relic_proto(&self) -> EquipRelic { EquipRelic { - ipnhjoomhdm: 0, //slot - llepdadmfdo: self.internal_uid, + ipnhjoomhdm: *RELIC_TYPE.get(&self.relic_id).unwrap_or(&0), + // ? + llepdadmfdo: 1 + self.internal_uid, } } } diff --git a/gameserver/src/net/tools_res.rs b/gameserver/src/net/tools_res.rs index 8b94201..d5d1058 100644 --- a/gameserver/src/net/tools_res.rs +++ b/gameserver/src/net/tools_res.rs @@ -62,7 +62,7 @@ pub struct LevelProp { pub anchor_group_id: Option, #[serde(rename = "MappingInfoID")] pub mapping_info_id: Option, - + #[serde(default)] #[serde(rename = "State")] pub state: PropState, @@ -299,4 +299,412 @@ impl GameResources { lazy_static! { pub static ref GAME_RESOURCES: GameResources = GameResources::new(); + pub static ref RELIC_TYPE: HashMap = HashMap::from([ + (31011, 1), + (41011, 1), + (51011, 1), + (61011, 1), + (31012, 2), + (41012, 2), + (51012, 2), + (61012, 2), + (31013, 3), + (41013, 3), + (51013, 3), + (61013, 3), + (31014, 4), + (41014, 4), + (51014, 4), + (61014, 4), + (31021, 1), + (41021, 1), + (51021, 1), + (61021, 1), + (31022, 2), + (41022, 2), + (51022, 2), + (61022, 2), + (31023, 3), + (41023, 3), + (51023, 3), + (61023, 3), + (31024, 4), + (41024, 4), + (51024, 4), + (61024, 4), + (31031, 1), + (41031, 1), + (51031, 1), + (61031, 1), + (31032, 2), + (41032, 2), + (51032, 2), + (61032, 2), + (31033, 3), + (41033, 3), + (51033, 3), + (61033, 3), + (31034, 4), + (41034, 4), + (51034, 4), + (61034, 4), + (31041, 1), + (41041, 1), + (51041, 1), + (61041, 1), + (31042, 2), + (41042, 2), + (51042, 2), + (61042, 2), + (31043, 3), + (41043, 3), + (51043, 3), + (61043, 3), + (31044, 4), + (41044, 4), + (51044, 4), + (61044, 4), + (31051, 1), + (41051, 1), + (51051, 1), + (61051, 1), + (31052, 2), + (41052, 2), + (51052, 2), + (61052, 2), + (31053, 3), + (41053, 3), + (51053, 3), + (61053, 3), + (31054, 4), + (41054, 4), + (51054, 4), + (61054, 4), + (31061, 1), + (41061, 1), + (51061, 1), + (61061, 1), + (31062, 2), + (41062, 2), + (51062, 2), + (61062, 2), + (31063, 3), + (41063, 3), + (51063, 3), + (61063, 3), + (31064, 4), + (41064, 4), + (51064, 4), + (61064, 4), + (31071, 1), + (41071, 1), + (51071, 1), + (61071, 1), + (31072, 2), + (41072, 2), + (51072, 2), + (61072, 2), + (31073, 3), + (41073, 3), + (51073, 3), + (61073, 3), + (31074, 4), + (41074, 4), + (51074, 4), + (61074, 4), + (31081, 1), + (41081, 1), + (51081, 1), + (61081, 1), + (31082, 2), + (41082, 2), + (51082, 2), + (61082, 2), + (31083, 3), + (41083, 3), + (51083, 3), + (61083, 3), + (31084, 4), + (41084, 4), + (51084, 4), + (61084, 4), + (31091, 1), + (41091, 1), + (51091, 1), + (61091, 1), + (31092, 2), + (41092, 2), + (51092, 2), + (61092, 2), + (31093, 3), + (41093, 3), + (51093, 3), + (61093, 3), + (31094, 4), + (41094, 4), + (51094, 4), + (61094, 4), + (31101, 1), + (41101, 1), + (51101, 1), + (61101, 1), + (31102, 2), + (41102, 2), + (51102, 2), + (61102, 2), + (31103, 3), + (41103, 3), + (51103, 3), + (61103, 3), + (31104, 4), + (41104, 4), + (51104, 4), + (61104, 4), + (31111, 1), + (41111, 1), + (51111, 1), + (61111, 1), + (31112, 2), + (41112, 2), + (51112, 2), + (61112, 2), + (31113, 3), + (41113, 3), + (51113, 3), + (61113, 3), + (31114, 4), + (41114, 4), + (51114, 4), + (61114, 4), + (31121, 1), + (41121, 1), + (51121, 1), + (61121, 1), + (31122, 2), + (41122, 2), + (51122, 2), + (61122, 2), + (31123, 3), + (41123, 3), + (51123, 3), + (61123, 3), + (31124, 4), + (41124, 4), + (51124, 4), + (61124, 4), + (33015, 5), + (43015, 5), + (53015, 5), + (63015, 5), + (33016, 6), + (43016, 6), + (53016, 6), + (63016, 6), + (33025, 5), + (43025, 5), + (53025, 5), + (63025, 5), + (33026, 6), + (43026, 6), + (53026, 6), + (63026, 6), + (33035, 5), + (43035, 5), + (53035, 5), + (63035, 5), + (33036, 6), + (43036, 6), + (53036, 6), + (63036, 6), + (33045, 5), + (43045, 5), + (53045, 5), + (63045, 5), + (33046, 6), + (43046, 6), + (53046, 6), + (63046, 6), + (33055, 5), + (43055, 5), + (53055, 5), + (63055, 5), + (33056, 6), + (43056, 6), + (53056, 6), + (63056, 6), + (33065, 5), + (43065, 5), + (53065, 5), + (63065, 5), + (33066, 6), + (43066, 6), + (53066, 6), + (63066, 6), + (33075, 5), + (43075, 5), + (53075, 5), + (63075, 5), + (33076, 6), + (43076, 6), + (53076, 6), + (63076, 6), + (33085, 5), + (43085, 5), + (53085, 5), + (63085, 5), + (33086, 6), + (43086, 6), + (53086, 6), + (63086, 6), + (33095, 5), + (43095, 5), + (53095, 5), + (63095, 5), + (33096, 6), + (43096, 6), + (53096, 6), + (63096, 6), + (33105, 5), + (43105, 5), + (53105, 5), + (63105, 5), + (33106, 6), + (43106, 6), + (53106, 6), + (63106, 6), + (55001, 3), + (55002, 4), + (55003, 3), + (55004, 3), + (55005, 4), + (55006, 3), + (31131, 1), + (41131, 1), + (51131, 1), + (61131, 1), + (31132, 2), + (41132, 2), + (51132, 2), + (61132, 2), + (31133, 3), + (41133, 3), + (51133, 3), + (61133, 3), + (31134, 4), + (41134, 4), + (51134, 4), + (61134, 4), + (31141, 1), + (41141, 1), + (51141, 1), + (61141, 1), + (31142, 2), + (41142, 2), + (51142, 2), + (61142, 2), + (31143, 3), + (41143, 3), + (51143, 3), + (61143, 3), + (31144, 4), + (41144, 4), + (51144, 4), + (61144, 4), + (31151, 1), + (41151, 1), + (51151, 1), + (61151, 1), + (31152, 2), + (41152, 2), + (51152, 2), + (61152, 2), + (31153, 3), + (41153, 3), + (51153, 3), + (61153, 3), + (31154, 4), + (41154, 4), + (51154, 4), + (61154, 4), + (31161, 1), + (41161, 1), + (51161, 1), + (61161, 1), + (31162, 2), + (41162, 2), + (51162, 2), + (61162, 2), + (31163, 3), + (41163, 3), + (51163, 3), + (61163, 3), + (31164, 4), + (41164, 4), + (51164, 4), + (61164, 4), + (33115, 5), + (43115, 5), + (53115, 5), + (63115, 5), + (33116, 6), + (43116, 6), + (53116, 6), + (63116, 6), + (33125, 5), + (43125, 5), + (53125, 5), + (63125, 5), + (33126, 6), + (43126, 6), + (53126, 6), + (63126, 6), + (31171, 1), + (41171, 1), + (51171, 1), + (61171, 1), + (31172, 2), + (41172, 2), + (51172, 2), + (61172, 2), + (31173, 3), + (41173, 3), + (51173, 3), + (61173, 3), + (31174, 4), + (41174, 4), + (51174, 4), + (61174, 4), + (31181, 1), + (41181, 1), + (51181, 1), + (61181, 1), + (31182, 2), + (41182, 2), + (51182, 2), + (61182, 2), + (31183, 3), + (41183, 3), + (51183, 3), + (61183, 3), + (31184, 4), + (41184, 4), + (51184, 4), + (61184, 4), + (33135, 5), + (43135, 5), + (53135, 5), + (63135, 5), + (33136, 6), + (43136, 6), + (53136, 6), + (63136, 6), + (33145, 5), + (43145, 5), + (53145, 5), + (63145, 5), + (33146, 6), + (43146, 6), + (53146, 6), + (63146, 6), + ]); }