39 lines
1.3 KiB
C#
Executable File
39 lines
1.3 KiB
C#
Executable File
using System;
|
|
using Dalamud.Game.Text.SeStringHandling;
|
|
using XivCommon;
|
|
using XivCommon.Functions;
|
|
|
|
namespace TextBoxStyler {
|
|
public class Styler : IDisposable {
|
|
private Plugin Plugin { get; }
|
|
private XivCommonBase Common { get; }
|
|
|
|
public Styler(Plugin plugin) {
|
|
this.Plugin = plugin;
|
|
this.Common = new XivCommonBase(Hooks.Talk | Hooks.BattleTalk);
|
|
|
|
this.Common.Functions.Talk.OnTalk += this.StyleTalk;
|
|
this.Common.Functions.BattleTalk.OnBattleTalk += this.StyleBattleTalk;
|
|
}
|
|
|
|
public void Dispose() {
|
|
this.Common.Functions.BattleTalk.OnBattleTalk -= this.StyleBattleTalk;
|
|
this.Common.Functions.Talk.OnTalk -= this.StyleTalk;
|
|
|
|
this.Common.Dispose();
|
|
}
|
|
|
|
private void StyleTalk(ref SeString name, ref SeString text, ref TalkStyle style) {
|
|
if (this.Plugin.Config.Style != null) {
|
|
style = this.Plugin.Config.Style.Value;
|
|
}
|
|
}
|
|
|
|
private void StyleBattleTalk(ref SeString sender, ref SeString message, ref BattleTalkOptions options, ref bool isHandled) {
|
|
if (this.Plugin.Config.BattleTalkStyle != null) {
|
|
options.Style = this.Plugin.Config.BattleTalkStyle.Value;
|
|
}
|
|
}
|
|
}
|
|
}
|