public static void UpdateSuffocation(Player __instance) { cfg = Config.GetConfig(); saveData = SaveData.GetSaveData(); StatObject stat = new StatObject() { Name = "Suffocation Time", Level = saveData.SuffocateResistLevel, MaxLevel = cfg.MaxSuffocateResistLevel, XP = saveData.SuffocateResist_XP, XPToNextLevel = saveData.SuffocateResist_XPToNextLevel, Modifier = cfg.SuffocateResist_XPNextLevel_Multiplier }; if (!StatMgr.CanLevelUp(stat)) { __instance.suffocationTime = 8 + saveData.SuffocateResistLevel; return; } int gainedLevels = StatMgr.DoWhileLevelUp(stat); Notify_LevelUp(stat, gainedLevels, stat.Level); saveData.SuffocateResistLevel = stat.Level; saveData.SuffocateResist_XP = stat.XP; saveData.SuffocateResist_XPToNextLevel = stat.XPToNextLevel; __instance.suffocationTime = 8 + saveData.SuffocateResistLevel; }
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); }
private void UpdateWalkSpeed() { var __instance = Player.main.playerController; StatObject stat = new StatObject() { Name = "Walk Speed", Level = saveData.WalkSpeedLevel, MaxLevel = cfg.MaxWalkSpeedLevel, XP = saveData.WalkSpeed_XP, XPToNextLevel = saveData.WalkSpeed_XPToNextLevel, Modifier = cfg.Walk_XPNextLevel_Multiplier }; if (!StatMgr.CanLevelUp(stat)) { UpdatePlayerController(__instance.groundController, saveData.WalkSpeedLevel); return; } int gainedLevels = StatMgr.DoWhileLevelUp(stat); StatMgr.NotifyLevelUp(stat, gainedLevels); saveData.WalkSpeedLevel = stat.Level; saveData.WalkSpeed_XP = stat.XP; saveData.WalkSpeed_XPToNextLevel = stat.XPToNextLevel; UpdatePlayerController(__instance.groundController, saveData.WalkSpeedLevel); }
//float defaultMaxHealth = 100f; public static void UpdateHealth(Player __instance) { saveData = SaveData.GetSaveData(); cfg = Config.GetConfig(); StatObject stat = new StatObject() { Name = "Max Health", Level = saveData.HealthLevel, MaxLevel = cfg.MaxHealthLevel, XP = saveData.Health_XP, XPToNextLevel = saveData.Health_XPToNextLevel, Modifier = cfg.Health_XPNextLevel_Multiplier }; if (!StatMgr.CanLevelUp(stat)) { __instance.liveMixin.data.maxHealth = 100 + saveData.HealthLevel; return; } int gainedLevels = StatMgr.DoWhileLevelUp(stat); StatMgr.NotifyLevelUp(stat, gainedLevels); saveData.HealthLevel = stat.Level; saveData.Health_XP = stat.XP; saveData.Health_XPToNextLevel = stat.XPToNextLevel; __instance.liveMixin.data.maxHealth = 100 + saveData.HealthLevel; }