public static float UpdateBreathPeriod(Player __instance, ref float __result) { saveData = SaveData.GetSaveData(); cfg = Config.GetConfig(); StatObject stat = new StatObject() { Name = "Breath Period", Level = saveData.BreathPeriodLevel, MaxLevel = cfg.MaxBreathPeriodLevel, XP = saveData.BreathPeriod_XP, XPToNextLevel = saveData.BreathPeriod_XPToNextLevel, Modifier = cfg.BreathPeriod_XPNextLevel_Multiplier }; if (!StatMgr.CanLevelUp(stat)) { __result += CalcBreathPeriodPercent(saveData.BreathPeriodLevel); return(__result); } int gainedLevels = StatMgr.DoWhileLevelUp(stat); Air.NotifyLevelUp(stat); saveData.BreathPeriodLevel = stat.Level; saveData.BreathPeriod_XP = stat.XP; saveData.BreathPeriod_XPToNextLevel = stat.XPToNextLevel; __result += CalcBreathPeriodPercent(saveData.BreathPeriodLevel); return(__result); }
public static void NotifyLevelUp(StatObject stat) { Random random = new Random(); Air a = new Air(); StatMgr mgr = new StatMgr(); int responseNum = random.Next(0, a.singleLevelNotifs.Count - 1); Logger.Log(String.Format(a.singleLevelNotifs[responseNum], stat.Name, CalcBreathPeriodPercent(stat.Level) + 3)); if (stat.Level >= stat.MaxLevel) { int maxRandom = random.Next(0, mgr.maxLevelNotifs.Count - 1); Logger.Log(String.Format(mgr.maxLevelNotifs[maxRandom], stat.Name) + ". Each breath now lasts " + (CalcBreathPeriodPercent(stat.Level) + 3) + " seconds"); } }