using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CrewBoom;
using CrewBoom.Data;
using CrewBoomAPI;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Reptile;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyCompany("Forcefem")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Everyone is girl!")]
[assembly: AssemblyTitle("Forcefem")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace Forcefem
{
[BepInPlugin("goatgirl.Forcefem", "Forcefem", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public static ManualLogSource Logger;
internal static Harmony Harmony = new Harmony("goatgirl.Forcefem");
public static bool hasCB = false;
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin goatgirl.Forcefem is loaded!");
foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
{
if (pluginInfo.Value.Metadata.GUID.Contains("CrewBoom") || pluginInfo.Value.Metadata.GUID.Equals("CrewBoom"))
{
hasCB = true;
Logger.LogInfo((object)"CrewBoom found!");
}
}
Harmony.PatchAll();
Gatekeeper.BindSettings(((BaseUnityPlugin)this).Config);
}
}
[HarmonyPatch(typeof(Player))]
internal class EstrogenPatch
{
[HarmonyPostfix]
[HarmonyPatch("SetCharacter")]
public static void OverrideCharacterGender(Player __instance)
{
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
Gatekeeper.UpdateListOfNonGirls();
if (Gatekeeper.ListOfNotGirls == null)
{
__instance.isGirl = true;
Plugin.Logger.LogInfo((object)"Gender Override Gender Override Gender Ovveride BAD!!!!! LIST IS BROKEN AS FUCK");
Plugin.Logger.LogInfo((object)__instance.isGirl);
return;
}
if (!Gatekeeper.ListOfNotGirls.Any() || Gatekeeper.config_NotGirls.Value == "")
{
__instance.isGirl = true;
Plugin.Logger.LogInfo((object)"Gender Override Gender Override Gender Ovveride BAD!!! LIST IS EMPTY AS FUCK");
Plugin.Logger.LogInfo((object)__instance.isGirl);
return;
}
string text = "";
string text2 = "";
try
{
if (Plugin.hasCB)
{
if (CrewBoomHelper.IsCustomCharacter(__instance.character))
{
text = CrewBoomHelper.CustomCharacterName(__instance.character);
text2 = CrewBoomHelper.CustomCharacterInternalName(__instance.character);
}
else
{
text = Core.Instance.Localizer.GetCharacterName(__instance.character);
text2 = ((object)(Characters)(ref __instance.character)).ToString();
}
}
else
{
text = Core.Instance.Localizer.GetCharacterName(__instance.character);
text2 = ((object)(Characters)(ref __instance.character)).ToString();
}
}
catch (Exception ex)
{
Plugin.Logger.LogInfo((object)ex.Message);
}
bool flag = (Gatekeeper.ListOfNotGirls.Contains(text.ToLower().Trim()) && text != "") || (Gatekeeper.ListOfNotGirls.Contains(text2.ToLower().Trim()) && text2 != "");
__instance.isGirl = !flag;
Plugin.Logger.LogInfo((object)"Gender Override Gender Override Gender Ovveride");
Plugin.Logger.LogInfo((object)text);
Plugin.Logger.LogInfo((object)text2);
Plugin.Logger.LogInfo((object)__instance.isGirl);
}
[HarmonyPrefix]
[HarmonyPatch("CheckNPCTriggerForConversation")]
private static bool Prefix(NPC npc, Player __instance)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Invalid comparison between Unknown and I4
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Invalid comparison between Unknown and I4
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Invalid comparison between Unknown and I4
if (!__instance.isGirl || __instance.IsDead() || npc.CanDoConversationStarter((ConversationStarter)2))
{
return true;
}
if ((int)__instance.character != 3 && (int)__instance.character != 15 && (int)__instance.character != 25)
{
return true;
}
if (npc.CanDoConversationStarter((ConversationStarter)1) && __instance.sprayButtonNew && __instance.isGirl && npc.CanDoConversationStarter((ConversationStarter)7))
{
npc.StartTalkingWithConvoStarter((ConversationStarter)7);
return false;
}
return true;
}
}
internal class Gatekeeper
{
public static ConfigEntry<string> config_NotGirls;
public static List<string> ListOfNotGirls;
public static List<string> ConvertString(string _string)
{
string text = _string.ToLower();
List<string> list = text.Split(new char[1] { ',' }).ToList();
List<string> list2 = new List<string>();
foreach (string item in list)
{
list2.Add(item.Trim());
}
return list2;
}
public static void UpdateListOfNonGirls()
{
ListOfNotGirls = ConvertString(config_NotGirls.Value);
}
public static void UpdateSettingsEvent(object sender, EventArgs args)
{
UpdateListOfNonGirls();
WorldHandler instance = WorldHandler.instance;
EstrogenPatch.OverrideCharacterGender((instance != null) ? instance.GetCurrentPlayer() : null);
}
public static void BindSettings(ConfigFile Config)
{
config_NotGirls = Config.Bind<string>("Settings", "List of Non-Girl Characters", "", "Names of non-girl characters separated by commas. Both internal names (spaceGirl) and display names (Bel) work. In vanilla: frank, ringdude, metalHead, blockGuy, eightBall, dummy, dj, boarder, headMan, prince, jetpackBossPlayer, legendFace, oldheadPlayer, robot, wideKid, headManNoJetpack, eightBallBoss, legendMetalHead");
config_NotGirls.SettingChanged += UpdateSettingsEvent;
}
}
internal class CrewBoomHelper
{
public static bool IsCustomCharacter(Characters character)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Invalid comparison between Unknown and I4
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
CustomCharacter val = default(CustomCharacter);
return (int)character > 26 && CharacterDatabase.GetCharacter(character, ref val);
}
public static string CustomCharacterName(Characters character)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
string result = default(string);
if (CharacterDatabase.GetCharacterName(character, ref result))
{
return result;
}
return "";
}
public static string CustomCharacterInternalName(Characters character)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected I4, but got Unknown
if (CrewBoomAPIDatabase.IsInitialized)
{
Guid key = default(Guid);
if (!CrewBoomAPIDatabase.GetUserGuidForCharacter((int)character, ref key))
{
return "";
}
if (CharacterDatabase._characterBundlePaths.TryGetValue(key, out var value))
{
return Path.GetFileNameWithoutExtension(value);
}
}
return "";
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Forcefem";
public const string PLUGIN_NAME = "Everyone is girl!";
public const string PLUGIN_VERSION = "1.0.0";
}
}