public static void RecreateSave(StoryGameSession session) { string text = string.Empty; int m = 0; foreach (var kvp in Inventories) { if (kvp.Value.Count > 0) { text = text + kvp.Key + "<svD>"; for (int n = 0; n < kvp.Value.Count; n++) { string text2 = text; text = string.Concat(new object[] { text2, kvp.Value[n].ToString(), (n >= kvp.Value.Count - 1) ? string.Empty : "<svD>" }); } text += (m >= Inventories.Count - 1) ? string.Empty : "svC"; } m++; } InventorySave = text; }
static void PlayerUpdateHook(On.Player.orig_Update orig, Player self, bool eu) { orig(self, eu); if (self.dead) { RegionCastPlugin.Instance.Transmitter.SendUDP("Dead"); return; } // 5 second cooldown - Player.Update is called every frame DateTime currentTime = DateTime.Now; if (currentTime.Subtract(lastUpdate) < TimeSpan.FromSeconds(5)) { return; } string currentLocationName; string regionCode = ""; if (!(self.room.world.region is null)) { regionCode = self.room.world.region.name; // player is in a region (the region doesn't not exist...) int regionNumber = self.room.abstractRoom.subRegion; if (regionNumber == 0) { regionNumber = 1; } try { currentLocationName = self.room.world.region.subRegions[regionNumber]; } catch (ArgumentOutOfRangeException) { currentLocationName = regionCode; } StoryGameSession session = self.room.world.game.session as StoryGameSession; int cycleNumber = session.saveState.cycleNumber; if (SlugName == "Hunter") { cycleNumber = 19 - cycleNumber; if (session.saveState.redExtraCycles) { cycleNumber += 5; } } Hooks.CycleNumber = cycleNumber; }
public static void RefreshAllPlayers(StoryGameSession session) { foreach (AbstractCreature ac in session.Players) { if (ac.realizedCreature != null && ac.realizedCreature is Player) { Player player = ac.realizedCreature as Player; KarmaToFood(player.slugcatStats, player.Karma); //does not refresh the FoodMeter FoodToStats(player.slugcatStats, player.CurrentFood, player.Karma >= 9); KarmaAppetite.RefreshLight(player); } } }
private static void StoryGameSession_ctor(On.StoryGameSession.orig_ctor orig, StoryGameSession self, int saveStateNumber, RainWorldGame game) { orig.Invoke(self, saveStateNumber, game); if (Downpour.debug && Downpour.exposureControllers != null) { for (int i = 0; i < Downpour.exposureControllers.Count; i++) { Downpour.exposureControllers[i].RemoveDebugLabels(); } } if (Downpour.snow && Downpour.blizzard) { Downpour.exposureControllers = new List <ExposureController>(); } }
private static void StoryGameSession_ctor(On.StoryGameSession.orig_ctor orig, StoryGameSession self, int saveStateNumber, RainWorldGame game) { orig.Invoke(self, saveStateNumber, game); string saveFilePath = string.Concat(new object[] { Custom.RootFolderDirectory(), "UserData", Path.DirectorySeparatorChar, self.game.rainWorld.options.SaveFileName, ".txt" }); if (!File.Exists(saveFilePath) || !game.manager.menuSetup.LoadInitCondition || self.saveState.cycleNumber == 0) //New game { self.saveState.deathPersistentSaveData.theMark = true; if (self.saveState.deathPersistentSaveData.karmaCap < KarmaAppetite.STARTING_MAX_KARMA) { self.saveState.deathPersistentSaveData.karmaCap = KarmaAppetite.STARTING_MAX_KARMA; } if (self.saveStateNumber != 2) { self.saveState.denPosition = "SB_S07"; if (self.saveState.miscWorldSaveData.privSlOracleState == null) { self.saveState.miscWorldSaveData.privSlOracleState = new SLOrcacleState(false, saveStateNumber); } self.saveState.miscWorldSaveData.privSlOracleState.miscPearlCounter = 6; self.saveState.miscWorldSaveData.privSlOracleState.totalPearlsBrought = 6; self.saveState.miscWorldSaveData.privSlOracleState.neuronsLeft = 6; self.saveState.miscWorldSaveData.privSlOracleState.totNeuronsGiven = 1; self.saveState.miscWorldSaveData.privSlOracleState.neuronGiveConversationCounter = 1; self.saveState.miscWorldSaveData.privSlOracleState.totalItemsBrought = 7; self.saveState.miscWorldSaveData.privSlOracleState.playerEncountersWithMark = 6; self.saveState.miscWorldSaveData.privSlOracleState.playerEncounters = 7; self.saveState.miscWorldSaveData.privSlOracleState.likesPlayer = 1f; KarmaAppetite_MoonFix.FixInfluenceCap(self.saveState.miscWorldSaveData.privSlOracleState); } } int neuronTresh = (self.saveState.saveStateNumber != 2) ? 6 : 5; int encTresh = (self.saveState.saveStateNumber != 2) ? 7 : 0; KarmaAppetite_MoonFix.SetTreshholds(encTresh, neuronTresh); self.lastEverMetMoon = self.saveState.miscWorldSaveData.privSlOracleState != null && self.saveState.miscWorldSaveData.privSlOracleState.playerEncounters > encTresh; KarmaAppetite.KarmaToFood(self.characterStats, self.saveState.deathPersistentSaveData.karma); KarmaAppetite.FoodToStats(self.characterStats, self.saveState.food, self.saveState.deathPersistentSaveData.karma >= 9); }
public static void AddInventory(StoryGameSession self, AbstractCreature player) { foreach (AbstractCreature ac in self.Players) { if (ac == player && !Inventories.ContainsKey((ac.state as PlayerState).playerNumber)) { if (InventorySave != null && InventorySave != string.Empty) { List <AbstractPhysicalObject> content = new List <AbstractPhysicalObject>(); string[] arrayPlayers = Regex.Split(InventorySave, "<svC>"); for (int m = 0; m < arrayPlayers.Length; m++) { string[] arrayContent = Regex.Split(arrayPlayers[m], "<svD>"); if (int.Parse(arrayContent[0]) == (player.state as PlayerState).playerNumber) { for (int n = 1; n < arrayContent.Length; n++) { AbstractPhysicalObject apo = null; if (arrayContent[n].Contains("<oA>")) { apo = SaveState.AbstractPhysicalObjectFromString(self.game.world, arrayContent[n]); } else if (arrayContent[n].Contains("<cA>")) { apo = SaveState.AbstractCreatureFromString(self.game.world, arrayContent[n], false); } if (apo != null) { apo.pos = ac.pos; } content.Add(apo); } } } Inventories.Add((ac.state as PlayerState).playerNumber, content); } else { Inventories.Add((ac.state as PlayerState).playerNumber, new List <AbstractPhysicalObject>()); } } } }
private static void StoryGameSession_AddPlayer(On.StoryGameSession.orig_AddPlayer orig, StoryGameSession self, AbstractCreature player) { orig.Invoke(self, player); KarmaAppetite_ExtraInventory.AddInventory(self, player); }
private static void StoryGameSession_AddPlayer(On.StoryGameSession.orig_AddPlayer orig, StoryGameSession self, AbstractCreature player) { orig.Invoke(self, player); rainList.Clear(); //Rain Chance if (UnityEngine.Random.Range(0, 100) < Downpour.rainChance) { noRainThisCycle = false; } else { noRainThisCycle = true; } //Rain Starting Intensity (Non-Dynamic) if (!Downpour.dynamic) { if (Downpour.intensity == 1) { rainIntensity = 0.31f; Downpour.dynamic = false; } if (Downpour.intensity == 2) { rainIntensity = 0.6f; Downpour.dynamic = false; } if (Downpour.intensity == 3) { rainIntensity = 0.9f; Downpour.dynamic = false; } } //Rain Starting Intensity (Dynamic) else { Downpour.dynamic = true; if (!Downpour.snow) { rainIntensity = UnityEngine.Random.Range(-1.5f, 0.8f); } else { rainIntensity = UnityEngine.Random.Range(0.15f, 0.9f); } } //Rain Direction switch (Downpour.direction) { case 0: direction = UnityEngine.Random.Range(1, 4); Downpour.windDirection = direction; break; case 1: direction = 1; break; case 2: direction = 2; break; case 3: direction = 3; break; } int leftOrRight = direction; if (direction == 2) { if (UnityEngine.Random.value >= 0.5f) { leftOrRight = 3; } else { leftOrRight = 1; } } Downpour.windDirection = leftOrRight; //Apply Rain Intensity if (!noRainThisCycle) { startingIntensity = rainIntensity; } else { startingIntensity = 0; rainIntensity = 0; } }
private static void StoryGameSession_AddPlayer(On.StoryGameSession.orig_AddPlayer orig, StoryGameSession self, AbstractCreature player) { orig.Invoke(self, player); fleeList = new List <Scavenger>(); shelter = ""; }