1
Fork 0
mirror of https://github.com/redstrate/Auracite.git synced 2025-04-24 13:37:45 +00:00
auracite/dalamud/Auracite/PlaytimeStep.cs

45 lines
1,000 B
C#
Raw Normal View History

using System;
using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling;
namespace Auracite;
public class PlaytimeStep : IStep
{
public PlaytimeStep()
{
Plugin.ChatGui.ChatMessage += OnChatMessage;
}
public void Dispose()
{
Plugin.ChatGui.ChatMessage -= OnChatMessage;
}
public event IStep.CompletedDelegate? Completed;
public void Run()
{
}
public string StepName()
{
return "Playtime";
}
public string StepDescription()
{
return "Type /playtime into the chat window.";
}
private void OnChatMessage(XivChatType type, int timestamp, ref SeString sender, ref SeString message,
ref bool ishandled)
{
var msgString = message.ToString();
if (msgString.Contains("Total Play Time:") && type == XivChatType.SystemMessage)
{
Plugin.package.playtime = msgString.Split(": ")[1]; // TODO: lol
Completed?.Invoke();
}
}
}