コード例 #1
0
        private static void SaveState_LoadGame(On.SaveState.orig_LoadGame orig, SaveState self, string str, RainWorldGame game)
        {
            // New game, generate regionsave checksum
            if (str == string.Empty)
            {
                CustomWorldMod.Log(CustomWorldMod.GetSaveInformation());
            }
            // Existing game, validate regionsave checksum
            else
            {
                // Check if player playing on existing save before CR
            }

            orig(self, str, game);
        }
コード例 #2
0
        private static void SaveState_LoadGame(On.SaveState.orig_LoadGame orig, SaveState self, string str, RainWorldGame game)
        {
            if (!(self is CustomSaveState css))
            {
                orig(self, str, game);
                return;
            }

            // This will produce extraneous debugging logs - consider somehow suppressing them
            orig(self, str, game);

            string customStartRoom = css.Character.StartRoom;

            if (str == string.Empty && customStartRoom != null)
            {
                self.denPosition = customStartRoom;
            }

            var data        = DataFromString(SearchForSavePair(str, "SLUGBASE", "<svB>", "<svA>"));
            var persistData = DataFromString(SearchForSavePair(str, "SLUGBASEPERSISTENT", "<svB>", "<svA>"));

            css.Load(data);
            css.LoadPermanent(persistData);
        }
コード例 #3
0
 private static void LoadGamePatch(On.SaveState.orig_LoadGame orig, SaveState self, string str, RainWorldGame game)
 {
     orig.Invoke(self, str, game);
     LoadAndSaveOI(2, false);
 }
