catastropy averted?
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<AssemblyName>AntiDickheadChatmodule</AssemblyName>
|
||||
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<LangVersion>14.0</LangVersion>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Reference Include="Dalamud" />
|
||||
<Reference Include="FFXIVClientStructs" />
|
||||
<Reference Include="Dalamud.Bindings.ImGui" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using Dalamud.Configuration;
|
||||
using Dalamud.Plugin;
|
||||
|
||||
namespace AntiDickheadChatmodule;
|
||||
|
||||
[Serializable]
|
||||
public class Configuration : IPluginConfiguration
|
||||
{
|
||||
[NonSerialized]
|
||||
private IDalamudPluginInterface? pluginInterface;
|
||||
|
||||
public int Version { get; set; }
|
||||
|
||||
public bool Enabled { get; set; } = true;
|
||||
|
||||
public int RightClickDelay { get; set; } = 250;
|
||||
|
||||
public void Initialize(IDalamudPluginInterface pluginInterface)
|
||||
{
|
||||
this.pluginInterface = pluginInterface;
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
pluginInterface.SavePluginConfig((IPluginConfiguration)(object)this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using Dalamud.Game.Command;
|
||||
using Dalamud.Game.Text;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
using Dalamud.Hooking;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Services;
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
|
||||
namespace AntiDickheadChatmodule;
|
||||
|
||||
public sealed class Plugin : IDalamudPlugin, IDisposable
|
||||
{
|
||||
private unsafe delegate void* AgentShow(void* a1);
|
||||
|
||||
private const string commandName = "/adh";
|
||||
|
||||
public string Name => "Anti-Dickhead chatmodule";
|
||||
|
||||
private IDalamudPluginInterface PluginInterface { get; init; }
|
||||
|
||||
private ICommandManager CommandManager { get; init; }
|
||||
|
||||
private Configuration Configuration { get; init; }
|
||||
|
||||
private PluginUI PluginUi { get; init; }
|
||||
|
||||
public long rcStartTime { get; private set; }
|
||||
|
||||
private Hook<AgentShow>? DutyFinderHook { get; set; }
|
||||
|
||||
public unsafe AtkUnitBase* dutyFinderAtkUnitBase { get; private set; }
|
||||
|
||||
public string DataPath { get; } = string.Empty;
|
||||
|
||||
public Plugin(IDalamudPluginInterface pluginInterface, ICommandManager commandManager)
|
||||
{
|
||||
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_008e: Expected O, but got Unknown
|
||||
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_009e: Expected O, but got Unknown
|
||||
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_00ed: Expected O, but got Unknown
|
||||
PluginInterface = pluginInterface;
|
||||
CommandManager = commandManager;
|
||||
pluginInterface.Create<Service>(Array.Empty<object>());
|
||||
Configuration = (PluginInterface.GetPluginConfig() as Configuration) ?? new Configuration();
|
||||
Configuration.Initialize(PluginInterface);
|
||||
PluginUi = new PluginUI(Configuration, DataPath);
|
||||
CommandManager.AddHandler("/adh", new CommandInfo(new HandlerDelegate(OnCommand))
|
||||
{
|
||||
HelpMessage = "Show the tracker UI"
|
||||
});
|
||||
PluginInterface.UiBuilder.Draw += DrawUI;
|
||||
PluginInterface.UiBuilder.OpenConfigUi += DrawConfigUI;
|
||||
Service.Chat.ChatMessage += new OnMessageDelegate(Chat_ChatMessage1);
|
||||
}
|
||||
|
||||
private void Chat_ChatMessage1(XivChatType type, int timestamp, ref SeString sender, ref SeString message, ref bool isHandled)
|
||||
{
|
||||
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
|
||||
if (!new List<XivChatType>
|
||||
{
|
||||
(XivChatType)15,
|
||||
(XivChatType)37,
|
||||
(XivChatType)101,
|
||||
(XivChatType)102,
|
||||
(XivChatType)103,
|
||||
(XivChatType)104,
|
||||
(XivChatType)105,
|
||||
(XivChatType)106,
|
||||
(XivChatType)107,
|
||||
(XivChatType)14,
|
||||
(XivChatType)11,
|
||||
(XivChatType)10,
|
||||
(XivChatType)30,
|
||||
(XivChatType)24,
|
||||
(XivChatType)13,
|
||||
(XivChatType)27
|
||||
}.Contains(type))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
bool flag = false;
|
||||
foreach (Payload payload in message.Payloads)
|
||||
{
|
||||
TextPayload val = (TextPayload)(object)((payload is TextPayload) ? payload : null);
|
||||
if (val == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
flag = false;
|
||||
continue;
|
||||
}
|
||||
string text = val.Text;
|
||||
Service.PluginLog.Debug(text ?? string.Empty, Array.Empty<object>());
|
||||
if (string.IsNullOrEmpty(text) || text.Contains('\ue0bb'))
|
||||
{
|
||||
Service.PluginLog.Debug("Skipping, because empty or symbol", Array.Empty<object>());
|
||||
flag = true;
|
||||
continue;
|
||||
}
|
||||
string text2 = text;
|
||||
if (text2.Contains(".") || char.IsUpper(text2[0]))
|
||||
{
|
||||
string[] array = text2.Split(" ");
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
if (array[i].Length > 1 && char.IsUpper(array[i][0]) && !char.IsUpper(array[i][1]) && array[i][1] != '\'')
|
||||
{
|
||||
array[i] = array[i].ToLower();
|
||||
}
|
||||
if (!array[i].EndsWith("."))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (i + 1 < array.Length)
|
||||
{
|
||||
string pattern = "((?::|;|=)(?:-)?(?:\\)|D|P))";
|
||||
if (Regex.Match(array[i + 1], pattern, RegexOptions.IgnoreCase).Success)
|
||||
{
|
||||
array[i] = array[i].Substring(0, array[i].Length - 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
array[i] = array[i].Substring(0, array[i].Length - 1);
|
||||
}
|
||||
}
|
||||
string text3 = "";
|
||||
string[] array2 = array;
|
||||
foreach (string text4 in array2)
|
||||
{
|
||||
text3 = text3 + text4 + " ";
|
||||
}
|
||||
text2 = text3;
|
||||
}
|
||||
if (!text.Equals(text2))
|
||||
{
|
||||
val.Text = text2;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Service.PluginLog.Debug($"Failed to process message: {message}.", Array.Empty<object>());
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0032: Expected O, but got Unknown
|
||||
PluginUi.Dispose();
|
||||
CommandManager.RemoveHandler("/adh");
|
||||
Service.Chat.ChatMessage -= new OnMessageDelegate(Chat_ChatMessage1);
|
||||
}
|
||||
|
||||
private void OnCommand(string command, string args)
|
||||
{
|
||||
PluginUi.Visible = true;
|
||||
}
|
||||
|
||||
private void DrawUI()
|
||||
{
|
||||
PluginUi.Draw();
|
||||
}
|
||||
|
||||
private void DrawConfigUI()
|
||||
{
|
||||
PluginUi.SettingsVisible = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
|
||||
namespace AntiDickheadChatmodule;
|
||||
|
||||
internal class PluginUI : IDisposable
|
||||
{
|
||||
private Configuration configuration;
|
||||
|
||||
private bool settingsVisible;
|
||||
|
||||
private bool visible;
|
||||
|
||||
public string DataPath { get; }
|
||||
|
||||
public bool SettingsVisible
|
||||
{
|
||||
get
|
||||
{
|
||||
return settingsVisible;
|
||||
}
|
||||
set
|
||||
{
|
||||
settingsVisible = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Visible
|
||||
{
|
||||
get
|
||||
{
|
||||
return visible;
|
||||
}
|
||||
set
|
||||
{
|
||||
visible = value;
|
||||
}
|
||||
}
|
||||
|
||||
public PluginUI(Configuration configuration, string DataPath)
|
||||
{
|
||||
this.configuration = configuration;
|
||||
this.DataPath = DataPath;
|
||||
}
|
||||
|
||||
public void DrawMainWindow()
|
||||
{
|
||||
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
|
||||
if (Visible)
|
||||
{
|
||||
ImGui.SetNextWindowSize(new Vector2(700f, 330f), (ImGuiCond)4);
|
||||
ImGui.SetNextWindowSizeConstraints(new Vector2(700f, 330f), new Vector2(float.MaxValue, float.MaxValue));
|
||||
if (ImGui.Begin(ImU8String.op_Implicit("Dickheads be gone from mine chat"), ref visible, (ImGuiWindowFlags)24))
|
||||
{
|
||||
ImGui.Text(ImU8String.op_Implicit("Anti-fags :D"));
|
||||
}
|
||||
ImGui.End();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
DrawMainWindow();
|
||||
DrawSettingsWindow();
|
||||
}
|
||||
|
||||
public void DrawSettingsWindow()
|
||||
{
|
||||
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
|
||||
if (!SettingsVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ImGui.SetNextWindowSize(new Vector2(450f, 100f), (ImGuiCond)1);
|
||||
if (ImGui.Begin(ImU8String.op_Implicit("World Map Enhancer Settings"), ref settingsVisible, (ImGuiWindowFlags)58))
|
||||
{
|
||||
bool enabled = configuration.Enabled;
|
||||
if (ImGui.Checkbox(ImU8String.op_Implicit("Enable zooming out with right click"), ref enabled))
|
||||
{
|
||||
configuration.Enabled = enabled;
|
||||
configuration.Save();
|
||||
}
|
||||
int rightClickDelay = configuration.RightClickDelay;
|
||||
if (ImGui.InputInt(ImU8String.op_Implicit("Right click release delay"), ref rightClickDelay, 25, 100, default(ImU8String), (ImGuiInputTextFlags)0))
|
||||
{
|
||||
configuration.RightClickDelay = rightClickDelay;
|
||||
configuration.Save();
|
||||
}
|
||||
}
|
||||
ImGui.End();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
||||
namespace AntiDickheadChatmodule;
|
||||
|
||||
public class Service
|
||||
{
|
||||
[PluginService]
|
||||
public static IClientState ClientState { get; private set; }
|
||||
|
||||
[PluginService]
|
||||
public static IChatGui Chat { get; private set; }
|
||||
|
||||
[PluginService]
|
||||
public static IDataManager Data { get; private set; }
|
||||
|
||||
[PluginService]
|
||||
public static IPluginLog PluginLog { get; private set; }
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
|
||||
[assembly: AssemblyCompany("aRkker")]
|
||||
[assembly: AssemblyConfiguration("Release")]
|
||||
[assembly: AssemblyDescription("Sufferable chat = insufferable. :)")]
|
||||
[assembly: AssemblyFileVersion("0.0.6.0")]
|
||||
[assembly: AssemblyInformationalVersion("0.0.6.0+8c181f19a2ba71e0bee0e08ad8a42953b3276520")]
|
||||
[assembly: AssemblyProduct("AntiDickheadChatmodule")]
|
||||
[assembly: AssemblyTitle("AntiDickheadChatmodule")]
|
||||
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/aRkker/ffxiv-dalamud-wme.git")]
|
||||
[assembly: AssemblyVersion("0.0.6.0")]
|
||||
Reference in New Issue
Block a user