mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 23:17:28 +00:00
const and compile save
This commit is contained in:
parent
c572f2a58d
commit
a5e63529dc
@ -200,19 +200,20 @@ void Leaderboard::SetupLeaderboard(uint32_t resultStart, uint32_t resultEnd) {
|
|||||||
|
|
||||||
// If we are getting the friends leaderboard, add the friends query, otherwise fill it in with nothing.
|
// If we are getting the friends leaderboard, add the friends query, otherwise fill it in with nothing.
|
||||||
std::string friendsQuery =
|
std::string friendsQuery =
|
||||||
R"QUERY( AND (
|
R"QUERY(
|
||||||
character_id IN (
|
AND (
|
||||||
SELECT fr.requested_player FROM (
|
character_id IN (
|
||||||
SELECT CASE
|
SELECT fr.requested_player FROM (
|
||||||
WHEN player_id = ? THEN friend_id
|
SELECT CASE
|
||||||
WHEN friend_id = ? THEN player_id
|
WHEN player_id = ? THEN friend_id
|
||||||
END AS requested_player
|
WHEN friend_id = ? THEN player_id
|
||||||
FROM friends
|
END AS requested_player
|
||||||
) AS fr
|
FROM friends
|
||||||
JOIN charinfo AS ci
|
) AS fr
|
||||||
ON ci.id = fr.requested_player
|
JOIN charinfo AS ci
|
||||||
WHERE fr.requested_player IS NOT NULL
|
ON ci.id = fr.requested_player
|
||||||
)
|
WHERE fr.requested_player IS NOT NULL
|
||||||
|
)
|
||||||
OR character_id = ?
|
OR character_id = ?
|
||||||
)
|
)
|
||||||
)QUERY";
|
)QUERY";
|
||||||
@ -378,7 +379,7 @@ Leaderboard::Type LeaderboardManager::GetLeaderboardType(const GameID gameID) {
|
|||||||
if (lookup != leaderboardCache.end()) return lookup->second;
|
if (lookup != leaderboardCache.end()) return lookup->second;
|
||||||
|
|
||||||
auto* activitiesTable = CDClientManager::Instance().GetTable<CDActivitiesTable>();
|
auto* activitiesTable = CDClientManager::Instance().GetTable<CDActivitiesTable>();
|
||||||
std::vector<CDActivities> activities = activitiesTable->Query([=](const CDActivities& entry) {
|
std::vector<CDActivities> activities = activitiesTable->Query([gameID](const CDActivities& entry) {
|
||||||
return entry.ActivityID == gameID;
|
return entry.ActivityID == gameID;
|
||||||
});
|
});
|
||||||
auto type = !activities.empty() ? static_cast<Leaderboard::Type>(activities.at(0).leaderboardType) : Leaderboard::Type::None;
|
auto type = !activities.empty() ? static_cast<Leaderboard::Type>(activities.at(0).leaderboardType) : Leaderboard::Type::None;
|
||||||
|
@ -102,9 +102,6 @@ public:
|
|||||||
// Helper function to get the columns, ordering and insert format for a leaderboard
|
// Helper function to get the columns, ordering and insert format for a leaderboard
|
||||||
static const std::string_view GetOrdering(Type leaderboardType);
|
static const std::string_view GetOrdering(Type leaderboardType);
|
||||||
private:
|
private:
|
||||||
// Returns true if the string needs formatting
|
|
||||||
bool GetRankingQuery(std::string& lookupReturn) const;
|
|
||||||
|
|
||||||
// Takes the resulting query from a leaderboard lookup and converts it to the LDF we need
|
// Takes the resulting query from a leaderboard lookup and converts it to the LDF we need
|
||||||
// to send it to a client.
|
// to send it to a client.
|
||||||
void QueryToLdf(std::unique_ptr<sql::ResultSet>& rows);
|
void QueryToLdf(std::unique_ptr<sql::ResultSet>& rows);
|
||||||
@ -123,12 +120,10 @@ private:
|
|||||||
namespace LeaderboardManager {
|
namespace LeaderboardManager {
|
||||||
|
|
||||||
using LeaderboardCache = std::map<GameID, Leaderboard::Type>;
|
using LeaderboardCache = std::map<GameID, Leaderboard::Type>;
|
||||||
void SendLeaderboard(GameID gameID, Leaderboard::InfoType infoType, bool weekly, LWOOBJID playerID, LWOOBJID targetID, uint32_t resultStart = 0, uint32_t resultEnd = 10);
|
void SendLeaderboard(const GameID gameID, const Leaderboard::InfoType infoType, const bool weekly, const LWOOBJID playerID, const LWOOBJID targetID, const uint32_t resultStart = 0, const uint32_t resultEnd = 10);
|
||||||
|
|
||||||
void SaveScore(const LWOOBJID& playerID, const GameID gameID, const Leaderboard::Type leaderboardType, const float primaryScore, const float secondaryScore = 0, const float tertiaryScore = 0);
|
void SaveScore(const LWOOBJID& playerID, const GameID gameID, const Leaderboard::Type leaderboardType, const float primaryScore, const float secondaryScore = 0, const float tertiaryScore = 0);
|
||||||
|
|
||||||
void GetLeaderboard(const uint32_t gameID, const Leaderboard::InfoType infoType, const bool weekly, const LWOOBJID playerID = LWOOBJID_EMPTY);
|
|
||||||
|
|
||||||
Leaderboard::Type GetLeaderboardType(const GameID gameID);
|
Leaderboard::Type GetLeaderboardType(const GameID gameID);
|
||||||
extern LeaderboardCache leaderboardCache;
|
extern LeaderboardCache leaderboardCache;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user