コード例 #1
0
 /// <summary>
 /// Prestiges a skill, resetting it to level 0, removing all recipes and effects of the skill at higher levels
 /// and grants one prestige point in that skill to the player.
 /// </summary>
 /// <param name="skill">the skill you wish to prestige.</param>
 public static void PrestigeSkill(Skill skill)
 {
     try
     {
         if (PerSaveOptions.Instance.PainlessPrestigeMode)
         {
             Logger.LogInformation($"Prestiging skill {skill.Type.Name} via Painless Mode.");
             skill.SetSkillExperience(Game1.player.experiencePoints[skill.Type.Ordinal] - PerSaveOptions.Instance.ExperienceNeededPerPainlessPrestige);
             Logger.LogInformation($"Removed {PerSaveOptions.Instance.ExperienceNeededPerPainlessPrestige} experience points from {skill.Type.Name} skill.");
         }
         else
         {
             Logger.LogInformation($"Prestiging skill {skill.Type.Name}.");
             skill.SetSkillExperience(0);
             skill.SetSkillLevel(0);
             Logger.LogInformation($"Skill {skill.Type.Name} experience and level reset.");
             if (PerSaveOptions.Instance.ResetRecipesOnPrestige)
             {
                 RemovePlayerCraftingRecipesForSkill(skill.Type);
                 RemovePlayerCookingRecipesForSkill(skill.Type);
             }
             Profession.RemoveProfessions(skill);
             PlayerManager.CorrectStats(skill);
             Profession.AddMissingProfessions();
         }
         PrestigeSaveData.CurrentlyLoadedPrestigeSet.Prestiges.Single(x => x.SkillType == skill.Type).PrestigePoints += PerSaveOptions.Instance.PointsPerPrestige;
         Logger.LogInformation($"{PerSaveOptions.Instance.PointsPerPrestige} Prestige point(s) added to {skill.Type.Name} skill.");
     }
     catch (Exception exception)
     {
         Logger.LogError(exception.Message + Environment.NewLine + exception.StackTrace);
     }
 }
コード例 #2
0
ファイル: Prestige.cs プロジェクト: musbah/SkillPrestige
 /// <summary>
 /// Prestiges a skill, resetting it to level 0, removing all recipes and effects of the skill at higher levels
 /// and grants one prestige point in that skill to the player.
 /// </summary>
 /// <param name="skill">the skill you wish to prestige.</param>
 public static void PrestigeSkill(Skill skill)
 {
     try
     {
         Logger.LogInformation($"Prestiging skill {skill.Type.Name}.");
         skill.SetSkillExperience(0);
         skill.SetSkillLevel(0);
         Logger.LogInformation($"Skill {skill.Type.Name} experience and level reset.");
         if (PerSaveOptions.Instance.ResetRecipesOnPrestige)
         {
             RemovePlayerCraftingRecipesForSkill(skill.Type);
             RemovePlayerCookingRecipesForSkill(skill.Type);
         }
         Profession.RemoveProfessions(skill);
         Profession.AddMissingProfessions();
         PrestigeSaveData.CurrentlyLoadedPrestigeSet.Prestiges.Single(x => x.SkillType == skill.Type).PrestigePoints++;
         Logger.LogInformation($"Prestige point added to {skill.Type.Name} skill.");
     }
     catch (Exception exception)
     {
         Logger.LogError(exception.Message + Environment.NewLine + exception.StackTrace);
     }
 }