Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2013-11-07 20:08:05 +0000
committerStijn Buys <ingar@osirion.org>2013-11-07 20:08:05 +0000
commit87d5637c09dca61a650fe81d83ef328943176503 (patch)
tree60b97aa68a593d71b9a5566242da8d7f0676c3ef /src/core
parentcd9ad2786e0e4b0f0448363252d4b010dfe6515c (diff)
Save/load player reputation,
count player NPC and PVP kills.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/player.cc25
-rw-r--r--src/core/player.h34
2 files changed, 53 insertions, 6 deletions
diff --git a/src/core/player.cc b/src/core/player.cc
index e7fb024..eb5f08e 100644
--- a/src/core/player.cc
+++ b/src/core/player.cc
@@ -49,21 +49,24 @@ void Player::clear()
player_admin_level = 0;
player_reputation.clear();
+
+ player_npckills = 0;
+ player_pvpkills = 0;
}
void Player::print() const
{
con_print << "id: ^B" << id() << "^N name: ^B" << name() << "^N" << std::endl;
- con_print << " color ^B" << color() << std::endl;
- con_print << " ping ^B" << ping() << std::endl;
- con_print << " credits ^B" << credits() << std::endl;
- con_print << " level ^B" << level() << std::endl;
-
if (zone()) {
con_print << " zone ^B" << zone()->name() << std::endl;
}
-
+ con_print << " color ^B" << color() << std::endl;
+ con_print << " ping ^B" << ping() << std::endl;
+ con_print << " credits ^B" << credits() << std::endl;
+ con_print << " level ^B" << level() << std::endl;
+ con_print << " npc kills ^B" << npckills() << std::endl;
+ con_print << " pvp kills ^B" << pvpkills() << std::endl;
}
void Player::message(Message::Channel channel, const std::string text)
@@ -142,7 +145,17 @@ void Player::set_admin_level(const int admin_level)
{
player_admin_level = admin_level;
}
+
+void Player::set_npckills(const long kills)
+{
+ player_npckills = kills;
+}
+void Player::set_pvpkills(const long kills)
+{
+ player_pvpkills = kills;
+}
+
void Player::update_info()
{
Cvar *cl_name = Cvar::find("cl_name");
diff --git a/src/core/player.h b/src/core/player.h
index 91d66c5..8b60eee 100644
--- a/src/core/player.h
+++ b/src/core/player.h
@@ -157,6 +157,22 @@ public:
return player_reputation.reputation(faction);
}
+ /**
+ * @brief number of NPCs the player killed
+ * */
+ inline const long npckills() const
+ {
+ return player_npckills;
+ }
+
+ /**
+ * @brief number of other players the player killed
+ * */
+ inline const long pvpkills() const
+ {
+ return player_pvpkills;
+ }
+
/*----- server-side mesage functions ------------------------------ */
/// send a message to the player on one of the message channels
@@ -250,6 +266,16 @@ public:
inline void set_zonechange(const bool dirty = true) {
player_zonechange = dirty;
}
+
+ /**
+ * @brief set the number of NPCs the player killed
+ * */
+ void set_npckills(const long kills);
+
+ /**
+ * @brief set the number of other players the player killed
+ * */
+ void set_pvpkills(const long kills);
/* -- should actually not be public --*/
@@ -305,6 +331,14 @@ private:
float player_warningtime;
Reputation player_reputation;
+
+ long player_npckills;
+
+ long player_pvpkills;
+
+ unsigned long player_time_previously_wasted;
+
+ unsigned long player_time_last_joined;
};