- Add MuteList and TermsFilter to block functions
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>1.29.13</Version>
|
<Version>1.29.14</Version>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using Dalamud.Game.ClientState.Conditions;
|
using Dalamud.Game.ClientState.Conditions;
|
||||||
|
using Dalamud.Game.Text.SeStringHandling;
|
||||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||||
using Dalamud.Hooking;
|
using Dalamud.Hooking;
|
||||||
using Dalamud.Memory;
|
using Dalamud.Memory;
|
||||||
@@ -61,6 +62,16 @@ internal unsafe class GameFunctions : IDisposable
|
|||||||
ListCommand(name, world, "blist");
|
ListCommand(name, world, "blist");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void AddToMuteList(ulong accountId, ulong contentId, string name, short worldId)
|
||||||
|
{
|
||||||
|
AgentMutelist.Instance()->Add(accountId, contentId, name, worldId);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void AddToTermsList(SeString content)
|
||||||
|
{
|
||||||
|
AgentTermFilter.Instance()->OpenNewFilterWindow(content.EncodeWithNullTerminator());
|
||||||
|
}
|
||||||
|
|
||||||
private void ListCommand(string name, ushort world, string commandName)
|
private void ListCommand(string name, ushort world, string commandName)
|
||||||
{
|
{
|
||||||
var row = Plugin.DataManager.GetExcelSheet<World>().GetRow(world);
|
var row = Plugin.DataManager.GetExcelSheet<World>().GetRow(world);
|
||||||
|
|||||||
+4
-2
@@ -60,6 +60,7 @@ internal partial class Message
|
|||||||
internal Guid Id { get; } = Guid.NewGuid();
|
internal Guid Id { get; } = Guid.NewGuid();
|
||||||
internal ulong Receiver { get; }
|
internal ulong Receiver { get; }
|
||||||
internal ulong ContentId { get; set; }
|
internal ulong ContentId { get; set; }
|
||||||
|
internal ulong AccountId { get; set; } // 0 if not set
|
||||||
|
|
||||||
internal DateTimeOffset Date { get; }
|
internal DateTimeOffset Date { get; }
|
||||||
internal ChatCode Code { get; }
|
internal ChatCode Code { get; }
|
||||||
@@ -77,11 +78,12 @@ internal partial class Message
|
|||||||
internal Dictionary<Guid, float?> Height { get; } = new();
|
internal Dictionary<Guid, float?> Height { get; } = new();
|
||||||
internal Dictionary<Guid, bool> IsVisible { get; } = new();
|
internal Dictionary<Guid, bool> IsVisible { get; } = new();
|
||||||
|
|
||||||
internal Message(ulong receiver, ulong contentId, ChatCode code, List<Chunk> sender, List<Chunk> content, SeString senderSource, SeString contentSource)
|
internal Message(ulong receiver, ulong contentId, ulong accountId, ChatCode code, List<Chunk> sender, List<Chunk> content, SeString senderSource, SeString contentSource)
|
||||||
{
|
{
|
||||||
var extraChatChannel = ExtractExtraChatChannel(contentSource);
|
var extraChatChannel = ExtractExtraChatChannel(contentSource);
|
||||||
Receiver = receiver;
|
Receiver = receiver;
|
||||||
ContentId = contentId;
|
ContentId = contentId;
|
||||||
|
AccountId = accountId;
|
||||||
Date = DateTimeOffset.UtcNow;
|
Date = DateTimeOffset.UtcNow;
|
||||||
Code = code;
|
Code = code;
|
||||||
Sender = sender;
|
Sender = sender;
|
||||||
@@ -119,7 +121,7 @@ internal partial class Message
|
|||||||
|
|
||||||
internal static Message FakeMessage(List<Chunk> content, ChatCode code)
|
internal static Message FakeMessage(List<Chunk> content, ChatCode code)
|
||||||
{
|
{
|
||||||
return new Message(0, 0, code, [], content, new SeString(), new SeString());
|
return new Message(0, 0, 0, code, [], content, new SeString(), new SeString());
|
||||||
}
|
}
|
||||||
|
|
||||||
internal bool Matches(Dictionary<ChatType, ChatSource> channels, bool allExtraChatChannels, HashSet<Guid> extraChatChannels)
|
internal bool Matches(Dictionary<ChatType, ChatSource> channels, bool allExtraChatChannels, HashSet<Guid> extraChatChannels)
|
||||||
|
|||||||
@@ -196,6 +196,7 @@ internal class MessageManager : IAsyncDisposable
|
|||||||
{
|
{
|
||||||
ReceiverId = CurrentContentId,
|
ReceiverId = CurrentContentId,
|
||||||
ContentId = 0,
|
ContentId = 0,
|
||||||
|
AccountId = 0,
|
||||||
Type = type,
|
Type = type,
|
||||||
Timestamp = timestamp,
|
Timestamp = timestamp,
|
||||||
Sender = sender,
|
Sender = sender,
|
||||||
@@ -222,6 +223,7 @@ internal class MessageManager : IAsyncDisposable
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
PendingSync.Last().ContentId = contentId;
|
PendingSync.Last().ContentId = contentId;
|
||||||
|
PendingSync.Last().AccountId = accountId;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProcessMessage(PendingMessage pendingMessage)
|
private void ProcessMessage(PendingMessage pendingMessage)
|
||||||
@@ -247,7 +249,7 @@ internal class MessageManager : IAsyncDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
var contentChunks = ChunkUtil.ToChunks(pendingMessage.Content, ChunkSource.Content, chatCode.Type).ToList();
|
var contentChunks = ChunkUtil.ToChunks(pendingMessage.Content, ChunkSource.Content, chatCode.Type).ToList();
|
||||||
var message = new Message(CurrentContentId, pendingMessage.ContentId, chatCode, senderChunks, contentChunks, pendingMessage.Sender, pendingMessage.Content);
|
var message = new Message(CurrentContentId, pendingMessage.ContentId, pendingMessage.AccountId, chatCode, senderChunks, contentChunks, pendingMessage.Sender, pendingMessage.Content);
|
||||||
|
|
||||||
if (Plugin.Config.DatabaseBattleMessages || !message.Code.IsBattle())
|
if (Plugin.Config.DatabaseBattleMessages || !message.Code.IsBattle())
|
||||||
Store.UpsertMessage(message);
|
Store.UpsertMessage(message);
|
||||||
@@ -331,6 +333,7 @@ internal class MessageManager : IAsyncDisposable
|
|||||||
{
|
{
|
||||||
internal ulong ReceiverId { get; set; }
|
internal ulong ReceiverId { get; set; }
|
||||||
internal ulong ContentId { get; set; } // 0 if unknown
|
internal ulong ContentId { get; set; } // 0 if unknown
|
||||||
|
internal ulong AccountId { get; set; } // 0 if unknown
|
||||||
internal XivChatType Type { get; set; }
|
internal XivChatType Type { get; set; }
|
||||||
internal int Timestamp { get; set; }
|
internal int Timestamp { get; set; }
|
||||||
internal SeString Sender { get; set; }
|
internal SeString Sender { get; set; }
|
||||||
|
|||||||
@@ -565,7 +565,7 @@ public sealed class PayloadHandler
|
|||||||
var leader = (ulong?) party[(int) party.PartyLeaderIndex]?.ContentId;
|
var leader = (ulong?) party[(int) party.PartyLeaderIndex]?.ContentId;
|
||||||
var isLeader = party.Length == 0 || Plugin.ClientState.LocalContentId == leader;
|
var isLeader = party.Length == 0 || Plugin.ClientState.LocalContentId == leader;
|
||||||
var member = party.FirstOrDefault(member => member.Name.TextValue == player.PlayerName && member.World.RowId == world.RowId);
|
var member = party.FirstOrDefault(member => member.Name.TextValue == player.PlayerName && member.World.RowId == world.RowId);
|
||||||
var isInParty = member != default;
|
var isInParty = member != null;
|
||||||
var inInstance = GameFunctions.GameFunctions.IsInInstance();
|
var inInstance = GameFunctions.GameFunctions.IsInInstance();
|
||||||
var inPartyInstance = Sheets.TerritorySheet.GetRow(Plugin.ClientState.TerritoryType).TerritoryIntendedUse.RowId is (41 or 47 or 48 or 52 or 53);
|
var inPartyInstance = Sheets.TerritorySheet.GetRow(Plugin.ClientState.TerritoryType).TerritoryIntendedUse.RowId is (41 or 47 or 48 or 52 or 53);
|
||||||
if (isLeader)
|
if (isLeader)
|
||||||
@@ -605,8 +605,22 @@ public sealed class PayloadHandler
|
|||||||
if (!isFriend && ImGui.Selectable(Language.Context_SendFriendRequest))
|
if (!isFriend && ImGui.Selectable(Language.Context_SendFriendRequest))
|
||||||
LogWindow.Plugin.Functions.SendFriendRequest(player.PlayerName, (ushort) world.RowId);
|
LogWindow.Plugin.Functions.SendFriendRequest(player.PlayerName, (ushort) world.RowId);
|
||||||
|
|
||||||
if (ImGui.Selectable(Language.Context_AddToBlacklist))
|
using var menuBlockFunctions = ImGuiUtil.Menu(Language.Context_BlockFunctions);
|
||||||
LogWindow.Plugin.Functions.AddToBlacklist(player.PlayerName, (ushort) world.RowId);
|
if (menuBlockFunctions.Success)
|
||||||
|
{
|
||||||
|
if (ImGui.Selectable(Language.Context_AddToBlacklist))
|
||||||
|
LogWindow.Plugin.Functions.AddToBlacklist(player.PlayerName, (ushort)world.RowId);
|
||||||
|
|
||||||
|
if (chunk.Message != null)
|
||||||
|
{
|
||||||
|
var message = chunk.Message;
|
||||||
|
if (ImGui.Selectable(Language.Context_AddToMuteList))
|
||||||
|
LogWindow.Plugin.Functions.AddToMuteList(message.AccountId, message.ContentId, player.PlayerName, (short) world.RowId);
|
||||||
|
|
||||||
|
if (ImGui.Selectable(Language.Context_AddToTermsFilter))
|
||||||
|
LogWindow.Plugin.Functions.AddToTermsList(message.ContentSource);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (GameFunctions.GameFunctions.IsMentor() && ImGui.Selectable(Language.Context_InviteToNoviceNetwork))
|
if (GameFunctions.GameFunctions.IsMentor() && ImGui.Selectable(Language.Context_InviteToNoviceNetwork))
|
||||||
GameFunctions.Context.InviteToNoviceNetwork(player.PlayerName, (ushort) world.RowId);
|
GameFunctions.Context.InviteToNoviceNetwork(player.PlayerName, (ushort) world.RowId);
|
||||||
|
|||||||
Generated
+27
@@ -1094,6 +1094,24 @@ namespace ChatTwo.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Register to Mute List.
|
||||||
|
/// </summary>
|
||||||
|
internal static string Context_AddToMuteList {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Context_AddToMuteList", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Add to Term Filters.
|
||||||
|
/// </summary>
|
||||||
|
internal static string Context_AddToTermsFilter {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Context_AddToTermsFilter", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to View Adventurer Plate.
|
/// Looks up a localized string similar to View Adventurer Plate.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1112,6 +1130,15 @@ namespace ChatTwo.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Block Functions.
|
||||||
|
/// </summary>
|
||||||
|
internal static string Context_BlockFunctions {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Context_BlockFunctions", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Copy.
|
/// Looks up a localized string similar to Copy.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -679,6 +679,9 @@
|
|||||||
<data name="Context_InviteToParty">
|
<data name="Context_InviteToParty">
|
||||||
<value>Invite to Party</value>
|
<value>Invite to Party</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Context_BlockFunctions">
|
||||||
|
<value>Block Functions</value>
|
||||||
|
</data>
|
||||||
<data name="Context_InviteToParty_SameWorld">
|
<data name="Context_InviteToParty_SameWorld">
|
||||||
<value>Same world</value>
|
<value>Same world</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -697,6 +700,12 @@
|
|||||||
<data name="Context_AddToBlacklist">
|
<data name="Context_AddToBlacklist">
|
||||||
<value>Add to Blacklist</value>
|
<value>Add to Blacklist</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Context_AddToMuteList">
|
||||||
|
<value>Register to Mute List</value>
|
||||||
|
</data>
|
||||||
|
<data name="Context_AddToTermsFilter">
|
||||||
|
<value>Add to Term Filters</value>
|
||||||
|
</data>
|
||||||
<data name="Context_InviteToNoviceNetwork">
|
<data name="Context_InviteToNoviceNetwork">
|
||||||
<value>Invite to Novice Network</value>
|
<value>Invite to Novice Network</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
Reference in New Issue
Block a user