mirror of
https://github.com/redstrate/Kawari.git
synced 2025-07-17 10:47:44 +00:00
Add support for the QuestActiveList IPC opcode
This commit is contained in:
parent
8be1fefa53
commit
2cc562de38
4 changed files with 59 additions and 3 deletions
|
@ -284,6 +284,11 @@
|
|||
"name": "TitleList",
|
||||
"opcode": 731,
|
||||
"size": 112
|
||||
},
|
||||
{
|
||||
"name": "QuestActiveList",
|
||||
"opcode": 398,
|
||||
"size": 480
|
||||
}
|
||||
],
|
||||
"ClientZoneIpcType": [
|
||||
|
|
|
@ -91,6 +91,9 @@ pub use event_yield_handler::EventYieldHandler;
|
|||
mod object_spawn;
|
||||
pub use object_spawn::ObjectSpawn;
|
||||
|
||||
mod quest_active_list;
|
||||
pub use quest_active_list::QuestActiveList;
|
||||
|
||||
use crate::COMPLETED_QUEST_BITMASK_SIZE;
|
||||
use crate::TITLE_UNLOCK_BITMASK_SIZE;
|
||||
use crate::common::ObjectTypeId;
|
||||
|
@ -467,6 +470,8 @@ pub enum ServerZoneIpcData {
|
|||
TitleList {
|
||||
unlock_bitmask: [u8; TITLE_UNLOCK_BITMASK_SIZE],
|
||||
},
|
||||
#[br(pre_assert(*magic == ServerZoneIpcType::QuestActiveList))]
|
||||
QuestActiveList(QuestActiveList),
|
||||
Unknown {
|
||||
#[br(count = size - 32)]
|
||||
unk: Vec<u8>,
|
||||
|
@ -943,6 +948,10 @@ mod tests {
|
|||
ServerZoneIpcType::FreeCompanyInfo,
|
||||
ServerZoneIpcData::FreeCompanyInfo { unk: [0; 80] },
|
||||
),
|
||||
(
|
||||
ServerZoneIpcType::QuestActiveList,
|
||||
ServerZoneIpcData::QuestActiveList(QuestActiveList::default()),
|
||||
),
|
||||
];
|
||||
|
||||
for (opcode, data) in &ipc_types {
|
||||
|
|
24
src/ipc/zone/quest_active_list.rs
Normal file
24
src/ipc/zone/quest_active_list.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
use binrw::binrw;
|
||||
|
||||
#[binrw]
|
||||
#[derive(Debug, Clone, Copy, Default)]
|
||||
pub struct ActiveQuest {
|
||||
pub id: u16,
|
||||
pub sequence: u8,
|
||||
#[brw(pad_after = 1)] // padding
|
||||
pub flags: u8,
|
||||
#[brw(pad_after = 1)] // padding
|
||||
pub bitflags: [u8; 6],
|
||||
}
|
||||
|
||||
impl ActiveQuest {
|
||||
pub const SIZE: usize = 16;
|
||||
}
|
||||
|
||||
#[binrw]
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct QuestActiveList {
|
||||
#[br(count = 30)]
|
||||
#[brw(pad_size_to = 30 * ActiveQuest::SIZE)]
|
||||
pub quests: Vec<ActiveQuest>,
|
||||
}
|
|
@ -21,9 +21,9 @@ use crate::{
|
|||
ActionEffect, ActionRequest, ActionResult, ActorControl, ActorControlCategory,
|
||||
ActorControlSelf, ActorControlTarget, ClientZoneIpcSegment, CommonSpawn, Config,
|
||||
ContainerInfo, CurrencyInfo, DisplayFlag, EffectKind, Equip, GameMasterRank, InitZone,
|
||||
ItemInfo, Move, NpcSpawn, ObjectKind, PlayerStats, PlayerSubKind, ServerZoneIpcData,
|
||||
ServerZoneIpcSegment, StatusEffect, StatusEffectList, UpdateClassInfo, Warp,
|
||||
WeatherChange,
|
||||
ItemInfo, Move, NpcSpawn, ObjectKind, PlayerStats, PlayerSubKind, QuestActiveList,
|
||||
ServerZoneIpcData, ServerZoneIpcSegment, StatusEffect, StatusEffectList,
|
||||
UpdateClassInfo, Warp, WeatherChange,
|
||||
},
|
||||
},
|
||||
opcodes::ServerZoneIpcType,
|
||||
|
@ -1295,6 +1295,24 @@ impl ZoneConnection {
|
|||
}
|
||||
|
||||
pub async fn send_quest_information(&mut self) {
|
||||
// quest active list
|
||||
{
|
||||
let ipc = ServerZoneIpcSegment {
|
||||
op_code: ServerZoneIpcType::QuestActiveList,
|
||||
timestamp: timestamp_secs(),
|
||||
data: ServerZoneIpcData::QuestActiveList(QuestActiveList::default()),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
self.send_segment(PacketSegment {
|
||||
source_actor: self.player_data.actor_id,
|
||||
target_actor: self.player_data.actor_id,
|
||||
segment_type: SegmentType::Ipc,
|
||||
data: SegmentData::Ipc { data: ipc },
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
||||
// quest complete list
|
||||
{
|
||||
let ipc = ServerZoneIpcSegment {
|
||||
|
|
Loading…
Add table
Reference in a new issue