|
|
|
@ -14,9 +14,8 @@ namespace mwmp
|
|
|
|
|
class ProxyMasterPacket : public BasePacket
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
ProxyMasterPacket(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
|
|
|
|
explicit ProxyMasterPacket(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
@ -25,11 +24,10 @@ namespace mwmp
|
|
|
|
|
{
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
int rulesSize = server.rules.size();
|
|
|
|
|
|
|
|
|
|
int32_t rulesSize = server.rules.size();
|
|
|
|
|
packet->RW(rulesSize, send);
|
|
|
|
|
|
|
|
|
|
if (rulesSize > 2000)
|
|
|
|
|
if (rulesSize > QueryData::maxRules)
|
|
|
|
|
rulesSize = 0;
|
|
|
|
|
|
|
|
|
|
map<string, ServerRule>::iterator ruleIt;
|
|
|
|
@ -38,7 +36,7 @@ namespace mwmp
|
|
|
|
|
|
|
|
|
|
while (rulesSize--)
|
|
|
|
|
{
|
|
|
|
|
ServerRule *rule = 0;
|
|
|
|
|
ServerRule *rule = nullptr;
|
|
|
|
|
string key;
|
|
|
|
|
if (send)
|
|
|
|
|
{
|
|
|
|
@ -46,7 +44,7 @@ namespace mwmp
|
|
|
|
|
rule = &ruleIt->second;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
packet->RW(key, send);
|
|
|
|
|
packet->RW(key, send, QueryData::maxStringLength);
|
|
|
|
|
if (!send)
|
|
|
|
|
{
|
|
|
|
|
ruleIt = server.rules.insert(pair<string, ServerRule>(key, ServerRule())).first;
|
|
|
|
@ -55,8 +53,8 @@ namespace mwmp
|
|
|
|
|
|
|
|
|
|
packet->RW(rule->type, send);
|
|
|
|
|
|
|
|
|
|
if (rule->type == 's')
|
|
|
|
|
packet->RW(rule->str, send);
|
|
|
|
|
if (rule->type == ServerRule::Type::string)
|
|
|
|
|
packet->RW(rule->str, send, QueryData::maxStringLength);
|
|
|
|
|
else
|
|
|
|
|
packet->RW(rule->val, send);
|
|
|
|
|
|
|
|
|
@ -66,56 +64,38 @@ namespace mwmp
|
|
|
|
|
|
|
|
|
|
vector<string>::iterator plIt;
|
|
|
|
|
|
|
|
|
|
if (send)
|
|
|
|
|
plIt = server.players.begin();
|
|
|
|
|
else
|
|
|
|
|
server.players.clear();
|
|
|
|
|
|
|
|
|
|
int playersCount = server.players.size();
|
|
|
|
|
int32_t playersCount = server.players.size();
|
|
|
|
|
packet->RW(playersCount, send);
|
|
|
|
|
|
|
|
|
|
if (playersCount > 2000)
|
|
|
|
|
if (playersCount > QueryData::maxPlayers)
|
|
|
|
|
playersCount = 0;
|
|
|
|
|
|
|
|
|
|
while (playersCount--)
|
|
|
|
|
if (!send)
|
|
|
|
|
{
|
|
|
|
|
string player;
|
|
|
|
|
if (send)
|
|
|
|
|
player = *plIt;
|
|
|
|
|
server.players.clear();
|
|
|
|
|
server.players.resize(playersCount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
packet->RW(player, send);
|
|
|
|
|
for(auto &&player : server.players)
|
|
|
|
|
packet->RW(player, send, QueryData::maxStringLength);
|
|
|
|
|
|
|
|
|
|
if (!send)
|
|
|
|
|
server.players.push_back(player);
|
|
|
|
|
else
|
|
|
|
|
plIt++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int pluginsCount = server.plugins.size();
|
|
|
|
|
int32_t pluginsCount = server.plugins.size();
|
|
|
|
|
packet->RW(pluginsCount, send);
|
|
|
|
|
|
|
|
|
|
if (pluginsCount > 2000)
|
|
|
|
|
if (pluginsCount > QueryData::maxPlugins)
|
|
|
|
|
pluginsCount = 0;
|
|
|
|
|
|
|
|
|
|
vector<Plugin>::iterator pluginIt;
|
|
|
|
|
|
|
|
|
|
if (send)
|
|
|
|
|
pluginIt = server.plugins.begin();
|
|
|
|
|
else
|
|
|
|
|
if (!send)
|
|
|
|
|
{
|
|
|
|
|
server.plugins.clear();
|
|
|
|
|
server.plugins.resize(pluginsCount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (pluginsCount--)
|
|
|
|
|
for (auto &&plugin : server.plugins)
|
|
|
|
|
{
|
|
|
|
|
Plugin plugin;
|
|
|
|
|
if (send)
|
|
|
|
|
plugin = *pluginIt;
|
|
|
|
|
|
|
|
|
|
packet->RW(plugin.name, send);
|
|
|
|
|
packet->RW(plugin.name, send, QueryData::maxStringLength);
|
|
|
|
|
packet->RW(plugin.hash, send);
|
|
|
|
|
if (!send)
|
|
|
|
|
server.plugins.push_back(plugin);
|
|
|
|
|
else
|
|
|
|
|
pluginIt++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|