Esempio n. 1
0
        private void SetupEyeInterface(RegisterSubCategoriesEvent e, KK_CharaOverlaysBasedOnCoordinate owner)
        {
            CharaOverlaysBasedOnCoordinateController controller = MakerAPI.GetCharacterControl().gameObject.GetComponent <CharaOverlaysBasedOnCoordinateController>();
            KoiSkinOverlayController KSOXController             = MakerAPI.GetCharacterControl().gameObject.GetComponent <KoiSkinOverlayController>();

            MakerCategory irisCategory = MakerConstants.Face.Iris;
            MakerCategory eyeCategory  = new MakerCategory(irisCategory.CategoryName, "tglEyeOverlayKSOX", irisCategory.Position + 5, "Iris Overlays");

            e.AddSubCategory(eyeCategory);

            e.AddControl(new MakerButton("Copy iris overlay to all outfits", eyeCategory, owner))
            .OnClick.AddListener(delegate() {
                controller.CopyOverlayToAllOutfits(TexType.EyeOver);
                controller.CopyOverlayToAllOutfits(TexType.EyeUnder);
                Logger.LogMessage("[Chara Overlays Based On Coordinate] Successfully copied iris overlay");
            }
                                 );
            IrisSideRadioBtn = new MakerRadioButtons(eyeCategory, owner, "Side to display", "Both", "Left", "Right");
            e.AddControl(IrisSideRadioBtn)
            .ValueChanged.Subscribe(side => {
                controller.ChangeIrisDisplayside(side);
                //Logger.LogDebug("Changed RadioBtn: " + side);
            }
                                    );
        }
Esempio n. 2
0
        internal PluginData GetPluginData()
        {
            var pluginData = new PluginData();

            if (block.Count > 0)
            {
                try
                {
                    byte[] sceneData = Utils.SerializeData(block.ExportScenes());
                    pluginData.data["scenes"]       = sceneData;
                    pluginData.data["currentScene"] = block.currentSceneIndex;
                    pluginData.data["sceneNames"]   = block.ExportSceneStrings();
                    pluginData.data["trackMap"]     = this.track_map;
                    var saveDataSizeKb = CalculateSaveDataSize(sceneData);
                    Logger.LogMessage($"Saved {(saveDataSizeKb):N} Kb of scene state data.");
                    saveDataSize = saveDataSizeKb;
                    return(pluginData);
                }
                catch (Exception e)
                {
                    Logger.LogError("Error occurred while saving scene data: " + e.ToString());
                    Logger.LogMessage("Failed to save scene data, check debug log for more info.");
                    return(null);
                }
            }
            else
            {
                saveDataSize = 0;
                return(null);
            }
        }
Esempio n. 3
0
        private void OnCardAccept(string[] path)
        {
            if (path.IsNullOrEmpty())
            {
                return;
            }

            var cardType = DetermineCardType(path[0]);

            switch (cardType)
            {
            case ExpectedCardType:
                CardPath.Value = path[0];
                break;

            case CardType.None:
                Logger.LogMessage("Error! Not a card.");
                break;

            case CardType.Unknown:
                Logger.LogMessage("Error! Unknown card type.");
                break;

            default:
                Logger.LogMessage($"Error! This is a {cardType.ToString()} card.");
                break;
            }
        }
Esempio n. 4
0
        private static void BepinexLog(object input, LogLevel level)
        {
            if (logger == null)
            {
                throw new System.NullReferenceException("Log Class in " + Assembly.GetExecutingAssembly().GetName().Name + " not initialized prior to message call!");
            }
            switch (level)
            {
            case LogLevel.Info:
                if (BepinexInfoAlwaysLogs || DebugConvar.value)
                {
                    logger.LogInfo(input);
                }
                break;

            case LogLevel.Message:
                logger.LogMessage(input);
                break;

            case LogLevel.Warning:
                logger.LogWarning(input);
                break;

            case LogLevel.Error:
                logger.LogError(input);
                break;
            }
        }
