RSR update

This commit is contained in:
SamSWAT 2023-02-06 23:13:20 +03:00
parent f74ad87802
commit 1cee7c22ae
8 changed files with 28 additions and 29 deletions

View File

@ -1,7 +1,7 @@
using System.Reflection;
using Aki.Bundles.Models;
using Aki.Bundles.Utils;
using Aki.Common.Utils;
using Aki.Custom.Models;
using Aki.Custom.Utils;
using Aki.Reflection.Patching;
using Newtonsoft.Json.Linq;

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -32,8 +32,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="aki-bundles, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\References\aki-bundles.dll</HintPath>
<Reference Include="aki-custom">
<HintPath>..\..\References\aki-custom.dll</HintPath>
</Reference>
<Reference Include="Aki.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\References\Aki.Common.dll</HintPath>
@ -44,6 +44,9 @@
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\References\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="BepInEx">
<HintPath>..\..\References\BepInEx.dll</HintPath>
</Reference>
<Reference Include="BepInEx, Version=5.4.21.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\References\BepInEx.dll</HintPath>
</Reference>
@ -53,7 +56,7 @@
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
<HintPath>..\..\References\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System"/>
<Reference Include="System" />
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\References\UnityEngine.dll</HintPath>
</Reference>
@ -62,13 +65,13 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Patch.cs"/>
<Compile Include="SightSwitch.cs"/>
<Compile Include="Plugin.cs"/>
<Compile Include="Properties\AssemblyInfo.cs"/>
<Compile Include="BundleLoader.cs"/>
<Compile Include="Patch.cs" />
<Compile Include="SightSwitch.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="BundleLoader.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@ -34,7 +34,7 @@ namespace SamSWAT.SixthSense
new Patch().Enable();
string uri = "file://" + (BepInEx.Paths.PluginPath + "/SamSWAT.SixthSense/audio.ogg").Replace("\\", "/");
using (UnityWebRequest web = UnityWebRequestMultimedia.GetAudioClip(uri, AudioType.OGGVORBIS))
using (var web = UnityWebRequestMultimedia.GetAudioClip(uri, AudioType.OGGVORBIS))
{
var asyncOperation = web.SendWebRequest();
@ -55,7 +55,7 @@ namespace SamSWAT.SixthSense
public class Patch : ModulePatch
{
private static float nextTime = 0;
private static float nextTime;
protected override MethodBase GetTargetMethod()
{
@ -65,23 +65,19 @@ namespace SamSWAT.SixthSense
[PatchPostfix]
public static void PatchPostfix(BotOwner bot)
{
if (Plugin.PluginEnabled.Value && Plugin.AudioClip != null && Time.time > nextTime)
{
//GClass442 goalEnemy = bot.Memory.GoalEnemy;
object goalEnemy = bot.Memory.GetType().GetProperty("GoalEnemy").GetValue(bot.Memory);
if (!Plugin.PluginEnabled.Value || Plugin.AudioClip == null || Time.time < nextTime) return;
//GClass442 goalEnemy = bot.Memory.GoalEnemy;
object goalEnemy = bot.Memory.GetType().GetProperty("GoalEnemy").GetValue(bot.Memory);
if (goalEnemy != null)
{
IAIDetails person = (IAIDetails)goalEnemy.GetType().GetProperty("Person").GetValue(goalEnemy);
bool isVisible = (bool)goalEnemy.GetType().GetProperty("IsVisible").GetValue(goalEnemy);
if (goalEnemy == null) return;
IAIDetails person = (IAIDetails)goalEnemy.GetType().GetProperty("Person").GetValue(goalEnemy);
bool isVisible = (bool)goalEnemy.GetType().GetProperty("IsVisible").GetValue(goalEnemy);
if (person.GetPlayer.IsYourPlayer && isVisible)
{
Singleton<GUISounds>.Instance.PlaySound(Plugin.AudioClip);
nextTime = Time.time + Plugin.Cooldown.Value;
}
}
}
if (!person.GetPlayer.IsYourPlayer || !isVisible) return;
Singleton<GUISounds>.Instance.PlaySound(Plugin.AudioClip);
nextTime = Time.time + Plugin.Cooldown.Value;
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
References/aki-custom.dll Normal file

Binary file not shown.