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

Commit

Permalink
fix: blm default, changeing the usage of leyline and manafont.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Feb 6, 2023
1 parent 7ce852f commit 1134e17
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 73 deletions.
12 changes: 7 additions & 5 deletions RotationSolver/Commands/RSCommands_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,18 @@ internal static unsafe void DoAnAction(bool isGCD)
return;
}

internal static void ResetSpecial() => DoSpecialCommandType(SpecialCommandType.EndSpecial, false);
internal static void CancelState() => DoStateCommandType(StateCommandType.Cancel);

internal static void UpdateRotationState()
{
//结束战斗,那就关闭。
if (Service.ClientState.LocalPlayer.CurrentHp == 0
|| Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.LoggingOut]
|| Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.OccupiedInCutSceneEvent]
|| Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.BetweenAreas]
|| Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.BetweenAreas51])
StateType = StateCommandType.Cancel;

|| Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.OccupiedInCutSceneEvent])
{
CancelState();
}
//Auto start at count Down.
else if (Service.Configuration.StartOnCountdown && CountDown.CountDownTime > 0)
{
Expand Down
2 changes: 0 additions & 2 deletions RotationSolver/Commands/RSCommands_StateSpecialCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ private static void UpdateToast()
});
}

internal static void ResetSpecial() => DoSpecialCommandType(SpecialCommandType.EndSpecial, false);

private static void DoStateCommandType(StateCommandType stateType) => DoOneCommandType(stateType, EnumTranslations.ToSayout, role =>
{
if (StateType == StateCommandType.Smart
Expand Down
26 changes: 25 additions & 1 deletion RotationSolver/RotationSolverPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using Dalamud.Interface.Windowing;
using Dalamud.Plugin;
using Lumina.Excel.GeneratedSheets;
using RotationSolver.Commands;
using RotationSolver.Configuration;
using RotationSolver.Data;
Expand Down Expand Up @@ -45,13 +46,13 @@ public RotationSolverPlugin(DalamudPluginInterface pluginInterface)
Service.Interface.UiBuilder.OpenConfigUi += OnOpenConfigUi;
Service.Interface.UiBuilder.Draw += windowSystem.Draw;
Service.Interface.UiBuilder.Draw += OverlayWindow.Draw;
Service.ClientState.TerritoryChanged += ClientState_TerritoryChanged;

MajorUpdater.Enable();
TimeLineUpdater.Enable(pluginInterface.ConfigDirectory.FullName);
Watcher.Enable();
CountDown.Enable();


Service.Localization = new LocalizationManager();
#if DEBUG
Service.Localization.ExportLocalization();
Expand All @@ -60,6 +61,27 @@ public RotationSolverPlugin(DalamudPluginInterface pluginInterface)
ChangeUITranslation();
}

private void ClientState_TerritoryChanged(object sender, ushort e)
{
#if DEBUG
Service.ChatGui.Print($"Terrritory: {e}");
var territory = Service.DataManager.GetExcelSheet<TerritoryType>().GetRow(e);
if (territory != null)
{
Service.ChatGui.Print($"Terrritory Name: {territory.PlaceName}");
Service.ChatGui.Print($"Terrritory Icon: {territory.PlaceNameIcon}");
Service.ChatGui.Print($"Terrritory Zone Icon: {territory.PlaceNameRegionIcon}");
}
#endif

if (!Service.Configuration.AutoOffBetweenArea) return;
if (Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.BoundByDuty]
|| Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.BoundByDuty56]
|| Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.BoundByDuty95]
|| Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.BoundToDuty97]) return;
RSCommands.CancelState();
}

