Files
DarkflameServer/dDatabase/GameDatabase/ITables/IPlayKeys.h
Aaron Kimbrell e213a7aeff feat: web dashboard and playground work
The NexusDashboard-parity dashboard (dDashboardServer) and everything built on it on the experimental branch:
accounts, characters, properties and moderation tools, permissions shared with in-game slash commands, economy
reports, World 3D and property 3D views with client scenery, scheduled events (features, vanity changes, live
events, announcements, restarts), vanity files and events, the CDClient browser, the message inspector with saved
captures, chat filter tools, community challenges, live ops, the AI moderator helper, and the server-side changes
they need.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 22:30:43 -05:00

43 lines
1.7 KiB
C++

#ifndef __IPLAYKEYS__H__
#define __IPLAYKEYS__H__
#include <cstdint>
#include <optional>
#include <string>
#include <string_view>
#include "json.hpp"
class IPlayKeys {
public:
// Get the playkey id for the given playkey.
// Optional of bool may seem pointless, however the optional indicates if the playkey exists
// and the bool indicates if the playkey is active.
virtual std::optional<bool> IsPlaykeyActive(const int32_t playkeyId) = 0;
// Get paginated list of play keys with optional search/filtering for DataTables
// Returns a JSON-formatted string with the play key data and metadata
virtual std::string GetPlayKeysTable(uint32_t start, uint32_t length, const std::string_view search = "", uint32_t orderColumn = 0, bool orderAsc = true) = 0;
virtual uint32_t GetPlayKeyCount() = 0;
virtual void CreatePlayKey(const std::string_view keyString, const uint32_t uses, const std::string_view notes = "") = 0;
virtual void SetPlayKeyActive(const int32_t playkeyId, const bool active) = 0;
// Get a single play key including the accounts that registered with it, or {"error": ...} if missing
virtual nlohmann::json GetPlayKey(const int32_t playkeyId) = 0;
virtual void UpdatePlayKey(const int32_t playkeyId, const uint32_t uses, const std::string_view notes, const bool active) = 0;
// Delete a play key, detaching any accounts that registered with it
virtual void DeletePlayKey(const int32_t playkeyId) = 0;
// Id of an active play key that still has uses left, for account registration
virtual std::optional<int32_t> GetRedeemablePlayKeyId(const std::string_view keyString) = 0;
virtual void SetAccountPlayKey(const uint32_t accountId, const int32_t playkeyId) = 0;
};
#endif //!__IPLAYKEYS__H__