This commit is contained in:
aozhiwei 2019-04-08 16:52:32 +08:00
parent 59921a6bb4
commit 899a79c08e
4 changed files with 52 additions and 5 deletions

View File

@ -83,6 +83,31 @@ void Human::FillMFObjectFull(cs::MFObjectFull* full_data)
p->set_sdmg(sdmg); p->set_sdmg(sdmg);
} }
void Human::FillMFPlayerStats(cs::MFPlayerStats* stats_pb)
{
stats_pb->set_player_id(entity_uniid);
stats_pb->set_player_avatar_url(avatar_url);
stats_pb->set_time_alive(dead_frameno * 1000.0f / SERVER_FRAME_RATE);
stats_pb->set_kills(stats.kills);
stats_pb->set_damage_amount(stats.damage_amount);
stats_pb->set_heal_amount(stats.heal_amount);
stats_pb->set_history_time_alive(stats.history_time_alive);
stats_pb->set_history_kills(stats.history_kills);
stats_pb->set_history_damage_amount(stats.history_damage_amount);
stats_pb->set_history_heal_amount(stats.history_heal_amount);
stats_pb->set_gold(stats.gold);
stats_pb->set_score(stats.score);
stats_pb->set_dead(dead);
stats_pb->set_killer_id(stats.killer_id);
stats_pb->set_killer_name(stats.killer_name);
stats_pb->set_account_id(account_id);
}
void Human::Shot(Vector2D& target_dir) void Human::Shot(Vector2D& target_dir)
{ {
if (!curr_weapon->meta) { if (!curr_weapon->meta) {

View File

@ -13,12 +13,32 @@ struct HumanFrameData
{ {
}; };
struct PlayerStats
{
int kills = 0;
int damage_amount = 0;
int heal_amount = 0;
int history_time_alive = 0;
int history_kills = 0;
int history_damage_amount = 0;
int history_heal_amount = 0;
int gold = 0;
int score = 0;
int killer_id = 0;
std::string killer_name;
};
class CircleCollider; class CircleCollider;
class Obstacle; class Obstacle;
class Human : public Entity class Human : public Entity
{ {
public: public:
int team_id = 0; int team_id = 0;
std::string account_id;
std::string team_uniid; std::string team_uniid;
MetaData::Player* meta = nullptr; MetaData::Player* meta = nullptr;
MetaData::Equip* helmet_meta = nullptr; MetaData::Equip* helmet_meta = nullptr;
@ -28,6 +48,7 @@ class Human : public Entity
Vector2D attack_dir; Vector2D attack_dir;
std::string name; std::string name;
std::string avatar_url;
float health = 0.0; float health = 0.0;
bool dead = false; bool dead = false;
bool downed = false; bool downed = false;
@ -61,6 +82,7 @@ class Human : public Entity
bool need_sync_active_player = false; bool need_sync_active_player = false;
HumanFrameData frame_data; HumanFrameData frame_data;
PlayerStats stats;
std::set<Entity*> new_objects; std::set<Entity*> new_objects;
std::set<Entity*> part_objects; std::set<Entity*> part_objects;
@ -71,6 +93,7 @@ class Human : public Entity
virtual float GetSpeed() override; virtual float GetSpeed() override;
virtual void FillMFObjectPart(cs::MFObjectPart* part_data) override; virtual void FillMFObjectPart(cs::MFObjectPart* part_data) override;
virtual void FillMFObjectFull(cs::MFObjectFull* full_data) override; virtual void FillMFObjectFull(cs::MFObjectFull* full_data) override;
virtual void FillMFPlayerStats(cs::MFPlayerStats* stats);
void Shot(Vector2D& target_dir); void Shot(Vector2D& target_dir);
void RecalcSelfCollider(); void RecalcSelfCollider();
bool IsCollision(); bool IsCollision();

View File

@ -23,12 +23,10 @@ class Player : public Human
public: public:
int socket_handle = 0; int socket_handle = 0;
std::string account_id;
int team_mode = 0; int team_mode = 0;
int player_count = 0; int player_count = 0;
bool auto_fill = false; bool auto_fill = false;
bool use_touch = false; bool use_touch = false;
std::string avatar_url;
int last_seq_id = 0; int last_seq_id = 0;
bool moving = false; bool moving = false;

View File

@ -478,12 +478,12 @@ message MFPlayerStats
optional string player_avatar_url = 2; // optional string player_avatar_url = 2; //
// //
optional int32 time_alive = 3; // optional int32 time_alive = 3; //()
optional int32 kills = 4; // optional int32 kills = 4; //
optional int32 damage_amount = 8; // optional int32 damage_amount = 8; //
optional int32 heal_amount = 20; // optional int32 heal_amount = 20; //
// //
optional int32 history_time_alive = 30; // optional int32 history_time_alive = 30; //()
optional int32 history_kills = 31; // optional int32 history_kills = 31; //
optional int32 history_damage_amount = 32; // optional int32 history_damage_amount = 32; //
optional int32 history_heal_amount = 33; // optional int32 history_heal_amount = 33; //
@ -491,8 +491,9 @@ message MFPlayerStats
optional int32 gold = 10; // optional int32 gold = 10; //
optional int32 score = 11; // optional int32 score = 11; //
optional int32 dead = 5; // optional bool dead = 5; //
optional int32 killer_id = 7; //id() optional int32 killer_id = 7; //id()
optional string killer_name = 40; //
optional string account_id = 21; //id optional string account_id = 21; //id
} }