Esempio n. 5
0
        private void ProcessAssembly(Assembly assembly)
        {
            string assemblyPath = assembly.Location;
            string filename = assembly.GetName().Name;
            string outputPath = Path.Combine(Path.GetDirectoryName(assemblyPath), "publicized_assemblies");
            string outputSuffix = "_publicized";

            Directory.CreateDirectory(outputPath);

            string lastHash = null;
            string curHash = ComputeHash(assemblyPath);

            string hashPath = Path.Combine(outputPath, $"{filename}{outputSuffix}.hash");

            if (File.Exists(hashPath))
            {
                lastHash = File.ReadAllText(hashPath);
            }

            if (curHash == lastHash)
            {
                return;
            }

            log.LogMessage($"Making a public assembly from {filename}");
            RewriteAssembly(assemblyPath).Write($"{Path.Combine(outputPath, filename)}{outputSuffix}.dll");
            File.WriteAllText(hashPath, curHash);
        }
Esempio n. 6
0
        // Called on script startup.
        void Start()
        {
            // Assign our class tracker.
            classTracker = new ClassTracker();

            // Assign our logger.
            Logger = base.Logger;

            // -------------------------------------------------------
            // Config entries.

            // General entries.
            _enabled = Config.Bind("General", "Enabled", true, "Enable the ability to run our code.");
            // _runCustomCode = Config.Bind("General", "ToggleKey", new KeyboardShortcut(KeyCode.U, KeyCode.LeftShift), "A key that runs our code when pressed.");

            // Debug entries.
            _showDebugInfoKey = Config.Bind("Debug", "ShowDebugInfoKey", new KeyboardShortcut(KeyCode.U, KeyCode.LeftShift), "The key used to toggle debug information.");
            _debugShown       = Config.Bind("Debug", "ShowDebugInfo", false, "Show the debug window.");

            // -------------------------------------------------------
            // Our patches.
            // Harmony.CreateAndPatchAll(typeof(Hooks.GameStateMachineHook));
            // Harmony.CreateAndPatchAll(typeof(Hooks.InventoryControlHook));
            // Harmony.CreateAndPatchAll(typeof(Hooks.EnemyAIHook));

            Harmony.CreateAndPatchAll(typeof(Hooks.BountyManagerHook));
            Logger.LogMessage("Successfully hooked onto BountyManager.");
        }
Esempio n. 7
0
        public override void HouseData_Load(string path, ManualLogSource Logger)
        {
            var craftInfo = CraftInfo.LoadStatic(path);
            var housingID = Singleton <CraftScene> .Instance.HousingID;

            if (Singleton <Manager.Housing> .Instance.dicAreaInfo.TryGetValue(housingID, out var areaInfo))
            {
                if (Singleton <Manager.Housing> .Instance.dicAreaSizeInfo.TryGetValue(areaInfo.size, out var areaSizeInfo))
                {
                    if (areaSizeInfo.compatibility.Contains(Singleton <Manager.Housing> .Instance.GetSizeType(craftInfo.AreaNo)))
                    {
                        if (!DragAndDropCore.ShowSceneOverwriteWarnings.Value)
                        {
                            LoadHouseData(path);
                        }
                        else
                        {
                            ConfirmScene.Sentence     = "データを読込みますか?\n" + "セットされたアイテムは削除されます。".Coloring("#DE4529FF").Size(24);
                            ConfirmScene.OnClickedYes = () => { LoadHouseData(path); };
                            ConfirmScene.OnClickedNo  = () => { };
                            Singleton <Game> .Instance.LoadDialog();
                        }
                    }
                    else
                    {
                        Logger.LogMessage("Incorrect housing location");
                    }
                }
            }
        }
