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

Commit

Permalink
fix: add friend target self aoe count checking.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jul 29, 2023
1 parent e3fe3e8 commit 9a13c43
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 17 deletions.
3 changes: 3 additions & 0 deletions Resources/AnimationLockTime.json
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,8 @@
"25840": 0.6,
"25859": 0.1,
"25860": 0.1,
"25861": 0.6,
"25862": 0.6,
"25865": 0.1,
"25870": 0.6,
"25871": 0.1,
Expand Down Expand Up @@ -587,6 +589,7 @@
"29400": 0.6,
"29401": 2.5,
"29709": 0.1,
"30800": 0.1,
"31323": 2.1,
"31338": 2.1,
"33041": 2.1,
Expand Down
7 changes: 6 additions & 1 deletion Resources/HostileCastingArea.json
Original file line number Diff line number Diff line change
Expand Up @@ -331,5 +331,10 @@
25672,
25685,
25690,
25701
25701,
30421,
30450,
30955,
30447,
30798
]
15 changes: 10 additions & 5 deletions RotationSolver.Basic/Actions/BaseAction_Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,16 @@ private bool TargetHostileManual(BattleChara b, bool mustUse, int aoeCount, out

private bool TargetSelf(bool mustUse, int aoeCount)
{
if (EffectRange > 0 && !IsFriendly)
if (EffectRange <= 0) return true;

if (IsFriendly)
{
if (NoAOE)
{
return false;
}
var tars = TargetFilter.GetObjectInRadius(TargetFilterFuncEot(DataCenter.PartyMembers, mustUse), EffectRange);
if (tars.Count() < aoeCount) return false;
}
else
{
if (NoAOE) return false;

//not use when aoe.
if (DataCenter.IsManual)
Expand All @@ -366,6 +370,7 @@ private bool TargetSelf(bool mustUse, int aoeCount)
if (Service.Config.NoNewHostiles && TargetFilter.GetObjectInRadius(DataCenter.AllHostileTargets, EffectRange)
.Any(t => t.TargetObject == null)) return false;
}

return true;
}

Expand Down
39 changes: 30 additions & 9 deletions RotationSolver/UI/RotationConfigWindowNew.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class RotationConfigWindowNew : Window

private RotationConfigWindowTab _activeTab;

private const float MIN_COLUMN_WIDTH = 30;
private const float MIN_COLUMN_WIDTH = 24;
private const float JOB_ICON_WIDTH = 50;

public RotationConfigWindowNew()
Expand Down Expand Up @@ -55,9 +55,27 @@ private void DrawSideBar()
{
if (item.GetAttribute<TabSkipAttribute>() != null) continue;

if(ImGui.Selectable(item.ToString(), _activeTab == item, ImGuiSelectableFlags.None, new Vector2(0, 20)))
var icon = IconSet.GetTexture(item.GetAttribute<TabIconAttribute>()?.Icon ?? 0);

if(icon != null && wholeWidth <= JOB_ICON_WIDTH * _scale)
{
_activeTab = item;
var size = Math.Max(_scale * MIN_COLUMN_WIDTH, Math.Min(wholeWidth, _scale * JOB_ICON_WIDTH)) * 0.6f;
DrawItemMiddle(() =>
{
if (SilenceImageButton(icon.ImGuiHandle, Vector2.One * size, _activeTab == item))
{
_activeTab = item;
}
}, Math.Max(_scale * MIN_COLUMN_WIDTH, wholeWidth), size);

ImguiTooltips.HoveredTooltip(item.ToString());
}
else
{
if (ImGui.Selectable(item.ToString(), _activeTab == item, ImGuiSelectableFlags.None, new Vector2(0, 20)))
{
_activeTab = item;
}
}
}
ImGui.PopStyleVar();
Expand All @@ -67,7 +85,7 @@ private void DrawSideBar()

private void DrawHeader(float wholeWidth)
{
var size = MathF.Max(_scale * MathF.Min(wholeWidth, _scale * 120), _scale * MIN_COLUMN_WIDTH);
var size = MathF.Max(MathF.Min(wholeWidth, _scale * 120), _scale * MIN_COLUMN_WIDTH);

var logo = IconSet.GetTexture("https://raw.githubusercontent.com/ArchiDog1998/RotationSolver/main/docs/RotationSolverIcon_128.png");

Expand All @@ -92,7 +110,12 @@ private void DrawHeader(float wholeWidth)

var iconSize = Math.Max(_scale * MIN_COLUMN_WIDTH, Math.Min(wholeWidth, _scale * JOB_ICON_WIDTH));
var comboSize = ImGui.CalcTextSize(rotation.RotationName).X + _scale * 30;
size = comboSize + iconSize + ImGui.GetStyle().ItemSpacing.X;

const string slash = " - ";
var gameVersionSize = ImGui.CalcTextSize(slash + rotation.GameVersion).X + ImGui.GetStyle().ItemSpacing.X;
var gameVersion = LocalizationManager.RightLang.ConfigWindow_Helper_GameVersion + ": ";
var drawCenter = ImGui.CalcTextSize(slash + gameVersion + rotation.GameVersion).X + iconSize + ImGui.GetStyle().ItemSpacing.X * 3 < wholeWidth;
if(drawCenter) gameVersionSize += ImGui.CalcTextSize(gameVersion).X + ImGui.GetStyle().ItemSpacing.X;

DrawItemMiddle(() =>
{
Expand Down Expand Up @@ -140,20 +163,18 @@ private void DrawHeader(float wholeWidth)
: warning + "\n \n" + LocalizationManager.RightLang.ConfigWindow_Helper_SwitchRotation;
ImguiTooltips.HoveredTooltip(warning);

var slash = " - ";
ImGui.TextDisabled(slash);
ImGui.SameLine();

var gameVersion = LocalizationManager.RightLang.ConfigWindow_Helper_GameVersion + ": ";
if (ImGui.CalcTextSize(slash + gameVersion + rotation.GameVersion).X + ImGui.GetCursorPosX() - ImGui.GetStyle().ItemSpacing.X < wholeWidth)
if (drawCenter)
{
ImGui.TextDisabled(gameVersion);
ImGui.SameLine();
}
ImGui.Text(rotation.GameVersion);
ImGui.EndGroup();
}
}, wholeWidth, size);
}, wholeWidth, Math.Max(comboSize, gameVersionSize) + iconSize + ImGui.GetStyle().ItemSpacing.X);
}
}

Expand Down
8 changes: 7 additions & 1 deletion RotationSolver/UI/RotationConfigWindowTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ internal class TabSkipAttribute : Attribute

}

[AttributeUsage(AttributeTargets.Field)]
internal class TabIconAttribute : Attribute
{
public uint Icon { get; set; }
}

internal enum RotationConfigWindowTab : byte
{
[TabSkip] About,
[TabSkip] Rotation,
Actions,
[TabIcon(Icon = 4)] Actions,
}
2 changes: 1 addition & 1 deletion RotationSolver/Updaters/SocialUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ internal static async void UpdateSocial()
#if DEBUG
Svc.Chat.Print("Macro now.");
#endif
//Service.Config.DutyStart.AddMacro();
Service.Config.DutyStart.AddMacro();
await Task.Delay(new Random().Next(1000, 1500));
SayHelloToAuthor();
}
Expand Down

0 comments on commit 9a13c43

Please sign in to comment.