Пример #1
0
        void SaveGameSelectionScreen_OnLoadGame(On.SaveGameSelectionScreen.orig_OnLoadGame orig, SaveGameSelectionScreen self, int slotIndex)
        {
            //slotIndex is 0-based, going to increment it locally to keep things simple.
            int fileSlot = slotIndex + 1;

            //Generate the mappings based on the seed for the game if a seed was generated.
            if (randoStateManager.HasSeedForFileSlot(fileSlot))
            {
                Console.WriteLine($"Seed exists for file slot {fileSlot}. Generating mappings.");

                //Load mappings
                randoStateManager.CurrentLocationToItemMapping = ItemRandomizerUtil.ParseLocationToItemMappings(randoStateManager.GetSeedForFileSlot(fileSlot));
                randoStateManager.CurrentLocationDialogtoRandomDialogMapping = DialogChanger.GenerateDialogMappingforItems();

                randoStateManager.IsRandomizedFile = true;
                randoStateManager.CurrentFileSlot  = fileSlot;
                //Log spoiler log
                randoStateManager.LogCurrentMappings();

                //We force a reload of all dialog when loading the game
                Manager <DialogManager> .Instance.LoadDialogs(Manager <LocalizationManager> .Instance.CurrentLanguage);
            }
            else
            {
                //This save file does not have a seed associated with it or is not a randomized file. Reset the mappings so everything is back to normal.
                Console.WriteLine($"This file slot ({fileSlot}) has no seed generated or is not a randomized file. Resetting the mappings and putting game items back to normal.");
                randoStateManager.ResetRandomizerState();
            }

            orig(self, slotIndex);
        }
        private void SaveGameSelectionScreen_OnLoadGame(On.SaveGameSelectionScreen.orig_OnLoadGame orig, SaveGameSelectionScreen self, int slotIndex)
        {
            orig(self, slotIndex);

            if (!_hcMode)
            {
                return;
            }

            if (Manager <SaveManager> .Instance.GetCurrentSaveGameSlot().SlotName.EndsWith("-hc"))
            {
                if (Manager <SkinManager> .Instance.GetEquippedSkin().skinID != ESkin.DARK_MESSENGER)
                {
                    Manager <SkinManager> .Instance.EquipSkin(ESkin.DARK_MESSENGER);
                }

                Manager <InventoryManager> .Instance.SetItemQuantity(EItems.TIME_SHARD, 0);
            }
            else
            {
                OnHardcoreModeToggle();
            }
        }