Esempio n. 8
0
        internal void Main()
        {
            Logger = base.Logger;

            PopulateUncensorLists();

#if KK || KKS
            _GenderBender = Config.Bind("Config", "Genderbender Allowed", true, new ConfigDescription("Whether or not genderbender characters are allowed. When disabled, girls will always have a female body with no penis, boys will always have a male body and a penis. Genderbender characters will still load in Studio for scene compatibility.", null, new ConfigurationManagerAttributes {
                Order = 29
            }));
#endif
#if !EC
            SeparateStudioExclusions = Config.Bind("Config", "Use separate exclusions for studio", false, new ConfigDescription("Whether separate exclusion lists will be used for studio (requires restart)", null, new ConfigurationManagerAttributes {
                Order = 0
            }));
            SeparateStudioExclusions.SettingChanged += (s, e) => Logger.LogMessage("Restart required for updated setting to take effect.");
#endif
            InitUncensorConfigs("Male", "Body", BodyDictionary, GetConfigBodyList(), 19, out var defaultConf, out var excludeConf);
            DefaultMaleBody        = defaultConf;
            RandomExcludedMaleBody = excludeConf;
            InitUncensorConfigs("Male", "Penis", PenisDictionary, GetConfigPenisList(), 18, out defaultConf, out excludeConf);
            DefaultMalePenis        = defaultConf;
            RandomExcludedMalePenis = excludeConf;
            InitUncensorConfigs("Male", "Balls", BallsDictionary, GetConfigBallsList(), 17, out defaultConf, out excludeConf);
            DefaultMaleBalls        = defaultConf;
            RandomExcludedMaleBalls = excludeConf;
            InitUncensorConfigs("Female", "Body", BodyDictionary, GetConfigBodyList(), 9, out defaultConf, out excludeConf);
            DefaultFemaleBody        = defaultConf;
            RandomExcludedFemaleBody = excludeConf;
            InitUncensorConfigs("Female", "Penis", PenisDictionary, GetConfigPenisList(), 8, out defaultConf, out excludeConf);
            DefaultFemalePenis        = defaultConf;
            RandomExcludedFemalePenis = excludeConf;
            InitUncensorConfigs("Female", "Balls", BallsDictionary, GetConfigBallsList(), 7, out defaultConf, out excludeConf);
            DefaultFemaleBalls        = defaultConf;
            RandomExcludedFemaleBalls = excludeConf;

            DefaultFemaleDisplayBalls = Config.Bind("Config", "Default Female Balls Display", false, new ConfigDescription("Whether balls will be displayed on females if not otherwise configured.", null, new ConfigurationManagerAttributes {
                Order = 6
            }));

            MakerAPI.RegisterCustomSubCategories += MakerAPI_RegisterCustomSubCategories;
            MakerAPI.MakerFinishedLoading        += MakerAPI_MakerFinishedLoading;
            CharacterApi.RegisterExtraBehaviour <UncensorSelectorController>(GUID);
#if !EC
            RegisterStudioControls();
#endif

            var harmony = Harmony.CreateAndPatchAll(typeof(Hooks));

#if KK
            Type       loadAsyncIterator         = typeof(ChaControl).GetNestedTypes(AccessTools.all).First(x => x.Name.StartsWith("<LoadAsync>c__Iterator"));
            MethodInfo loadAsyncIteratorMoveNext = loadAsyncIterator.GetMethod("MoveNext");
            harmony.Patch(loadAsyncIteratorMoveNext, null, null, new HarmonyMethod(typeof(Hooks).GetMethod(nameof(Hooks.LoadAsyncTranspiler), AccessTools.all)));
#elif KKS
            var tpl = new HarmonyMethod(typeof(Hooks), nameof(Hooks.LoadAsyncTranspiler));
            harmony.PatchMoveNext(AccessTools.Method(typeof(ChaControl), nameof(ChaControl.LoadAsync)), transpiler: tpl);
            harmony.Patch(AccessTools.Method(typeof(ChaControl), nameof(ChaControl.LoadNoAsync)), transpiler: tpl);
#endif
        }
Esempio n. 9
0
        public override void Load()
        {
            log = Log;

            log.LogMessage("BetterPolus Mod loaded");

            Harmony.PatchAll();
        }
Esempio n. 10
0
        public override void Load()

        {
            log = Log;
            log.LogMessage("Challenger Better Skeld Mod loaded");

            Harmony.PatchAll();
        }
Esempio n. 11
0
        private static void LoadTestXml()
        {
            var path = Path.Combine(Paths.ConfigPath, "AnimationLoader");

            if (Directory.Exists(path))
            {
                var docs = Directory.GetFiles(path, "*.xml").Select(XDocument.Load).ToList();
                if (docs.Count > 0)
                {
                    Logger.LogMessage("Loading test animations");
                    LoadXmls(docs);
                    return;
                }
            }

            Logger.LogMessage("Make a manifest format .xml in the config/AnimationLoader folder to test animations");
        }
