11using Helldivers . Core . Contracts . Collections ;
22using Helldivers . Core . Mapping ;
33using Helldivers . Core . Mapping . V2 ;
4+ using Helldivers . Models . V1 ;
45using Helldivers . Models . V2 ;
6+ using Dispatch = Helldivers . Models . V2 . Dispatch ;
57
68namespace Helldivers . Core . Facades ;
79
@@ -10,13 +12,20 @@ namespace Helldivers.Core.Facades;
1012/// </summary>
1113public sealed class V2Facade (
1214 IStore < Dispatch , int > dispatchStore ,
13- DispatchMapper dispatchMapper
15+ DispatchMapper dispatchMapper ,
16+ IStore < Planet , int > planetStore ,
17+ IStore < SpaceStation , long > spaceStationStore ,
18+ SpaceStationMapper spaceStationMapper
1419)
1520{
1621 /// <see cref="IStore{T,TKey}.SetStore" />
1722 public async ValueTask UpdateStores ( MappingContext context )
1823 {
1924 await UpdateDispatchStore ( context ) ;
25+
26+ // Some mappers need access to the list of planets, so we fetch it from the freshly-mapped store.
27+ var planets = await planetStore . AllAsync ( ) ;
28+ await UpdateSpaceStationStore ( context , planets ) ;
2029 }
2130
2231 private async ValueTask UpdateDispatchStore ( MappingContext context )
@@ -28,4 +37,13 @@ private async ValueTask UpdateDispatchStore(MappingContext context)
2837
2938 await dispatchStore . SetStore ( dispatches ) ;
3039 }
40+
41+ private async ValueTask UpdateSpaceStationStore ( MappingContext context , List < Planet > planets )
42+ {
43+ var spaceStations = spaceStationMapper
44+ . MapToV2 ( context , planets )
45+ . ToList ( ) ;
46+
47+ await spaceStationStore . SetStore ( spaceStations ) ;
48+ }
3149}
0 commit comments