Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarPlayerCodexes.hpp
blob: 1d0d4dfcf7a5248311365c35479c13ca78ed0ec2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once

#include "StarUuid.hpp"
#include "StarJson.hpp"

namespace Star {

STAR_CLASS(Codex);
STAR_STRUCT(CodexEntry);
STAR_CLASS(UniverseClient);

class PlayerCodexes {
public:
  typedef pair<CodexConstPtr, bool> CodexEntry;

  PlayerCodexes(Json const& json = {});

  Json toJson() const;

  List<CodexEntry> codexes() const;

  bool codexKnown(String const& codexId) const;
  CodexConstPtr learnCodex(String const& codexId, bool markRead = false);

  bool codexRead(String const& codexId) const;
  bool markCodexRead(String const& codexId);
  bool markCodexUnread(String const& codexId);

  void learnInitialCodexes(String const& playerSpecies);

  CodexConstPtr firstNewCodex() const;

private:
  StringMap<CodexEntry> m_codexes;
};

typedef shared_ptr<PlayerCodexes> PlayerCodexesPtr;
}