Compare commits

...

6 commits

Author SHA1 Message Date
furo 35c006fc60
Merge 20d2d1fdd8 into 96ad30eb21 2024-09-18 02:09:43 -05:00
Dennis Felsing 96ad30eb21
Merge pull request #8978 from ChillerDragon/pr_spamprot
Describe what sv_spamprotection covers
2024-09-18 06:42:21 +00:00
Dennis Felsing b03245f7dd
Merge pull request #8979 from ChillerDragon/pr_flag_sounds7
Fix 0.7 client flag sounds being duplicated when dummy is connected
2024-09-18 06:39:16 +00:00
ChillerDragon 7192bbf397 Fix 0.7 client flag sounds being duplicated when dummy is connected
Closed https://github.com/ddnet-insta/ddnet-insta/issues/127
2024-09-18 10:40:36 +08:00
ChillerDragon 984845b2a9 Describe what sv_spamprotection covers 2024-09-18 09:40:09 +08:00
furo 20d2d1fdd8 Remove outdated anti-bot code 2024-09-17 13:48:25 +02:00
5 changed files with 9 additions and 37 deletions

View file

@ -228,7 +228,7 @@ MACRO_CONFIG_INT(SvWarmup, sv_warmup, 0, 0, 0, CFGFLAG_SERVER, "Number of second
MACRO_CONFIG_STR(SvMotd, sv_motd, 900, "", CFGFLAG_SERVER, "Message of the day to display for the clients")
MACRO_CONFIG_STR(SvGametype, sv_gametype, 32, "ddnet", CFGFLAG_SERVER, "Game type (ddnet, mod)")
MACRO_CONFIG_INT(SvTournamentMode, sv_tournament_mode, 0, 0, 1, CFGFLAG_SERVER, "Tournament mode. When enabled, players joins the server as spectator")
MACRO_CONFIG_INT(SvSpamprotection, sv_spamprotection, 1, 0, 1, CFGFLAG_SERVER, "Spam protection")
MACRO_CONFIG_INT(SvSpamprotection, sv_spamprotection, 1, 0, 1, CFGFLAG_SERVER, "Spam protection for: team change, chat, skin change, emotes and votes")
MACRO_CONFIG_INT(SvSpectatorSlots, sv_spectator_slots, 0, 0, MAX_CLIENTS, CFGFLAG_SERVER, "Number of slots to reserve for spectators")
MACRO_CONFIG_INT(SvInactiveKickTime, sv_inactivekick_time, 0, 0, 1000, CFGFLAG_SERVER, "How many minutes to wait before taking care of inactive players")

View file

@ -620,10 +620,12 @@ void *CGameClient::TranslateGameMsg(int *pMsgId, CUnpacker *pUnpacker, int Conn)
switch(GameMsgId)
{
case protocol7::GAMEMSG_CTF_DROP:
m_Sounds.Enqueue(CSounds::CHN_GLOBAL, SOUND_CTF_DROP);
if(Conn == g_Config.m_ClDummy)
m_Sounds.Enqueue(CSounds::CHN_GLOBAL, SOUND_CTF_DROP);
break;
case protocol7::GAMEMSG_CTF_RETURN:
m_Sounds.Enqueue(CSounds::CHN_GLOBAL, SOUND_CTF_RETURN);
if(Conn == g_Config.m_ClDummy)
m_Sounds.Enqueue(CSounds::CHN_GLOBAL, SOUND_CTF_RETURN);
break;
case protocol7::GAMEMSG_TEAM_ALL:
{
@ -650,7 +652,8 @@ void *CGameClient::TranslateGameMsg(int *pMsgId, CUnpacker *pUnpacker, int Conn)
}
break;
case protocol7::GAMEMSG_CTF_GRAB:
m_Sounds.Enqueue(CSounds::CHN_GLOBAL, SOUND_CTF_GRAB_EN);
if(Conn == g_Config.m_ClDummy)
m_Sounds.Enqueue(CSounds::CHN_GLOBAL, SOUND_CTF_GRAB_EN);
break;
case protocol7::GAMEMSG_GAME_PAUSED:
{
@ -660,7 +663,8 @@ void *CGameClient::TranslateGameMsg(int *pMsgId, CUnpacker *pUnpacker, int Conn)
}
break;
case protocol7::GAMEMSG_CTF_CAPTURE:
m_Sounds.Enqueue(CSounds::CHN_GLOBAL, SOUND_CTF_CAPTURE);
if(Conn == g_Config.m_ClDummy)
m_Sounds.Enqueue(CSounds::CHN_GLOBAL, SOUND_CTF_CAPTURE);
int ClientId = clamp(aParaI[1], 0, MAX_CLIENTS - 1);
m_aStats[ClientId].m_FlagCaptures++;

View file

@ -1525,24 +1525,6 @@ void CGameContext::OnClientEnter(int ClientId)
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_NORECORD, ClientId);
}
{
int Empty = -1;
for(int i = 0; i < MAX_CLIENTS; i++)
{
if(Server()->ClientSlotEmpty(i))
{
Empty = i;
break;
}
}
CNetMsg_Sv_Chat Msg;
Msg.m_Team = 0;
Msg.m_ClientId = Empty;
Msg.m_pMessage = "Do you know someone who uses a bot? Please report them to the moderators.";
m_apPlayers[ClientId]->m_EligibleForFinishCheck = time_get();
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_NORECORD, ClientId);
}
IServer::CClientInfo Info;
if(Server()->GetClientInfo(ClientId, &Info) && Info.m_GotDDNetVersion)
{
@ -2093,18 +2075,6 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
void CGameContext::OnSayNetMessage(const CNetMsg_Cl_Say *pMsg, int ClientId, const CUnpacker *pUnpacker)
{
CPlayer *pPlayer = m_apPlayers[ClientId];
bool Check = !pPlayer->m_NotEligibleForFinish && pPlayer->m_EligibleForFinishCheck + 10 * time_freq() >= time_get();
if(Check && str_comp(pMsg->m_pMessage, "xd sure chillerbot.png is lyfe") == 0 && pMsg->m_Team == 0)
{
if(m_TeeHistorianActive)
{
m_TeeHistorian.RecordPlayerMessage(ClientId, pUnpacker->CompleteData(), pUnpacker->CompleteSize());
}
pPlayer->m_NotEligibleForFinish = true;
dbg_msg("hack", "bot detected, cid=%d", ClientId);
return;
}
int Team = pMsg->m_Team;
// trim right and set maximum length to 256 utf8-characters

View file

@ -140,7 +140,6 @@ void CPlayer::Reset()
m_FirstVoteTick = Now;
m_NotEligibleForFinish = false;
m_EligibleForFinishCheck = 0;
m_VotedForPractice = false;
m_SwapTargetsClientId = -1;
m_BirthdayAnnounced = false;

View file

@ -222,7 +222,6 @@ public:
std::shared_ptr<CScorePlayerResult> m_ScoreQueryResult;
std::shared_ptr<CScorePlayerResult> m_ScoreFinishResult;
bool m_NotEligibleForFinish;
int64_t m_EligibleForFinishCheck;
bool m_VotedForPractice;
int m_SwapTargetsClientId; //Client ID of the swap target for the given player
bool m_BirthdayAnnounced;