- API 12
- Cleanup
This commit is contained in:
+4
-44
@@ -1,59 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Dalamud.NET.SDK/12.0.2">
|
||||
<PropertyGroup>
|
||||
<Version>1.29.20</Version>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Version>1.30.0</Version>
|
||||
<TargetFramework>net9.0-windows</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
|
||||
<LangVersion>preview</LangVersion>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<DalamudLibPath>$(AppData)\XIVLauncher\addon\Hooks\dev</DalamudLibPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">
|
||||
<DalamudLibPath>$(DALAMUD_HOME)</DalamudLibPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(IsCI)' == 'true'">
|
||||
<DalamudLibPath>$(HOME)/dalamud</DalamudLibPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Dalamud">
|
||||
<HintPath>$(DalamudLibPath)\Dalamud.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="FFXIVClientStructs">
|
||||
<HintPath>$(DalamudLibPath)\FFXIVClientStructs.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="ImGui.NET">
|
||||
<HintPath>$(DalamudLibPath)\ImGui.NET.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="Lumina">
|
||||
<HintPath>$(DalamudLibPath)\Lumina.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="Lumina.Excel">
|
||||
<HintPath>$(DalamudLibPath)\Lumina.Excel.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>$(DalamudLibPath)\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DalamudPackager" Version="11.0.0" />
|
||||
<PackageReference Include="MessagePack" Version="3.1.3" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.0" />
|
||||
<PackageReference Include="Pidgin" Version="3.3.0" />
|
||||
|
||||
+2
-2
@@ -54,7 +54,7 @@ public enum ChunkSource
|
||||
Content,
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
[MessagePackObject(AllowPrivate = true)]
|
||||
public class TextChunk : Chunk
|
||||
{
|
||||
[Key(2)]
|
||||
@@ -121,7 +121,7 @@ public class TextChunk : Chunk
|
||||
}
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
[MessagePackObject(AllowPrivate = true)]
|
||||
public class IconChunk : Chunk
|
||||
{
|
||||
[Key(2)]
|
||||
|
||||
@@ -17,6 +17,7 @@ using FFXIVClientStructs.FFXIV.Client.UI.Info;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Shell;
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
using InteropGenerator.Runtime;
|
||||
using Lumina.Text.ReadOnly;
|
||||
|
||||
using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType;
|
||||
@@ -98,7 +99,7 @@ internal sealed unsafe class Chat : IDisposable
|
||||
internal string? GetLinkshellName(uint idx)
|
||||
{
|
||||
var utf = InfoProxyChat.Instance()->GetLinkShellName(idx);
|
||||
return utf == null ? null : MemoryHelper.ReadStringNullTerminated((nint) utf);
|
||||
return utf.HasValue ? utf.ToString() : null;
|
||||
}
|
||||
|
||||
internal string? GetCrossLinkshellName(uint idx)
|
||||
@@ -199,9 +200,9 @@ internal sealed unsafe class Chat : IDisposable
|
||||
string? addIfNotPresent = null;
|
||||
|
||||
var str = value + 2;
|
||||
if (str != null && ((int) str->Type & 0xF) == (int) ValueType.String && str->String != null)
|
||||
if (str != null && ((int) str->Type & 0xF) == (int) ValueType.String && str->String.HasValue)
|
||||
{
|
||||
var add = MemoryHelper.ReadStringNullTerminated((nint) str->String);
|
||||
var add = str->String.ToString();
|
||||
if (add.Length > 0)
|
||||
addIfNotPresent = add;
|
||||
}
|
||||
@@ -227,7 +228,7 @@ internal sealed unsafe class Chat : IDisposable
|
||||
return 1;
|
||||
}
|
||||
|
||||
private byte* ChangeChannelNameDetour(AgentChatLog* agent)
|
||||
private CStringPointer ChangeChannelNameDetour(AgentChatLog* agent)
|
||||
{
|
||||
var ret = ChangeChannelNameHook.Original(agent);
|
||||
if (agent == null)
|
||||
@@ -525,7 +526,7 @@ internal sealed unsafe class Chat : IDisposable
|
||||
{
|
||||
var uC = Utf8String.FromString(c.ToString());
|
||||
|
||||
uC->SanitizeString(0x27F, Utf8String.CreateEmpty());
|
||||
uC->SanitizeString((AllowedEntities) 0x27F);
|
||||
var wasValid = uC->ToString().Length > 0;
|
||||
|
||||
uC->Dtor(true);
|
||||
|
||||
@@ -33,7 +33,7 @@ public unsafe class ChatBox
|
||||
{
|
||||
var uText = Utf8String.FromString(text);
|
||||
|
||||
uText->SanitizeString(0x27F, (Utf8String*)nint.Zero);
|
||||
uText->SanitizeString((AllowedEntities) 0x27F);
|
||||
var sanitised = uText->ToString();
|
||||
uText->Dtor(true);
|
||||
|
||||
|
||||
+1
-1
@@ -337,7 +337,7 @@ internal partial class Message
|
||||
else if (split == "<flag>")
|
||||
{
|
||||
var agentMap = AgentMap.Instance();
|
||||
if (agentMap->IsFlagMarkerSet == 0)
|
||||
if (!agentMap->IsFlagMarkerSet)
|
||||
{
|
||||
AddChunkWithMessage(text.NewWithStyle(chunk.Source, chunk.Link, split));
|
||||
continue;
|
||||
|
||||
@@ -267,7 +267,6 @@ internal class MessageManager : IAsyncDisposable
|
||||
if (tab.Identifier == currentTabId)
|
||||
Plugin.ServerCore.SendNewMessage(message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -277,10 +277,10 @@ public sealed class PayloadHandler
|
||||
var atkPos = new Vector2(component.ScreenX, component.ScreenY);
|
||||
var atkSize = new Vector2(component.GetWidth() * component.ScaleX, component.GetHeight() * component.GetScaleY());
|
||||
|
||||
var chatRect = MathUtil.Rectangle.FromPosAndSize(LogWindow.LastWindowPos, LogWindow.LastWindowSize);
|
||||
var addonRect = MathUtil.Rectangle.FromPosAndSize(atkPos, atkSize);
|
||||
var chatRect = new MathUtil.Rectangle(LogWindow.LastWindowPos, LogWindow.LastWindowSize);
|
||||
var addonRect = new MathUtil.Rectangle(atkPos, atkSize);
|
||||
|
||||
if (!MathUtil.CheckRectOverlap(chatRect, addonRect))
|
||||
if (!chatRect.HasOverlap(addonRect))
|
||||
return;
|
||||
|
||||
var viewportSize = ImGuiHelpers.MainViewport.Size;
|
||||
|
||||
@@ -80,7 +80,7 @@ public sealed class SettingsWindow : Window
|
||||
|
||||
using (var table = ImRaii.Table("##chat2-settings-table", 2))
|
||||
{
|
||||
if (table)
|
||||
if (table.Success)
|
||||
{
|
||||
ImGui.TableSetupColumn("tab", ImGuiTableColumnFlags.WidthFixed);
|
||||
ImGui.TableSetupColumn("settings", ImGuiTableColumnFlags.WidthStretch);
|
||||
@@ -99,10 +99,11 @@ public sealed class SettingsWindow : Window
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
|
||||
var height = ImGui.GetContentRegionAvail().Y - ImGui.GetStyle().FramePadding.Y * 2 - ImGui.GetStyle().ItemSpacing.Y
|
||||
- ImGui.GetStyle().ItemInnerSpacing.Y * 2 - ImGui.CalcTextSize("A").Y;
|
||||
var style = ImGui.GetStyle();
|
||||
var height = ImGui.GetContentRegionAvail().Y - style.FramePadding.Y * 2 - style.ItemSpacing.Y - style.ItemInnerSpacing.Y * 2 - ImGui.CalcTextSize("A").Y;
|
||||
|
||||
using var child = ImRaii.Child("##chat2-settings", new Vector2(-1, height));
|
||||
if (child)
|
||||
if (child.Success)
|
||||
Tabs[CurrentTab].Draw(changed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,14 +41,14 @@ internal static class ChunkUtil
|
||||
case PayloadType.UIForeground:
|
||||
var foregroundPayload = (UIForegroundPayload) payload;
|
||||
if (foregroundPayload.IsEnabled)
|
||||
foreground.Push(foregroundPayload.UIColor.Value.UIForeground);
|
||||
foreground.Push(foregroundPayload.UIColor.Value.Dark);
|
||||
else if (foreground.Count > 0)
|
||||
foreground.Pop();
|
||||
break;
|
||||
case PayloadType.UIGlow:
|
||||
var glowPayload = (UIGlowPayload) payload;
|
||||
if (glowPayload.IsEnabled)
|
||||
glow.Push(glowPayload.UIColor.Value.UIGlow);
|
||||
glow.Push(glowPayload.UIColor.Value.Light);
|
||||
else if (glow.Count > 0)
|
||||
glow.Pop();
|
||||
break;
|
||||
|
||||
+21
-12
@@ -4,30 +4,39 @@ namespace ChatTwo.Util;
|
||||
|
||||
public static class MathUtil
|
||||
{
|
||||
public struct Rectangle
|
||||
public record Rectangle
|
||||
{
|
||||
public int X;
|
||||
public int Y;
|
||||
public int Width;
|
||||
public int Height;
|
||||
|
||||
public static Rectangle FromPosAndSize(Vector2 pos, Vector2 size)
|
||||
public int SizeX;
|
||||
public int SizeY;
|
||||
|
||||
public Rectangle(int x, int y, int width, int height)
|
||||
{
|
||||
return new Rectangle
|
||||
{
|
||||
X = (int) pos.X,
|
||||
Y = (int) pos.Y,
|
||||
Width = (int) size.X,
|
||||
Height = (int) size.Y
|
||||
};
|
||||
X = x;
|
||||
Y = y;
|
||||
Width = width;
|
||||
Height = height;
|
||||
|
||||
SizeX = X + Width;
|
||||
SizeY = Y + Height;
|
||||
}
|
||||
|
||||
public int SizeX => X + Width;
|
||||
public int SizeY => Y + Height;
|
||||
public Rectangle(Vector2 pos, Vector2 size)
|
||||
: this((int) pos.X, (int) pos.Y, (int) size.X, (int) size.Y) { }
|
||||
}
|
||||
|
||||
// From: https://stackoverflow.com/a/306379
|
||||
public static bool CheckRectOverlap(Rectangle a, Rectangle b)
|
||||
/// <summary>
|
||||
/// Checks if two rectangles overlap at any point.
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <returns>True if overlapping</returns>
|
||||
public static bool HasOverlap(this Rectangle a, Rectangle b)
|
||||
{
|
||||
bool ValueInRange(int value, int min, int max)
|
||||
=> value > min && value < max;
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
{
|
||||
"version": 1,
|
||||
"dependencies": {
|
||||
"net8.0-windows7.0": {
|
||||
"net9.0-windows7.0": {
|
||||
"DalamudPackager": {
|
||||
"type": "Direct",
|
||||
"requested": "[11.0.0, )",
|
||||
"resolved": "11.0.0",
|
||||
"contentHash": "bjT7XUlhIJSmsE/O76b7weUX+evvGQctbQB8aKXt94o+oPWxHpCepxAGMs7Thow3AzCyqWs7cOpp9/2wcgRRQA=="
|
||||
"requested": "[12.0.0, )",
|
||||
"resolved": "12.0.0",
|
||||
"contentHash": "J5TJLV3f16T/E2H2P17ClWjtfEBPpq3yxvqW46eN36JCm6wR+EaoaYkqG9Rm5sHqs3/nK/vKjWWyvEs/jhKoXw=="
|
||||
},
|
||||
"DotNet.ReproducibleBuilds": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.2.25, )",
|
||||
"resolved": "1.2.25",
|
||||
"contentHash": "xCXiw7BCxHJ8pF6wPepRUddlh2dlQlbr81gXA72hdk4FLHkKXas7EH/n+fk5UCA/YfMqG1Z6XaPiUjDbUNBUzg=="
|
||||
},
|
||||
"MessagePack": {
|
||||
"type": "Direct",
|
||||
|
||||
Reference in New Issue
Block a user