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

Add new mtaserver.conf rules for server browser/list #3761

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
b97c3ab
add new serverlist rule values mtaserver.conf
Fernando-A-Rocha Oct 1, 2024
bf12328
Fix empty lines etc
Fernando-A-Rocha Oct 3, 2024
ed0d19a
Fix newline at end of line
Fernando-A-Rocha Oct 3, 2024
c29110a
Load rules from mtaserver.conf
Fernando-A-Rocha Oct 3, 2024
6a74163
Merge branch 'master' into serverlist-new-conf
Fernando-A-Rocha Oct 3, 2024
5cbe04d
Improve code thnx to review by tederis
Fernando-A-Rocha Oct 3, 2024
c622dd3
Merge branch 'serverlist-new-conf' of github.com:Fernando-A-Rocha/mta…
Fernando-A-Rocha Oct 3, 2024
e4b797f
add const noexcept GetRulesForASE
Fernando-A-Rocha Oct 3, 2024
32c56a2
Refactor
Fernando-A-Rocha Oct 3, 2024
f8b08f5
Refactor hungarian notation
Fernando-A-Rocha Oct 3, 2024
13ff349
Merge branch 'master' into serverlist-new-conf
Fernando-A-Rocha Oct 3, 2024
4cb8995
Fix redundant check ASE
Fernando-A-Rocha Oct 3, 2024
a938d62
Refactor grab client_file part
Fernando-A-Rocha Oct 4, 2024
be21fa1
Refactor CMainConfig::AddMissingSettings() and edit .conf comments
Fernando-A-Rocha Oct 5, 2024
a7facd3
Merge branch 'master' into serverlist-new-conf
Fernando-A-Rocha Oct 5, 2024
d191085
early continue
Fernando-A-Rocha Oct 5, 2024
2e39c06
fix
Fernando-A-Rocha Oct 8, 2024
75d3ccb
refactor
Fernando-A-Rocha Oct 8, 2024
2741a3c
Merge branch 'master' into serverlist-new-conf
Fernando-A-Rocha Nov 4, 2024
031a840
Merge branch 'master' into serverlist-new-conf
Fernando-A-Rocha Nov 20, 2024
5ec4e66
Merge branch 'master' into serverlist-new-conf
Fernando-A-Rocha Nov 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Server/mods/deathmatch/editor.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,30 @@
<!-- This parameter specifies the name the server will be visible as in the ingame server browser
and on Game-Monitor. It is a required parameter. -->
<servername>Map Editor Server</servername>

<!-- These rules are optional parameters for the server browser/list (they can be left empty).
Each rule has their own requirements. Read carefully. -->

<!-- A brief description of the server. -->
<rule name="description" value="" />

<!-- A comma separated list of languages that the server supports (e.g. en). -->
<rule name="languages" value="" />

<!-- A comma separated list of tags that describe the server (e.g. freeroam,roleplay). -->
<rule name="tags" value="" />

<!-- The URL of the server's website. -->
<rule name="website_url" value="" />

<!-- A social media URL #1 (e.g. Discord). -->
<rule name="social1_url" value="" />

<!-- A social media URL #2 (e.g. YouTube). -->
<rule name="social2_url" value="" />

<!-- A social media URL #3 (e.g. Facebook). -->
<rule name="social3_url" value="" />

<!-- This parameter specifies the contact email addresses for the owner(s) of this server.
The email addresses will not be publicly available, and only used by MTA administrators
Expand Down
24 changes: 24 additions & 0 deletions Server/mods/deathmatch/local.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,30 @@
<!-- This parameter specifies the name the server will be visible as in the ingame server browser
and on Game-Monitor. It is a required parameter. -->
<servername>Default MTA Server</servername>

<!-- These rules are optional parameters for the server browser/list (they can be left empty).
Each rule has their own requirements. Read carefully. -->

<!-- A brief description of the server. -->
<rule name="description" value="" />

<!-- A comma separated list of languages that the server supports (e.g. en). -->
<rule name="languages" value="" />

<!-- A comma separated list of tags that describe the server (e.g. freeroam,roleplay). -->
<rule name="tags" value="" />

<!-- The URL of the server's website. -->
<rule name="website_url" value="" />

<!-- A social media URL #1 (e.g. Discord). -->
<rule name="social1_url" value="" />

<!-- A social media URL #2 (e.g. YouTube). -->
<rule name="social2_url" value="" />

<!-- A social media URL #3 (e.g. Facebook). -->
<rule name="social3_url" value="" />

<!-- This parameter specifies the contact email addresses for the owner(s) of this server.
The email addresses will not be publicly available, and only used by MTA administrators
Expand Down
12 changes: 10 additions & 2 deletions Server/mods/deathmatch/logic/CGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -962,8 +962,16 @@ bool CGame::Start(int iArgumentCount, char* szArguments[])

// If ASE is enabled
m_pASE = new ASE(m_pMainConfig, m_pPlayerManager, static_cast<int>(usServerPort), strServerIPList);
if (m_pMainConfig->GetSerialVerificationEnabled())
m_pASE->SetRuleValue("SerialVerification", "yes");
if (m_pASE) {
if (m_pMainConfig->GetSerialVerificationEnabled())
m_pASE->SetRuleValue("SerialVerification", "yes");

// Set the Rules loaded from config
std::map<SString, SString> rulesMap = m_pMainConfig->GetRulesForASE();
for (const auto& rule : rulesMap)
m_pASE->SetRuleValue(rule.first, rule.second);
Fernando-A-Rocha marked this conversation as resolved.
Show resolved Hide resolved
}

ApplyAseSetting();
m_pMasterServerAnnouncer = new CMasterServerAnnouncer();
m_pMasterServerAnnouncer->Pulse();
Expand Down
29 changes: 27 additions & 2 deletions Server/mods/deathmatch/logic/CMainConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,31 @@ bool CMainConfig::Load()
return false;
}

