@@ -13,44 +13,55 @@ namespace TrackerCouncil.Smz3.Data.Configuration;
1313/// </summary>
1414public class Configs
1515{
16+ private ConfigProvider _configProvider ;
17+ private RandomizerOptions _randomizerOptions ;
18+ private ILogger < Configs > _logger ;
19+
1620 /// <summary>
1721 /// Constructor
1822 /// </summary>
1923 /// <param name="optionsFactory">The tracker options for determining the selected tracker profiles</param>
2024 /// <param name="provider">The config provider for loading configs</param>
2125 /// <param name="logger"></param>
22- public Configs ( OptionsFactory optionsFactory , Smz3 . Data . Configuration . ConfigProvider provider , ILogger < Configs > logger )
26+ public Configs ( OptionsFactory optionsFactory , ConfigProvider provider , ILogger < Configs > logger )
27+ {
28+ _configProvider = provider ;
29+ _randomizerOptions = optionsFactory . Create ( ) ;
30+ _logger = logger ;
31+ LoadConfigs ( ) ;
32+ }
33+
34+ public void LoadConfigs ( )
2335 {
24- var options = optionsFactory . Create ( ) ;
25- var profiles = options . GeneralOptions . SelectedProfiles . NonNull ( ) . Where ( x => x != "Default" ) . ToArray ( ) ;
26- var moods = provider . GetAvailableMoods ( profiles ) ;
36+ var profiles = _randomizerOptions . GeneralOptions . SelectedProfiles . NonNull ( ) . Where ( x => x != "Default" ) . ToArray ( ) ;
37+ var moods = _configProvider . GetAvailableMoods ( profiles ) ;
2738 CurrentMood = moods . Random ( Random . Shared ) ;
28- logger . LogInformation ( "Tracker is feeling {Mood} today" , CurrentMood ) ;
29-
30- Bosses = provider . GetBossConfig ( profiles , CurrentMood ) ;
31- Dungeons = provider . GetDungeonConfig ( profiles , CurrentMood ) ;
32- Items = provider . GetItemConfig ( profiles , CurrentMood ) ;
33- Locations = provider . GetLocationConfig ( profiles , CurrentMood ) ;
34- Regions = provider . GetRegionConfig ( profiles , CurrentMood ) ;
35- Requests = provider . GetRequestConfig ( profiles , CurrentMood ) ;
36- Responses = provider . GetResponseConfig ( profiles , CurrentMood ) ;
37- Rooms = provider . GetRoomConfig ( profiles , CurrentMood ) ;
38- Rewards = provider . GetRewardConfig ( profiles , CurrentMood ) ;
39- UILayouts = provider . GetUIConfig ( profiles , CurrentMood ) ;
40- GameLines = provider . GetGameConfig ( profiles , CurrentMood ) ;
41- MsuConfig = provider . GetMsuConfig ( profiles , CurrentMood ) ;
42- HintTileConfig = provider . GetHintTileConfig ( profiles , CurrentMood ) ;
39+ _logger . LogInformation ( "Tracker is feeling {Mood} today" , CurrentMood ) ;
40+
41+ Bosses = _configProvider . GetBossConfig ( profiles , CurrentMood ) ;
42+ Dungeons = _configProvider . GetDungeonConfig ( profiles , CurrentMood ) ;
43+ Items = _configProvider . GetItemConfig ( profiles , CurrentMood ) ;
44+ Locations = _configProvider . GetLocationConfig ( profiles , CurrentMood ) ;
45+ Regions = _configProvider . GetRegionConfig ( profiles , CurrentMood ) ;
46+ Requests = _configProvider . GetRequestConfig ( profiles , CurrentMood ) ;
47+ Responses = _configProvider . GetResponseConfig ( profiles , CurrentMood ) ;
48+ Rooms = _configProvider . GetRoomConfig ( profiles , CurrentMood ) ;
49+ Rewards = _configProvider . GetRewardConfig ( profiles , CurrentMood ) ;
50+ UILayouts = _configProvider . GetUIConfig ( profiles , CurrentMood ) ;
51+ GameLines = _configProvider . GetGameConfig ( profiles , CurrentMood ) ;
52+ MsuConfig = _configProvider . GetMsuConfig ( profiles , CurrentMood ) ;
53+ HintTileConfig = _configProvider . GetHintTileConfig ( profiles , CurrentMood ) ;
4354 }
4455
4556 /// <summary>
4657 /// Gets the current mood.
4758 /// </summary>
48- public string ? CurrentMood { get ; }
59+ public string ? CurrentMood { get ; private set ; }
4960
5061 /// <summary>
5162 /// Gets a collection of trackable items.
5263 /// </summary>
53- public ItemConfig Items { get ; }
64+ public ItemConfig Items { get ; private set ; } = null ! ;
5465
5566 /// <summary>
5667 /// Gets the peg world peg configuration. This will be moved to UI
@@ -85,60 +96,60 @@ public Configs(OptionsFactory optionsFactory, Smz3.Data.Configuration.ConfigProv
8596 /// <summary>
8697 /// Gets a collection of configured responses.
8798 /// </summary>
88- public ResponseConfig Responses { get ; }
99+ public ResponseConfig Responses { get ; private set ; } = null ! ;
89100
90101 /// <summary>
91102 /// Gets a collection of basic requests and responses.
92103 /// </summary>
93- public RequestConfig Requests { get ; }
104+ public RequestConfig Requests { get ; private set ; } = null ! ;
94105
95106 /// <summary>
96107 /// Gets a collection of extra information about regions.
97108 /// </summary>
98- public RegionConfig Regions { get ; }
109+ public RegionConfig Regions { get ; private set ; } = null ! ;
99110
100111 /// <summary>
101112 /// Gets a collection of extra information about dungeons.
102113 /// </summary>
103- public DungeonConfig Dungeons { get ; }
114+ public DungeonConfig Dungeons { get ; private set ; } = null ! ;
104115
105116 /// <summary>
106117 /// Gets a collection of bosses.
107118 /// </summary>
108- public BossConfig Bosses { get ; }
119+ public BossConfig Bosses { get ; private set ; } = null ! ;
109120
110121 /// <summary>
111122 /// Gets a collection of extra information about rooms.
112123 /// </summary>
113- public RoomConfig Rooms { get ; }
124+ public RoomConfig Rooms { get ; private set ; } = null ! ;
114125
115126 /// <summary>
116127 /// Gets a collection of extra information about locations.
117128 /// </summary>
118- public LocationConfig Locations { get ; }
129+ public LocationConfig Locations { get ; private set ; } = null ! ;
119130
120131 /// <summary>
121132 /// Gets a collection of extra information about rewards
122133 /// </summary>
123- public RewardConfig Rewards { get ; }
134+ public RewardConfig Rewards { get ; private set ; } = null ! ;
124135
125136 /// <summary>
126137 /// Gets a collection of available UI layouts
127138 /// </summary>
128- public UIConfig UILayouts { get ; }
139+ public UIConfig UILayouts { get ; private set ; } = null ! ;
129140
130141 /// <summary>
131142 /// Gets the in game lines
132143 /// </summary>
133- public GameLinesConfig GameLines { get ; }
144+ public GameLinesConfig GameLines { get ; private set ; } = null ! ;
134145
135146 /// <summary>
136147 /// Gets the msu config
137148 /// </summary>
138- public MsuConfig MsuConfig { get ; }
149+ public MsuConfig MsuConfig { get ; private set ; } = null ! ;
139150
140151 /// <summary>
141152 /// Gets the hint tile config
142153 /// </summary>
143- public HintTileConfig HintTileConfig { get ; }
154+ public HintTileConfig HintTileConfig { get ; private set ; } = null ! ;
144155}
0 commit comments