2024-01-12 13:30:53 +02:00
|
|
|
/*
|
|
|
|
* GlobalLobbyProcessor.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../lib/network/NetworkInterface.h"
|
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
class JsonNode;
|
|
|
|
VCMI_LIB_NAMESPACE_END
|
|
|
|
|
|
|
|
class CVCMIServer;
|
|
|
|
|
|
|
|
class GlobalLobbyProcessor : public INetworkClientListener
|
|
|
|
{
|
|
|
|
CVCMIServer & owner;
|
|
|
|
|
2024-01-29 22:05:11 +02:00
|
|
|
NetworkConnectionPtr controlConnection;
|
|
|
|
std::map<std::string, NetworkConnectionPtr> proxyConnections;
|
2024-01-12 13:30:53 +02:00
|
|
|
|
2024-02-02 01:27:19 +02:00
|
|
|
void onDisconnected(const std::shared_ptr<INetworkConnection> & connection, const std::string & errorMessage) override;
|
|
|
|
void onPacketReceived(const std::shared_ptr<INetworkConnection> & connection, const std::vector<std::byte> & message) override;
|
2024-01-12 13:30:53 +02:00
|
|
|
void onConnectionFailed(const std::string & errorMessage) override;
|
|
|
|
void onConnectionEstablished(const std::shared_ptr<INetworkConnection> &) override;
|
|
|
|
|
2024-02-02 00:12:30 +02:00
|
|
|
void receiveOperationFailed(const JsonNode & json);
|
2024-03-11 17:48:56 +02:00
|
|
|
void receiveServerLoginSuccess(const JsonNode & json);
|
2024-01-12 16:55:36 +02:00
|
|
|
void receiveAccountJoinsRoom(const JsonNode & json);
|
2024-01-12 17:21:59 +02:00
|
|
|
|
|
|
|
void establishNewConnection();
|
2024-03-11 19:47:35 +02:00
|
|
|
void sendMessage(const NetworkConnectionPtr & targetConnection, const JsonNode & payload);
|
2024-03-29 17:04:52 +02:00
|
|
|
|
2024-04-15 12:34:16 +02:00
|
|
|
JsonNode getHostModList() const;
|
2024-03-29 17:04:52 +02:00
|
|
|
const std::string & getHostAccountID() const;
|
|
|
|
const std::string & getHostAccountCookie() const;
|
|
|
|
const std::string & getHostAccountDisplayName() const;
|
2024-01-12 13:30:53 +02:00
|
|
|
public:
|
2024-03-11 19:47:35 +02:00
|
|
|
void sendChangeRoomDescription(const std::string & description);
|
2024-03-12 20:53:39 +02:00
|
|
|
void sendGameStarted();
|
2024-03-11 19:47:35 +02:00
|
|
|
|
2024-02-03 22:59:56 +02:00
|
|
|
explicit GlobalLobbyProcessor(CVCMIServer & owner);
|
2024-01-12 13:30:53 +02:00
|
|
|
};
|