Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ChromaInitializer.cs
Go to the documentation of this file.
1using System;
4using System.Linq;
5using System.Windows.Forms;
8using ReLogic.OS;
14using SteelSeries.GameSense;
15using SteelSeries.GameSense.DeviceZone;
19using Terraria.IO;
20
21namespace Terraria.Initializers;
22
23public static class ChromaInitializer
24{
31
32 private static ChromaEngine _engine;
33
34 private const string GAME_NAME_ID = "TERRARIA";
35
36 private static float _rgbUpdateRate;
37
38 private static bool _useRazer;
39
40 private static bool _useCorsair;
41
42 private static bool _useLogitech;
43
44 private static bool _useSteelSeries;
45
47
49
51
53
55 {
56 {
57 "KEY_MOUSELEFT",
59 {
60 DefaultDisplayName = "Left Mouse Button"
61 }
62 },
63 {
64 "KEY_MOUSERIGHT",
66 {
67 DefaultDisplayName = "Right Mouse Button"
68 }
69 },
70 {
71 "KEY_UP",
73 {
74 DefaultDisplayName = "Up"
75 }
76 },
77 {
78 "KEY_DOWN",
80 {
81 DefaultDisplayName = "Down"
82 }
83 },
84 {
85 "KEY_LEFT",
87 {
88 DefaultDisplayName = "Left"
89 }
90 },
91 {
92 "KEY_RIGHT",
94 {
95 DefaultDisplayName = "Right"
96 }
97 },
98 {
99 "KEY_JUMP",
101 {
102 DefaultDisplayName = "Jump"
103 }
104 },
105 {
106 "KEY_THROW",
108 {
109 DefaultDisplayName = "Throw"
110 }
111 },
112 {
113 "KEY_INVENTORY",
115 {
116 DefaultDisplayName = "Inventory"
117 }
118 },
119 {
120 "KEY_GRAPPLE",
122 {
123 DefaultDisplayName = "Grapple"
124 }
125 },
126 {
127 "KEY_SMARTSELECT",
129 {
130 DefaultDisplayName = "Smart Select"
131 }
132 },
133 {
134 "KEY_SMARTCURSOR",
136 {
137 DefaultDisplayName = "Smart Cursor"
138 }
139 },
140 {
141 "KEY_QUICKMOUNT",
143 {
144 DefaultDisplayName = "Quick Mount"
145 }
146 },
147 {
148 "KEY_QUICKHEAL",
150 {
151 DefaultDisplayName = "Quick Heal"
152 }
153 },
154 {
155 "KEY_QUICKMANA",
157 {
158 DefaultDisplayName = "Quick Mana"
159 }
160 },
161 {
162 "KEY_QUICKBUFF",
164 {
165 DefaultDisplayName = "Quick Buff"
166 }
167 },
168 {
169 "KEY_MAPZOOMIN",
171 {
172 DefaultDisplayName = "Map Zoom In"
173 }
174 },
175 {
176 "KEY_MAPZOOMOUT",
178 {
179 DefaultDisplayName = "Map Zoom Out"
180 }
181 },
182 {
183 "KEY_MAPALPHAUP",
185 {
186 DefaultDisplayName = "Map Transparency Up"
187 }
188 },
189 {
190 "KEY_MAPALPHADOWN",
192 {
193 DefaultDisplayName = "Map Transparency Down"
194 }
195 },
196 {
197 "KEY_MAPFULL",
199 {
200 DefaultDisplayName = "Map Full"
201 }
202 },
203 {
204 "KEY_MAPSTYLE",
206 {
207 DefaultDisplayName = "Map Style"
208 }
209 },
210 {
211 "KEY_HOTBAR1",
213 {
214 DefaultDisplayName = "Hotbar 1"
215 }
216 },
217 {
218 "KEY_HOTBAR2",
220 {
221 DefaultDisplayName = "Hotbar 2"
222 }
223 },
224 {
225 "KEY_HOTBAR3",
227 {
228 DefaultDisplayName = "Hotbar 3"
229 }
230 },
231 {
232 "KEY_HOTBAR4",
234 {
235 DefaultDisplayName = "Hotbar 4"
236 }
237 },
238 {
239 "KEY_HOTBAR5",
241 {
242 DefaultDisplayName = "Hotbar 5"
243 }
244 },
245 {
246 "KEY_HOTBAR6",
248 {
249 DefaultDisplayName = "Hotbar 6"
250 }
251 },
252 {
253 "KEY_HOTBAR7",
255 {
256 DefaultDisplayName = "Hotbar 7"
257 }
258 },
259 {
260 "KEY_HOTBAR8",
262 {
263 DefaultDisplayName = "Hotbar 8"
264 }
265 },
266 {
267 "KEY_HOTBAR9",
269 {
270 DefaultDisplayName = "Hotbar 9"
271 }
272 },
273 {
274 "KEY_HOTBAR10",
276 {
277 DefaultDisplayName = "Hotbar 10"
278 }
279 },
280 {
281 "KEY_HOTBARMINUS",
283 {
284 DefaultDisplayName = "Hotbar Minus"
285 }
286 },
287 {
288 "KEY_HOTBARPLUS",
290 {
291 DefaultDisplayName = "Hotbar Plus"
292 }
293 },
294 {
295 "KEY_DPADRADIAL1",
297 {
298 DefaultDisplayName = "Dpad Radial 1"
299 }
300 },
301 {
302 "KEY_DPADRADIAL2",
304 {
305 DefaultDisplayName = "Dpad Radial 2"
306 }
307 },
308 {
309 "KEY_DPADRADIAL3",
311 {
312 DefaultDisplayName = "Dpad Radial 3"
313 }
314 },
315 {
316 "KEY_DPADRADIAL4",
318 {
319 DefaultDisplayName = "Dpad Radial 4"
320 }
321 },
322 {
323 "KEY_RADIALHOTBAR",
325 {
326 DefaultDisplayName = "Radial Hotbar"
327 }
328 },
329 {
330 "KEY_RADIALQUICKBAR",
332 {
333 DefaultDisplayName = "Radial Quickbar"
334 }
335 },
336 {
337 "KEY_DPADSNAP1",
339 {
340 DefaultDisplayName = "Dpad Snap 1"
341 }
342 },
343 {
344 "KEY_DPADSNAP2",
346 {
347 DefaultDisplayName = "Dpad Snap 2"
348 }
349 },
350 {
351 "KEY_DPADSNAP3",
353 {
354 DefaultDisplayName = "Dpad Snap 3"
355 }
356 },
357 {
358 "KEY_DPADSNAP4",
360 {
361 DefaultDisplayName = "Dpad Snap 4"
362 }
363 },
364 {
365 "KEY_MENUUP",
367 {
368 DefaultDisplayName = "Menu Up"
369 }
370 },
371 {
372 "KEY_MENUDOWN",
374 {
375 DefaultDisplayName = "Menu Down"
376 }
377 },
378 {
379 "KEY_MENULEFT",
381 {
382 DefaultDisplayName = "Menu Left"
383 }
384 },
385 {
386 "KEY_MENURIGHT",
388 {
389 DefaultDisplayName = "Menu Right"
390 }
391 },
392 {
393 "KEY_LOCKON",
395 {
396 DefaultDisplayName = "Lock On"
397 }
398 },
399 {
400 "KEY_VIEWZOOMIN",
402 {
403 DefaultDisplayName = "Zoom In"
404 }
405 },
406 {
407 "KEY_VIEWZOOMOUT",
409 {
410 DefaultDisplayName = "Zoom Out"
411 }
412 },
413 {
414 "KEY_TOGGLECREATIVEMENU",
416 {
417 DefaultDisplayName = "Toggle Creative Menu"
418 }
419 },
420 {
421 "DO_RAINBOWS",
423 {
424 DefaultDisplayName = "Theme"
425 }
426 },
427 {
428 "ZONE1",
430 {
431 DefaultDisplayName = "Zone 1"
432 }
433 },
434 {
435 "ZONE2",
437 {
438 DefaultDisplayName = "Zone 2"
439 }
440 },
441 {
442 "ZONE3",
444 {
445 DefaultDisplayName = "Zone 3"
446 }
447 },
448 {
449 "ZONE4",
451 {
452 DefaultDisplayName = "Zone 4"
453 }
454 },
455 {
456 "ZONE5",
458 {
459 DefaultDisplayName = "Zone 5"
460 }
461 },
462 {
463 "ZONE6",
465 {
466 DefaultDisplayName = "Zone 6"
467 }
468 },
469 {
470 "ZONE7",
472 {
473 DefaultDisplayName = "Zone 7"
474 }
475 },
476 {
477 "ZONE8",
479 {
480 DefaultDisplayName = "Zone 8"
481 }
482 },
483 {
484 "ZONE9",
486 {
487 DefaultDisplayName = "Zone 9"
488 }
489 },
490 {
491 "ZONE10",
493 {
494 DefaultDisplayName = "Zone 10"
495 }
496 },
497 {
498 "ZONE11",
500 {
501 DefaultDisplayName = "Zone 11"
502 }
503 },
504 {
505 "ZONE12",
507 {
508 DefaultDisplayName = "Zone 12"
509 }
510 },
511 {
512 "LIFE",
514 {
515 DefaultDisplayName = "Life Percent"
516 }
517 },
518 {
519 "MANA",
521 {
522 DefaultDisplayName = "Mana Percent"
523 }
524 },
525 {
526 "BREATH",
528 {
529 DefaultDisplayName = "Breath Percent"
530 }
531 }
532 };
533
535
537
539
540 public static void BindTo(Preferences preferences)
541 {
542 preferences.OnSave += Configuration_OnSave;
543 preferences.OnLoad += Configuration_OnLoad;
544 }
545
547 {
548 //IL_005e: Unknown result type (might be due to invalid IL or missing references)
549 //IL_0068: Expected O, but got Unknown
550 //IL_0073: Unknown result type (might be due to invalid IL or missing references)
551 //IL_007d: Expected O, but got Unknown
552 //IL_0088: Unknown result type (might be due to invalid IL or missing references)
553 //IL_0092: Expected O, but got Unknown
554 //IL_009d: Unknown result type (might be due to invalid IL or missing references)
555 //IL_00a7: Expected O, but got Unknown
556 _useRazer = obj.Get("UseRazerRGB", defaultValue: true);
557 _useCorsair = obj.Get("UseCorsairRGB", defaultValue: true);
558 _useLogitech = obj.Get("UseLogitechRGB", defaultValue: true);
559 _useSteelSeries = obj.Get("UseSteelSeriesRGB", defaultValue: true);
560 _razerColorProfile = obj.Get<VendorColorProfile>("RazerColorProfile", new VendorColorProfile(new Vector3(1f, 0.765f, 0.568f)));
561 _corsairColorProfile = obj.Get<VendorColorProfile>("CorsairColorProfile", new VendorColorProfile());
562 _logitechColorProfile = obj.Get<VendorColorProfile>("LogitechColorProfile", new VendorColorProfile());
563 _steelSeriesColorProfile = obj.Get<VendorColorProfile>("SteelSeriesColorProfile", new VendorColorProfile());
564 _rgbUpdateRate = obj.Get("RGBUpdatesPerSecond", 45f);
565 if (_rgbUpdateRate <= 1E-07f)
566 {
567 _rgbUpdateRate = 45f;
568 }
569 }
570
572 {
573 preferences.Put("RGBUpdatesPerSecond", _rgbUpdateRate);
574 preferences.Put("UseRazerRGB", _useRazer);
575 preferences.Put("RazerColorProfile", _razerColorProfile);
576 preferences.Put("UseCorsairRGB", _useCorsair);
577 preferences.Put("CorsairColorProfile", _corsairColorProfile);
578 preferences.Put("UseLogitechRGB", _useLogitech);
579 preferences.Put("LogitechColorProfile", _logitechColorProfile);
580 preferences.Put("UseSteelSeriesRGB", _useSteelSeries);
581 preferences.Put("SteelSeriesColorProfile", _steelSeriesColorProfile);
582 }
583
584 private static void AddDevices()
585 {
586 //IL_000f: Unknown result type (might be due to invalid IL or missing references)
587 //IL_0019: Expected O, but got Unknown
588 //IL_0028: Unknown result type (might be due to invalid IL or missing references)
589 //IL_0032: Expected O, but got Unknown
590 //IL_0041: Unknown result type (might be due to invalid IL or missing references)
591 //IL_004b: Expected O, but got Unknown
592 //IL_0065: Unknown result type (might be due to invalid IL or missing references)
593 //IL_006f: Expected O, but got Unknown
594 _engine.AddDeviceGroup("Razer", (RgbDeviceGroup)new RazerDeviceGroup(_razerColorProfile));
595 _engine.AddDeviceGroup("Corsair", (RgbDeviceGroup)new CorsairDeviceGroup(_corsairColorProfile));
596 _engine.AddDeviceGroup("Logitech", (RgbDeviceGroup)new LogitechDeviceGroup(_logitechColorProfile));
597 _engine.AddDeviceGroup("SteelSeries", (RgbDeviceGroup)new SteelSeriesDeviceGroup(_steelSeriesColorProfile, "TERRARIA", "Terraria", IconColor.Green));
598 _engine.FrameTimeInSeconds = 1f / _rgbUpdateRate;
599 if (_useRazer)
600 {
601 _engine.EnableDeviceGroup("Razer");
602 }
603 if (_useCorsair)
604 {
605 _engine.EnableDeviceGroup("Corsair");
606 }
607 if (_useLogitech)
608 {
609 _engine.EnableDeviceGroup("Logitech");
610 }
611 if (_useSteelSeries)
612 {
613 _engine.EnableDeviceGroup("SteelSeries");
614 }
616 AppDomain.CurrentDomain.ProcessExit += OnProcessExit;
618 {
619 Application.ApplicationExit += OnProcessExit;
620 }
621 }
622
623 private static void LoadSpecialRulesForDevices()
624 {
625 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
626 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
627 //IL_0015: Expected O, but got Unknown
628 //IL_0015: Unknown result type (might be due to invalid IL or missing references)
629 //IL_001a: Unknown result type (might be due to invalid IL or missing references)
630 //IL_002a: Expected O, but got Unknown
631 //IL_002a: Unknown result type (might be due to invalid IL or missing references)
632 //IL_002f: Unknown result type (might be due to invalid IL or missing references)
633 //IL_003f: Expected O, but got Unknown
635 {
636 EventName = "LIFE"
637 };
639 {
640 EventName = "MANA"
641 };
643 {
644 EventName = "BREATH"
645 };
647 }
648
649 public static void UpdateEvents()
650 {
651 if (Main.gameMenu)
652 {
656 return;
657 }
659 int num = (int)Utils.Clamp((float)localPlayer.statLife / (float)localPlayer.statLifeMax2 * 100f, 0f, 100f);
661 int num2 = (int)Utils.Clamp((float)localPlayer.statMana / (float)localPlayer.statManaMax2 * 100f, 0f, 100f);
663 int num3 = (int)Utils.Clamp((float)localPlayer.breath / (float)localPlayer.breathMax * 100f, 0f, 100f);
665 }
666
667 private static void LoadSpecialRulesFor_GameSense()
668 {
669 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
670 //IL_0006: Expected O, but got Unknown
672 List<Bind_Event> eventsToBind = (val.EventsToBind = new List<Bind_Event>());
676 LoadSpecialRulesFor_SecondaryDevice(eventsToBind, "ZONE3", "zone3", new RGBZonedDevice("three"));
680 LoadSpecialRulesFor_SecondaryDevice(eventsToBind, "ZONE7", "zone7", new RGBZonedDevice("seven"));
681 LoadSpecialRulesFor_SecondaryDevice(eventsToBind, "ZONE8", "zone8", new RGBZonedDevice("eight"));
683 LoadSpecialRulesFor_SecondaryDevice(eventsToBind, "ZONE10", "zone10", new RGBZonedDevice("ten"));
684 LoadSpecialRulesFor_SecondaryDevice(eventsToBind, "ZONE11", "zone11", new RGBZonedDevice("eleven"));
685 LoadSpecialRulesFor_SecondaryDevice(eventsToBind, "ZONE12", "zone12", new RGBZonedDevice("twelve"));
687 val.MiscEvents = new List<ARgbGameValueTracker>
688 {
692 };
693 foreach (Bind_Event item in val.EventsToBind)
694 {
695 if (_localizedEvents.TryGetValue(item.eventName, out var value))
696 {
697 item.defaultDisplayName = value.DefaultDisplayName;
698 item.localizedDisplayNames = value.LocalizedNames;
699 }
700 }
701 _engine.LoadSpecialRules((object)val);
702 }
703
705 {
706 eventsToBind.Add(new Bind_Event("TERRARIA", ((ARgbGameValueTracker)Event_LifePercent).EventName, 0, 100, EventIconId.Health, new AbstractHandler[0]));
707 eventsToBind.Add(new Bind_Event("TERRARIA", ((ARgbGameValueTracker)Event_ManaPercent).EventName, 0, 100, EventIconId.Mana, new AbstractHandler[0]));
708 eventsToBind.Add(new Bind_Event("TERRARIA", ((ARgbGameValueTracker)Event_BreathPercent).EventName, 0, 100, EventIconId.Air, new AbstractHandler[0]));
709 }
710
712 {
713 Bind_Event item = new Bind_Event("TERRARIA", eventName, 0, 10, EventIconId.Default, new AbstractHandler[1]
714 {
715 new ContextColorEventHandlerType
716 {
717 ContextFrameKey = contextFrameKey,
718 DeviceZone = zone
719 }
720 });
722 }
723
725 {
726 Dictionary<string, byte> xnaKeyNamesToSteelSeriesKeyIndex = HIDCodes.XnaKeyNamesToSteelSeriesKeyIndex;
728 foreach (KeyValuePair<string, List<string>> item3 in PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus)
729 {
730 string key = item3.Key;
731 List<string> value = item3.Value;
732 List<byte> list = new List<byte>();
733 foreach (string item4 in value)
734 {
736 {
737 list.Add(value2);
738 }
739 }
741 new ColorStatic
742 {
743 red = white.R,
744 green = white.G,
745 blue = white.B
746 };
747 Bind_Event item = new Bind_Event("TERRARIA", "KEY_" + key.ToUpper(), 0, 10, EventIconId.Default, new AbstractHandler[1]
748 {
749 new ContextColorEventHandlerType
750 {
751 ContextFrameKey = key,
752 DeviceZone = deviceZone
753 }
754 });
756 }
757 Bind_Event item2 = new Bind_Event("TERRARIA", "DO_RAINBOWS", 0, 10, EventIconId.Default, new AbstractHandler[1]
758 {
759 new PartialBitmapEventHandlerType
760 {
761 EventsToExclude = eventsToBind.Select((Bind_Event x) => x.eventName).ToArray()
762 }
763 });
765 }
766
767 public static void DisableAllDeviceGroups()
768 {
769 if (_engine != null)
770 {
771 _engine.DisableAllDeviceGroups();
772 }
773 }
774
775 private static void OnProcessExit(object sender, EventArgs e)
776 {
777 DisableAllDeviceGroups();
778 }
779
780 public static void Load()
781 {
782 _engine = Main.Chroma;
783 AddDevices();
784 Color color = new Color(46, 23, 12);
785 RegisterShader("Base", (ChromaShader)(object)new SurfaceBiomeShader(Color.Green, color), CommonConditions.InMenu, (ShaderLayer)9);
786 RegisterShader("Surface Mushroom", (ChromaShader)(object)new SurfaceBiomeShader(Color.DarkBlue, new Color(33, 31, 27)), CommonConditions.DrunkMenu, (ShaderLayer)9);
787 RegisterShader("Sky", (ChromaShader)(object)new SkyShader(new Color(34, 51, 128), new Color(5, 5, 5)), CommonConditions.Depth.Sky, (ShaderLayer)1);
788 RegisterShader("Surface", (ChromaShader)(object)new SurfaceBiomeShader(Color.Green, color), CommonConditions.Depth.Surface, (ShaderLayer)1);
789 RegisterShader("Vines", (ChromaShader)(object)new VineShader(), CommonConditions.Depth.Vines, (ShaderLayer)1);
790 RegisterShader("Underground", (ChromaShader)(object)new CavernShader(new Color(122, 62, 32), new Color(25, 13, 7), 0.5f), CommonConditions.Depth.Underground, (ShaderLayer)1);
791 RegisterShader("Caverns", (ChromaShader)(object)new CavernShader(color, new Color(25, 25, 25), 0.5f), CommonConditions.Depth.Caverns, (ShaderLayer)1);
792 RegisterShader("Magma", (ChromaShader)(object)new CavernShader(new Color(181, 17, 0), new Color(25, 25, 25), 0.5f), CommonConditions.Depth.Magma, (ShaderLayer)1);
793 RegisterShader("Underworld", (ChromaShader)(object)new UnderworldShader(Color.Red, new Color(1f, 0.5f, 0f), 1f), CommonConditions.Depth.Underworld, (ShaderLayer)1);
794 RegisterShader("Surface Desert", (ChromaShader)(object)new SurfaceBiomeShader(new Color(84, 49, 0), new Color(245, 225, 33)), CommonConditions.SurfaceBiome.Desert, (ShaderLayer)2);
795 RegisterShader("Surface Jungle", (ChromaShader)(object)new SurfaceBiomeShader(Color.Green, Color.Teal), CommonConditions.SurfaceBiome.Jungle, (ShaderLayer)2);
796 RegisterShader("Surface Ocean", (ChromaShader)(object)new SurfaceBiomeShader(Color.SkyBlue, Color.Blue), CommonConditions.SurfaceBiome.Ocean, (ShaderLayer)2);
797 RegisterShader("Surface Snow", (ChromaShader)(object)new SurfaceBiomeShader(new Color(0, 10, 50), new Color(0.5f, 0.75f, 1f)), CommonConditions.SurfaceBiome.Snow, (ShaderLayer)2);
798 RegisterShader("Surface Mushroom", (ChromaShader)(object)new SurfaceBiomeShader(Color.DarkBlue, new Color(33, 31, 27)), CommonConditions.SurfaceBiome.Mushroom, (ShaderLayer)2);
799 RegisterShader("Surface Hallow", (ChromaShader)(object)new HallowSurfaceShader(), CommonConditions.SurfaceBiome.Hallow, (ShaderLayer)3);
800 RegisterShader("Surface Crimson", (ChromaShader)(object)new CorruptSurfaceShader(Color.Red, new Color(25, 25, 40)), CommonConditions.SurfaceBiome.Crimson, (ShaderLayer)3);
801 RegisterShader("Surface Corruption", (ChromaShader)(object)new CorruptSurfaceShader(new Color(73, 0, 255), new Color(15, 15, 27)), CommonConditions.SurfaceBiome.Corruption, (ShaderLayer)3);
802 RegisterShader("Hive", (ChromaShader)(object)new DrippingShader(new Color(0.05f, 0.01f, 0f), new Color(255, 150, 0), 0.5f), CommonConditions.UndergroundBiome.Hive, (ShaderLayer)3);
803 RegisterShader("Underground Mushroom", (ChromaShader)(object)new UndergroundMushroomShader(), CommonConditions.UndergroundBiome.Mushroom, (ShaderLayer)2);
804 RegisterShader("Underground Corrutpion", (ChromaShader)(object)new UndergroundCorruptionShader(), CommonConditions.UndergroundBiome.Corrupt, (ShaderLayer)2);
805 RegisterShader("Underground Crimson", (ChromaShader)(object)new DrippingShader(new Color(0.05f, 0f, 0f), new Color(255, 0, 0)), CommonConditions.UndergroundBiome.Crimson, (ShaderLayer)2);
806 RegisterShader("Underground Hallow", (ChromaShader)(object)new UndergroundHallowShader(), CommonConditions.UndergroundBiome.Hallow, (ShaderLayer)2);
807 RegisterShader("Meteorite", (ChromaShader)(object)new MeteoriteShader(), CommonConditions.MiscBiome.Meteorite, (ShaderLayer)3);
808 RegisterShader("Temple", (ChromaShader)(object)new TempleShader(), CommonConditions.UndergroundBiome.Temple, (ShaderLayer)3);
809 RegisterShader("Dungeon", (ChromaShader)(object)new DungeonShader(), CommonConditions.UndergroundBiome.Dungeon, (ShaderLayer)3);
810 RegisterShader("Granite", (ChromaShader)(object)new CavernShader(new Color(14, 19, 46), new Color(5, 0, 30), 0.5f), CommonConditions.UndergroundBiome.Granite, (ShaderLayer)3);
811 RegisterShader("Marble", (ChromaShader)(object)new CavernShader(new Color(100, 100, 100), new Color(20, 20, 20), 0.5f), CommonConditions.UndergroundBiome.Marble, (ShaderLayer)3);
812 RegisterShader("Gem Cave", (ChromaShader)(object)new GemCaveShader(color, new Color(25, 25, 25), new Vector4[7]
813 {
814 Color.White.ToVector4(),
815 Color.Yellow.ToVector4(),
816 Color.Orange.ToVector4(),
817 Color.Red.ToVector4(),
818 Color.Green.ToVector4(),
819 Color.Blue.ToVector4(),
820 Color.Purple.ToVector4()
821 })
822 {
823 CycleTime = 100f,
824 ColorRarity = 20f,
825 TimeRate = 0.25f
827 Vector4[] array = new Vector4[12];
828 for (int i = 0; i < array.Length; i++)
829 {
830 array[i] = Main.hslToRgb((float)i / (float)array.Length, 1f, 0.5f).ToVector4();
831 }
832 RegisterShader("Shimmer", (ChromaShader)(object)new GemCaveShader(Color.Silver * 0.5f, new Color(125, 55, 125), array)
833 {
834 CycleTime = 2f,
835 ColorRarity = 4f,
836 TimeRate = 0.5f
838 RegisterShader("Underground Jungle", (ChromaShader)(object)new JungleShader(), CommonConditions.UndergroundBiome.Jungle, (ShaderLayer)2);
839 RegisterShader("Underground Ice", (ChromaShader)(object)new IceShader(new Color(0, 10, 50), new Color(0.5f, 0.75f, 1f)), CommonConditions.UndergroundBiome.Ice, (ShaderLayer)2);
840 RegisterShader("Corrupt Ice", (ChromaShader)(object)new IceShader(new Color(5, 0, 25), new Color(152, 102, 255)), CommonConditions.UndergroundBiome.CorruptIce, (ShaderLayer)3);
841 RegisterShader("Crimson Ice", (ChromaShader)(object)new IceShader(new Color(0.1f, 0f, 0f), new Color(1f, 0.45f, 0.4f)), CommonConditions.UndergroundBiome.CrimsonIce, (ShaderLayer)3);
842 RegisterShader("Hallow Ice", (ChromaShader)(object)new IceShader(new Color(0.2f, 0f, 0.1f), new Color(1f, 0.7f, 0.7f)), CommonConditions.UndergroundBiome.HallowIce, (ShaderLayer)3);
843 RegisterShader("Underground Desert", (ChromaShader)(object)new DesertShader(new Color(60, 10, 0), new Color(255, 165, 0)), CommonConditions.UndergroundBiome.Desert, (ShaderLayer)2);
844 RegisterShader("Corrupt Desert", (ChromaShader)(object)new DesertShader(new Color(15, 0, 15), new Color(116, 103, 255)), CommonConditions.UndergroundBiome.CorruptDesert, (ShaderLayer)3);
845 RegisterShader("Crimson Desert", (ChromaShader)(object)new DesertShader(new Color(20, 10, 0), new Color(195, 0, 0)), CommonConditions.UndergroundBiome.CrimsonDesert, (ShaderLayer)3);
846 RegisterShader("Hallow Desert", (ChromaShader)(object)new DesertShader(new Color(29, 0, 56), new Color(255, 221, 255)), CommonConditions.UndergroundBiome.HallowDesert, (ShaderLayer)3);
847 RegisterShader("Pumpkin Moon", (ChromaShader)(object)new MoonShader(new Color(13, 0, 26), Color.Orange), CommonConditions.Events.PumpkinMoon, (ShaderLayer)4);
848 RegisterShader("Blood Moon", (ChromaShader)(object)new MoonShader(new Color(10, 0, 0), Color.Red, Color.Red, new Color(255, 150, 125)), CommonConditions.Events.BloodMoon, (ShaderLayer)4);
849 RegisterShader("Frost Moon", (ChromaShader)(object)new MoonShader(new Color(0, 4, 13), new Color(255, 255, 255)), CommonConditions.Events.FrostMoon, (ShaderLayer)4);
850 RegisterShader("Solar Eclipse", (ChromaShader)(object)new MoonShader(new Color(0.02f, 0.02f, 0.02f), Color.Orange, Color.Black), CommonConditions.Events.SolarEclipse, (ShaderLayer)4);
851 RegisterShader("Pirate Invasion", (ChromaShader)(object)new PirateInvasionShader(new Color(173, 173, 173), new Color(101, 101, 255), Color.Blue, Color.Black), CommonConditions.Events.PirateInvasion, (ShaderLayer)4);
852 RegisterShader("DD2 Event", (ChromaShader)(object)new DD2Shader(new Color(222, 94, 245), Color.White), CommonConditions.Events.DD2Event, (ShaderLayer)4);
853 RegisterShader("Goblin Army", (ChromaShader)(object)new GoblinArmyShader(new Color(14, 0, 79), new Color(176, 0, 144)), CommonConditions.Events.GoblinArmy, (ShaderLayer)4);
854 RegisterShader("Frost Legion", (ChromaShader)(object)new FrostLegionShader(Color.White, new Color(27, 80, 201)), CommonConditions.Events.FrostLegion, (ShaderLayer)4);
855 RegisterShader("Martian Madness", (ChromaShader)(object)new MartianMadnessShader(new Color(64, 64, 64), new Color(64, 113, 122), new Color(255, 255, 0), new Color(3, 3, 18)), CommonConditions.Events.MartianMadness, (ShaderLayer)4);
856 RegisterShader("Solar Pillar", (ChromaShader)(object)new PillarShader(Color.Red, Color.Orange), CommonConditions.Events.SolarPillar, (ShaderLayer)4);
857 RegisterShader("Nebula Pillar", (ChromaShader)(object)new PillarShader(new Color(255, 144, 209), new Color(100, 0, 76)), CommonConditions.Events.NebulaPillar, (ShaderLayer)4);
858 RegisterShader("Vortex Pillar", (ChromaShader)(object)new PillarShader(Color.Green, Color.Black), CommonConditions.Events.VortexPillar, (ShaderLayer)4);
859 RegisterShader("Stardust Pillar", (ChromaShader)(object)new PillarShader(new Color(46, 63, 255), Color.White), CommonConditions.Events.StardustPillar, (ShaderLayer)4);
860 RegisterShader("Eater of Worlds", (ChromaShader)(object)new WormShader(new Color(14, 0, 15), new Color(47, 51, 59), new Color(20, 25, 11)), CommonConditions.Boss.EaterOfWorlds, (ShaderLayer)5);
861 RegisterShader("Eye of Cthulhu", (ChromaShader)(object)new EyeOfCthulhuShader(new Color(145, 145, 126), new Color(138, 0, 0), new Color(3, 3, 18)), CommonConditions.Boss.EyeOfCthulhu, (ShaderLayer)5);
862 RegisterShader("Skeletron", (ChromaShader)(object)new SkullShader(new Color(110, 92, 47), new Color(36, 32, 51), new Color(0, 0, 0)), CommonConditions.Boss.Skeletron, (ShaderLayer)5);
863 RegisterShader("Brain Of Cthulhu", (ChromaShader)(object)new BrainShader(new Color(54, 0, 0), new Color(186, 137, 139)), CommonConditions.Boss.BrainOfCthulhu, (ShaderLayer)5);
864 RegisterShader("Empress of Light", (ChromaShader)(object)new EmpressShader(), CommonConditions.Boss.Empress, (ShaderLayer)5);
865 RegisterShader("Queen Slime", (ChromaShader)(object)new QueenSlimeShader(new Color(72, 41, 130), new Color(126, 220, 255)), CommonConditions.Boss.QueenSlime, (ShaderLayer)5);
866 RegisterShader("King Slime", (ChromaShader)(object)new KingSlimeShader(new Color(41, 70, 130), Color.White), CommonConditions.Boss.KingSlime, (ShaderLayer)5);
867 RegisterShader("Queen Bee", (ChromaShader)(object)new QueenBeeShader(new Color(5, 5, 0), new Color(255, 235, 0)), CommonConditions.Boss.QueenBee, (ShaderLayer)5);
868 RegisterShader("Wall of Flesh", (ChromaShader)(object)new WallOfFleshShader(new Color(112, 48, 60), new Color(5, 0, 0)), CommonConditions.Boss.WallOfFlesh, (ShaderLayer)5);
869 RegisterShader("Destroyer", (ChromaShader)(object)new WormShader(new Color(25, 25, 25), new Color(192, 0, 0), new Color(10, 0, 0)), CommonConditions.Boss.Destroyer, (ShaderLayer)5);
870 RegisterShader("Skeletron Prime", (ChromaShader)(object)new SkullShader(new Color(110, 92, 47), new Color(79, 0, 0), new Color(255, 29, 0)), CommonConditions.Boss.SkeletronPrime, (ShaderLayer)5);
871 RegisterShader("The Twins", (ChromaShader)(object)new TwinsShader(new Color(145, 145, 126), new Color(138, 0, 0), new Color(138, 0, 0), new Color(20, 20, 20), new Color(65, 140, 0), new Color(3, 3, 18)), CommonConditions.Boss.TheTwins, (ShaderLayer)5);
872 RegisterShader("Duke Fishron", (ChromaShader)(object)new DukeFishronShader(new Color(0, 0, 122), new Color(100, 254, 194)), CommonConditions.Boss.DukeFishron, (ShaderLayer)5);
873 RegisterShader("Deerclops", (ChromaShader)(object)new BlizzardShader(new Vector4(1f, 1f, 1f, 1f), new Vector4(0.15f, 0.1f, 0.4f, 1f), -0.1f, 0.4f), CommonConditions.Boss.Deerclops, (ShaderLayer)5);
874 RegisterShader("Plantera", (ChromaShader)(object)new PlanteraShader(new Color(255, 0, 220), new Color(0, 255, 0), new Color(12, 4, 0)), CommonConditions.Boss.Plantera, (ShaderLayer)5);
875 RegisterShader("Golem", (ChromaShader)(object)new GolemShader(new Color(255, 144, 0), new Color(255, 198, 0), new Color(10, 10, 0)), CommonConditions.Boss.Golem, (ShaderLayer)5);
876 RegisterShader("Cultist", (ChromaShader)(object)new CultistShader(), CommonConditions.Boss.Cultist, (ShaderLayer)5);
877 RegisterShader("Moon Lord", (ChromaShader)(object)new EyeballShader(isSpawning: false), CommonConditions.Boss.MoonLord, (ShaderLayer)5);
878 RegisterShader("Rain", (ChromaShader)(object)new RainShader(), CommonConditions.Weather.Rain, (ShaderLayer)6);
879 RegisterShader("Snowstorm", (ChromaShader)(object)new BlizzardShader(new Vector4(1f, 1f, 1f, 1f), new Vector4(0.1f, 0.1f, 0.3f, 1f), 0.35f, -0.35f), CommonConditions.Weather.Blizzard, (ShaderLayer)6);
880 RegisterShader("Sandstorm", (ChromaShader)(object)new SandstormShader(), CommonConditions.Weather.Sandstorm, (ShaderLayer)6);
881 RegisterShader("Slime Rain", (ChromaShader)(object)new SlimeRainShader(), CommonConditions.Weather.SlimeRain, (ShaderLayer)6);
882 RegisterShader("Drowning", (ChromaShader)(object)new DrowningShader(), CommonConditions.Alert.Drowning, (ShaderLayer)7);
883 RegisterShader("Keybinds", (ChromaShader)(object)new KeybindsMenuShader(), CommonConditions.Alert.Keybinds, (ShaderLayer)7);
884 RegisterShader("Lava Indicator", (ChromaShader)(object)new LavaIndicatorShader(Color.Black, Color.Red, new Color(255, 188, 0)), CommonConditions.Alert.LavaIndicator, (ShaderLayer)7);
885 RegisterShader("Moon Lord Spawn", (ChromaShader)(object)new EyeballShader(isSpawning: true), CommonConditions.Alert.MoonlordComing, (ShaderLayer)7);
886 RegisterShader("Low Life", (ChromaShader)(object)new LowLifeShader(), CommonConditions.CriticalAlert.LowLife, (ShaderLayer)8);
887 RegisterShader("Death", (ChromaShader)(object)new DeathShader(new Color(36, 0, 10), new Color(158, 28, 53)), CommonConditions.CriticalAlert.Death, (ShaderLayer)8);
888 }
889
890 private static void RegisterShader(string name, ChromaShader shader, ChromaCondition condition, ShaderLayer layer)
891 {
892 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
893 _engine.RegisterShader(shader, condition, layer);
894 }
895
896 [Conditional("DEBUG")]
897 private static void AddDebugDraw()
898 {
899 //IL_000a: Unknown result type (might be due to invalid IL or missing references)
900 new BasicDebugDrawer(Main.instance.GraphicsDevice);
901 Filters.Scene.OnPostDraw += delegate
902 {
903 };
904 }
905}
static bool IsWindows
Definition Platform.cs:19
void RegisterShader(ChromaShader shader, ChromaCondition condition, ShaderLayer layer)
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
void Add(TKey key, TValue value)
static readonly ChromaCondition LavaIndicator
static readonly ChromaCondition MoonlordComing
static readonly ChromaCondition DukeFishron
static readonly ChromaCondition BrainOfCthulhu
static readonly ChromaCondition WallOfFlesh
static readonly ChromaCondition EaterOfWorlds
static readonly ChromaCondition SkeletronPrime
static readonly ChromaCondition EyeOfCthulhu
static readonly ChromaCondition InMenu
static readonly ChromaCondition DrunkMenu
static PlayerInputProfile CurrentProfile
static Dictionary< string, EventLocalization > _localizedEvents
static void LoadSpecialRulesFor_SecondaryDevice(List< Bind_Event > eventsToBind, string eventName, string contextFrameKey, AbstractIlluminationDevice_Zone zone)
static void Configuration_OnSave(Preferences preferences)
static VendorColorProfile _corsairColorProfile
static void LoadSpecialRulesFor_GameSense_Keyboard(List< Bind_Event > eventsToBind)
static IntRgbGameValueTracker Event_BreathPercent
static VendorColorProfile _logitechColorProfile
static void OnProcessExit(object sender, EventArgs e)
static void BindTo(Preferences preferences)
static IntRgbGameValueTracker Event_LifePercent
static void AddGameplayEvents(List< Bind_Event > eventsToBind)
static void RegisterShader(string name, ChromaShader shader, ChromaCondition condition, ShaderLayer layer)
static IntRgbGameValueTracker Event_ManaPercent
static VendorColorProfile _steelSeriesColorProfile
static void Configuration_OnLoad(Preferences obj)
static VendorColorProfile _razerColorProfile
static Main instance
Definition Main.cs:283
static ChromaEngine Chroma
Definition Main.cs:285
static Microsoft.Xna.Framework.Color hslToRgb(Vector3 hslVector)
Definition Main.cs:44913
static bool gameMenu
Definition Main.cs:1926
static Player LocalPlayer
Definition Main.cs:2829