Esempio n. 12
0
        private static IEnumerable <CodeInstruction> ChangeCharaCount(IEnumerable <CodeInstruction> instructions)
        {
            var il = instructions.ToList();

            var index = il.FindIndex(instruction => instruction.opcode == OpCodes.Ldc_I4_4);

            if (index <= 0)
            {
                Logger.LogMessage("Failed transpiling 'ChangeCharaCount' Character count index not found!");
                Logger.LogWarning("Failed transpiling 'ChangeCharaCount' Character count index not found!");
                return(il);
            }

            il[index].opcode  = OpCodes.Ldc_I4_S;
            il[index].operand = girlCount;

            return(il);
        }
        public override void Load()
        {
            displayImpostors = false;
            impostors        = new List <PlayerControl>();
            log = base.Log;
            Harmony.PatchAll();

            log.LogMessage("loaded");
        }
Esempio n. 14
0
        internal void UnloadTemps()
        {
            Log.LogMessage("Unloading extension plugins...");

            foreach (var temp in TemporaryPluginGUIDs)
            {
                if (!(this.Plugins[temp].Instance as HacknetPlugin)?.Unload() ?? true)
                {
                    Log.LogError($"{temp} failed to unload, this could cause problems without a game restart!");
                }
                this.Plugins.Remove(temp);

                Log.LogMessage($"Unloaded {temp}");
            }
            TemporaryPluginGUIDs.Clear();

            Log.LogMessage("Finished unloading extension plugins");
        }
Esempio n. 15
0
        public static IEnumerable <CodeInstruction> HSceneSprite_OnClickMainCategories_AllowMalesClothesCategory(IEnumerable <CodeInstruction> instructions)
        {
            var il = instructions.ToList();

            // Force show males selection in clothes category
            var index = il.FindIndex(instruction => instruction.opcode == OpCodes.Call && (instruction.operand as MethodInfo)?.Name == "SetAnimationMenu");

            if (index <= 0)
            {
                Logger.LogMessage("Failed transpiling 'HSceneSprite_OnClickMainCategories_AllowMalesClothesCategory' SetAnimationMenu index not found!");
                Logger.LogWarning("Failed transpiling 'HSceneSprite_OnClickMainCategories_AllowMalesClothesCategory' SetAnimationMenu index not found!");
                return(il);
            }

            il[index + 5].opcode = OpCodes.Ldc_I4_2;
            il[index + 6].opcode = OpCodes.Clt;

            return(il);
        }
Esempio n. 16
0
        static HookgenPreloader()
        {
            Logging.LogMessage($"BepInEx-Partiality-Wrapper initializing HOOKS...");

            if (!File.Exists(AsmCSharpFilePath))
            {
                Logging.LogMessage($"Could not find 'Assembly-CSharp.dll' file, aborting HOOKS generatiion.");
                return;
            }

            if (File.Exists(HooksAsmFilePath))
            {
                // if HOOKS file is older than the Assembly-Csharp file...
                if (File.GetLastWriteTime(HooksAsmFilePath) < File.GetLastWriteTime(AsmCSharpFilePath))
                {
                    Logging.LogMessage($"HOOKS file is outdated, deleting...");
                    File.Delete(HooksAsmFilePath);
                }
                else
                {
                    Logging.LogMessage($"HOOKS file is up to date!");
                    return;
                }
            }

            Logging.LogMessage("Generating new HOOKS file...");

            try
            {
                using (var modder = new MonoModder
                {
                    InputPath = AsmCSharpFilePath,
                    OutputPath = HooksAsmFilePath,
                    PublicEverything = true,
                    DependencyDirs = new List <string> {
                        Paths.ManagedPath, HookgenPatcherFolder
                    }
                })
                {
                    modder.Read();
                    modder.MapDependencies();
                    var generator = new HookGenerator(modder, Path.GetFileName(HooksAsmFilePath));
                    using (ModuleDefinition module = generator.OutputModule)
                    {
                        generator.HookPrivate = true;
                        generator.Generate();
                        module.Write(HooksAsmFilePath);
                    }
                }

                Logging.LogMessage("Done!");
            }
            catch (Exception ex)
            {
                Logging.LogWarning($"Exception running HOOKS generation!");
                Logging.LogMessage(ex);
            }
        }
