Skip to content

Commit

Permalink
Too many changes for me to split at this point
Browse files Browse the repository at this point in the history
Added:
Overrides for folder selection
ability to have heroines change to club outfit when starting at koi club
heroines arriving at koi club can be swapped to koi outfit
added ability to give equal weight to non-set items
added ability to not apply set to everything possible
Simplified ME process stuff
fixed hair support
fixed bad queue errors in ME stuff
  • Loading branch information
jalil49 committed Mar 23, 2021
1 parent 6156db1 commit 536b77a
Show file tree
Hide file tree
Showing 15 changed files with 1,178 additions and 1,443 deletions.
4 changes: 4 additions & 0 deletions src/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[*.cs]

# IDE0051: Remove unused private members
dotnet_diagnostic.IDE0051.severity = silent
1,021 changes: 42 additions & 979 deletions src/CharaEvent.cs

Large diffs are not rendered by default.

909 changes: 655 additions & 254 deletions src/ClothingLoader.cs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/Cosplay Academy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<None Include=".editorconfig" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
5 changes: 5 additions & 0 deletions src/Cosplay Academy.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ VisualStudioVersion = 16.0.30907.101
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosplay Academy", "Cosplay Academy.csproj", "{1C928150-B47E-4B1B-9D18-15E4997AF124}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8A65FB8E-42BB-4B1A-A188-A2D60A9EB4E6}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
1 change: 1 addition & 0 deletions src/Definitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ static class Constants
};
public static List<ChaDefault> ChaDefaults = new List<ChaDefault>();
}

