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

Commit

Permalink
fix: add drawing ui.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Mar 7, 2024
1 parent 49c5723 commit 7a441f0
Show file tree
Hide file tree
Showing 13 changed files with 1,003 additions and 880 deletions.
2 changes: 1 addition & 1 deletion Resources/RotationSolverRecord.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ClickingCount": 98904,
"SayingHelloCount": 165,
"SayingHelloCount": 166,
"SaidUsers": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ internal class DrawingTimeline : BaseTimelineItem
{
public float Duration { get; set; } = 5;

public TimelineConditionSet Condition { get; set; } = new()
{
Conditions = [new TrueTimelineCondition()],
};
public TimelineConditionSet Condition { get; set; } = new();
public List<IDrawingGetter> DrawingGetters { get; set; } = [];

private IDisposable[] _drawings = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ internal class ITimelineItemConverter : JsonCreationConverter<BaseTimelineItem>
{
return new MacroTimelineItem();
}
else if (FieldExists(nameof(MoveTimelineItem.Points), jObject))
{
return new MoveTimelineItem();
}
return null;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using ECommons.Automation;

namespace RotationSolver.Basic.Configuration.Timeline;

[Description("Macro Time line")]
internal class MacroTimelineItem : BaseTimelineItem
{
public string Macro { get; set; } = "";
Expand Down
32 changes: 32 additions & 0 deletions RotationSolver.Basic/Configuration/Timeline/MoveTimelineItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using ECommons.DalamudServices;

namespace RotationSolver.Basic.Configuration.Timeline;

[Description("Move Time line")]
internal class MoveTimelineItem : BaseTimelineItem
{
public List<Vector3> Points { get; set; } = [];
public override bool InPeriod(TimelineItem item)
{
var time = item.Time - DataCenter.RaidTimeRaw;

if (time < 0) return false;

if (time > Time || Time - time > 3) return false;
return true;
}

protected override void OnEnable()
{
base.OnEnable();

var ipc = Svc.PluginInterface.GetIpcSubscriber<List<Vector3>, bool, object>("vnavmesh.Path.MoveTo");

if(ipc == null)
{
Svc.Log.Error("Can't find the vnavmesh to move.");
return;
}
ipc.InvokeAction(Points, false);
}
}
3 changes: 2 additions & 1 deletion RotationSolver.Basic/Data/TimelineItem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using ECommons.DalamudServices;
using Newtonsoft.Json.Linq;
using System.Globalization;
using System.Text.RegularExpressions;

namespace RotationSolver.Basic.Data;
Expand Down Expand Up @@ -33,7 +34,7 @@ private uint[] GetActionIds()

foreach ( var id in idsRaw)
{
if(uint.TryParse(id, out var i))
if (uint.TryParse(id, NumberStyles.HexNumber, null, out var i))
{
reuslt.Add(i);
}
Expand Down
7 changes: 6 additions & 1 deletion RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,5 +371,10 @@
"RotationSolver.Basic.Data.JobRole.Melee": "Melee",
"RotationSolver.Basic.Data.JobRole.Healer": "Healer",
"RotationSolver.Basic.Data.JobRole.RangedPhysical": "RangedPhysical",
"RotationSolver.Basic.Data.JobRole.RangedMagical": "RangedMagical"
"RotationSolver.Basic.Data.JobRole.RangedMagical": "RangedMagical",
"RotationSolver.Basic.Configuration.Timeline.TimelineCondition.ObjectType.GameObject": "GameObject",
"RotationSolver.Basic.Configuration.Timeline.TimelineCondition.ObjectType.BattleCharactor": "BattleCharactor",
"RotationSolver.Basic.Configuration.Timeline.TimelineCondition.ObjectType.PlayerCharactor": "PlayerCharactor",
"RotationSolver.Basic.Configuration.Timeline.TimelineCondition.ObjectType.Myself": "Myself",
"RotationSolver.Basic.Configuration.Timeline.MacroTimelineItem": "Macro Time line"
}
23 changes: 22 additions & 1 deletion RotationSolver/RotationSolverPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
using RotationSolver.Localization;
using RotationSolver.UI;
using RotationSolver.Updaters;
using System.Xml.Linq;
using XIVPainter;
using XIVPainter.Vfx;

namespace RotationSolver;

Expand Down Expand Up @@ -96,7 +98,26 @@ public RotationSolverPlugin(DalamudPluginInterface pluginInterface)
#if DEBUG
if (Player.Available)
{
//_ = XIVPainterMain.ShowOff();
Task.Run(async () =>
{
var player = Player.Object;
var target = Svc.Targets.Target ?? player;

foreach (var str in Svc.Data.GetExcelSheet<Lumina.Excel.GeneratedSheets2.Lockon>()!.Select(i => i.Unknown0.RawString))
{
using var i = new ActorVfx(str.LockOn(), player, target);
Svc.Toasts.ShowError(str);
await Task.Delay(5000);
}

Svc.Toasts.ShowQuest("That's All Lock On!", new Dalamud.Game.Gui.Toast.QuestToastOptions()
{
DisplayCheckmark = true,
PlaySound = true,
});
});

_ = XIVPainterMain.ShowOff();
}
#endif
}
Expand Down
30 changes: 0 additions & 30 deletions RotationSolver/UI/ConditionDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -887,36 +887,6 @@ private static void DrawAfter(this TerritoryCondition territoryCondition, ICusto
territoryCondition.Name = i;
}, UiString.ConfigWindow_Condition_DutyName.Local());
break;

case TerritoryConditionType.MapEffect:
ImGui.SameLine();

ImGui.Text("Pos:");
DrawDragInt($"##Position{territoryCondition.GetHashCode()}", ref territoryCondition.Position);

ImGui.SameLine();

ImGui.Text("P1:");
DrawDragInt($"##Param1{territoryCondition.GetHashCode()}", ref territoryCondition.TerritoryId);

ImGui.SameLine();

ImGui.Text("P2:");
DrawDragInt($"##Param2{territoryCondition.GetHashCode()}", ref territoryCondition.Param2);

ImGui.SameLine();

ImGui.Text("Time Offset:");
ImGui.SameLine();
const float MIN = 0, MAX = 60;

ImGui.SetNextItemWidth(80 * ImGuiHelpers.GlobalScale);
if (ImGui.DragFloatRange2($"##TimeOffset {territoryCondition.GetHashCode()}", ref territoryCondition.TimeStart, ref territoryCondition.TimeEnd, 0.1f, MIN, MAX))
{
territoryCondition.TimeStart = Math.Max(Math.Min(territoryCondition.TimeStart, territoryCondition.TimeEnd), MIN);
territoryCondition.TimeEnd = Math.Min(Math.Max(territoryCondition.TimeStart, territoryCondition.TimeEnd), MAX);
}
break;
}
}
#endregion
Expand Down
Loading

0 comments on commit 7a441f0

Please sign in to comment.