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

Commit

Permalink
fix: add some default center position in the trails and raids.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Sep 28, 2023
1 parent 0efd7fd commit f9cec3e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 10 deletions.
19 changes: 17 additions & 2 deletions RotationSolver.Basic/Actions/BaseAction_Target.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Logging;
using ECommons;
using ECommons.DalamudServices;
using ECommons.ExcelServices;
using ECommons.GameFunctions;
using ECommons.GameHelpers;
using FFXIVClientStructs.FFXIV.Client.Game;
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
using RotationSolver.Basic.Configuration;
using System.Runtime.InteropServices;

namespace RotationSolver.Basic.Actions;

Expand Down Expand Up @@ -226,9 +228,21 @@ private bool TargetAreaFriend(float range, bool mustUse, PlayerCharacter player)
{
case 0: // Find from list
case 1: // Only the list
OtherConfiguration.BeneficialPositions.TryGetValue(Svc.ClientState.TerritoryType, out var pts);

if (OtherConfiguration.BeneficialPositions.TryGetValue(Svc.ClientState.TerritoryType, out var pts)
&& pts != null && pts.Length > 0)
pts ??= Array.Empty<Vector3>();

if (pts.Length == 0)
{
if (DataCenter.TerritoryContentType == TerritoryContentType.Trials ||
DataCenter.TerritoryContentType == TerritoryContentType.Raids
&& DataCenter.AllianceMembers.Count(p => p is PlayerCharacter) == 8)
{
pts = pts.Union(new Vector3[] { Vector3.Zero, new Vector3(100, 0, 100) }).ToArray();
}
}

if (pts.Length > 0)
{
var closest = pts.MinBy(p => Vector3.Distance(player.Position, p));
var rotation = new Random().NextDouble() * Math.Tau;
Expand All @@ -244,6 +258,7 @@ private bool TargetAreaFriend(float range, bool mustUse, PlayerCharacter player)

if (strategy == 1) return false;
break;

case 2: // Target
if(Svc.Targets.Target != null && Svc.Targets.Target.DistanceToPlayer() < range)
{
Expand Down
5 changes: 4 additions & 1 deletion RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,6 @@ internal class Strings
public string ConfigWindow_Basic_ClickingDuration { get; set; } = "The clicking duration, RS will try to click at this moment.";
public string ConfigWindow_Basic_WeaponDelay { get; set; } = "This is the clipping time.\nGCD is over. However, RS forgets to click the next action.";
public string ConfigWindow_About_ClickingCount { get; set; } = "Rotation Solver helped you by clicking actions {0:N0} times.";
public string ConfigWindow_About_ClickingTooMuch { get; set; } = "Well, you must be a lazy player!";
public string ConfigWindow_Auto_AutoHealTimeToKill { get; set; } = "Stop healing when time to kill is lower then...";
public string ConfigWindow_UI_ShowHostiles { get; set; } = "Show the hostile target icon";
public string ConfigWindow_UI_HostileIconHeight { get; set; } = "Hostile Icon height from position";
Expand Down Expand Up @@ -749,4 +748,8 @@ 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_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!";

}
24 changes: 17 additions & 7 deletions RotationSolver/UI/RotationConfigWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
using RotationSolver.UI.SearchableConfigs;
using RotationSolver.UI.SearchableSettings;
using RotationSolver.Updaters;
using System;
using System.Diagnostics;
using GAction = Lumina.Excel.GeneratedSheets.Action;

Expand Down Expand Up @@ -472,6 +471,13 @@ private void DrawBody()
}

#region About

private static readonly SortedList<uint, string> CountStringPair = new SortedList<uint, string>()
{
{ 100_000, LocalizationManager.RightLang.ConfigWindow_About_Clicking100k },
{ 500_000, LocalizationManager.RightLang.ConfigWindow_About_Clicking500k },
};

private static void DrawAbout()
{
ImGui.PushFont(ImGuiHelper.GetFont(18));
Expand Down Expand Up @@ -505,18 +511,22 @@ private static void DrawAbout()
ImGui.TextWrapped(countStr);
}, width, ImGui.CalcTextSize(countStr).X);

if (clickingCount >= 100_000)
foreach (var pair in CountStringPair.Reverse())
{
countStr = LocalizationManager.RightLang.ConfigWindow_About_ClickingTooMuch;
ImGuiHelper.DrawItemMiddle(() =>
if (clickingCount >= pair.Key)
{
ImGui.TextWrapped(countStr);
}, width, ImGui.CalcTextSize(countStr).X);
countStr = pair.Value;
ImGuiHelper.DrawItemMiddle(() =>
{
ImGui.TextWrapped(countStr);
}, width, ImGui.CalcTextSize(countStr).X);
break;
}
}

ImGui.PopStyleColor();
}


_aboutHeaders.Draw();
}

Expand Down

0 comments on commit f9cec3e

Please sign in to comment.