Esempio n. 17
0
        private void OnCardAccept(string key, string[] path)
        {
            if (path.IsNullOrEmpty())
            {
                return;
            }

            var cardType = DetermineCardType(path[0]);

            switch (cardType)
            {
            case ExpectedCardType:
                if (key.StartsWith(CardNameDefaultF))
                {
                    CardPathDefaultF.Value = path[0];
                }
                else if (key.StartsWith(CardNameDefaultM))
                {
                    CardPathDefaultM.Value = path[0];
                }
                else if (key.StartsWith(CardNameOther) && CardPathOther != null)
                {
                    CardPathOther.Value = path[0];
                }
                break;

            case CardType.None:
                Logger.LogMessage("Error! Not a card.");
                break;

            case CardType.Unknown:
                Logger.LogMessage("Error! Unknown card type.");
                break;

            default:
                Logger.LogMessage($"Error! This is a {cardType.ToString()} card.");
                break;
            }
        }
Esempio n. 18
0
        public override void Load()
        {
            ServerName = Config.Bind("Server", "Name", "Glaucus Pocus");
            ServerHost = Config.Bind("Server", "Hostname", "127.0.0.1");
            ServerPort = Config.Bind("Server", "Port", (ushort)22023);

            var defaultRegions = ServerManager.DefaultRegions.ToList();
            var ip             = ServerHost.Value;

            if (Uri.CheckSchemeName(ServerHost.Value).ToString() == "Dns")
            {
                try
                {
                    foreach (var address in Dns.GetHostAddresses(ServerHost.Value))
                    {
                        if (address.AddressFamily != AddressFamily.InterNetwork)
                        {
                            continue;
                        }
                        ip = address.ToString();
                        break;
                    }
                }
                catch
                {
                    log.LogMessage("Hostname could not be resolved" + ip);
                }
                log.LogMessage("IP is " + ip);
            }

            defaultRegions.Insert(0, new RegionInfo(ServerName.Value, ip, new[]
            {
                new ServerInfo($"{ServerName.Value}-Master-1", ip, ServerPort.Value)
            }));

            ServerManager.DefaultRegions = defaultRegions.ToArray();

            Harmony.PatchAll();
        }
Esempio n. 19
0
        public static void PrintLogInfo(ManualLogSource log)
        {
            string consoleTitle = $"BepInEx {Paths.BepInExVersion} - {Paths.ProcessName}";

            log.LogMessage(consoleTitle);

            if (ConsoleManager.ConsoleActive)
            {
                ConsoleManager.SetConsoleTitle(consoleTitle);
            }

            //See BuildInfoAttribute for more information about this section.
            object[] attributes = typeof(BuildInfoAttribute).Assembly.GetCustomAttributes(typeof(BuildInfoAttribute), false);

            if (attributes.Length > 0)
            {
                var attribute = (BuildInfoAttribute)attributes[0];
                log.LogMessage(attribute.Info);
            }

            Logger.LogInfo($"System platform: {PlatformHelper.Current}");
        }
Esempio n. 20
0
        public override void Load()
        {
            log = Log;

            log.LogMessage("BetterPolus Mod loaded");

            SceneManager.add_sceneLoaded((Action<Scene, LoadSceneMode>) ((scene, loadSceneMode) =>
            {
                ModManager.Instance.ShowModStamp();
            }));

            Harmony.PatchAll();
        }
