bump
This commit is contained in:
parent
a30bab42ac
commit
acac743403
1
.gitignore
vendored
1
.gitignore
vendored
@ -52,3 +52,4 @@ WIP/CWX-BackpackReload/CWX-BackpackReload/obj
|
||||
|
||||
WIP/CWX-BUNDLEMAKER/BUNDLEMAKER/bin
|
||||
WIP/CWX-BUNDLEMAKER/BUNDLEMAKER/obj
|
||||
Live/CWX_Mods.sln.DotSettings.user
|
||||
|
@ -21,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CWX_LockPicking", "CWX_Lock
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kaeno-TraderScrolling", "Kaeno-TraderScrolling\Kaeno-TraderScrolling.csproj", "{01BF7708-EC1F-4E2A-A788-084AE1C9E467}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chocster-mod", "Chocster-mod\Chocster-mod.csproj", "{1EE1391B-8D03-43C1-BB65-8B631122D54C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -63,6 +65,10 @@ Global
|
||||
{01BF7708-EC1F-4E2A-A788-084AE1C9E467}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{01BF7708-EC1F-4E2A-A788-084AE1C9E467}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{01BF7708-EC1F-4E2A-A788-084AE1C9E467}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1EE1391B-8D03-43C1-BB65-8B631122D54C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1EE1391B-8D03-43C1-BB65-8B631122D54C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1EE1391B-8D03-43C1-BB65-8B631122D54C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1EE1391B-8D03-43C1-BB65-8B631122D54C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
35
Live/Chocster-mod/Chocster-mod.csproj
Normal file
35
Live/Chocster-mod/Chocster-mod.csproj
Normal file
@ -0,0 +1,35 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<RootNamespace>Chocster_mod</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>..\..\..\Shared\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Aki.Common">
|
||||
<HintPath>..\..\..\Shared\Aki.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Aki.Reflection">
|
||||
<HintPath>..\..\..\Shared\Aki.Reflection.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>..\..\..\Shared\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BepInEx">
|
||||
<HintPath>..\..\..\Shared\BepInEx.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Comfort">
|
||||
<HintPath>..\..\..\Shared\Comfort.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>..\..\..\Shared\UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>..\..\..\Shared\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
47
Live/Chocster-mod/patch.cs
Normal file
47
Live/Chocster-mod/patch.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Aki.Reflection.Patching;
|
||||
using System.Reflection;
|
||||
using Aki.Reflection.Utils;
|
||||
using EFT;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace Chocster_mod
|
||||
{
|
||||
public class ChocPatch : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return PatchConstants.EftTypes.First(IsTargetType).GetMethod("OnModChanged", PatchConstants.PublicFlags);
|
||||
}
|
||||
|
||||
private bool IsTargetType(Type type)
|
||||
{
|
||||
if (type.Name == "Class943")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
[PatchPrefix]
|
||||
private static void PatchPrefix(ref object __instance)
|
||||
{
|
||||
Logger.LogError($"Get weaponPrefab");
|
||||
var testTraverse = (Player.FirearmController) Traverse.Create(__instance).Field("firearmController_0").GetValue();
|
||||
var testtest = (WeaponPrefab)Traverse.Create(testTraverse).Field("weaponPrefab_0").GetValue();
|
||||
Logger.LogError($"Got weaponPrefab");
|
||||
Logger.LogError($"Get weaponPrefab methods");
|
||||
var methodsOnType = testtest.GetType().GetMethods().ToList();
|
||||
Logger.LogError($"Log weaponPrefab methods");
|
||||
foreach (var method in methodsOnType)
|
||||
{
|
||||
Logger.LogError(method.Name);
|
||||
}
|
||||
Logger.LogError($"End");
|
||||
testtest.ResetStatesToDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
18
Live/Chocster-mod/plugin.cs
Normal file
18
Live/Chocster-mod/plugin.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using BepInEx;
|
||||
using BepInEx.Logging;
|
||||
|
||||
namespace Chocster_mod
|
||||
{
|
||||
[BepInPlugin("com.ChocMod", "ChocMod", "1.0.0")]
|
||||
public class ChocPlugin : BaseUnityPlugin
|
||||
{
|
||||
internal new static ManualLogSource Logger { get; private set; }
|
||||
private void Awake()
|
||||
{
|
||||
Logger = base.Logger;
|
||||
|
||||
new ChocPatch().Enable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Aki.Reflection.Patching;
|
||||
using EFT.InventoryLogic;
|
||||
using EFT.UI.DragAndDrop;
|
||||
using System.Reflection;
|
||||
using Aki.Reflection.Utils;
|
||||
using EFT.UI;
|
||||
using UnityEngine;
|
||||
using Newtonsoft.Json;
|
||||
@ -13,7 +15,31 @@ namespace Test_layout
|
||||
{
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return typeof(ContainedGridsView).GetMethod("CreateGrids", BindingFlags.Public | BindingFlags.Static);
|
||||
var typesToCheck = PatchConstants.EftTypes;
|
||||
var afterChecks = typesToCheck.First(IsTargetType);
|
||||
|
||||
Debug.LogError($"AfterChecks: {afterChecks.Name}");
|
||||
|
||||
var methodToCheck = afterChecks.GetMethod("OnModChanged", PatchConstants.PublicFlags);
|
||||
|
||||
Debug.LogError($"methodName: {methodToCheck.Name}");
|
||||
|
||||
return methodToCheck;
|
||||
}
|
||||
|
||||
private bool IsTargetType(Type type)
|
||||
{
|
||||
Debug.LogError($"type name: {type.Name}");
|
||||
var fieldsToCheck = type.GetFields();
|
||||
|
||||
if (fieldsToCheck.Length == 4 && fieldsToCheck.Any(x => x.Name == "item_0") &&
|
||||
fieldsToCheck.Any(x => x.Name == "slot_0") && fieldsToCheck.Any(x => x.Name == "callback_0"))
|
||||
{
|
||||
Debug.LogError("type found mother fucker");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
[PatchPostfix]
|
||||
|
Loading…
x
Reference in New Issue
Block a user