2525
2626class InventorySystem ;
2727class SkillSystem ;
28- class QuestSystem ;
2928
3029struct PlayerAttributes {
3130 int strength = 10 ; // Physical power
@@ -159,6 +158,10 @@ class Player : public GameEntity {
159158 const std::string& GetUsername () const { return username_; }
160159
161160 void UpdatePosition (float x, float y, float z);
161+ void UpdateHeartbeat ();
162+ bool IsHeartbeatExpired (int timeoutSeconds) const ;
163+ void ApplyDamage (int damage, int64_t attackerId);
164+ void ApplyHealing (int amount, int64_t healerId);
162165
163166 // Player-specific properties
164167 void SetPlayerClass (PlayerClass player_class) { player_class_ = player_class; }
@@ -271,7 +274,7 @@ class Player : public GameEntity {
271274 // Player systems access
272275 InventorySystem& GetInventorySystem () const { return inventory_system_; }
273276 SkillSystem& GetSkillSystem () const { return skill_system_; }
274- QuestSystem& GetQuestSystem () const { return quest_system_ ; }
277+ QuestManager& GetQuestManager () const { return quest_manager_ ; }
275278
276279 // Utility methods
277280 bool IsAlive () const { return stats_.health > 0 ; }
@@ -298,6 +301,10 @@ class Player : public GameEntity {
298301
299302 void SetCosmetic (const std::string& slot, const std::string& cosmetic_id);
300303 std::string GetCosmetic (const std::string& slot) const ;
304+ float GetDistanceTo (const glm::vec3& other) const ;
305+ void AddCurrencyGold (int amount);
306+ void AddCurrencyGems (int amount);
307+ void SetOnline (bool online);
301308
302309 // Player session
303310 void SetSessionId (uint64_t session_id) { session_id_ = session_id; }
@@ -310,13 +317,20 @@ class Player : public GameEntity {
310317 virtual nlohmann::json Serialize () const override ;
311318 virtual void Deserialize (const nlohmann::json& data) override ;
312319 nlohmann::json JsonGetInventory () const ;
320+ nlohmann::json ToJson () const ;
313321
314322private:
315323 int64_t id_;
316324 std::string username_;
317325
318326 // struct Position {float x, y, z;} position_;
319- // nlohmann::json attributes_;
327+ std::chrono::system_clock::time_point last_movement_;
328+
329+ bool online_ = false ;
330+ std::chrono::system_clock::time_point created_at_;
331+ std::chrono::system_clock::time_point last_login_;
332+ std::chrono::system_clock::time_point last_logout_;
333+ std::chrono::system_clock::time_point last_heartbeat_;
320334
321335 mutable std::shared_mutex mutex_;
322336
@@ -341,7 +355,7 @@ class Player : public GameEntity {
341355 nlohmann::json buff_data;
342356 float duration;
343357 float time_remaining;
344- std::chrono::steady_clock ::time_point applied_time;
358+ std::chrono::system_clock ::time_point applied_time;
345359 };
346360 std::unordered_map<std::string, ActiveBuff> active_buffs_;
347361
@@ -350,7 +364,7 @@ class Player : public GameEntity {
350364 std::string ability_id;
351365 float duration;
352366 float time_remaining;
353- std::chrono::steady_clock ::time_point start_time;
367+ std::chrono::system_clock ::time_point start_time;
354368 };
355369 std::unordered_map<std::string, Cooldown> cooldowns_;
356370
@@ -377,7 +391,7 @@ class Player : public GameEntity {
377391 // Systems
378392 InventorySystem& inventory_system_;
379393 SkillSystem& skill_system_;
380- QuestSystem& quest_system_ ;
394+ QuestManager& quest_manager_ ;
381395
382396 // Private methods
383397 void OnLevelUp ();
@@ -404,14 +418,14 @@ class Player : public GameEntity {
404418 struct DamageSource {
405419 uint64_t attacker_id;
406420 int damage;
407- std::chrono::steady_clock ::time_point timestamp;
421+ std::chrono::system_clock ::time_point timestamp;
408422 };
409423 std::deque<DamageSource> damage_sources_;
410424
411425 struct HealingSource {
412426 uint64_t healer_id;
413427 int healing;
414- std::chrono::steady_clock ::time_point timestamp;
428+ std::chrono::system_clock ::time_point timestamp;
415429 };
416430 std::deque<HealingSource> healing_sources_;
417431
0 commit comments