RuiNtD / SVRichPresence

Discord Rich Presence for Stardew Valley
https://www.nexusmods.com/stardewvalley/mods/2156
MIT License
14 stars 4 forks source link

Add TotalTimeLetter tag #34

Open Tenebrosful opened 7 months ago

Tenebrosful commented 7 months ago

Hi, i wanted a better format for the total time with the h for hour replacing the :, so could be nice.

Feel free to change the name, naming is hard...

(Didn't tested because idk how to compile SDV mods but should works)

Tenebrosful commented 7 months ago

image

RuiNtD commented 7 months ago

The original tag uses the same function that the SDV uses to format the time on the top right of the screen. If your game is set to French, I believe it should already be formatted with an h for hour.

case LocalizedContentManager.LanguageCode.fr:
    if (time % 100 != 0)
    {
        return text2 + "h" + time % 100;
    }

    return text2 + "h";
Tenebrosful commented 7 months ago

The original tag uses the same function that the SDV uses to format the time on the top right of the screen. If your game is set to French, I believe it should already be formatted with an h for hour.

case LocalizedContentManager.LanguageCode.fr:
    if (time % 100 != 0)
    {
        return text2 + "h" + time % 100;
    }

    return text2 + "h";

That's the total save time spend, not currently time of the day

(Also i don't think that's a french thing, just wanted that because just XX:XX looks weird because you don't know if it's HH:MM or MM:SS)

RuiNtD commented 7 months ago

Considering how much this function changes the formatting based on language, it would make more sense to just replace the original function with a XhXm format.

Tenebrosful commented 7 months ago

Considering how much this function changes the formatting based on language, it would make more sense to just replace the original function with a XhXm format.

I think we don't talk about the same thing, i'm talking about TotalTime that only use Utility.getHoursMinutesStringFromMiliseconds that is

public static string getHoursMinutesStringFromMilliseconds(ulong milliseconds)
{
    return milliseconds / 3600000 + ":" + ((milliseconds % 3600000 / 60000 < 10) ? "0" : "") + milliseconds % 3600000 / 60000;
}

and isn't location based. i think you talk about Time that use Game1.getTimeOfDayString