Esempio n. 21
0
        public static void Start()
        {
            var preloaderListener = new PreloaderConsoleListener();

            Logger.Listeners.Add(preloaderListener);

            var entrypointAssemblyPath = Path.ChangeExtension(Process.GetCurrentProcess().MainModule.FileName, "dll");

            Paths.SetExecutablePath(entrypointAssemblyPath);

            TypeLoader.SearchDirectories.Add(Path.GetDirectoryName(entrypointAssemblyPath));

            Logger.Sources.Add(TraceLogSource.CreateSource());

            ChainloaderLogHelper.PrintLogInfo(Log);

            Log.Log(LogLevel.Info, $"CLR runtime version: {Environment.Version}");


            AssemblyBuildInfo executableInfo;

            using (var entrypointAssembly = AssemblyDefinition.ReadAssembly(entrypointAssemblyPath))
                executableInfo = AssemblyBuildInfo.DetermineInfo(entrypointAssembly);

            Log.LogInfo($"Game executable build architecture: {executableInfo}");

            Log.Log(LogLevel.Message, "Preloader started");

            using (var assemblyPatcher = new AssemblyPatcher())
            {
                assemblyPatcher.AddPatchersFromDirectory(Paths.PatcherPluginPath);

                Log.Log(LogLevel.Info,
                        $"{assemblyPatcher.PatcherContext.PatchDefinitions.Count} patcher definition(s) loaded");

                assemblyPatcher.LoadAssemblyDirectories(new[] { Paths.GameRootPath }, new[] { "dll", "exe" });

                Log.Log(LogLevel.Info, $"{assemblyPatcher.PatcherContext.AvailableAssemblies.Count} assemblies discovered");

                assemblyPatcher.PatchAndLoad();
            }

            Log.LogMessage("Preloader finished");

            Logger.Listeners.Remove(preloaderListener);

            var chainloader = new NetChainloader();

            chainloader.Initialize();
            chainloader.Execute();
        }
Esempio n. 22
0
        private void Awake()
        {
            Logger = base.Logger;

            try
            {
                Harmony.CreateAndPatchAll(typeof(Hooks), GUID);
            }
            catch (Exception e)
            {
                Logger.LogMessage(GUID + " is not compatible with version of Unity that this game is using!");
                Debug.LogException(e);
                enabled = false;
            }
        }
Esempio n. 23
0
        public override void Load()
        {
            log = Log;

            log.LogMessage("BetterPolus Mod loaded");

            ReactorVersionShower.TextUpdated += (text) =>
            {
                int index = text.Text.LastIndexOf('\n');
                text.Text = text.Text.Insert(index == -1 ? text.Text.Length - 1 : index,
                                             "\nLoaded [5E4CA6FF]BetterPolus v1.1.2-R []by Brybry");
            };

            Harmony.PatchAll();
        }
Esempio n. 24
0
        // Called every frame.
        void Update()
        {
            classTracker.TrackClasses();

            if (_showDebugInfoKey.Value.IsDown())
            {
                // Toggle _debugShown.
                _debugShown.Value = !_debugShown.Value;

                Logger.LogMessage("_debugShown toggled.");
            }

            if (classTracker.gameStateMachine_Running)
            {
                // Update code here.
            }
        }
        public static bool Prefix(ref Dictionary <string, UnlockableDef> ___nameToDefTable)
        {
            //Set up logging
            var unlockableLogger = new ManualLogSource("AchievementLoader.Unlock");

            BepInEx.Logging.Logger.Sources.Add(unlockableLogger);
            unlockableLogger.LogMessage("__== Unlock Loader ==__");

            unlockableLogger.LogInfo("Searching for custom unlockables...");

            var customUnlockableDefs =
                from t in AppDomain.CurrentDomain.GetAssemblies().Where(a => a.GetName().Name != "ConfigurationManager").SelectMany(a => { unlockableLogger.LogDebug(String.Format("Scanning assembly {0} for unlockable defs", a.FullName)); try { return(a.GetTypes()); } catch { unlockableLogger.LogError(String.Format("Unable to scan {0} for types", a.FullName)); return(new Type[0]); } })
                let attributes = t.GetCustomAttributes(typeof(CustomUnlockable), true)
                                 where attributes != null && attributes.Length > 0
                                 select(attributes.Cast <CustomUnlockable>().ToArray()[0]);

            if (customUnlockableDefs.Count() > 0)
            {
                unlockableLogger.LogInfo(string.Format("Found {0} custom unlock(s) to add to catalog", customUnlockableDefs.Count()));

                //Iterate through each custom unlock and add them to the unlock catalog

                foreach (CustomUnlockable customUnlock in customUnlockableDefs)
                {
                    //Create new unlock def
                    UnlockableDef newUnlock = customUnlock.GetUnlockableDef();

                    //Set the index of the unlock def
                    newUnlock.index = new UnlockableIndex(___nameToDefTable.Count);

                    //Add the def to the unlock table
                    ___nameToDefTable.Add(newUnlock.name, newUnlock);

                    unlockableLogger.LogDebug(string.Format("Added Custom Unlock {0}", newUnlock.name));
                }
            }
            else
            {
                unlockableLogger.LogInfo("Found no custom unlocks to add");
            }
            unlockableLogger.LogInfo("Done!");

            //Continue on the the original unlock catalog
            return(true);
        }
