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; }