Skip to content

Commit

Permalink
Refactor and update various game logic and configurations
Browse files Browse the repository at this point in the history
- Modified `PLD_Beta.cs` to add level checks for `BladeOfValorPvE`, `BladeOfTruthPvE`, and `BladeOfFaithPvE`, and changed the status check for `ConfiteorPvE` from `Requiescat` to `ConfiteorReady`.
- Updated the submodule `ECommons` to a new commit.
- Added a new property `HasShownMainMenuMessage` to the `Configs` class in `Configs.cs`.
- Added new actions `SharpenedKnife`, `ChocoMeteor`, and `PomCure` to the `BlueMageRotation` class in `BlueMageRotation.cs`.
- Added partial methods to modify the settings for `SharpenedKnifePvE`, `ChocoMeteorPvE`, and `PomCurePvE` in `BlueMageRotation.cs`.
- In `RotationConfigWindow.cs`, added logic to show a main menu message if it hasn't been shown before and updated the logic for checking incompatible plugins to use a `foreach` loop instead of `Any()`.
- Added a private field `_showText` to `RotationConfigWindow.cs` and updated the `DrawHeader` method to conditionally render text based on this field.
- Refactored the logic for finding custom rotations and actions in `RotationConfigWindow.cs` to use `foreach` loops instead of LINQ methods.
- Updated the logic for displaying statuses in `RotationConfigWindow.cs` to use a `foreach` loop instead of LINQ methods.
  • Loading branch information
LTS-FFXIV committed Jan 6, 2025
1 parent cf226af commit 19ff819
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ lib/
.idea/
RotationSolver/Localization/Localization.json
/Resources/AutoStatusOrder.json
/RotationSolver.GameData/RotationSolver.GameData.csproj.user
8 changes: 4 additions & 4 deletions BasicRotations/Tank/PLD_Beta.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ protected override bool GeneralGCD(out IAction? act)
if (PassageProtec && Player.HasStatus(true, StatusID.PassageOfArms)) return false;

// Confiteor Combo
if (BladeOfValorPvE.CanUse(out act)) return true;
if (BladeOfTruthPvE.CanUse(out act)) return true;
if (BladeOfFaithPvE.CanUse(out act)) return true;
if (Player.HasStatus(true, StatusID.Requiescat) && ConfiteorPvE.CanUse(out act, usedUp: true, skipAoeCheck: true)) return true;
if (BladeOfValorPvE.EnoughLevel && BladeOfValorPvE.CanUse(out act)) return true;
if (BladeOfTruthPvE.EnoughLevel && BladeOfTruthPvE.CanUse(out act)) return true;
if (BladeOfFaithPvE.EnoughLevel && BladeOfFaithPvE.CanUse(out act)) return true;
if (Player.HasStatus(true, StatusID.ConfiteorReady) && ConfiteorPvE.CanUse(out act, usedUp: true, skipAoeCheck: true)) return true;

if (GoringBladePvE.CanUse(out act)) return true;

Expand Down
2 changes: 1 addition & 1 deletion ECommons
1 change: 1 addition & 0 deletions RotationSolver.Basic/Configuration/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public const string

public const int CurrentVersion = 12;
public int Version { get; set; } = CurrentVersion;
public bool HasShownMainMenuMessage { get; set; } = false;

public string LastSeenChangelog { get; set; } = "0.0.0.0";
public bool FirstTimeSetupDone { get; set; } = false;
Expand Down
33 changes: 33 additions & 0 deletions RotationSolver.Basic/Rotations/Basic/BlueMageRotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ public enum BluDPSSpell : byte
/// </summary>
GoblinPunch,

/// <summary>
///
/// </summary>
SharpenedKnife,

}

/// <summary>
Expand Down Expand Up @@ -70,6 +75,11 @@ public enum BluAOESpell : byte
///
/// </summary>
ThousandNeedles,

/// <summary>
///
/// </summary>
ChocoMeteor,
}

/// <summary>
Expand All @@ -86,6 +96,11 @@ public enum BluHealSpell : byte
///
/// </summary>
AngelsSnack,

/// <summary>
///
/// </summary>
PomCure,
}

/// <summary>
Expand Down Expand Up @@ -159,6 +174,24 @@ public enum BLUID : byte
[RotationConfig(CombatType.PvE, Name = "Aetheric Mimicry Role")]
public static BLUID BlueId { get; set; } = BLUID.DPS;

static partial void ModifySharpenedKnifePvE(ref ActionSetting setting)
{

}

static partial void ModifyChocoMeteorPvE(ref ActionSetting setting)
{
setting.CreateConfig = () => new ActionConfig()
{
AoeCount = 3,
};
}

static partial void ModifyPomCurePvE(ref ActionSetting setting)
{
setting.IsFriendly = true;
}

static partial void ModifySongOfTormentPvE(ref ActionSetting setting)
{
setting.TargetStatusProvide = [StatusID.Bleeding_1714];
Expand Down
76 changes: 61 additions & 15 deletions RotationSolver/UI/RotationConfigWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public RotationConfigWindow()
MaximumSize = new Vector2(5000, 5000),
};
RespectCloseHotkey = true;

_showText = !Service.Config.HasShownMainMenuMessage; // Show the message if it hasn't been shown before
}

