-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSeasonSettings.cs
2173 lines (1830 loc) · 86 KB
/
SeasonSettings.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 BepInEx;
using HarmonyLib;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Linq;
using UnityEngine;
using static Seasons.Seasons;
using ServerSync;
namespace Seasons
{
[Serializable]
public class SeasonSettingsFile
{
public int daysInSeason;
public int nightLength;
public bool torchAsFiresource;
public float torchDurabilityDrain;
public float plantsGrowthMultiplier;
public float beehiveProductionMultiplier;
public float foodDrainMultiplier;
public float staminaDrainMultiplier;
public float fireplaceDrainMultiplier;
public float sapCollectingSpeedMultiplier;
public bool rainProtection;
public float woodFromTreesMultiplier;
public float windIntensityMultiplier;
public float restedBuffDurationMultiplier;
public float livestockProcreationMultiplier;
public bool overheatIn2WarmClothes;
public float meatFromAnimalsMultiplier;
public float treesRegrowthChance;
public SeasonSettingsFile(SeasonSettings settings)
{
daysInSeason = settings.m_daysInSeason;
nightLength = settings.m_nightLength;
torchAsFiresource = settings.m_torchAsFiresource;
torchDurabilityDrain = settings.m_torchDurabilityDrain;
plantsGrowthMultiplier = settings.m_plantsGrowthMultiplier;
beehiveProductionMultiplier = settings.m_beehiveProductionMultiplier;
foodDrainMultiplier = settings.m_foodDrainMultiplier;
staminaDrainMultiplier = settings.m_staminaDrainMultiplier;
fireplaceDrainMultiplier = settings.m_fireplaceDrainMultiplier;
sapCollectingSpeedMultiplier = settings.m_sapCollectingSpeedMultiplier;
rainProtection = settings.m_rainProtection;
woodFromTreesMultiplier = settings.m_woodFromTreesMultiplier;
windIntensityMultiplier = settings.m_windIntensityMultiplier;
restedBuffDurationMultiplier = settings.m_restedBuffDurationMultiplier;
livestockProcreationMultiplier = settings.m_livestockProcreationMultiplier;
overheatIn2WarmClothes = settings.m_overheatIn2WarmClothes;
meatFromAnimalsMultiplier = settings.m_meatFromAnimalsMultiplier;
treesRegrowthChance = settings.m_treesRegrowthChance;
}
public SeasonSettingsFile()
{
}
}
[Serializable]
public class SeasonBiomeEnvironment
{
public class EnvironmentAdd
{
public string m_name;
public EnvEntry m_environment;
public EnvironmentAdd(string name, EnvEntry environment)
{
m_name = name;
m_environment = environment;
}
}
[Serializable]
public class EnvironmentRemove
{
public string m_name;
public string m_environment;
public EnvironmentRemove(string name, string environment)
{
m_name = name;
m_environment = environment;
}
}
[Serializable]
public class EnvironmentReplace
{
public string m_environment;
public string replace_to;
public EnvironmentReplace(string environment, string replaceTo)
{
m_environment = environment;
replace_to = replaceTo;
}
}
[Serializable]
public class EnvironmentReplacePair
{
public string m_environment;
public string replace_to;
}
public List<EnvironmentAdd> add = new List<EnvironmentAdd>();
public List<EnvironmentRemove> remove = new List<EnvironmentRemove>();
public List<EnvironmentReplace> replace = new List<EnvironmentReplace>();
}
[Serializable]
public class SeasonEnvironment
{
public string m_cloneFrom = "";
public string m_name = "";
public bool m_default;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Include)]
public bool m_isWet;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Include)]
public bool m_isFreezing;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Include)]
public bool m_isFreezingAtNight;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Include)]
public bool m_isCold;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Include)]
public bool m_isColdAtNight;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Include)]
public bool m_alwaysDark;
public string m_ambColorNight;
public string m_ambColorDay;
public string m_fogColorNight;
public string m_fogColorMorning;
public string m_fogColorDay;
public string m_fogColorEvening;
public string m_fogColorSunNight;
public string m_fogColorSunMorning;
public string m_fogColorSunDay;
public string m_fogColorSunEvening;
public float m_fogDensityNight;
public float m_fogDensityMorning;
public float m_fogDensityDay;
public float m_fogDensityEvening;
public string m_sunColorNight;
public string m_sunColorMorning;
public string m_sunColorDay;
public string m_sunColorEvening;
public float m_lightIntensityDay;
public float m_lightIntensityNight;
public float m_sunAngle;
public float m_windMin;
public float m_windMax;
public string m_envObject;
public string m_psystems;
public bool m_psystemsOutsideOnly;
public float m_rainCloudAlpha;
public string m_ambientLoop;
public float m_ambientVol;
public string m_ambientList;
public string m_musicMorning;
public string m_musicEvening;
public string m_musicDay;
public string m_musicNight;
public SeasonEnvironment()
{
}
public SeasonEnvironment(EnvSetup env)
{
foreach (FieldInfo property in env.GetType().GetFields())
{
FieldInfo field = GetType().GetField(property.Name);
if (field == null)
continue;
switch (property.Name)
{
case "m_envObject":
{
if (env.m_envObject != null)
m_envObject = env.m_envObject.name;
continue;
}
case "m_psystems":
{
if (env.m_psystems != null)
m_psystems = env.m_psystems.Select(ps => ps.name).Join(null, ",");
continue;
}
case "m_ambientLoop":
{
if (env.m_ambientLoop != null)
m_ambientLoop = env.m_ambientLoop.name;
continue;
}
}
field.SetValue(this, property.FieldType == typeof(Color) ? $"#{ColorUtility.ToHtmlStringRGBA((Color)property.GetValue(env))}" : property.GetValue(env));
}
}
public EnvSetup ToEnvSetup()
{
EnvSetup original = EnvMan.instance.m_environments.Find(e => e.m_name == m_cloneFrom) ?? EnvMan.instance.m_environments[0];
SeasonEnvironment defaultSettings = new SeasonEnvironment();
EnvSetup env = original.Clone();
foreach (FieldInfo property in env.GetType().GetFields())
{
FieldInfo field = GetType().GetField(property.Name);
if (field == null)
continue;
if ((field.GetValue(this) == null) || (field.FieldType != typeof(bool) && field.GetValue(this).Equals(field.GetValue(defaultSettings))))
continue;
switch (property.Name)
{
case "m_envObject":
{
env.m_envObject = usedObjects.GetValueSafe(m_envObject);
continue;
}
case "m_psystems":
{
env.m_psystems = m_psystems.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Where(ps => usedObjects.ContainsKey(ps)).Select(ps => usedObjects.GetValueSafe(ps)).ToArray();
continue;
}
case "m_ambientLoop":
{
env.m_ambientLoop = usedAudioClips.GetValueSafe(m_ambientLoop) ?? CustomMusic.audioClips.GetValueSafe(m_ambientLoop);
continue;
}
}
property.SetValue(env, property.FieldType == typeof(Color) && ColorUtility.TryParseHtmlString(field.GetValue(this).ToString(), out Color color) ? color : field.GetValue(this));
}
return env;
}
public static List<SeasonEnvironment> GetDefaultCustomEnvironments()
{
return new List<SeasonEnvironment>()
{
new SeasonEnvironment
{
m_name = "Clear Winter",
m_cloneFrom = "Clear",
m_isCold = true,
m_isColdAtNight = true
},
new SeasonEnvironment
{
m_name = "Clear Summer",
m_cloneFrom = "Clear",
m_isCold = false,
m_isColdAtNight = false
},
new SeasonEnvironment
{
m_name = "Misty Winter",
m_cloneFrom = "Misty",
m_isCold = true,
m_isColdAtNight = true
},
new SeasonEnvironment
{
m_name = "Misty Summer",
m_cloneFrom = "Misty",
m_isCold = false,
m_isColdAtNight = false
},
new SeasonEnvironment
{
m_name = "DeepForest Mist Winter",
m_cloneFrom = "DeepForest Mist",
m_isCold = true,
m_isColdAtNight = true
},
new SeasonEnvironment
{
m_name = "DeepForest Mist Summer",
m_cloneFrom = "DeepForest Mist",
m_isCold = false,
m_isColdAtNight = false
},
new SeasonEnvironment
{
m_name = "Rain Winter",
m_cloneFrom = "Rain",
m_isWet = true,
m_isFreezingAtNight = true,
m_isCold = true,
m_isColdAtNight = true,
m_alwaysDark = true,
m_psystems = "SnowStorm",
m_ambientLoop = "Wind_BlowingLoop3",
},
new SeasonEnvironment
{
m_name = "LightRain Winter",
m_cloneFrom = "LightRain",
m_isWet = true,
m_isCold = true,
m_isColdAtNight = true,
m_alwaysDark = true,
m_psystems = "GroundMist,Snow,FogClouds",
m_ambientLoop = "Wind_ColdLoop3",
},
new SeasonEnvironment
{
m_name = "ThunderStorm Winter",
m_cloneFrom = "ThunderStorm",
m_isWet = true,
m_isCold = true,
m_isFreezing = true,
m_isFreezingAtNight = true,
m_isColdAtNight = true,
m_alwaysDark = true,
m_psystems = "SnowStorm",
m_ambientLoop = "Wind_BlowingLoop3",
},
new SeasonEnvironment
{
m_name = "ThunderStorm Fall",
m_cloneFrom = "ThunderStorm",
m_isWet = true,
m_isCold = true,
m_isColdAtNight = true,
m_alwaysDark = true,
},
new SeasonEnvironment
{
m_name = "SwampRain Winter",
m_cloneFrom = "SwampRain",
m_isWet = true,
m_isCold = true,
m_isColdAtNight = true,
m_alwaysDark = true,
m_psystems = "Snow,GroundMist",
m_ambientLoop = "Wind_ColdLoop3",
},
new SeasonEnvironment
{
m_name = "SwampRain Fall",
m_cloneFrom = "SwampRain",
m_isWet = true,
m_isCold = true,
m_isColdAtNight = true,
m_alwaysDark = false,
},
new SeasonEnvironment
{
m_name = "Mistlands_clear Winter",
m_cloneFrom = "Mistlands_clear",
m_isCold = true,
m_isColdAtNight = true,
},
new SeasonEnvironment
{
m_name = "Mistlands_clear Summer",
m_cloneFrom = "Mistlands_clear",
m_isCold = false,
m_isColdAtNight = false,
},
new SeasonEnvironment
{
m_name = "Mistlands_rain Winter",
m_cloneFrom = "Mistlands_rain",
m_isWet = true,
m_isCold = true,
m_isColdAtNight = true,
m_isFreezingAtNight = true,
m_alwaysDark = true,
m_psystems = "Snow,GroundMist",
m_ambientLoop = "Wind_ColdLoop3",
},
new SeasonEnvironment
{
m_name = "Mistlands_thunder Winter",
m_cloneFrom = "Mistlands_thunder",
m_isWet = true,
m_isCold = true,
m_isColdAtNight = true,
m_isFreezing = true,
m_isFreezingAtNight = true,
m_alwaysDark = true,
m_psystems = "SnowStorm,MistlandsThunder",
m_ambientLoop = "Wind_BlowingLoop3",
},
new SeasonEnvironment
{
m_name = "Darklands_dark Winter",
m_cloneFrom = "Darklands_dark",
m_isCold = true,
m_isColdAtNight = true,
m_isFreezingAtNight = true,
m_alwaysDark = false,
m_psystems = "Snow,Darklands,GroundMist",
m_ambientLoop = "Wind_ColdLoop3",
},
new SeasonEnvironment
{
m_name = "Heath clear Winter",
m_cloneFrom = "Heath clear",
m_isCold = true,
m_isColdAtNight = true
},
new SeasonEnvironment
{
m_name = "Heath clear Summer",
m_cloneFrom = "Heath clear",
m_isColdAtNight = false
},
new SeasonEnvironment
{
m_name = "Swamp Summer",
m_cloneFrom = "Darklands_dark",
m_isCold = false,
m_isColdAtNight = false,
m_alwaysDark = true,
m_psystems = "LightRain,GroundMist",
m_ambientLoop = "SW008_Wendland_Autumn_Wind_In_Reeds_Medium_Distance_Leaves_Only",
},
new SeasonEnvironment
{
m_name = "SwampRain Summer",
m_cloneFrom = "SwampRain",
m_isWet = false,
m_isColdAtNight = false,
m_alwaysDark = true,
m_psystems = "GroundMist",
m_ambientLoop = "SW008_Wendland_Autumn_Wind_In_Reeds_Medium_Distance_Leaves_Only",
}
};
}
public static Dictionary<string, GameObject> usedObjects
{
get
{
if (_usedObjects.Count > 0 || EnvMan.instance == null)
return _usedObjects;
foreach (EnvSetup env in EnvMan.instance.m_environments)
{
if (env.m_envObject != null && !_usedObjects.ContainsKey(env.m_envObject.name))
_usedObjects.Add(env.m_envObject.name, env.m_envObject);
env.m_psystems?.Where(ps => !_usedObjects.ContainsKey(ps.name)).Do(ps => _usedObjects.Add(ps.name, ps));
}
return _usedObjects;
}
}
private static readonly Dictionary<string, GameObject> _usedObjects = new Dictionary<string, GameObject>();
public static Dictionary<string, AudioClip> usedAudioClips
{
get
{
if (_usedAudioClips.Count > 0 || EnvMan.instance == null)
return _usedAudioClips;
foreach (EnvSetup env in EnvMan.instance.m_environments)
if (env.m_ambientLoop != null && !_usedAudioClips.ContainsKey(env.m_ambientLoop.name))
_usedAudioClips.Add(env.m_ambientLoop.name, env.m_ambientLoop);
return _usedAudioClips;
}
}
private static readonly Dictionary<string, AudioClip> _usedAudioClips = new Dictionary<string, AudioClip>();
public static void ClearCachedObjects()
{
_usedObjects.Clear();
_usedAudioClips.Clear();
}
}
[Serializable]
public class SeasonBiomeEnvironments
{
public SeasonBiomeEnvironment Spring = new SeasonBiomeEnvironment();
public SeasonBiomeEnvironment Summer = new SeasonBiomeEnvironment();
public SeasonBiomeEnvironment Fall = new SeasonBiomeEnvironment();
public SeasonBiomeEnvironment Winter = new SeasonBiomeEnvironment();
public SeasonBiomeEnvironments(bool loadDefaults = false)
{
if (!loadDefaults)
return;
Summer.replace.Add(new SeasonBiomeEnvironment.EnvironmentReplace("Clear", "Clear Summer"));
Summer.replace.Add(new SeasonBiomeEnvironment.EnvironmentReplace("Misty", "Misty Summer"));
Summer.replace.Add(new SeasonBiomeEnvironment.EnvironmentReplace("DeepForest Mist", "DeepForest Mist Summer"));
Summer.replace.Add(new SeasonBiomeEnvironment.EnvironmentReplace("Mistlands_clear", "Mistlands_clear Summer"));
Summer.replace.Add(new SeasonBiomeEnvironment.EnvironmentReplace("Heath clear", "Heath clear Summer"));
Summer.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Meadows", new EnvEntry { m_environment = "Heath clear", m_weight = 2.0f }));
Summer.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Black forest", new EnvEntry { m_environment = "LightRain", m_weight = 0.1f }));
Summer.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Black forest", new EnvEntry { m_environment = "Clear", m_weight = 0.2f }));
Summer.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Swamp", new EnvEntry { m_environment = "SwampRain Summer", m_weight = 0.1f }));
Summer.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Swamp", new EnvEntry { m_environment = "Swamp Summer", m_weight = 0.1f }));
Summer.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Mountain", new EnvEntry { m_environment = "Twilight_Clear", m_weight = 1.0f }));
Summer.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Mountain", new EnvEntry { m_environment = "Twilight_Snow", m_weight = 1.0f }));
Summer.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Plains", new EnvEntry { m_environment = "ThunderStorm", m_weight = 0.1f }));
Summer.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Ocean", new EnvEntry { m_environment = "Heath clear", m_weight = 1.0f }));
Summer.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Mistlands", new EnvEntry { m_environment = "Heath clear", m_weight = 0.5f }));
Fall.replace.Add(new SeasonBiomeEnvironment.EnvironmentReplace("ThunderStorm", "ThunderStorm Fall"));
Fall.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Meadows", new EnvEntry { m_environment = "DeepForest Mist", m_weight = 0.2f }));
Fall.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Meadows", new EnvEntry { m_environment = "SwampRain Fall", m_weight = 0.2f }));
Fall.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Black forest", new EnvEntry { m_environment = "LightRain", m_weight = 0.1f }));
Fall.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Black forest", new EnvEntry { m_environment = "SwampRain Fall", m_weight = 0.1f }));
Fall.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Swamp", new EnvEntry { m_environment = "ThunderStorm", m_weight = 0.1f }));
Fall.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Mountain", new EnvEntry { m_environment = "Twilight_SnowStorm", m_weight = 0.5f }));
Fall.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Plains", new EnvEntry { m_environment = "Rain", m_weight = 0.4f }));
Fall.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Plains", new EnvEntry { m_environment = "ThunderStorm", m_weight = 0.2f }));
Fall.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Plains", new EnvEntry { m_environment = "SwampRain Fall", m_weight = 0.1f }));
Fall.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Ocean", new EnvEntry { m_environment = "SwampRain Fall", m_weight = 0.1f }));
Fall.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Ocean", new EnvEntry { m_environment = "DeepForest Mist", m_weight = 0.1f }));
Fall.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Mistlands", new EnvEntry { m_environment = "SwampRain Fall", m_weight = 0.1f }));
Fall.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Mistlands", new EnvEntry { m_environment = "DeepForest Mist", m_weight = 0.1f }));
Winter.replace.Add(new SeasonBiomeEnvironment.EnvironmentReplace("Rain", "Rain Winter"));
Winter.replace.Add(new SeasonBiomeEnvironment.EnvironmentReplace("LightRain", "LightRain Winter"));
Winter.replace.Add(new SeasonBiomeEnvironment.EnvironmentReplace("ThunderStorm", "ThunderStorm Winter"));
Winter.replace.Add(new SeasonBiomeEnvironment.EnvironmentReplace("Clear", "Clear Winter"));
Winter.replace.Add(new SeasonBiomeEnvironment.EnvironmentReplace("Misty", "Misty Winter"));
Winter.replace.Add(new SeasonBiomeEnvironment.EnvironmentReplace("DeepForest Mist", "DeepForest Mist Winter"));
Winter.replace.Add(new SeasonBiomeEnvironment.EnvironmentReplace("SwampRain", "SwampRain Winter"));
Winter.replace.Add(new SeasonBiomeEnvironment.EnvironmentReplace("Mistlands_clear", "Mistlands_clear Winter"));
Winter.replace.Add(new SeasonBiomeEnvironment.EnvironmentReplace("Mistlands_rain", "Mistlands_rain Winter"));
Winter.replace.Add(new SeasonBiomeEnvironment.EnvironmentReplace("Mistlands_thunder", "Mistlands_thunder Winter"));
Winter.replace.Add(new SeasonBiomeEnvironment.EnvironmentReplace("Heath clear", "Heath clear Winter"));
Winter.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Mountain", new EnvEntry { m_environment = "Twilight_SnowStorm", m_weight = 1.0f }));
Winter.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Plains", new EnvEntry { m_environment = "Snow", m_weight = 0.5f }));
Winter.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Ocean", new EnvEntry { m_environment = "Darklands_dark Winter", m_weight = 0.1f }));
Winter.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Mistlands", new EnvEntry { m_environment = "Twilight_Snow", m_weight = 0.1f }));
Winter.add.Add(new SeasonBiomeEnvironment.EnvironmentAdd("Mistlands", new EnvEntry { m_environment = "Twilight_SnowStorm", m_weight = 0.1f }));
}
public SeasonBiomeEnvironment GetSeasonBiomeEnvironment(Season season)
{
return season switch
{
Season.Spring => Spring,
Season.Summer => Summer,
Season.Fall => Fall,
Season.Winter => Winter,
_ => new SeasonBiomeEnvironment(),
};
}
}
[Serializable]
public class SeasonRandomEvents
{
[Serializable]
public class SeasonRandomEvent
{
public string m_name;
public string m_biomes;
public int m_weight;
public SeasonRandomEvent()
{
}
public SeasonRandomEvent(RandomEvent randomEvent)
{
m_name = randomEvent.m_name;
m_weight = 1;
m_biomes = randomEvent.m_biome.ToString();
}
public Heightmap.Biome GetBiome()
{
return (Heightmap.Biome)Enum.Parse(typeof(Heightmap.Biome), m_biomes);
}
}
public List<SeasonRandomEvent> Spring = new List<SeasonRandomEvent>();
public List<SeasonRandomEvent> Summer = new List<SeasonRandomEvent>();
public List<SeasonRandomEvent> Fall = new List<SeasonRandomEvent>();
public List<SeasonRandomEvent> Winter = new List<SeasonRandomEvent>();
public SeasonRandomEvents(bool loadDefaults = false)
{
if (!loadDefaults)
return;
Spring.Add(new SeasonRandomEvent()
{
m_name = "foresttrolls",
m_weight = 2
});
Spring.Add(new SeasonRandomEvent()
{
m_name = "bats",
m_weight = 0
});
Spring.Add(new SeasonRandomEvent()
{
m_name = "army_eikthyr",
m_weight = 2
});
Spring.Add(new SeasonRandomEvent()
{
m_name = "army_theelder",
m_weight = 2
});
Summer.Add(new SeasonRandomEvent()
{
m_name = "bats",
m_weight = 2
});
Summer.Add(new SeasonRandomEvent()
{
m_name = "surtlings",
m_weight = 2
});
Summer.Add(new SeasonRandomEvent()
{
m_name = "wolves",
m_weight = 0
});
Summer.Add(new SeasonRandomEvent()
{
m_name = "army_goblin",
m_weight = 2
});
Fall.Add(new SeasonRandomEvent()
{
m_name = "skeletons",
m_weight = 2
});
Fall.Add(new SeasonRandomEvent()
{
m_name = "blobs",
m_weight = 2
});
Fall.Add(new SeasonRandomEvent()
{
m_name = "army_bonemass",
m_weight = 2
});
Winter.Add(new SeasonRandomEvent()
{
m_name = "wolves",
m_biomes = "Meadows, Swamp, Mountain, BlackForest, Plains, DeepNorth",
m_weight = 2
});
Winter.Add(new SeasonRandomEvent()
{
m_name = "army_moder",
m_weight = 2
});
Winter.Add(new SeasonRandomEvent()
{
m_name = "skeletons",
m_weight = 0
});
Winter.Add(new SeasonRandomEvent()
{
m_name = "foresttrolls",
m_weight = 0
});
Winter.Add(new SeasonRandomEvent()
{
m_name = "surtlings",
m_weight = 0
});
Winter.Add(new SeasonRandomEvent()
{
m_name = "blobs",
m_weight = 0
});
}
public List<SeasonRandomEvent> GetSeasonEvents(Season season)
{
return season switch
{
Season.Spring => Spring,
Season.Summer => Summer,
Season.Fall => Fall,
Season.Winter => Winter,
_ => new List<SeasonRandomEvent>(),
};
}
}
[Serializable]
public class SeasonLightings
{
[Serializable]
public class LightingSettings
{
public float luminanceMultiplier = 1.0f;
public float fogDensityMultiplier = 1.0f;
}
[Serializable]
public class SeasonLightingSettings
{
public LightingSettings indoors = new LightingSettings();
public LightingSettings morning = new LightingSettings();
public LightingSettings day = new LightingSettings();
public LightingSettings evening = new LightingSettings();
public LightingSettings night = new LightingSettings();
public float lightIntensityDayMultiplier = 1.0f;
public float lightIntensityNightMultiplier = 1.0f;
}
public SeasonLightingSettings Spring = new SeasonLightingSettings();
public SeasonLightingSettings Summer = new SeasonLightingSettings();
public SeasonLightingSettings Fall = new SeasonLightingSettings();
public SeasonLightingSettings Winter = new SeasonLightingSettings();
public SeasonLightings(bool loadDefaults = false)
{
if (!loadDefaults)
return;
Summer.indoors.fogDensityMultiplier = 0.9f;
Summer.morning.luminanceMultiplier = 1.1f;
Summer.morning.fogDensityMultiplier = 0.9f;
Summer.evening.luminanceMultiplier = 1.1f;
Summer.evening.fogDensityMultiplier = 0.9f;
Summer.night.luminanceMultiplier = 1.1f;
Summer.night.fogDensityMultiplier = 0.9f;
Summer.lightIntensityNightMultiplier = 0.9f;
Fall.morning.luminanceMultiplier = 0.95f;
Fall.morning.fogDensityMultiplier = 1.1f;
Fall.evening.luminanceMultiplier = 0.95f;
Fall.evening.fogDensityMultiplier = 1.1f;
Fall.night.luminanceMultiplier = 0.9f;
Fall.night.fogDensityMultiplier = 1.3f;
Fall.lightIntensityNightMultiplier = 1.2f;
Winter.indoors.luminanceMultiplier = 0.9f;
Winter.indoors.fogDensityMultiplier = 1.1f;
Winter.morning.luminanceMultiplier = 0.9f;
Winter.morning.fogDensityMultiplier = 1.2f;
Winter.evening.luminanceMultiplier = 0.9f;
Winter.evening.fogDensityMultiplier = 1.2f;
Winter.night.luminanceMultiplier = 0.8f;
Winter.night.fogDensityMultiplier = 1.7f;
Winter.lightIntensityNightMultiplier = 1.5f;
}
public SeasonLightingSettings GetSeasonLighting(Season season)
{
return season switch
{
Season.Spring => Spring,
Season.Summer => Summer,
Season.Fall => Fall,
Season.Winter => Winter,
_ => new SeasonLightingSettings(),
};
}
}
[Serializable]
public class SeasonStats
{
[Serializable]
public class Stats
{
[Header("__SE_Stats__")]
[Header("HP per tick")]
public float m_tickInterval;
public float m_healthPerTickMinHealthPercentage;
public float m_healthPerTick;
public string m_healthHitType = "";
[Header("Stamina")]
public float m_staminaDrainPerSec;
public float m_runStaminaDrainModifier;
public float m_jumpStaminaUseModifier;
[Header("Regen modifiers")]
public float m_healthRegenMultiplier = 1f;
public float m_staminaRegenMultiplier = 1f;
public float m_eitrRegenMultiplier = 1f;
[Header("Skills modifiers")]
public Dictionary<string, float> m_raiseSkills = new Dictionary<string, float>();
public Dictionary<string, float> m_skillLevels = new Dictionary<string, float>();
public Dictionary<string, float> m_modifyAttackSkills = new Dictionary<string, float>();
[Header("Hit modifier")]
public Dictionary<string, string> m_damageModifiers = new Dictionary<string, string>();
[Header("Sneak")]
public float m_noiseModifier;
public float m_stealthModifier;
[Header("Carry weight")]
public float m_addMaxCarryWeight;
[Header("Speed")]
public float m_speedModifier;
[Header("Fall")]
public float m_maxMaxFallSpeed;
public float m_fallDamageModifier;
public void SetStatusEffectStats(SE_Season statusEffect)
{
foreach (FieldInfo property in GetType().GetFields())
{
FieldInfo field = statusEffect.GetType().GetField(property.Name);
if (field == null)
continue;
field.SetValue(statusEffect, property.GetValue(this));
}
statusEffect.m_mods.Clear();
foreach (KeyValuePair<string, string> damageMod in m_damageModifiers)
if (Enum.TryParse(damageMod.Key, out HitData.DamageType m_type) && Enum.TryParse(damageMod.Value, out HitData.DamageModifier m_modifier))
statusEffect.m_mods.Add(new HitData.DamageModPair() { m_type = m_type, m_modifier = m_modifier });
statusEffect.m_hitType = HitData.HitType.Undefined;
if (Enum.TryParse(m_healthHitType, out HitData.HitType hitType))
statusEffect.m_hitType = hitType;
statusEffect.m_customRaiseSkills.Clear();
foreach (KeyValuePair<string, float> skillPair in m_raiseSkills)
if (ParseSkill(skillPair.Key, out Skills.SkillType skill))
statusEffect.m_customRaiseSkills.Add(skill, skillPair.Value);
statusEffect.m_customSkillLevels.Clear();
foreach (KeyValuePair<string, float> skillPair in m_skillLevels)
if (ParseSkill(skillPair.Key, out Skills.SkillType skill))
statusEffect.m_customSkillLevels.Add(skill, skillPair.Value);
statusEffect.m_customModifyAttackSkills.Clear();
foreach (KeyValuePair<string, float> skillPair in m_modifyAttackSkills)
if (ParseSkill(skillPair.Key, out Skills.SkillType skill))
statusEffect.m_customModifyAttackSkills.Add(skill, skillPair.Value);
}
public bool ParseSkill(string skillName, out Skills.SkillType skill)
{
if (Enum.TryParse(skillName, out skill))
return true;
Skills.SkillType fromSkillManager = (Skills.SkillType)Math.Abs(skillName.GetStableHashCode());
if (Player.m_localPlayer.m_skills.m_skills.Any(skl => skl.m_skill == fromSkillManager))
{
skill = fromSkillManager;
return true;
}
return false;
}
}
public Stats Spring = new Stats();
public Stats Summer = new Stats();
public Stats Fall = new Stats();
public Stats Winter = new Stats();
public SeasonStats(bool loadDefaults = false)
{
if (!loadDefaults)
return;
Spring.m_tickInterval = 5f;
Spring.m_healthPerTick = 1f;
Spring.m_damageModifiers.Add(HitData.DamageType.Poison.ToString(), HitData.DamageModifier.Resistant.ToString());
Spring.m_raiseSkills.Add(Skills.SkillType.Jump.ToString(), 1.2f);
Spring.m_raiseSkills.Add(Skills.SkillType.Sneak.ToString(), 1.2f);
Spring.m_raiseSkills.Add(Skills.SkillType.Run.ToString(), 1.2f);
Spring.m_raiseSkills.Add(Skills.SkillType.Swim.ToString(), 1.2f);
Spring.m_skillLevels.Add(Skills.SkillType.Jump.ToString(), 15f);
Spring.m_skillLevels.Add(Skills.SkillType.Sneak.ToString(), 15f);
Spring.m_skillLevels.Add(Skills.SkillType.Run.ToString(), 15f);
Spring.m_skillLevels.Add(Skills.SkillType.Swim.ToString(), 15f);
Summer.m_runStaminaDrainModifier = -0.1f;
Summer.m_jumpStaminaUseModifier = -0.1f;
Summer.m_healthRegenMultiplier = 1.1f;
Summer.m_noiseModifier = -0.2f;
Summer.m_stealthModifier = 0.2f;
Summer.m_speedModifier = 0.05f;
Summer.m_raiseSkills.Add(Skills.SkillType.Jump.ToString(), 1.1f);
Summer.m_raiseSkills.Add(Skills.SkillType.Sneak.ToString(), 1.1f);
Summer.m_raiseSkills.Add(Skills.SkillType.Run.ToString(), 1.1f);
Summer.m_raiseSkills.Add(Skills.SkillType.Swim.ToString(), 1.1f);
Summer.m_skillLevels.Add(Skills.SkillType.Jump.ToString(), 10f);
Summer.m_skillLevels.Add(Skills.SkillType.Sneak.ToString(), 10f);
Summer.m_skillLevels.Add(Skills.SkillType.Run.ToString(), 10f);
Summer.m_skillLevels.Add(Skills.SkillType.Swim.ToString(), 10f);
Fall.m_eitrRegenMultiplier = 1.1f;
Fall.m_raiseSkills.Add(Skills.SkillType.WoodCutting.ToString(), 1.2f);
Fall.m_raiseSkills.Add(Skills.SkillType.Fishing.ToString(), 1.2f);