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
//! Structs and functions to interact with the data of items in a general context.

use crate::ffi;

/// An IQ Group ID with associated methods to get metadata.
///
/// Use the associated constants or the [`Self::new`] method to get instances of this.
pub type IqGroupId = ffi::iq_group_id;
impl Copy for IqGroupId {}

/// This impl provides general metadata about IQ Groups in the game.
impl IqGroupId {
    /// Returns the ID struct for the IQ Group with the given ID.
    ///
    /// # Safety
    /// The caller must make sure the ID is valid (refers to an existing IQ Group),
    /// otherwise this is UB.
    pub const unsafe fn new(id: u32) -> Self {
        Self(id)
    }

    /// Returns the ID of this IQ Group.
    pub const fn id(&self) -> u32 {
        self.0
    }
}

impl From<IqGroupId> for u32 {
    fn from(v: IqGroupId) -> Self {
        v.0
    }
}

/// An IQ Skill ID with associated methods to get metadata.
///
/// Use the associated constants or the [`Self::new`] method to get instances of this.
pub type IqSkillId = ffi::iq_skill_id;
impl Copy for IqSkillId {}

/// This impl provides general metadata about IQ Skills in the game.
impl IqSkillId {
    /// Returns the ID struct for the IQ Skill with the given ID.
    ///
    /// # Safety
    /// The caller must make sure the ID is valid (refers to an existing IQ Skill),
    /// otherwise this is UB.
    pub const unsafe fn new(id: u32) -> Self {
        Self(id)
    }

    /// Returns the ID of this IQ Skill.
    pub const fn id(&self) -> u32 {
        self.0
    }
}

impl From<IqSkillId> for u32 {
    fn from(v: IqSkillId) -> Self {
        v.0
    }
}