mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge branch 'master' of http://github.com/heinrich5991/DDRace
Conflicts: src/game/server/gamecontext.cpp
This commit is contained in:
commit
7f437f7245
|
@ -812,11 +812,12 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
|
|||
|
||||
if(Unpacker.Error() == 0/* && m_aClients[ClientId].m_Authed*/)
|
||||
{
|
||||
Console()->RegisterAlternativePrintCallback(0, 0);
|
||||
|
||||
char aBuf[256];
|
||||
if(m_aClients[ClientId].m_Authed >= 0)
|
||||
{
|
||||
Console()->RegisterAlternativePrintCallback(0, 0);
|
||||
|
||||
str_format(aBuf, sizeof(aBuf), "'%s' ClientId=%d Level=%d Rcon='%s'", ClientName(ClientId), ClientId, m_aClients[ClientId].m_Authed, pCmd);
|
||||
Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "server", aBuf);
|
||||
|
||||
|
@ -833,7 +834,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
|
|||
}
|
||||
else
|
||||
{
|
||||
dbg_msg("server", "'%s' client tried rcon command ('pCmd') without permissions. Cid=%x ip=%d.%d.%d.%d",
|
||||
dbg_msg("server", "'%s' client tried rcon command ('%s') without permissions. Cid=%x ip=%d.%d.%d.%d",
|
||||
ClientName(ClientId),
|
||||
pCmd,
|
||||
ClientId,
|
||||
|
@ -976,7 +977,7 @@ void CServer::SendServerInfo(NETADDR *pAddr, int Token)
|
|||
p.AddString(aBuf, 4);
|
||||
|
||||
str_format(aBuf, sizeof(aBuf), "%d", PlayerCount); p.AddString(aBuf, 3); // num players
|
||||
str_format(aBuf, sizeof(aBuf), "%d", m_NetServer.MaxClients()); p.AddString(aBuf, 3); // max players
|
||||
str_format(aBuf, sizeof(aBuf), "%d", max(m_NetServer.MaxClients() - g_Config.m_SvReservedSlots, PlayerCount)); p.AddString(aBuf, 3); // max players
|
||||
|
||||
for(i = 0; i < MAX_CLIENTS; i++)
|
||||
{
|
||||
|
@ -1724,7 +1725,7 @@ void CServer::CheckPass(int ClientId, const char *pPw)
|
|||
else
|
||||
{
|
||||
NETADDR Addr = m_NetServer.ClientAddr(ClientId);
|
||||
BanAdd(Addr, g_Config.m_SvRconBantime*60, "Too many remote console authentication tries");
|
||||
BanAdd(Addr, g_Config.m_SvRconBantime, "Too many remote console authentication tries");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ MACRO_CONFIG_INT(ClEditor, cl_editor, 0, 0, 1, CFGFLAG_CLIENT, "", -1)
|
|||
|
||||
MACRO_CONFIG_INT(ClEventthread, cl_eventthread, 0, 0, 1, CFGFLAG_CLIENT, "Enables the usage of a thread to pump the events", -1)
|
||||
|
||||
MACRO_CONFIG_INT(ClShowIds, cl_show_ids, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Whether to show client ids in scoreboard", -1)
|
||||
|
||||
MACRO_CONFIG_INT(InpGrab, inp_grab, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use forceful input grabbing method", -1)
|
||||
|
||||
MACRO_CONFIG_STR(BrFilterString, br_filter_string, 25, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Server browser filtering string", -1)
|
||||
|
@ -70,7 +72,7 @@ MACRO_CONFIG_INT(SvHighBandwidth, sv_high_bandwidth, 0, 0, 1, CFGFLAG_SERVER, "U
|
|||
MACRO_CONFIG_INT(SvRegister, sv_register, 1, 0, 1, CFGFLAG_SERVER, "Register server with master server for public listing", 3)
|
||||
/*MACRO_CONFIG_STR(SvRconPassword, sv_rcon_password, 32, "", CFGFLAG_SERVER, "Remote console password")*/
|
||||
MACRO_CONFIG_INT(SvRconMaxTries, sv_rcon_max_tries, 3, 0, 100, CFGFLAG_SERVER, "Maximum number of tries for remote console authentication", 3)
|
||||
MACRO_CONFIG_INT(SvRconBantime, sv_rcon_bantime, 5, 0, 1440, CFGFLAG_SERVER, "The time a client gets banned if remote console authentication fails. 0 makes it just use kick", 3)
|
||||
MACRO_CONFIG_INT(SvRconBantime, sv_rcon_bantime, 300, 0, 9999, CFGFLAG_SERVER, "The time a client gets banned if remote console authentication fails. 0 makes it just use kick", 3)
|
||||
|
||||
MACRO_CONFIG_INT(Debug, debug, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Debug mode", 3)
|
||||
MACRO_CONFIG_INT(DbgStress, dbg_stress, 0, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Stress systems", 3)
|
||||
|
@ -105,7 +107,7 @@ MACRO_CONFIG_INT(SvPauseTime, sv_pause_time, 0, 0, 1, CFGFLAG_SERVER, "Whether '
|
|||
MACRO_CONFIG_INT(SvEmotionalTees, sv_emotional_tees, 1, 0, 1, CFGFLAG_SERVER, "Whether eye change of tees is enabled or not", 3)
|
||||
MACRO_CONFIG_INT(SvEmoticonDelay, sv_emoticon_delay, 3, 0, 9999, CFGFLAG_SERVER, "The time in seconds between over-head emoticons", 3)
|
||||
|
||||
MACRO_CONFIG_INT(SvChatDelay, sv_chat_delay, 0, 0, 9999, CFGFLAG_SERVER, "The time in seconds between chat messages", 3)
|
||||
MACRO_CONFIG_INT(SvChatDelay, sv_chat_delay, 1, 0, 9999, CFGFLAG_SERVER, "The time in seconds between chat messages", 3)
|
||||
MACRO_CONFIG_INT(SvTeamChangeDelay, sv_team_change_delay, 3, 0, 9999, CFGFLAG_SERVER, "The time in seconds between team changes (spectator/in game)", 3)
|
||||
MACRO_CONFIG_INT(SvInfoChangeDelay, sv_info_change_delay, 5, 0, 9999, CFGFLAG_SERVER, "The time in seconds between info changes (name/skin/color)", 3)
|
||||
MACRO_CONFIG_INT(SvVoteMapTimeDelay, sv_vote_map_delay,0,0,9999,CFGFLAG_SERVER, "The minimum time in seconds between map votes", 3)
|
||||
|
@ -139,9 +141,5 @@ MACRO_CONFIG_STR(SvRulesLine7, sv_rules_line7, 40, "", CFGFLAG_SERVER, "Rules li
|
|||
MACRO_CONFIG_STR(SvRulesLine8, sv_rules_line8, 40, "", CFGFLAG_SERVER, "Rules line 8", 4)
|
||||
MACRO_CONFIG_STR(SvRulesLine9, sv_rules_line9, 40, "", CFGFLAG_SERVER, "Rules line 9", 4)
|
||||
MACRO_CONFIG_STR(SvRulesLine10, sv_rules_line10, 40, "", CFGFLAG_SERVER, "Rules line 10", 4)
|
||||
|
||||
MACRO_CONFIG_INT(SvChatSpamMuteTime, sv_chat_spam_mutetime, 1, 0, 1440, CFGFLAG_SERVER, "Time in minutes to mute the spammer", 3)
|
||||
MACRO_CONFIG_INT(SvChatSpamCount, sv_chat_spam_count, 4, 0, 20, CFGFLAG_SERVER, "Number of spam tries from the same user before muting him", 3)
|
||||
MACRO_CONFIG_INT(SvChatSpamProtection, sv_chat_spam_protection, 1, 0, 1, CFGFLAG_SERVER, "Alternate chat protection system active or not", 3)
|
||||
//MACRO_CONFIG_INT(SvReconnectTime, sv_reconnect_time,5,0,9999,CFGFLAG_SERVER, "The time in seconds between leaves and joins of clients with the same ip", 3)
|
||||
#endif
|
||||
|
|
|
@ -107,9 +107,12 @@ void CScoreboard::RenderSpectators(float x, float y, float w)
|
|||
{
|
||||
if(Count)
|
||||
str_append(aBuffer, ", ", sizeof(aBuffer));
|
||||
char aId[3];
|
||||
str_format(aId,sizeof(aId),"%d:",pInfo->m_ClientId);
|
||||
str_append(aBuffer, aId, sizeof(aBuffer));
|
||||
if (g_Config.m_ClShowIds)
|
||||
{
|
||||
char aId[4];
|
||||
str_format(aId,sizeof(aId),"%d:",pInfo->m_ClientId);
|
||||
str_append(aBuffer, aId, sizeof(aBuffer));
|
||||
}
|
||||
str_append(aBuffer, m_pClient->m_aClients[pInfo->m_ClientId].m_aName, sizeof(aBuffer));
|
||||
Count++;
|
||||
}
|
||||
|
@ -245,8 +248,9 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
|||
FontSizeResize = FontSize;
|
||||
while(TextRender()->TextWidth(0, FontSizeResize, m_pClient->m_aClients[pInfo->m_ClientId].m_aName, -1) > w-163.0f-PingWidth)
|
||||
--FontSizeResize;
|
||||
char aId[64];
|
||||
str_format(aId,sizeof(aId),"%d:",pInfo->m_ClientId);
|
||||
char aId[64] = "";
|
||||
if (g_Config.m_ClShowIds)
|
||||
str_format(aId, sizeof(aId),"%d:", pInfo->m_ClientId);
|
||||
str_append(aId, m_pClient->m_aClients[pInfo->m_ClientId].m_aName,sizeof(aId));
|
||||
TextRender()->Text(0, x+128.0f, y+(FontSize-FontSizeResize)/2, FontSizeResize, aId, -1);
|
||||
|
||||
|
|
|
@ -624,7 +624,7 @@ void CGameContext::OnSetAuthed(int client_id, int Level)
|
|||
{
|
||||
m_apPlayers[client_id]->m_Authed = Level;
|
||||
char buf[11];
|
||||
str_format(buf, sizeof(buf), "ban %d %d", client_id, g_Config.m_SvVoteKickBantime*60);
|
||||
str_format(buf, sizeof(buf), "ban %d %d", client_id, g_Config.m_SvVoteKickBantime);
|
||||
if( !strcmp(m_aVoteCommand,buf))
|
||||
{
|
||||
m_VoteEnforce = CGameContext::VOTE_ENFORCE_NO;
|
||||
|
@ -726,27 +726,11 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
|
|||
{
|
||||
if(m_apPlayers[ClientId]->m_Muted == 0)
|
||||
{
|
||||
if(/*g_Config.m_SvSpamprotection && */pPlayer->m_Last_Chat && pPlayer->m_Last_Chat + Server()->TickSpeed() * g_Config.m_SvChatDelay > Server()->Tick())
|
||||
if(/*g_Config.m_SvSpamprotection && */pPlayer->m_Last_Chat && pPlayer->m_Last_Chat + Server()->TickSpeed() + g_Config.m_SvChatDelay > Server()->Tick())
|
||||
return;
|
||||
if(g_Config.m_SvChatSpamProtection)
|
||||
{
|
||||
if(!str_comp_nocase(pMsg->m_pMessage, pPlayer->m_LastMessage1))
|
||||
if(!str_comp_nocase(pPlayer->m_LastMessage1, pPlayer->m_LastMessage2))
|
||||
{
|
||||
pPlayer->m_SpamCount++;
|
||||
if(pPlayer->m_SpamCount > g_Config.m_SvChatSpamCount)
|
||||
m_apPlayers[ClientId]->m_Muted = g_Config.m_SvChatSpamMuteTime * 60 * Server()->TickSpeed();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SendChat(ClientId, Team, pMsg->m_pMessage);
|
||||
if(g_Config.m_SvChatSpamProtection)
|
||||
{
|
||||
str_copy(pPlayer->m_LastMessage2, pPlayer->m_LastMessage1, sizeof(pPlayer->m_LastMessage2));
|
||||
str_copy(pPlayer->m_LastMessage1, pMsg->m_pMessage, sizeof(pPlayer->m_LastMessage1));
|
||||
pPlayer->m_SpamCount = 0;
|
||||
}
|
||||
|
||||
pPlayer->m_Last_Chat = Server()->Tick();
|
||||
}
|
||||
else
|
||||
|
@ -1190,6 +1174,20 @@ void CGameContext::ConAddVote(IConsole::IResult *pResult, void *pUserData, int C
|
|||
pSelf->Server()->SendPackMsg(&OptionMsg, MSGFLAG_VITAL, -1);
|
||||
}
|
||||
|
||||
void CGameContext::ConClearVotes(IConsole::IResult *pResult, void *pUserData, int ClientID)
|
||||
{
|
||||
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||
|
||||
pSelf->m_pVoteOptionHeap->Reset();
|
||||
pSelf->m_pVoteOptionFirst = 0;
|
||||
pSelf->m_pVoteOptionLast = 0;
|
||||
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", "cleared vote options");
|
||||
|
||||
CNetMsg_Sv_VoteClearOptions ClearOptionsMsg;
|
||||
pSelf->Server()->SendPackMsg(&ClearOptionsMsg, MSGFLAG_VITAL, -1);
|
||||
}
|
||||
|
||||
void CGameContext::ConVote(IConsole::IResult *pResult, void *pUserData, int ClientID)
|
||||
{
|
||||
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||
|
@ -2335,6 +2333,8 @@ void CGameContext::OnConsoleInit()
|
|||
Console()->Register("broadcast", "r", CFGFLAG_SERVER, ConBroadcast, this, "Changes the broadcast message for a moment", 3);
|
||||
Console()->Register("say", "r", CFGFLAG_SERVER, ConSay, this, "Sends a server message to all players", 3);
|
||||
Console()->Register("set_team", "ii", CFGFLAG_SERVER, ConSetTeam, this, "Changes the team of player i1 to team i2", 2);
|
||||
Console()->Register("addvote", "r", CFGFLAG_SERVER, ConAddVote, this, "Adds a vote entry to the clients", 4);
|
||||
Console()->Register("clear_votes", "", CFGFLAG_SERVER, ConClearVotes, this, "Clears the vote list", 4);
|
||||
|
||||
Console()->Register("tune", "si", CFGFLAG_SERVER, ConTuneParam, this, "Modifies tune parameter s to value i", 4);
|
||||
Console()->Register("tune_reset", "", CFGFLAG_SERVER, ConTuneReset, this, "Resets all tuning", 4);
|
||||
|
@ -2390,7 +2390,6 @@ void CGameContext::OnConsoleInit()
|
|||
Console()->Register("right", "?i", CFGFLAG_SERVER, ConGoRight, this, "Makes you or player i move 1 tile right", 1);
|
||||
Console()->Register("up", "?i", CFGFLAG_SERVER, ConGoUp, this, "Makes you or player i move 1 tile up", 1);
|
||||
Console()->Register("down", "?i", CFGFLAG_SERVER, ConGoDown, this, "Makes you or player i move 1 tile down", 1);
|
||||
Console()->Register("addvote", "r", CFGFLAG_SERVER, ConAddVote, this, "Adds a vote entry to the clients", 4);
|
||||
|
||||
Console()->Register("broadtime", "", CFGFLAG_SERVER, ConBroadTime, this, "Toggles Showing the time string in race", -1);
|
||||
Console()->Register("cmdlist", "", CFGFLAG_SERVER, ConCmdList, this, "Shows the list of all commands", -1);
|
||||
|
|
|
@ -106,6 +106,7 @@ class CGameContext : public IGameServer
|
|||
static void ConGoDown(IConsole::IResult *pResult, void *pUserData, int ClientId);
|
||||
|
||||
static void ConAddVote(IConsole::IResult *pResult, void *pUserData, int ClientId);
|
||||
static void ConClearVotes(IConsole::IResult *pResult, void *pUserData, int ClientId);
|
||||
static void ConVote(IConsole::IResult *pResult, void *pUserData, int ClientId);
|
||||
static void ConchainSpecialMotdupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ void CPlayer::OnDisconnect()
|
|||
str_format(aBuf, sizeof(aBuf), "leave player='%d:%s'", m_ClientID, Server()->ClientName(m_ClientID));
|
||||
GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "game", aBuf);
|
||||
if(m_Muted > 0) {
|
||||
str_format(Cmd, sizeof(Cmd), "ban %d %d '%s'", m_ClientID, m_Muted/Server()->TickSpeed()/60, "ppc");
|
||||
str_format(Cmd, sizeof(Cmd), "ban %d %d '%s'", m_ClientID, m_Muted/Server()->TickSpeed(), "ppc");
|
||||
GameServer()->Console()->ExecuteLine(Cmd, 3, -1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,9 +78,6 @@ public:
|
|||
int64 m_Last_ChangeInfo;
|
||||
int64 m_Last_Emote;
|
||||
int64 m_Last_Kill;
|
||||
char m_LastMessage1[370];
|
||||
char m_LastMessage2[370];
|
||||
int m_SpamCount;
|
||||
|
||||
bool m_Invisible;
|
||||
|
||||
|
|
Loading…
Reference in a new issue