Skip to content

Commit

Permalink
Merge pull request #8 from SzymonKaminski/encounter-views-timer
Browse files Browse the repository at this point in the history
Add few encounter views, extract Timer
  • Loading branch information
Xsear authored Jun 15, 2024
2 parents 1104128 + 15a5576 commit 32ffd9e
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 30 deletions.
40 changes: 29 additions & 11 deletions AeroMessages/GSS/V66/Generic/Event/EncounterUIScopeIn.cs
Original file line number Diff line number Diff line change
@@ -1,30 +1,48 @@
using Aero.Gen.Attributes;
using AeroMessages.Common;
using static Aero.Gen.Attributes.AeroMessageIdAttribute;
using static Aero.Gen.Attributes.AeroIfAttribute;
using System;

namespace AeroMessages.GSS.V66.Generic
{
[Aero]
[AeroMessageId(MsgType.GSS, MsgSrc.Message, 0, 100)]
public partial class EncounterUIScopeIn
{
public EncounterUIScopeIn(int size)
{
_size = size;
}

public EncounterUIScopeIn()
{
}

public EntityId EncounterId;

[AeroArray(typeof(ushort))]
public byte[] BlobData; // Text keys with values inbetween or?
public byte[] Header;

public ushort SchemaVersion; // must be equal to 2

[AeroArray(typeof(byte))] public SinCardData[] SinCard;

public ushort Unk1;
[AeroArray(typeof(byte))] public EncounterUIData[] Unk2;
[AeroString] public string Unk3; // Consume remaining bytes, this is probably json?
private int _size;

[AeroArray(nameof(_size))]
public byte[] ShadowFieldValues;
}

[AeroBlock]
public struct EncounterUIData
public struct SinCardData
{
public ulong Unk1;
public ulong Unk2;
public int Unk3;
[AeroArray(typeof(byte))] public SinCardFieldData[] Unk4;
public ulong Guid;

public EntityId Target;

[AeroSdb("dbencounterdata::SinCardTemplate", "Id")]
//[AeroSdb("dbencounterdata::SinCardFields", "TemplateId")]
public int Type;

[AeroArray(typeof(byte))] public SinCardFieldData[] Fields;
}
}
16 changes: 15 additions & 1 deletion AeroMessages/GSS/V66/Generic/Event/EncounterUIUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,22 @@ namespace AeroMessages.GSS.V66.Generic
[AeroMessageId(MsgType.GSS, MsgSrc.Message, 0, 101)]
public partial class EncounterUIUpdate
{
public EncounterUIUpdate(int size)
{
_size = size;
}

public EncounterUIUpdate()
{
}

public EntityId EncounterId;

[AeroArray(typeof(ushort))] public byte[] BlobData;
[AeroString] public string Unk; // Consume remaining bytes, this is probably json?

private int _size;

[AeroArray(nameof(_size))]
public byte[] ShadowFieldValues;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Aero.Gen;
using Aero.Gen.Attributes;

namespace AeroMessages.GSS.V66.Generic.Event.EncounterView
{
[Aero(AeroGenTypes.View)]
[AeroEncounter("AirTrafficControl")]
public partial class AirTrafficControlView
{
// has no fields
}
}
24 changes: 24 additions & 0 deletions AeroMessages/GSS/V66/Generic/Event/EncounterView/ArcView.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Aero.Gen;
using Aero.Gen.Attributes;
using AeroMessages.Common;

namespace AeroMessages.GSS.V66.Generic.Event.EncounterView
{
[Aero(AeroGenTypes.View)]
[AeroEncounter("arc")]
public partial class ArcView
{
[AeroSdb("dblocalization::LocalizedText", "id")]
private uint arc_name;

[AeroSdb("dblocalization::LocalizedText", "id")]
private uint activity_string;

private ushort activity_visible;

private ushort healthbar_1_visible;

[AeroNullable]
private EntityId healthbar_1;
}
}
14 changes: 14 additions & 0 deletions AeroMessages/GSS/V66/Generic/Event/EncounterView/HudTimerView.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Aero.Gen;
using Aero.Gen.Attributes;

namespace AeroMessages.GSS.V66.Generic.Event.EncounterView
{
[Aero(AeroGenTypes.View)]
[AeroEncounter("default")]
public partial class HudTimerView
{
private Timer hudtimer_timer;

private uint hudtimer_label;
}
}
30 changes: 30 additions & 0 deletions AeroMessages/GSS/V66/Generic/Event/EncounterView/RaceView.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Aero.Gen;
using Aero.Gen.Attributes;

namespace AeroMessages.GSS.V66.Generic.Event.EncounterView
{
[Aero(AeroGenTypes.View)]
[AeroEncounter("race")]
public partial class RaceView
{
private ushort race_type;

[AeroSdb("dblocalization::LocalizedText", "id")]
private uint track_name;

[AeroSdb("dblocalization::LocalizedText", "id")]
private uint challenge_name;

private ushort waypoint_counter;

private ushort waypoint_goal;

private ushort lap_counter;

private ushort lap_goal;

private Timer objective_timer;

private ushort race_started;
}
}
40 changes: 22 additions & 18 deletions AeroMessages/GSS/V66/Shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,27 @@ public struct SinTeamsAcquiredByData
public byte[] Factions;
}

[AeroBlock]
public struct Timer
{
[Flags]
public enum TimerState : byte
{
CountingUp = 0,
CountingDown = 1,
Paused = 2, // doesnt work in UI, use CountingDownPaused instead
CountingDownPaused = CountingDown | Paused
}

public TimerState State;

[AeroIf(nameof(State), Ops.DoesntHaveFlag, TimerState.Paused)]
public ulong Micro;

[AeroIf(nameof(State), Ops.HasFlag, TimerState.Paused)]
public float Seconds;
}

[AeroBlock]
public struct SinCardFieldData
{
Expand All @@ -84,15 +105,6 @@ public enum SincardFieldDataType : byte
BoolToggle = 8
}

[Flags]
public enum TimerState : byte
{
CountingUp = 0,
CountingDown = 1,
Paused = 2, // doesnt work in UI, use CountingDownPaused instead
CountingDownPaused = CountingDown | Paused
}

public SinCardFieldData.SincardFieldDataType Type;

[AeroIf(nameof(Type), SinCardFieldData.SincardFieldDataType.LocalizationId)]
Expand All @@ -114,15 +126,7 @@ public enum TimerState : byte
public ushort Short;

[AeroIf(nameof(Type), SinCardFieldData.SincardFieldDataType.Timer)]
public TimerState Timer;

[AeroIf(nameof(Type), SinCardFieldData.SincardFieldDataType.Timer)]
[AeroIf(nameof(Timer), Ops.DoesntHaveFlag, SinCardFieldData.TimerState.Paused)]
public ulong TimerMicro;

[AeroIf(nameof(Type), SinCardFieldData.SincardFieldDataType.Timer)]
[AeroIf(nameof(Timer), Ops.HasFlag, SinCardFieldData.TimerState.Paused)]
public float TimerSeconds;
public Timer Timer;

public enum CardType : byte
{
Expand Down

0 comments on commit 32ffd9e

Please sign in to comment.