Skip to content

Commit

Permalink
Merge pull request #611 from drewhoener/djh/legacy-master
Browse files Browse the repository at this point in the history
Update 2.3.5
  • Loading branch information
drewhoener authored Oct 22, 2024
2 parents 70a5f28 + 13af2e3 commit 4297099
Show file tree
Hide file tree
Showing 21 changed files with 192 additions and 212 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# If you are here to install the mod

## We're on Nexus again!!
Big thank you to the Nexus support staff for clearing us to be back on the NexusMods site under the UIInfoSuite name!

**[Download Here](https://www.nexusmods.com/stardewvalley/mods/7098)**

### GitHub Download
**Go to the [Releases page](https://github.com/Annosz/UIInfoSuite2/releases) on the side, where you can always find the latest release. Download the UIInfoSuite2.zip file and copy it's content to the mod folder.**
![image](https://user-images.githubusercontent.com/10620868/145580465-5dc6cd97-e4da-4830-a639-8f3fb94a1001.png)
_Do **NOT** download the Source code (zip) or Source code (tar.gz). Also, do **NOT** use the green Code > Download ZIP button on the main page. These methods will only give you the source code but you will not be able to run the mod and use it with Stardew Valley!_
Expand Down
1 change: 1 addition & 0 deletions UIInfoSuite2/Compatibility/ApiManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public static class ModCompat
{
public const string CustomBush = "furyx639.CustomBush";
public const string Gmcm = "spacechase0.GenericModConfigMenu";
public const string DeluxeJournal = "MolsonCAD.DeluxeJournal";
}

public static class ApiManager
Expand Down
52 changes: 0 additions & 52 deletions UIInfoSuite2/Infrastructure/LanguageKeys.cs

This file was deleted.

11 changes: 7 additions & 4 deletions UIInfoSuite2/Infrastructure/SoundHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class SoundHelper
{
private static readonly Lazy<SoundHelper> LazyInstance = new(() => new SoundHelper());

private string _modId = "InfoSuite";
private bool _initialized;

protected SoundHelper() { }
Expand All @@ -28,14 +29,16 @@ public void Initialize(IModHelper helper)
throw new InvalidOperationException("Cannot re-initialize sound helper");
}

_modId = helper.ModContent.ModID;

RegisterSound(helper, Sounds.LevelUp, "LevelUp.wav");

_initialized = true;
}

private static string GetQualifiedSoundName(Sounds sound)
private string GetQualifiedSoundName(Sounds sound)
{
return $"UIInfoSuite.sounds.{sound.ToString()}";
return $"{_modId}.sounds.{sound.ToString()}";
}

private static void RegisterSound(
Expand All @@ -47,7 +50,7 @@ private static void RegisterSound(
CueDefinition.LimitBehavior? limitBehavior = null
)
{
CueDefinition newCueDefinition = new() { name = GetQualifiedSoundName(sound) };
CueDefinition newCueDefinition = new() { name = Instance.GetQualifiedSoundName(sound) };

if (instanceLimit > 0)
{
Expand All @@ -72,6 +75,6 @@ private static void RegisterSound(

public static void Play(Sounds sound)
{
Game1.playSound(GetQualifiedSoundName(sound));
Game1.playSound(Instance.GetQualifiedSoundName(sound));
}
}
2 changes: 1 addition & 1 deletion UIInfoSuite2/ModEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public class ModEntry : Mod
#region Entry
public override void Entry(IModHelper helper)
{
I18n.Init(helper.Translation);
Reflection = helper.Reflection;
MonitorObject = Monitor;
I18n.Init(helper.Translation);

_skipIntro = new SkipIntro(helper.Events);
_modConfig = Helper.ReadConfig<ModConfig>();
Expand Down
3 changes: 1 addition & 2 deletions UIInfoSuite2/Options/ModOptionsPageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,7 @@ private void OnRenderedMenu(object? sender, RenderedActiveMenuEventArgs e)
// Draw our tab's hover text
if (_modOptionsTab.Value?.containsPoint(Game1.getMouseX(), Game1.getMouseY()) == true)
{
Translation tooltip = _helper.Translation.Get(LanguageKeys.OptionsTabTooltip).Default("UI Info Mod Options");
IClickableMenu.drawHoverText(Game1.spriteBatch, tooltip, Game1.smallFont);
IClickableMenu.drawHoverText(Game1.spriteBatch, I18n.OptionsTabTooltip(), Game1.smallFont);

if (!gameMenu.hoverText.Equals(""))
{
Expand Down
2 changes: 1 addition & 1 deletion UIInfoSuite2/UIElements/ExperienceBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private void OnRenderingHud(object sender, RenderingHudEventArgs e)
// Level up text
if (LevelUpAnimationEnabled && _levelUpVisibleTimer.Value != 0)
{
_displayedLevelUpMessage.Value.Draw(_levelUpIconRectangle.Value, _helper.SafeGetString(LanguageKeys.LevelUp));
_displayedLevelUpMessage.Value.Draw(_levelUpIconRectangle.Value, I18n.LevelUp());
}

// Experience values
Expand Down
14 changes: 7 additions & 7 deletions UIInfoSuite2/UIElements/LuckOfDay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,35 +117,35 @@ private void CalculateLuck(UpdateTickedEventArgs e)
{
// Spirits are very happy (FeelingLucky)
case var l when l > 0.07:
_hoverText.Value = _helper.SafeGetString(LanguageKeys.LuckStatus1);
_hoverText.Value = I18n.LuckStatus1();
_color.Value = Luck1Color;
break;
// Spirits are in good humor (LuckyButNotTooLucky)
case var l when l > 0.02 && l <= 0.07:
_hoverText.Value = _helper.SafeGetString(LanguageKeys.LuckStatus2);
_hoverText.Value = I18n.LuckStatus2();
_color.Value = Luck2Color;

break;
// The spirits feel neutral
case var l when l >= -0.02 && l <= 0.02 && l != 0:
_hoverText.Value = _helper.SafeGetString(LanguageKeys.LuckStatus3);
_hoverText.Value = I18n.LuckStatus3();
_color.Value = Luck3Color;

break;
// The spirits feel absolutely neutral
case var l when l == 0:
_hoverText.Value = _helper.SafeGetString(LanguageKeys.LuckStatus4);
_hoverText.Value = I18n.LuckStatus4();
_color.Value = Luck4Color;
break;
// The spirits are somewhat annoyed (NotFeelingLuckyAtAll)
case var l when l >= -0.07 && l < -0.02:
_hoverText.Value = _helper.SafeGetString(LanguageKeys.LuckStatus5);
_hoverText.Value = I18n.LuckStatus5();
_color.Value = Luck5Color;

break;
// The spirits are very displeased (MaybeStayHome)
case var l when l < -0.07:
_hoverText.Value = _helper.SafeGetString(LanguageKeys.LuckStatus6);
_hoverText.Value = I18n.LuckStatus6();
_color.Value = Luck6Color;
break;
}
Expand All @@ -154,7 +154,7 @@ private void CalculateLuck(UpdateTickedEventArgs e)
if (ShowExactValue)
{
_hoverText.Value = string.Format(
_helper.SafeGetString(LanguageKeys.DailyLuckValue),
I18n.DailyLuckValue(),
Game1.player.DailyLuck.ToString("N3")
);
}
Expand Down
2 changes: 1 addition & 1 deletion UIInfoSuite2/UIElements/ShopHarvestPrices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private void OnRenderedActiveMenu(object sender, RenderedActiveMenuEventArgs e)
int yPosition = menu.yPositionOnScreen + 580;
IClickableMenu.drawTextureBox(Game1.spriteBatch, xPosition + 20, yPosition - 52, 264, 108, Color.White);
// Title "Harvest Price"
string textToRender = _helper.SafeGetString(LanguageKeys.HarvestPrice);
string textToRender = I18n.HarvestPrice();
Game1.spriteBatch.DrawString(
Game1.dialogueFont,
textToRender,
Expand Down
2 changes: 1 addition & 1 deletion UIInfoSuite2/UIElements/ShowBirthdayIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ private void DrawHoverText()
{
if (icons[i].containsPoint(Game1.getMouseX(), Game1.getMouseY()))
{
string hoverText = string.Format(_helper.SafeGetString(LanguageKeys.NpcBirthday), npcs[i].displayName);
string hoverText = string.Format(I18n.NpcBirthday(), npcs[i].displayName);
IClickableMenu.drawHoverText(Game1.spriteBatch, hoverText, Game1.dialogueFont);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ private void DrawBillboard()
{
string hoverText = Game1.getMouseX() <
_showBillboardButton.Value.bounds.X + _showBillboardButton.Value.bounds.Width / 2
? LanguageKeys.Calendar
: LanguageKeys.Billboard;
IClickableMenu.drawHoverText(Game1.spriteBatch, _helper.SafeGetString(hoverText), Game1.dialogueFont);
? I18n.Calendar()
: I18n.Billboard();
IClickableMenu.drawHoverText(Game1.spriteBatch, hoverText, Game1.dialogueFont);
}
}

Expand Down
8 changes: 7 additions & 1 deletion UIInfoSuite2/UIElements/ShowCropAndBarrelTime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,13 @@ public static bool CropRender(TerrainFeature? terrain, List<string> entries)
return false;
}

string fertilizerStr = string.IsNullOrEmpty(hoeDirt.fertilizer.Value) ? "" : GetFertilizerString(hoeDirt);
var fertilizerStr = "";
// Special case, someone had a case where id "0" was set in fertilizer, which is weeds...
// Weird, right?
if (!string.IsNullOrEmpty(hoeDirt.fertilizer.Value) && !"0".Equals(hoeDirt.fertilizer.Value))
{
fertilizerStr = GetFertilizerString(hoeDirt);
}

if (hoeDirt.crop is not null && !hoeDirt.crop.dead.Value)
{
Expand Down
2 changes: 1 addition & 1 deletion UIInfoSuite2/UIElements/ShowQueenOfSauceIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private void OnRenderedHud(object sender, RenderedHudEventArgs e)
{
IClickableMenu.drawHoverText(
Game1.spriteBatch,
_helper.SafeGetString(LanguageKeys.TodaysRecipe) + _todaysRecipe.DisplayName,
I18n.TodaysRecipe() + _todaysRecipe.DisplayName,
Game1.dialogueFont
);
}
Expand Down
14 changes: 7 additions & 7 deletions UIInfoSuite2/UIElements/ShowRainyDayIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,25 +228,25 @@ private void SetValleyWeatherSprite()
case Game1.weather_rain:
_valleyWeather.IsRainyTomorrow = true;
_valleyWeather.SpriteLocation = new Rectangle(0, 0, 15, 15);
_valleyWeather.HoverText = _helper.SafeGetString(LanguageKeys.RainNextDay);
_valleyWeather.HoverText = I18n.RainNextDay();
break;

case Game1.weather_lightning:
_valleyWeather.IsRainyTomorrow = true;
_valleyWeather.SpriteLocation = new Rectangle(15, 0, 15, 15);
_valleyWeather.HoverText = _helper.SafeGetString(LanguageKeys.ThunderstormNextDay);
_valleyWeather.HoverText = I18n.ThunderstormNextDay();
break;

case Game1.weather_snow:
_valleyWeather.IsRainyTomorrow = true;
_valleyWeather.SpriteLocation = new Rectangle(30, 0, 15, 15);
_valleyWeather.HoverText = _helper.SafeGetString(LanguageKeys.SnowNextDay);
_valleyWeather.HoverText = I18n.SnowNextDay();
break;

case Game1.weather_green_rain:
_valleyWeather.IsRainyTomorrow = true;
_valleyWeather.SpriteLocation = new Rectangle(45, 0, 15, 15);
_valleyWeather.HoverText = _helper.SafeGetString(LanguageKeys.RainNextDay);
_valleyWeather.HoverText = I18n.RainNextDay();
break;

default:
Expand All @@ -262,19 +262,19 @@ private void SetIslandWeatherSprite()
case Game1.weather_rain:
_islandWeather.IsRainyTomorrow = true;
_islandWeather.SpriteLocation = new Rectangle(60, 0, 18, 18);
_islandWeather.HoverText = _helper.SafeGetString(LanguageKeys.IslandRainNextDay);
_islandWeather.HoverText = I18n.IslandRainNextDay();
break;

case Game1.weather_lightning:
_islandWeather.IsRainyTomorrow = true;
_islandWeather.SpriteLocation = new Rectangle(78, 0, 18, 18);
_islandWeather.HoverText = _helper.SafeGetString(LanguageKeys.IslandThunderstormNextDay);
_islandWeather.HoverText = I18n.IslandThunderstormNextDay();
break;

case Game1.weather_green_rain:
_islandWeather.IsRainyTomorrow = true;
_islandWeather.SpriteLocation = new Rectangle(96, 0, 18, 18);
_islandWeather.HoverText = _helper.SafeGetString(LanguageKeys.IslandRainNextDay);
_islandWeather.HoverText = I18n.IslandRainNextDay();
break;

default:
Expand Down
6 changes: 3 additions & 3 deletions UIInfoSuite2/UIElements/ShowRobinBuildingStatusIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ private bool GetRobinMessage(out string hoverText)
if (building.daysOfConstructionLeft.Value > building.daysUntilUpgrade.Value)
{
hoverText = string.Format(
_helper.SafeGetString(LanguageKeys.RobinBuildingStatus),
I18n.RobinBuildingStatus(),
building.daysOfConstructionLeft.Value
);
return true;
}

// Add another translation string for this?
hoverText = string.Format(
_helper.SafeGetString(LanguageKeys.RobinBuildingStatus),
I18n.RobinBuildingStatus(),
building.daysUntilUpgrade.Value
);
return true;
Expand All @@ -131,7 +131,7 @@ private bool GetRobinMessage(out string hoverText)
return false;
}

hoverText = string.Format(_helper.SafeGetString(LanguageKeys.RobinHouseUpgradeStatus), remainingDays);
hoverText = string.Format(I18n.RobinHouseUpgradeStatus(), remainingDays);
return true;
}

Expand Down
6 changes: 3 additions & 3 deletions UIInfoSuite2/UIElements/ShowSeasonalBerry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ private void UpdateBerryForDay()
{
case "spring" when day is >= 15 and <= 18:
_berrySpriteLocation = new Rectangle(128, 193, 15, 15);
_hoverText = _helper.SafeGetString(LanguageKeys.CanFindSalmonberry);
_hoverText = I18n.CanFindSalmonberry();
_spriteScale = 8 / 3f;
break;
case "fall" when day is >= 8 and <= 11:
_berrySpriteLocation = new Rectangle(32, 272, 16, 16);
_hoverText = _helper.SafeGetString(LanguageKeys.CanFindBlackberry);
_hoverText = I18n.CanFindBlackberry();
_spriteScale = 5 / 2f;
break;
case "fall" when day >= 15 && ShowHazelnut:
_berrySpriteLocation = new Rectangle(1, 274, 14, 14);
_hoverText = _helper.SafeGetString(LanguageKeys.CanFindHazelnut);
_hoverText = I18n.CanFindHazelnut();
_spriteScale = 20 / 7f;
break;
default:
Expand Down
14 changes: 13 additions & 1 deletion UIInfoSuite2/UIElements/ShowToolUpgradeStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ private void UpdateToolInfo()
or Pickaxe
or Hoe
or WateringCan
or Pan
or GenericTool { IndexOfMenuItemView: >= 13 and <= 16 })
{
ParsedItemData? itemData = ItemRegistry.GetDataOrErrorItem(toolBeingUpgraded.QualifiedItemId);
Expand Down Expand Up @@ -60,7 +61,18 @@ or WateringCan
#region Properties
private readonly PerScreen<string> _hoverText = new();
private readonly PerScreen<Tool?> _toolBeingUpgraded = new();
private readonly PerScreen<ClickableTextureComponent> _toolUpgradeIcon = new();

private readonly PerScreen<ClickableTextureComponent> _toolUpgradeIcon = new(
() =>
{
return new ClickableTextureComponent(
new Rectangle(0, 0, 40, 40),
Game1.mouseCursors,
new Rectangle(322, 498, 12, 12),
40 / 12f
);
}
);

private readonly IModHelper _helper;
#endregion
Expand Down
2 changes: 1 addition & 1 deletion UIInfoSuite2/UIElements/ShowTravelingMerchant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private void OnRenderedHud(object sender, RenderedHudEventArgs e)
// Show text on hover
if (ShouldDrawIcon() && (_travelingMerchantIcon?.containsPoint(Game1.getMouseX(), Game1.getMouseY()) ?? false))
{
string hoverText = _helper.SafeGetString(LanguageKeys.TravelingMerchantIsInTown);
string hoverText = I18n.TravelingMerchantIsInTown();
IClickableMenu.drawHoverText(Game1.spriteBatch, hoverText, Game1.dialogueFont);
}
}
Expand Down
Loading

0 comments on commit 4297099

Please sign in to comment.