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

Commit

Permalink
fix: finished the say hello feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 5, 2023
1 parent 1c06b15 commit 840c314
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
1 change: 1 addition & 0 deletions RotationSolver.Extra/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[assembly: AuthorHash("Ig4lHXUohMZNIeheUtAtRg==")]
11 changes: 7 additions & 4 deletions RotationSolver/RotationSolverPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Interface.Windowing;
using Dalamud.Plugin;
Expand Down Expand Up @@ -67,9 +68,9 @@ public unsafe RotationSolverPlugin(DalamudPluginInterface pluginInterface)

RotationUpdater.GetAllCustomRotations();

LinkPayload = pluginInterface.AddChatLinkHandler(6, (id, str) =>
LinkPayload = pluginInterface.AddChatLinkHandler(0, (id, str) =>
{
if(id == 6) OpenConfigWindow();
if(id == 0) OpenConfigWindow();
});
}

Expand Down Expand Up @@ -113,9 +114,11 @@ internal static void OpenConfigWindow()
_comboConfigWindow.Toggle();
}

static RandomDelay validDelay = new RandomDelay(() => (0.2f, 0.2f));

internal static void UpdateDisplayWindow()
{
var isValid = MajorUpdater.IsValid
var isValid = validDelay.Delay(MajorUpdater.IsValid
&& (!Service.Config.OnlyShowWithHostileOrInDuty
|| Service.Conditions[ConditionFlag.BoundByDuty]
|| DataCenter.AllHostileTargets.Any(o => o.DistanceToPlayer() <= 25))
Expand All @@ -125,7 +128,7 @@ internal static void UpdateDisplayWindow()
&& !Service.Conditions[ConditionFlag.BetweenAreas]
&& !Service.Conditions[ConditionFlag.BetweenAreas51]
&& !Service.Conditions[ConditionFlag.WaitingForDuty]
&& !Service.Conditions[ConditionFlag.OccupiedInQuestEvent];
&& !Service.Conditions[ConditionFlag.OccupiedInQuestEvent]);

_controlWindow.IsOpen = isValid && Service.Config.ShowControlWindow;
_nextActionWindow.IsOpen = isValid && Service.Config.ShowNextActionWindow;
Expand Down
17 changes: 14 additions & 3 deletions RotationSolver/Updaters/SocialUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ internal static void Disable()
static RandomDelay socialDelay = new RandomDelay(() => (3, 5));
internal static async void UpdateSocial()
{
if (DataCenter.InCombat || DataCenter.PartyMembers.Count() < 2) return;
if (DataCenter.InCombat) return;
if (_canSaying && socialDelay.Delay(CanSocial))
{
_canSaying = false;
Expand Down Expand Up @@ -137,10 +137,21 @@ private static async void SayHelloToAuthor()
Service.TargetManager.SetTarget(author.c);
Service.SubmitToChat($"/{_macroToAuthor[new Random().Next(_macroToAuthor.Count)]} <t>");
#endif
var message = new SeString(new PlayerPayload(author.c.Name.TextValue, author.c.HomeWorld.Id),
new TextPayload($"({author.nameDesc}) is probably one of the authors of the "),
var message = new SeString(new IconPayload(BitmapFontIcon.Mentor),

new UIForegroundPayload(31),
new PlayerPayload(author.c.Name.TextValue, author.c.HomeWorld.Id),
UIForegroundPayload.UIForegroundOff,

new TextPayload($"({author.nameDesc}) is one of the authors of "),

new IconPayload(BitmapFontIcon.DPS),
RotationSolverPlugin.LinkPayload,
new UIForegroundPayload(31),
new TextPayload("Rotation Solver"),
UIForegroundPayload.UIForegroundOff,
RawPayload.LinkTerminator,

new TextPayload(", so say hello to him/her!"));

Service.ChatGui.PrintChat(new Dalamud.Game.Text.XivChatEntry()
Expand Down

0 comments on commit 840c314

Please sign in to comment.