20#ifndef HEADER_ACHIEVEMENTS_SLOT_HPP
21#define HEADER_ACHIEVEMENTS_SLOT_HPP
47 enum AchievementData {
58 CONS_WON_RACES_MAX = 5,
60 CONS_WON_RACES_HARD = 6,
61 CONS_WON_RACES_HARD_MAX = 7,
80 THREE_STRIKES_STARTED = 22,
81 THREE_STRIKES_FINISHED = 23,
84 EGG_HUNT_STARTED = 26,
85 EGG_HUNT_FINISHED = 27,
86 WITH_GHOST_STARTED = 28,
87 WITH_GHOST_FINISHED = 29,
95 POWERUP_USED_1RACE = 35,
96 POWERUP_USED_1RACE_MAX = 36,
99 BOWLING_HIT_1RACE = 38,
100 BOWLING_HIT_1RACE_MAX = 39,
103 SWATTER_HIT_1RACE = 41,
104 SWATTER_HIT_1RACE_MAX = 42,
109 ALL_HITS_1RACE_MAX = 45,
113 BANANA_1RACE_MAX = 48,
117 SKIDDING_1RACE_MAX = 51,
119 SKIDDING_1LAP_MAX = 53,
122 ACHIEVE_DATA_NUM = 54
126 std::map<uint32_t, Achievement *> m_achievements;
139 const int DATA_VERSION = 4;
146 std::string m_ach_enum_to_xml[ACHIEVE_DATA_NUM];
157 TR_FINISHED_REVERSE = 3,
159 TR_FINISHED_ALONE = 4,
164 TR_MIN_TWICE_LAPS = 7,
166 TR_EGG_HUNT_STARTED = 8,
167 TR_EGG_HUNT_FINISHED = 9,
178 int track_data[TR_DATA_NUM];
181 std::vector<TrackStats> m_track_stats;
186 std::string m_tr_enum_to_xml[2*TR_DATA_NUM];
193 std::vector<int> m_kart_hits;
200 UP_ACHIEVEMENT_DATA = 0,
209 void updateAchievementsProgress(UpdateType type,
unsigned int enum_id);
218 void sync(
const std::vector<uint32_t> & achieved_ids);
219 void increaseDataVar(
unsigned int achieve_data_id,
int increase);
220 void resetDataVar(
unsigned int achieve_data_id);
221 void onRaceEnd(
bool aborted=
false);
223 void trackEvent(std::string track_ident, AchievementsStatus::TrackData event);
224 void resetKartHits(
int num_karts);
225 void addKartHit(
int kart_id);
226 void updateAllAchievementsProgress();
227 int getNumTracksAboveValue(
int value, std::string goal_string);
228 int getNumAchieveTracks();
230 std::map<uint32_t, Achievement *>& getAllAchievements()
232 return m_achievements;
235 bool isOnline()
const {
return m_online; }
237 bool isValid()
const {
return m_valid; }
Definition: achievement.hpp:42
This class keeps tracks of all achievements of one player.
Definition: achievements_status.hpp:43
AchievementsStatus()
Constructor for an Achievement.
Definition: achievements_status.cpp:44
void load(const XMLNode *input)
Loads the saved state of all achievements from an XML file.
Definition: achievements_status.cpp:175
void save(UTFWriter &out)
Saves the achievement status to a file.
Definition: achievements_status.cpp:295
void sync(const std::vector< uint32_t > &achieved_ids)
Synchronises the achievements between local and online usage.
Definition: achievements_status.cpp:341
void trackEvent(std::string track_ident, AchievementsStatus::TrackData event)
Use the event type to increment the correct track event counter.
Definition: achievements_status.cpp:601
~AchievementsStatus()
Removes all achievements.
Definition: achievements_status.cpp:78
void setEnumToString()
This function loads a table associating an enum identifier with the matching command in achievements....
Definition: achievements_status.cpp:91
utility class used to write wide (UTF-16 or UTF-32, depending of size of wchar_t) XML files
Definition: utf_writer.hpp:35
utility class used to parse XML files
Definition: xml_node.hpp:48
Definition: achievements_status.hpp:135
Definition: achievements_status.hpp:176
Declares the general types that are used by the network.