Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: add an option about the say hello feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Nov 6, 2023
1 parent f1f2c05 commit d014aeb
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Resources/RotationSolverRecord.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"ClickingCount": 56826,
"ClickingCount": 56849,
"SaidUsers": []
}
1 change: 1 addition & 0 deletions RotationSolver.Basic/Configuration/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ public enum PluginConfigBool : byte

[Default(true)] HealWhenNothingTodo,
[Default(true)] UseResourcesAction,
[Default(true)] SayHelloToAll,
[Default(true)] SayHelloToUsers,
[Default(false)] JustSayHelloOnce,

Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Helpers/TargetFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static class TargetFilter
internal static IEnumerable<BattleChara> MeleeRangeTargetFilter(IEnumerable<BattleChara> availableCharas)
=> availableCharas.Where(t => t.DistanceToPlayer() >= 3 + Service.Config.GetValue(PluginConfigFloat.MeleeRangeOffset));

internal static BattleChara DefaultChooseFriend(IEnumerable<BattleChara> availableCharas, bool mustUse)
internal static BattleChara DefaultChooseFriend(IEnumerable<BattleChara> availableCharas, bool _)
{
if (availableCharas == null || !availableCharas.Any()) return null;

Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Localization/ConfigTranslation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ internal static class ConfigTranslation
PluginConfigBool.ToggleAuto => LocalizationManager.RightLang.ConfigWindow_Param_ToggleAuto,
PluginConfigBool.UseStopCasting => LocalizationManager.RightLang.ConfigWindow_Param_UseStopCasting,
PluginConfigBool.SayHelloToUsers => LocalizationManager.RightLang.ConfigWindow_Basic_SayHelloToUsers,
PluginConfigBool.SayHelloToAll => LocalizationManager.RightLang.ConfigWindow_Basic_SayHelloToAll,
PluginConfigBool.JustSayHelloOnce => LocalizationManager.RightLang.ConfigWindow_Basic_JustSayHelloOnce,
PluginConfigBool.UseAdditionalConditions => LocalizationManager.RightLang.ConfigWindow_Basic_UseAdditionalConditions,

Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ internal class Strings

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_SayHelloToAll { get; set; } = "Say hello to all 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!";
public string ConfigWindow_Basic_JustSayHelloOnce { get; set; } = "Just say hello once to the same user.";

Expand Down
35 changes: 22 additions & 13 deletions RotationSolver/UI/RotationConfigWindow_Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -341,21 +341,29 @@ private static void DrawBasicOthers()
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 (Service.Config.GetValue(PluginConfigBool.SayHelloToAll))
{
if (ImGui.Button("DM your Hash to ArchiTed for being greeted."))
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))
{
ImGui.SetClipboardText(str);
Notify.Success($"Your hash \"{str}\" copied to clipboard.");
Util.OpenLink("https://discord.com/users/1007293294100877322");
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");
}
}
}
else
{
ImGui.TextColored(ImGuiColors.DalamudRed, "The author of RS loves being greeted by you!");
}

}

private static readonly ISearchable[] _basicTimer = new ISearchable[]
Expand Down Expand Up @@ -387,8 +395,9 @@ private static void DrawBasicOthers()

new CheckBoxSearchPlugin(PluginConfigBool.UseAdditionalConditions),

new CheckBoxSearchPlugin(PluginConfigBool.SayHelloToUsers),
new CheckBoxSearchPlugin(PluginConfigBool.JustSayHelloOnce),
new CheckBoxSearchPlugin(PluginConfigBool.SayHelloToAll,
new CheckBoxSearchPlugin(PluginConfigBool.SayHelloToUsers),
new CheckBoxSearchPlugin(PluginConfigBool.JustSayHelloOnce)),
};

private static readonly ISearchable[] _basicSwitchTurnOn = new ISearchable[]
Expand Down
5 changes: 5 additions & 0 deletions RotationSolver/Updaters/SocialUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ internal static async void UpdateSocial()
private static readonly ChatEntityComparer _comparer = new();
private static async void SayHelloToUsers()
{
if (!Service.Config.GetValue(PluginConfigBool.SayHelloToUsers))
{
return;
}

var players = DataCenter.AllianceMembers.OfType<PlayerCharacter>()
#if DEBUG
#else
Expand Down

0 comments on commit d014aeb

Please sign in to comment.