Seeding reorg
This commit is contained in:
@@ -2,12 +2,14 @@ using System.Text.Json;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SVSim.Database.Enums;
|
||||
using SVSim.Database.Models;
|
||||
using SVSim.Database.Models.Config;
|
||||
using PreReleaseInfoEntity = SVSim.Database.Models.PreReleaseInfo;
|
||||
using PreReleaseInfoDto = SVSim.EmulatedEntrypoint.Models.Dtos.PreReleaseInfo;
|
||||
using SVSim.Database.Repositories.Card;
|
||||
using SVSim.Database.Repositories.Collectibles;
|
||||
using SVSim.Database.Repositories.Globals;
|
||||
using SVSim.Database.Repositories.Viewer;
|
||||
using SVSim.Database.Services;
|
||||
using SVSim.EmulatedEntrypoint.Constants;
|
||||
using SVSim.EmulatedEntrypoint.Infrastructure;
|
||||
using SVSim.EmulatedEntrypoint.Models.Dtos;
|
||||
@@ -43,16 +45,18 @@ public class LoadController : SVSimController
|
||||
private readonly ICollectionRepository _collectionRepository;
|
||||
private readonly IGlobalsRepository _globalsRepository;
|
||||
private readonly ICardAcquisitionService _acquisition;
|
||||
private readonly IGameConfigService _config;
|
||||
|
||||
public LoadController(IViewerRepository viewerRepository, ICardRepository cardRepository,
|
||||
ICollectionRepository collectionRepository, IGlobalsRepository globalsRepository,
|
||||
ICardAcquisitionService acquisition)
|
||||
ICardAcquisitionService acquisition, IGameConfigService config)
|
||||
{
|
||||
_viewerRepository = viewerRepository;
|
||||
_cardRepository = cardRepository;
|
||||
_collectionRepository = collectionRepository;
|
||||
_globalsRepository = globalsRepository;
|
||||
_acquisition = acquisition;
|
||||
_config = config;
|
||||
}
|
||||
|
||||
[HttpPost("index")]
|
||||
@@ -141,10 +145,12 @@ public class LoadController : SVSimController
|
||||
prevNecessaryExp = entry.NecessaryExp;
|
||||
}
|
||||
|
||||
// Globals — one cached fetch per slice. GameConfiguration carries six time-varying scalars
|
||||
// (ts_rotation_id, is_battle_pass_period, etc.) added in the prod-capture migration; the
|
||||
// other repo methods come from SVSim.Bootstrap.GlobalsImporter seeding.
|
||||
GameConfiguration cfg = await _globalsRepository.GetGameConfiguration("default");
|
||||
// Globals — one cached fetch per slice. The Rotation/Challenge/DefaultLoadout sections
|
||||
// come via IGameConfigService (DB → appsettings → ShippedDefaults). Other repo methods
|
||||
// come from SVSim.Bootstrap.GlobalsImporter seeding.
|
||||
var rotation = _config.Get<RotationConfig>();
|
||||
var challenge = _config.Get<ChallengeConfig>();
|
||||
var defaultLoadout = _config.Get<DefaultLoadoutConfig>();
|
||||
|
||||
List<CardSetIdentifier> rotationSets = (await _globalsRepository.GetRotationCardSets())
|
||||
.OrderBy(s => s.Id)
|
||||
@@ -187,7 +193,7 @@ public class LoadController : SVSimController
|
||||
MyPageBackgrounds = viewer.MyPageBackgrounds.Select(mpbg => mpbg.Id.ToString()).ToList(),
|
||||
LootBoxRegulations = new LootBoxRegulations(),
|
||||
GatheringInfo = new GatheringInfo(),
|
||||
IsBattlePassPeriod = cfg.Config.Rotation.IsBattlePassPeriod,
|
||||
IsBattlePassPeriod = rotation.IsBattlePassPeriod,
|
||||
// Optional per spec (load-index.md:228). We have BattlePassLevelEntry rows seeded, but
|
||||
// no per-viewer Battle Pass progression yet — emit null until that subsystem lands.
|
||||
BattlePassLevelInfo = null,
|
||||
@@ -230,19 +236,19 @@ public class LoadController : SVSimController
|
||||
}).ToList(),
|
||||
ArenaConfig = new ArenaConfig
|
||||
{
|
||||
UseChallengePickTwoPremiumCard = cfg.Config.Challenge.UseTwoPickPremiumCard ? 1 : 0,
|
||||
ChallengePickTwoCardSleeve = (int)cfg.Config.Challenge.TwoPickSleeveId,
|
||||
UseChallengePickTwoPremiumCard = challenge.UseTwoPickPremiumCard ? 1 : 0,
|
||||
ChallengePickTwoCardSleeve = (int)challenge.TwoPickSleeveId,
|
||||
},
|
||||
ArenaInfos = await BuildArenaInfosAsync(),
|
||||
RotationSets = rotationSets,
|
||||
UserConfig = new UserConfig(),
|
||||
OpenBattlefieldIds = (await _globalsRepository.GetBattlefields(true))
|
||||
.Select(bf => bf.Id.ToString()).ToList(),
|
||||
DefaultSettings = new DefaultSettings(cfg),
|
||||
DefaultSettings = new DefaultSettings(defaultLoadout),
|
||||
ClassExp = classExps,
|
||||
RankInfo = (await _globalsRepository.GetRankInfo()).Select(ri => new RankInfo(ri)).ToList(),
|
||||
DeckFormat = Format.Rotation,
|
||||
CardSetIdForResourceDlView = cfg.Config.Rotation.CardSetIdForResourceDlView,
|
||||
CardSetIdForResourceDlView = rotation.CardSetIdForResourceDlView,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -314,12 +320,21 @@ public class LoadController : SVSimController
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Schedules are not yet stored per-rotation in the DB; prod's shape (free_battle / gathering
|
||||
/// DateRange) is global. Hardcoded to a default-initialized SpecialRotationSchedule until we
|
||||
/// capture meaningful values — the client's MyRotationAllInfo.Parse audit will tell us where
|
||||
/// these come from.
|
||||
/// Maps the <c>MyRotationSchedule</c> config section to the wire-shape <c>SpecialRotationSchedule</c>.
|
||||
/// The client gates the Custom Rotation format-selector button on <c>FreeBattle</c>'s window
|
||||
/// being currently open (Wizard/MyRotationAllInfo.cs:45), so a default-initialised
|
||||
/// <c>DateTime.MinValue</c> pair here hides the button. Config defaults reproduce the
|
||||
/// 2026-05-23 prod capture; GlobalsImporter overwrites from newer captures.
|
||||
/// </summary>
|
||||
private static SpecialRotationSchedule BuildMyRotationSchedules() => new();
|
||||
private SpecialRotationSchedule BuildMyRotationSchedules()
|
||||
{
|
||||
var cfg = _config.Get<MyRotationScheduleConfig>();
|
||||
return new SpecialRotationSchedule
|
||||
{
|
||||
Gathering = new DateRange { BeginTime = cfg.Gathering.Begin, EndTime = cfg.Gathering.End },
|
||||
FreeBattle = new DateRange { BeginTime = cfg.FreeBattle.Begin, EndTime = cfg.FreeBattle.End },
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds <c>avatar_info</c> from AvatarAbilityEntry rows. Schedules is an empty list per the
|
||||
|
||||
Reference in New Issue
Block a user