コード例 #4
0
    private static void SaveState_LoadGame(On.SaveState.orig_LoadGame orig, SaveState self, string str, RainWorldGame game)
    {
        self.loaded                 = true;
        self.redExtraCycles         = false;
        self.initiatedInGameVersion = 0;
        if (str == string.Empty)
        {
            Debug.Log("NOTHING TO LOAD - START CLEAR");
            self.denPosition = ((self.saveStateNumber != 2) ? "SU_C04" : "LF_H01");
        }
        else
        {
            string[]        array = Regex.Split(str, "<svA>");
            List <string[]> list  = new List <string[]>();
            for (int i = 0; i < array.Length; i++)
            {
                string[] array2 = Regex.Split(array[i], "<svB>");
                if (array2.Length > 0 && array2[0].Length > 0)
                {
                    list.Add(array2);
                }
            }
            int j = 0;
            while (j < list.Count)
            {
                string text = list[j][0];
                if (text == null)
                {
                    goto IL_66F;
                }

                Dictionary <string, int> dictionary = new Dictionary <string, int>(24);
                dictionary.Add("SAV STATE NUMBER", 0);
                dictionary.Add("DENPOS", 1);
                dictionary.Add("CYCLENUM", 2);
                dictionary.Add("FOOD", 3);
                dictionary.Add("NEXTID", 4);
                dictionary.Add("HASTHEGLOW", 5);
                dictionary.Add("GUIDEOVERSEERDEAD", 6);
                dictionary.Add("RESPAWNS", 7);
                dictionary.Add("WAITRESPAWNS", 8);
                dictionary.Add("REGIONSTATE", 9);
                dictionary.Add("COMMUNITIES", 10);
                dictionary.Add("MISCWORLDSAVEDATA", 11);
                dictionary.Add("DEATHPERSISTENTSAVEDATA", 12);
                dictionary.Add("SWALLOWEDITEMS", 13);
                dictionary.Add("VERSION", 14);
                dictionary.Add("INITVERSION", 15);
                dictionary.Add("WORLDVERSION", 16);
                dictionary.Add("SEED", 17);
                dictionary.Add("DREAMSSTATE", 18);
                dictionary.Add("TOTFOOD", 19);
                dictionary.Add("TOTTIME", 20);
                dictionary.Add("CURRVERCYCLES", 21);
                dictionary.Add("KILLS", 22);
                dictionary.Add("REDEXTRACYCLES", 23);
                dictionary.Add("EXTRAINVENTORY", 24);

                int num;
                if (!dictionary.TryGetValue(text, out num))
                {
                    goto IL_66F;
                }
                switch (num)
                {
                case 0:
                    break;

                case 1:
                    self.denPosition = list[j][1];
                    break;

                case 2:
                    self.cycleNumber = int.Parse(list[j][1]);
                    break;

                case 3:
                    self.food = int.Parse(list[j][1]);
                    break;

                case 4:
                    if (game != null)
                    {
                        game.nextIssuedId = int.Parse(list[j][1]);
                    }
                    break;

                case 5:
                    self.theGlow = true;
                    break;

                case 6:
                    self.guideOverseerDead = true;
                    break;

                case 7:
                {
                    string[] array3 = list[j][1].Split(new char[]
                        {
                            '.'
                        });
                    for (int k = 0; k < array3.Length; k++)
                    {
                        if (k < array3.Length)
                        {
                            self.respawnCreatures.Add(int.Parse(array3[k]));
                        }
                    }
                    break;
                }

                case 8:
                {
                    string[] array4 = list[j][1].Split(new char[]
                        {
                            '.'
                        });
                    for (int l = 0; l < array4.Length; l++)
                    {
                        if (l < array4.Length)
                        {
                            self.waitRespawnCreatures.Add(int.Parse(array4[l]));
                        }
                    }
                    break;
                }

                case 9:
                {
                    string[] array5 = Regex.Split(list[j][1], "<rgA>");
                    for (int m = 0; m < array5.Length; m++)
                    {
                        if (Regex.Split(array5[m], "<rgB>")[0] == "REGIONNAME")
                        {
                            for (int n = 0; n < self.progression.regionNames.Length; n++)
                            {
                                if (self.progression.regionNames[n] == Regex.Split(array5[m], "<rgB>")[1])
                                {
                                    self.regionLoadStrings[n] = list[j][1];
                                    break;
                                }
                            }
                            break;
                        }
                    }
                    break;
                }

                case 10:
                    self.creatureCommunitiesString = list[j][1];
                    break;

                case 11:
                    self.miscWorldSaveData.FromString(list[j][1]);
                    break;

                case 12:
                    self.deathPersistentSaveData.FromString(list[j][1]);
                    if (self.saveStateNumber == 1)
                    {
                        self.deathPersistentSaveData.howWellIsPlayerDoing = -1f;
                    }
                    else if (self.saveStateNumber == 2)
                    {
                        self.deathPersistentSaveData.howWellIsPlayerDoing = 1f;
                    }
                    break;

                case 13:
                    self.swallowedItems = new string[list[j].Length - 1];
                    for (int num2 = 1; num2 < list[j].Length; num2++)
                    {
                        self.swallowedItems[num2 - 1] = list[j][num2];
                    }
                    break;

                case 14:
                    self.gameVersion = int.Parse(list[j][1]);
                    break;

                case 15:
                    self.initiatedInGameVersion = int.Parse(list[j][1]);
                    break;

                case 16:
                    self.worldVersion = int.Parse(list[j][1]);
                    break;

                case 17:
                    self.seed = int.Parse(list[j][1]);
                    break;

                case 18:
                    self.dreamsState.FromString(list[j][1]);
                    break;

                case 19:
                    self.totFood = int.Parse(list[j][1]);
                    break;

                case 20:
                    self.totTime = int.Parse(list[j][1]);
                    break;

                case 21:
                    self.cyclesInCurrentWorldVersion = int.Parse(list[j][1]);
                    break;

                case 22:
                {
                    self.kills.Clear();
                    string[] array6 = Regex.Split(list[j][1], "<svC>");
                    for (int num3 = 0; num3 < array6.Length; num3++)
                    {
                        self.kills.Add(new KeyValuePair <IconSymbol.IconSymbolData, int>(IconSymbol.IconSymbolData.IconSymbolDataFromString(Regex.Split(array6[num3], "<svD>")[0]), int.Parse(Regex.Split(array6[num3], "<svD>")[1])));
                    }
                    break;
                }

                case 23:
                    self.redExtraCycles = true;
                    break;

                case 24:
                {
                    KarmaAppetite_ExtraInventory.InventorySave = list[j][1];
                    KarmaAppetite_ExtraInventory.Inventories.Clear();
                    break;
                }

                default:
                    goto IL_66F;
                }
IL_68A:
                j++;
                continue;
IL_66F:
                Debug.Log("Unknown save state load string");
                Debug.Log(list[j][0]);
                goto IL_68A;
            }
        }
        if (game != null)
        {
            if (game.setupValues.cheatKarma > 0)
            {
                self.deathPersistentSaveData.karma    = game.setupValues.cheatKarma - 1;
                self.deathPersistentSaveData.karmaCap = Math.Max(self.deathPersistentSaveData.karmaCap, self.deathPersistentSaveData.karma);
            }
            if (game.setupValues.theMark)
            {
                self.deathPersistentSaveData.theMark = true;
            }
            if (self.worldVersion != game.rainWorld.worldVersion)
            {
                game.manager.rainWorld.progression.miscProgressionData.redUnlocked = true;
                BackwardsCompability.UpdateWorldVersion(self, game.rainWorld.worldVersion, game.rainWorld.progression);
                self.cyclesInCurrentWorldVersion = 0;
            }
        }
        else
        {
            Debug.Log("LOADING SAV WITH NULL GAME");
        }
        if (self.deathPersistentSaveData.redsDeath && self.cycleNumber < RedsIllness.RedsCycles(self.redExtraCycles))
        {
            self.deathPersistentSaveData.redsDeath = false;
        }
    }