physis/layer/
npc.rs

1// SPDX-FileCopyrightText: 2025 Joshua Goins <josh@redstrate.com>
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4use binrw::binread;
5
6use super::common::RelativePositions;
7
8#[binread]
9#[derive(Debug)]
10#[br(little)]
11pub struct GameInstanceObject {
12    base_id: u32,
13}
14
15#[binread]
16#[derive(Debug)]
17#[br(little)]
18pub struct NPCInstanceObject {
19    parent_data: GameInstanceObject,
20    pop_weather: u32,
21    pop_time_start: u8,
22    pop_time_end: u8,
23    padding: u16,
24    move_ai: u32,
25    wandering_range: u8,
26    route: u8,
27    event_group: u16,
28    padding1: [u32; 2],
29}
30
31#[binread]
32#[derive(Debug)]
33#[br(little)]
34pub struct ENPCInstanceObject {
35    pub parent_data: NPCInstanceObject,
36    pub behavior: u32,
37    padding: [u32; 2],
38}
39
40#[binread]
41#[derive(Debug)]
42#[br(little)]
43pub struct BNPCInstanceObject {
44    pub parent_data: NPCInstanceObject,
45    pub name_id: u32,
46    pub drop_item: u32,
47    pub sense_range_rate: f32,
48    pub level: u16,
49    pub active_type: u8,
50    pub pop_interval: u8,
51    pub pop_rate: u8,
52    pub pop_event: u8,
53    pub link_group: u8,
54    pub link_family: u8,
55    pub link_range: u8,
56    pub link_count_limit: u8,
57    pub nonpop_init_zone: u8,
58    pub invalid_repop: u8,
59    pub link_parent: u8,
60    pub link_override: u8,
61    pub link_reply: u8,
62    pub nonpop: u8,
63    pub relative_positions: RelativePositions,
64    pub horizontal_pop_range: f32,
65    pub vertical_pop_range: f32,
66    pub bnpc_base_data: i32,
67    pub repop_id: u8,
68    pub bnpc_ran_id: u8,
69    pub territory_range: u16,
70    pub bound_instance_id: u32,
71    pub fate_layout_label_id: u32,
72    pub normal_ai: u32,
73    pub server_path_id: u32,
74    pub equipment_id: u32,
75    pub customize_id: u32,
76    // TODO: read relativeposition data
77}