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/Commands [Implement kickdelay command] #14250

Closed
wants to merge 14 commits into from
Closed

Core/Commands [Implement kickdelay command] #14250

wants to merge 14 commits into from

Conversation

hguy23
Copy link

@hguy23 hguy23 commented Dec 17, 2022

Changes Proposed:

  • Implemented kickdelay/bandelay commands

Issues Addressed:

Tests Performed:

  • Builds and test ingame

How to Test the Changes:

Example commands:
.kickdelay test Cheating 10 <- 10 means seconds
.bandelay ip 147.232.22.53 1d Cheating 10
.bandelay account test 1d Cheating 10

  1. Type .kickdelay $charactername $reason $delay_time or .bandelay account $acc_name $bantime $reason $delay_time or .bandelay ip $acc_ip $bantime $reason $delay_time
  2. Announce from $reason will appear at client.
  3. Wait $delay_time given time until kick/ban.
  4. Profit?

Known Issues and TODO List:

  • [ ]
  • [ ]

How to Test AzerothCore PRs

When a PR is ready to be tested, it will be marked as [WAITING TO BE TESTED].

You can help by testing PRs and writing your feedback here on the PR's page on GitHub. Follow the instructions here:

http://www.azerothcore.org/wiki/How-to-test-a-PR

REMEMBER: when testing a PR that changes something generic (i.e. a part of code that handles more than one specific thing), the tester should not only check that the PR does its job (e.g. fixing spell XXX) but especially check that the PR does not cause any regression (i.e. introducing new bugs).

For example: if a PR fixes spell X by changing a part of code that handles spells X, Y, and Z, we should not only test X, but we should test Y and Z as well.

@Yehonal Yehonal added CORE Related to the core DB related to the SQL database file-cpp Used to trigger the matrix build Script labels Dec 17, 2022
@hguy23
Copy link
Author

hguy23 commented Dec 17, 2022

Should I ignore that codefactor issue ? https://www.codefactor.io/repository/github/azerothcore/azerothcore-wotlk/pull/14250

Copy link
Member

@Kitzunu Kitzunu left a comment

Choose a reason for hiding this comment

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

Apart from that I still don't see the point of delayed commands, here are some things to improve.

Yes, you can ignore CodeFactor

Thanks fo the PR.

src/server/scripts/Commands/cs_ban.cpp Outdated Show resolved Hide resolved
src/server/scripts/Commands/cs_ban.cpp Outdated Show resolved Hide resolved
@hguy23 hguy23 requested a review from Kitzunu December 17, 2022 15:15
src/server/game/Entities/Player/PlayerUpdates.cpp Outdated Show resolved Hide resolved
src/server/game/Misc/BanMgr.cpp Outdated Show resolved Hide resolved
src/server/scripts/Commands/cs_ban.cpp Outdated Show resolved Hide resolved
src/server/scripts/Commands/cs_misc.cpp Outdated Show resolved Hide resolved
@hguy23
Copy link
Author

hguy23 commented Dec 18, 2022

Removed min_time and max_time, in my opinion this is uselles to pick random time, just delay it with one value.

@hguy23 hguy23 requested review from Kitzunu and acidmanifesto and removed request for Kitzunu and acidmanifesto December 18, 2022 09:09
@hguy23 hguy23 requested review from acidmanifesto and Kitzunu and removed request for Kitzunu and acidmanifesto December 18, 2022 20:02
@acidmanifesto
Copy link
Contributor

@frytik can you update the the how to test portion. I may know someone who may be interested in testing this out.
@55Honey this is a delay kick and ban gm cmd if you want to test this. I remember we had a prior conversation about this feature before.

@hguy23
Copy link
Author

hguy23 commented Dec 19, 2022

Thanks for the PR. The purpose of a delayed ban, is to leave the affected accounts owner clueless what exact action has triggered it. So it shouldn't interact with the banned player at all. It may definitely NOT send a message announcing a ban to be useful.

So I have just to remove notification from player, and we are good to go?

@55Honey
Copy link
Member

55Honey commented Dec 19, 2022

So I have just to remove notification from player, and we are good to go?

In terms of features, that's my only request. I'll leave the actual code to the other devs.

@hguy23
Copy link
Author

hguy23 commented Dec 19, 2022

So I have just to remove notification from player, and we are good to go?

In terms of features, that's my only request. I'll leave the actual code to the other devs.

Changed.

@hguy23 hguy23 requested review from acidmanifesto and removed request for Kitzunu December 19, 2022 15:52
src/server/game/Entities/Player/Player.h Outdated Show resolved Hide resolved

LoginDatabase.CommitTransaction(trans);

if (sWorld->getBoolConfig(CONFIG_SHOW_BAN_IN_WORLD))
if (sWorld->getBoolConfig(CONFIG_SHOW_BAN_IN_WORLD) && !delay)
Copy link
Member

