Skip to content

Commit

Permalink
Added KK_EyeShaking
Browse files Browse the repository at this point in the history
  • Loading branch information
DeathWeasel1337 committed Feb 20, 2019
1 parent 3cc1f89 commit ea2c8de
Show file tree
Hide file tree
Showing 4 changed files with 210 additions and 0 deletions.
96 changes: 96 additions & 0 deletions KK_EyeShaking/KK_EyeShaking.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
using BepInEx;
using Harmony;
using KKAPI;
using KKAPI.Chara;
using System.ComponentModel;
/// <summary>
/// Adds shaking to a character's eye highlights when she is a virgin in an H scene
/// </summary>
namespace KK_EyeShaking
{
[BepInPlugin(GUID, PluginName, Version)]
public class KK_EyeShaking : BaseUnityPlugin
{
public const string GUID = "com.deathweasel.bepinex.eyeshaking";
public const string PluginName = "Eye Shaking";
public const string PluginNameInternal = "KK_EyeShaking";
public const string Version = "1.0";
[DisplayName("Enabled")]
[Category("Config")]
[Description("When enabled, virgins in H scenes will appear to have shaking eye highlights")]
public static ConfigWrapper<bool> Enabled { get; private set; }

void Main()
{
var harmony = HarmonyInstance.Create(GUID);
harmony.PatchAll(typeof(KK_EyeShaking));
CharacterApi.RegisterExtraBehaviour<EyeShakingController>(GUID);
Enabled = new ConfigWrapper<bool>("Enabled", PluginNameInternal, true);
}

private static EyeShakingController GetController(ChaControl character) => character?.gameObject?.GetComponent<EyeShakingController>();

public class EyeShakingController : CharaCustomFunctionController
{
internal bool IsVirgin { get; set; } = true;
internal bool IsVirginOrg { get; set; } = true;
internal bool IsInit { get; set; } = false;

protected override void OnCardBeingSaved(GameMode currentGameMode) { }
protected override void OnReload(GameMode currentGameMode) { }

internal void HSceneStart(bool virgin)
{
IsVirgin = virgin;
IsVirginOrg = virgin;
IsInit = true;
}

internal void HSceneEnd()
{
ChaControl.ChangeEyesShaking(false);
IsInit = false;
}

internal void OnInsert() => IsVirgin = false;
internal void AddOrgasm() => IsVirginOrg = false;

protected override void Update()
{
if (Enabled.Value && IsInit && (IsVirgin || IsVirginOrg))
ChaControl.ChangeEyesShaking(true);
}
}
/// <summary>
/// Insert vaginal
/// </summary>
[HarmonyPrefix, HarmonyPatch(typeof(HFlag), nameof(HFlag.AddSonyuKokanPlay))]
public static void AddSonyuKokanPlay(HFlag __instance) => GetController(__instance.lstHeroine[0].chaCtrl).OnInsert();
/// <summary>
/// Insert anal
/// </summary>
[HarmonyPrefix, HarmonyPatch(typeof(HFlag), nameof(HFlag.AddSonyuAnalPlay))]
public static void AddSonyuAnalPlay(HFlag __instance) => GetController(__instance.lstHeroine[0].chaCtrl).OnInsert();
/// <summary>
/// Something that happens at the end of H scene loading, good enough place to hook
/// </summary>
[HarmonyPrefix, HarmonyPatch(typeof(HSceneProc), "MapSameObjectDisable")]
public static void MapSameObjectDisable(HSceneProc __instance)
{
SaveData.Heroine heroine = __instance.flags.lstHeroine[0];
GetController(heroine.chaCtrl).HSceneStart(heroine.isVirgin && heroine.isAnalVirgin);
}

[HarmonyPrefix, HarmonyPatch(typeof(HFlag), nameof(HFlag.AddSonyuOrg))]
public static void AddSonyuOrg(HFlag __instance) => GetController(__instance.lstHeroine[0].chaCtrl).AddOrgasm();
[HarmonyPrefix, HarmonyPatch(typeof(HFlag), nameof(HFlag.AddSonyuSame))]
public static void AddSonyuSame(HFlag __instance) => GetController(__instance.lstHeroine[0].chaCtrl).AddOrgasm();
[HarmonyPrefix, HarmonyPatch(typeof(HFlag), nameof(HFlag.AddSonyuAnalOrg))]
public static void AddSonyuAnalOrg(HFlag __instance) => GetController(__instance.lstHeroine[0].chaCtrl).AddOrgasm();
[HarmonyPrefix, HarmonyPatch(typeof(HFlag), nameof(HFlag.AddSonyuAnalSame))]
public static void AddSonyuAnalSame(HFlag __instance) => GetController(__instance.lstHeroine[0].chaCtrl).AddOrgasm();

[HarmonyPrefix, HarmonyPatch(typeof(HSceneProc), "EndProc")]
public static void EndProc(HSceneProc __instance) => GetController(__instance.flags.lstHeroine[0].chaCtrl).HSceneEnd();
}
}
72 changes: 72 additions & 0 deletions KK_EyeShaking/KK_EyeShaking.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?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>{7B514B4E-A0BC-4DA9-B2A8-0B72515E8033}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>KK_EyeShaking</RootNamespace>
<AssemblyName>KK_EyeShaking</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</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="KKAPI">
<HintPath>..\lib\KKAPI.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_EyeShaking.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>if exist C:\Illusion\Koikatu\BepInEx (
copy /y $(TargetPath) C:\illusion\Koikatu\BepInEx\$(TargetFileName)
)</PostBuildEvent>
</PropertyGroup>
</Project>
36 changes: 36 additions & 0 deletions KK_EyeShaking/Properties/AssemblyInfo.cs
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_EyeShaking")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("KK_EyeShaking")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[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("7b514b4e-a0bc-4da9-b2a8-0b72515e8033")]

// 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(KK_EyeShaking.KK_EyeShaking.Version)]
[assembly: AssemblyFileVersion(KK_EyeShaking.KK_EyeShaking.Version)]
6 changes: 6 additions & 0 deletions KK_Plugins.sln
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KK_Colliders", "KK_Collider
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KK_FreeHRandom", "KK_FreeHRandom\KK_FreeHRandom.csproj", "{A59CF955-A07B-4EF1-A9B5-169E0CE750DA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KK_EyeShaking", "KK_EyeShaking\KK_EyeShaking.csproj", "{7B514B4E-A0BC-4DA9-B2A8-0B72515E8033}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -123,6 +125,10 @@ Global
{A59CF955-A07B-4EF1-A9B5-169E0CE750DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A59CF955-A07B-4EF1-A9B5-169E0CE750DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A59CF955-A07B-4EF1-A9B5-169E0CE750DA}.Release|Any CPU.Build.0 = Release|Any CPU
{7B514B4E-A0BC-4DA9-B2A8-0B72515E8033}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7B514B4E-A0BC-4DA9-B2A8-0B72515E8033}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B514B4E-A0BC-4DA9-B2A8-0B72515E8033}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B514B4E-A0BC-4DA9-B2A8-0B72515E8033}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit ea2c8de

Please sign in to comment.