Merge pull request #120 from Salanto/add-asset-packet
Add asset packet + network encoding
This commit is contained in:
commit
f01db9b22e
@ -20,6 +20,7 @@ maximum_statements=10
|
|||||||
multiclient_limit=15
|
multiclient_limit=15
|
||||||
maximum_characters=256
|
maximum_characters=256
|
||||||
message_floodguard=250
|
message_floodguard=250
|
||||||
|
asset_url=Your WebAO asset url here.
|
||||||
|
|
||||||
[Dice]
|
[Dice]
|
||||||
max_value=100
|
max_value=100
|
||||||
|
@ -317,6 +317,10 @@ class Server : public QObject {
|
|||||||
* @brief The minimum time between IC messages, in milliseconds.
|
* @brief The minimum time between IC messages, in milliseconds.
|
||||||
*/
|
*/
|
||||||
int message_floodguard;
|
int message_floodguard;
|
||||||
|
/**
|
||||||
|
* @brief URL send to the client during handshake to set the remote repository URL.
|
||||||
|
*/
|
||||||
|
QUrl asset_url;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/**
|
/**
|
||||||
|
@ -265,6 +265,10 @@ void AOClient::sendPacket(AOPacket packet)
|
|||||||
#ifdef NET_DEBUG
|
#ifdef NET_DEBUG
|
||||||
qDebug() << "Sent packet:" << packet.header << ":" << packet.contents;
|
qDebug() << "Sent packet:" << packet.header << ":" << packet.contents;
|
||||||
#endif
|
#endif
|
||||||
|
packet.contents.replaceInStrings("#", "<num>")
|
||||||
|
.replaceInStrings("%", "<percent>")
|
||||||
|
.replaceInStrings("$", "<dollar>")
|
||||||
|
.replaceInStrings("&", "<and>");
|
||||||
socket->write(packet.toUtf8());
|
socket->write(packet.toUtf8());
|
||||||
socket->flush();
|
socket->flush();
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,11 @@ void AOClient::pktSoftwareId(AreaData* area, int argc, QStringList argv, AOPacke
|
|||||||
|
|
||||||
sendPacket("PN", {QString::number(server->player_count), server->max_players});
|
sendPacket("PN", {QString::number(server->player_count), server->max_players});
|
||||||
sendPacket("FL", feature_list);
|
sendPacket("FL", feature_list);
|
||||||
|
|
||||||
|
if (server->asset_url.isValid()) {
|
||||||
|
QByteArray asset_url = server->asset_url.toEncoded(QUrl::EncodeSpaces);
|
||||||
|
sendPacket("ASS", {asset_url});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOClient::pktBeginLoad(AreaData* area, int argc, QStringList argv, AOPacket packet)
|
void AOClient::pktBeginLoad(AreaData* area, int argc, QStringList argv, AOPacket packet)
|
||||||
|
@ -295,6 +295,9 @@ void Server::loadServerConfig()
|
|||||||
message_floodguard = config.value("message_floodguard", "250").toInt(&message_floodguard_conversion_success);
|
message_floodguard = config.value("message_floodguard", "250").toInt(&message_floodguard_conversion_success);
|
||||||
if (!message_floodguard_conversion_success)
|
if (!message_floodguard_conversion_success)
|
||||||
message_floodguard = 30;
|
message_floodguard = 30;
|
||||||
|
asset_url = config.value("asset_url","").toString().toUtf8();
|
||||||
|
if (!asset_url.isValid())
|
||||||
|
asset_url = NULL;
|
||||||
config.endGroup();
|
config.endGroup();
|
||||||
|
|
||||||
//Load dice values
|
//Load dice values
|
||||||
|
Loading…
Reference in New Issue
Block a user