Choose a reason for hiding this comment

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

Why are excluding delayed banns? Add another config for it instead

Copy link
Author

Choose a reason for hiding this comment

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

Because we shouldn't show ban reason in chat for delayed ban, because kick is comming after certain time.

Copy link
Member

Choose a reason for hiding this comment

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

I'd still say add a config for it

Copy link
Author

Choose a reason for hiding this comment

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

Why do you need config for that ? You have to skip this message if you are doing bandelay, cause this message is handled in bandelay function.

Copy link
Author

Choose a reason for hiding this comment

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

If you keep this option with config, banned player will see reason in chat before kick out of game.

Copy link
Member

@Kitzunu Kitzunu Dec 22, 2022

Choose a reason for hiding this comment

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

No, keep the config default off. Perhaps someone would like the message to show, and therefore should have the option for it

src/server/game/Misc/BanMgr.cpp Show resolved Hide resolved
kickReasonStr = std::string{ *reason };
}

targetPlayer->KickPlayer(kickReasonStr, Seconds(Acore::StringTo<int32>(delay_time).value_or(0)));
Copy link
Member

Choose a reason for hiding this comment

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

I am not the best when it comes to CommandHandler, but cant we pass the delay_time argument directly as Chrono by just needing the user to specify ms/s/d when using the command, to avoid the 3 way conversion?

Copy link
Author

Choose a reason for hiding this comment

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

Sadly I don't know. Every other command parsing it same way.

Copy link
Member

Choose a reason for hiding this comment

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

Ok just checking

@hguy23 hguy23 requested review from Kitzunu and removed request for acidmanifesto December 20, 2022 00:55
@hguy23
Copy link
Author

hguy23 commented Dec 20, 2022

Reworked whole announce system for kick/ban, now everything is in separate function, so should be better readable

@acidmanifesto
Copy link
Contributor

Reworked whole announce system for kick/ban, now everything is in separate function, so should be better readable

Ill give this a test run the next 48hrs when i got a opening in my schedule

@hguy23
Copy link
Author

hguy23 commented Dec 20, 2022

Reworked whole announce system for kick/ban, now everything is in separate function, so should be better readable

Ill give this a test run the next 48hrs when i got a opening in my schedule

Save you some time :D

Video2.mp4

@55Honey
Copy link
Member

55Honey commented Dec 20, 2022

Thanks for the video!
I don't see a delay timer given in the bandelay command you have used in the video I wonder how the syntax is?

@hguy23
Copy link
Author

hguy23 commented Dec 20, 2022

Thanks for the video! I don't see a delay timer given in the bandelay command you have used in the video I wonder how the syntax is?

.bandelay account $acc_name $bantime $reason $delay_time

That number five at end of command means delay time

@Kitzunu
Copy link
Member

Kitzunu commented Dec 22, 2022

#14250 (comment)

@acidmanifesto acidmanifesto added the run-build Used to trigger the windows/mac/docker and matrix builds label Jan 27, 2023
@acidmanifesto
Copy link
Contributor

applying run-build label to see if workflow passes. failure not related to pr.

Copy link
Contributor

@acidmanifesto acidmanifesto left a comment

Choose a reason for hiding this comment

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

image

@ghost
Copy link

ghost commented Feb 5, 2023

Tested with 2 char and work fine for the two commands. Thanks

@ghost ghost removed the Waiting to be Tested label Feb 5, 2023
@Gozzim
Copy link
Contributor

Gozzim commented Feb 12, 2023

One question and a comment if I may, just went over the PR list and read it out of curiosity.

  1. Why not just add this to the default kick and ban commands and default to no delay if none is given?
    That way we don't get a new command and have a better overview. Even though I like new commands and more possibilities, having combined what can be combined makes it less confusing in my opinion.

  2. We changed all commands that include a time argument to take timestrings instead of pure integers (and default to seconds if no unit for the time is given) to be consistent. Maybe we should also stay consistent here, even though like a 2m delay wouldn't make much sense, it would still be consistent over all commands then. Edit: And avoid a possible integer overflow

@Kitzunu Kitzunu added the PR Abandoned Original author stopped working on this PR. Feel free to take over. label Jun 27, 2023
@Kitzunu
Copy link
Member

Kitzunu commented Jun 27, 2023

PR Abandoned. If you want to continue work on this address the comment above. Open a new PR or reopen this

@Kitzunu Kitzunu closed this Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CORE Related to the core DB related to the SQL database file-cpp Used to trigger the matrix build PR Abandoned Original author stopped working on this PR. Feel free to take over. Ready to be Reviewed run-build Used to trigger the windows/mac/docker and matrix builds Script Waiting to be Tested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 new functions: delayedKick(), delayedBan()
7 participants