1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//! Player status packets \[0x06\]
use super::{models::character::Class, HelperReadWrite, ObjectHeader, PacketReadWrite};
use half::f16;
// ----------------------------------------------------------------
// Player status packets
// ----------------------------------------------------------------
/// (0x06, 0x00) Set Player ID.
///
/// (S -> C) Sent during map loading.
///
/// Following: [`crate::protocol::Packet::LoadLevel`]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(default))]
#[derive(Debug, Default, Clone, PartialEq, PacketReadWrite)]
#[Id(0x06, 0x00)]
pub struct SetPlayerIDPacket {
pub player_id: u32,
pub unk1: u32,
pub unk2: u32,
}
/// (0x06, 0x01) Deal damage to an object.
///
/// (C -> S) Sent when the client wants to deal damage.
///
/// Respond with: [`crate::protocol::Packet::DamageReceive`]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(default))]
#[derive(Debug, Clone, Default, PartialEq, PacketReadWrite)]
#[Id(0x06, 0x01)]
pub struct DealDamagePacket {
/// Object that inflicted the damage.
pub inflicter: ObjectHeader,
/// Object that received the damage.
pub target: ObjectHeader,
pub attack_id: u32,
pub unk2: u64,
/// Hitbox ID (?).
pub hitbox_id: u32,
/// Hit x position.
pub x_pos: f16,
/// Hit y position.
pub y_pos: f16,
/// Hit z position.
pub z_pos: f16,
pub unk4: u16,
pub unk5: u64,
pub unk6: [u8; 0x18],
}
/// (0x06, 0x05) EXP Gained. (broadcast)
///
/// (S -> C) Sent when the players earn EXP.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(default))]
#[derive(Debug, Clone, Default, PartialEq, PacketReadWrite)]
#[Id(0x06, 0x05)]
#[Flags(Flags::PACKED)]
#[Magic(0x7C49, 0x9E)]
pub struct GainedEXPPacket {
/// Packet receiver.
pub sender: ObjectHeader,
/// All players that gained EXP.
pub receivers: Vec<EXPReceiver>,
}
// ----------------------------------------------------------------
// Additional structs
// ----------------------------------------------------------------
/// Information about EXP receiving player.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(default))]
#[derive(Debug, Default, Clone, PartialEq, HelperReadWrite)]
pub struct EXPReceiver {
/// Player that received EXP.
pub object: ObjectHeader,
pub unk1: u8,
pub unk2: u8,
pub unk3: [u8; 6],
/// How much EXP did the main class earn.
pub gained: u64,
/// Main class total EXP.
pub total: u64,
/// New sublevel(?) of the main class.
pub level2: u16,
/// New level of the main class.
pub level: u16,
/// Main class.
pub class: Class,
pub pad1: [u8; 3],
/// How much EXP did the subclass earn.
pub gained_sub: u64,
/// Subclass total EXP.
pub total_sub: u64,
/// New sublevel(?) of the subclass.
pub level2_sub: u16,
/// New level of the subclass.
pub level_sub: u16,
/// Subclass.
pub subclass: Class,
pub pad2: [u8; 3],
}