diff --git a/Resources/UsersHash.json b/Resources/UsersHash.json index ad8705fa9..707f60393 100644 --- a/Resources/UsersHash.json +++ b/Resources/UsersHash.json @@ -1,3 +1,3 @@ [ - "kkCy7C/6qMb8yhX+VQByCA==" + "Cs5AdOZTzkt2xdRfVaLw9Q==" ] \ No newline at end of file diff --git a/RotationSolver/Helpers/RotationLoadContext.cs b/RotationSolver/Helpers/RotationLoadContext.cs index 5499c6851..f4f227724 100644 --- a/RotationSolver/Helpers/RotationLoadContext.cs +++ b/RotationSolver/Helpers/RotationLoadContext.cs @@ -1,10 +1,7 @@ using System.Runtime.Loader; - using Dalamud.Logging; using Dalamud.Plugin; - using FFXIVClientStructs.Interop; - using Lumina.Excel; using Lumina.Excel.CustomSheets; diff --git a/RotationSolver/Localization/ConfigTranslation.cs b/RotationSolver/Localization/ConfigTranslation.cs index 265731012..da300bcff 100644 --- a/RotationSolver/Localization/ConfigTranslation.cs +++ b/RotationSolver/Localization/ConfigTranslation.cs @@ -249,6 +249,8 @@ internal static class ConfigTranslation PluginConfigBool.MoveTowardsScreenCenter => LocalizationManager.RightLang.ConfigWindow_Param_MoveTowardsScreenDesc, PluginConfigBool.MoveAreaActionFarthest => LocalizationManager.RightLang.ConfigWindow_Param_MoveAreaActionFarthestDesc, + PluginConfigBool.SayHelloToUsers => LocalizationManager.RightLang.ConfigWindow_Basic_SayHelloToUsersDesc, + PluginConfigBool.AutoOpenChest => "Because of the feature in pandora, there is an issue the treasure chest cannot be opened in some cases, I find the code from roll for loot. Once Pandora fixed that, this feature will be deleted.", _ => string.Empty, }; diff --git a/RotationSolver/Localization/Localization.json b/RotationSolver/Localization/Localization.json index 4bb29dacd..cd4f55c00 100644 --- a/RotationSolver/Localization/Localization.json +++ b/RotationSolver/Localization/Localization.json @@ -463,6 +463,7 @@ "ConfigWindow_List_NoHostilesName": "The name of the enemy that you don't want to be targeted", "ConfigWindow_List_NoProvokeName": "The name of the enemy that you don't want to be provoked", "ConfigWindow_Basic_AutoSwitch": "Auto Switch", + "ConfigWindow_Basic_Others": "Others", "ConfigWindow_Basic_Timer": "Timer", "ConfigWindow_UI_Windows": "Windows", "ConfigWindow_UI_Overlay": "Overlay", @@ -522,5 +523,8 @@ "ConfigWindow_Actions_TTK": "TTK that this action needs the target be.", "ConfigWindow_Actions_HealRatio": "The HP ratio to auto heal", "ConfigWindow_Actions_ConditionDescription": "Forced Conditions have a higher priority. If Forced Conditions are met, Disabled Condition will be ignored.", - "ConfigWindow_Auto_UseResourcesAction": "Use actions that use resources" + "ConfigWindow_Auto_UseResourcesAction": "Use actions that use resources", + "ConfigWindow_Auto_HealthForAutoDefense": "HP Ratio about defense single of Tanks", + "ConfigWindow_Basic_SayHelloToUsers": "Say hello to the users of Rotation Solver.", + "ConfigWindow_Basic_SayHelloToUsersDesc": "It can only be disabled for users, not authors and contributors.\nIf you want to be greeted by other users, please DM ArchiTed in Discord Server with your Hash!" } \ No newline at end of file diff --git a/RotationSolver/Localization/Strings.cs b/RotationSolver/Localization/Strings.cs index ba25f17ce..67cfad0aa 100644 --- a/RotationSolver/Localization/Strings.cs +++ b/RotationSolver/Localization/Strings.cs @@ -748,4 +748,5 @@ internal class Strings public string ConfigWindow_Auto_UseResourcesAction { get; set; } = "Use actions that use resources"; public string ConfigWindow_Auto_HealthForAutoDefense { get; set; } = "HP Ratio about defense single of Tanks"; public string ConfigWindow_Basic_SayHelloToUsers { get; set; } = "Say hello to the users of Rotation Solver."; + public string ConfigWindow_Basic_SayHelloToUsersDesc { get; set; } = "It can only be disabled for users, not authors and contributors.\nIf you want to be greeted by other users, please DM ArchiTed in Discord Server with your Hash!"; } \ No newline at end of file diff --git a/RotationSolver/UI/RotationConfigWindow.cs b/RotationSolver/UI/RotationConfigWindow.cs index eac098741..d4c8bd17e 100644 --- a/RotationSolver/UI/RotationConfigWindow.cs +++ b/RotationSolver/UI/RotationConfigWindow.cs @@ -2068,10 +2068,6 @@ private static void DrawDebug() searchable?.Draw(Job); } - var str = SocialUpdater.EncryptString(Player.Object); - ImGui.SetNextItemWidth(ImGui.CalcTextSize(str).X + 10); - ImGui.InputText("That is your HASH", ref str, 100); - if (!Player.Available || !Service.Config.GetValue(PluginConfigBool.InDebug)) return; _debugHeader?.Draw(); diff --git a/RotationSolver/UI/RotationConfigWindow_Config.cs b/RotationSolver/UI/RotationConfigWindow_Config.cs index aaf9542ee..0de61a04b 100644 --- a/RotationSolver/UI/RotationConfigWindow_Config.cs +++ b/RotationSolver/UI/RotationConfigWindow_Config.cs @@ -1,19 +1,24 @@ using Dalamud.Game.ClientState.Keys; using Dalamud.Interface.Colors; +using Dalamud.Utility; +using ECommons.GameHelpers; using ECommons.ImGuiMethods; using RotationSolver.Basic.Configuration; +using RotationSolver.Helpers; using RotationSolver.Localization; using RotationSolver.UI.SearchableConfigs; using RotationSolver.UI.SearchableSettings; +using RotationSolver.Updaters; namespace RotationSolver.UI; public partial class RotationConfigWindow { + private static char[] _splitChar = new char[] { ' ', ',', '、', '.', '。' }; internal static float Similarity(string text, string key) { - var chars = text.Split(new char[] { ' ', ',', '、', '.', '。' }, StringSplitOptions.RemoveEmptyEntries); - var keys = key.Split(new char[] { ' ', ',', '、', '.', '。' }, StringSplitOptions.RemoveEmptyEntries); + var chars = text.Split(_splitChar, StringSplitOptions.RemoveEmptyEntries); + var keys = key.Split(_splitChar, StringSplitOptions.RemoveEmptyEntries); var startWithCount = chars.Count(i => keys.Any(k => i.StartsWith(k, StringComparison.OrdinalIgnoreCase))); @@ -82,13 +87,7 @@ private static void DrawBasic() { { () => LocalizationManager.RightLang.ConfigWindow_Basic_Timer, DrawBasicTimer }, { () => LocalizationManager.RightLang.ConfigWindow_Basic_AutoSwitch, DrawBasicAutoSwitch }, - { () => LocalizationManager.RightLang.ConfigWindow_Basic_Others, () => - { - foreach (var searchable in _basicParamsSearchable) - { - searchable?.Draw(Job); - } - } }, + { () => LocalizationManager.RightLang.ConfigWindow_Basic_Others, DrawBasicOthers }, }); private static readonly uint PING_COLOR = ImGui.ColorConvertFloat4ToU32(ImGuiColors.ParsedGreen); @@ -265,6 +264,30 @@ private static void DrawBasicAutoSwitch() } } + private static void DrawBasicOthers() + { + foreach (var searchable in _basicParamsSearchable) + { + searchable?.Draw(Job); + } + + var str = SocialUpdater.EncryptString(Player.Object); + ImGui.SetNextItemWidth(ImGui.CalcTextSize(str).X + 10); + ImGui.InputText("That is your HASH:", ref str, 100); + + if (!DownloadHelper.ContributorsHash.Contains(str) + && !DownloadHelper.UsersHash.Contains(str) + && !RotationUpdater.AuthorHashes.ContainsKey(str)) + { + if (ImGui.Button("DM your Hash to ArchiTed for being greeted.")) + { + ImGui.SetClipboardText(str); + Notify.Success($"Your hash \"{str}\" copied to clipboard."); + Util.OpenLink("https://discord.com/users/1007293294100877322"); + } + } + } + private static readonly ISearchable[] _basicTimer = new ISearchable[] { new DragFloatSearchPlugin(PluginConfigFloat.ActionAhead, 0.002f), @@ -288,11 +311,11 @@ private static void DrawBasicAutoSwitch() new CheckBoxSearchPlugin(PluginConfigBool.UseWorkTask), - new CheckBoxSearchPlugin(PluginConfigBool.SayHelloToUsers), - new DragFloatSearchPlugin(PluginConfigFloat.MistakeRatio, 0.002f), new DragFloatRangeSearchPlugin(PluginConfigFloat.NotInCombatDelayMin, PluginConfigFloat.NotInCombatDelayMax, 0.002f), + + new CheckBoxSearchPlugin(PluginConfigBool.SayHelloToUsers), }; private static readonly ISearchable[] _basicSwitchTurnOn = new ISearchable[] diff --git a/RotationSolver/Updaters/SocialUpdater.cs b/RotationSolver/Updaters/SocialUpdater.cs index b227298f6..c31a4fb0b 100644 --- a/RotationSolver/Updaters/SocialUpdater.cs +++ b/RotationSolver/Updaters/SocialUpdater.cs @@ -32,7 +32,6 @@ internal class SocialUpdater private static readonly HashSet saidAuthors = new(); - static bool _canSaying = false; public static TerritoryType[] HighEndDuties { get; private set; } = Array.Empty(); @@ -143,15 +142,12 @@ internal static async void UpdateSocial() Service.Config.GlobalConfig.DutyStart.AddMacro(); await Task.Delay(new Random().Next(1000, 1500)); - if (Service.Config.GetValue(Basic.Configuration.PluginConfigBool.SayHelloToUsers)) - { - SayHelloToParticipants(); - } + SayHelloToUsers(); } } private static readonly ChatEntityComparer _comparer = new ChatEntityComparer(); - private static async void SayHelloToParticipants() + private static async void SayHelloToUsers() { var players = DataCenter.AllianceMembers.OfType() #if DEBUG @@ -174,9 +170,12 @@ private static async void SayHelloToParticipants() .Where(p => DownloadHelper.ContributorsHash.Contains(p.Item2)) .Select(p => new ContributorChatEntity(p.player)), _comparer); - entities = entities.Union(players - .Where(p => DownloadHelper.UsersHash.Contains(p.Item2)) - .Select(p => new UserChatEntity(p.player)), _comparer); + if (Service.Config.GetValue(Basic.Configuration.PluginConfigBool.SayHelloToUsers)) + { + entities = entities.Union(players + .Where(p => DownloadHelper.UsersHash.Contains(p.Item2)) + .Select(p => new UserChatEntity(p.player)), _comparer); + } foreach (var entity in entities) {