From e13cf9409c2b559b70b95e0518cc94275439fecd Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Tue, 7 Feb 2023 21:49:53 +0100 Subject: [PATCH] Add dotnet format as pre-commit hook --- .githooks/pre-commit | 7 +++++++ SlightIsRightPlugin.cs | 10 +++++----- 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 .githooks/pre-commit diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100644 index 0000000..54ba8e5 --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,7 @@ +#!/bin/sh +# +# Use with: +# +# $> git config core.hooksPath .githooks +# +dotnet format SliceIsRight.sln diff --git a/SlightIsRightPlugin.cs b/SlightIsRightPlugin.cs index d81d3d1..e97f36d 100644 --- a/SlightIsRightPlugin.cs +++ b/SlightIsRightPlugin.cs @@ -35,7 +35,7 @@ namespace SliceIsRight [PluginService] private ClientState ClientState { get; set; } - + private const ushort GoldSaucerTerritoryId = 144; private bool IsInGoldSaucer { get; set; } @@ -69,7 +69,7 @@ namespace SliceIsRight if (!ClientState.IsLoggedIn || !IsInGoldSaucer || ObjectTable == null) return; - for (int index = 0; index < ObjectTable.Length; ++ index) + for (int index = 0; index < ObjectTable.Length; ++index) { GameObject? obj = ObjectTable[index]; if (obj == null || DistanceToPlayer(obj.Position) > MaxDistance) @@ -122,7 +122,7 @@ namespace SliceIsRight break; case 2010779: - //default: + //default: DrawFilledCircleWorld(obj, radius ?? 11f, COLOUR_RED); break; } @@ -158,7 +158,7 @@ namespace SliceIsRight onScreen |= GameGui.WorldToScreen(new Vector3(center.X + radius * (float)Math.Sin(Math.PI / segmentCount * index), center.Y, center.Z + radius * (float)Math.Cos(Math.PI / segmentCount * index)), out Vector2 vector2); ImGui.GetWindowDrawList().PathLineTo(vector2); } - + if (onScreen) ImGui.GetWindowDrawList().PathFillConvex(colour); else @@ -187,7 +187,7 @@ namespace SliceIsRight Vector3 farCenter = new Vector3(nearCenter.X + lengthSlice * (float)Math.Sin(rotation), nearCenter.Y, nearCenter.Z + lengthSlice * (float)Math.Cos(rotation)); bool onScreen = false; - foreach (Vector3 v in new[]{ far2, farCenter, far1, near1, nearCenter, near2}) + foreach (Vector3 v in new[] { far2, farCenter, far1, near1, nearCenter, near2 }) { onScreen |= GameGui.WorldToScreen(v, out Vector2 nextVertex); if ((nextVertex.X > 0 & nextVertex.X < displaySize.X) || (nextVertex.Y > 0 & nextVertex.Y < displaySize.Y))