chore: pull out context menu strings

This commit is contained in:
Anna 2022-06-01 21:34:45 -04:00
parent 68fd866913
commit 3d9d65e80e
3 changed files with 214 additions and 24 deletions

View File

@ -1,6 +1,7 @@
using System.Numerics;
using System.Reflection;
using ChatTwo.Code;
using ChatTwo.Resources;
using ChatTwo.Ui;
using ChatTwo.Util;
using Dalamud.Game.ClientState.Objects.SubKinds;
@ -91,7 +92,7 @@ internal sealed class PayloadHandler {
.Select(chunk => chunk.Link)
.FirstOrDefault(chunk => chunk is PlayerPayload) as PlayerPayload;
if (ImGui.BeginMenu("Integrations")) {
if (ImGui.BeginMenu(Language.Context_Integrations)) {
foreach (var id in registered) {
try {
this.Ui.Plugin.Ipc.Invoke(id, sender, contentId, payload, chunk.Message?.SenderSource, chunk.Message?.ContentSource);
@ -113,14 +114,14 @@ internal sealed class PayloadHandler {
return;
}
ImGui.Checkbox("Screenshot mode", ref this.Ui.ScreenshotMode);
ImGui.Checkbox(Language.Context_ScreenshotMode, ref this.Ui.ScreenshotMode);
if (ImGui.Selectable("Hide chat")) {
if (ImGui.Selectable(Language.Context_HideChat)) {
this.Log.UserHide();
}
if (chunk.Message is { } message) {
if (ImGui.BeginMenu("Copy")) {
if (ImGui.BeginMenu(Language.Context_Copy)) {
var text = message.Sender
.Concat(message.Content)
.Where(chunk => chunk is TextChunk)
@ -365,30 +366,30 @@ internal sealed class PayloadHandler {
var realItemId = payload.RawItemId;
if (item.EquipSlotCategory.Row != 0) {
if (ImGui.Selectable("Try On")) {
if (ImGui.Selectable(Language.Context_TryOn)) {
this.Ui.Plugin.Functions.Context.TryOn(realItemId, 0);
}
if (ImGui.Selectable("Item Comparison")) {
if (ImGui.Selectable(Language.Context_ItemComparison)) {
this.Ui.Plugin.Functions.Context.OpenItemComparison(realItemId);
}
}
if (item.ItemSearchCategory.Value?.Category == 3) {
if (ImGui.Selectable("Search Recipes Using This Material")) {
if (ImGui.Selectable(Language.Context_SearchRecipes)) {
this.Ui.Plugin.Functions.Context.SearchForRecipesUsingItem(payload.ItemId);
}
}
if (ImGui.Selectable("Search for Item")) {
if (ImGui.Selectable(Language.Context_SearchForItem)) {
this.Ui.Plugin.Functions.Context.SearchForItem(realItemId);
}
if (ImGui.Selectable("Link")) {
if (ImGui.Selectable(Language.Context_Link)) {
this.Ui.Plugin.Functions.Context.LinkItem(realItemId);
}
if (ImGui.Selectable("Copy Item Name")) {
if (ImGui.Selectable(Language.Context_CopyItemName)) {
ImGui.SetClipboardText(name.TextValue);
}
}
@ -413,11 +414,11 @@ internal sealed class PayloadHandler {
var realItemId = payload.RawItemId;
if (ImGui.Selectable("Link")) {
if (ImGui.Selectable(Language.Context_Link)) {
this.Ui.Plugin.Functions.Context.LinkItem(realItemId);
}
if (ImGui.Selectable("Copy Item Name")) {
if (ImGui.Selectable(Language.Context_CopyItemName)) {
ImGui.SetClipboardText(name.TextValue);
}
}
@ -434,7 +435,7 @@ internal sealed class PayloadHandler {
this.Log.DrawChunks(name, false);
ImGui.Separator();
if (ImGui.Selectable("Send Tell")) {
if (ImGui.Selectable(Language.Context_SendTell)) {
this.Log.Chat = $"/tell {player.PlayerName}";
if (player.World.IsPublic) {
this.Log.Chat += $"@{player.World.Name}";
@ -455,15 +456,15 @@ internal sealed class PayloadHandler {
if (isLeader) {
if (!isInParty) {
if (inInstance && inPartyInstance) {
if (chunk.Message?.ContentId is not null or 0 && ImGui.Selectable("Invite to Party")) {
if (chunk.Message?.ContentId is not null or 0 && ImGui.Selectable(Language.Context_InviteToParty)) {
this.Ui.Plugin.Functions.Party.InviteInInstance(chunk.Message!.ContentId);
}
} else if (!inInstance && ImGui.BeginMenu("Invite to Party")) {
if (ImGui.Selectable("Same world")) {
} else if (!inInstance && ImGui.BeginMenu(Language.Context_InviteToParty)) {
if (ImGui.Selectable(Language.Context_InviteToParty_SameWorld)) {
this.Ui.Plugin.Functions.Party.InviteSameWorld(player.PlayerName, (ushort) player.World.RowId, chunk.Message?.ContentId ?? 0);
}
if (chunk.Message?.ContentId is not null or 0 && ImGui.Selectable("Different world")) {
if (chunk.Message?.ContentId is not null or 0 && ImGui.Selectable(Language.Context_InviteToParty_DifferentWorld)) {
this.Ui.Plugin.Functions.Party.InviteOtherWorld(chunk.Message!.ContentId);
}
@ -472,37 +473,37 @@ internal sealed class PayloadHandler {
}
if (isInParty && member != null && (!inInstance || (inInstance && inPartyInstance))) {
if (ImGui.Selectable("Promote")) {
if (ImGui.Selectable(Language.Context_Promote)) {
this.Ui.Plugin.Functions.Party.Promote(player.PlayerName, (ulong) member.ContentId);
}
if (ImGui.Selectable("Kick from Party")) {
if (ImGui.Selectable(Language.Context_KickFromParty)) {
this.Ui.Plugin.Functions.Party.Kick(player.PlayerName, (ulong) member.ContentId);
}
}
}
var isFriend = this.Ui.Plugin.Common.Functions.FriendList.List.Any(friend => friend.Name.TextValue == player.PlayerName && friend.HomeWorld == player.World.RowId);
if (!isFriend && ImGui.Selectable("Send Friend Request")) {
if (!isFriend && ImGui.Selectable(Language.Context_SendFriendRequest)) {
this.Ui.Plugin.Functions.SendFriendRequest(player.PlayerName, (ushort) player.World.RowId);
}
if (ImGui.Selectable("Add to Blacklist")) {
if (ImGui.Selectable(Language.Context_AddToBlacklist)) {
this.Ui.Plugin.Functions.AddToBlacklist(player.PlayerName, (ushort) player.World.RowId);
}
if (this.Ui.Plugin.Functions.IsMentor() && ImGui.Selectable("Invite to Novice Network")) {
if (this.Ui.Plugin.Functions.IsMentor() && ImGui.Selectable(Language.Context_InviteToNoviceNetwork)) {
this.Ui.Plugin.Functions.Context.InviteToNoviceNetwork(player.PlayerName, (ushort) player.World.RowId);
}
}
var inputChannel = chunk.Message?.Code.Type.ToInputChannel();
if (inputChannel != null && ImGui.Selectable("Reply in Selected Chat Mode")) {
if (inputChannel != null && ImGui.Selectable(Language.Context_ReplyInSelectedChatMode)) {
this.Ui.Plugin.Functions.Chat.SetChannel(inputChannel.Value);
this.Log.Activate = true;
}
if (ImGui.Selectable("Target") && this.FindCharacterForPayload(player) is { } obj) {
if (ImGui.Selectable(Language.Context_Target) && this.FindCharacterForPayload(player) is { } obj) {
this.Ui.Plugin.TargetManager.SetTarget(obj);
}

View File

@ -872,5 +872,131 @@ namespace ChatTwo.Resources {
return ResourceManager.GetString("ExtraGlyphRanges_Vietnamese_Name", resourceCulture);
}
}
internal static string Context_Integrations {
get {
return ResourceManager.GetString("Context_Integrations", resourceCulture);
}
}
internal static string Context_ScreenshotMode {
get {
return ResourceManager.GetString("Context_ScreenshotMode", resourceCulture);
}
}
internal static string Context_HideChat {
get {
return ResourceManager.GetString("Context_HideChat", resourceCulture);
}
}
internal static string Context_Copy {
get {
return ResourceManager.GetString("Context_Copy", resourceCulture);
}
}
internal static string Context_TryOn {
get {
return ResourceManager.GetString("Context_TryOn", resourceCulture);
}
}
internal static string Context_ItemComparison {
get {
return ResourceManager.GetString("Context_ItemComparison", resourceCulture);
}
}
internal static string Context_SearchRecipes {
get {
return ResourceManager.GetString("Context_SearchRecipes", resourceCulture);
}
}
internal static string Context_SearchForItem {
get {
return ResourceManager.GetString("Context_SearchForItem", resourceCulture);
}
}
internal static string Context_Link {
get {
return ResourceManager.GetString("Context_Link", resourceCulture);
}
}
internal static string Context_CopyItemName {
get {
return ResourceManager.GetString("Context_CopyItemName", resourceCulture);
}
}
internal static string Context_SendTell {
get {
return ResourceManager.GetString("Context_SendTell", resourceCulture);
}
}
internal static string Context_InviteToParty {
get {
return ResourceManager.GetString("Context_InviteToParty", resourceCulture);
}
}
internal static string Context_InviteToParty_SameWorld {
get {
return ResourceManager.GetString("Context_InviteToParty_SameWorld", resourceCulture);
}
}
internal static string Context_InviteToParty_DifferentWorld {
get {
return ResourceManager.GetString("Context_InviteToParty_DifferentWorld", resourceCulture);
}
}
internal static string Context_Promote {
get {
return ResourceManager.GetString("Context_Promote", resourceCulture);
}
}
internal static string Context_KickFromParty {
get {
return ResourceManager.GetString("Context_KickFromParty", resourceCulture);
}
}
internal static string Context_SendFriendRequest {
get {
return ResourceManager.GetString("Context_SendFriendRequest", resourceCulture);
}
}
internal static string Context_AddToBlacklist {
get {
return ResourceManager.GetString("Context_AddToBlacklist", resourceCulture);
}
}
internal static string Context_InviteToNoviceNetwork {
get {
return ResourceManager.GetString("Context_InviteToNoviceNetwork", resourceCulture);
}
}
internal static string Context_ReplyInSelectedChatMode {
get {
return ResourceManager.GetString("Context_ReplyInSelectedChatMode", resourceCulture);
}
}
internal static string Context_Target {
get {
return ResourceManager.GetString("Context_Target", resourceCulture);
}
}
}
}

View File

@ -536,4 +536,67 @@
<data name="ExtraGlyphRanges_Vietnamese_Name" xml:space="preserve">
<value>Vietnamese</value>
</data>
<data name="Context_Integrations" xml:space="preserve">
<value>Integrations</value>
</data>
<data name="Context_ScreenshotMode" xml:space="preserve">
<value>Screenshot mode</value>
</data>
<data name="Context_HideChat" xml:space="preserve">
<value>Hide chat</value>
</data>
<data name="Context_Copy" xml:space="preserve">
<value>Copy</value>
</data>
<data name="Context_TryOn" xml:space="preserve">
<value>Try On</value>
</data>
<data name="Context_ItemComparison" xml:space="preserve">
<value>Item Comparison</value>
</data>
<data name="Context_SearchRecipes" xml:space="preserve">
<value>Search Recipes Using This Material</value>
</data>
<data name="Context_SearchForItem" xml:space="preserve">
<value>Search for Item</value>
</data>
<data name="Context_Link" xml:space="preserve">
<value>Link</value>
</data>
<data name="Context_CopyItemName" xml:space="preserve">
<value>Copy Item Name</value>
</data>
<data name="Context_SendTell" xml:space="preserve">
<value>Send Tell</value>
</data>
<data name="Context_InviteToParty" xml:space="preserve">
<value>Invite to Party</value>
</data>
<data name="Context_InviteToParty_SameWorld" xml:space="preserve">
<value>Same world</value>
</data>
<data name="Context_InviteToParty_DifferentWorld" xml:space="preserve">
<value>Different world</value>
</data>
<data name="Context_Promote" xml:space="preserve">
<value>Promote</value>
</data>
<data name="Context_KickFromParty" xml:space="preserve">
<value>Kick from Party</value>
</data>
<data name="Context_SendFriendRequest" xml:space="preserve">
<value>Send Friend Request</value>
</data>
<data name="Context_AddToBlacklist" xml:space="preserve">
<value>Add to Blacklist</value>
</data>
<data name="Context_InviteToNoviceNetwork" xml:space="preserve">
<value>Invite to Novice Network</value>
</data>
<data name="Context_ReplyInSelectedChatMode" xml:space="preserve">
<value>Reply in Selected Chat Mode</value>
</data>
<data name="Context_Target" xml:space="preserve">
<value>Target</value>
</data>
</root>