mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-11 01:48:07 +00:00

* feat: convert character ids to 64 bits remove all usages of the PERSISTENT bit with regards to storing of playerIDs on the server. the bit does not exist and was a phantom in the first place. Tested that a full playthrough of ag, ns and gf was still doable. slash commands work, ugc works, friends works, ignore list works, properties work and have names, teaming works. migrating an old mysql database works . need to test an old sqlite database * fix sqlite migration * remove nd specific column migration
49 lines
1.6 KiB
C++
49 lines
1.6 KiB
C++
#ifndef __ILEADERBOARD__H__
|
|
#define __ILEADERBOARD__H__
|
|
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <vector>
|
|
#include "dCommonVars.h"
|
|
|
|
class ILeaderboard {
|
|
public:
|
|
|
|
struct Entry {
|
|
LWOOBJID charId{};
|
|
uint32_t lastPlayedTimestamp{};
|
|
float primaryScore{};
|
|
float secondaryScore{};
|
|
float tertiaryScore{};
|
|
uint32_t numWins{};
|
|
uint32_t numTimesPlayed{};
|
|
uint32_t ranking{};
|
|
std::string name{};
|
|
};
|
|
|
|
struct Score {
|
|
auto operator<=>(const Score& rhs) const = default;
|
|
|
|
float primaryScore{ 0.0f };
|
|
float secondaryScore{ 0.0f };
|
|
float tertiaryScore{ 0.0f };
|
|
};
|
|
|
|
// Get the donation total for the given activity id.
|
|
virtual std::optional<uint32_t> GetDonationTotal(const uint32_t activityId) = 0;
|
|
|
|
virtual std::vector<ILeaderboard::Entry> GetDescendingLeaderboard(const uint32_t activityId) = 0;
|
|
virtual std::vector<ILeaderboard::Entry> GetAscendingLeaderboard(const uint32_t activityId) = 0;
|
|
virtual std::vector<ILeaderboard::Entry> GetNsLeaderboard(const uint32_t activityId) = 0;
|
|
virtual std::vector<ILeaderboard::Entry> GetAgsLeaderboard(const uint32_t activityId) = 0;
|
|
virtual std::optional<Score> GetPlayerScore(const LWOOBJID playerId, const uint32_t gameId) = 0;
|
|
|
|
virtual void SaveScore(const LWOOBJID playerId, const uint32_t gameId, const Score& score) = 0;
|
|
virtual void UpdateScore(const LWOOBJID playerId, const uint32_t gameId, const Score& score) = 0;
|
|
virtual void IncrementNumWins(const LWOOBJID playerId, const uint32_t gameId) = 0;
|
|
virtual void IncrementTimesPlayed(const LWOOBJID playerId, const uint32_t gameId) = 0;
|
|
};
|
|
|
|
#endif //!__ILEADERBOARD__H__
|