Skip to content

Commit

Permalink
oops
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaksuhn committed Jan 15, 2025
1 parent bbf4500 commit 6f33f07
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Automaton/Features/GettingTooAttached.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private void OnAchievementProgressUpdate(uint id, uint current, uint max)

public override void DrawConfig()
{
if (!C.EnabledTweaks.Contains(Name)) return;
if (!C.EnabledTweaks.Contains(nameof(GettingTooAttached))) return;

ImGui.DragInt("Number of Loops", ref Config.NumberOfLoops);
if (ImGui.Button(!active ? $"Start Looping###StartLooping" : $"Looping. Click to abort.###AbortLoop"))
Expand Down
2 changes: 1 addition & 1 deletion Automaton/Features/RetrieveMateria.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private void OnOpenContextMenu(IMenuOpenedArgs args)
PrefixChar = 'C',
Name = "Retrieve All Materia",
OnClicked = (a) => P.Automation.Start(new RetrieveAllMateria(inv.TargetItem.Value)),
IsEnabled = inv.TargetItem.Value.Materia.ToArray().Any(m => m != 0) && !Svc.Condition[ConditionFlag.Occupied39],
IsEnabled = inv.TargetItem.Value.Materia.ToArray().Any(m => m != 0) && !PlayerEx.IsBusy,
});
}
}
1 change: 1 addition & 0 deletions Automaton/FeaturesSetup/Tweak.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ internal virtual void EnableInternal()
if (!Ready || Outdated || Disabled) return;
if (Requirements.Any(r => !r.IsLoaded))
{
// TODO: append a button to re-enable
ModuleMessage("Feature not enabled due to missing dependencies. Please install them then re-enable this feature.");
return;
}
Expand Down
4 changes: 4 additions & 0 deletions Automaton/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ private void OnCommand(string command, string args)
else
C.EnabledTweaks.Add(@params[0]);
break;
case "stop":
P.Automation.Stop();
P.TaskManager.Abort();
break;
}
}
}
Expand Down
47 changes: 34 additions & 13 deletions Automaton/Tasks/LoopMelding.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
using System.Threading.Tasks;
using FFXIVClientStructs.FFXIV.Client.Game.Event;
using FFXIVClientStructs.FFXIV.Client.Game;
using System.Threading.Tasks;
using Dalamud.Game.Inventory;

namespace Automaton.Tasks;
public sealed class LoopMelding : CommonTasks
{
private static readonly uint GettingTooAttachedVII = 1905;
protected override async Task Execute()
{
var (current, max) = await GetAchievementProgress(GettingTooAttachedVII, $"GetProgress{nameof(GettingTooAttachedVII)}");
while (current < max)
{
current++;
}
}
}
//public sealed class LoopMelding(GameInventoryItem item) : CommonTasks
//{
// private static readonly uint GettingTooAttachedVII = 1905;
// protected override async Task Execute()
// {
// Status = $"Getting Achievement Progress";
// var (current, max) = await GetAchievementProgress(GettingTooAttachedVII, $"GetProgress{nameof(GettingTooAttachedVII)}");
// while (current < max)
// {
// Status = $"Melding [{current}/{max}]";
// Meld();
// await WaitUntilThenFalse(() => Svc.Condition[ConditionFlag.Occupied39], "Melding");

// Status = $"Retrieving [{current}/{max}]";
// Retrieve(MaterializeEventId.Retrieve);
// await WaitUntilThenFalse(() => Svc.Condition[ConditionFlag.Occupied39], "Retrieving");
// current++;
// }
// }

// private unsafe void Retrieve(MaterializeEventId eventId)
// {
// try
// {
// var _item = (InventoryItem*)item.Address;
// P.Memory.RetrieveMateria?.Invoke(EventFramework.Instance(), (int)eventId, _item->Container, _item->Slot, 0);
// }
// catch (Exception e) { e.Log(); }
// }
//}
4 changes: 2 additions & 2 deletions Automaton/Tasks/RetrieveAllMateria.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ protected override async Task Execute()
foreach (var materia in materias)
{
Retrieve();
await WaitUntilThenFalse(() => Svc.Condition[ConditionFlag.Occupied39], "RetrivingMateria");
await WaitUntilThenFalse(() => Svc.Condition[ConditionFlag.Occupied39], "RetrievingMateria");
}
}

Expand All @@ -22,7 +22,7 @@ private unsafe void Retrieve()
try
{
var _item = (InventoryItem*)item.Address;
P.Memory.RetrieveMateria?.Invoke(EventFramework.Instance(), 0x390001, _item->Container, _item->Slot, 0);
P.Memory.RetrieveMateria?.Invoke(EventFramework.Instance(), (int)MaterializeEventId.Retrieve, _item->Container, _item->Slot, 0);
}
catch (Exception e) { e.Log(); }
}
Expand Down
23 changes: 22 additions & 1 deletion Automaton/Utilities/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public enum ExecuteCommandFlag
CancelCast = 105,
RidePillion = 106,
WithdrawParasol = 109,
const_10 = 110,
Unk110 = 110,
Revive = 200,
TerritoryTransport = 201,
Teleport = 202,
Expand All @@ -38,9 +38,23 @@ public enum ExecuteCommandFlag
PlaceFieldMarker = 317,
RemoveFieldMarker = 318,
ResetStrikingDummy = 319,
Unk400 = 400,
Unk401 = 401,
Unk402 = 402,
Unk403 = 403,
Unk404 = 404,
RequestInventory = 405,
Unk406 = 406,
Unk407 = 407,
EnterMateriaAttachState = 408,
Unk409 = 409,
LeaveMateriaAttachState = 410,
Unk411 = 411, // materia related?
Unk412 = 412, // materia related?
Unk413 = 413,
Unk415 = 415,
Unk416 = 416,
Unk417 = 417,
CancelMateriaMeldRequest = 419,
RequestCabinet = 424,
StoreToCabinet = 425,
Expand Down Expand Up @@ -151,4 +165,11 @@ public enum ExecuteCommandComplexFlag
PetAction = 1800,
BgcArmyAction = 1810
}

public enum MaterializeEventId
{
Unk0 = 0x390000, // called in salvage and unk
Retrieve = 0x390001,
Unk2 = 0x390002, // called in purify
}
}

0 comments on commit 6f33f07

Please sign in to comment.