Skip to content

Commit

Permalink
dd commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaksuhn committed Apr 8, 2024
1 parent 1288ff8 commit 9795872
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
24 changes: 24 additions & 0 deletions SomethingNeedDoing/Interface/HelpWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ public override void Draw()
("Sends", this.DrawVirtualKeys),
("Conditions", this.DrawAllConditions),
("Game Data", this.DrawGameData),
("Debug", this.DrawDebug),
};

foreach (var (title, dele) in tabs)
Expand Down Expand Up @@ -327,6 +328,16 @@ static void DisplayChangelog(string date, string changes, bool separator = true)

ImGui.PushFont(UiBuilder.MonoFont);

DisplayChangelog(
"2024-04-08",
"- Added GetObjectDataID()\n" +
"- Added GetBronzeChestLocations()\n" +
"- Added GetSilverChestLocations()\n" +
"- Added GetGoldChestLocations()\n" +
"- Added GetMimicChestLocations()\n" +
"- Added GetPassageLocation()\n" +
"- Added GetTrapLocations()\n");

DisplayChangelog(
"2024-04-07",
"- Added party index support to /target (i.e. /target <2>)\n");
Expand Down Expand Up @@ -1442,6 +1453,19 @@ private void DrawGameData()
ImGui.EndChild();
}

private void DrawDebug()
{
var bronzes = WorldStateCommands.Instance.GetBronzeChestLocations();
foreach (var l in bronzes)
ImGui.TextUnformatted($"bronze @ {new Vector3(l.Item1, l.Item2, l.Item3)}");
var silvers = WorldStateCommands.Instance.GetSilverChestLocations();
foreach (var l in silvers)
ImGui.TextUnformatted($"silver @ {new Vector3(l.Item1, l.Item2, l.Item3)}");
var golds = WorldStateCommands.Instance.GetGoldChestLocations();
foreach (var l in golds)
ImGui.TextUnformatted($"gold @ {new Vector3(l.Item1, l.Item2, l.Item3)}");
}

private void DrawObjectKinds()
{
using var font = ImRaii.PushFont(UiBuilder.MonoFont);
Expand Down
1 change: 1 addition & 0 deletions SomethingNeedDoing/Misc/Commands/EntityStateCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public unsafe bool IsObjectMounted(string name)
return false;
return true;
}
public uint GetObjectDataID(string name) => GetGameObjectFromName(name)?.DataId ?? 0;
public unsafe bool IsObjectInCombat(string name) => ((Character*)GetGameObjectFromName(name)?.Address!)->InCombat;
#endregion

Expand Down
8 changes: 8 additions & 0 deletions SomethingNeedDoing/Misc/Commands/WorldStateCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ public unsafe ushort GetNearestFate() => FateManager.Instance()->Fates.Span.ToAr
public float GetAccursedHoardRawX() => Svc.Objects.FirstOrDefault(x => x.DataId == DeepDungeonDataIDs.AccursedHoard)?.Position.X ?? 0;
public float GetAccursedHoardRawY() => Svc.Objects.FirstOrDefault(x => x.DataId == DeepDungeonDataIDs.AccursedHoard)?.Position.Y ?? 0;
public float GetAccursedHoardRawZ() => Svc.Objects.FirstOrDefault(x => x.DataId == DeepDungeonDataIDs.AccursedHoard)?.Position.Z ?? 0;
public List<(float, float, float)> GetBronzeChestLocations() => Svc.Objects.OrderBy(DistanceToObject).Where(x => DeepDungeonDataIDs.BronzeChestIDs.Contains(x.DataId)).Select(x => (x.Position.X, x.Position.Y, x.Position.Z)).ToList();
public List<(float, float, float)> GetSilverChestLocations() => Svc.Objects.OrderBy(DistanceToObject).Where(x => x.DataId == DeepDungeonDataIDs.SilverChest).Select(x => (x.Position.X, x.Position.Y, x.Position.Z)).ToList();
public List<(float, float, float)> GetGoldChestLocations() => Svc.Objects.OrderBy(DistanceToObject).Where(x => x.DataId == DeepDungeonDataIDs.GoldChest).Select(x => (x.Position.X, x.Position.Y, x.Position.Z)).ToList();
public List<(float, float, float)> GetMimicChestLocations() => Svc.Objects.OrderBy(DistanceToObject).Where(x => x.DataId == DeepDungeonDataIDs.MimicChest || DeepDungeonDataIDs.MimicIDs.Contains(x.DataId)).Select(x => (x.Position.X, x.Position.Y, x.Position.Z)).ToList();
public List<(float, float, float)> GetPassageLocation() => Svc.Objects.OrderBy(DistanceToObject).Where(x => DeepDungeonDataIDs.PassageIDs.Contains(x.DataId)).Select(x => (x.Position.X, x.Position.Y, x.Position.Z)).ToList();
public List<(float, float, float)> GetTrapLocations() => Svc.Objects.OrderBy(DistanceToObject).Where(x => DeepDungeonDataIDs.TrapIDs.ContainsKey(x.DataId)).Select(x => (x.Position.X, x.Position.Y, x.Position.Z)).ToList();
#endregion

public List<string> GetNearbyObjectNames(float distance = 0, byte objectKind = 0) =>
Expand All @@ -106,4 +112,6 @@ public List<string> GetNearbyObjectNames(float distance = 0, byte objectKind = 0
.Where(o => o.IsTargetable && (distance == 0 || Vector3.DistanceSquared(o.Position, Svc.ClientState.LocalPlayer!.Position) <= distance) && (objectKind == 0 || (byte)o.ObjectKind == objectKind))
.Select(o => o.Name.TextValue)
.ToList();

private float DistanceToObject(Dalamud.Game.ClientState.Objects.Types.GameObject o) => Vector3.DistanceSquared(o.Position, Svc.ClientState.LocalPlayer!.Position);
}

0 comments on commit 9795872

Please sign in to comment.