DarkflameServer/dNet/ZoneInstanceManager.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1.2 KiB
C
Raw Permalink Normal View History

#pragma once
#include <functional>
#include <vector>
#include <string>
2023-07-15 04:43:00 +00:00
#include "RakNetTypes.h"
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)>;
2023-07-15 04:43:00 +00:00
// The zone request
struct ZoneTransferRequest {
2023-07-15 04:43:00 +00:00
uint64_t requestID = 0;
ZoneTransferCallback callback;
};
//! The zone manager
class ZoneInstanceManager {
private:
2023-07-15 04:43:00 +00:00
std::vector<ZoneTransferRequest> requests; //!< The zone transfer requests
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
*/
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
*/
void HandleRequestZoneTransferResponse(uint64_t requestID, Packet* packet);
2022-07-28 13:39:57 +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);
};