Files
sor/Server/src/SOR.Content/Handlers/ContentDtoMapper.cs
T
c105120dc6 Feature: card unit SFX + genus multi-select + CardEditor UX fixes
- CardDefinition: add MoveSoundUrl, DamagedSoundUrl, BlockedSoundUrl,
  AttackSoundUrl, DeathSoundUrl columns (nullable text)
- Migration 20260317100000_AddCardUnitSounds: 5 new columns on card_definitions
- CardDefinitionDto + ContentDtoMapper: expose 5 SFX fields to client
- CardEditor:
  - Genus: replace plain text input with DB-backed checkbox multi-select
    (loads distinct tags from all cards; add new tags inline)
  - Channel range (Min/Max): now ArchSpirit-only (removed from Spirit)
  - CanUseAbility / RequiresLos: default true for display & new cards
  - Assets tab: Unit Sound Effects section (5 CDN URL inputs)
  - model-viewer script injected lazily so 3D preview renders

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-03-17 09:36:18 -04:00

73 lines
2.7 KiB
C#

namespace SOR.Content.Handlers;
using SOR.Database.Entities.Catalog;
internal static class ContentDtoMapper
{
internal static CardDefinitionDto ToDto(CardDefinition c) => new(
Id: c.Id,
Name: c.Name,
Description: c.Description,
CardType: c.CardType.ToString(),
Affinity: c.Affinity.ToString(),
Rarity: c.Rarity.ToString(),
SpCost: c.SpCost,
StCost: c.StCost,
OtherCostsJson: c.OtherCostsJson,
MinChannelRange: c.MinChannelRange,
MaxChannelRange: c.MaxChannelRange,
AttackType: c.AttackType?.ToString(),
RequiresLos: c.RequiresLos,
MinAttackRange: c.MinAttackRange,
MaxAttackRange: c.MaxAttackRange,
CanAttack: c.CanAttack,
Damage: c.Damage,
CanDefend: c.CanDefend,
MaxHealth: c.MaxHealth,
MaxDefense: c.MaxDefense,
CanBeAttacked: c.CanBeAttacked,
CanBeBlocked: c.CanBeBlocked,
CanMove: c.CanMove,
MovementType: c.MovementType?.ToString(),
MovementPoints: c.MovementPoints,
CanBeObstructed: c.CanBeObstructed,
CanUseAbility: c.CanUseAbility,
Genus: c.Genus,
CanBeSacrificed: c.CanBeSacrificed,
Tier: c.Tier,
PreviousTierId: c.PreviousTierId,
TerramorphaMode: c.TerramorphaMode?.ToString(),
AbilitiesJson: c.AbilitiesJson,
EffectsJson: c.EffectsJson,
SetId: c.SetId,
CollectorNumber: c.CollectorNumber,
IsPublished: c.IsPublished,
IsRetired: c.IsRetired,
RetiredAt: c.RetiredAt,
UpdatedAt: c.UpdatedAt,
DefinitionVersion: c.DefinitionVersion,
ModelScale: c.ModelScale,
ModelTintColor: c.ModelTintColor,
MoveSoundUrl: c.MoveSoundUrl,
DamagedSoundUrl: c.DamagedSoundUrl,
BlockedSoundUrl: c.BlockedSoundUrl,
AttackSoundUrl: c.AttackSoundUrl,
DeathSoundUrl: c.DeathSoundUrl,
Assets: c.Assets.Select(a => new CardAssetDto(
a.Id,
a.AssetType.ToString(),
a.CdnUrl,
a.MimeType,
a.IsAiGenerated,
a.ModelFacingDirection,
a.ModelTintMaskUrl)),
AnimationBindings: c.AnimationBindings.Select(b => new CardAnimationBindingDto(
b.Id,
b.ActionName,
b.AnimationCdnUrl,
b.IsAiGenerated,
b.AnimationTrackName,
b.CastSoundCdnUrl,
b.ImpactSoundCdnUrl)));
}