public override void OnClose()
Expand Down Expand Up @@ -145,8 +147,15 @@ private void DrawErrorZone()
{
var incompatiblePlugins = DownloadHelper.IncompatiblePlugins ?? Array.Empty<IncompatiblePlugin>();

bool hasIncompatiblePlugin = incompatiblePlugins.Any(item =>
(item.Name == "XIV Combo" || item.Name == "XIV Combo Expanded" || item.Name == "XIVSlothCombo" || item.Name == "Wrath Combo") && item.IsInstalled);
bool hasIncompatiblePlugin = false;
foreach (var item in incompatiblePlugins)
{
if ((item.Name == "XIV Combo" || item.Name == "XIV Combo Expanded" || item.Name == "XIVSlothCombo" || item.Name == "Wrath Combo") && item.IsInstalled)
{
hasIncompatiblePlugin = true;
break;
}
}

if (hasIncompatiblePlugin)
{
Expand All @@ -157,22 +166,22 @@ private void DrawErrorZone()
{
if (plugin.Name == "XIV Combo")
{
message = "Disable XIV Combo plugin";
message = "Disable XIV Combo plugin, causes targetting issues";
break;
}
else if (plugin.Name == "XIV Combo Expanded")
{
message = "Disable XIV Combo Expanded plugin";
message = "Disable XIV Combo Expanded plugin, causes targetting issues";
break;
}
else if (plugin.Name == "XIVSlothCombo")
{
message = "Disable XIVSlothCombo plugin";
message = "Disable XIVSlothCombo plugin, causes targetting issues";
break;
}
else if (plugin.Name == "Wrath Combo")
{
message = "Disable Wrath Combo plugin";
message = "Disable Wrath Combo plugin, causes targetting issues";
break;
}
}
Expand Down Expand Up @@ -308,7 +317,15 @@ private void DrawSideBar()
if (item.GetAttribute<TabSkipAttribute>() != null) continue;

// Check if the "AutoDuty" plugin is installed
bool isAutoDutyInstalled = incompatiblePlugins.Any(plugin => plugin.IsInstalled && plugin.Name == "AutoDuty");
bool isAutoDutyInstalled = false;
foreach (var plugin in incompatiblePlugins)
{
if (plugin.IsInstalled && plugin.Name == "AutoDuty")
{
isAutoDutyInstalled = true;
break;
}
}

// Skip the "AutoDuty" tab if the plugin is not installed
if (item == RotationConfigWindowTab.AutoDuty && !isAutoDutyInstalled) continue;
Expand Down Expand Up @@ -355,12 +372,20 @@ private void DrawSideBar()
}
}

private bool _showText;

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

if (IconSet.GetTexture((uint)0, out var overlay))
{
if (_showText) // Conditionally render the text
{
ImGui.TextWrapped("Click RSR icon for main menu");
ImGui.Spacing();
}

ImGuiHelper.DrawItemMiddle(() =>
{
var cursor = ImGui.GetCursorPos();
Expand All @@ -370,6 +395,11 @@ private void DrawHeader(float wholeWidth)
{
_activeTab = RotationConfigWindowTab.About;
_searchResults = [];
_showText = false; // Update the flag when the icon is clicked

// Save the configuration to indicate that the message has been shown
Service.Config.HasShownMainMenuMessage = true;
Service.Config.Save();
}
ImguiTooltips.HoveredTooltip(UiString.ConfigWindow_About_Punchline.GetDescription());

Expand Down Expand Up @@ -422,7 +452,15 @@ private void DrawHeader(float wholeWidth)
return;
}

var rotations = RotationUpdater.CustomRotations.FirstOrDefault(i => i.ClassJobIds.Contains((Job)(Player.Object?.ClassJob.RowId ?? 0)))?.Rotations ?? [];
Type[] rotations = Array.Empty<Type>();
foreach (var customRotation in RotationUpdater.CustomRotations)
{
if (customRotation.ClassJobIds.Contains((Job)(Player.Object?.ClassJob.RowId ?? 0)))
{
rotations = customRotation.Rotations;
break;
}
}

if (rotation != null)
{
Expand Down Expand Up @@ -1250,9 +1288,16 @@ private static void DrawRotationDescription()
var attr = RotationDescAttribute.MergeToOne(a);
if (attr == null) continue;

var allActions = attr.Actions.Select(i => rotation.AllBaseActions
.FirstOrDefault(a => a.ID == (uint)i))
.Where(i => i != null);
var allActions = new List<IBaseAction>();
foreach (var actionId in attr.Actions)
{
var action = rotation.AllBaseActions.FirstOrDefault(a => a.ID == (uint)actionId);
if (action != null)
{
allActions.Add(action);
}
}


bool hasDesc = !string.IsNullOrEmpty(attr.Description);

Expand Down Expand Up @@ -2204,13 +2249,14 @@ private static void DrawStatusList(string name, HashSet<uint> statuses, Status[]
ImguiTooltips.HoveredTooltip(UiString.ConfigWindow_List_AddStatus.GetDescription());
}

foreach (var status in statuses.Select(a => Service.GetSheet<Status>().GetRow(a))
.Where(a => a.RowId != 0)
.OrderByDescending(s => SearchableCollection.Similarity($"{s.Name} {s.RowId}", _statusSearching)))
foreach (var statusId in statuses)
{
var status = Service.GetSheet<Status>().GetRow(statusId);
if (status.RowId == 0) continue;

void Delete() => removeId = status.RowId;

var key = $"Status{status!.RowId}";
var key = $"Status{status.RowId}";

ImGuiHelper.DrawHotKeysPopup(key, string.Empty, (UiString.ConfigWindow_List_Remove.GetDescription(), Delete, new[] { "Delete" }));

Expand Down

0 comments on commit 19ff819

Please sign in to comment.