Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core/Server: correct timestamp format for shutdown/restart notification broadcasts #24181

Merged
merged 8 commits into from
Feb 22, 2020

Conversation

ForesterDev
Copy link
Contributor

Changes proposed:

  • change the time output format for restart/shutdown notifications
  • also check where we should use singular or plural forms for words: Day, Hour, Minute, Second

Target branch(es): 3.3.5/master

  • 3.3.5

Issues addressed: Closes #24174

Tests performed: (Does it build, tested in-game, etc.) Build, tested
image

@ghost
Copy link

ghost commented Feb 20, 2020

Can confirm this works, good job. :-)

EDIT: Can I just ask, what are the other irrelevant commits you've included in this pull request? I'm not trying to be funny I just can't understand why.

src/common/Common.h Outdated Show resolved Hide resolved
@ghost
Copy link

ghost commented Feb 20, 2020

LordWaycrest wrote:
EDIT: Can I just ask, what are the other irrelevant commits you've included in this pull request? I'm not trying to be funny I just can't understand why.

Those commits are there to keep the PR branch up to date with the 3.3.5 branch (at least for the content of this PR), to avoid file conflicts.

@ghost
Copy link

ghost commented Feb 20, 2020

LordWaycrest wrote:
EDIT: Can I just ask, what are the other irrelevant commits you've included in this pull request? I'm not trying to be funny I just can't understand why.

Those commits are there to keep the PR branch up to date with the 3.3.5 branch (at least for the content of this PR), to avoid file conflicts.

Hi, thank you for clarifying! :-)

@ghost
Copy link

ghost commented Feb 20, 2020

Hi, thank you for clarifying! :-)

You're welcome. The commits don't look quite like TC commits, but there may have been some back-and-forth during the creation of his PR, so I am guessing he didn't start off with a fully updated source before creating the PR branch.

@ghost
Copy link

ghost commented Feb 20, 2020

Hi, thank you for clarifying! :-)

You're welcome. The commits don't look quite like TC commits, but there may have been some back-and-forth during the creation of his PR, so I am guessing he didn't start off with a fully updated source before creating the PR branch.

I can't wait for this PR to be merged if it ever happens. I've been wanting to get this sorted for a long time. I'm all about Blizz-like! :-)

@ghost
Copy link

ghost commented Feb 20, 2020

Sure, I can see that. I enjoy seeing people making constructive changes toward blizzlike content, especially when the end result gives the player a feeling of being in a game environment with a very close to retail experience.

@ghost
Copy link

ghost commented Feb 20, 2020

Sure, I can see that. I enjoy seeing people making constructive changes toward blizzlike content, especially when the end result gives the player a feeling of being in a game environment with a very close to retail experience.

That is honestly my aim, people say to me "Why on earth would you focus on silly things like that?" It all counts!

@ghost
Copy link

ghost commented Feb 20, 2020

@ForesterDev : would you mind adding the content changes from commit 9009c82 to have all 4 PR tests working as intended?

}
if (secs || (!days && !hours && !minutes))
{
ss << secs;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this format seconds value as a single digit when between 0 and 9?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but for restart/shutdown notifications this situation is impossible, that why I did not process this case

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just use fmt

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Warpten not worth using fmt separately for multiple parts of this function (and you can't wrap it all in one big format)

ss << days << (shortText ? "d" : " Day(s) ");
{
ss << days;
if (timeFormat == TimeFormat::Numeric)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not switch?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    switch (timeFormat)
    {
    case TimeFormat::Numeric:
        ss << ":";
        break;
    case TimeFormat::ShortText:
        ss << "d";
        break;
    case TimeFormat::FullText:
        [[fallthrough]];
    default:
        if (days == 1)
            ss << " Day ";
        else
            ss << " Days ";
        break;
    }

@jackpoz jackpoz merged commit 6923158 into TrinityCore:3.3.5 Feb 22, 2020
@jackpoz
Copy link
Contributor

jackpoz commented Feb 22, 2020

Thanks for the PR :)

@ghost
Copy link

ghost commented Feb 22, 2020

Thank you those who helped, especially @ForesterDev :-)

@ghost
Copy link

ghost commented Feb 22, 2020

While this has been resolved, I actually have an idea that we could implement, later on, so obviously we can't make this format work for anything over 59 minutes, else it would look messed up. So I thought maybe we could limit the countdown timer to 59 minutes to solve that matter?

@ghost
Copy link

ghost commented Feb 23, 2020

Well, that might be useful on custom servers, because I can't remember seeing retail servers ever announcing an upcoming restart or shutdown in more than 30 or 45 minutes. Whoever chooses to use a warning for more than 59 minutes should consider this a special (custom) case. (At least that is what it looks like to me.)

@ghost
Copy link

ghost commented Feb 23, 2020

Well, that might be useful on custom servers, because I can't remember seeing retail servers ever announcing an upcoming restart or shutdown in more than 30 or 45 minutes. Whoever chooses to use a warning for more than 59 minutes should consider this a special (custom) case. (At least that is what it looks like to me.)

Once their automated shutdown countdown kicked in early which resulted in it printing random messages to chat. People were seeing a 53:00 minute warning.

Blizzard_CSEU on Twitter even apologized for it.

QKoQKS1

Think I could make it a feature request like you could configure it in the worldserver.conf?

@ghost
Copy link

ghost commented Feb 23, 2020

Feature request ticket sounds fair enough. (I am not a TC member, though. Just speaking from general experience.)

@ForesterDev ForesterDev deleted the timestamp_format branch May 20, 2020 07:37
Shauren pushed a commit that referenced this pull request Dec 22, 2021
…on broadcasts (#24181)

* Core/SmartScripts: implement SMART_ACTION_OVERRIDE_LIGHT and SMART_ACTION_OVERRIDE_WEATHER

* Core/Server: correct timestamp format for shutdown/restart notification broadcasts

* remove unexpected changes

* move enum from Common to Util

* Use enum class instead of enum

* Fix width for seconds 0 to 9

(cherry picked from commit 6923158)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants