Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions Visibility/Handlers/ChatHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Dalamud.Game.Text.SeStringHandling.Payloads;

using Visibility.Configuration;
using Visibility.Void;


namespace Visibility.Handlers;
Expand Down Expand Up @@ -49,12 +50,33 @@ private void OnChatMessage(IHandleableChatMessage message)
return;
}

if (this.configuration.VoidList.Any(x =>
x.HomeworldId ==
(isEmoteType ? emotePlayerPayload?.World.RowId : playerPayload?.World.RowId)
&& x.Name == (isEmoteType ? emotePlayerPayload?.PlayerName : playerPayload?.PlayerName)))
PlayerPayload? payload = isEmoteType ? emotePlayerPayload : playerPayload;
uint? worldId = payload?.World.RowId;
string? name = payload?.PlayerName;

VoidItem? match = this.configuration.VoidList
.FirstOrDefault(x => x.HomeworldId == worldId && x.Name == name);

if (match == null)
{
message.PreventOriginal();
return;
}

if (match.ShowPublicChat && IsPublicChannel(message.LogKind))
{
return;
}

message.PreventOriginal();
}

private static bool IsPublicChannel(XivChatType chatType) => chatType is
XivChatType.Say or
XivChatType.Shout or
XivChatType.Yell or
XivChatType.CustomEmote or
XivChatType.StandardEmote or
XivChatType.Party or
XivChatType.CrossParty or
XivChatType.Alliance;
}
2 changes: 2 additions & 0 deletions Visibility/Languages/de-DE/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"ColumnWorld": "Welt",
"ColumnDate": "Datum",
"ColumnReason": "Begründung",
"ColumnPublicChat": "Öffentlicher Chat",
"ColumnPublicChatTooltip": "Zeigt Sagen-, Rufen-, Schreien-, Emote-, Gruppen- und Allianz-Nachrichten dieses Spielers an. Flüster-, Freie-Gesellschaft-, Kontaktkreis- und alle anderen Kanäle bleiben ausgeblendet.",
"ColumnAction": "Aktion",
"OptionLanguage": "Sprache",
"LanguageName": "Deutsch",
Expand Down
2 changes: 2 additions & 0 deletions Visibility/Languages/en-US/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"ColumnWorld": "World",
"ColumnDate": "Date",
"ColumnReason": "Reason",
"ColumnPublicChat": "Public chat",
"ColumnPublicChatTooltip": "Show this player's say, shout, yell, emote, party and alliance messages. Tells, free company, linkshell and all other channels stay hidden.",
"ColumnAction": "Action",
"OptionLanguage": "Language",
"LanguageName": "English",
Expand Down
2 changes: 2 additions & 0 deletions Visibility/Languages/es-ES/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"ColumnWorld": "Mundo",
"ColumnDate": "Fecha",
"ColumnReason": "Razón",
"ColumnPublicChat": "Chat público",
"ColumnPublicChatTooltip": "Muestra los mensajes de say, shout, yell, emotes, party y alianza de este jugador. Los tells, los mensajes de FC y linkshell y todos los demás canales permanecen ocultos.",
"ColumnAction": "Acción",
"OptionLanguage": "Idioma",
"LanguageName": "Español",
Expand Down
2 changes: 2 additions & 0 deletions Visibility/Languages/fr-FR/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"ColumnWorld": "Monde",
"ColumnDate": "Date",
"ColumnReason": "Motif",
"ColumnPublicChat": "Chat public",
"ColumnPublicChatTooltip": "Affiche les messages dire, crier, hurler, emotes, équipe et alliance de ce joueur. Les messages privés, de compagnie libre, de contact et de tous les autres canaux restent masqués.",
"ColumnAction": "Action",
"OptionLanguage": "Langue",
"LanguageName": "Français",
Expand Down
2 changes: 2 additions & 0 deletions Visibility/Languages/it-IT/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"ColumnWorld": "Mondo",
"ColumnDate": "Data",
"ColumnReason": "Motivo",
"ColumnPublicChat": "Chat pubblica",
"ColumnPublicChatTooltip": "Mostra i messaggi say, shout, yell, emote, gruppo e alleanza di questo giocatore. I tell, i messaggi di FC e linkshell e tutti gli altri canali restano nascosti.",
"ColumnAction": "Azione",
"OptionLanguage": "Lingua",
"LanguageName": "Italiano",
Expand Down
2 changes: 2 additions & 0 deletions Visibility/Languages/ja-JP/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"ColumnWorld": "ワールド",
"ColumnDate": "日付",
"ColumnReason": "理由",
"ColumnPublicChat": "公開チャット",
"ColumnPublicChatTooltip": "このプレイヤーのSay、Shout、Yell、エモート、パーティ、アライアンスのメッセージを表示します。テル、フリーカンパニー、リンクシェル、その他すべてのチャンネルのメッセージは非表示のままです。",
"ColumnAction": "動作",
"OptionLanguage": "言語",
"LanguageName": "日本語",
Expand Down
2 changes: 2 additions & 0 deletions Visibility/Languages/pt-BR/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"ColumnWorld": "Mundo",
"ColumnDate": "Data",
"ColumnReason": "Motivo",
"ColumnPublicChat": "Chat público",
"ColumnPublicChatTooltip": "Mostra as mensagens de say, shout, yell, emotes, party e aliança deste jogador. Tells, mensagens de FC e linkshell e todos os outros canais continuam ocultos.",
"ColumnAction": "Ação",
"OptionLanguage": "Idioma",
"LanguageName": "Português",
Expand Down
2 changes: 2 additions & 0 deletions Visibility/Languages/ru-RU/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"ColumnWorld": "Мир",
"ColumnDate": "Дата",
"ColumnReason": "Причина",
"ColumnPublicChat": "Общий чат",
"ColumnPublicChatTooltip": "Показывать сообщения этого игрока в say, shout, yell, эмоции, группе и альянсе. Личные сообщения (tell), сообщения FC и linkshell, а также все остальные каналы останутся скрытыми.",
"ColumnAction": "Действие",
"OptionLanguage": "Язык",
"LanguageName": "Русский",
Expand Down
2 changes: 2 additions & 0 deletions Visibility/Languages/sv-SE/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"ColumnWorld": "Värld",
"ColumnDate": "Datum",
"ColumnReason": "Anledning",
"ColumnPublicChat": "Offentlig chatt",
"ColumnPublicChatTooltip": "Visar denna spelares meddelanden i say, shout, yell, emotes, grupp och allians. Tells, FC- och linkshell-meddelanden samt alla andra kanaler förblir dolda.",
"ColumnAction": "Handling",
"OptionLanguage": "Språk",
"LanguageName": "svenska",
Expand Down
2 changes: 2 additions & 0 deletions Visibility/Languages/zh-CN/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"ColumnWorld": "服务器",
"ColumnDate": "日期",
"ColumnReason": "原因",
"ColumnPublicChat": "公共聊天",
"ColumnPublicChatTooltip": "显示该玩家的说话、呼喊、喊话、情感动作、小队和团队消息。密语、部队、通讯贝以及所有其他频道的消息仍将被隐藏。",
"ColumnAction": "操作",
"OptionLanguage": "语言",
"LanguageName": "简体中文",
Expand Down
2 changes: 2 additions & 0 deletions Visibility/Languages/zh-TW/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"ColumnWorld": "服務器",
"ColumnDate": "日期",
"ColumnReason": "原因",
"ColumnPublicChat": "公共聊天",
"ColumnPublicChatTooltip": "顯示該玩家的說話、呼喊、喊話、情感動作、小隊和團隊訊息。密語、部隊、通訊貝以及所有其他頻道的訊息仍會被隱藏。",
"ColumnAction": "操作",
"OptionLanguage": "語言",
"LanguageName": "繁體中文",
Expand Down
5 changes: 5 additions & 0 deletions Visibility/Localization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ public string ContextMenuRemove(string name) =>
public string ColumnWorld => this.GetString("ColumnWorld", this.CurrentLanguage);
public string ColumnDate => this.GetString("ColumnDate", this.CurrentLanguage);
public string ColumnReason => this.GetString("ColumnReason", this.CurrentLanguage);
public string ColumnPublicChat => this.GetString("ColumnPublicChat", this.CurrentLanguage);

