1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-07-19 11:17:46 +00:00

Add support for the QuestActiveList IPC opcode

This commit is contained in:
Joshua Goins 2025-07-13 11:24:14 -04:00
parent 8be1fefa53
commit 2cc562de38
4 changed files with 59 additions and 3 deletions

View file

@ -284,6 +284,11 @@
"name": "TitleList", "name": "TitleList",
"opcode": 731, "opcode": 731,
"size": 112 "size": 112
},
{
"name": "QuestActiveList",
"opcode": 398,
"size": 480
} }
], ],
"ClientZoneIpcType": [ "ClientZoneIpcType": [

View file

@ -91,6 +91,9 @@ pub use event_yield_handler::EventYieldHandler;
mod object_spawn; mod object_spawn;
pub use object_spawn::ObjectSpawn; pub use object_spawn::ObjectSpawn;
mod quest_active_list;
pub use quest_active_list::QuestActiveList;
use crate::COMPLETED_QUEST_BITMASK_SIZE; use crate::COMPLETED_QUEST_BITMASK_SIZE;
use crate::TITLE_UNLOCK_BITMASK_SIZE; use crate::TITLE_UNLOCK_BITMASK_SIZE;
use crate::common::ObjectTypeId; use crate::common::ObjectTypeId;
@ -467,6 +470,8 @@ pub enum ServerZoneIpcData {
TitleList { TitleList {
unlock_bitmask: [u8; TITLE_UNLOCK_BITMASK_SIZE], unlock_bitmask: [u8; TITLE_UNLOCK_BITMASK_SIZE],
}, },
#[br(pre_assert(*magic == ServerZoneIpcType::QuestActiveList))]
QuestActiveList(QuestActiveList),
Unknown { Unknown {
#[br(count = size - 32)] #[br(count = size - 32)]
unk: Vec<u8>, unk: Vec<u8>,
@ -943,6 +948,10 @@ mod tests {
ServerZoneIpcType::FreeCompanyInfo, ServerZoneIpcType::FreeCompanyInfo,
ServerZoneIpcData::FreeCompanyInfo { unk: [0; 80] }, ServerZoneIpcData::FreeCompanyInfo { unk: [0; 80] },
), ),
(
ServerZoneIpcType::QuestActiveList,
ServerZoneIpcData::QuestActiveList(QuestActiveList::default()),
),
]; ];
for (opcode, data) in &ipc_types { for (opcode, data) in &ipc_types {

View 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>,
}

View file

@ -21,9 +21,9 @@ use crate::{
ActionEffect, ActionRequest, ActionResult, ActorControl, ActorControlCategory, ActionEffect, ActionRequest, ActionResult, ActorControl, ActorControlCategory,
ActorControlSelf, ActorControlTarget, ClientZoneIpcSegment, CommonSpawn, Config, ActorControlSelf, ActorControlTarget, ClientZoneIpcSegment, CommonSpawn, Config,
ContainerInfo, CurrencyInfo, DisplayFlag, EffectKind, Equip, GameMasterRank, InitZone, ContainerInfo, CurrencyInfo, DisplayFlag, EffectKind, Equip, GameMasterRank, InitZone,
ItemInfo, Move, NpcSpawn, ObjectKind, PlayerStats, PlayerSubKind, ServerZoneIpcData, ItemInfo, Move, NpcSpawn, ObjectKind, PlayerStats, PlayerSubKind, QuestActiveList,
ServerZoneIpcSegment, StatusEffect, StatusEffectList, UpdateClassInfo, Warp, ServerZoneIpcData, ServerZoneIpcSegment, StatusEffect, StatusEffectList,
WeatherChange, UpdateClassInfo, Warp, WeatherChange,
}, },
}, },
opcodes::ServerZoneIpcType, opcodes::ServerZoneIpcType,
@ -1295,6 +1295,24 @@ impl ZoneConnection {
} }
pub async fn send_quest_information(&mut self) { 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 // quest complete list
{ {
let ipc = ServerZoneIpcSegment { let ipc = ServerZoneIpcSegment {