Skip to content

Commit 719a373

Browse files
committed
[PR] Patch 7.0 support
No functional changes.
1 parent 389c105 commit 719a373

File tree

6 files changed

+46
-43
lines changed

6 files changed

+46
-43
lines changed

PositionalGuide/Configuration.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,16 @@ public const int
7676
/// Starts at front then goes clockwise up to index=7, then circle at index=8 and outer circle at index=9
7777
/// </summary>
7878
public Vector4[] LineColours { get; set; } = new Vector4[] {
79-
new Vector4(1, 0, 0, 1), // front
80-
new Vector4(1, 0, 0, 1), // front right
81-
new Vector4(0, 0, 1, 1), // right
82-
new Vector4(0, 1, 0, 1), // back right
83-
new Vector4(0, 1, 0, 1), // back
84-
new Vector4(0, 1, 0, 1), // back left
85-
new Vector4(0, 0, 1, 1), // left
86-
new Vector4(1, 0, 0, 1), // front left
87-
new Vector4(1, 1, 0, 1), // circle default
88-
new Vector4(1, 1, 0, 1), // outer circle default
79+
new(1, 0, 0, 1), // front
80+
new(1, 0, 0, 1), // front right
81+
new(0, 0, 1, 1), // right
82+
new(0, 1, 0, 1), // back right
83+
new(0, 1, 0, 1), // back
84+
new(0, 1, 0, 1), // back left
85+
new(0, 0, 1, 1), // left
86+
new(1, 0, 0, 1), // front left
87+
new(1, 1, 0, 1), // circle default
88+
new(1, 1, 0, 1), // outer circle default
8989
};
9090