Esempio n. 26
0
        public static void ChangeListFilter(CustomSelectListCtrl customSelectListCtrl, ListVisibilityType visibilityType)
        {
            List <CustomSelectInfo> lstSelectInfo = (List <CustomSelectInfo>)Traverse.Create(customSelectListCtrl).Field("lstSelectInfo").GetValue();

            int count = 0;

            for (var i = 0; i < lstSelectInfo.Count; i++)
            {
                CustomSelectInfo customSelectInfo = lstSelectInfo[i];
                if (visibilityType == ListVisibilityType.All)
                {
                    customSelectListCtrl.DisvisibleItem(customSelectInfo.index, false);
                    continue;
                }

                bool hide = visibilityType != ListVisibilityType.Filtered;

                if (customSelectInfo.index >= UniversalAutoResolver.BaseSlotID)
                {
                    ResolveInfo Info = UniversalAutoResolver.TryGetResolutionInfo((ChaListDefine.CategoryNo)customSelectInfo.category, customSelectInfo.index);
                    if (Info != null)
                    {
                        if (CheckBlacklist(Info.GUID, (int)Info.CategoryNo, Info.Slot))
                        {
                            hide = visibilityType == ListVisibilityType.Filtered;
                            count++;
                        }
                    }
                }
                customSelectListCtrl.DisvisibleItem(customSelectInfo.index, hide);
            }
            ListVisibility[customSelectListCtrl] = visibilityType;

            if (count == 0 && visibilityType == ListVisibilityType.Hidden)
            {
                Logger.LogMessage("No items are hidden");
                ChangeListFilter(customSelectListCtrl, ListVisibilityType.Filtered);
            }
        }
Esempio n. 27
0
        private static void InitEliteTiers(CombatDirector.EliteTierDef[] eliteTiers)
        {
            try
            {
                var malachite = RoR2Content.Elites.Poison.eliteIndex;
                var celestine = RoR2Content.Elites.Haunted.eliteIndex;

                // Find the elite tier that contains Poison (Malachite) and Haunted (Celestine).
                // This tier is used after looping.
                var loopEliteTier = eliteTiers.FirstOrDefault(tier =>
                                                              2 == tier.eliteTypes.Count(t =>
                                                                                         t != null && (
                                                                                             t.eliteIndex == malachite ||
                                                                                             t.eliteIndex == celestine
                                                                                             )
                                                                                         )
                                                              );

                if (loopEliteTier.eliteTypes.Contains(RoR2Content.Elites.Lunar))
                {
                    instanceLogger?.LogDebug("Loop elite tier already contains perfected elites; aborting");
                    return;
                }

                if (loopEliteTier == null)
                {
                    instanceLogger?.LogDebug("Loop elites not found through search; falling back to vanilla index");
                    loopEliteTier = eliteTiers[VanillaLoopEliteTier];
                }

                loopEliteTier.eliteTypes = loopEliteTier.eliteTypes.Concat(new[] {
                    RoR2Content.Elites.Lunar,
                }).ToArray();
                instanceLogger?.LogMessage("Perfected elites should now appear after looping");
            }
            catch (Exception e)
            {
                instanceLogger?.LogError(e);
            }
        }