internal static void ChangeUITranslation()
{
_comboConfigWindow.WindowName = LocalizationManager.RightLang.ConfigWindow_Header
Expand All @@ -75,6 +97,8 @@ public void Dispose()
Service.Interface.UiBuilder.OpenConfigUi -= OnOpenConfigUi;
Service.Interface.UiBuilder.Draw -= windowSystem.Draw;
Service.Interface.UiBuilder.Draw -= OverlayWindow.Draw;
Service.ClientState.TerritoryChanged -= ClientState_TerritoryChanged;

Service.IconReplacer.Dispose();

Service.Localization.Dispose();
Expand Down
13 changes: 6 additions & 7 deletions RotationSolver/Rotations/RangedMagicial/BLM/BLM_Default.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private static bool NeedToTransposeGoIce(bool usedOne)

private protected override IRotationConfigSet CreateConfiguration()
=> base.CreateConfiguration()
.SetFloat("CountDownTime", 4, "What Time to Leylines when Counting down.", 3, 5)
.SetFloat("CountDownTime", 3, "What Time to Fire3 when Counting down.", 2, 4)
.SetBool("UseTransposeForParadox", true, "Use Transpose to Fire for Paradox")
.SetBool("ExtendTimeSafely", false, "Extend Fire Element Time Safely")
.SetBool("UseN15", false, "Use N15");
Expand All @@ -55,7 +55,6 @@ private protected override IAction CountDownAction(float remainTime)
IAction act;
if(remainTime < Configs.GetFloat("CountDownTime"))
{
if (Leylines.CanUse(out act)) return act;
if (Fire3.CanUse(out act)) return act;
}
if (remainTime <= 12 && Sharpcast.CanUse(out act, emptyOrSkipCombo: true)) return act;
Expand All @@ -79,7 +78,7 @@ private protected override bool AttackAbility(byte abilitiesRemaining, out IActi
}
if (InAstralFire)
{
if (Manafont.CanUse(out act)) return true;
if (!CombatElapsedLess(5) && CombatElapsedLess(8) && Leylines.CanUse(out act)) return true;
if (Triplecast.CanUse(out act, gcdCountForAbility: 5)) return true;
}
if (Amplifier.CanUse(out act)) return true;
Expand All @@ -98,6 +97,8 @@ private protected override bool EmergencyAbility(byte abilitiesRemaining, IActio
if(Transpose.CanUse(out act)) return true;
}

//Using Manafont
if (InAstralFire && Player.CurrentMp == 0 && Manafont.CanUse(out act)) return true;
//To Ice
if (NeedToTransposeGoIce(true) && Transpose.CanUse(out act)) return true;

Expand Down Expand Up @@ -146,7 +147,8 @@ private static bool GoIce(out IAction act)

if (!NeedToGoIce) return false;

if (NeedToTransposeGoIce(false)
//Use Manafont or transpose.
if ((!Manafont.IsCoolingDown || NeedToTransposeGoIce(false))
&& UseInstanceSpell(out act)) return true;

//Go to Ice.
Expand Down Expand Up @@ -277,9 +279,6 @@ private static bool DoFire(out IAction act)
if (UmbralHearts < 2 && Flare.CanUse(out act)) return true;
if (Fire2.CanUse(out act)) return true;

//To add Manafont.
if(!Manafont.IsCoolingDown && Manafont.ActionCheck.Invoke(null) && IsPolyglotStacksMaxed && UsePolyglot(out act, 0)) return true;

if (Player.CurrentMp >= Fire.MPNeed + 800)
{
if (Fire4.CanUse(out act)) return true;
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Updaters/ActionUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ internal unsafe static void DoAction()
|| Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.Occupied33]
|| Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.Occupied38]
|| Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.Jumping61]
|| Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.BetweenAreas] && Service.Configuration.AutoOffBetweenArea
|| Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.BetweenAreas]
|| Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.BetweenAreas51]
|| Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.Mounted]
|| Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.SufferingStatusAffliction]
Expand Down
135 changes: 78 additions & 57 deletions RotationSolver/Windows/RotationConfigWindow_Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,100 +6,121 @@
using RotationSolver.Commands;
using RotationSolver.Data;
using RotationSolver.Helpers;
using RotationSolver.Localization;
using RotationSolver.Rotations.RangedMagicial.BLM;
using RotationSolver.SigReplacers;
using RotationSolver.Updaters;
using System;
using System.Linq;
using System.Numerics;

