Pollinator::cAchievementsManager class

Manages the achievements of the game.

This manager listens to the App::IMessageManager::kMsgCheatInvoked message, and will disable achievements when it receives the message, as you will be considered a cheater. Example code: AchievementsManager.AddProgress(id("ADV-MyHero"), 20);

Base classes

class App::IUnmanagedMessageListener
Same as App::IMessageListener, but this one does not use ref-counting.

Public types

enum Messages { kMsgSaveAchievements = 0x212D3E7 }

Public static functions

static auto Get() -> cAchievementsManager*

Public functions

auto Init() -> bool
auto GetAchievementDefinition(uint32_t achievementID) -> cAchievementDefinition*
auto EvaluateTriggerOp(uint32_t achievementID) -> bool
Evaluates whether the current achievement progress exceeds the trigger, which means the achievement should be earned.
auto AddProgress(uint32_t achievementID, int deltaProgress) -> void
Increases or decreases the progress of an achievement.
auto SetProgressFlags(uint32_t achievementID, int progressFlags, bool value) -> void
Treats the progress as flags, and enables or disables some of them.
auto EarnAchievement(uint32_t achievementID) -> bool
Earns an achievement.

Public variables

int mpAchievementNotifierUI
cSPAchievementSerializerPtr mpSerializer
eastl::vector_map<uint32_t, cAchievementDefinition> mAchievements
bool mIsCheater
If true, achievements are disabled.
cSPAchievementSerializer::CrossGameData mCrossGameData

Function documentation

bool Pollinator::cAchievementsManager::EvaluateTriggerOp(uint32_t achievementID)

Evaluates whether the current achievement progress exceeds the trigger, which means the achievement should be earned.

Parameters
achievementID

void Pollinator::cAchievementsManager::AddProgress(uint32_t achievementID, int deltaProgress)

Increases or decreases the progress of an achievement.

Parameters
achievementID
deltaProgress

If the achievement is automatic, this will call EvaluateTriggerOp() afterwards, and earn the achievement if it returns true.

void Pollinator::cAchievementsManager::SetProgressFlags(uint32_t achievementID, int progressFlags, bool value)

Treats the progress as flags, and enables or disables some of them.

Parameters
achievementID
progressFlags
value

If the achievement is automatic, this will call EvaluateTriggerOp() afterwards, and earn the achievement if it returns true.

bool Pollinator::cAchievementsManager::EarnAchievement(uint32_t achievementID)

Earns an achievement.

Parameters
achievementID
Returns True if it was earned successfully