2021-12-05 17:54:36 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
|
2023-07-15 04:43:00 +00:00
|
|
|
#include "RakNetTypes.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
class dServer;
|
2023-07-15 04:43:00 +00:00
|
|
|
using ZoneTransferCallback = std::function<void(bool, uint32_t, uint32_t, uint32_t, std::string, uint16_t)>;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-07-15 04:43:00 +00:00
|
|
|
// The zone request
|
2021-12-05 17:54:36 +00:00
|
|
|
struct ZoneTransferRequest {
|
2023-07-15 04:43:00 +00:00
|
|
|
uint64_t requestID = 0;
|
|
|
|
ZoneTransferCallback callback;
|
2021-12-05 17:54:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//! The zone manager
|
|
|
|
class ZoneInstanceManager {
|
|
|
|
private:
|
2023-07-15 04:43:00 +00:00
|
|
|
std::vector<ZoneTransferRequest> requests; //!< The zone transfer requests
|
2021-12-05 17:54:36 +00:00
|
|
|
uint64_t currentRequestID; //!< The current request ID
|
|
|
|
public:
|
2023-07-15 04:43:00 +00:00
|
|
|
/**
|
|
|
|
* @param zoneID The zone ID
|
|
|
|
* @param zoneClone The zone clone
|
|
|
|
* @param mythranShift Whether or not this is a mythran shift
|
|
|
|
* @param callback The callback function
|
2021-12-05 17:54:36 +00:00
|
|
|
*/
|
2023-07-15 04:43:00 +00:00
|
|
|
void RequestZoneTransfer(dServer* server, uint32_t zoneID, uint32_t zoneClone, bool mythranShift, ZoneTransferCallback callback);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2023-07-15 04:43:00 +00:00
|
|
|
/**
|
|
|
|
* @param requestID The request ID
|
|
|
|
* @param packet The packet
|
2021-12-05 17:54:36 +00:00
|
|
|
*/
|
|
|
|
void HandleRequestZoneTransferResponse(uint64_t requestID, Packet* packet);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
void CreatePrivateZone(dServer* server, uint32_t zoneID, uint32_t zoneClone, const std::string& password);
|
|
|
|
|
2023-07-15 04:43:00 +00:00
|
|
|
void RequestPrivateZone(dServer* server, bool mythranShift, const std::string& password, ZoneTransferCallback callback);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
};
|