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

Commit

Permalink
fix: add just say once option.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Sep 28, 2023
1 parent f9cec3e commit e24738c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions RotationSolver.Basic/Configuration/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ public enum PluginConfigBool : byte
[Default(true)] HealWhenNothingTodo,
[Default(true)] UseResourcesAction,
[Default(true)] SayHelloToUsers,
[Default(false)] JustSayHelloOnce,
}

public enum PluginConfigFloat : byte
Expand Down
5 changes: 5 additions & 0 deletions RotationSolver.Basic/Configuration/RotationSolverRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ public class RotationSolverRecord
/// How many times have rs clicked for you
/// </summary>
public uint ClickingCount { get; set; } = 0;

/// <summary>
/// The users that already said hello.
/// </summary>
public HashSet<string> SaidUsers { get; set; } = new HashSet<string>();
}
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.JustSayHelloOnce => LocalizationManager.RightLang.ConfigWindow_Basic_JustSayHelloOnce,

// UI
PluginConfigBool.HideWarning => LocalizationManager.RightLang.ConfigWindow_UI_HideWarning,
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,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_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.";

public string ConfigWindow_About_Clicking100k { get; set; } = "Well, you must be a lazy player!";
public string ConfigWindow_About_Clicking500k { get; set; } = "You're tiring RS out, give it a break!";
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/UI/RotationConfigWindow_Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ private static void DrawBasicOthers()
new DragFloatRangeSearchPlugin(PluginConfigFloat.NotInCombatDelayMin, PluginConfigFloat.NotInCombatDelayMax, 0.002f),

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

private static readonly ISearchable[] _basicSwitchTurnOn = new ISearchable[]
Expand Down
11 changes: 9 additions & 2 deletions RotationSolver/Updaters/SocialUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using ECommons.GameHelpers;
using FFXIVClientStructs.FFXIV.Client.UI;
using Lumina.Excel.GeneratedSheets;
using RotationSolver.Basic.Configuration;
using RotationSolver.Helpers;
using RotationSolver.Localization;
using System.Diagnostics.CodeAnalysis;
Expand Down Expand Up @@ -155,7 +156,8 @@ private static async void SayHelloToUsers()
.Where(c => c.ObjectId != Player.Object.ObjectId)
#endif
.Select(player => (player, EncryptString(player)))
.Where(pair => !saidAuthors.Contains(pair.Item2));
.Where(pair => !saidAuthors.Contains(pair.Item2)
&& !OtherConfiguration.RotationSolverRecord.SaidUsers.Contains(pair.Item2));

IEnumerable<ChatEntity> entities = players
.Select(c =>
Expand Down Expand Up @@ -262,7 +264,12 @@ public ChatEntity(PlayerCharacter character)

public void Dispose()
{
saidAuthors.Add(EncryptString(player));
var hash = EncryptString(player);
saidAuthors.Add(hash);
if (Service.Config.GetValue(PluginConfigBool.JustSayHelloOnce))
{
OtherConfiguration.RotationSolverRecord.SaidUsers.Add(hash);
}
}
}

Expand Down

0 comments on commit e24738c

Please sign in to comment.