public string ColumnPublicChatTooltip =>
this.GetString("ColumnPublicChatTooltip", this.CurrentLanguage);

public string ColumnAction => this.GetString("ColumnAction", this.CurrentLanguage);
public string OptionLanguage => this.GetString("OptionLanguage", this.CurrentLanguage);
public string LanguageName => this.GetString("LanguageName", this.CurrentLanguage);
Expand Down
5 changes: 4 additions & 1 deletion Visibility/Void/VoidItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public string Name
public uint HomeworldId { get; set; }
public string Reason { get; set; } = string.Empty;
public bool Manual { get; set; }
public bool ShowPublicChat { get; set; }

[JsonConstructor]
public VoidItem(
Expand All @@ -52,7 +53,8 @@ public VoidItem(
DateTime time,
uint homeworldId,
string reason,
bool manual): this()
bool manual,
bool showPublicChat): this()
{
this.Version = version;
this.Id = id;
Expand All @@ -62,5 +64,6 @@ public VoidItem(
this.HomeworldId = homeworldId;
this.Reason = reason;
this.Manual = manual;
this.ShowPublicChat = showPublicChat;
}
}
34 changes: 33 additions & 1 deletion Visibility/Windows/VoidItemList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public override void Draw()
{
if (!ImGui.BeginTable(
this.isWhitelist ? "WhitelistTable" : "VoidListTable",
6,
this.isWhitelist ? 6 : 7,
ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollY | ImGuiTableFlags.Sortable))
{
return;
Expand All @@ -71,6 +71,14 @@ public override void Draw()
this.pluginLocalization.ColumnDate,
ImGuiTableColumnFlags.DefaultSort);
ImGui.TableSetupColumn(this.pluginLocalization.ColumnReason);

if (!this.isWhitelist)
{
ImGui.TableSetupColumn(
this.pluginLocalization.ColumnPublicChat,
ImGuiTableColumnFlags.NoSort);
}

ImGui.TableSetupColumn(this.pluginLocalization.ColumnAction, ImGuiTableColumnFlags.NoSort);
ImGui.TableSetupScrollFreeze(0, 1);
ImGui.TableHeadersRow();
Expand Down Expand Up @@ -123,6 +131,24 @@ public override void Draw()
ImGui.Text(item.Time.ToString(CultureInfo.CurrentCulture));
ImGui.TableNextColumn();
ImGui.TextUnformatted(item.Reason);

if (!this.isWhitelist)
{
ImGui.TableNextColumn();
bool showPublicChat = item.ShowPublicChat;

if (ImGui.Checkbox($"##showPublicChat{item.Name}{item.HomeworldId}", ref showPublicChat))
{
item.ShowPublicChat = showPublicChat;
this.configuration.Save();
}

if (ImGui.IsItemHovered())
{
ImGui.SetTooltip(this.pluginLocalization.ColumnPublicChatTooltip);
}
}

ImGui.TableNextColumn();

if (ImGui.Button($"{this.pluginLocalization.OptionRemovePlayer}##{item.Name}"))
Expand Down Expand Up @@ -207,6 +233,12 @@ public override void Draw()
ImGui.TableNextColumn();
ImGui.TableNextColumn();
ImGui.InputText("###reason", this.buffer[3]);

if (!this.isWhitelist)
{
ImGui.TableNextColumn();
}

ImGui.TableNextColumn();

if (ImGui.Button(this.pluginLocalization.OptionAddPlayer))
Expand Down