Skip to content

Commit 71ffe5d

Browse files
authored
Merge pull request #1192 from erdelf/dev
adjusting pre-stage retainer window closing
2 parents d7c1b4c + fa16297 commit 71ffe5d

File tree

4 files changed

+58
-38
lines changed

4 files changed

+58
-38
lines changed

AutoDuty/AutoDuty.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1827,7 +1827,7 @@ private void CheckRetainerWindow()
18271827
return;
18281828

18291829
if (Svc.Condition[ConditionFlag.OccupiedSummoningBell])
1830-
while(!AutoRetainerHelper.Instance.CloseAddons());
1830+
AutoRetainerHelper.Instance.CloseAddons();
18311831
}
18321832

18331833
private void InteractablesCheck()

AutoDuty/Helpers/ActiveHelperBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ public unsafe bool CloseAddons()
185185
{
186186
for (int i = 0; i < this.AddonsToClose.Length; i++)
187187
{
188-
if (GenericHelpers.TryGetAddonByName(this.AddonsToClose[i], out AtkUnitBase* atkUnitBase) && atkUnitBase->IsVisible)
188+
if (GenericHelpers.TryGetAddonByName(this.AddonsToClose[i], out AtkUnitBase* atkUnitBase) && atkUnitBase->IsReady)
189189
{
190190
this.DebugLog("Closing Addon " + this.AddonsToClose[i]);
191-
atkUnitBase->Close(true);
191+
atkUnitBase->FireCallbackInt(-1);
192192
return false;
193193
}
194194
}

AutoDuty/Windows/Config.cs

Lines changed: 54 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ namespace AutoDuty.Windows;
4040
using System.IO.Pipes;
4141
using System.Numerics;
4242
using System.Text;
43+
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
4344
using Achievement = Lumina.Excel.Sheets.Achievement;
4445
using ExitDutyHelper = Helpers.ExitDutyHelper;
4546
using Map = Lumina.Excel.Sheets.Map;
@@ -1176,7 +1177,10 @@ public bool AutoDesynthSkillUp
11761177
AutoDesynth = false;
11771178
}
11781179
}
1179-
public int AutoDesynthSkillUpLimit = 50;
1180+
public int AutoDesynthSkillUpLimit = 50;
1181+
public bool AutoDesynthNoGearset = true;
1182+
public ulong AutoDesynthCategories = 0x1;
1183+
11801184
internal bool autoGCTurnin = false;
11811185
public bool AutoGCTurnin
11821186
{
@@ -2702,54 +2706,70 @@ public static void Draw()
27022706

27032707

27042708
ImGui.Columns(2, "##DesynthColumns");
2709+
float columnY = ImGui.GetCursorPosY();
27052710

27062711
if (ImGui.Checkbox("Auto Desynth", ref Configuration.autoDesynth))
27072712
{
27082713
Configuration.AutoDesynth = Configuration.autoDesynth;
27092714
Configuration.Save();
27102715
}
2711-
ImGui.NextColumn();
2712-
//ImGui.SameLine(0, 5);
2713-
using (ImGuiHelper.RequiresPlugin(ExternalPlugin.AutoRetainer, "GCTurnin"))
2716+
if (Configuration.AutoDesynth)
27142717
{
2715-
if (ImGui.Checkbox("Auto GC Turnin", ref Configuration.autoGCTurnin))
2718+
ImGui.Indent();
2719+
if (ImGui.Checkbox("Only Skill Ups", ref Configuration.autoDesynthSkillUp))
27162720
{
2717-
Configuration.AutoGCTurnin = Configuration.autoGCTurnin;
2721+
Configuration.AutoDesynthSkillUp = Configuration.autoDesynthSkillUp;
27182722
Configuration.Save();
27192723
}
2720-
2721-
ImGui.NextColumn();
2724+
if (Configuration.AutoDesynthSkillUp)
2725+
{
2726+
ImGui.Indent();
2727+
ImGui.Text("Item Level Limit");
2728+
ImGuiComponents.HelpMarker("Stops desynthesising an item once your desynthesis skill reaches the Item Level + this limit.");
2729+
ImGui.SameLine();
2730+
ImGui.PushItemWidth(ImGui.GetContentRegionAvail().X);
2731+
if (ImGui.SliderInt("##AutoDesynthSkillUpLimit", ref Configuration.AutoDesynthSkillUpLimit, 0, 50))
2732+
{
2733+
Configuration.AutoDesynthSkillUpLimit = Math.Clamp(Configuration.AutoDesynthSkillUpLimit, 0, 50);
2734+
Configuration.Save();
2735+
}
2736+
ImGui.PopItemWidth();
2737+
ImGui.Unindent();
2738+
}
2739+
2740+
if (ImGui.Checkbox($"Protect Gearsets##Desynth{nameof(Configuration.AutoDesynthNoGearset)}", ref Configuration.AutoDesynthNoGearset))
2741+
Configuration.Save();
27222742

2723-
//slightly cursed
2724-
using (ImRaii.Enabled())
2743+
if (ImGui.CollapsingHeader("Desynth Categories"))
27252744
{
2726-
if (Configuration.AutoDesynth)
2745+
ImGui.Indent();
2746+
AgentSalvage.SalvageItemCategory[] values = Enum.GetValues<AgentSalvage.SalvageItemCategory>();
2747+
for (int index = 0; index < values.Length; index++)
27272748
{
2728-
ImGui.Indent();
2729-
if (ImGui.Checkbox("Only Skill Ups", ref Configuration.autoDesynthSkillUp))
2730-
{
2731-
Configuration.AutoDesynthSkillUp = Configuration.autoDesynthSkillUp;
2732-
Configuration.Save();
2733-
}
2734-
if (Configuration.AutoDesynthSkillUp)
2735-
{
2736-
ImGui.Indent();
2737-
ImGui.Text("Item Level Limit");
2738-
ImGuiComponents.HelpMarker("Stops desynthesising an item once your desynthesis skill reaches the Item Level + this limit.");
2739-
ImGui.SameLine();
2740-
ImGui.PushItemWidth(ImGui.GetContentRegionAvail().X);
2741-
if (ImGui.SliderInt("##AutoDesynthSkillUpLimit", ref Configuration.AutoDesynthSkillUpLimit, 0, 50))
2742-
{
2743-
Configuration.AutoDesynthSkillUpLimit = Math.Clamp(Configuration.AutoDesynthSkillUpLimit, 0, 50);
2744-
Configuration.Save();
2745-
}
2746-
ImGui.PopItemWidth();
2747-
ImGui.Unindent();
2748-
}
2749-
ImGui.Unindent();
2749+
bool x = Bitmask.IsBitSet(Configuration.AutoDesynthCategories, index);
2750+
string categoryName = values[index].ToCustomString();
2751+
if (ImGui.Checkbox(categoryName + $"##DesynthCategory{categoryName}", ref x))
2752+
if (x)
2753+
Bitmask.SetBit(ref Configuration.AutoDesynthCategories, index);
2754+
else
2755+
Bitmask.ResetBit(ref Configuration.AutoDesynthCategories, index);
27502756
}
2757+
ImGui.Unindent();
2758+
}
2759+
2760+
ImGui.Unindent();
2761+
}
2762+
2763+
ImGui.NextColumn();
2764+
ImGui.SetCursorPosY(columnY);
2765+
//ImGui.SameLine(0, 5);
2766+
using (ImGuiHelper.RequiresPlugin(ExternalPlugin.AutoRetainer, "GCTurnin"))
2767+
{
2768+
if (ImGui.Checkbox("Auto GC Turnin", ref Configuration.autoGCTurnin))
2769+
{
2770+
Configuration.AutoGCTurnin = Configuration.autoGCTurnin;
2771+
Configuration.Save();
27512772
}
2752-
ImGui.NextColumn();
27532773
if (Configuration.AutoGCTurnin)
27542774
{
27552775
ImGui.Indent();

0 commit comments

Comments
 (0)