public enum HStates
{
FirstTime, //0
Expand Down
46 changes: 33 additions & 13 deletions src/DirectoryFinder.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace Cosplay_Academy
{
static class DirectoryFinder
{
static List<string> Choosen;
static List<string> FoldersPath;
static readonly List<string> Choosen;
static readonly List<string> FoldersPath;
static bool Reset;
static DirectoryFinder()
{
Expand Down Expand Up @@ -45,15 +46,32 @@ public static List<string> Grab_All_Files(string input)
FoldersPath.Clear();
FoldersPath.Add(input);
string[] folders = System.IO.Directory.GetDirectories(input, "*", System.IO.SearchOption.AllDirectories); //grab child folders
FoldersPath.AddRange(folders);
int index = FoldersPath.FindIndex(a => a.EndsWith(@"\Sets"));
FoldersPath.RemoveAt(index);
#if Debug
foreach (var item in FoldersPath)
List<string> FolderLists = folders.ToList();
int index = FolderLists.FindIndex(a => a.EndsWith(@"\Sets"));
FolderLists.RemoveAt(index);
FoldersPath.AddRange(FolderLists);
if (ExpandedOutfit.NonMatchWeight.Value)
{
ExpandedOutfit.Logger.LogError(item);
List<string> append = new List<string>();
foreach (var item in FoldersPath)
{
if (!item.Contains(@"\Sets\"))
{
for (int i = 1; i < Directory.GetFiles(item).Length; i++)
{
append.Add(item);
}
}
}
FoldersPath.AddRange(append);
}
#endif

//ExpandedOutfit.Logger.LogWarning("\n\n");

//foreach (var item in FoldersPath)
//{
// ExpandedOutfit.Logger.LogError(item);
//}
return FoldersPath;
}
public static List<string> Get_Set_Paths(string Narrow)
Expand All @@ -71,11 +89,13 @@ public static List<string> Get_Set_Paths(string Narrow)
}
public static List<string> Get_Outfits_From_Path(string FilePath, bool RemoveSets = true)
{
ExpandedOutfit.Logger.LogDebug("Searching " + FilePath);
//ExpandedOutfit.Logger.LogDebug("Searching " + FilePath);
Choosen.Clear();
List<string> Paths = new List<string>();
Paths.Add(FilePath); //add parent folder to list
//ExpandedOutfit.Logger.LogDebug(coordinatepath + "coordinate" + Narrow);
List<string> Paths = new List<string>
{
FilePath //add parent folder to list
};
//ExpandedOutfit.Logger.LogDebug(coordinatepath + "coordinate" + Narrow);
string[] folders = System.IO.Directory.GetDirectories(FilePath, "*", System.IO.SearchOption.AllDirectories); //grab child folders
if (folders.Length > 0)
{
Expand Down
48 changes: 47 additions & 1 deletion src/GameEvent.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using ActionGame;
using HarmonyLib;
using KKAPI.MainGame;
using System.Collections.Generic;
namespace Cosplay_Academy
{
public class GameEvent : GameCustomFunctionController
Expand All @@ -11,6 +13,10 @@ protected override void OnPeriodChange(Cycle.Type period)
Constants.ChaDefaults.Clear();
OutfitDecider.Reset = true;
}
foreach (var item in Constants.ChaDefaults)
{
item.Changestate = true;
}
}
protected override void OnDayChange(Cycle.Week day)
{
Expand All @@ -22,6 +28,7 @@ protected override void OnDayChange(Cycle.Week day)
}
protected override void OnGameLoad(GameSaveLoadEventArgs args)
{

Constants.ChaDefaults.Clear();
OutfitDecider.Reset = true;
ExpandedOutfit.Logger.LogInfo("Reset has applied");
Expand All @@ -42,6 +49,29 @@ protected override void OnStartH(HSceneProc hSceneProc, bool freeH)
item.ChaControl.SetAccessoryStateAll(true);
}
}
else if (!freeH && ExpandedOutfit.EnableSetting.Value) //required when starting H from special scenes: 3P, caught playing with self, les
{
ClothingLoader clothingLoader = new ClothingLoader();
List<ChaControl> lstFemale = (List<ChaControl>)Traverse.Create(hSceneProc).Field("lstFemale").GetValue();
foreach (var item in lstFemale)
{
//chacontrols from special scenes do not seem to be the same as the ones from reload as changes don't take effect
//used to do it in CharaEvent, but it broke with textures after talkng to someone
var ChaPara = item.fileParam;

var ThisOutfitData = Constants.ChaDefaults.Find(x => ChaPara.personality == x.Personality && x.FullName == ChaPara.fullname && x.BirthDay == ChaPara.strBirthDay);
if (ThisOutfitData != null)
{
//Storedwaifus[ChaPara.fullname + ChaPara.personality + ChaPara.strBirthDay] = ThisOutfitData.ChaControl;
//ThisOutfitData.ChaControl = item;
//ThisOutfitData.Chafile = item.chaFile;
int retain = item.chaFile.status.coordinateType;
clothingLoader.FullLoad(ThisOutfitData, item, item.chaFile);
item.chaFile.status.coordinateType = retain;
item.ChangeCoordinateTypeAndReload();
}
}
}
}
protected override void OnEndH(HSceneProc hSceneProc, bool freeH)
{
Expand All @@ -50,8 +80,24 @@ protected override void OnEndH(HSceneProc hSceneProc, bool freeH)
{
Constants.ChaDefaults.Clear();
OutfitDecider.Reset = true;
ExpandedOutfit.Logger.LogInfo("Reset has applied");
}
//else if (!freeH)
//{
// foreach (var item in Storedwaifus)
// {
// var ThisOutfitData = Constants.ChaDefaults.Find(x => (x.FullName + x.Personality + x.BirthDay) == item.Key);
// if (ThisOutfitData != null)
// {
// ThisOutfitData.ChaControl = item.Value;
// ThisOutfitData.Chafile = item.Value.chaFile;
// }
// else
// {
// ExpandedOutfit.Logger.LogError("Unable to revert chacontrol to normal");
// }
// }
// Storedwaifus.Clear();
//}
}
}
}
Loading

0 comments on commit 536b77a

Please sign in to comment.