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
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
|
using System.Numerics;
using ImGuiNET;
using SharpPluginLoader.Core;
using SharpPluginLoader.Core.Memory;
using SharpPluginLoader.Core.View;
using SharpPluginLoader.Core.Entities;
using SharpPluginLoader.Core.Rendering;
namespace PlayerPoser
{
using static Utility;
public unsafe class Plugin : IPlugin
{
public string Name => "Player Poser";
public string Author => "Akon City Software";
private const string fontPath = "nativePC/plugins/CSharp/Fonts/Catrinity.otf";
private bool tryCustomFont = false;
internal static readonly MtObject sMhArea = SingletonManager.GetSingleton("sMhArea")!;
internal static readonly MtObject sPlayer = SingletonManager.GetSingleton("sPlayer")!;
internal static readonly MtObject sOtomo = SingletonManager.GetSingleton("sOtomo")!;
internal static readonly MtObject sUserData = SingletonManager.GetSingleton("sUserData")!;
private bool hideWeapon = false;
private NativeAction<nint, int> hideWeaponFunc;
private bool hideKnife = false;
private bool hideSlinger = false;
private bool updateHideSlinger = false;
private static bool overridePlayerWetness = false;
private static float headWetness = 0.0f;
private static float bodyWetness = 0.0f;
private static float waistWetness = 0.0f;
private static float legsWetness = 0.0f;
private Patch noopPlayerWetnessUpdate;
private Patch jmpOverChangeEquipmentWetnessUpdate_1;
private Patch jmpOverChangeEquipmentWetnessUpdate_2;
private void overridePlayerWetnessEnable()
{
noopPlayerWetnessUpdate.Enable();
jmpOverChangeEquipmentWetnessUpdate_1.Enable();
jmpOverChangeEquipmentWetnessUpdate_2.Enable();
}
private void overridePlayerWetnessDisable()
{
noopPlayerWetnessUpdate.Disable();
jmpOverChangeEquipmentWetnessUpdate_1.Disable();
jmpOverChangeEquipmentWetnessUpdate_2.Disable();
}
private float playerOpacityOverride = 1.0f;
private float palicoOpacityOverride = 1.0f;
private delegate void UpdateCharacterParams(nint characterObject, nint unknownPtr);
private Hook<UpdateCharacterParams>? updateCharacterParams;
private delegate void UpdatePalicoFade(nint palicoObject);
private Hook<UpdatePalicoFade>? updatePalicoFade;
private bool disableCollision = false;
private bool disableExtraCollision = false;
private bool disableGravity = false;
private bool disableExtraGravity = false;
private Patch disableXCollision;
private Patch disableYCollision;
private Patch disableSecondaryYCollision;
private Patch disableZCollision;
private Patch disableExtraYCollision;
private Patch disableGravityYUpdate;
private Patch disableGravityXZUpdate;
private Patch disableGravityEval;
private void disableCollisionEnable()
{
disableXCollision.Enable();
disableYCollision.Enable();
disableSecondaryYCollision.Enable();
disableZCollision.Enable();
}
private void disableCollisionDisable()
{
disableXCollision.Disable();
disableYCollision.Disable();
disableSecondaryYCollision.Disable();
disableZCollision.Disable();
}
private void disableExtraCollisionEnable()
{
disableExtraYCollision.Enable();
}
private void disableExtraCollisionDisable()
{
disableExtraYCollision.Disable();
}
private void disableGravityEnable()
{
disableGravityYUpdate.Enable();
}
private void disableGravityDisable()
{
disableGravityYUpdate.Disable();
}
private void disableExtraGravityEnable()
{
disableGravityEval.Enable();
}
private void disableExtraGravityDisable()
{
disableGravityEval.Disable();
}
private bool sortMonsters;
private bool sortAnimals;
public PluginData Initialize()
{
PluginData data = new PluginData();
if (File.Exists(fontPath))
{
Renderer.RegisterFont("Catrinity", fontPath, 21.0f, GlyphRangeFactory.CreateGlyphRanges([
(0x0020, 0x00FF), (0x2640, 0x2642) // Gender symbols.
]));
tryCustomFont = true;
}
Utility.Initialize();
Zone.Initialize();
Armor.Initialize();
hideWeaponFunc = new NativeAction<nint, int>(0x141789AB0);
updateCharacterParams = Hook.Create<UpdateCharacterParams>(0x141F605F0, UpdateCharacterParamsHook);
updatePalicoFade = Hook.Create<UpdatePalicoFade>(0x14201D130, UpdatePalicoFadeHook);
noopPlayerWetnessUpdate = new Patch(0x14203E893, [0x90, 0x90, 0x90, 0x90, 0x90]);
jmpOverChangeEquipmentWetnessUpdate_1 = new Patch(0x14203E310, [0xEB]); // je -> jmp.
jmpOverChangeEquipmentWetnessUpdate_2 = new Patch(0x14203E397, [0xE9, 0xB9, 0x00, 0x00, 0x00, 0x90]); // je -> jmp.
// Noop collision checks.
nint addr = PatternScanner.FindFirst(Pattern.FromString("F3 0F 11 06 F3 0F 10 48 04 F3 0F 58 4E 04 F3 0F 11 4E 04 F3 0F 10 40 08 F3 0F 58 46 08 F3 0F 11 46 08 44 8B AF E0 0B 00 00"));
Assert(addr == 0x141C001B5);
disableXCollision = new Patch(addr, [0x90, 0x90, 0x90, 0x90]);
Assert(addr + 0xE == 0x141C001C3);
disableYCollision = new Patch(addr + 0xE, [0x90, 0x90, 0x90, 0x90, 0x90]);
Assert(addr + 0x1D == 0x141C001D2);
disableZCollision = new Patch(addr + 0x1D, [0x90, 0x90, 0x90, 0x90, 0x90]);
addr = PatternScanner.FindFirst(Pattern.FromString("F3 0F 11 46 04 F3 0F 10 46 08 F3 0F 5C C2 F3 0F 11 46 08 ?? ?? F3 0F"));
Assert(addr == 0x141C000D2);
disableSecondaryYCollision = new Patch(addr, [0x90, 0x90, 0x90, 0x90, 0x90]);
addr = PatternScanner.FindFirst(Pattern.FromString("F3 0F 11 46 04 F3 0F 10 58 08 F3 0F 58 5E 08 F3 0F 11 5E 08 44 8B 87 D0 0B 00 00 41 F6 C0 03"));
Assert(addr == 0x141BFFF90);
disableExtraYCollision = new Patch(addr, [0x90, 0x90, 0x90, 0x90, 0x90]);
addr = PatternScanner.FindFirst(Pattern.FromString("F3 0F 11 83 80 00 00 00 F3 0F 11 8B 84 00 00 00 F3 0F 11 93 88 00 00 00 89 B3 8C 00 00 00 8B 83 A4 01 00 00 C1 E8 05 44 0F 29 A4 24 D0 01 00 00 44 0F 29 B4 24 B0 01 00 00 A8 01"));
Assert(addr + 0x8 == 0x1413259ED);
disableGravityYUpdate = new Patch(addr + 0x8, [
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
]);
disableGravityXZUpdate = new Patch(addr, [
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, // Will already be applied.
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90
]);
addr = PatternScanner.FindFirst(Pattern.FromString("F3 0F 11 97 54 15 00 00 F3 0F 11 8F 58 15 00 00 F3 0F 10 47 68 F3 0F 5E D8 44 89 B7 6C 15 00 00 F3 0F 5E D0 F3 0F 5E C8 F3 0F 11 9F 60 15 00 00 F3 0F 11 97 64 15 00 00 F3 0F 11 8F 68 15 00 00"));
Assert(addr + 0x40 == 0x141BFFF75);
disableGravityEval = new Patch(addr + 0x40, [0x90, 0x90, 0x90, 0x90, 0x90]); // call MonsterHunterWorld.exe+1325810.
return data;
}
private void perFrameHideEquipment(Player player)
{
if (hideWeapon)
{
hideWeaponFunc.Invoke(player.Instance, 0);
/*
// MonsterHunterWorld.exe+1789ABA - mov rdi,[rcx+000076B0]
nint weapon = player.Get<nint>(0x76B0);
if (weapon != 0x0)
{
GetRef<byte>(weapon, 0x1A98) = 0x1;
int weaponParts = Get<int>(weapon, 0x2250);
for (int i = 0; i < weaponParts; i++)
{
nint part = Get<nint>(weapon, (i + 0x16B) * 24);
if (part != 0x0)
{
GetRef<byte>(part, 0x1A98) = 0x1;
}
}
}
*/
}
if (hideKnife)
{
// Emulate what Carving and Flourish emote do at
// MonsterHunterWorld.exe+1F68832 - bts eax,06
// if set, skips
// MonsterHunterWorld.exe+203A0D2 - bts ecx,01
player.GetRef<int>(0x8938) |= (1 << 6);
player.GetRef<int>(0x8968) |= (1 << 6);
/*
if (playerArmor[Armor.Waist] != 0x0)
{
if (hideKnife)
{
GetRef<byte>(playerArmor[Armor.Waist], 0x2D0) &= 0xFD;
}
else
{
GetRef<byte>(playerArmor[Armor.Waist], 0x2D0) |= 0x2;
}
}
*/
}
if (hideSlinger || updateHideSlinger)
{
nint slinger = player.Get<nint>(0x8918);
if (slinger != 0)
{
// MonsterHunterWorld.exe+AD9CC6 - cmp [rdi+000019E7],bl
// MonsterHunterWorld.exe+AD8A10 - and [rbx+000002D0],FFFFFE1E
GetRef<byte>(slinger, 0x19E7) = ByteFlag(hideSlinger);
updateHideSlinger = false;
}
}
}
internal static void OnPlayerChange()
{
Armor.OnPlayerChange();
}
public void OnUpdate(float deltaTime)
{
Utility.OnUpdate();
Armor.OnUpdate();
Player? player = getPlayer();
if (player != null)
{
perFrameHideEquipment(player);
}
}
internal static void OnZoneChange(nint player)
{
if (overridePlayerWetness)
{
nint wetnessAddr = player + 0x13BD0;
GetRef<float>(wetnessAddr) = headWetness;
GetRef<float>(wetnessAddr, 0x28) = bodyWetness;
GetRef<float>(wetnessAddr, 0x50) = waistWetness;
GetRef<float>(wetnessAddr, 0x78) = legsWetness;
}
}
private void UpdateCharacterParamsHook(nint characterObject, nint unknownPtr)
{
updateCharacterParams!.Original(characterObject, unknownPtr);
if (playerOpacityOverride != 1.0f)
{
Player? player = getPlayer();
if (player != null && characterObject == player.Instance)
{
player.GetRef<float>(0x78E0) = playerOpacityOverride;
}
}
}
public void UpdatePalicoFadeHook(nint palicoObject)
{
updatePalicoFade!.Original(palicoObject);
if (palicoOpacityOverride != 1.0f)
{
NativeWrapper palico = getPalico();
if (palico != 0x0 && palicoObject == palico)
{
palico.GetRef<float>(0x314) = palicoOpacityOverride;
}
}
}
private void drawPlayerName(NativeWrapper playerSettings, bool isFemale)
{
string playerName = new(playerSettings.GetPtrInline<sbyte>(0x50));
string genderSymbol;
if (tryCustomFont)
{
ImGui.PushFont(Renderer.GetFont("Catrinity"));
genderSymbol = isFemale ? "♀" : "♂";
}
else
{
genderSymbol = isFemale ? "(F)" : "(M)";
}
ImGui.Text($"{playerName}");
ImGui.SameLine();
if (isFemale)
{
ImGui.PushStyleColor(ImGuiCol.Text, (uint)ColorVectorToInt(ImGui.GetStyle().Colors[(int)ImGuiCol.PlotHistogram]));
}
else
{
ImGui.PushStyleColor(ImGuiCol.Text, (uint)ColorVectorToInt(ImGui.GetStyle().Colors[(int)ImGuiCol.PlotLinesHovered]));
}
ImGui.SetCursorPos(ImGui.GetCursorPos() - new Vector2(4.0f, (tryCustomFont && isFemale) ? -1.0f : 0.0f));
ImGui.Text($"{genderSymbol}");
ImGui.PopStyleColor();
if (tryCustomFont)
{
ImGui.PopFont();
}
ImGui.SetCursorPos(ImGui.GetCursorPos() + new Vector2(0.0f, 2.0f));
}
public void OnRender()
{
Armor.OnRender();
}
public void OnImGuiRender()
{
float width = ImGui.GetWindowWidth();
width /= width / 600.0f;
Player? player = getPlayer();
NativeWrapper playerSettings = new(0x0);
if (player == null)
{
ImGui.Text("Player not found");
goto debug;
}
playerSettings = getPlayerSettings();
bool isFemale = player.Get<byte>(0x1371C) == 1;
drawPlayerName(playerSettings, isFemale);
ImGui.Checkbox("Hide Weapon", ref hideWeapon);
ImGui.SameLine();
ImGui.Checkbox("Hide Knife", ref hideKnife);
ImGui.SameLine();
if (ImGui.Checkbox("Hide Slinger", ref hideSlinger))
{
updateHideSlinger = true;
}
ImGui.AlignTextToFramePadding();
ImGui.Text("Head Armor Display");
// MonsterHunterWorld.exe+11A2967 - cmp byte ptr [rax+001403E1],01
ref byte showHeadArmor = ref playerSettings.GetRef<byte>(0x1403E1);
int showHeadArmorInt = showHeadArmor;
ImGui.SameLine();
if (ImGui.RadioButton("Show", ref showHeadArmorInt, 0))
{
showHeadArmor = (byte)showHeadArmorInt;
}
ImGui.SameLine();
if (ImGui.RadioButton("Hide", ref showHeadArmorInt, 1))
{
showHeadArmor = (byte)showHeadArmorInt;
}
ImGui.SameLine();
if (ImGui.RadioButton("Hide in Cutscenes", ref showHeadArmorInt, 2))
{
showHeadArmor = (byte)showHeadArmorInt;
}
if (ImGui.CollapsingHeader("Armor Parts"))
{
Armor.drawArmorParts(player, width);
}
ImGui.PushID("Opacity");
ref float playerOpacity = ref player.GetRef<float>(0x78E0);
if (ImGui.Button("Reset"))
{
playerOpacity = 1.0f;
playerOpacityOverride = 1.0f;
}
ImGui.SameLine();
ImGui.SetNextItemWidth(width * 0.3f);
if (ImGui.DragFloat("Opacity", ref playerOpacity, 0.01f, 0.0f, Single.MaxValue))
{
playerOpacityOverride = playerOpacity;
}
NativeWrapper palico = getPalico();
if (palico != 0x0)
{
ImGui.PushID("Palico");
ref float palicoOpacity = ref palico.GetRef<float>(0x314);
if (ImGui.Button("Reset"))
{
palicoOpacity = 1.0f;
palicoOpacityOverride = 1.0f;
}
ImGui.SameLine();
ImGui.SetNextItemWidth(width * 0.3f);
if (ImGui.DragFloat("Palico Opacity", ref palicoOpacity, 0.01f, 0.0f, Single.MaxValue))
{
palicoOpacityOverride = palicoOpacity;
}
ImGui.PopID();
}
ImGui.PopID();
ImGui.PushID("Wetness");
if (ImGui.CollapsingHeader("Wetness"))
{
nint wetnessAddr = player.Instance + 0x13BD0;
ref float head = ref GetRef<float>(wetnessAddr);
ref float body = ref GetRef<float>(wetnessAddr, 0x28);
ref float waist = ref GetRef<float>(wetnessAddr, 0x50);
ref float legs = ref GetRef<float>(wetnessAddr, 0x78);
ImGui.PushItemWidth(width * 0.2f);
if (ImGui.DragFloat("Head", ref headWetness, 0.005f))
{
head = headWetness;
}
ImGui.SameLine();
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, ImGui.GetStyle().Alpha * disableAlphaFactor);
ImGui.Text($"(Current: {head})");
ImGui.PopStyleVar();
if (ImGui.DragFloat("Body", ref bodyWetness, 0.005f))
{
body = bodyWetness;
}
ImGui.SameLine();
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, ImGui.GetStyle().Alpha * disableAlphaFactor);
ImGui.Text($"(Current: {body})");
ImGui.PopStyleVar();
if (ImGui.DragFloat("Waist", ref waistWetness, 0.005f))
{
waist = waistWetness;
}
ImGui.SameLine();
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, ImGui.GetStyle().Alpha * disableAlphaFactor);
ImGui.Text($"(Current: {waist})");
ImGui.PopStyleVar();
if (ImGui.DragFloat("Legs", ref legsWetness, 0.005f))
{
legs = legsWetness;
}
ImGui.SameLine();
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, ImGui.GetStyle().Alpha * disableAlphaFactor);
ImGui.Text($"(Current: {legs})");
ImGui.PopStyleVar();
ImGui.PopItemWidth();
if (ImGui.Button("Reset"))
{
head = headWetness = 0.0f;
body = bodyWetness = 0.0f;
waist = waistWetness = 0.0f;
legs = legsWetness = 0.0f;
}
ImGui.SameLine();
if (ImGui.Checkbox("Override Player Wetness", ref overridePlayerWetness))
{
if (overridePlayerWetness)
{
overridePlayerWetnessEnable();
head = headWetness;
body = bodyWetness;
waist = waistWetness;
legs = legsWetness;
}
else
{
overridePlayerWetnessDisable();
}
}
}
ImGui.PopID();
if (ImGui.CollapsingHeader("Skin Tone"))
{
Armor.drawSkinTone(player, playerSettings, width);
}
ImGui.PushID("Position");
ImGui.PushItemWidth(width * 0.75f);
ImGui.DragFloat3("Position", ref player.Position, 0.5f);
Vector3 forward = new(player.Forward.X, player.Forward.Y, player.Forward.Z);
ImGui.DragFloat3("Forward", ref forward, 0.0f);
Vector4 rotation = new(player.Rotation.X, player.Rotation.Y, player.Rotation.Z, player.Rotation.W);
ImGui.SliderFloat4("Rotation", ref rotation, -1.0f, 1.0f);
if (Models.drawRotate("Rotate", rotation, out Vector4 result))
{
player.Rotation = new(result.X, result.Y, result.Z, result.W);
}
ImGui.PopItemWidth();
if (ImGui.Button("Reset"))
{
player.Rotation.X = 0.0f;
player.Rotation.Z = 0.0f;
}
ImGui.PopID();
if (ImGui.Checkbox("Disable Some Collision", ref disableCollision))
{
if (disableCollision)
{
disableCollisionEnable();
}
else
{
disableCollisionDisable();
}
}
ImGui.SameLine();
if (ImGui.Checkbox("Disable Another Y Collision", ref disableExtraCollision))
{
if (disableExtraCollision)
{
disableExtraCollisionEnable();
}
else
{
disableExtraCollisionDisable();
}
}
if (ImGui.BeginItemTooltip())
{
ImGui.Text("This will make your legs goofy, but is needed to get on top of some things.");
ImGui.EndTooltip();
}
if (ImGui.Checkbox("Disable Height Check", ref disableGravity))
{
if (disableGravity)
{
if (!disableExtraGravity)
{
disableExtraGravityEnable();
disableExtraGravity = true;
}
disableGravityEnable();
}
else
{
disableGravityDisable();
}
}
if (ImGui.BeginItemTooltip())
{
ImGui.Text("Avoid falling when going too high.");
ImGui.EndTooltip();
}
ImGui.SameLine();
float widthDiff = ImGui.CalcTextSize("Disable Some Collision").X - ImGui.CalcTextSize("Disable Height Check").X;
ImGui.SetCursorPos(ImGui.GetCursorPos() + new Vector2(widthDiff, 0.0f));
if (ImGui.Checkbox("Disable Gravity", ref disableExtraGravity))
{
if (disableExtraGravity)
{
disableExtraGravityEnable();
}
else
{
disableExtraGravityDisable();
}
}
if (ImGui.BeginItemTooltip())
{
ImGui.Text("Avoid falling when going out of bounds or rotating.");
ImGui.EndTooltip();
}
Zone.drawUI(player, getSaveSlotIndex() >= 0, width);
Models.drawAnimationInfo(player, width, false);
Armor.drawPoser(player, width);
debug:
if (ImGui.CollapsingHeader("DEBUG"))
{
drawDebugMenu(player, playerSettings, width);
}
}
private void drawDebugMenu(Player? player, NativeWrapper playerSettings, float width)
{
ImGui.PushID("Player");
ImGui.Text("Player");
ImGui.Text($"sPlayer: 0x{sPlayer.Instance:X}");
if (player != null)
{
ImGui.Text($"Address: 0x{player.Instance:X}");
ImGui.Text($"Settings: 0x{playerSettings.Instance:X}");
Models.drawAnimationInfo(player, width, true);
ImGui.Separator();
}
ImGui.PopID();
ImGui.PushID("Palico");
ImGui.Text("Palico/Otomo");
ImGui.Text($"sOtomo: 0x{sOtomo.Instance:X}");
ImGui.PopID();
if (ImGui.CollapsingHeader("Monsters"))
{
Monster[] monsters = Monster.GetAllMonsters();
ImGui.Text($"Count: {monsters.Length}");
ImGui.Checkbox("Sort by distance from camera", ref sortMonsters);
Viewport vp = CameraSystem.GetViewport(0);
if (sortMonsters && vp.Camera != null)
{
Array.Sort(monsters, delegate(Monster x, Monster y)
{
float distX = Vector3.Distance(vp.Camera.Position, x.Position);
float distY = Vector3.Distance(vp.Camera.Position, y.Position);
if (distX < distY) return 1;
else if (distX > distY) return -1;
return 0;
});
}
for (int i = monsters.Length - 1; i >= 0; i--)
{
Monster monster = monsters[i];
ImGui.PushID(monster.Instance);
ImGui.Text($"{monster.Name}:");
ImGui.Text($" Address: 0x{monster.Instance:X}");
ImGui.DragFloat3("Position", ref monster.Position, 0.5f);
Vector4 rotation = new(monster.Rotation.X, monster.Rotation.Y, monster.Rotation.Z, monster.Rotation.W);
ImGui.SliderFloat4("Rotation", ref rotation, -1.0f, 1.0f);
if (Models.drawRotate("Rotate", rotation, out Vector4 result))
{
monster.Rotation = new(result.X, result.Y, result.Z, result.W);
}
Models.drawAnimationInfo(monster, width, true);
ImGui.PopID();
ImGui.Separator();
}
}
if (ImGui.CollapsingHeader("Animals"))
{
Animal[] animals = Animal.GetAllAnimals();
ImGui.Text($"Count: {animals.Length}");
ImGui.Checkbox("Sort by distance from camera", ref sortAnimals);
Viewport vp = CameraSystem.GetViewport(0);
if (sortAnimals && vp.Camera != null)
{
Array.Sort(animals, delegate(Animal x, Animal y)
{
float distX = Vector3.Distance(vp.Camera.Position, x.Position);
float distY = Vector3.Distance(vp.Camera.Position, y.Position);
if (distX < distY) return 1;
else if (distX > distY) return -1;
return 0;
});
}
for (int i = animals.Length - 1; i >= 0; i--)
{
Animal animal = animals[i];
ImGui.PushID(animal.Instance);
ImGui.Text($"{animal.Id:X} ({animal.OtherId:X}):");
ImGui.Text($" Address: 0x{animal.Instance:X}");
ImGui.DragFloat3("Position", ref animal.Position, 0.5f);
Vector4 rotation = new(animal.Rotation.X, animal.Rotation.Y, animal.Rotation.Z, animal.Rotation.W);
ImGui.SliderFloat4("Rotation", ref rotation, -1.0f, 1.0f);
if (Models.drawRotate("Rotate", rotation, out Vector4 result))
{
animal.Rotation = new(result.X, result.Y, result.Z, result.W);
}
if (ImGui.Button("Remove"))
{
MemoryUtil.GetRef<uint>(animal.Instance + 0x928) = 0xFFFFFFFF;
}
ImGui.PopID();
ImGui.Separator();
}
}
ImGui.Checkbox("Only Toggle LOD 0", ref Models.modelOnlyAddressLod0);
if (ImGui.BeginItemTooltip())
{
ImGui.Text($"This can be used to check if a given model is showing LOD 0 or not.\nApplies when a part is toggled, meaning you should probably toggle all parts on before enabling this.");
ImGui.EndTooltip();
}
bool expand = ImGui.CollapsingHeader("Loaded Models");
if (expand && player != null)
{
Models.drawModelList(width, player.Instance);
}
expand = ImGui.CollapsingHeader("Objects");
if (ImGui.BeginItemTooltip())
{
ImGui.Text("This reads from the list of objects to be updated.\nTherefore, at any given moment it could be empty.");
ImGui.EndTooltip();
}
if (expand && player != null)
{
Models.drawObjectList(width, player);
}
}
}
}
|