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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
//! Checks a mod answers for the game: interactions, skills, comfort, experience and altar limits.
use c_void;
use crate;
/// A player about to interact with an entity, as
/// [`HostApi::interaction_filter`](super::HostApi::interaction_filter) hands it
/// on.
///
/// Open it, move items in or out of it, sort it, craft or build from it,
/// dismantle it, or flip its Quick Stash or upgrade switch.
///
/// # Examples
///
/// ```
/// use enshwick::abi::{Header, Interaction};
///
/// let call = Interaction {
/// header: Header::of::<Interaction>(),
/// kind: Interaction::OPEN,
/// player: enshwick::Entity(4096),
/// target: enshwick::Entity(5000),
/// item: enshwick::ItemId::new(0x5e01),
/// known: 1,
/// reserved: [0; 3],
/// position: [1.0, 2.0, 3.0],
/// };
/// assert_eq!(call.kind, Interaction::OPEN);
/// ```
impl_headed!;
/// A mod's interaction filter: the call and the pointer given at
/// registration; returns 0 to refuse, which the game handles as its own
/// refusal, so nothing moves and nothing is lost.
pub type InteractionFn =
unsafe extern "system" fn ;
/// The game asking whether a character unlocked a skill node, as
/// [`HostApi::skill_override`](super::HostApi::skill_override) hands it on.
///
/// # Examples
///
/// ```
/// use enshwick::abi::{Header, SkillCheck};
///
/// let check = SkillCheck { header: Header::of::<SkillCheck>(), node: enshwick::abi::SkillNode::new(0x4475_e8dd), gate: SkillCheck::FLY_MODE, unlocked: 0, reserved: [0; 3] };
/// assert_eq!(check.gate, SkillCheck::FLY_MODE);
/// ```
impl_headed!;
/// A skill override: the check and the pointer given at registration;
/// returns [`SkillCheck::VANILLA`], [`SkillCheck::UNLOCKED`] or
/// [`SkillCheck::LOCKED`].
pub type SkillCheckFn =
unsafe extern "system" fn ;
/// A comfort provider in a base registering its comfort for its category,
/// as [`HostApi::comfort_filter`](super::HostApi::comfort_filter) hands it on.
///
/// # Examples
///
/// ```
/// use enshwick::abi::{Comfort, Header};
///
/// let comfort = Comfort { header: Header::of::<Comfort>(), category: 3, value: 5, position: [0.0; 3] };
/// assert_eq!(comfort.value, 5);
/// ```
impl_headed!;
/// A comfort filter: the registration and the pointer given at
/// registration; returns the comfort to register.
pub type ComfortFn = unsafe extern "system" fn ;
/// One character's experience before the game applies it, in an
/// [`ExperiencePass`]. Its layout is frozen: it is passed as an array.
///
/// # Examples
///
/// ```
/// use enshwick::abi::ExperienceRow;
///
/// let row = ExperienceRow { entity: enshwick::Entity(4096), level: 3, progress: 10, need: 100, gained: 5 };
/// assert_eq!(row.gained, 5);
/// ```
/// Every spawned character's experience before the server applies it, as
/// [`HostApi::experience_filter`](super::HostApi::experience_filter) hands it on.
///
/// # Examples
///
/// ```
/// use enshwick::abi::{ExperiencePass, Header};
///
/// let pass = ExperiencePass { header: Header::of::<ExperiencePass>(), rows: core::ptr::null_mut(), row_count: 0, level_cap: 25, need_for: None, token: core::ptr::null_mut() };
/// assert_eq!(pass.level_cap, 25);
/// ```
impl_headed!;
/// An experience filter: the pass and the pointer given at registration.
pub type ExperiencePassFn = unsafe extern "system" fn;
/// How many altars a Flame level allows, as the loader asks every
/// [`HostApi::altar_limit_filter`](super::HostApi::altar_limit_filter) in
/// load order.
///
/// # Examples
///
/// ```
/// use enshwick::abi::{AltarLimit, Header};
///
/// let limit = AltarLimit { header: Header::of::<AltarLimit>(), flame_level: 3, vanilla: 6, allowed: 6, reserved: [0; 2] };
/// assert_eq!(limit.allowed, limit.vanilla);
/// ```
impl_headed!;
/// The most altar zones and bases the game groups, as
/// [`HostApi::base_limit`](super::HostApi::base_limit) writes it.
///
/// # Examples
///
/// ```
/// use enshwick::abi::{BaseLimitInfo, Header};
///
/// let limit = BaseLimitInfo {
/// header: Header::of::<BaseLimitInfo>(),
/// zones: 16,
/// bases: 16,
/// vanilla_zones: 16,
/// reserved: 0,
/// vanilla_bases: 16,
/// max_zones: 255,
/// max_bases: 16,
/// };
/// assert_eq!(limit.zones, limit.vanilla_zones);
/// ```
impl_headed!;
/// An altar limit filter: the limit so far, writable, and the pointer given
/// at registration. It must not unwind.
pub type AltarLimitFilterFn = unsafe extern "system" fn;