forked from zenDzeeMods/zenDzeeMods_Heritage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
StaticBodySliders.cs
423 lines (410 loc) · 13.6 KB
/
StaticBodySliders.cs
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
using TaleWorlds.Core;
namespace zenDzeeMods
{
internal class StaticBodySliders
{
private ulong KeyPart6;
private ulong KeyPart5;
private ulong KeyPart4;
private ulong KeyPart3;
private ulong KeyPart2;
private ulong KeyPart1;
private ulong KeyPart8;
private ulong KeyPart7;
public StaticBodySliders(StaticBodyProperties properties)
{
KeyPart1 = properties.KeyPart1;
KeyPart2 = properties.KeyPart2;
KeyPart3 = properties.KeyPart3;
KeyPart4 = properties.KeyPart4;
KeyPart5 = properties.KeyPart5;
KeyPart6 = properties.KeyPart6;
KeyPart7 = properties.KeyPart7;
KeyPart8 = properties.KeyPart8;
}
public StaticBodyProperties GetStaticBodyProperties()
{
return new StaticBodyProperties(KeyPart1, KeyPart2, KeyPart3, KeyPart4, KeyPart5, KeyPart6, KeyPart7, KeyPart8);
}
private void SetHalfByte(ref ulong key, int halfBytePosition, byte value)
{
halfBytePosition *= 4;
ulong s = value;
ulong n = s << halfBytePosition;
s = 0x0Ful << halfBytePosition;
key = (key & ~s) | (n & s);
}
private byte GetHalfByte(ulong key, int halfBytePosition)
{
halfBytePosition *= 4;
return (byte)((key >> halfBytePosition) & 0x0Ful);
}
// halfBytePosition - points to least half-byte
private void SetByte(ref ulong key, int halfBytePosition, byte value)
{
halfBytePosition *= 4;
ulong s = value;
ulong n = s << halfBytePosition;
s = 0xFFul << halfBytePosition;
key = (key & ~s) | (n & s);
}
private byte GetByte(ulong key, int halfBytePosition)
{
halfBytePosition *= 4;
return (byte)((key >> halfBytePosition) & 0xFFul);
}
private void SetBits(ref ulong key, int bitPosition, int size, byte value)
{
ulong s = value;
ulong n = s << bitPosition;
s = (~(0xFFFFFFFFFFFFFFFFul << size)) << bitPosition;
key = (key & ~s) | (n & s);
}
private byte GetBits(ulong key, int bitPosition, int size)
{
ulong s = ~(0xFFFFFFFFFFFFFFFFul << size);
return (byte)((key >> bitPosition) & s);
}
public byte FaceWidth
{
get { return GetHalfByte(KeyPart2, 0); }
set { SetHalfByte(ref KeyPart2, 0, value); }
}
public byte FaceDepth
{
get { return GetHalfByte(KeyPart2, 1); }
set { SetHalfByte(ref KeyPart2, 1, value); }
}
public byte FaceCenterHeight
{
get { return GetHalfByte(KeyPart2, 2); }
set { SetHalfByte(ref KeyPart2, 2, value); }
}
public byte FaceRatio
{
get { return GetHalfByte(KeyPart2, 3); }
set { SetHalfByte(ref KeyPart2, 3, value); }
}
public byte FaceWeight
{
get { return GetHalfByte(KeyPart2, 4); }
set { SetHalfByte(ref KeyPart2, 4, value); }
}
public byte FaceCheekboneHeight
{
get { return GetHalfByte(KeyPart2, 5); }
set { SetHalfByte(ref KeyPart2, 5, value); }
}
public byte FaceCheekboneWidth
{
get { return GetHalfByte(KeyPart2, 6); }
set { SetHalfByte(ref KeyPart2, 6, value); }
}
public byte FaceCheekboneDepth
{
get { return GetHalfByte(KeyPart2, 7); }
set { SetHalfByte(ref KeyPart2, 7, value); }
}
public byte FaceSharpness
{
get { return GetHalfByte(KeyPart2, 8); }
set { SetHalfByte(ref KeyPart2, 8, value); }
}
public byte FaceTempleWidth
{
get { return GetHalfByte(KeyPart2, 9); }
set { SetHalfByte(ref KeyPart2, 9, value); }
}
public byte FaceEyeSocketSize
{
get { return GetHalfByte(KeyPart2, 10); }
set { SetHalfByte(ref KeyPart2, 10, value); }
}
public byte FaceEarShape
{
get { return GetHalfByte(KeyPart2, 11); }
set { SetHalfByte(ref KeyPart2, 11, value); }
}
public byte FaceEarSize
{
get { return GetHalfByte(KeyPart2, 12); }
set { SetHalfByte(ref KeyPart2, 12, value); }
}
public byte FaceAsymmetry
{
get { return GetHalfByte(KeyPart2, 13); }
set { SetHalfByte(ref KeyPart2, 13, value); }
}
public byte EyeEyebrowType
{
get { return GetHalfByte(KeyPart8, 3); }
set { SetHalfByte(ref KeyPart8, 3, value); }
}
public byte EyeEyebrowDepth
{
get { return GetHalfByte(KeyPart2, 14); }
set { SetHalfByte(ref KeyPart2, 14, value); }
}
public byte EyeBrowOuterHeight
{
get { return GetHalfByte(KeyPart2, 15); }
set { SetHalfByte(ref KeyPart2, 15, value); }
}
public byte EyeBrowMiddleHeight
{
get { return GetHalfByte(KeyPart3, 0); }
set { SetHalfByte(ref KeyPart3, 0, value); }
}
public byte EyeBrowInnerHeight
{
get { return GetHalfByte(KeyPart3, 1); }
set { SetHalfByte(ref KeyPart3, 1, value); }
}
public byte EyePosition
{
get { return GetHalfByte(KeyPart3, 2); }
set { SetHalfByte(ref KeyPart3, 2, value); }
}
public byte EyeSize
{
get { return GetHalfByte(KeyPart3, 3); }
set { SetHalfByte(ref KeyPart3, 3, value); }
}
public byte EyeMonolidEyes
{
get { return GetHalfByte(KeyPart3, 4); }
set { SetHalfByte(ref KeyPart3, 4, value); }
}
public byte EyeEyelidHeight
{
get { return GetHalfByte(KeyPart3, 5); }
set { SetHalfByte(ref KeyPart3, 5, value); }
}
public byte EyeDepth
{
get { return GetHalfByte(KeyPart3, 6); }
set { SetHalfByte(ref KeyPart3, 6, value); }
}
public byte EyeShape
{
get { return GetHalfByte(KeyPart3, 7); }
set { SetHalfByte(ref KeyPart3, 7, value); }
}
public byte EyeOuterHeight
{
get { return GetHalfByte(KeyPart3, 8); }
set { SetHalfByte(ref KeyPart3, 8, value); }
}
public byte EyeInnerHeight
{
get { return GetHalfByte(KeyPart3, 9); }
set { SetHalfByte(ref KeyPart3, 9, value); }
}
public byte EyeToEyeDistance
{
get { return GetHalfByte(KeyPart3, 10); }
set { SetHalfByte(ref KeyPart3, 10, value); }
}
public byte EyeAsymmetry
{
get { return GetHalfByte(KeyPart3, 11); }
set { SetHalfByte(ref KeyPart3, 11, value); }
}
public byte EyeColor
{
get { return GetHalfByte(KeyPart1, 11); }
set { SetHalfByte(ref KeyPart1, 11, value); }
}
public byte NoseAngle
{
get { return GetHalfByte(KeyPart3, 12); }
set { SetHalfByte(ref KeyPart3, 12, value); }
}
public byte NoseLength
{
get { return GetHalfByte(KeyPart3, 13); }
set { SetHalfByte(ref KeyPart3, 13, value); }
}
public byte NoseBridge
{
get { return GetHalfByte(KeyPart3, 14); }
set { SetHalfByte(ref KeyPart3, 14, value); }
}
public byte NoseTipHeight
{
get { return GetHalfByte(KeyPart3, 15); }
set { SetHalfByte(ref KeyPart3, 15, value); }
}
public byte NoseSize
{
get { return GetHalfByte(KeyPart4, 0); }
set { SetHalfByte(ref KeyPart4, 0, value); }
}
public byte NoseWidth
{
get { return GetHalfByte(KeyPart4, 1); }
set { SetHalfByte(ref KeyPart4, 1, value); }
}
public byte NoseNostrilHeight
{
get { return GetHalfByte(KeyPart4, 2); }
set { SetHalfByte(ref KeyPart4, 2, value); }
}
public byte NoseNostrilSize
{
get { return GetHalfByte(KeyPart4, 3); }
set { SetHalfByte(ref KeyPart4, 3, value); }
}
public byte NoseBump
{
get { return GetHalfByte(KeyPart4, 4); }
set { SetHalfByte(ref KeyPart4, 4, value); }
}
public byte NoseDefenition
{
get { return GetHalfByte(KeyPart4, 5); }
set { SetHalfByte(ref KeyPart4, 5, value); }
}
public byte NoseShape
{
get { return GetHalfByte(KeyPart4, 6); }
set { SetHalfByte(ref KeyPart4, 6, value); }
}
public byte NoseAsymmetry
{
get { return GetHalfByte(KeyPart4, 7); }
set { SetHalfByte(ref KeyPart4, 7, value); }
}
public byte MouthTeethType
{
get { return GetHalfByte(KeyPart8, 1); }
set { SetHalfByte(ref KeyPart8, 1, value); }
}
public byte MouthWidth
{
get { return GetHalfByte(KeyPart4, 8); }
set { SetHalfByte(ref KeyPart4, 8, value); }
}
public byte MouthPosition
{
get { return GetHalfByte(KeyPart4, 9); }
set { SetHalfByte(ref KeyPart4, 9, value); }
}
public byte MouthFrowSmile
{
get { return GetHalfByte(KeyPart4, 10); }
set { SetHalfByte(ref KeyPart4, 10, value); }
}
public byte MouthLipThickness
{
get { return GetHalfByte(KeyPart4, 11); }
set { SetHalfByte(ref KeyPart4, 11, value); }
}
public byte MouthForward
{
get { return GetHalfByte(KeyPart4, 12); }
set { SetHalfByte(ref KeyPart4, 12, value); }
}
public byte MouthBottomLipShape
{
get { return GetHalfByte(KeyPart4, 13); }
set { SetHalfByte(ref KeyPart4, 13, value); }
}
public byte MouthTopLipShape
{
get { return GetHalfByte(KeyPart4, 14); }
set { SetHalfByte(ref KeyPart4, 14, value); }
}
public byte MouthLipsConcaveConvex
{
get { return GetHalfByte(KeyPart4, 15); }
set { SetHalfByte(ref KeyPart4, 15, value); }
}
public byte MouthJawLine
{
get { return GetHalfByte(KeyPart5, 0); }
set { SetHalfByte(ref KeyPart5, 0, value); }
}
public byte MouthJawShape
{
get { return GetHalfByte(KeyPart5, 1); }
set { SetHalfByte(ref KeyPart5, 1, value); }
}
public byte MouthJawHeight
{
get { return GetHalfByte(KeyPart5, 2); }
set { SetHalfByte(ref KeyPart5, 2, value); }
}
public byte MouthChinForward
{
get { return GetHalfByte(KeyPart5, 3); }
set { SetHalfByte(ref KeyPart5, 3, value); }
}
public byte MouthChinShape
{
get { return GetHalfByte(KeyPart5, 4); }
set { SetHalfByte(ref KeyPart5, 4, value); }
}
public byte MouthChinLength
{
get { return GetHalfByte(KeyPart5, 5); }
set { SetHalfByte(ref KeyPart5, 5, value); }
}
// limited set of value
public byte HairType
{
get { return GetByte(KeyPart1, 0); }
set { SetByte(ref KeyPart1, 0, value); }
}
// limited set of value
public byte HairColor
{
get { return GetBits(KeyPart1, 30, 6); }
set { SetBits(ref KeyPart1, 30, 6, value); }
}
// limited set of value
public byte MarkingsColor
{
get { return GetByte(KeyPart1, 4); }
set { SetByte(ref KeyPart1, 4, value); }
}
// limited set of value
public byte MarkingsType
{
get { return GetBits(KeyPart1, 24, 6); }
set { SetBits(ref KeyPart1, 24, 6, value); }
}
// limited set of value
public byte VoiceType
{
get { return GetHalfByte(KeyPart8, 0); }
set { SetHalfByte(ref KeyPart8, 0, value); }
}
// limited set of value
public byte VoicePitch
{
get { return GetByte(KeyPart8, 6); }
set { SetByte(ref KeyPart8, 6, value); }
}
// limited set of value
public byte SkinColor
{
get { return GetByte(KeyPart1, 12); }
set { SetByte(ref KeyPart1, 12, value); }
}
}
internal class HairHelper
{
public static byte MaxHairType(bool isFemale)
{
if (isFemale)
{
return 0x13;
}
else
{
return 0x19;
}
}
}
}