forked from xoxfaby/BetterUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigManager.cs
More file actions
684 lines (550 loc) · 39.6 KB
/
Copy pathConfigManager.cs
File metadata and controls
684 lines (550 loc) · 39.6 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
using BepInEx;
using BepInEx.Configuration;
using System;
using UnityEngine;
using System.Collections.Generic;
using System.Linq;
using RoR2;
namespace BetterUI
{
internal static class ConfigManager
{
// Files
public static ConfigFile ConfigFileComponents;
public static ConfigFile ConfigFileMisc;
public static ConfigFile ConfigFileAdvancedIcons;
public static ConfigFile ConfigFileBuffs;
public static ConfigFile ConfigFileCommandImprovements;
public static ConfigFile ConfigFileDPSMeter;
public static ConfigFile ConfigFileItemCounters;
public static ConfigFile ConfigFileStatsDisplay;
public static ConfigFile ConfigFileSorting;
// Components
public static ConfigEntry<bool> ComponentsAdvancedIcons;
public static ConfigEntry<bool> ComponentsBuffTimers;
public static ConfigEntry<bool> ComponentsCommandImprovements;
public static ConfigEntry<bool> ComponentsDPSMeter;
public static ConfigEntry<bool> ComponentsItemCounters;
public static ConfigEntry<bool> ComponentsItemSorting;
public static ConfigEntry<bool> ComponentsMisc;
public static ConfigEntry<bool> ComponentsStatsDisplay;
// Misc
public static ConfigEntry<bool> MiscShowHidden;
public static ConfigEntry<bool> MiscAdvancedPickupNotificationsItems;
public static ConfigEntry<bool> MiscAdvancedPickupNotificationsEquipements;
public static ConfigEntry<bool> MiscHidePickupNotificiationsItems;
public static ConfigEntry<bool> MiscHidePickupNotificiationsEquipements;
public static ConfigEntry<bool> MiscHidePickupNotificiationsArtifacts;
public static ConfigEntry<bool> MiscShowPickupDescription;
public static ConfigEntry<bool> MiscPickupDescriptionAdvanced;
// AdvancedIcons
public static ConfigEntry<bool> AdvancedIconsItemAdvancedDescriptions;
public static ConfigEntry<bool> AdvancedIconsItemItemStatsIntegration;
public static ConfigEntry<bool> AdvancedIconsEquipementShowCooldownStacks;
public static ConfigEntry<bool> AdvancedIconsEquipementAdvancedDescriptions;
public static ConfigEntry<bool> AdvancedIconsEquipementShowBaseCooldown;
public static ConfigEntry<bool> AdvancedIconsEquipementShowCalculatedCooldown;
public static ConfigEntry<bool> AdvancedIconsSkillShowCooldownStacks;
public static ConfigEntry<bool> AdvancedIconsSkillShowBaseCooldown;
public static ConfigEntry<bool> AdvancedIconsSkillShowCalculatedCooldown;
public static ConfigEntry<bool> AdvancedIconsSkillShowProcCoefficient;
public static ConfigEntry<bool> AdvancedIconsSkillCalculateSkillProcEffects;
// Buffs
public static ConfigEntry<bool> BuffTimers;
public static ConfigEntry<bool> BuffTimersDecimal;
public static ConfigEntry<bool> BuffTooltips;
public static ConfigEntry<String> BuffTimersPosition;
public static TMPro.TextAlignmentOptions BuffTimersTextAlignmentOption;
public static ConfigEntry<float> BuffTimersFontSize;
// CommandImprovements
public static ConfigEntry<bool> CommandResizeCommandWindow;
public static ConfigEntry<bool> CommandRemoveBackgroundBlur;
public static ConfigEntry<bool> CommandCloseOnEscape;
public static ConfigEntry<bool> CommandCloseOnWASD;
public static ConfigEntry<String> CommandCloseOnCustom;
public static ConfigEntry<bool> CommandTooltipsShow;
public static ConfigEntry<bool> CommandTooltipsItemStatsBeforeAfter;
public static ConfigEntry<bool> CommandCountersShow;
public static ConfigEntry<bool> CommandCountersHideOnZero;
public static ConfigEntry<String> CommandCountersPosition;
public static TMPro.TextAlignmentOptions CommandCountersTextAlignmentOption;
public static ConfigEntry<float> CommandCountersFontSize;
public static ConfigEntry<String> CommandCountersPrefix;
// DPSMeter
public static ConfigEntry<float> DPSMeterTimespan;
public static ConfigEntry<bool> DPSMeterWindowShow;
public static ConfigEntry<bool> DPSMeterWindowIncludeMinions;
public static ConfigEntry<bool> DPSMeterWindowBackground;
public static ConfigEntry<bool> DPSMeterWindowHideWhenTyping;
public static ConfigEntry<Vector2> DPSMeterWindowAnchorMin;
public static ConfigEntry<Vector2> DPSMeterWindowAnchorMax;
public static ConfigEntry<Vector2> DPSMeterWindowPosition;
public static ConfigEntry<Vector2> DPSMeterWindowPivot;
public static ConfigEntry<Vector2> DPSMeterWindowSize;
public static ConfigEntry<Vector3> DPSMeterWindowAngle;
// ItemCounters
public static ConfigEntry<bool> ItemCountersShowItemCounters;
public static ConfigEntry<bool> ItemCountersShowItemScore;
public static ConfigEntry<bool> ItemCountersItemScoreFromTier;
public static ConfigEntry<bool> ItemCountersShowItemSum;
public static ConfigEntry<string> ItemCountersItemSumTiersString;
public static List<ItemTier> ItemCountersItemSumTiers;
public static ConfigEntry<bool> ItemCountersShowItemsByTier;
public static ConfigEntry<string> ItemCountersItemsByTierOrderString;
public static List<ItemTier> ItemCountersItemsByTierOrder;
public static ConfigEntry<float> ItemCountersTierScoreTier1;
public static ConfigEntry<float> ItemCountersTierScoreTier2;
public static ConfigEntry<float> ItemCountersTierScoreTier3;
public static ConfigEntry<float> ItemCountersTierScoreLunar;
public static ConfigEntry<float> ItemCountersTierScoreBoss;
public static ConfigEntry<float> ItemCountersTierScoreNoTier;
public static Dictionary<ItemTier, float> ItemCountersTierScores;
public static Dictionary<ItemDef, float> ItemCountersItemScores;
public static Dictionary<string, float> ItemCountersItemScoreDefaults;
// StatsDisplay
public static ConfigEntry<bool> StatsDisplayEnable;
public static ConfigEntry<String> StatsDisplayStatString;
public static ConfigEntry<String> StatsDisplayStatStringCustomBind;
public static ConfigEntry<String> StatsDisplayCustomBind;
public static ConfigEntry<bool> StatsDisplayShowCustomBindOnly;
public static ConfigEntry<bool> StatsDisplayToggleOnBind;
public static ConfigEntry<bool> StatsDisplayPanelBackground;
public static ConfigEntry<bool> StatsDisplayAttachToObjectivePanel;
public static ConfigEntry<Vector2> StatsDisplayWindowAnchorMin;
public static ConfigEntry<Vector2> StatsDisplayWindowAnchorMax;
public static ConfigEntry<Vector2> StatsDisplayWindowPosition;
public static ConfigEntry<Vector2> StatsDisplayWindowPivot;
public static ConfigEntry<Vector2> StatsDisplayWindowSize;
public static ConfigEntry<Vector3> StatsDisplayWindowAngle;
// Sorting
public static ConfigEntry<bool> SortingSortItemsInventory;
public static ConfigEntry<bool> SortingSortItemsCommand;
public static ConfigEntry<bool> SortingSortItemsScrapper;
public static ConfigEntry<String> SortingTierOrderString;
public static int[] SortingTierOrder;
public static ConfigEntry<String> SortingSortOrder;
public static ConfigEntry<String> SortingSortOrderCommand;
public static ConfigEntry<String> SortingSortOrderScrapper;
// Internal
/*
* NOTE:
* When renaming a config entry within the same config file, place both the new Section + Key
* and the old Section + Key in the dictionary below.
*
* By creating a rename mapping, we're able to
* 1) transfer the old entry's value to the new entry's value.
* 2) remove the old entry from the config file.
*
* This let's us update config files without users' configs suddenly changing.
*/
static IReadOnlyDictionary<(string, string), (string, string)> previousEntryMap = new Dictionary<(string, string), (string, string)>()
{
// Current config section & key pairs. Previous config section & key pairs.
{ ("Components", "AdvancedIcons"), ("Components", "AdvanedIcons") },
{ ("Misc", "AdvancedPickupNotificationsEquipment"), ("Misc", "AdvancedPickupNotificationsEquipements") },
{ ("Misc", "HidePickupNotificationsItems"), ("Misc", "HidePickupNotificiationsItems") },
{ ("Misc", "HidePickupNotificationsEquipment"), ("Misc", "HidePickupNotificiationsEquipements") },
{ ("Misc", "HidePickupNotificationsArtifacts"), ("Misc", "HidePickupNotificiationsArtifacts") },
{ ("Equipment Improvements", "ShowCooldownStacks"), ("Equipement Improvements", "ShowCooldownStacks") },
{ ("Equipment Improvements", "AdvancedDescriptions"), ("Equipement Improvements", "AdvancedDescriptions") },
{ ("Equipment Improvements", "BaseCooldown"), ("Equipement Improvements", "BaseCooldown") },
{ ("Equipment Improvements", "CalculatedCooldown"), ("Equipement Improvements", "CalculatedCooldown") },
{ ("Components", "Buffs"), ("Components", "BuffTimers") },
};
static ConfigManager()
{
ConfigFileComponents = new ConfigFile(Paths.ConfigPath + "\\BetterUI-Components.cfg", true);
ConfigFileMisc = new ConfigFile(Paths.ConfigPath + "\\BetterUI-Misc.cfg", true);
ConfigFileAdvancedIcons = new ConfigFile(Paths.ConfigPath + "\\BetterUI-AdvancedIcons.cfg", true);
ConfigFileBuffs = new ConfigFile(Paths.ConfigPath + "\\BetterUI-Buffs.cfg", true);
ConfigFileCommandImprovements = new ConfigFile(Paths.ConfigPath + "\\BetterUI-CommandImprovements.cfg", true);
ConfigFileDPSMeter = new ConfigFile(Paths.ConfigPath + "\\BetterUI-DPSMeter.cfg", true);
ConfigFileItemCounters = new ConfigFile(Paths.ConfigPath + "\\BetterUI-ItemCounters.cfg", true);
ConfigFileStatsDisplay = new ConfigFile(Paths.ConfigPath + "\\BetterUI-StatsDisplay.cfg", true);
ConfigFileSorting = new ConfigFile(Paths.ConfigPath + "\\BetterUI-Sorting.cfg", true);
// Components
ComponentsAdvancedIcons = Bind(ConfigFileComponents, "Components", "AdvancedIcons", true, "Enable/Disable the component entirely, stopping it from hooking any game functions.");
ComponentsBuffTimers = Bind(ConfigFileComponents, "Components", "Buffs", true, "Enable/Disable the component entirely, stopping it from hooking any game functions.");
ComponentsCommandImprovements = Bind(ConfigFileComponents, "Components", "CommandImprovements", true, "Enable/Disable the component entirely, stopping it from hooking any game functions.");
ComponentsDPSMeter = Bind(ConfigFileComponents, "Components", "DPSMeter", true, "Enable/Disable the component entirely, stopping it from hooking any game functions.");
ComponentsItemCounters = Bind(ConfigFileComponents, "Components", "ItemCounters", true, "Enable/Disable the component entirely, stopping it from hooking any game functions.");
ComponentsItemSorting = Bind(ConfigFileComponents, "Components", "ItemSorting", true, "Enable/Disable the component entirely, stopping it from hooking any game functions.");
ComponentsMisc = Bind(ConfigFileComponents, "Components", "Misc", true, "Enable/Disable the component entirely, stopping it from hooking any game functions.");
ComponentsStatsDisplay = Bind(ConfigFileComponents, "Components", "StatsDisplay", true, "Enable/Disable the component entirely, stopping it from hooking any game functions.");
// Misc
MiscShowHidden = Bind(ConfigFileMisc, "Misc", "ShowHidden", false, "Show hidden items in the item inventory.");
MiscAdvancedPickupNotificationsItems = Bind(ConfigFileMisc, "Misc", "AdvancedPickupNotificationsItems", false, "Show advanced descriptions when picking up an item.");
MiscAdvancedPickupNotificationsEquipements = Bind(ConfigFileMisc, "Misc", "AdvancedPickupNotificationsEquipment", false, "Show advanced descriptions when picking up equipment.");
MiscHidePickupNotificiationsItems = Bind(ConfigFileMisc, "Misc", "HidePickupNotificationsItems", false, "Hide pickup notifications for items.");
MiscHidePickupNotificiationsEquipements = Bind(ConfigFileMisc, "Misc", "HidePickupNotificationsEquipment", false, "Hide pickup notifications for equipment.");
MiscHidePickupNotificiationsArtifacts = Bind(ConfigFileMisc, "Misc", "HidePickupNotificationsArtifacts", false, "Hide pickup notifications for artifacts.");
MiscShowPickupDescription = Bind(ConfigFileMisc, "Misc", "ShowPickupDescription", true, "Show the item description on the interaction pop-up.");
MiscPickupDescriptionAdvanced = Bind(ConfigFileMisc, "Misc", "PickupDescriptionAdvanced", false, "Show advanced descriptions for the interaction pop-up.");
// Advanced Icons
AdvancedIconsItemAdvancedDescriptions = Bind(ConfigFileAdvancedIcons, "Item Improvements", "AdvancedDescriptions", true, "Show advanced descriptions when hovering over an item.");
AdvancedIconsItemItemStatsIntegration = Bind(ConfigFileAdvancedIcons, "Item Improvements", "ItemStatsIntegration", true, "Show ItemStats where applicable.");
AdvancedIconsEquipementShowCooldownStacks = Bind(ConfigFileAdvancedIcons, "Equipment Improvements", "ShowCooldownStacks", true, "Show the cooldown for your equipment when charging multiple stacks.");
AdvancedIconsEquipementAdvancedDescriptions = Bind(ConfigFileAdvancedIcons, "Equipment Improvements", "AdvancedDescriptions", true, "Show advanced descriptions when hovering over equipment.");
AdvancedIconsEquipementShowBaseCooldown = Bind(ConfigFileAdvancedIcons, "Equipment Improvements", "BaseCooldown", true, "Show the base cooldown when hovering over equipment.");
AdvancedIconsEquipementShowCalculatedCooldown = Bind(ConfigFileAdvancedIcons, "Equipment Improvements", "CalculatedCooldown", true, "Show the calculated cooldown based on your items when hovering over equipment.");
AdvancedIconsSkillShowCooldownStacks = Bind(ConfigFileAdvancedIcons, "Skill Improvements", "ShowCooldownStacks", true, "Show the cooldown for skills when charging multiple stacks.");
AdvancedIconsSkillShowBaseCooldown = Bind(ConfigFileAdvancedIcons, "Skill Improvements", "BaseCooldown", true, "Show the base cooldown when hovering over a skill.");
AdvancedIconsSkillShowCalculatedCooldown = Bind(ConfigFileAdvancedIcons, "Skill Improvements", "CalculatedCooldown", true, "Show the calculated cooldown based on your items when hovering over a skill.");
AdvancedIconsSkillShowProcCoefficient = Bind(ConfigFileAdvancedIcons, "Skill Improvements", "ShowProcCoefficient", true, "Show the proc coefficient when hovering over a skill.");
AdvancedIconsSkillCalculateSkillProcEffects = Bind(ConfigFileAdvancedIcons, "Skill Improvements", "CalculateProcEffects", true, "Show the effects of carried items, adjusted for each skill's proc coefficient.");
// Buffs
BuffTimers = Bind(ConfigFileBuffs, "Buffs", "BuffTimers", true, "Show buff timers (host only).");
BuffTimersDecimal = Bind(ConfigFileBuffs, "Buffs", "BuffTimersDecimal", true, "Show 1 decimal point when timer is below 10.");
BuffTooltips = Bind(ConfigFileBuffs, "Buffs", "BuffTooltips", true, "Show buff tooltips.");
BuffTimersPosition = Bind(ConfigFileBuffs, "Buffs", "CountersPosition", "TopRight",
"Location of buff timer text.\n" +
"Valid options:\n" +
"TopLeft\n" +
"TopRight\n" +
"BottomLeft\n" +
"BottomRight\n" +
"Center\n");
BuffTimersTextAlignmentOption = (TMPro.TextAlignmentOptions)Enum.Parse(typeof(TMPro.TextAlignmentOptions), BuffTimersPosition.Value, true);
BuffTimersFontSize = Bind(ConfigFileBuffs, "Buffs", "CountersFontSize", 23f, "Size of the buff timer text.");
// Command / Scrapper Improvements
CommandResizeCommandWindow = Bind(ConfigFileCommandImprovements, "Command / Scrapper Improvements", "ResizeCommandWindow", true, "Resize the command window depending on the number of items.");
CommandRemoveBackgroundBlur = Bind(ConfigFileCommandImprovements, "Command / Scrapper Improvements", "RemoveBackgroundBlur", true, "Remove the blur behind the command window that hides the rest of the UI.");
CommandCloseOnEscape = Bind(ConfigFileCommandImprovements, "Command / Scrapper Improvements", "CloseOnEscape", true, "Close the command/scrapper window when you press escape.");
CommandCloseOnWASD = Bind(ConfigFileCommandImprovements, "Command / Scrapper Improvements", "CloseOnWASD", true, "Close the command/scrapper window when you press W, A, S, or D.");
CommandCloseOnCustom = Bind(ConfigFileCommandImprovements, "Command / Scrapper Improvements", "CloseOnCustom", "", "Close the command/scrapper window when you press the key selected here.\n" +
"Example: space\n" +
"Must be lowercase. Leave blank to disable.");
CommandTooltipsShow = Bind(ConfigFileCommandImprovements, "Command / Scrapper Improvements", "TooltipsShow", true, "Show tooltips in the command and scrapper windows.");
CommandTooltipsItemStatsBeforeAfter = Bind(ConfigFileCommandImprovements, "Command / Scrapper Improvements", "TooltipsItemStatsBeforeAfter", true, "Show the ItemStats before and after picking up the item.");
CommandCountersShow = Bind(ConfigFileCommandImprovements, "Command / Scrapper Improvements", "CountersShow", true, "Show counters in the command and scrapper windows.");
CommandCountersHideOnZero = Bind(ConfigFileCommandImprovements, "Command / Scrapper Improvements", "CountersHideOnZero", false, "Hide counters when they are zero.");
CommandCountersPosition = Bind(ConfigFileCommandImprovements, "Command / Scrapper Improvements", "CountersPosition", "TopRight",
"Location of the command item counter.\n" +
"Valid options:\n" +
"TopLeft\n" +
"TopRight\n" +
"BottomLeft\n" +
"BottomRight\n" +
"Center\n");
CommandCountersTextAlignmentOption = (TMPro.TextAlignmentOptions)Enum.Parse(typeof(TMPro.TextAlignmentOptions), CommandCountersPosition.Value, true);
CommandCountersFontSize = Bind(ConfigFileCommandImprovements, "Command / Scrapper Improvements", "CountersFontSize", 20f, "Size of the command item counter text.");
CommandCountersPrefix = Bind(ConfigFileCommandImprovements, "Command / Scrapper Improvements", "CountersPrefix", "x", "Prefix for the command item counter. Example 'x' will show x0, x1, x2, etc.\nCan be empty.");
// DPSMeter
DPSMeterTimespan = Bind(ConfigFileDPSMeter, "DPSMeter", "Timespan", 5f, "Calculate DPS across this many seconds.");
DPSMeterWindowShow = Bind(ConfigFileDPSMeter, "DPSMeter", "WindowShow", true, "Show a dedicated DPSMeter.");
DPSMeterWindowIncludeMinions = Bind(ConfigFileDPSMeter, "DPSMeter", "WindowIncludeMinions", true, "Include minions such as turrets and drones in the DPS meter.");
DPSMeterWindowBackground = Bind(ConfigFileDPSMeter, "DPSMeter", "WindowBackground", true, "Whether or not the DPS window should have a background.");
DPSMeterWindowHideWhenTyping = Bind(ConfigFileDPSMeter, "DPSMeter", "WindowHideWhenTyping", true, "Whether or not the DPS window should be hidden when typing into the chat box.");
DPSMeterWindowAnchorMin = Bind(ConfigFileDPSMeter, "DPSMeter", "WindowAnchorMin", new Vector2(0, 0),
"Screen position the lower left window corner is anchored to.\n" +
"X & Y can be any number from 0.0 to 1.0 (inclusive).\n" +
"Screen position starts at the bottom-left (0.0, 0.0) and increases toward the top-right (1.0, 1.0).");
DPSMeterWindowAnchorMax = Bind(ConfigFileDPSMeter, "DPSMeter", "WindowAnchorMax", new Vector2(0, 0f),
"Screen position the upper right window corner is anchored to.\n" +
"X & Y can be any number from 0.0 to 1.0 (inclusive).\n" +
"Screen position starts at the bottom-left (0.0, 0.0) and increases toward the top-right (1.0, 1.0).");
DPSMeterWindowPosition = Bind(ConfigFileDPSMeter, "DPSMeter", "WindowPosition", new Vector2(120, 240), "Position of the DPSMeter window relative to the anchor.");
DPSMeterWindowPivot = Bind(ConfigFileDPSMeter, "DPSMeter", "WindowPivot", new Vector2(0, 1), "Pivot of the DPSMeter window.\n" +
"Window Position is from the anchor to the pivot.");
DPSMeterWindowSize = Bind(ConfigFileDPSMeter, "DPSMeter", "WindowSize", new Vector2(350, 45), "Size of the DPSMeter window.");
DPSMeterWindowAngle = Bind(ConfigFileDPSMeter, "DPSMeter", "WindowAngle", new Vector3(0, -6, 0), "Angle of the DPSMeter window.");
// ItemCounters
ItemCountersShowItemCounters = Bind(ConfigFileItemCounters, "ItemCounters", "ShowItemCounters", true, "Enable/Disable ItemCounters entirely.");
ItemCountersShowItemScore = Bind(ConfigFileItemCounters, "ItemCounters", "ShowItemScore", true, "Show your item score.");
ItemCountersItemScoreFromTier = Bind(ConfigFileItemCounters, "ItemCounters", "ItemScoreFromTier", true, "Whether or not the ItemScore should be based on tier. If disabled, the per-item settings will be used.");
ItemCountersShowItemSum = Bind(ConfigFileItemCounters, "ItemCounters", "ShowItemSum", true, "Show the how many items you have.");
ItemCountersItemSumTiersString = Bind(ConfigFileItemCounters, "ItemCounters", "ItemSumTiersString", "01234", "Which tiers to include in the ItemSum.\n0 = White, 1 = Green, 2 = Red, 3 = Lunar, 4 = Boss, 5 = NoTier");
ItemCountersItemSumTiers = ItemCountersItemSumTiersString.Value.ToCharArray().Select(c => (ItemTier)char.GetNumericValue(c)).ToList();
ItemCountersShowItemsByTier = Bind(ConfigFileItemCounters, "ItemCounters", "ShowItemsByTier", true, "Show how many items you have, by tier.");
ItemCountersItemsByTierOrderString = Bind(ConfigFileItemCounters, "ItemCounters", "ItemsByTierOrderString", "43210", "Which tiers to include in the ItemsByTier, in order.\n0 = White, 1 = Green, 2 = Red, 3 = Lunar, 4 = Boss, 5 = NoTier");
ItemCountersItemsByTierOrder = ItemCountersItemsByTierOrderString.Value.ToCharArray().Select(c => (ItemTier)char.GetNumericValue(c)).ToList();
ItemCountersTierScoreTier1 = Bind(ConfigFileItemCounters, "ItemCounters Tier Score", "Tier1", 1f, "Score for Tier 1 (white) and Void Tier 1 items.");
ItemCountersTierScoreTier2 = Bind(ConfigFileItemCounters, "ItemCounters Tier Score", "Tier2", 2.5f, "Score for Tier 2 (green) and Void Tier 2 items.");
ItemCountersTierScoreTier3 = Bind(ConfigFileItemCounters, "ItemCounters Tier Score", "Tier3", 10f, "Score for Tier 3 (red) and Void Tier 3 items.");
ItemCountersTierScoreLunar = Bind(ConfigFileItemCounters, "ItemCounters Tier Score", "Lunar", 0f, "Score for Lunar items.");
ItemCountersTierScoreBoss = Bind(ConfigFileItemCounters, "ItemCounters Tier Score", "Boss", 2.5f, "Score for Boss Tier (yellow) and Void Boss Tier items.");
ItemCountersTierScoreNoTier = Bind(ConfigFileItemCounters, "ItemCounters Tier Score", "NoTier", 0f, "Score for items without a tier.");
ItemCountersTierScores = new Dictionary<ItemTier, float>()
{
{ ItemTier.Tier1, ItemCountersTierScoreTier1.Value },
{ ItemTier.VoidTier1, ItemCountersTierScoreTier1.Value },
{ ItemTier.Tier2, ItemCountersTierScoreTier2.Value},
{ ItemTier.VoidTier2, ItemCountersTierScoreTier2.Value},
{ ItemTier.Tier3, ItemCountersTierScoreTier3.Value},
{ ItemTier.VoidTier3, ItemCountersTierScoreTier3.Value},
{ ItemTier.Lunar, ItemCountersTierScoreLunar.Value},
{ ItemTier.Boss, ItemCountersTierScoreBoss.Value},
{ ItemTier.VoidBoss, ItemCountersTierScoreBoss.Value},
{ ItemTier.NoTier, ItemCountersTierScoreNoTier.Value},
};
ItemCountersItemScoreDefaults = new Dictionary<string, float>()
{
// Tier 3 (including void)
{ "AlienHead", 9f },
{ "ArmorReductionOnHit", 7.5f },
{ "BarrierOnOverHeal", 7.5f },
{ "Behemoth", 10f },
{ "BounceNearby", 14f },
{ "CaptainDefenseMatrix", 0f },
{ "Clover", 15f },
{ "CloverVoid", 0f },
{ "CritDamage", 11f },
{ "Dagger", 11f },
{ "DroneWeapons", 8f },
{ "ExtraLife", 7f },
{ "ExtraLifeVoid", 7f },
{ "FallBoots", 4f },
{ "GhostOnKill", 0.5f },
{ "HeadHunter", 5f },
{ "Icicle", 9f },
{ "ImmuneToDebuff", 13f },
{ "IncreaseHealing", 13f },
{ "KillEliteFrenzy", 9f },
{ "LaserTurbine", 11f },
{ "MoreMissile", 13f },
{ "NovaOnHeal", 7f },
{ "PermanentDebuffOnHit", 7f },
{ "Plant", 8f },
{ "RandomEquipmentTrigger", 9f },
{ "ScrapRed", 2f },
{ "ShockNearby", 14f },
{ "Talisman", 11f },
{ "UtilitySkillMagazine", 11f },
// Tier 2 (including void)
{ "AttackSpeedOnCrit", 3.25f },
{ "Bandolier", 1.75f },
{ "BonusGoldPackOnKill", 1f },
{ "ChainLightning", 3.6f },
{ "ChainLightningVoid", 3.8f },
{ "DeathMark", 2.6f },
{ "ElementalRingVoid", 2.75f },
{ "EnergizedOnEquipmentUse", 2.8f },
{ "EquipmentMagazine", 3f },
{ "EquipmentMagazineVoid", 3f },
{ "ExecuteLowHealthElite", 3.25f },
{ "ExplodeOnDeath", 3.25f },
{ "ExplodeOnDeathVoid", 2.75f },
{ "Feather", 3f },
{ "FireRing", 4f },
{ "FreeChest", 1f },
{ "HealOnCrit", 3.25f },
{ "IceRing", 4f },
{ "Infusion", 2.25f },
{ "JumpBoost", 2.5f },
{ "Missile", 3f },
{ "MissileVoid", 4f },
{ "MoveSpeedOnKill", 2.75f },
{ "Phasing", 2.5f },
{ "PrimarySkillShuriken", 2.8f },
{ "RegeneratingScrap", 2f },
{ "ScrapGreen", 2f },
{ "Seed", 1.75f },
{ "SlowOnHit", 1.5f },
{ "SlowOnHitVoid", 1.85f },
{ "SprintArmor", 2.25f },
{ "SprintOutOfCombat", 2f },
{ "Squid", 1.25f },
{ "StrengthenBurn", 1.85f },
{ "TPHealingNova", 0.5f },
{ "Thorns", 3.1f },
{ "WarCryOnMultiKill", 1.75f },
// Tier 1 (including void)
{ "ArmorPlate", 1.1f },
{ "AttackSpeedAndMoveSpeed", 1.2f },
{ "BarrierOnKill", 1.2f },
{ "Bear", 1.5f },
{ "BearVoid", 1.2f },
{ "BleedOnHit", 1.1f },
{ "BleedOnHitVoid", 1.1f },
{ "BossDamageBonus", 1.1f },
{ "CritGlasses", 1.3f },
{ "CritGlassesVoid", 1.5f },
{ "Crowbar", 1f },
{ "Firework", 0.9f },
{ "FlatHealth", 0.6f },
{ "FragileDamageBonus", 2.5f },
{ "GoldOnHurt", 0.4f },
{ "HealWhileSafe", 1f },
{ "HealingPotion", 2f },
{ "Hoof", 1.3f },
{ "IgniteOnKill", 1f },
{ "Medkit", 1.2f },
{ "Mushroom", 0.9f },
{ "MushroomVoid", 1.4f },
{ "NearbyDamageBonus", 1.6f },
{ "OutOfCombatArmor", 1.1f },
{ "PersonalShield", 0.8f },
{ "ScrapWhite", 0.8f },
{ "SecondarySkillMagazine", 1.3f },
{ "SprintBonus", 1.35f },
{ "StickyBomb", 0.9f },
{ "StunChanceOnHit", 0.7f },
{ "Syringe", 1.2f },
{ "Tooth", 1f },
{ "TreasureCache", 1f },
{ "TreasureCacheVoid", 2.5f },
{ "WardOnLevel", 0.2f },
// Boss Tier (including void)
{ "ArtifactKey", 0f },
{ "BleedOnHitAndExplode", 3.5f },
{ "BeetleGland", 1.5f },
{ "FireballsOnHit", 2.25f },
{ "Knurl", 2f },
{ "LightningStrikeOnHit", 3f },
{ "MinorConstructOnKill", 1.75f },
{ "NovaOnLowHealth", 2f },
{ "ParentEgg", 2.8f },
{ "Pearl", 2f },
{ "RoboBallBuddy", 2f },
{ "ScrapYellow", 2f },
{ "ShinyPearl", 8f },
{ "SiphonOnLowHealth", 3f },
{ "SprintWisp", 1.75f },
{ "TitanGoldDuringTP", 0.5f },
{ "VoidMegaCrabItem", 1.75f },
};
ItemCountersItemScores = new Dictionary<ItemDef, float>();
// StatsDisplay
StatsDisplayEnable = Bind(ConfigFileStatsDisplay, "StatsDisplay", "Enable", true, "Enable/Disable the StatsDisplay entirely.");
StatsDisplayStatString = Bind(ConfigFileStatsDisplay, "StatsDisplay", "StatString",
"<color=#FFFFFF>" +
"<size=18><b>Stats</b></size>\n" +
"<size=14>Luck: $luck\n" +
"Base Damage: $dmg\n" +
"Crit Chance: $luckcrit%\n" +
"Attack Speed: $atkspd\n" +
"Armor: $armor | $armordmgreduction%\n" +
"Regen: $regen\n" +
"Speed: $velocity\n" +
"Jumps: $jumps/$maxjumps\n" +
"Kills: $killcount\n" +
"Mountain Shrines: $mountainshrines\n",
"You may format the StatString using formatting tags such as color, size, bold, underline, italics. See Readme for more.\n" +
"Valid Parameters:\n" +
string.Join(" ", StatsDisplay.regexmap.Keys));
StatsDisplayStatStringCustomBind = Bind(ConfigFileStatsDisplay, "StatsDisplay", "StatStringCustomBind",
"<color=#FFFFFF>" +
"<size=18><b>Stats</b></size>\n" +
"<size=14>Luck: $luck\n" +
"Experience: $exp/$maxexp\n" +
"Base Damage: $dmg\n" +
"Crit Chance: $crit%\n" +
"Crit w/ Luck: $luckcrit%\n" +
"Crit Damage: $critdamage\n" +
"Attack Speed: $atkspd\n" +
"Armor: $armor | $armordmgreduction%\n" +
"Regen: $regen\n" +
"Speed: $velocity\n" +
"Jumps: $jumps/$maxjumps\n" +
"Kills: $killcount\n" +
"Mountain Shrines: $mountainshrines\n" +
"Difficulty: $difficulty\n" +
"Blue Portal: $blueportal\n" +
"Gold Portal: $goldportal\n" +
"Celestial Portal: $celestialportal\n" +
"Void Portal: $voidportal\n",
"StatDisplay string to show when the custom bind is being pressed. This can be the same or different from the normal StatString.");
StatsDisplayCustomBind = Bind(ConfigFileStatsDisplay, "StatsDisplay", "CustomBind", "tab", "Bind to show secondary StatsDisplay string.\n" +
"Example: space\n" +
"Must be lowercase. Leave blank to disable.");
StatsDisplayShowCustomBindOnly = Bind(ConfigFileStatsDisplay, "StatsDisplay", "ShowCustomBindOnly", false, "Only show the StatsDisplay when the scoreboard is open.");
StatsDisplayToggleOnBind = Bind(ConfigFileStatsDisplay, "StatsDisplay", "ToggleOnBind", false, "Toggle the StatsDisplay when the bind is pressed rather than showing it when it is held.");
StatsDisplayPanelBackground = Bind(ConfigFileStatsDisplay, "StatsDisplay", "PanelBackground", true, "Whether or not the StatsDisplay panel should have a background.");
StatsDisplayAttachToObjectivePanel = Bind(ConfigFileStatsDisplay, "StatsDisplay", "AttachToObjectivePanel", true, "Whether to attach the stats display to the objective panel.\n" +
"If not, it will be a free-floating window that can be moved with the options below.");
StatsDisplayWindowAnchorMin = Bind(ConfigFileStatsDisplay, "StatsDisplay", "WindowAnchorMin", new Vector2(1, 0.5f),
"Screen position the lower left window corner is anchored to.\n" +
"X & Y can be any number from 0.0 to 1.0 (inclusive).\n" +
"Screen position starts at the bottom-left (0.0, 0.0) and increases toward the top-right (1.0, 1.0).");
StatsDisplayWindowAnchorMax = Bind(ConfigFileStatsDisplay, "StatsDisplay", "WindowAnchorMax", new Vector2(1, 0.5f),
"Screen position the upper right window corner is anchored to.\n" +
"X & Y can be any number from 0.0 to 1.0 (inclusive).\n" +
"Screen position starts at the bottom-left (0.0, 0.0) and increases toward the top-right (1.0, 1.0).");
StatsDisplayWindowPosition = Bind(ConfigFileStatsDisplay, "StatsDisplay", "WindowPosition", new Vector2(-210, 100), "Position of the StatsDisplay window relative to the anchor.");
StatsDisplayWindowPivot = Bind(ConfigFileStatsDisplay, "StatsDisplay", "WindowPivot", new Vector2(0, 0.5f), "Pivot of the StatsDisplay window.\n" +
"Window Position is from the anchor to the pivot.");
StatsDisplayWindowSize = Bind(ConfigFileStatsDisplay, "StatsDisplay", "WindowSize", new Vector2(200, 600), "Size of the StatsDisplay window.");
StatsDisplayWindowAngle = Bind(ConfigFileStatsDisplay, "StatsDisplay", "WindowAngle", new Vector3(0, 6, 0), "Angle of the StatsDisplay window.");
// Sorting
SortingSortItemsInventory = Bind(ConfigFileSorting, "Sorting", "SortItemsInventory", true, "Sort items in the inventory and scoreboard.");
SortingSortItemsCommand = Bind(ConfigFileSorting, "Sorting", "SortItemsCommand", true, "Sort items in the command window.");
SortingSortItemsScrapper = Bind(ConfigFileSorting, "Sorting", "SortItemsScrapper", true, "Sort items in the scrapper window.");
SortingTierOrderString = Bind(ConfigFileSorting, "Sorting", "TierOrder", "012345", "Tiers in ascending order, left to right.\n0 = White, 1 = Green, 2 = Red, 3 = Lunar, 4 = Boss, 5 = NoTier");
SortingTierOrder = new int[]
{
SortingTierOrderString.Value.IndexOf('0'),
SortingTierOrderString.Value.IndexOf('1'),
SortingTierOrderString.Value.IndexOf('2'),
SortingTierOrderString.Value.IndexOf('3'),
SortingTierOrderString.Value.IndexOf('4'),
SortingTierOrderString.Value.IndexOf('5'),
};
SortingSortOrder = Bind(ConfigFileSorting, "Sorting", "SortOrder", "S134",
"What to sort the items by, most important to least important.\n" +
"Find the full details and an example in the Readme on Thunderstore/Github.\n" +
"0 = Tier Ascending\n" +
"1 = Tier Descending\n" +
"2 = Stack Size Ascending\n" +
"3 = Stack Size Descending\n" +
"4 = Pickup Order\n" +
"5 = Pickup Order Reversed\n" +
"6 = Alphabetical\n" +
"7 = Alphabetical Reversed\n" +
"8 = Random\n" +
"i = ItemIndex\n" +
"I = ItemIndex Descending\n" +
"\n" +
"Tag Based:\n" +
"s = Scrap First\n" +
"S = Scrap Last\n" +
"d = Damage First\n" +
"D = Damage Last\n" +
"h = Healing First\n" +
"H = Healing Last\n" +
"u = Utility First\n" +
"U = Utility Last\n" +
"o = On Kill Effect First\n" +
"O = On Kill Effect Last\n" +
"e = Equipment Related First\n" +
"E = Equipment Related Last\n" +
"p = Sprint Related First\n" +
"P = Sprint Related Last");
SortingSortOrderCommand = Bind(ConfigFileSorting, "Sorting", "SortOrderCommand", "6",
"Sort order for the command window.\n" +
"The command window has a special sort option \"C\" which will place the last selected item in the middle.\n" +
"Note: This option must be the last one in the SortOrderCommand option.");
SortingSortOrderScrapper = Bind(ConfigFileSorting, "Sorting", "SortOrderScrapper", "134",
"Sort order for the scrapper window.");
}
/// <summary>
/// Automatically transfers the value of old config entries to new config entries based on
/// <see cref="previousEntryMap"/>. Old config entries are deleted after their value has
/// been transferred.<br/>
/// Wraps <see cref="ConfigFile.Bind{T}(string, string, T, string)"/>.
/// </summary>
/// <param name="config">File containing the config entry..</param>
/// <param name="section">Section/category/group of the setting. Settings are grouped by this.</param>
/// <param name="key">Name of the setting.</param>
/// <param name="defaultValue">Value of the setting if the setting was not created yet.</param>
/// <param name="description">Simple description of the setting shown to the user.</param>
/// <typeparam name="T">Type of the value contained in this setting.</typeparam>
static ConfigEntry<T> Bind<T>(ConfigFile config, string section, string key, T defaultValue, string description)
{
var currentEntry = config.Bind(section, key, defaultValue, description);
if (previousEntryMap.ContainsKey((section, key)))
{
var previousTuple = previousEntryMap[(section, key)];
var previousDefinition = new ConfigDefinition(previousTuple.Item1, previousTuple.Item2);
// ConfigFile has to Bind to a Section + Key before it knows that it's in the file.
var previousEntry = config.Bind(previousDefinition, "If you ever set your config option to this, it's your own fault", new ConfigDescription(description));
if(previousEntry.Value != "If you ever set your config option to this, it's your own fault")
{
// Let ConfigBaseEntry deal with type parsing.
currentEntry.SetSerializedValue(previousEntry.GetSerializedValue());
}
config.Remove(previousDefinition);
}
return currentEntry;
}
}
}