Esempio n. 28
0
        public RichPresence(IntPtr intPtr) : base(intPtr)
        {
            log              = Logger.CreateLogSource("Discord Rich Presence");
            _discord         = new Discord.Discord(764433332330037249L, 0UL);
            _activityManager = _discord.GetActivityManager();
            // TODO: ?
            _activityManager.RegisterCommand("gtfo://run");
            _activityManager.RegisterSteam(493520);

            _currentTime = _currentTime.AddSeconds(10);

            _activityManager.OnActivityJoin += Events.OnActivityJoin;
            log.LogMessage("RichPresence created.");

            Activity activity = new Activity()
            {
                State   = "Playing GTFO",
                Details = "Selecting an expedition."
            };

            SetActivity(activity);
        }
        /// <summary>
        /// Add the button for creating the masking folders
        /// </summary>
        private static void InitStudioUI(Scene scene, LoadSceneMode loadSceneMode)
        {
            if (scene.name != "Studio")
            {
                return;
            }
            SceneManager.sceneLoaded -= InitStudioUI;

            RectTransform original                          = GameObject.Find("StudioScene").transform.Find("Canvas Object List/Image Bar/Button Route").GetComponent <RectTransform>();
            Button        colliderFolderButton              = Instantiate(original.gameObject).GetComponent <Button>();
            Transform     colliderFolderButtonTransform     = colliderFolderButton.transform;
            RectTransform colliderFolderButtonRectTransform = colliderFolderButtonTransform as RectTransform;

            colliderFolderButtonTransform.SetParent(original.parent, true);
            colliderFolderButtonTransform.localScale = original.localScale;
            colliderFolderButtonRectTransform.SetRect(original.anchorMin, original.anchorMax, original.offsetMin, original.offsetMax);
            colliderFolderButtonRectTransform.anchoredPosition = original.anchoredPosition + new Vector2(-96f, 0f);

            Texture2D texture2D = new Texture2D(32, 32);

            texture2D.LoadImage(LoadIcon());
            var icon = colliderFolderButton.targetGraphic as Image;

            icon.sprite = Sprite.Create(texture2D, new Rect(0f, 0f, 32, 32), new Vector2(16, 16));
            icon.color  = Color.white;

            colliderFolderButton.onClick = new Button.ButtonClickedEvent();
            colliderFolderButton.onClick.AddListener(() =>
            {
                SceneControllerInstance.CreateMaskingFolder();
                if (!StudioSceneSettings.SceneController.MapMasking.Value)
                {
                    Logger.LogMessage("The mask will not work until you turn on [system\\Scene Effects\\Map Masking]!");
                }
            });

            Camera.main.gameObject.AddComponent <DrawColliderLines>();
        }
Esempio n. 30
0
        public static void Start(string[] args)
        {
            if (ConfigEntrypointExecutable.Value == null)
            {
                Log.LogFatal($"Entry executable was not set. Please set this in your config before launching the application");
                Program.ReadExit();
                return;
            }

            string executablePath = Path.GetFullPath(ConfigEntrypointExecutable.Value);

            if (!File.Exists(executablePath))
            {
                Log.LogFatal($"Unable to locate executable: {ConfigEntrypointExecutable.Value}");
                Program.ReadExit();
                return;
            }

            Paths.SetExecutablePath(executablePath);
            Program.ResolveDirectories.Add(Paths.GameRootPath);
            TypeLoader.SearchDirectories.Add(Paths.GameRootPath);

            Logger.Sources.Add(TraceLogSource.CreateSource());

            ChainloaderLogHelper.PrintLogInfo(Log);

            Log.LogInfo($"CLR runtime version: {Environment.Version}");

            Log.LogMessage("Preloader started");

            Assembly entrypointAssembly;

            using (var assemblyPatcher = new AssemblyPatcher())
            {
                assemblyPatcher.AddPatchersFromDirectory(Paths.PatcherPluginPath);

                Log.LogInfo($"{assemblyPatcher.PatcherPlugins.Count} patcher plugin(s) loaded");

                assemblyPatcher.LoadAssemblyDirectory(Paths.GameRootPath, "dll", "exe");

                Log.LogInfo($"{assemblyPatcher.AssembliesToPatch.Count} assemblies discovered");

                assemblyPatcher.PatchAndLoad();


                var assemblyName = AssemblyName.GetAssemblyName(executablePath);

                entrypointAssembly = assemblyPatcher.LoadedAssemblies.Values.FirstOrDefault(x => x.FullName == assemblyName.FullName);

                if (entrypointAssembly != null)
                {
                    Log.LogDebug("Found patched entrypoint assembly! Using it");
                }
                else
                {
                    Log.LogDebug("Using entrypoint assembly from disk");
                    entrypointAssembly = Assembly.LoadFrom(executablePath);
                }
            }

            Log.LogMessage("Preloader finished");

            var chainloader = new NetChainloader();

            chainloader.Initialize();
            chainloader.Execute();


            AssemblyFix.Execute(entrypointAssembly);

            entrypointAssembly.EntryPoint.Invoke(null, new [] { args });
        }