9191
public void Update() {

PositionalGuide/ImGuitils.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ namespace PrincessRTFM.PositionalGuide;
77
internal class ImGuitils {
88
public int TooltipPixelWrapWidth;
99

10-
public ImGuitils(int tooltipPixelWrapWidth) {
11-
this.TooltipPixelWrapWidth = tooltipPixelWrapWidth;
12-
}
10+
public ImGuitils(int tooltipPixelWrapWidth) => this.TooltipPixelWrapWidth = tooltipPixelWrapWidth;
1311

1412
public void Tooltip(string text) {
1513
if (ImGui.IsItemHovered()) {

PositionalGuide/Plugin.cs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
using Dalamud.Game.ClientState.Objects.SubKinds;
99
using Dalamud.Game.ClientState.Objects.Types;
1010
using Dalamud.Game.Gui.Dtr;
11-
using Dalamud.Interface.Internal.Notifications;
11+
using Dalamud.Interface.ImGuiNotification;
1212
using Dalamud.Interface.Utility;
1313
using Dalamud.Interface.Windowing;
1414
using Dalamud.IoC;
@@ -27,7 +27,7 @@ public class Plugin: IDalamudPlugin {
2727
// lineIndexToRad and circleSegmentIdxToRad are fixed and only need to be calculated once at the start,
2828
// since neither the number of lines nor the number of circle segments change
2929
private readonly float[] lineIndexToAngle = Enumerable.Range(Configuration.IndexFront, Configuration.IndexFrontLeft + 1).Select(idx => (float)(idx * Math.PI / 4)).ToArray();
30-
private readonly float[] circleSegmentIdxToAngle = Enumerable.Range(0, circleSegmentCount).Select(idx => (float)(idx * (2.0 * Math.PI / circleSegmentCount))).ToArray();
30+
private readonly float[] circleSegmentIdxToAngle = Enumerable.Range(0, circleSegmentCount).Select(idx => (float)(idx * (2.0 * Math.PI / circleSegmentCount))).ToArray();
3131
private readonly Vector4[] circleSegmentIdxToColour = new Vector4[circleSegmentCount];
3232

3333
private enum CircleTypes { Target, Outer };
@@ -39,7 +39,7 @@ private enum CircleTypes { Target, Outer };
3939

4040
[PluginService] public static IGameGui Gui { get; private set; } = null!;
4141
[PluginService] public static IChatGui Chat { get; private set; } = null!;
42-
[PluginService] public static DalamudPluginInterface Interface { get; private set; } = null!;
42+
[PluginService] public static IDalamudPluginInterface Interface { get; private set; } = null!;
4343
[PluginService] public static ICommandManager Commands { get; private set; } = null!;
4444
[PluginService] public static IClientState Client { get; private set; } = null!;
4545
[PluginService] public static ITargetManager Targets { get; private set; } = null!;
@@ -50,7 +50,7 @@ private enum CircleTypes { Target, Outer };
5050

5151
private readonly WindowSystem windowSystem;
5252
private readonly ConfigWindow configWindow;
53-
private readonly DtrBarEntry dtrEntry;
53+
private readonly IDtrBarEntry dtrEntry;
5454

5555
public Plugin(IDtrBar dtrBar) {
5656
this.Config = Interface.GetPluginConfig() as Configuration ?? new();
@@ -117,10 +117,10 @@ internal void Draw() {
117117
if (!this.Config.Enabled)
118118
return;
119119

120-
if (Targets.Target is not BattleChara target)
120+
if (Targets.Target is not IBattleNpc target)
121121
return;
122122

123-
if (Client.LocalPlayer is not PlayerCharacter player)
123+
if (Client.LocalPlayer is not IPlayerCharacter player)
124124
return;
125125

126126
if (target.ObjectKind is ObjectKind.Player) {
@@ -174,16 +174,17 @@ internal void Draw() {
174174
for (int lineIndex = Configuration.IndexFront; lineIndex <= Configuration.IndexFrontLeft; ++lineIndex) {
175175
if (!this.Config.DrawGuides[lineIndex])
176176
continue;
177-
anyLineActive = true;
177+
anyLineActive = true;
178178

179179
Vector3 rotated = RotatePoint(targetPos, guidelineBasePoint2, targetFacing + this.lineIndexToAngle[lineIndex]);
180180
bool endpointOnScreen = Gui.WorldToScreen(rotated, out Vector2 coord);
181-
if (limitEither) {
182-
if (!targetOnScreen && !endpointOnScreen)
183-
continue;
184-
} else if (limitOuter && !endpointOnScreen) {
185-
continue;
186-
}
181+
if (limitEither) {
182+
if (!targetOnScreen && !endpointOnScreen)
183+
continue;
184+
}
185+
else if (limitOuter && !endpointOnScreen) {
186+
continue;
187+
}
187188
drawing.AddLine(centre, coord, ImGui.GetColorU32(this.Config.LineColours[lineIndex]), this.Config.LineThickness);
188189
}
189190

@@ -264,13 +265,13 @@ private void DrawCircle(ImDrawListPtr drawing, Vector3 targetPos, Vector3 basePo
264265
case CircleTypes.Outer:
265266
circleColour = this.Config.LineColours[Configuration.IndexOuterCircle];
266267
forceCircleColour = this.Config.AlwaysUseCircleColours || this.Config.AlwaysUseCircleColoursOuter || !anyLineActive;
267-
circleBasePoint += new Vector3(0, 0, this.Config.SoftOuterCircleRange);
268+
circleBasePoint += new Vector3(0, 0, this.Config.SoftOuterCircleRange);
268269
break;
269270
}
270271

271272
Vector3 startPoint = RotatePoint(targetPos, circleBasePoint, targetFacing);
272273
Vector3[] points = CirclePoints(targetPos, startPoint, this.circleSegmentIdxToAngle).ToArray();
273-
274+
274275
(Vector2 point, bool render)[] screenPoints = new (Vector2 point, bool render)[points.Length];
275276
for (int i = 0; i < points.Length; ++i) {
276277
bool render = Gui.WorldToScreen(points[i], out Vector2 screenPoint);
@@ -310,7 +311,7 @@ private static Vector3 RotatePoint(Vector3 centre, Vector3 originalPoint, double
310311

311312
private static double AngleBetween(Vector2 vertex, Vector2 a, Vector2 b) => Math.Atan2(b.Y - vertex.Y, b.X - vertex.X) - Math.Atan2(a.Y - vertex.Y, a.X - vertex.X);
312313
private static double AngleBetween(Vector3 vertex, Vector3 a, Vector3 b) => AngleBetween(new Vector2(vertex.X, vertex.Z), new Vector2(a.X, a.Z), new Vector2(b.X, b.Z));
313-
private static float AngleDifference(float a, float b) => (float)(Math.Min(Math.Abs(a - b), Math.Abs(Math.Abs(a - b) - (2 * Math.PI))));
314+
private static float AngleDifference(float a, float b) => (float)Math.Min(Math.Abs(a - b), Math.Abs(Math.Abs(a - b) - (2 * Math.PI)));
314315

315316
private static IEnumerable<Vector2> CirclePoints(Vector2 centre, Vector2 start, float[] angles) {
316317
foreach (float angle in angles)

PositionalGuide/PositionalGuide.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
44
<Product>PositionalGuide</Product>
5-
<Version>4.6.0</Version>
5+
<Version>4.6.0.1</Version>
66
<Description>Provides drawn guidelines to see where you need to stand to hit enemies with positionals</Description>
77
<Copyright>Copyleft VariableVixen 2022</Copyright>
88
<PackageProjectUrl>https://github.com/PrincessRTFM/PositionalAssistant</PackageProjectUrl>

PositionalGuide/dalamud.props

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<Import Project="framework.props" />
1616

1717
<ItemGroup>
18-
<PackageReference Include="DalamudPackager" Version="2.1.12" />
18+
<PackageReference Include="DalamudPackager" Version="2.1.13" />
1919
<Reference Include="Newtonsoft.Json">
2020
<HintPath>$(DalamudLibPath)Newtonsoft.Json.dll</HintPath>
2121
<Private>False</Private>
@@ -44,6 +44,10 @@
4444
<HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath>
4545
<Private>False</Private>
4646
</Reference>
47+
<Reference Include="InteropGenerator.Runtime">
48+
<HintPath>$(DalamudLibPath)InteropGenerator.Runtime.dll</HintPath>
49+
<Private>False</Private>
50+
</Reference>
4751
</ItemGroup>
4852

4953
<ItemGroup>

PositionalGuide/packages.lock.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"version": 1,
3-
"dependencies": {
4-
"net8.0-windows7.0": {
5-
"DalamudPackager": {
6-
"type": "Direct",
7-
"requested": "[2.1.12, )",
8-
"resolved": "2.1.12",
9-
"contentHash": "Sc0PVxvgg4NQjcI8n10/VfUQBAS4O+Fw2pZrAqBdRMbthYGeogzu5+xmIGCGmsEZ/ukMOBuAqiNiB5qA3MRalg=="
10-
}
11-
}
12-
}
13-
}
2+
"version": 1,
3+
"dependencies": {
4+
"net8.0-windows7.0": {
5+
"DalamudPackager": {
6+
"type": "Direct",
7+
"requested": "[2.1.13, )",
8+
"resolved": "2.1.13",
9+
"contentHash": "rMN1omGe8536f4xLMvx9NwfvpAc9YFFfeXJ1t4P4PE6Gu8WCIoFliR1sh07hM+bfODmesk/dvMbji7vNI+B/pQ=="
10+
}
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)