-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlugin.cs
More file actions
2780 lines (2417 loc) · 104 KB
/
Plugin.cs
File metadata and controls
2780 lines (2417 loc) · 104 KB
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
global using BepInEx;
global using BepInEx.IL2CPP;
global using HarmonyLib;
global using UnityEngine;
global using System;
global using System.IO;
global using UnhollowerRuntimeLib;
using System.Linq;
using TMPro;
using System.Diagnostics;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using SteamworksNative;
using System.Text;
using System.Collections.Generic;
using System.Threading;
using Input = UnityEngine.Input;
using KeyCode = UnityEngine.KeyCode;
using Math = System.Math;
using UnityEngine.EventSystems;
using BepInEx.Logging;
using BepInEx.IL2CPP.Utils.Collections;
using UnityEngine.UI;
namespace itemMod
{
[BepInPlugin("htMDT64UsYVG2LkapJ7wcz", "itemMod", "10.1")]
public class Plugin : BasePlugin
{
public const string ver = "10c";
public const int apiver = 15;
public static ulong clientId = 0;
public static string lobbyIDCheckURL = "";
public static string DiscordURL = "";
public static string WebsiteURL = "";
public static string UpdateURL = "";
// Program
internal static new ManualLogSource Logger;
public static string pluginsPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
public static readonly HttpClient httpClient = new HttpClient();
public static string crabgamePath = pluginsPath.Replace("\\BepInEx\\plugins", "");
public static string itemmodPath = $"{pluginsPath}\\ItemMod";
// Internal values
public static bool gameStarted = false;
public static int itemToGive = -1;
public static bool crabMode = false;
public static bool crabModeAllowed = true;
public static List<Il2CppSystem.Collections.Generic.Dictionary<ulong, MonoBehaviourPublicCSstReshTrheObplBojuUnique>.Entry> playersList;
public static List<Il2CppSystem.Collections.Generic.Dictionary<ulong, MonoBehaviourPublicCSstReshTrheObplBojuUnique>.Entry> playersList2;
public static Dictionary<ulong, int> playerDMG = new Dictionary<ulong, int>();
public static TextMeshProUGUI spectatorsText = null;
public static Dictionary<ulong, ulong> spectatorsList = new Dictionary<ulong, ulong>();
public static List<ulong> spectatingME = new List<ulong>();
public static float totalReloadTime = 0f;
public static float currentReloadTime = 0f;
// config
public static bool dontReplaceItem = true;
public static bool profanityBypass = false;
public static bool fullprofanityBypass = true;
public static bool jumpboostdisabled = false;
public static float jumpboostamount = 20;
public static string webhook = "";
public static bool crabModeIsOn = true;
public static bool show_ammo = true;
public static bool dcplayerlisthaslinks = false;
public static bool warn100dmg = false;
public static bool skipIntro = true;
public static bool show_gameid_chat = true;
public static bool show_moregameid_chat = true;
public static bool showBoxRates = false;
public static bool hideAbout = true;
public static bool IdToWebhook = true;
public static bool IdToNotepad = true;
public static bool playerlisttodcauto = false;
public static bool unbanAkDual = true;
public static bool autoCopyOnId = false;
public static bool showSpectatorCount = false;
public static bool spectatorCountBelowCrosshair = false;
public static bool spectatorsInTAB = false;
public static bool clearView = false;
public static bool localdeathmessages = false;
public static bool hostdeathmessages = false;
public static bool localjoinleavemessages = false;
public static bool hostjoinleavemessages = false;
public static bool steamcmduseoverlay = false;
// config (keybinds)
public static int key_pizza = 112;
public static int key_milk = 109;
public static int key_grenade = 111;
public static int key_jumpboost = 98;
public static int key_ready = 107;
public static int key_spin = 108;
public static int key_kill = 290;
public static int key_checktag = 117;
public static int key_crab = 106;
public override void Load()
{
ClassInjector.RegisterTypeInIl2Cpp<Main>();
Harmony.CreateAndPatchAll(typeof(Plugin));
Logger = base.Log;
Logger.LogInfo($"ItemMOD v{ver} Loaded.");
Logger.LogInfo($"Made by Win_7");
if (!Directory.Exists(itemmodPath)) {
Directory.CreateDirectory(itemmodPath);
}
//File.WriteAllText($"{itemmodPath}\\log.txt", "");
File.WriteAllText($"{itemmodPath}\\keys_for_keybinds.txt",
@"Backspace: 8
Delete: 127
Tab: 9
Clear: 12
Return: 13
Pause: 19
Escape: 27
Space: 32
Exclaim: 33
DoubleQuote: 34
Hash: 35
Dollar: 36
Percent: 37
Ampersand: 38
LeftParen: 40
RightParen: 41
Asterisk: 42
Plus: 43
Comma: 44
Minus: 45
Period: 46
Slash: 47
Colon: 58
Semicolon: 59
Less: 60
Equals: 61
Greater: 62
Question: 63
At: 64
LeftBracket: 91
Backslash: 92
RightBracket: 93
Caret: 94
Underscore: 95
BackQuote: 96
A: 97
B: 98
C: 99
D: 100
E: 101
F: 102
G: 103
H: 104
I: 105
J: 106
K: 107
L: 108
M: 109
N: 110
O: 111
P: 112
Q: 113
R: 114
S: 115
T: 116
U: 117
V: 118
W: 119
X: 120
Y: 121
Z: 122
Alpha0: 48
Alpha1: 49
Alpha2: 50
Alpha3: 51
Alpha4: 52
Alpha5: 53
Alpha6: 54
Alpha7: 55
Alpha8: 56
Alpha9: 57
LeftCurlyBracket: 123
Pipe: 124
RightCurlyBracket: 125
Tilde: 126
Numlock: 300
CapsLock: 301
ScrollLock: 302
RightShift: 303
LeftShift: 304
RightControl: 305
LeftControl: 306
RightAlt: 307
LeftAlt: 308
LeftCommand: 310
RightCommand: 309
LeftWindows: 311
RightWindows: 312
AltGr: 313
Help: 315
Print: 316
SysReq: 317
Break: 318
Menu: 319
Mouse0: 323
Mouse1: 324
Mouse2: 325
Mouse3: 326
Mouse4: 327
Mouse5: 328
Mouse6: 329
Keypad0: 256
Keypad1: 257
Keypad2: 258
Keypad3: 259
Keypad4: 260
Keypad5: 261
Keypad6: 262
Keypad7: 263
Keypad8: 264
Keypad9: 265
KeypadPeriod: 266
KeypadDivide: 267
KeypadMultiply: 268
KeypadMinus: 269
KeypadPlus: 270
KeypadEnter: 271
KeypadEquals: 272
UpArrow: 273
DownArrow: 274
RightArrow: 275
LeftArrow: 276
F1: 282
F2: 283
F3: 284
F4: 285
F5: 286
F6: 287
F7: 288
F8: 289
F9: 290
F10: 291
F11: 292
F12: 293
Insert: 277
Home: 278
End: 279
PageUp: 280
PageDown: 281
"
);
if (!File.Exists($"{itemmodPath}\\config.txt"))
{
string fullConfig =
@"# If set to true when getting milk/pizza it will not replace an existing item in your inventory
dont-replace-item=true
# Bypasses the client-side profanity filter
# Set to 'true' to allow swear words
profanity-bypass=true
# Full profanity bypass (Allowing anything to be sent in the chat)
full-profanity-bypass=false
# Disable jumpboost (B button)
disable-jumpboost=false
# Jumpboost height (default: 20)
jumpboost-height=20
# Discord webhook for #id dc (leave blank to disable)
webhook=
# Crab mode enabled or not?
crabmode_enabled=true
# Show ammo when equipping gun
showammo=true
# Should the command '#id dc' send the steamids as links or plain text?
dc_playerlist_haslinks=false
# Should you receive a warning in chat if you have done over 100 damage to somebody?
warn_on_100_damage=false
# Skip the Intro UI on round beginning?
skip_intro=true
# Show gamemode name in chat upon loading into map (For use with Disable IntroUI)
show_gamemode_id_in_chat=true
# Show gamemodes WaitingRoom and Practice? (For use with Disable IntroUI)
show_more_gamemode_ids_in_chat=true
# Tick the show box rates box by default
show_box_rates_by_default=false
# Should we hide the About button on the main menu?
hide_about_tab=true
# Send steamid when using #id to webhook (if set)
id_to_webhook=true
# Show the steamID in notepad
id_to_notepad=true
# Should the playerlist be sent to discord on round start?
playerlist_to_dc_auto=false
# Unban AK and Dual when you are host?
unban_ak_dual=true
# Auto copy steamid on #id ?
auto_copy_on_id=false
# Show count of how many people are spectating you
show_spectator_count=false
# Show spectator counter right below the crosshair? true=below crosshair false=top right
show_spectator_count_below_crosshair=false
# Show who people are spectating in TAB (may be buggy)
show_spectating_in_tab=false
# Should we hide unnessecary particles/go through objects?
clear_view=false
# Do you want to get local death messages? (For vanilla lobbys)
local_death_messages=false
# Do you want to have death messages in the lobbys you host?
host_death_messages=false
# Do you want to get local join/leave messages?
local_joinleave_messages=false
# Do you want to have join/leave messages in the lobbys you host?
host_joinleave_messages=false
# Do you want #steam command to open in the overlay instead?
steam_cmd_use_overlay=false
### KEYBINDS
key_pizza=112
key_milk=109
key_grenade=111
key_jumpboost=98
key_ready=107
key_spin=108
key_kill=290
key_checktag=117
key_crab=106
";
File.WriteAllText($"{itemmodPath}\\config.txt", fullConfig);
}
loadConfig();
}
public static void loadConfig()
{
string conf = File.ReadAllText($"{itemmodPath}\\config.txt");
var configSettings = new Dictionary<string, string>();
bool newConfig = false;
foreach (var line in conf.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
{
if (!line.StartsWith("#"))
{
var parts = line.Trim().Split('=');
if (parts.Length == 2)
{
configSettings.Add(parts[0].Trim(), parts[1].Trim());
}
}
}
if (configSettings.TryGetValue("dont-replace-item", out string dontreplaceitem))
{
dontReplaceItem = bool.TryParse(dontreplaceitem, out bool result) ? result : true;
}
else newConfig = true;
if (configSettings.TryGetValue("profanity-bypass", out string defaultValue2))
{
profanityBypass = bool.TryParse(defaultValue2, out bool result) ? result : true;
}
else newConfig = true;
if (configSettings.TryGetValue("full-profanity-bypass", out string full_profanity_bypass))
{
fullprofanityBypass = bool.TryParse(full_profanity_bypass, out bool result) ? result : false;
}
else newConfig = true;
if (configSettings.TryGetValue("disable-jumpboost", out string defaultValue5))
{
jumpboostdisabled = bool.TryParse(defaultValue5, out bool result) ? result : false;
}
else newConfig = true;
if (configSettings.TryGetValue("jumpboost-height", out string defaultValue1))
{
jumpboostamount = float.TryParse(defaultValue1, out float result) ? result : 20;
}
else newConfig = true;
if (configSettings.TryGetValue("webhook", out string webhookValue))
{
if (webhookValue.StartsWithMod("http")) webhook = webhookValue;
}
else newConfig = true;
if (configSettings.TryGetValue("crabmode_enabled", out string crabmodeenabled))
{
crabModeIsOn = bool.TryParse(crabmodeenabled, out bool result) ? result : true;
}
else newConfig = true;
if (configSettings.TryGetValue("showammo", out string showammo))
{
show_ammo = bool.TryParse(showammo, out bool result) ? result : true;
}
else newConfig = true;
if (configSettings.TryGetValue("dc_playerlist_haslinks", out string dc_playerlist_haslinks))
{
dcplayerlisthaslinks = bool.TryParse(dc_playerlist_haslinks, out bool result) ? result : false;
}
else newConfig = true;
if (configSettings.TryGetValue("warn_on_100_damage", out string warn_on_100_damage))
{
warn100dmg = bool.TryParse(warn_on_100_damage, out bool result) ? result : false;
}
else newConfig = true;
if (configSettings.TryGetValue("skip_intro", out string skip_intro))
{
skipIntro = bool.TryParse(skip_intro, out bool result) ? result : true;
}
else newConfig = true;
if (configSettings.TryGetValue("show_gamemode_id_in_chat", out string show_gamemode_id_in_chat))
{
show_gameid_chat = bool.TryParse(show_gamemode_id_in_chat, out bool result) ? result : true;
}
else newConfig = true;
if (configSettings.TryGetValue("show_more_gamemode_ids_in_chat", out string show_more_gamemode_ids_in_chat))
{
show_moregameid_chat = bool.TryParse(show_more_gamemode_ids_in_chat, out bool result) ? result : true;
}
else newConfig = true;
if (configSettings.TryGetValue("show_box_rates_by_default", out string box_rates))
{
showBoxRates = bool.TryParse(box_rates, out bool result) ? result : false;
}
else newConfig = true;
if (configSettings.TryGetValue("hide_about_tab", out string hide_about_tab))
{
hideAbout = bool.TryParse(hide_about_tab, out bool result) ? result : true;
}
else newConfig = true;
if (configSettings.TryGetValue("id_to_webhook", out string id_to_webhook))
{
IdToWebhook = bool.TryParse(id_to_webhook, out bool result) ? result : true;
}
else newConfig = true;
if (configSettings.TryGetValue("id_to_notepad", out string id_to_notepad))
{
IdToNotepad = bool.TryParse(id_to_notepad, out bool result) ? result : true;
}
else newConfig = true;
if (configSettings.TryGetValue("playerlist_to_dc_auto", out string playerlist_to_dc_auto))
{
playerlisttodcauto = bool.TryParse(playerlist_to_dc_auto, out bool result) ? result : false;
}
else newConfig = true;
if (configSettings.TryGetValue("unban_ak_dual", out string unban_ak_dual))
{
unbanAkDual = bool.TryParse(unban_ak_dual, out bool result) ? result : true;
}
else newConfig = true;
if (configSettings.TryGetValue("auto_copy_on_id", out string auto_copy_on_id))
{
autoCopyOnId = bool.TryParse(auto_copy_on_id, out bool result) ? result : false;
}
else newConfig = true;
if (configSettings.TryGetValue("show_spectator_count", out string show_spectator_count))
{
showSpectatorCount = bool.TryParse(show_spectator_count, out bool result) ? result : false;
}
else newConfig = true;
if (configSettings.TryGetValue("show_spectator_count_below_crosshair", out string show_spectator_count_below_crosshair))
{
spectatorCountBelowCrosshair = bool.TryParse(show_spectator_count_below_crosshair, out bool result) ? result : false;
}
else newConfig = true;
if (configSettings.TryGetValue("show_spectating_in_tab", out string show_spectating_in_tab))
{
spectatorsInTAB = bool.TryParse(show_spectating_in_tab, out bool result) ? result : false;
}
else newConfig = true;
if (configSettings.TryGetValue("clear_view", out string clear_view))
{
clearView = bool.TryParse(clear_view, out bool result) ? result : false;
}
else newConfig = true;
if (configSettings.TryGetValue("local_death_messages", out string local_death_messages))
{
localdeathmessages = bool.TryParse(local_death_messages, out bool result) ? result : false;
}
else newConfig = true;
if (configSettings.TryGetValue("host_death_messages", out string host_death_messages))
{
hostdeathmessages = bool.TryParse(host_death_messages, out bool result) ? result : false;
}
else newConfig = true;
if (configSettings.TryGetValue("local_joinleave_messages", out string local_joinleave_messages))
{
localjoinleavemessages = bool.TryParse(local_joinleave_messages, out bool result) ? result : false;
}
else newConfig = true;
if (configSettings.TryGetValue("host_joinleave_messages", out string host_joinleave_messages))
{
hostjoinleavemessages = bool.TryParse(host_joinleave_messages, out bool result) ? result : false;
}
else newConfig = true;
if (configSettings.TryGetValue("steam_cmd_use_overlay", out string steam_cmd_use_overlay))
{
steamcmduseoverlay = bool.TryParse(steam_cmd_use_overlay, out bool result) ? result : false;
}
else newConfig = true;
/// ----------------------------------- KEYBINDS -------------------------------------------------------------------------------
if (configSettings.TryGetValue("key_pizza", out string defaultValue7))
{
key_pizza = int.TryParse(defaultValue7, out int result) ? result : 112;
}
if (configSettings.TryGetValue("key_milk", out string defaultValue8))
{
key_milk = int.TryParse(defaultValue8, out int result) ? result : 109;
}
if (configSettings.TryGetValue("key_grenade", out string defaultValue9))
{
key_grenade = int.TryParse(defaultValue9, out int result) ? result : 111;
}
if (configSettings.TryGetValue("key_jumpboost", out string defaultValue10))
{
key_jumpboost = int.TryParse(defaultValue10, out int result) ? result : 98;
}
if (configSettings.TryGetValue("key_ready", out string defaultValue11))
{
key_ready = int.TryParse(defaultValue11, out int result) ? result : 107;
}
if (configSettings.TryGetValue("key_spin", out string defaultValue12))
{
key_spin = int.TryParse(defaultValue12, out int result) ? result : 108;
}
if (configSettings.TryGetValue("key_kill", out string defaultValue13))
{
key_kill = int.TryParse(defaultValue13, out int result) ? result : 290;
}
if (configSettings.TryGetValue("key_checktag", out string defaultValue15))
{
key_checktag = int.TryParse(defaultValue15, out int result) ? result : 117;
}
if (configSettings.TryGetValue("key_crab", out string defaultValue23))
{
key_crab = int.TryParse(defaultValue23, out int result) ? result : 291;
}
string confver = "";
try
{
confver = File.ReadAllText($"{itemmodPath}\\.config-ver");
}
catch { }
if (confver != apiver.ToString() && newConfig)
{
printNotepad("ItemMOD has new config available!\nTo refresh your config file please do the following:\n\n1) Open Crab Game files\n2) Go to BepInEx\\plugins\\ItemMod\n3) Delete or rename config.txt\n4) Launch and close Crab Game\n5) Open the new file and make your configurations\n\nThis message will not be shown again.");
File.WriteAllText($"{itemmodPath}\\.config-ver", apiver.ToString());
}
else if (confver != apiver.ToString() && !newConfig)
{
File.WriteAllText($"{itemmodPath}\\.config-ver", apiver.ToString());
}
}
public class Main : MonoBehaviour
{
void Awake() // called once per round
{
playerDMG.Clear();
itemToGive = -1;
spectatingME.Clear();
spectatorsList.Clear();
if (LobbyManager.Instance.gameMode.id == 0 || LobbyManager.Instance.gameMode.id == 13)
{
gameStarted = false;
}
else
{
gameStarted = true;
}
if (playerlisttodcauto && LobbyManager.Instance.gameMode.id != 13)
{
if (string.IsNullOrWhiteSpace(webhook))
{
playerlisttodcauto = false;
}
else
{
sendUserListToWebhook();
}
}
doClearView();
}
void Update()
{
// dont register keybinds when typing in chat
if (ChatBox.Instance.transform.GetChild(0).GetChild(1).GetComponent<TMP_InputField>().isFocused) return;
if (Input.GetKeyDown((KeyCode)key_pizza))
{
itemToGive = 12;
}
if (Input.GetKeyDown((KeyCode)key_milk))
{
itemToGive = 11;
}
if (Input.GetKeyDown((KeyCode)key_grenade))
{
itemToGive = 13;
}
if (Input.GetKeyDown((KeyCode)key_ready))
{
ClientSend.TryInteract(4);
}
if (Input.GetKeyDown((KeyCode)key_spin))
{
totalReloadTime += 1f;
ClientSend.PlayerReload(totalReloadTime);
}
if (Input.GetKeyDown((KeyCode)key_kill))
{
ClientSend.PlayerDied(clientId, Vector3.zero);
}
if (Input.GetKeyDown((KeyCode)key_crab))
{
if (crabModeIsOn && crabModeAllowed)
{
crabMode = !crabMode;
if (crabMode) ForceMessageModGreen("You have become a crab :D");
else ForceMessageModRed("You are no longer a crab.");
PlayerServerCommunication.Instance.ForceMovementUpdate();
}
}
if (!jumpboostdisabled && Input.GetKeyDown((KeyCode)key_jumpboost))
{
if (LobbyManager.Instance.gameMode.id == 13 || LobbyManager.Instance.gameMode.id == 0)
{
GameObject clientObject = GameObject.Find("/Player");
PlayerMovement clientMovement = clientObject?.GetComponent<PlayerMovement>();
clientMovement.PushPlayer(new Vector3(0, jumpboostamount, 0));
}
}
if (Input.GetKeyDown((KeyCode)key_checktag))
{
if (LobbyManager.Instance.gameMode.id == 4) // Only for tag
{
try
{
GameModeTag gmtag;
try
{
gmtag = GameObject.Find("/GameManager (1)").GetComponent<GameModeTag>();
}
catch
{
gmtag = GameObject.Find("/GameManager").GetComponent<GameModeTag>();
}
if (gmtag.field_Private_List_1_UInt64_0.Contains(clientId))
{
ForceMessageModRed("You are tagged!");
}
else
{
ForceMessageModGreen("You are not tagged.");
}
}
catch (Exception ex)
{
Logger.LogWarning(ex.ToString());
}
}
}
}
}
public static void printNotepad(string text)
{
File.WriteAllText($"{itemmodPath}\\ItemMOD-message", text);
Process.Start("notepad.exe", $"{itemmodPath}\\ItemMOD-message");
}
public static void openNotepad(string path)
{
if (File.Exists("C:\\Program Files\\Notepad++\\notepad++.exe"))
{
Process.Start("C:\\Program Files\\Notepad++\\notepad++.exe", $"\"{path}\"");
}
else
{
Process.Start("notepad.txt", $"\"{path}\"");
}
}
public static void doClearView()
{
if (!clearView) return;
//bool unfair = false;
switch (LobbyManager.Instance.map.id)
{
case 5:
case 17:
case 22:
turnOffObject("Statue/StatueFinal/Creepy"); // Annoying Sounds
turnOffObject("Grass");
turnOffObject("r"); // House
turnOffObject("r (1)");
turnOffObject("r (2)");
if (LobbyManager.Instance.map.id == 17)
{
turnOffObject("plainsGround/Plane.000");
turnOffObject("plainsGround/Plane.001");
}
else
{
turnOffObject("Cube (2)");
}
break;
case 10:
turnOffObject("Bush_Snow_2");
turnOffObject("Bush_Snow_2 (1)");
turnOffObject("Bush_Snow_2 (2)");
turnOffObject("Bush_Snow_2 (3)");
turnOffObject("Bush_Snow_2 (4)");
turnOffObject("Bush_Snow_2 (5)");
turnOffObject("Bush_Snow_2 (6)");
turnOffObject("Bush_Snow_2 (7)");
break;
case 20:
turnOffObject("DamageNumbers"); // Maplayout credit text
break;
case 29:
turnOffObject("Cube"); // random pole in the distance with no collision
turnOffObject("Bush_Snow_2");
turnOffObject("Bush_Snow_2 (1)");
turnOffObject("Bush_Snow_2 (2)");
turnOffObject("Bush_Snow_2 (3)");
turnOffObject("Bush_Snow_2 (4)");
turnOffObject("Bush_Snow_2 (5)");
turnOffObject("Bush_Snow_2 (6)");
turnOffObject("Bush_Snow_2 (7)");
turnOffObject("Bush_Snow_2 (8)");
turnOffObject("Bush_Snow_2 (9)");
turnOffObject("Bush_Snow_2 (10)");
turnOffObject("Bush_Snow_2 (11)");
turnOffObject("Bush_Snow_2 (12)");
turnOffObject("Bush_Snow_2 (13)");
turnOffObject("Bush_Snow_2 (14)");
turnOffObject("Bush_Snow_2 (15)");
turnOffObject("Bush_Snow_2 (16)");
turnOffObject("Bush_Snow_2 (17)");
turnOffObject("Bush_Snow_2 (18)");
turnOffObject("Bush_Snow_2 (19)");
turnOffObject("Bush_Snow_2 (20)");
break;
case 32:
turnOffObject("WoodLog (3)"); // the reandom log with no collision
break;
case 33:
turnOffObject("Dust");
turnOffObject("ScrollController"); // ground
removeRenderer("Map"); // disable bcs fog
break;
case 39:
turnOffObject("Cactus_3 (3)");
turnOffObject("Cactus_3 (4)");
break;
case 42:
case 43:
turnOffObject("Bush_Snow_2");
turnOffObject("Bush_Snow_2 (1)");
turnOffObject("Bush_Snow_2 (2)");
turnOffObject("Bush_Snow_2 (3)");
turnOffObject("Bush_Snow_2 (4)");
turnOffObject("Bush_Snow_2 (5)");
break;
case 56:
turnOffObject("Ball");
turnOffObject("Ball (1)");
break;
case 57:
turnOffObject("Bush_Snow_2");
turnOffObject("Bush_Snow_2 (1)");
turnOffObject("Bush_Snow_2 (2)");
turnOffObject("Bush_Snow_2 (3)");
turnOffObject("Bush_Snow_2 (4)");
turnOffObject("Bush_Snow_2 (5)");
turnOffObject("Bush_Snow_2 (6)");
turnOffObject("Bush_Snow_2 (7)");
turnOffObject("Bush_Snow_2 (8)");
turnOffObject("Bush_Snow_2 (9)");
turnOffObject("Bush_Snow_2 (10)");
turnOffObject("Bush_Snow_2 (11)");
turnOffObject("Bush_Snow_2 (12)");
turnOffObject("Bush_Snow_2 (13)");
turnOffObject("Bush_Snow_2 (14)");
turnOffObject("Bush_Snow_2 (15)");
turnOffObject("Bush_Snow_2 (16)");
turnOffObject("Bush_Snow_2 (17)");
turnOffObject("Bush_Snow_2 (18)");
turnOffObject("Bush_Snow_2 (19)");
turnOffObject("Bush_Snow_2 (20)");
turnOffObject("Bush_Snow_2 (21)");
turnOffObject("Bush_Snow_2 (22)");
turnOffObject("Bush_Snow_2 (23)");
turnOffObject("Bush_Snow_2 (24)");
turnOffObject("Bush_Snow_2 (25)");
turnOffObject("Bush_Snow_2 (26)");
break;
default:
break;
}
// Finally, we turn off snow and windparticles for every map
turnOffObject("Snow");
turnOffObject("WindParticles");
}
public static void turnOffObject(string obj)
{
try
{
GameObject gameObject = GameObject.Find(obj);
gameObject.active = false;
gameObject.SetActive(false);
}
catch { }
}
public static void removeRenderer(string obj)
{
try
{
GameObject gameObject = GameObject.Find(obj);
UnityEngine.Object.Destroy(gameObject.GetComponent<UnityEngine.MeshRenderer>());
}
catch { }
}
public static string GetPlayerSteamId(int playerNumber)
{
playersList = GameManager.Instance.activePlayers.entries.ToList();
for (int u = 0; u <= playersList.Count; u++)
{
try
{
if (playersList[u].value.playerNumber == playerNumber)
{
return playersList[u].value.steamProfile.m_SteamID.ToString();
}
}
catch (Exception ex)
{
Logger.LogError("Error[GetPlayerSteamId] : " + ex.Message);
}
}
return null;
}
public static int GetPlayerNumber(ulong steamId)
{
foreach (Il2CppSystem.Collections.Generic.KeyValuePair<ulong, MonoBehaviourPublicCSstReshTrheObplBojuUnique> player in GameManager.Instance.activePlayers)
{
if (player.Value.steamProfile.m_SteamID == steamId)
{
return player.value.playerNumber;
}
}
return 0;
}
public static string GetPlayerSteamName(string steamid)
{
return SteamFriends.GetFriendPersonaName((CSteamID)ulong.Parse(steamid));
}
public static string GetPlayerSteamName(ulong steamid)
{
return SteamFriends.GetFriendPersonaName((CSteamID)steamid);
}
public static string GetPlayerSteamName(CSteamID steamid)
{
return SteamFriends.GetFriendPersonaName(steamid);
}
public static void SendMessage(string message)
{
ChatBox.Instance.SendMessage(message);
}
public static void ForceMessage(string message)
{
ChatBox.Instance.ForceMessage(message);
}
public static void ForceMessageModWhite(string message)
{
ChatBox.Instance.ForceMessage("<color=#17b54b>[ItemMOD]</color> <color=#FFFFFF>" + message + "</color>");
}
public static void ForceMessageModRed(string message)
{
ChatBox.Instance.ForceMessage("<color=#17b54b>[ItemMOD]</color> <color=#ff0000>" + message + "</color>");
}
public static void ForceMessageModGreen(string message)
{
ChatBox.Instance.ForceMessage("<color=#17b54b>[ItemMOD]</color> <color=#00ff00>" + message + "</color>");