-
Notifications
You must be signed in to change notification settings - Fork 25
/
Comps.cs
3236 lines (3062 loc) · 142 KB
/
Comps.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
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
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using GameServer;
using MelonLoader;
using UnityEngine;
using static SkyCoop.DataStr;
using static SkyCoop.MyMod;
using Il2Cpp;
namespace SkyCoop
{
public class Comps
{
public static void RegisterComponents()
{
ClassInjector.RegisterTypeInIl2Cpp<AnimalUpdates>();
ClassInjector.RegisterTypeInIl2Cpp<DestoryArrowOnHit>();
ClassInjector.RegisterTypeInIl2Cpp<PlayerBulletDamage>();
ClassInjector.RegisterTypeInIl2Cpp<ClientProjectile>();
ClassInjector.RegisterTypeInIl2Cpp<MultiplayerPlayer>();
ClassInjector.RegisterTypeInIl2Cpp<ContainersSync>();
ClassInjector.RegisterTypeInIl2Cpp<UiButtonPressHook>();
ClassInjector.RegisterTypeInIl2Cpp<DestoryStoneOnStop>();
ClassInjector.RegisterTypeInIl2Cpp<MultiplayerPlayerAnimator>();
ClassInjector.RegisterTypeInIl2Cpp<MultiplayerPlayerClothingManager>();
ClassInjector.RegisterTypeInIl2Cpp<DoNotSerializeThis>();
ClassInjector.RegisterTypeInIl2Cpp<MultiplayerPlayerVoiceChatPlayer>();
ClassInjector.RegisterTypeInIl2Cpp<DroppedGearDummy>();
ClassInjector.RegisterTypeInIl2Cpp<IgnoreDropOverride>();
ClassInjector.RegisterTypeInIl2Cpp<DropFakeOnLeave>();
ClassInjector.RegisterTypeInIl2Cpp<FakeBed>();
ClassInjector.RegisterTypeInIl2Cpp<FakeBedDummy>();
ClassInjector.RegisterTypeInIl2Cpp<AnimalActor>();
ClassInjector.RegisterTypeInIl2Cpp<AnimalCorpseObject>();
ClassInjector.RegisterTypeInIl2Cpp<SpawnRegionSimple>();
ClassInjector.RegisterTypeInIl2Cpp<LobbyHoverNickname>();
ClassInjector.RegisterTypeInIl2Cpp<CookpotHelmet>();
ClassInjector.RegisterTypeInIl2Cpp<UiButtonKeyboardPressSkip>();
ClassInjector.RegisterTypeInIl2Cpp<DeathDropContainer>();
ClassInjector.RegisterTypeInIl2Cpp<DoorLockedOnKey>();
ClassInjector.RegisterTypeInIl2Cpp<FakeRockCache>();
ClassInjector.RegisterTypeInIl2Cpp<LocalVariablesKit>();
ClassInjector.RegisterTypeInIl2Cpp<ParticleSystemParasite>();
ClassInjector.RegisterTypeInIl2Cpp<ExpeditionInteractive>();
}
public class DroppedGearDummy : MonoBehaviour
{
public DroppedGearDummy(IntPtr ptr) : base(ptr) { }
public string m_LocalizedDisplayName;
public int m_SearchKey = 0;
public DataStr.ExtraDataForDroppedGear m_Extra = new DataStr.ExtraDataForDroppedGear();
}
public class IgnoreDropOverride : MonoBehaviour
{
public IgnoreDropOverride(IntPtr ptr) : base(ptr) { }
}
public class DropFakeOnLeave : MonoBehaviour
{
public DropFakeOnLeave(IntPtr ptr) : base(ptr) { }
public Vector3 m_OldPossition = new Vector3(0, 0, 0);
public Quaternion m_OldRotation = new Quaternion(0, 0, 0, 0);
}
public class FakeBed : MonoBehaviour
{
public FakeBed(IntPtr ptr) : base(ptr) { }
}
public class FakeBedDummy : MonoBehaviour
{
public FakeBedDummy(IntPtr ptr) : base(ptr) { }
public GameObject m_LinkedFakeObject;
}
public class DestoryArrowOnHit : MonoBehaviour
{
public DestoryArrowOnHit(IntPtr ptr) : base(ptr) { }
}
public class DestoryStoneOnStop : MonoBehaviour
{
public DestoryStoneOnStop(IntPtr ptr) : base(ptr) { }
public GameObject m_Obj = null;
public Rigidbody m_RB = null;
public GearItem m_Gear = null;
public bool m_ShouldSendDrop = false;
private bool m_SendDrop = false;
void Update()
{
if (m_Obj != null && m_RB != null && m_Gear != null)
{
if (m_RB.isKinematic == true)
{
if (m_ShouldSendDrop)
{
if (!m_SendDrop)
{
m_SendDrop = true;
SendDropItem(m_Gear, 0, 0, true);
}
} else
{
UnityEngine.Object.Destroy(m_Obj);
}
}
}
}
}
public class ClientProjectile : MonoBehaviour
{
public ClientProjectile(IntPtr ptr) : base(ptr) { }
public int m_ClientID = 0;
}
public class UiButtonPressHook : MonoBehaviour
{
public UiButtonPressHook(IntPtr ptr) : base(ptr) { }
public int m_CustomId = 0;
}
public class UiButtonKeyboardPressSkip : MonoBehaviour
{
public UiButtonKeyboardPressSkip(IntPtr ptr) : base(ptr) { }
public IL2CPP.List<EventDelegate> m_Click;
}
public class DeathDropContainer : MonoBehaviour
{
public DeathDropContainer(IntPtr ptr) : base(ptr) { }
public string m_Owner = "UNKNOWN";
}
public class DoorLockedOnKey : MonoBehaviour
{
public DoorLockedOnKey(IntPtr ptr) : base(ptr) { }
public string m_Owner = "UNKNOWN";
public string m_DoorKey = "";
}
public class DoNotSerializeThis : MonoBehaviour
{
public DoNotSerializeThis(IntPtr ptr) : base(ptr) { }
}
public class ContainersSync : MonoBehaviour
{
public ContainersSync(IntPtr ptr) : base(ptr) { }
public GameObject m_Obj = null;
public Container m_Cont = null;
public string m_Guid = "";
public string m_LastAnim = "";
public bool m_Empty = true;
void Update()
{
if (m_Obj != null)
{
if (m_Cont == null && m_Obj.GetComponent<Container>() != null)
{
m_Cont = m_Obj.GetComponent<Container>();
}
if (m_Guid == "" && m_Obj.GetComponent<ObjectGuid>() != null)
{
m_Guid = m_Obj.GetComponent<ObjectGuid>().Get();
}
if (m_Guid != "" && m_Cont != null)
{
if (m_Cont.m_IsCorpse == true)
{
//UnityEngine.Object.Destroy(m_Obj.GetComponent<ContainersSync>());
}
}
}
}
public void CallSync()
{
DataStr.ContainerOpenSync sync = new DataStr.ContainerOpenSync();
sync.m_Guid = m_Guid;
if (m_LastAnim == "close")
{
sync.m_State = false;
}
else
{
sync.m_State = true;
}
if (MyMod.iAmHost == true)
{
using (Packet _packet = new Packet((int)ServerPackets.CONTAINEROPEN))
{
ServerSend.CONTAINEROPEN(0, sync, true);
}
}
if (MyMod.sendMyPosition == true)
{
using (Packet _packet = new Packet((int)ClientPackets.CONTAINEROPEN))
{
_packet.Write(sync);
MyMod.SendUDPData(_packet);
}
}
}
public void Open()
{
if (m_Cont != null && m_Cont.m_ObjectAnims != null && m_LastAnim != "open")
{
if (m_Cont.m_PendingClose)
return;
for (int index = 0; index < m_Cont.m_ObjectAnims.Length; ++index)
{
ObjectAnim objectAnim = m_Cont.m_ObjectAnims[index];
if ((bool)(UnityEngine.Object)objectAnim && !objectAnim.Play("open"))
return;
}
if (m_Cont.gameObject != null && GameManager.GetPlayerObject() != null)
{
float dist = Vector3.Distance(GameManager.GetPlayerObject().transform.position, m_Cont.gameObject.transform.position);
if (dist < 30)
{
m_Cont.PlayContainerOpenSound();
}
}
}
}
public void Close()
{
if (m_Cont != null && m_Cont.m_ObjectAnims != null && m_LastAnim != "close")
{
for (int index = 0; index < m_Cont.m_ObjectAnims.Length; ++index)
{
ObjectAnim objectAnim = m_Cont.m_ObjectAnims[index];
if ((bool)(UnityEngine.Object)objectAnim && !objectAnim.Play("close"))
{
m_Cont.m_PendingClose = true;
return;
}
}
if (m_Cont.gameObject != null && GameManager.GetPlayerObject() != null)
{
float dist = Vector3.Distance(GameManager.GetPlayerObject().transform.position, m_Cont.gameObject.transform.position);
if (dist < 30)
{
m_Cont.PlayContainerCloseSound();
}
}
m_Cont.m_PendingClose = false;
return;
}
}
}
public class AnimalUpdates : MonoBehaviour
{
public AnimalUpdates(IntPtr ptr) : base(ptr) { }
public GameObject m_Animal = null;
public int NoResponce = 5;
public int ReTakeCoolDown = 5;
public float nextActionTimeNR = 0.0f;
public float noresponce_perioud = 1f;
public float nextActionSync = 0.0f;
public float actionSync_perioud = 0.3f;
public float nextActionBloodDrop = 0.0f;
public float blooddrop_period = 0.15f;
public float nextActionDampingOn = 0.0f;
public float dampingOn_perioud = 1.5f;
public Vector3 m_ToGo = new Vector3(0, 0, 0);
public Quaternion m_ToRotate = new Quaternion(0, 0, 0, 0);
public bool m_CanSync = false;
public float m_Hp = 100;
public bool m_Banned = false;
public bool m_DampingIgnore = false;
public int LastFoundPlayer = -1;
public bool m_MyControlled = false;
public bool m_PickedUp = false;
public string m_RegionGUID = "";
public bool m_AddedToRegion = false;
public bool m_MarkToDestroy = false;
public List<DataStr.AnimalArrow> m_Arrows = new List<DataStr.AnimalArrow>();
public int LastDamager = 0;
void Start()
{
nextActionTimeNR = Time.time;
nextActionSync = Time.time;
nextActionBloodDrop = Time.time;
nextActionDampingOn = Time.time + dampingOn_perioud;
}
public void ProcessArrows()
{
for (int i = 0; i < m_Arrows.Count; i++)
{
AddFakeArrowToAnimal(this, i);
}
}
public void CallSync()
{
if (m_Animal != null && m_Banned == false && m_Animal.activeSelf == true && m_PickedUp == false)
{
if (m_Animal.GetComponent<BaseAi>() != null)
{
BaseAi _AI = m_Animal.GetComponent<BaseAi>();
DataStr.AnimalCompactData Dat = GetCompactDataForAnimal(_AI, m_Arrows);
DataStr.AnimalAnimsSync AnimDat = GetAnimationDataFromAnimal(_AI);
if (Dat.m_GUID == "")
{
return;
}
int newController = GetClosestPlayerToAnimal(m_Animal, ReTakeCoolDown, ClientUser.myId, GameManager.GetPlayerTransform().position, levelid);
Dat.m_LastController = newController;
if (newController != ClientUser.myId)
{
SendAnimalForValidPlayers(Dat, AnimDat);
m_Banned = true;
m_MarkToDestroy = true;
RecreateAnimalToActor(m_Animal, m_Arrows);
}
else
{
SendAnimalForValidPlayers(Dat, AnimDat);
}
}
}
}
void OnDestroy()
{
if (m_Animal)
{
if (m_Animal.GetComponent<ObjectGuid>() != null)
{
if (m_RegionGUID != "")
{
GameObject RegionSpawnObj = Il2CppTLD.PDID.PdidTable.GetGameObject(m_RegionGUID);
if (RegionSpawnObj != null)
{
RegionSpawnObj.GetComponent<SpawnRegionSimple>().m_Animals.Remove(m_Animal.GetComponent<ObjectGuid>().Get());
}
}
}
}
}
void MaybeAddToSpawnRegion()
{
if (!m_AddedToRegion && m_RegionGUID != "")
{
m_AddedToRegion = true;
GameObject RegionSpawnObj = Il2CppTLD.PDID.PdidTable.GetGameObject(m_RegionGUID);
if (RegionSpawnObj)
{
if (m_Animal.GetComponent<ObjectGuid>() != null && RegionSpawnObj.GetComponent<SpawnRegionSimple>() != null)
{
RegionSpawnObj.GetComponent<SpawnRegionSimple>().m_Animals.Remove(m_Animal.GetComponent<ObjectGuid>().Get());
RegionSpawnObj.GetComponent<SpawnRegionSimple>().m_Animals.Add(m_Animal.GetComponent<ObjectGuid>().Get(), m_Animal);
}
}
}
}
public void DropArrows()
{
for (int i = 0; i < m_Arrows.Count; i++)
{
GameObject reference = GetGearItemObject("GEAR_Arrow");
GameObject obj = UnityEngine.Object.Instantiate<GameObject>(reference, Vector3.zero, Quaternion.identity);
SendDropItem(obj.GetComponent<GearItem>(), 0, 0, false, 0, m_Animal);
}
}
void Update()
{
if (m_MarkToDestroy == true)
{
UnityEngine.Object.Destroy(m_Animal);
return;
}
if (m_Animal != null && m_PickedUp == false && m_Banned == false)
{
MaybeAddToSpawnRegion();
if (Time.time > nextActionSync)
{
nextActionSync += actionSync_perioud;
if (level_name != "Empty" && level_name != "MainMenu")
{
if (AnimalsController == true || m_MyControlled == true)
{
CallSync();
}
}
}
if (Time.time > nextActionTimeNR)
{
nextActionTimeNR += noresponce_perioud;
ReTakeCoolDown--;
if (ReTakeCoolDown <= 0)
{
ReTakeCoolDown = 0;
}
if (AnimalsController == false && m_MyControlled == false)
{
m_MarkToDestroy = true;
}
}
if (InOnline() && m_Animal.GetComponent<BaseAi>() && m_Animal.GetComponent<ObjectGuid>() && (AnimalsController == true || m_MyControlled == true))
{
BaseAi bai = m_Animal.GetComponent<BaseAi>();
string RightName = GetAnimalPrefabName(m_Animal.name);
if (bai.m_CurrentHP <= 0 || bai.m_CurrentMode == AiMode.Dead || bai.m_CurrentMode == AiMode.Stunned)
{
DropArrows();
DataStr.AnimalKilled Corpse = new DataStr.AnimalKilled();
Corpse.m_Position = m_Animal.transform.position;
Corpse.m_Rotation = m_Animal.transform.rotation;
Corpse.m_PrefabName = RightName;
Corpse.m_GUID = m_Animal.GetComponent<ObjectGuid>().Get();
Corpse.m_LevelGUID = level_guid;
Corpse.m_CreatedTime = MinutesFromStartServer;
Corpse.m_Knocked = bai.m_CurrentMode == AiMode.Stunned;
Corpse.m_RegionGUID = m_RegionGUID;
if (!Corpse.m_Knocked)
{
MelonLogger.Msg("Animal been killed SpawnRegion " + m_RegionGUID);
}
else
{
MelonLogger.Msg("Animal been knocked SpawnRegion " + m_RegionGUID);
}
m_Banned = true;
if (iAmHost == true)
{
m_MarkToDestroy = true;
ServerSend.ANIMALCORPSE(0, Corpse, true);
ObjectGuidManager.UnRegisterGuid(m_Animal.GetComponent<ObjectGuid>().Get());
Shared.OnAnimalKilled(RightName, m_Animal.transform.position, m_Animal.transform.rotation, m_Animal.GetComponent<ObjectGuid>().Get(), level_guid, m_RegionGUID, Corpse.m_Knocked);
}
else if (sendMyPosition == true)
{
using (Packet _packet = new Packet((int)ClientPackets.ANIMALKILLED))
{
_packet.Write(Corpse);
SendUDPData(_packet);
}
m_MarkToDestroy = true;
ObjectGuidManager.UnRegisterGuid(m_Animal.GetComponent<ObjectGuid>().Get());
SpawnAnimalCorpse(RightName, m_Animal.transform.position, m_Animal.transform.rotation, m_Animal.GetComponent<ObjectGuid>().Get(), m_RegionGUID); // So we won't wait responce.
}
}
}
}
}
}
public class AnimalActor : MonoBehaviour
{
public AnimalActor(IntPtr ptr) : base(ptr) { }
public GameObject m_Animal = null;
public int NoResponce = 5;
public int ReTakeCoolDown = 5;
// Timers
public float nextActionTimeNR = 0.0f;
public float noresponce_perioud = 1f;
public float nextActionSync = 0.0f;
public float actionSync_perioud = 0.3f;
public float nextActionBloodDrop = 0.0f;
public float blooddrop_period = 0.15f;
public float nextActionDampingOn = 0.0f;
public float dampingOn_perioud = 1.5f;
public Vector3 m_ToGo = new Vector3(0, 0, 0);
public Quaternion m_ToRotate = new Quaternion(0, 0, 0, 0);
// Animation parameters
public float AP_TurnAngle; //0
public float AP_TurnSpeed; //1
public float AP_Speed; //2
public float AP_Wounded; //3
public float AP_Roll; //4
public float AP_Pitch; //5
public float AP_TargetHeading; //6
public float AP_TargetHeadingSmooth; //7
public float AP_TapMeter; //8
public int AP_AiState; //10
public bool AP_Corpse; //14
public bool AP_Dead; //15
public int AP_DeadSide; //16
public int AP_DamageBodyPart; //19
public int AP_AttackId; //23
public bool AP_Stunned;
public float m_Hp = 100;
public bool m_Bleeding = false;
public int m_ClientController = -1;
public bool m_Banned = false;
public bool m_MarkToDestroy = false;
public bool m_DampingIgnore = false;
public string m_RegionGUID = "";
public bool m_AddedToRegion = false;
int m_AnimParameter_TurnAngle;
int m_AnimParameter_TurnSpeed;
int m_AnimParameter_Speed;
int m_AnimParameter_Wounded;
int m_AnimParameter_Roll;
int m_AnimParameter_Pitch;
int m_AnimParameter_TargetHeading;
int m_AnimParameter_TargetHeadingSmooth;
int m_AnimParameter_TapMeter;
int m_AnimParameter_AiState;
int m_AnimParameter_Corpse;
int m_AnimParameter_Dead;
int m_AnimParameter_DamageSide;
int m_AnimParameter_DamageBodyPart;
int m_AnimParameter_AttackId;
int m_AnimParameter_Stunned;
public Dictionary<string, int> m_AnimalAnimatorHashes = new Dictionary<string, int>();
public bool m_AnimalAnimatorHashesReady = false;
public Animator m_Animator;
public List<DataStr.AnimalArrow> m_Arrows = new List<DataStr.AnimalArrow>();
void Start()
{
nextActionTimeNR = Time.time;
nextActionSync = Time.time;
nextActionBloodDrop = Time.time;
nextActionDampingOn = Time.time + dampingOn_perioud;
}
public void ProcessArrows()
{
for (int i = 0; i < m_Arrows.Count; i++)
{
MyMod.AddFakeArrowToAnimal(this, i);
}
}
public void AnimInit()
{
m_AnimParameter_TurnAngle = Animator.StringToHash("TurnAngle");
m_AnimParameter_TurnSpeed = Animator.StringToHash("TurnSpeed");
m_AnimParameter_Speed = Animator.StringToHash("Speed");
m_AnimParameter_Wounded = Animator.StringToHash("Wounded");
m_AnimParameter_Roll = Animator.StringToHash("Roll");
m_AnimParameter_Pitch = Animator.StringToHash("Pitch");
m_AnimParameter_TargetHeading = Animator.StringToHash("TargetHeading");
m_AnimParameter_TargetHeadingSmooth = Animator.StringToHash("TargetHeadingSmooth");
m_AnimParameter_TapMeter = Animator.StringToHash("TapMeter");
m_AnimParameter_AiState = Animator.StringToHash("AiState");
m_AnimParameter_Corpse = Animator.StringToHash("Corpse");
m_AnimParameter_Dead = Animator.StringToHash("Dead");
m_AnimParameter_DamageSide = Animator.StringToHash("DamageSide");
m_AnimParameter_DamageBodyPart = Animator.StringToHash("DamageBodyPart");
m_AnimParameter_AttackId = Animator.StringToHash("AttackId");
m_AnimParameter_Stunned = Animator.StringToHash("Stunned");
m_AnimalAnimatorHashesReady = true;
}
void SetAnimations()
{
Animator AN = m_Animator;
if (AN != null)
{
if (!m_AnimalAnimatorHashesReady)
{
AnimInit();
}
AN.SetFloat(m_AnimParameter_TurnAngle, AP_TurnAngle);
AN.SetFloat(m_AnimParameter_TurnSpeed, AP_TurnSpeed);
AN.SetFloat(m_AnimParameter_Speed, AP_Speed);
AN.SetFloat(m_AnimParameter_Wounded, AP_Wounded);
AN.SetFloat(m_AnimParameter_Roll, AP_Roll);
AN.SetFloat(m_AnimParameter_Pitch, AP_Pitch);
AN.SetFloat(m_AnimParameter_TargetHeading, AP_TargetHeading);
AN.SetFloat(m_AnimParameter_TargetHeadingSmooth, AP_TargetHeadingSmooth);
AN.SetFloat(m_AnimParameter_TapMeter, AP_TapMeter);
AN.SetInteger(m_AnimParameter_AiState, AP_AiState);
AN.SetBool(m_AnimParameter_Corpse, AP_Corpse);
AN.SetBool(m_AnimParameter_Dead, AP_Dead);
AN.SetInteger(m_AnimParameter_DamageSide, AP_DeadSide);
AN.SetInteger(m_AnimParameter_DamageBodyPart, AP_DamageBodyPart);
AN.SetInteger(m_AnimParameter_AttackId, AP_AttackId);
AN.SetBool(m_AnimParameter_Stunned, AP_Stunned);
}
}
void SetPosition()
{
if (m_DampingIgnore == true)
{
m_Animal.transform.position = m_ToGo;
m_Animal.transform.rotation = m_ToRotate;
}
else
{
m_Animal.transform.position = Vector3.Lerp(m_Animal.transform.position, m_ToGo, Time.deltaTime * DeltaAnimalsMultiplayer);
m_Animal.transform.rotation = Quaternion.Lerp(m_Animal.transform.rotation, m_ToRotate, Time.deltaTime * DeltaAnimalsMultiplayer);
}
}
void OnDestroy()
{
if (m_Animal)
{
if (m_Animal.GetComponent<ObjectGuid>() != null)
{
ActorsList.Remove(m_Animal.GetComponent<ObjectGuid>().Get());
GameAudioManager.StopAllSoundsFromGameObject(m_Animal);
}
if (m_RegionGUID != "")
{
GameObject RegionSpawnObj = Il2CppTLD.PDID.PdidTable.GetGameObject(m_RegionGUID);
if (RegionSpawnObj != null)
{
RegionSpawnObj.GetComponent<SpawnRegionSimple>().m_Animals.Remove(m_Animal.GetComponent<ObjectGuid>().Get());
}
}
}
}
void MaybeAddToSpawnRegion()
{
if (!m_AddedToRegion && m_RegionGUID != "")
{
m_AddedToRegion = true;
GameObject RegionSpawnObj = Il2CppTLD.PDID.PdidTable.GetGameObject(m_RegionGUID);
if (m_Animal.GetComponent<ObjectGuid>() != null)
{
if (m_RegionGUID != "")
{
if (RegionSpawnObj != null)
{
RegionSpawnObj.GetComponent<SpawnRegionSimple>().m_Animals.Remove(m_Animal.GetComponent<ObjectGuid>().Get());
RegionSpawnObj.GetComponent<SpawnRegionSimple>().m_Animals.Add(m_Animal.GetComponent<ObjectGuid>().Get(), m_Animal);
}
}
}
}
}
public uint m_FeedingAudioID = 0U;
public uint m_FleeAudioId = 0U;
public uint m_HoldGroundAudioID = 0U;
public uint m_IdleAudioId = 0U;
public uint m_SleepingLoopAudioID = 0U;
public uint m_StalkingAudioID = 0U;
public uint m_StalkingLoopAudioID = 0U;
public uint m_StuggleAudioId = 0U;
public uint m_WanderAudioId = 0U;
public uint m_HideAndSeekAudioId = 0U;
public uint m_JoinPackAudioId = 0U;
void ExitFeeding()
{
if (m_FeedingAudioID == 0U)
return;
AkSoundEngine.StopPlayingID(m_FeedingAudioID, GameManager.GetGameAudioManagerComponent().m_StopAudioFadeOutMicroseconds);
}
void ExitFlee()
{
if (m_FleeAudioId == 0U)
return;
AkSoundEngine.StopPlayingID(m_FleeAudioId, GameManager.GetGameAudioManagerComponent().m_StopAudioFadeOutMicroseconds);
m_FleeAudioId = 0U;
}
void ExitHoldGround()
{
if (m_HoldGroundAudioID == 0U)
return;
AkSoundEngine.StopPlayingID(m_HoldGroundAudioID, GameManager.GetGameAudioManagerComponent().m_StopAudioFadeOutMicroseconds);
m_HoldGroundAudioID = 0U;
}
void ExitIdle()
{
if (m_IdleAudioId == 0U)
return;
AkSoundEngine.StopPlayingID(m_IdleAudioId, GameManager.GetGameAudioManagerComponent().m_StopAudioFadeOutMicroseconds);
m_IdleAudioId = 0U;
}
void ExitInvestigateFood()
{
ExitFeeding();
}
void ExitSleep()
{
if (m_SleepingLoopAudioID == 0U)
return;
AkSoundEngine.StopPlayingID(m_SleepingLoopAudioID, GameManager.GetGameAudioManagerComponent().m_StopAudioFadeOutMicroseconds);
m_SleepingLoopAudioID = 0U;
}
void ExitStalking()
{
if (m_StalkingAudioID != 0U)
{
AkSoundEngine.StopPlayingID(m_StalkingAudioID, GameManager.GetGameAudioManagerComponent().m_StopAudioFadeOutMicroseconds);
m_StalkingAudioID = 0U;
}
if (m_StalkingLoopAudioID == 0U)
return;
AkSoundEngine.StopPlayingID(m_StalkingLoopAudioID, GameManager.GetGameAudioManagerComponent().m_StopAudioFadeOutMicroseconds);
m_StalkingLoopAudioID = 0U;
}
void ExitStruggle()
{
if (m_StuggleAudioId == 0U)
return;
AkSoundEngine.StopPlayingID(m_StuggleAudioId, GameManager.GetGameAudioManagerComponent().m_StopAudioFadeOutMicroseconds);
m_StuggleAudioId = 0U;
}
void ExitWander()
{
if (m_WanderAudioId == 0U)
return;
AkSoundEngine.StopPlayingID(m_WanderAudioId, GameManager.GetGameAudioManagerComponent().m_StopAudioFadeOutMicroseconds);
m_WanderAudioId = 0U;
}
void ExitHideAndSeek()
{
if (m_HideAndSeekAudioId == 0U)
return;
AkSoundEngine.StopPlayingID(m_HideAndSeekAudioId, GameManager.GetGameAudioManagerComponent().m_StopAudioFadeOutMicroseconds);
m_HideAndSeekAudioId = 0U;
}
void ExitJoinPack()
{
if (m_JoinPackAudioId == 0U)
return;
AkSoundEngine.StopPlayingID(m_JoinPackAudioId, GameManager.GetGameAudioManagerComponent().m_StopAudioFadeOutMicroseconds);
m_JoinPackAudioId = 0U;
}
public AiMode m_CurrentMode = AiMode.Idle;
public AiMode m_NextMode = AiMode.Idle;
public string m_EnterAttackModeAudio = "";
public string m_EnterFleeModeAudio = "";
public string m_HoldGroundAudio = "";
public string m_IdleAudio = "";
public string m_SleepingAudio = "";
public string m_EnterStalkingAudio = "";
public string m_WanderAudio = "";
public string m_HideAndSeekAudio = "";
public string m_JoinPackAudio = "";
bool m_AudioReady = false;
void EnterAttack()
{
GameAudioManager.Play3DSound(m_EnterAttackModeAudio, m_Animal);
}
void EnterFlee()
{
if (m_EnterFleeModeAudio == "" || m_FleeAudioId != 0U)
{
return;
}
m_FleeAudioId = GameAudioManager.Play3DSound(m_EnterFleeModeAudio, m_Animal);
}
void EnterHoldGround()
{
if (m_HoldGroundAudio == "")
{
return;
}
m_HoldGroundAudioID = GameAudioManager.Play3DSound(m_HoldGroundAudio, m_Animal);
}
void EnterIdle()
{
if (m_IdleAudio == "")
{
return;
}
if (m_IdleAudioId == 0U)
{
m_IdleAudioId = GameAudioManager.Play3DSound(m_IdleAudio, m_Animal);
}
}
void EnterSleep()
{
if (m_SleepingAudio == "")
{
return;
}
m_SleepingLoopAudioID = GameAudioManager.Play3DSound(m_SleepingAudio, m_Animal);
}
void EnterStalking()
{
if (m_EnterStalkingAudio == "")
{
return;
}
m_StalkingAudioID = GameAudioManager.Play3DSound(m_EnterStalkingAudio, m_Animal);
m_StalkingLoopAudioID = 0U;
}
void EnterWander()
{
if (m_WanderAudioId != 0U || m_WanderAudio == "")
return;
m_WanderAudioId = GameAudioManager.Play3DSound(m_WanderAudio, m_Animal);
}
void EnterHideAndSeek()
{
if (m_HideAndSeekAudioId == 0U && m_HideAndSeekAudio != "")
{
m_HideAndSeekAudioId = GameAudioManager.Play3DSound(m_HideAndSeekAudio, m_Animal);
}
}
void EnterJoinPack()
{
if (m_JoinPackAudioId == 0U && m_JoinPackAudio != "")
{
m_JoinPackAudioId = GameAudioManager.Play3DSound(m_JoinPackAudio, m_Animal);
}
}
public void SetAiMode()
{
if (m_CurrentMode == m_NextMode)
{
return;
}
switch (m_CurrentMode) // Stop Audio Events from current animation
{
case AiMode.Attack:
break;
case AiMode.Dead:
break;
case AiMode.Feeding:
ExitFeeding();
break;
case AiMode.Flee:
ExitFlee();
break;
case AiMode.FollowWaypoints:
break;
case AiMode.HoldGround:
ExitHoldGround();
break;
case AiMode.Idle:
ExitIdle();
break;
case AiMode.Investigate:
break;
case AiMode.InvestigateFood:
ExitInvestigateFood();
break;
case AiMode.InvestigateSmell:
break;
case AiMode.Sleep:
ExitSleep();
break;
case AiMode.Stalking:
ExitStalking();
break;
case AiMode.Struggle:
ExitStruggle();
break;
case AiMode.Wander:
ExitWander();
break;
case AiMode.WanderPaused:
break;
case AiMode.GoToPoint:
break;
case AiMode.InteractWithProp:
break;
case AiMode.ScriptedSequence:
break;
case AiMode.Stunned:
break;
case AiMode.ScratchingAntlers:
break;
case AiMode.PatrolPointsOfInterest:
break;
case AiMode.HideAndSeek:
ExitHideAndSeek();
break;
case AiMode.JoinPack:
ExitJoinPack();
break;
case AiMode.PassingAttack:
break;
case AiMode.Howl:
break;
}
switch (m_NextMode) // Play audio for this mode
{
case AiMode.Attack:
EnterAttack();
break;
case AiMode.Dead:
;
break;
case AiMode.Feeding:
break;
case AiMode.Flee:
EnterFlee();
break;
case AiMode.FollowWaypoints:
break;
case AiMode.HoldGround:
EnterHoldGround();
break;
case AiMode.Idle:
EnterIdle();
break;
case AiMode.Investigate:
break;
case AiMode.InvestigateFood:
break;
case AiMode.InvestigateSmell:
break;
case AiMode.Rooted:
break;
case AiMode.Sleep:
this.EnterSleep();
break;
case AiMode.Stalking:
this.EnterStalking();
break;
case AiMode.Struggle:
break;
case AiMode.Wander:
this.EnterWander();
break;
case AiMode.WanderPaused:
break;
case AiMode.GoToPoint:
break;
case AiMode.InteractWithProp:
break;
case AiMode.ScriptedSequence:
break;
case AiMode.Stunned:
break;
case AiMode.ScratchingAntlers:
break;
case AiMode.PatrolPointsOfInterest:
break;
case AiMode.HideAndSeek:
EnterHideAndSeek();
break;
case AiMode.JoinPack:
EnterJoinPack();
break;
case AiMode.PassingAttack:
break;
case AiMode.Howl:
break;
}
m_CurrentMode = m_NextMode;
}
void SetAudioNames()
{
string name = m_Animal.gameObject.name;
if (name.Contains("Bear"))
{
m_EnterAttackModeAudio = "Play_BearDetect";
m_EnterFleeModeAudio = "Play_BearFlee";
m_HoldGroundAudio = "Play_BearHoldGround";
m_IdleAudio = "Play_BearIdle";
m_SleepingAudio = "Play_BearSleeping";
m_EnterStalkingAudio = "Play_BearAttack";
m_WanderAudio = "Play_BearIdle";
}
else if (name.Contains("Wolf") && !name.Contains("gray"))
{
m_EnterAttackModeAudio = "Play_WolfAttackEnter";
m_EnterFleeModeAudio = "PLAY_WolfWhine";
m_HoldGroundAudio = "Play_WolfGrowlLoop";
m_SleepingAudio = "Play_WolfSleeping";
m_EnterStalkingAudio = "Play_WolfWarn";
}
else if (name.Contains("Wolf") && name.Contains("gray"))
{
m_EnterAttackModeAudio = "Play_TimberwolfAttackEnter";
m_EnterFleeModeAudio = "Play_TimberwolfWhine";
m_HoldGroundAudio = "Play_TimberwolfGrowlLoop";
m_IdleAudio = "Play_TimberwolfIdle";
m_SleepingAudio = "Play_TimberwolfSleeping";
m_EnterStalkingAudio = "Play_TimberwolfWarn";
m_HideAndSeekAudio = "Play_TimberwolfGrowlLoop";
}
else if (name.Contains("Rabbit"))
{
m_EnterFleeModeAudio = "Play_RabbitSqueal";
}
else if (name.Contains("Moose"))
{