forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kill_tracker.h
50 lines (40 loc) · 1.46 KB
/
kill_tracker.h
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
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once
#ifndef CATA_SRC_KILL_TRACKER_H
#define CATA_SRC_KILL_TRACKER_H
#include <iosfwd>
#include <map>
#include <vector>
#include "event_subscriber.h"
#include "type_id.h"
class JsonObject;
class JsonOut;
namespace cata
{
class event;
} // namespace cata
class kill_tracker : public event_subscriber
{
/** to keep track of new kills, need to access private member (kills, npc_kills), may include getter for thows and remove frend class diary. */
friend class diary;
public:
kill_tracker() = default;
void reset( const std::map<mtype_id, int> &kills,
const std::vector<std::string> &npc_kills );
/** Returns the number of kills of the given mon_id by the player. */
int kill_count( const mtype_id & ) const;
/** Returns the number of kills of the given monster species by the player. */
int kill_count( const species_id & ) const;
int monster_kill_count() const;
int npc_kill_count() const;
// TEMPORARY until 0.G
int legacy_kill_xp() const;
std::string get_kills_text() const;
void clear();
void notify( const cata::event & ) override;
void serialize( JsonOut & ) const;
void deserialize( const JsonObject &data );
private:
std::map<mtype_id, int> kills; // Player's kill count
std::vector<std::string> npc_kills; // names of NPCs the player killed
};
#endif // CATA_SRC_KILL_TRACKER_H