namespace RotationSolver.Windows.RotationConfigWindow;
#if DEBUG
internal partial class RotationConfigWindow
{
private unsafe void DrawDebugTab()
private void DrawDebugTab()
{
var str = TargetUpdater.EncryptString(Service.ClientState.LocalPlayer);
ImGui.SetNextItemWidth(ImGui.CalcTextSize(str).X + 10);
ImGui.InputText("That is your HASH", ref str, 100);

if (ImGui.CollapsingHeader("Status"))
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0f, 5f));

if (ImGui.BeginTabBar("Debug Items"))
{
ImGui.Text(ActionUpdater.WeaponRemain.ToString());
DrawParamTabItem("Status", DrawStatus);
DrawParamTabItem("Party", DrawParty);
DrawParamTabItem("Target Data", DrawTargetData);
DrawParamTabItem("Next Action", DrawNextAction);
DrawParamTabItem("Last Action", DrawLastAction);
DrawParamTabItem("CD, EX", DrawCDEX);
DrawParamTabItem("Icon", DrawIcon);

if ((IntPtr)FateManager.Instance() != IntPtr.Zero)
{
ImGui.Text("Fate: " + TargetUpdater.FateId.ToString());
}
ImGui.EndTabBar();
}
ImGui.PopStyleVar();
}

foreach (var status in Service.ClientState.LocalPlayer.StatusList)
{
var source = Service.ObjectTable.SearchById(status.SourceId)?.Name ?? "None";
ImGui.Text($"{status.GameData.Name}: {status.StatusId} From: {source}");
}
private unsafe void DrawStatus()
{
ImGui.Text(ActionUpdater.WeaponRemain.ToString());

if ((IntPtr)FateManager.Instance() != IntPtr.Zero)
{
ImGui.Text("Fate: " + TargetUpdater.FateId.ToString());
}

if (ImGui.CollapsingHeader("Party"))
foreach (var status in Service.ClientState.LocalPlayer.StatusList)
{
ImGui.Text("Friends: " + TargetUpdater.PartyMembers.Count().ToString());
ImGui.Text("CanHealSingleAbility: " + TargetUpdater.CanHealSingleAbility.ToString());
ImGui.Text("CanHealSingleSpell: " + TargetUpdater.CanHealSingleSpell.ToString());
ImGui.Text("CanHealAreaAbility: " + TargetUpdater.CanHealAreaAbility.ToString());
ImGui.Text("CanHealAreaSpell: " + TargetUpdater.CanHealAreaSpell.ToString());
var source = Service.ObjectTable.SearchById(status.SourceId)?.Name ?? "None";
ImGui.Text($"{status.GameData.Name}: {status.StatusId} From: {source}");
}
}
private void DrawParty()
{
ImGui.Text("Friends: " + TargetUpdater.PartyMembers.Count().ToString());
ImGui.Text("CanHealSingleAbility: " + TargetUpdater.CanHealSingleAbility.ToString());
ImGui.Text("CanHealSingleSpell: " + TargetUpdater.CanHealSingleSpell.ToString());
ImGui.Text("CanHealAreaAbility: " + TargetUpdater.CanHealAreaAbility.ToString());
ImGui.Text("CanHealAreaSpell: " + TargetUpdater.CanHealAreaSpell.ToString());
}

