Skip to content

Commit

Permalink
Merge pull request #8 from FightCore/feature/angular-16
Browse files Browse the repository at this point in the history
Feature/angular 16
bartdebever authored May 16, 2024
2 parents 8c80432 + 107345a commit 99bac6b
Showing 185 changed files with 11,553 additions and 6,072 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ jobs:

strategy:
matrix:
node-version: [16.x]
node-version: [18.x]

steps:
- uses: actions/checkout@v3
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using AutoMapper;
using FightCore.Api.DataTransferObjects.Abstract;
using FightCore.Api.DataTransferObjects.Characters;
using FightCore.Api.DataTransferObjects.Exports.Characters;
using FightCore.Api.DataTransferObjects.Exports.Full;
using FightCore.Models;

@@ -12,6 +13,7 @@ public CharacterProfile()
{
CreateMap<Character, BaseCharacter>();
CreateMap<Character, FullExportCharacter>();
CreateMap<Character, BasicExportCharacter>();
CreateMap<Character, BasicCharacter>();
CreateMap<Character, CharacterWithMoves>();

37 changes: 37 additions & 0 deletions Backend/FightCore.Api/Configuration/Profiles/SubactionProfile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using AutoMapper;
using FightCore.Api.DataTransferObjects.Subactions;
using FightCore.Api.DataTransferObjects.Subactions.Commands;
using FightCore.Models.Subactions;
using FightCore.Models.Subactions.Commands;
using MatchType = FightCore.Models.Subactions.MatchType;

namespace FightCore.Api.Configuration.Profiles
{
public class SubactionProfile : Profile
{
public SubactionProfile()
{
CreateMap<Subaction, SubactionDto>();
CreateMap<ScriptCommand, ScriptCommandDto>().IncludeAllDerived();
CreateMap<AutoCancelCommand, AutoCancelCommandDto>().IncludeBase<ScriptCommand, ScriptCommandDto>();
CreateMap<BodyStateCommand, BodyStateCommandDto>().IncludeBase<ScriptCommand, ScriptCommandDto>();
CreateMap<BodyType, BodyTypeDto>();
CreateMap<ElementType, ElementTypeDto>();
CreateMap<HitboxCommand, HitboxCommandDto>().IncludeBase<ScriptCommand, ScriptCommandDto>();
CreateMap<HurtboxInteractionFlags, HurtboxInteractionFlagsDto>();
CreateMap<PartialBodystateCommand, PartialBodystateCommandDto>().IncludeBase<ScriptCommand, ScriptCommandDto>();
CreateMap<PointerCommand, PointerCommandDto>().IncludeBase<ScriptCommand, ScriptCommandDto>();
CreateMap<StartLoopCommand, StartLoopCommandDto>().IncludeBase<ScriptCommand, ScriptCommandDto>();
CreateMap<ThrowCommand, ThrowCommandDto>().IncludeBase<ScriptCommand, ScriptCommandDto>();
CreateMap<ThrowElementType, ThrowElementTypeDto>();
CreateMap<ThrowType, ThrowTypeDto>();
CreateMap<TimerCommand, TimerCommandDto>().IncludeBase<ScriptCommand, ScriptCommandDto>();
CreateMap<UnsolvedCommand, UnsolvedCommandDto>().IncludeBase<ScriptCommand, ScriptCommandDto>();
CreateMap<VisibilityCommand, VisibilityCommandDto>().IncludeBase<ScriptCommand, ScriptCommandDto>();
CreateMap<VisibilityConstant, VisibilityConstantDto>();
CreateMap<MatchType, MatchTypeDto>();
CreateMap<MoveSubaction, MoveSubactionDto>();
CreateMap<SubactionHeader, SubactionHeaderDto>();
}
}
}
34 changes: 31 additions & 3 deletions Backend/FightCore.Api/Controllers/ExportController.cs
Original file line number Diff line number Diff line change
@@ -5,6 +5,8 @@
using Microsoft.Extensions.Caching.Distributed;
using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using FightCore.Api.DataTransferObjects.Exports.Characters;

namespace FightCore.Api.Controllers
{
@@ -53,10 +55,36 @@ public async Task<IActionResult> GetAllFrameData()

var convertedDtos = _mapper.Map<List<FullExportCharacter>>(export);

await _cache.SetAsync(_fullExportCacheKey,
Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(convertedDtos)));
foreach (var character in convertedDtos)
{
var json = JsonConvert.SerializeObject(character, Formatting.None, new JsonSerializerSettings()
{
ContractResolver = new DefaultContractResolver
{
NamingStrategy = new CamelCaseNamingStrategy()
},
TypeNameHandling = TypeNameHandling.Objects,
TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Full
});

System.IO.File.WriteAllText($"C:\\tmp\\framedata\\{character.NormalizedName}.json", json);
}

var convertedDto = _mapper.Map<List<BasicExportCharacter>>(export);

var fullJson = JsonConvert.SerializeObject(convertedDto, Formatting.None, new JsonSerializerSettings()
{
ContractResolver = new DefaultContractResolver
{
NamingStrategy = new CamelCaseNamingStrategy()
},
TypeNameHandling = TypeNameHandling.Objects,
TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Full
});

System.IO.File.WriteAllText("C:\\tmp\\framedata.json", fullJson);

return Ok(convertedDtos);
return Ok(convertedDtos);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using FightCore.Api.DataTransferObjects.Abstract;

namespace FightCore.Api.DataTransferObjects.Exports.Characters
{
public class BasicExportCharacter : BaseCharacter
{
public BaseCharacterMiscInfo CharacterInfo { get; set; }

public BaseCharacterStatistics CharacterStatistics { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using FightCore.Api.DataTransferObjects.Abstract;
using FightCore.Api.DataTransferObjects.Subactions;

namespace FightCore.Api.DataTransferObjects.Exports.Full
{
@@ -9,5 +10,7 @@ public class FullExportCharacter : BaseCharacter
public BaseCharacterStatistics CharacterStatistics { get; set; }

public List<FullExportMove> Moves { get; set; }

public List<SubactionDto> Subactions { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using FightCore.Api.DataTransferObjects.Abstract;
using FightCore.Api.DataTransferObjects.Subactions;

namespace FightCore.Api.DataTransferObjects.Exports.Full
{
public class FullExportMove : BaseMove
{
public List<BaseHitbox> Hitboxes { get; set; }

public List<MoveSubactionDto> MoveSubactions { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace FightCore.Api.DataTransferObjects.Subactions.Commands
{
public class AutoCancelCommandDto : ScriptCommandDto
{
public bool AutoCancelEnabled { get; set; }

public override CommandType CommandType => CommandType.AutoCancel;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace FightCore.Api.DataTransferObjects.Subactions.Commands
{
public class BodyStateCommandDto : ScriptCommandDto
{
public BodyTypeDto BodyType { get; set; }

public override CommandType CommandType => CommandType.BodyState;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace FightCore.Api.DataTransferObjects.Subactions.Commands
{
public enum BodyTypeDto
{
Normal = 0x0,
Invulnerable = 0x1,
Intangible = 0x2
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace FightCore.Api.DataTransferObjects.Subactions.Commands;

public enum CommandType
{
Script = 0,
Unsolved = 1,
AutoCancel = 2,
BodyState = 3,
Hitbox = 4,
PartialBodyState = 5,
Pointer = 6,
StartLoop = 7,
Throw = 8,
Timer = 9,
Visibility = 10,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace FightCore.Api.DataTransferObjects.Subactions.Commands
{
public enum ElementTypeDto
{
Normal = 0x00,
Fire = 0x04,
Electric = 0x08,
Slash = 0x0C,
Coin = 0x10,
Ice = 0x14,
Sleep = 0x18,
Sleep2 = 0x1C,
Grounded = 0x20,
Grounded2 = 0x24,
Cape = 0x28,
Empty = 0x2C,
Disabled = 0x30,
ScrewAttack = 0x38,
PoisonFlower = 0x3C,
Nothing = 0x40
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
namespace FightCore.Api.DataTransferObjects.Subactions.Commands
{
public class HitboxCommandDto : ScriptCommandDto
{
public int HitboxId { get; set; }

public int UnknownR { get; set; }

public int BoneId { get; set; }

public int Unknown0 { get; set; }

public int UnknownQ { get; set; }

public int UnknownV { get; set; }

public int Size { get; set; }

public int ZOffset { get; set; }

public int YOffset { get; set; }

public int XOffset { get; set; }

public HurtboxInteractionFlagsDto HurtboxInteraction { get; set; }

public int BaseKnockback { get; set; }

public int ShieldDamage { get; set; }

public int SFX { get; set; }

public bool HitsGround { get; set; }

public bool HitsAir { get; set; }

public int KnockbackGrowth { get; set; }

public int Damage { get; set; }

public int WeightDependantKnockback { get; set; }

public ElementTypeDto Element { get; set; }

public int Angle { get; set; }

public override CommandType CommandType => CommandType.Hitbox;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace FightCore.Api.DataTransferObjects.Subactions.Commands
{
public enum HurtboxInteractionFlagsDto
{
NoClank, SomeClank, MoreClank, AllClank
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace FightCore.Api.DataTransferObjects.Subactions.Commands
{
public class PartialBodystateCommandDto : ScriptCommandDto
{
public ushort Bone { get; set; }

public override CommandType CommandType => CommandType.PartialBodyState;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace FightCore.Api.DataTransferObjects.Subactions.Commands
{
public class PointerCommandDto : ScriptCommandDto
{
public uint Pointer { get; set; }

public override CommandType CommandType => CommandType.Pointer;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace FightCore.Api.DataTransferObjects.Subactions.Commands
{
public class ScriptCommandDto
{
public long Id { get; set; }

public string DisplayName { get; set; }

public string Name { get; set; }

public uint Type { get; set; }

public uint Length { get; set; }

public string HexString { get; set; }

public int Order { get; set; }

public virtual CommandType CommandType => CommandType.Script;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace FightCore.Api.DataTransferObjects.Subactions.Commands
{
public class StartLoopCommandDto : ScriptCommandDto
{
public ushort Iterations { get; set; }

public override CommandType CommandType => CommandType.StartLoop;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace FightCore.Api.DataTransferObjects.Subactions.Commands
{
public class ThrowCommandDto : ScriptCommandDto
{
public ThrowTypeDto ThrowType { get; set; }

public int Damage { get; set; }

public int KnockbackGrowth { get; set; }

public int WeightDependantKnockback { get; set; }

public ThrowElementTypeDto ThrowElement { get; set; }

public int Angle { get; set; }

public int BaseKnockback { get; set; }

public override CommandType CommandType => CommandType.Throw;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace FightCore.Api.DataTransferObjects.Subactions.Commands
{
public enum ThrowElementTypeDto
{
Normal = 0x0,
Fire = 0x1,
Electric = 0x2,
Ice = 0x5,
Darkness = 0xD
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace FightCore.Api.DataTransferObjects.Subactions.Commands
{
public enum ThrowTypeDto
{
Throw = 0x00,
Release = 0x01,
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace FightCore.Api.DataTransferObjects.Subactions.Commands
{
public class TimerCommandDto : ScriptCommandDto
{
public ushort Frames { get; set; }

public override CommandType CommandType => CommandType.Timer;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace FightCore.Api.DataTransferObjects.Subactions.Commands
{
public class UnsolvedCommandDto : ScriptCommandDto
{
public override CommandType CommandType => CommandType.Unsolved;
}
}
Loading

0 comments on commit 99bac6b

Please sign in to comment.