Skip to content

Commit

Permalink
warn users in chat when loading with deprecated combos enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
PrincessRTFM committed Sep 3, 2023
1 parent 0699dd1 commit fa2cf9c
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
6 changes: 4 additions & 2 deletions XIVComboVX/ChatUtil.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace PrincessRTFM.XIVComboVX;

using System;
using System.Diagnostics.CodeAnalysis;

using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling;
Expand All @@ -16,14 +17,15 @@ internal readonly DalamudLinkPayload
clplOpenConfig;

internal const ushort
clfgDeprecationCount = 32,
clfgOpenConfig = 34,
clbgOpenConfig = 502;
clbgOpenConfig = 37;

internal ChatUtil() {
this.clplOpenConfig = Service.Interface.AddChatLinkHandler(clidOpenConfig, this.onClickChatLink);
}

[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Convention")]
[SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Convention")]
internal void print(XivChatType type, params Payload[] payloads) {
if (payloads.Length > 0) {
Service.ChatGui.PrintChat(new XivChatEntry() {
Expand Down
40 changes: 39 additions & 1 deletion XIVComboVX/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace PrincessRTFM.XIVComboVX;

using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;

using Dalamud.Game.Command;
Expand All @@ -11,6 +12,9 @@ namespace PrincessRTFM.XIVComboVX;
using Dalamud.Interface.Windowing;
using Dalamud.Logging;
using Dalamud.Plugin;
using Dalamud.Utility;

using PrincessRTFM.XIVComboVX.Attributes;

using XIVComboVX.Config;

Expand Down Expand Up @@ -84,7 +88,9 @@ public Plugin(DalamudPluginInterface pluginInterface) {
Service.Ipc = new();

Service.Ipc.addTips(
$"{this.Name} - better than a broken leg!" // I will not be serious and you cannot make me.
$"{this.Name} - better than a broken leg!", // I will not be serious and you cannot make me.
$"It looks like {this.Name} is installed. Do you hate pressing buttons?",
$"I see you're using {this.Name}. Have you tried being good at the game instead?"
);

PluginLog.Information($"{this.FullPluginSignature} initialised {(Service.Address.LoadSuccessful ? "" : "un")}successfully");
Expand All @@ -95,6 +101,38 @@ public Plugin(DalamudPluginInterface pluginInterface) {
Service.Configuration.Save();
}

int deprecated = 0;
foreach (CustomComboPreset active in Service.Configuration.EnabledActions) {
if (active.GetAttribute<DeprecatedAttribute>() is not null)
++deprecated;
}
if (deprecated > 0) {
SeStringBuilder msg = new();

msg.AddUiForeground(ChatUtil.clfgOpenConfig);
msg.Add(Service.ChatUtils.clplOpenConfig);
msg.AddText($"[{this.Name}] ");
msg.Add(RawPayload.LinkTerminator);
msg.AddUiForegroundOff();
msg.AddText("You currently have ");
msg.AddUiForeground(ChatUtil.clfgDeprecationCount);
msg.AddText($"{deprecated} deprecated combo{(deprecated == 1 ? "" : "s")}");
msg.AddUiForegroundOff();
msg.AddText(" enabled. It is recommended to ");
msg.AddUiForeground(ChatUtil.clfgOpenConfig);
msg.AddUiGlow(ChatUtil.clbgOpenConfig);
msg.Add(Service.ChatUtils.clplOpenConfig);
msg.AddText("open the settings");
msg.Add(RawPayload.LinkTerminator);
msg.AddUiGlowOff();
msg.AddUiForegroundOff();
msg.AddText($" and replace {(deprecated == 1 ? "it" : "them")} with the recommended alternatives.");
Service.ChatGui.PrintChat(new XivChatEntry() {
Type = XivChatType.ErrorMessage,
Message = msg.Build(),
});
}

}

#region Disposable
Expand Down
2 changes: 1 addition & 1 deletion XIVComboVX/XIVComboVX.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Product>XIVComboVX</Product>
<Authors>attick, daemitus, VariableVixen</Authors>
<Version>9.5.0</Version>
<Version>9.6.0</Version>
<Description>This plugin condenses various abilities onto single buttons.</Description>
<PackageProjectUrl>https://github.com/PrincessRTFM/XIVComboPlugin</PackageProjectUrl>
<Copyright>Copyleft attick 2020 baybeeee</Copyright>
Expand Down
Binary file added dalamud-plugin-ui-colours.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fa2cf9c

Please sign in to comment.