if (ImGui.CollapsingHeader("Target Data"))
private void DrawTargetData()
{
if (Service.TargetManager.Target is BattleChara b)
{
if (Service.TargetManager.Target is BattleChara b)
{
ImGui.Text("Is Boss: " + b.IsBoss().ToString());
ImGui.Text("Has Positional: " + b.HasPositional().ToString());
ImGui.Text("Is Dying: " + b.IsDying().ToString());

foreach (var status in b.StatusList)
{
var source = Service.ObjectTable.SearchById(status.SourceId)?.Name ?? "None";
ImGui.Text($"{status.GameData.Name}: {status.StatusId} From: {source}");
}
}
ImGui.Text("Is Boss: " + b.IsBoss().ToString());
ImGui.Text("Has Positional: " + b.HasPositional().ToString());
ImGui.Text("Is Dying: " + b.IsDying().ToString());

ImGui.Text("All: " + TargetUpdater.AllTargets.Count().ToString());
ImGui.Text("Hostile: " + TargetUpdater.HostileTargets.Count().ToString());
foreach (var item in TargetUpdater.HostileTargets)
foreach (var status in b.StatusList)
{
ImGui.Text(item.Name.ToString());
var source = Service.ObjectTable.SearchById(status.SourceId)?.Name ?? "None";
ImGui.Text($"{status.GameData.Name}: {status.StatusId} From: {source}");
}
}

if (ImGui.CollapsingHeader("Next Action"))
ImGui.Text("All: " + TargetUpdater.AllTargets.Count().ToString());
ImGui.Text("Hostile: " + TargetUpdater.HostileTargets.Count().ToString());
foreach (var item in TargetUpdater.HostileTargets)
{
ImGui.Text(RotationUpdater.RightNowRotation.RotationName);
ImGui.Text(RSCommands.SpecialType.ToString());

ActionUpdater.NextAction?.Display(false);
ImGui.Text("Ability Remain: " + ActionUpdater.AbilityRemain.ToString());
ImGui.Text("Ability Count: " + ActionUpdater.AbilityRemainCount.ToString());
ImGui.Text(item.Name.ToString());
}
}
private void DrawNextAction()
{
ImGui.Text(RotationUpdater.RightNowRotation.RotationName);
ImGui.Text(RSCommands.SpecialType.ToString());

if (ImGui.CollapsingHeader("Last Action"))
{
DrawAction(Watcher.LastAction, nameof(Watcher.LastAction));
DrawAction(Watcher.LastAbility, nameof(Watcher.LastAbility));
DrawAction(Watcher.LastGCD, nameof(Watcher.LastGCD));
DrawAction(ActionUpdater.LastComboAction, nameof(ActionUpdater.LastComboAction));
}
ActionUpdater.NextAction?.Display(false);
ImGui.Text("Ability Remain: " + ActionUpdater.AbilityRemain.ToString());
ImGui.Text("Ability Count: " + ActionUpdater.AbilityRemainCount.ToString());

if (ImGui.CollapsingHeader("Countdown, Exception"))
{
ImGui.Text("Count Down: " + CountDown.CountDownTime.ToString());
}
private void DrawLastAction()
{
DrawAction(Watcher.LastAction, nameof(Watcher.LastAction));
DrawAction(Watcher.LastAbility, nameof(Watcher.LastAbility));
DrawAction(Watcher.LastGCD, nameof(Watcher.LastGCD));
DrawAction(ActionUpdater.LastComboAction, nameof(ActionUpdater.LastComboAction));
}

if (ActionUpdater.exception != null)
{
ImGui.Text(ActionUpdater.exception.Message);
ImGui.Text(ActionUpdater.exception.StackTrace);
}
private void DrawCDEX()
{
ImGui.Text("Count Down: " + CountDown.CountDownTime.ToString());

if (ActionUpdater.exception != null)
{
ImGui.Text(ActionUpdater.exception.Message);
ImGui.Text(ActionUpdater.exception.StackTrace);
}
}

private void DrawIcon()
{
ImGui.Image(IconSet.GetTexture(10).ImGuiHandle, new Vector2(24, 24));
}

private static void DrawAction(ActionID id, string type)
{
var action = new BaseAction(id);
Expand Down

0 comments on commit 1134e17

Please sign in to comment.