mirror of
https://github.com/redstrate/Auracite.git
synced 2025-04-24 05:37:44 +00:00
This is to facilitate support for this feature on the Web, where the plugin needs to start a server instead of Auracite itself. Otherwise, the functionality is identical to before.
45 lines
No EOL
1,000 B
C#
45 lines
No EOL
1,000 B
C#
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();
|
|
}
|
|
}
|
|
} |