Compare commits

..

No commits in common. "main" and "1.0.1" have entirely different histories.
main ... 1.0.1

5 changed files with 8 additions and 33 deletions

1
.gitignore vendored
View File

@ -3,7 +3,6 @@ project/References/EFT_Managed/*
# Allow these files, despite the rules above # Allow these files, despite the rules above
!project/References/EFT_Managed/.keep !project/References/EFT_Managed/.keep
!project/References/SPT/.keep
# ---> VisualStudio # ---> VisualStudio
## Ignore Visual Studio temporary files, build results, and ## Ignore Visual Studio temporary files, build results, and

View File

@ -1,8 +1,7 @@
using System; using System;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using Comfort.Common; using Aki.Reflection.Patching;
using SPT.Reflection.Patching;
using EFT; using EFT;
using EFT.Communications; using EFT.Communications;
using EFT.PrefabSettings; using EFT.PrefabSettings;
@ -24,26 +23,18 @@ namespace Terkoiz.FlareEventNotifier
} }
[PatchPrefix] [PatchPrefix]
public static void PatchPrefix(FlareEventType flareType, EZoneEventTypeEnumClone eventType, string playerProfileID) public static void PatchPrefix(FlareEventType flareType, EZoneEventTypeEnumClone eventType)
{ {
if (flareType != FlareEventType.ExitActivate) if (flareType != FlareEventType.ExitActivate)
{ {
return; return;
} }
if (eventType != EZoneEventTypeEnumClone.FiredPlayerAddedInShotList && eventType != EZoneEventTypeEnumClone.PlayerByPartyAddedInShotList) if (eventType == EZoneEventTypeEnumClone.FiredPlayerAddedInShotList || eventType == EZoneEventTypeEnumClone.PlayerByPartyAddedInShotList)
{ {
return;
}
var localPlayer = GetLocalPlayerFromWorld();
if (localPlayer != null && localPlayer.ProfileId != playerProfileID)
{
return;
}
NotificationManagerClass.DisplayNotification(new ExfilFlareSuccessNotification()); NotificationManagerClass.DisplayNotification(new ExfilFlareSuccessNotification());
} }
}
/// <summary> /// <summary>
/// Copy of the EZoneEventType enum so that a direct GClass reference could be avoided /// Copy of the EZoneEventType enum so that a direct GClass reference could be avoided
@ -56,24 +47,9 @@ namespace Terkoiz.FlareEventNotifier
FiredPlayerAddedInShotList, FiredPlayerAddedInShotList,
PlayerByPartyAddedInShotList PlayerByPartyAddedInShotList
} }
/// <summary>
/// Gets the current <see cref="Player"/> instance if it's available
/// </summary>
/// <returns>Local <see cref="Player"/> instance; returns null if the game is not in raid</returns>
private static Player GetLocalPlayerFromWorld()
{
var gameWorld = Singleton<GameWorld>.Instance;
if (gameWorld == null || gameWorld.MainPlayer == null)
{
return null;
} }
return gameWorld.MainPlayer; public class ExfilFlareSuccessNotification : NotificationClass
}
}
public class ExfilFlareSuccessNotification : NotificationAbstractClass
{ {
public ExfilFlareSuccessNotification() public ExfilFlareSuccessNotification()
{ {

View File

@ -3,7 +3,7 @@ using JetBrains.Annotations;
namespace Terkoiz.FlareEventNotifier namespace Terkoiz.FlareEventNotifier
{ {
[BepInPlugin("com.terkoiz.flareeventnotifier", "Terkoiz.FlareEventNotifier", "1.0.2")] [BepInPlugin("com.terkoiz.flareeventnotifier", "Terkoiz.FlareEventNotifier", "1.0.1")]
public class FlareEventNotifierPlugin : BaseUnityPlugin public class FlareEventNotifierPlugin : BaseUnityPlugin
{ {
[UsedImplicitly] [UsedImplicitly]

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net472</TargetFramework> <TargetFramework>net472</TargetFramework>
<Version>1.0.2</Version> <Version>1.0.1</Version>
<Authors>Terkoiz</Authors> <Authors>Terkoiz</Authors>
<RepositoryUrl>https://dev.sp-tarkov.com/Terkoiz/FlareEventNotifier</RepositoryUrl> <RepositoryUrl>https://dev.sp-tarkov.com/Terkoiz/FlareEventNotifier</RepositoryUrl>
<PackageLicenseExpression>NCSA</PackageLicenseExpression> <PackageLicenseExpression>NCSA</PackageLicenseExpression>
@ -16,7 +16,7 @@
<ItemGroup> <ItemGroup>
<Reference Include="Aki.Reflection"> <Reference Include="Aki.Reflection">
<HintPath>..\References\SPT\spt-reflection.dll</HintPath> <HintPath>..\References\EFT_Managed\Aki.Reflection.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="Assembly-CSharp"> <Reference Include="Assembly-CSharp">