diff --git a/UIInfoSuite2/UIElements/ExperienceBar.cs b/UIInfoSuite2/UIElements/ExperienceBar.cs index eceb1c0a..79771754 100644 --- a/UIInfoSuite2/UIElements/ExperienceBar.cs +++ b/UIInfoSuite2/UIElements/ExperienceBar.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Microsoft.Xna.Framework; using StardewModdingAPI; using StardewModdingAPI.Enums; @@ -6,6 +6,7 @@ using StardewModdingAPI.Utilities; using StardewValley; using StardewValley.Tools; +using StardewValley.Menus; using UIInfoSuite2.Compatibility; using UIInfoSuite2.Infrastructure; using UIInfoSuite2.Infrastructure.Extensions; @@ -18,6 +19,7 @@ public partial class ExperienceBar #region Properties private readonly PerScreen _previousItem = new(); private readonly PerScreen _currentExperience = new(() => new int[5]); + private readonly PerScreen _currentMasteryXP = new(() => 0); private readonly PerScreen _currentLevelExtenderExperience = new(() => new int[5]); private readonly PerScreen _currentSkillLevel = new(() => 0); private readonly PerScreen _experienceRequiredToLevel = new(() => -1); @@ -61,6 +63,7 @@ public partial class ExperienceBar private readonly PerScreen _levelUpIconRectangle = new(() => SkillIconRectangles[SkillType.Farming]); private readonly PerScreen _experienceFillColor = new(() => ExperienceFillColor[SkillType.Farming]); + private readonly PerScreen _experienceTextColor = new(() => Color.Black); private bool ExperienceBarFadeoutEnabled { get; set; } = true; private bool ExperienceGainTextEnabled { get; set; } = true; @@ -244,6 +247,7 @@ private void OnRenderingHud(object sender, RenderingHudEventArgs e) { _displayedExperienceBar.Value.Draw( _experienceFillColor.Value, + _experienceTextColor.Value, _experienceIconRectangle.Value, _experienceEarnedThisLevel.Value, _experienceRequiredToLevel.Value - _experienceFromPreviousLevels.Value, @@ -261,7 +265,12 @@ private void InitializeExperiencePoints() _currentExperience.Value[i] = Game1.player.experiencePoints[i]; } - if (_levelExtenderApi != null) + if (Game1.player.Level >= 25) + { + _currentMasteryXP.Value = (int)Game1.stats.Get("MasteryExp"); + } + + if (_levelExtenderApi != null) { for (var i = 0; i < _currentLevelExtenderExperience.Value.Length; ++i) { @@ -307,10 +316,24 @@ private void UpdateExperience(int currentLevelIndex, bool displayExperience) _experienceFillColor.Value = ExperienceFillColor[(SkillType)currentLevelIndex]; _currentSkillLevel.Value = Game1.player.GetUnmodifiedSkillLevel(currentLevelIndex); - _experienceRequiredToLevel.Value = GetExperienceRequiredToLevel(_currentSkillLevel.Value); - _experienceFromPreviousLevels.Value = GetExperienceRequiredToLevel(_currentSkillLevel.Value - 1); - _experienceEarnedThisLevel.Value = - Game1.player.experiencePoints[currentLevelIndex] - _experienceFromPreviousLevels.Value; + + if (Game1.player.Level >= 25 && (MasteryTrackerMenu.getCurrentMasteryLevel() < 5)) + { + _experienceRequiredToLevel.Value = MasteryTrackerMenu.getMasteryExpNeededForLevel(MasteryTrackerMenu.getCurrentMasteryLevel() + 1); + _experienceFromPreviousLevels.Value = MasteryTrackerMenu.getMasteryExpNeededForLevel(MasteryTrackerMenu.getCurrentMasteryLevel()); + _experienceEarnedThisLevel.Value = (int)Game1.stats.Get("MasteryExp") - MasteryTrackerMenu.getMasteryExpNeededForLevel(MasteryTrackerMenu.getCurrentMasteryLevel()); + _currentMasteryXP.Value = (int)Game1.stats.Get("MasteryExp"); + + _experienceFillColor.Value = new Color(0, 0.443f, 0.243f , 1.0f); + _experienceTextColor.Value = Color.White; + _experienceIconRectangle.Value = SkillIconRectangles[SkillType.Luck]; + } + else + { + _experienceRequiredToLevel.Value = GetExperienceRequiredToLevel(_currentSkillLevel.Value); + _experienceFromPreviousLevels.Value = GetExperienceRequiredToLevel(_currentSkillLevel.Value - 1); + _experienceEarnedThisLevel.Value = Game1.player.experiencePoints[currentLevelIndex] - _experienceFromPreviousLevels.Value; + } if (_experienceRequiredToLevel.Value <= 0 && _levelExtenderApi != null) { @@ -369,5 +392,5 @@ private static int GetExperienceRequiredToLevel(int currentLevel) _ => -1 }; } -#endregion Logic + #endregion Logic } diff --git a/UIInfoSuite2/UIElements/ExperienceElements/DisplayedExperienceBar.cs b/UIInfoSuite2/UIElements/ExperienceElements/DisplayedExperienceBar.cs index 6987c98f..02266d5b 100644 --- a/UIInfoSuite2/UIElements/ExperienceElements/DisplayedExperienceBar.cs +++ b/UIInfoSuite2/UIElements/ExperienceElements/DisplayedExperienceBar.cs @@ -8,10 +8,11 @@ namespace UIInfoSuite2.UIElements.ExperienceElements; public class DisplayedExperienceBar { - private const int MaxBarWidth = 175; + private const int MaxBarWidth = 235; public void Draw( Color experienceFillColor, + Color textColor, Rectangle experienceIconPosition, int experienceEarnedThisLevel, int experienceDifferenceBetweenLevels, @@ -24,7 +25,7 @@ int currentLevel Game1.drawDialogueBox( (int)leftSide, Game1.graphics.GraphicsDevice.Viewport.TitleSafeArea.Bottom - 160, - 240, + 300, 160, false, true @@ -59,34 +60,57 @@ int currentLevel experienceFillColor ); - if (IsMouseOverExperienceBar(leftSide)) + if (IsMouseOverExperienceBar(leftSide)) { Game1.drawWithBorder( experienceEarnedThisLevel + "/" + experienceDifferenceBetweenLevels, - Color.Black, - Color.Black, + textColor, + textColor, new Vector2(leftSide + 33, Game1.graphics.GraphicsDevice.Viewport.TitleSafeArea.Bottom - 70) ); } else { - Game1.spriteBatch.Draw( - Game1.mouseCursors, - new Vector2(leftSide + 54, Game1.graphics.GraphicsDevice.Viewport.TitleSafeArea.Bottom - 62), - experienceIconPosition, - Color.White, - 0, - Vector2.Zero, - 2.9f, - SpriteEffects.None, - 0.85f - ); + String levelNumber = ""; + int masteryMargin = 0; + if (Game1.player.Level < 25) + { + Game1.spriteBatch.Draw( + Game1.mouseCursors, + new Vector2(leftSide + 54, Game1.graphics.GraphicsDevice.Viewport.TitleSafeArea.Bottom - 62), + experienceIconPosition, + Color.White, + 0, + Vector2.Zero, + 2.9f, + SpriteEffects.None, + 0.85f + ); + levelNumber = currentLevel.ToString(); + } + else + { + Game1.spriteBatch.Draw( + Game1.mouseCursors_1_6, + new Vector2(leftSide + 38, Game1.graphics.GraphicsDevice.Viewport.TitleSafeArea.Bottom - 62), + new Rectangle(458,299,10,10), + Color.White, + 0, + Vector2.Zero, + 2.9f, + SpriteEffects.None, + 0.85f + ); + + levelNumber = MasteryTrackerMenu.getCurrentMasteryLevel().ToString(); + masteryMargin = 37; + } Game1.drawWithBorder( - currentLevel.ToString(), - Color.Black * 0.6f, - Color.Black, - new Vector2(leftSide + 33, Game1.graphics.GraphicsDevice.Viewport.TitleSafeArea.Bottom - 70) + levelNumber, + textColor * 0.6f, + textColor, + new Vector2(leftSide + 33 + masteryMargin, Game1.graphics.GraphicsDevice.Viewport.TitleSafeArea.Bottom - 70) ); } }