Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
3006bab9cd |
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,6 +3,7 @@ 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
|
||||||
|
0
project/References/SPT/.keep
Normal file
0
project/References/SPT/.keep
Normal file
@ -1,7 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Aki.Reflection.Patching;
|
using Comfort.Common;
|
||||||
|
using SPT.Reflection.Patching;
|
||||||
using EFT;
|
using EFT;
|
||||||
using EFT.Communications;
|
using EFT.Communications;
|
||||||
using EFT.PrefabSettings;
|
using EFT.PrefabSettings;
|
||||||
@ -23,17 +24,25 @@ namespace Terkoiz.FlareEventNotifier
|
|||||||
}
|
}
|
||||||
|
|
||||||
[PatchPrefix]
|
[PatchPrefix]
|
||||||
public static void PatchPrefix(FlareEventType flareType, EZoneEventTypeEnumClone eventType)
|
public static void PatchPrefix(FlareEventType flareType, EZoneEventTypeEnumClone eventType, string playerProfileID)
|
||||||
{
|
{
|
||||||
if (flareType != FlareEventType.ExitActivate)
|
if (flareType != FlareEventType.ExitActivate)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eventType == EZoneEventTypeEnumClone.FiredPlayerAddedInShotList || eventType == EZoneEventTypeEnumClone.PlayerByPartyAddedInShotList)
|
if (eventType != EZoneEventTypeEnumClone.FiredPlayerAddedInShotList && eventType != EZoneEventTypeEnumClone.PlayerByPartyAddedInShotList)
|
||||||
{
|
{
|
||||||
NotificationManagerClass.DisplayNotification(new ExfilFlareSuccessNotification());
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var localPlayer = GetLocalPlayerFromWorld();
|
||||||
|
if (localPlayer != null && localPlayer.ProfileId != playerProfileID)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NotificationManagerClass.DisplayNotification(new ExfilFlareSuccessNotification());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -47,9 +56,24 @@ 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()
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@ using JetBrains.Annotations;
|
|||||||
|
|
||||||
namespace Terkoiz.FlareEventNotifier
|
namespace Terkoiz.FlareEventNotifier
|
||||||
{
|
{
|
||||||
[BepInPlugin("com.terkoiz.flareeventnotifier", "Terkoiz.FlareEventNotifier", "1.0.1")]
|
[BepInPlugin("com.terkoiz.flareeventnotifier", "Terkoiz.FlareEventNotifier", "1.0.2")]
|
||||||
public class FlareEventNotifierPlugin : BaseUnityPlugin
|
public class FlareEventNotifierPlugin : BaseUnityPlugin
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net472</TargetFramework>
|
<TargetFramework>net472</TargetFramework>
|
||||||
<Version>1.0.1</Version>
|
<Version>1.0.2</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\EFT_Managed\Aki.Reflection.dll</HintPath>
|
<HintPath>..\References\SPT\spt-reflection.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Assembly-CSharp">
|
<Reference Include="Assembly-CSharp">
|
||||||
|
Reference in New Issue
Block a user