// Grab rules
CXMLNode* pNode = nullptr;
unsigned int uiCurrentIndex = 0;
Fernando-A-Rocha marked this conversation as resolved.
Show resolved Hide resolved
do
{
// Grab the current script node
pNode = m_pRootNode->FindSubNode("rule", uiCurrentIndex++);
if (pNode)
{
// Grab its "name" attribute
CXMLAttribute* pAttribute = pNode->GetAttributes().Find("name");
SString strName = pAttribute ? pAttribute->GetValue() : "";
Fernando-A-Rocha marked this conversation as resolved.
Show resolved Hide resolved

// Grab its "value" attribute
pAttribute = pNode->GetAttributes().Find("value");
SString strValue = pAttribute ? pAttribute->GetValue() : "";
Fernando-A-Rocha marked this conversation as resolved.
Show resolved Hide resolved

// Ignore if name or value are empty
if (strName != "" && strValue != "") {
Fernando-A-Rocha marked this conversation as resolved.
Show resolved Hide resolved
// Store the key value pair
m_RulesForASEMap[strName] = strValue;
Fernando-A-Rocha marked this conversation as resolved.
Show resolved Hide resolved
}
}
} while (pNode);

// Grab the forced server ip(s)
GetString(m_pRootNode, "serverip", m_strServerIP);
m_strServerIP = SString(m_strServerIP).Replace(" ", "");
Expand Down Expand Up @@ -232,8 +257,8 @@ bool CMainConfig::Load()
GetInteger(m_pRootNode, "verifyclientsettings", m_iEnableClientChecks);

// Handle the <client_file> nodes
CXMLNode* pNode = NULL;
unsigned int uiCurrentIndex = 0;
pNode = nullptr;
uiCurrentIndex = 0;
do
{
// Grab the current script node
Expand Down
2 changes: 2 additions & 0 deletions Server/mods/deathmatch/logic/CMainConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class CMainConfig : public CXMLConfig
unsigned int GetScriptDebugLogLevel() { return m_uiScriptDebugLogLevel; };
const std::string& GetAccessControlListFile() { return m_strAccessControlListFile; };
bool GetSerialVerificationEnabled() { return m_bVerifySerials; };
std::map<SString, SString> GetRulesForASE() { return m_RulesForASEMap; };
Fernando-A-Rocha marked this conversation as resolved.
Show resolved Hide resolved
bool IsDisableAC(const char* szTagAC) { return MapContains(m_DisableComboACMap, szTagAC); };
bool IsEnableDiagnostic(const char* szTag) { return MapContains(m_EnableDiagnosticMap, szTag); };
CMtaVersion GetMinClientVersion() { return m_strMinClientVersion; }
Expand Down Expand Up @@ -190,6 +191,7 @@ class CMainConfig : public CXMLConfig
unsigned short m_usFPSLimit;
int m_bDontBroadcastLan;
std::set<SString> m_DisableComboACMap;
std::map<SString, SString> m_RulesForASEMap;
std::set<SString> m_EnableDiagnosticMap;
std::vector<SString> m_AuthSerialGroupList;
bool m_bAuthSerialHttpEnabled;
Expand Down
26 changes: 25 additions & 1 deletion Server/mods/deathmatch/mtaserver.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,31 @@
<!-- This parameter specifies the name the server will be visible as in the ingame server browser
and on Game-Monitor. It is a required parameter. -->
<servername>Default MTA Server</servername>


<!-- These rules are optional parameters for the server browser/list (they can be left empty).
Each rule has their own requirements. Read carefully. -->

<!-- A brief description of the server. -->
<rule name="description" value="" />

<!-- A comma separated list of languages that the server supports (e.g. en). -->
<rule name="languages" value="" />

<!-- A comma separated list of tags that describe the server (e.g. freeroam,roleplay). -->
<rule name="tags" value="" />

<!-- The URL of the server's website. -->
<rule name="website_url" value="" />

<!-- A social media URL #1 (e.g. Discord). -->
<rule name="social1_url" value="" />

<!-- A social media URL #2 (e.g. YouTube). -->
<rule name="social2_url" value="" />

<!-- A social media URL #3 (e.g. Facebook). -->
<rule name="social3_url" value="" />

<!-- This parameter specifies the contact email addresses for the owner(s) of this server.
The email addresses will not be publicly available, and only used by MTA administrators
to contact the server owner.
Expand Down
24 changes: 24 additions & 0 deletions Server/mods/deathmatch/mtaserver.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,30 @@
<!-- This parameter specifies the name the server will be visible as in the ingame server browser
and on Game-Monitor. It is a required parameter. -->
<servername>Default MTA Server</servername>

<!-- These rules are optional parameters for the server browser/list (they can be left empty).
Each rule has their own requirements. Read carefully. -->

<!-- A brief description of the server. -->
<rule name="description" value="" />

<!-- A comma separated list of languages that the server supports (e.g. en). -->
<rule name="languages" value="" />

<!-- A comma separated list of tags that describe the server (e.g. freeroam,roleplay). -->
<rule name="tags" value="" />

<!-- The URL of the server's website. -->
<rule name="website_url" value="" />

<!-- A social media URL #1 (e.g. Discord). -->
<rule name="social1_url" value="" />

<!-- A social media URL #2 (e.g. YouTube). -->
<rule name="social2_url" value="" />

<!-- A social media URL #3 (e.g. Facebook). -->
<rule name="social3_url" value="" />

<!-- This parameter specifies the contact email addresses for the owner(s) of this server.
The email addresses will not be publicly available, and only used by MTA administrators
Expand Down
Loading