-
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a903927
commit 240566c
Showing
3 changed files
with
275 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
using BepInEx; | ||
using BepInEx.Logging; | ||
using Logger = BepInEx.Logger; | ||
using Harmony; | ||
using UnityEngine; | ||
using System; | ||
using System.ComponentModel; | ||
using System.Collections.Generic; | ||
using ExtensibleSaveFormat; | ||
using ChaCustom; | ||
/// <summary> | ||
/// Futa mod. Adds dicks to girls which save and load along with the card. | ||
/// </summary> | ||
namespace KK_FutaMod | ||
{ | ||
[BepInProcess("Koikatu")] //Not for Studio since you can add dicks whenever you want there | ||
[BepInPlugin("com.deathweasel.bepinex.futamod", "Futa Mod", "0.1")] | ||
public class KK_FutaMod : BaseUnityPlugin | ||
{ | ||
[DisplayName("Futa Hotkey")] | ||
[Description("Futa hotkey")] | ||
public static SavedKeyboardShortcut FutaHotkey { get; private set; } | ||
private static bool ListOverride = false; | ||
private static bool DoingLoadFileLimited = false; | ||
|
||
void Main() | ||
{ | ||
var harmony = HarmonyInstance.Create("com.deathweasel.bepinex.futamod"); | ||
harmony.PatchAll(typeof(KK_FutaMod)); | ||
FutaHotkey = new SavedKeyboardShortcut("FutaHotkey", "KK_FutaMod", new KeyboardShortcut(KeyCode.KeypadMinus)); | ||
ExtendedSave.CardBeingLoaded += ExtendedCardLoad; | ||
ExtendedSave.CardBeingSaved += ExtendedCardSave; | ||
} | ||
/// <summary> | ||
/// Replace this with a GUI | ||
/// </summary> | ||
void Update() | ||
{ | ||
if (FutaHotkey.IsDown() && Singleton<CustomBase>.IsInstance() && Singleton<CustomBase>.Instance.chaCtrl != null) | ||
{ | ||
bool IsFuta = !Singleton<CustomBase>.Instance.chaCtrl.chaFile.status.visibleSonAlways; | ||
Singleton<CustomBase>.Instance.chaCtrl.chaFile.status.visibleSonAlways = IsFuta; | ||
PluginData ExtendedData = new PluginData(); | ||
ExtendedData.data = new Dictionary<string, object> { { "Futa", IsFuta } }; | ||
ExtendedSave.SetExtendedDataById(Singleton<CustomBase>.Instance.chaCtrl.chaFile, "KK_FutaMod", ExtendedData); | ||
} | ||
} | ||
/// <summary> | ||
/// Card loading | ||
/// </summary> | ||
private static void ExtendedCardLoad(ChaFile file) | ||
{ | ||
if (ListOverride) return; | ||
|
||
bool IsFuta = false; | ||
PluginData ExtendedData = ExtendedSave.GetExtendedDataById(file, "KK_FutaMod"); | ||
|
||
if (ExtendedData != null && ExtendedData.data.ContainsKey("Futa")) | ||
{ | ||
IsFuta = (bool)ExtendedData.data["Futa"]; | ||
file.status.visibleSonAlways = IsFuta; | ||
} | ||
|
||
//Loading a card while in chara maker | ||
if (Singleton<CustomBase>.IsInstance() && Singleton<CustomBase>.Instance.chaCtrl != null && DoingLoadFileLimited) | ||
{ | ||
ExtendedData = new PluginData(); | ||
ExtendedData.data = new Dictionary<string, object> { { "Futa", IsFuta } }; | ||
ExtendedSave.SetExtendedDataById(Singleton<CustomBase>.Instance.chaCtrl.chaFile, "KK_FutaMod", ExtendedData); | ||
Singleton<CustomBase>.Instance.chaCtrl.chaFile.status.visibleSonAlways = IsFuta; | ||
} | ||
} | ||
/// <summary> | ||
/// Card saving | ||
/// </summary> | ||
private static void ExtendedCardSave(ChaFile file) | ||
{ | ||
PluginData ExtendedData = ExtendedSave.GetExtendedDataById(file, "KK_FutaMod"); | ||
|
||
if (ExtendedData != null && ExtendedData.data.ContainsKey("Futa")) | ||
{ | ||
if (Singleton<CustomBase>.IsInstance() && Singleton<CustomBase>.Instance.chaCtrl != null) | ||
{ | ||
//Saving card from chara maker, get the status from the character | ||
ExtendedData.data["Futa"] = file.status.visibleSonAlways; | ||
ExtendedSave.SetExtendedDataById(file, "KK_FutaMod", ExtendedData); | ||
} | ||
else | ||
{ | ||
//Not in chara maker, keep the existing extended data | ||
ExtendedSave.SetExtendedDataById(file, "KK_FutaMod", ExtendedData); | ||
} | ||
} | ||
else | ||
{ | ||
if (Singleton<CustomBase>.IsInstance() && Singleton<CustomBase>.Instance.chaCtrl != null) | ||
{ | ||
//Saving a character in chara maker that doesn't have extended data | ||
ExtendedData = new PluginData(); | ||
ExtendedData.data = new Dictionary<string, object> { { "Futa", file.status.visibleSonAlways } }; | ||
ExtendedSave.SetExtendedDataById(file, "KK_FutaMod", ExtendedData); | ||
} | ||
} | ||
} | ||
/// <summary> | ||
/// When one ChaFile is copied to another, copy over the extended data too | ||
/// </summary> | ||
[HarmonyPostfix, HarmonyPatch(typeof(ChaFile), nameof(ChaFile.CopyChaFile))] | ||
public static void CopyChaFile(ChaFile dst, ChaFile src) | ||
{ | ||
PluginData ExtendedData = ExtendedSave.GetExtendedDataById(src, "KK_FutaMod"); | ||
|
||
if (ExtendedData != null && ExtendedData.data.ContainsKey("Futa")) | ||
ExtendedSave.SetExtendedDataById(dst, "KK_FutaMod", ExtendedData); | ||
} | ||
/// <summary> | ||
/// When a female is created enable the dick | ||
/// </summary> | ||
[HarmonyPostfix, HarmonyPatch(typeof(Manager.Character), nameof(Manager.Character.CreateChara))] | ||
public static void CreateChara(ChaControl __result, ChaFileControl _chaFile, byte _sex) | ||
{ | ||
if (_sex == 0 || _chaFile == null) return; | ||
|
||
PluginData ExtendedData = ExtendedSave.GetExtendedDataById(_chaFile, "KK_FutaMod"); | ||
|
||
if (ExtendedData != null && ExtendedData.data.ContainsKey("Futa")) | ||
__result.chaFile.status.visibleSonAlways = (bool)ExtendedData.data["Futa"]; | ||
} | ||
|
||
//Allow changing futa state in chara maker only when LoadFileLimited has been called | ||
[HarmonyPrefix, HarmonyPatch(typeof(ChaFileControl), nameof(ChaFileControl.LoadFileLimited), new[] { typeof(string), typeof(byte), typeof(bool), typeof(bool), typeof(bool), typeof(bool), typeof(bool) })] | ||
public static void LoadFileLimitedPrefix() => DoingLoadFileLimited = true; | ||
[HarmonyPostfix, HarmonyPatch(typeof(ChaFileControl), nameof(ChaFileControl.LoadFileLimited), new[] { typeof(string), typeof(byte), typeof(bool), typeof(bool), typeof(bool), typeof(bool), typeof(bool) })] | ||
public static void LoadFileLimitedPostfix() => DoingLoadFileLimited = false; | ||
|
||
//Prevent changing futa state when loading the list of characters | ||
[HarmonyPrefix, HarmonyPatch(typeof(CustomCharaFile), "Initialize")] | ||
public static void CustomScenePrefix() => ListOverride = true; | ||
[HarmonyPostfix, HarmonyPatch(typeof(CustomCharaFile), "Initialize")] | ||
public static void CustomScenePostfix() => ListOverride = false; | ||
|
||
///// <summary> | ||
///// Normal asset loading. Replace the male body name with the female one. | ||
///// </summary> | ||
//[HarmonyPrefix] | ||
//[HarmonyBefore(new string[] { "com.bepis.bepinex.resourceredirector" })] | ||
//[HarmonyPatch(typeof(AssetBundleManager), nameof(AssetBundleManager.LoadAsset), new[] { typeof(string), typeof(string), typeof(Type), typeof(string) })] | ||
//public static void LoadAssetPrefix(ref string assetName) | ||
//{ | ||
// if (assetName == "p_cm_body_00_low") | ||
// assetName = "p_cf_body_00_low"; | ||
// else if (assetName == "p_cm_body_00") | ||
// assetName = "p_cf_body_00"; | ||
//} | ||
///// <summary> | ||
///// Async asset loading. Probably only used in the intro sequence. | ||
///// </summary> | ||
//[HarmonyPrefix] | ||
//[HarmonyBefore(new string[] { "com.bepis.bepinex.resourceredirector" })] | ||
//[HarmonyPatch(typeof(AssetBundleManager), nameof(AssetBundleManager.LoadAssetAsync), new[] { typeof(string), typeof(string), typeof(Type), typeof(string) })] | ||
//public static void LoadAssetAsyncPrefix(ref string assetName) | ||
//{ | ||
// if (assetName == "p_cm_body_00_low") | ||
// assetName = "p_cf_body_00_low"; | ||
// else if (assetName == "p_cm_body_00") | ||
// assetName = "p_cf_body_00"; | ||
//} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<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> | ||
<ProjectGuid>{B0B83F4C-6C04-4E90-A75E-62E8F83E8E7D}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>KK_FutaMod</RootNamespace> | ||
<AssemblyName>KK_FutaMod</AssemblyName> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>embedded</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>..\bin\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<DebugSymbols>true</DebugSymbols> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="0Harmony"> | ||
<HintPath>..\lib\0Harmony.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Assembly-CSharp"> | ||
<HintPath>..\lib\Assembly-CSharp.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="BepInEx"> | ||
<HintPath>..\lib\BepInEx.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="ConfigurationManager"> | ||
<HintPath>..\lib\ConfigurationManager.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="ExtensibleSaveFormat"> | ||
<HintPath>..\lib\ExtensibleSaveFormat.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="UnityEngine"> | ||
<HintPath>..\lib\UnityEngine.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="KK_FutaMod.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("KK_FutaMod")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("KK_FutaMod")] | ||
[assembly: AssemblyCopyright("Copyright © 2018")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("b0b83f4c-6c04-4e90-a75e-62e8f83e8e7d")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |