120 lines
6.2 KiB
C#
120 lines
6.2 KiB
C#
using System.Text.Json;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace GvrReplay;
|
|
|
|
// 사이트로 가는 형식. 시간은 모두 리플레이 시작부터 ms (t), 좌표는 게임 월드 단위(cm) 정수
|
|
public sealed class ReplayFile
|
|
{
|
|
public string Format { get; set; } = "gvr-replay";
|
|
/// 2: objects 에 yaw · pitch, objectPaths · track.f · states · hits · plants · actions · kills 4번째 열 추가 (v1 열은 그대로)
|
|
public int V { get; set; } = 2;
|
|
public string? MatchId { get; set; }
|
|
public string? Map { get; set; }
|
|
public string? Build { get; set; }
|
|
/// 리플레이 녹화 시작 시각 (서버 기준 유닉스 ms). t 를 실제 시각으로 바꿀 때 recordedAt + t
|
|
public long RecordedAt { get; set; }
|
|
public int DurationMs { get; set; }
|
|
public int SampleMs { get; set; }
|
|
public List<ReplayPlayer> Players { get; set; } = [];
|
|
public List<ReplayRound> Rounds { get; set; } = [];
|
|
/// [t, phase] 게임 단계 바뀜 (원본 값)
|
|
public List<int[]> Phases { get; set; } = [];
|
|
/// [t, killer, victim, deathAnim] (선수 번호, 모르면 -1. deathAnim = deathAnims 번호, 모르면 -1)
|
|
public List<int[]> Kills { get; set; } = [];
|
|
/// 죽는 모션 이름 (예: TP_Core_Death_Head_Front_SM_Montage)
|
|
public List<string> DeathAnims { get; set; } = [];
|
|
/// [t, player, x, y, z, yaw, pitch] 사격 위치와 방향
|
|
public List<int[]> Shots { get; set; } = [];
|
|
/// 스킬 · 설치물 [t0, t1, kind 번호, x, y, z, player, yaw, pitch] (t1 = 사라진 시각, 날아가는 것은 부딪힌 시각, 모르면 -1. yaw · pitch 는 생길 때 방향(도))
|
|
public List<int[]> Objects { get; set; } = [];
|
|
public List<string> ObjectKinds { get; set; } = [];
|
|
/// 움직이는 스킬의 경로 (투사체 비행 · 드론 · 분신). o = objects 번호
|
|
public List<ObjectPath> ObjectPaths { get; set; } = [];
|
|
/// 무기 · 스킬 상태 바뀜 [t, player, equipKind, stateKind] (FiringState · ReloadState · ZoomStateLevel1 · EquipState …)
|
|
public List<int[]> States { get; set; } = [];
|
|
public List<string> StateKinds { get; set; } = [];
|
|
/// 맞은 것 [t, attacker, victim, 쏜 x, y, z, 맞은 x, y, z, 부위(1 머리 · 2 몸 · 3 다리 · 0 모름), 죽였으면 1]
|
|
public List<int[]> Hits { get; set; } = [];
|
|
/// 스파이크 설치 [t, player, x, y, z]
|
|
public List<int[]> Plants { get; set; } = [];
|
|
/// 이어지는 동작 [t0, t1, player, actionKind] (Plant 설치 중 · Defuse 해체 중 · Rope 줄 타기), t1 모르면 -1
|
|
public List<int[]> Actions { get; set; } = [];
|
|
public List<string> ActionKinds { get; set; } = [];
|
|
/// 들고 있는 것이 바뀐 시각 [t, player, kind 번호, skin 번호]. 총은 영어 이름(Vandal 등), 칼은 Melee, 스파이크는 Spike, 스킬은 클래스 이름.
|
|
/// skin = skins 번호 (스킨 기록이 없는 것 · 스킬은 -1, 변환기 1.10.0~ 에만 4번째 열)
|
|
public List<int[]> Equips { get; set; } = [];
|
|
public List<string> EquipKinds { get; set; } = [];
|
|
/// 무기 스킨 (총 · 칼). 줍거나 떨어뜨려도 그 총의 스킨은 처음 주인 것 그대로 (게임과 같다)
|
|
public List<SkinInfo> Skins { get; set; } = [];
|
|
/// 점수판 (게임 Tab 화면): 선수 값이 바뀔 때마다 [t, player, 크레딧, 궁극기 점수, 킬, 데스, 어시스트, 전투 점수] (아직 모르는 값 -1, 변환기 1.10.0~)
|
|
public List<int[]> Scoreboard { get; set; } = [];
|
|
}
|
|
|
|
public sealed class ReplayPlayer
|
|
{
|
|
public string? Puuid { get; set; }
|
|
/// 캐릭터 클래스 (예: Wushu_PC_C). 요원 이름은 사이트가 경기 상세(match-details)로 붙인다
|
|
public string? Character { get; set; }
|
|
/// 이동 기록. 열 별 배열 (같은 길이): t, x, y, z, yaw(도), pitch(도)
|
|
public PlayerTrack Track { get; set; } = new();
|
|
/// 조준점 설정이 바뀐 시각마다 전체 설정 (시간 순). 리플레이에 없으면 null
|
|
public List<CrosshairAt>? Crosshair { get; set; }
|
|
}
|
|
|
|
public sealed class PlayerTrack
|
|
{
|
|
public List<int> T { get; set; } = [];
|
|
public List<int> X { get; set; } = [];
|
|
public List<int> Y { get; set; } = [];
|
|
public List<int> Z { get; set; } = [];
|
|
public List<int> Yaw { get; set; } = [];
|
|
public List<int> Pitch { get; set; } = [];
|
|
/// 움직임 상태 비트: 1 앉음 · 2 걷기(Shift) · 4 공중(점프 · 떨어짐) · 8 날기(제트 대시 등)
|
|
public List<int> F { get; set; } = [];
|
|
}
|
|
|
|
public sealed class ObjectPath
|
|
{
|
|
public int O { get; set; }
|
|
public List<int> T { get; set; } = [];
|
|
public List<int> X { get; set; } = [];
|
|
public List<int> Y { get; set; } = [];
|
|
public List<int> Z { get; set; } = [];
|
|
/// 드론 · 분신만 (보는 방향, 도). 투사체는 빈 배열
|
|
public List<int> Yaw { get; set; } = [];
|
|
}
|
|
|
|
public sealed class ReplayRound
|
|
{
|
|
/// 1부터
|
|
public int Num { get; set; }
|
|
/// 구매 단계 시작
|
|
public int Buy { get; set; }
|
|
/// 교전 시작 (구매 단계 끝), 모르면 -1
|
|
public int Combat { get; set; }
|
|
/// 라운드 끝 (승패 확정), 모르면 -1
|
|
public int End { get; set; }
|
|
}
|
|
|
|
public static class ReplayJson
|
|
{
|
|
public static readonly JsonSerializerOptions Options = new()
|
|
{
|
|
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
|
DefaultIgnoreCondition = JsonIgnoreCondition.Never,
|
|
};
|
|
}
|
|
|
|
/// <summary>무기 스킨: 게임 데이터 에셋 경로 (예: /Game/Equippables/Guns/Rifles/AK/HypeBeast/AssaultRifle_AK_HypeBeast_PrimaryAsset).
|
|
/// level = 스킨 단계, chroma = 색상, charm · charmLevel = 총 장식 (없으면 null)</summary>
|
|
public sealed record SkinInfo(string Skin, string? Level, string? Chroma, string? Charm, string? CharmLevel)
|
|
{
|
|
/// <summary>리플레이 필드(이름 → 경로)에서. 스킨이 없으면 null. 경로의 ".Default__…_C" 는 뗀다</summary>
|
|
public static SkinInfo? From(IReadOnlyDictionary<string, string> d)
|
|
{
|
|
string? P(string k) => d.GetValueOrDefault(k) is { Length: > 0 } v ? (v.IndexOf('.') is var i and > 0 ? v[..i] : v) : null;
|
|
return P("SkinDataAsset") is { } skin ? new SkinInfo(skin, P("SkinLevelDataAsset"), P("ChromaDataAsset"), P("CharmDataAsset"), P("CharmLevelDataAsset")) : null;
|
|
}
|
|
}
|