PKHeX/PKHeX.Core/Saves/Substructures/Gen8/LA/PlayTime8a.cs
Kurt 691f941bb6 Add savedata models
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
Co-Authored-By: SciresM <8676005+SciresM@users.noreply.github.com>
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
2022-02-04 17:31:20 -08:00

25 lines
851 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.ComponentModel;
using static System.Buffers.Binary.BinaryPrimitives;
namespace PKHeX.Core;
/// <summary>
/// Stores the amount of time the save file has been played.
/// </summary>
[TypeConverter(typeof(ExpandableObjectConverter))]
public sealed class PlayTime8a : SaveBlock
{
public PlayTime8a(SAV8LA sav, SCBlock block) : base(sav, block.Data) { }
public ushort PlayedHours
{
get => ReadUInt16LittleEndian(Data.AsSpan(Offset));
set => WriteUInt16LittleEndian(Data.AsSpan(Offset), value);
}
public byte PlayedMinutes { get => Data[Offset + 2]; set => Data[Offset + 2] = value; }
public byte PlayedSeconds { get => Data[Offset + 3]; set => Data[Offset + 3] = value; }
public string LastSavedTime => $"{PlayedHours:0000}ː{PlayedMinutes:00}ː{PlayedSeconds:00}"; // not :
}