azerothcore / azerothcore-wotlk

Complete Open Source and Modular solution for MMO
http://www.azerothcore.org
GNU Affero General Public License v3.0
6.41k stars 2.57k forks source link

2 new functions: delayedKick(), delayedBan() #2817

Open BarbzYHOOL opened 4 years ago

BarbzYHOOL commented 4 years ago

The idea is to create two functions to kick/ban someone without him knowing exactly when the kick/ban was decided. It will be useful if you have an anti-multi account system, an anticheat system, for new .kick delay/.ban delay commands or even for Warden actions with new config options. The best example is when a cheater is testing what he can do or can not do. If you kick him instantly, he will understand what got him detected. That applies to a kick made by a GM too.

PSEUDO CODE:

Two functions that are wrappers around the original Kick and Ban functions (well, I guess they will be wrappers, i haven't checked the original functions). They should be in the same file as kick and ban functions, of course (unless proven otherwise).

delayedKick(145, "Our systems have detected that you are cheating.")

delayedKick(user_id, message = FALSE, min_random_duration = 1min, max_random_duration = 6min)
{
    waiting_time = random(min_random_duration, max_random_duration);

    // wait before kicking
    sleep(waiting_time);
    // optional: put the player into a phase so he is harmless to other players? (not sure)

    // send red notification + message in chat in yellow from Admin or from something else
    if (message)
        sendMessageIngame(message)
        sendMail(message)
        sleep(10seconds);

    kick(user_id);
}

delayedBan(145, "Our systems have detected that you are a recurring cheater. You are banned.")

delayedBan(user_id, message = FALSE, min_random_duration = 1min, max_random_duration = 6min, ban_ip = FALSE) 
{
    waiting_time = random(min_random_duration, max_random_duration);

    // wait before banning
    sleep(waiting_time);

    // optional: put the player into a phase so he is harmless to other players? (not sure)

    // send red notification + message in chat in yellow from Admin or from something else
    if(message)
        sendMessageIngame(message)
        sleep(10seconds);

    // ban account, if ban_ip = TRUE, then ban by IP
    if (ban_ip)
        banIp(user_id);
    else
        banAccount(user_id);
}

Can even deduplicate code with a subfunction for shared code (the waiting time etc)

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/91347809-2-new-functions-delayedkick-delayedban?utm_campaign=plugin&utm_content=tracker%2F40032087&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F40032087&utm_medium=issues&utm_source=github).
Kitzunu commented 2 years ago

I do not see a reason for this