This commit is contained in:
aozhiwei 2020-11-19 17:05:24 +08:00
parent 9fad4f67b3
commit c9b30c083f
6 changed files with 59 additions and 5 deletions

View File

@ -222,6 +222,9 @@ void Human::FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_data
p->set_max_energy_shield(max_energy_shield);
}
#endif
if (guild_id != 0) {
p->set_guild_id(guild_id);
}
p->set_vip(vip);
p->set_sdmg(sdmg);
p->set_kill_count(stats.kills);
@ -306,6 +309,9 @@ void Human::FillMFPlayerStats(cs::MFPlayerStats* stats_pb)
}
stats_pb->set_account_id(account_id);
if (guild_id != 0) {
stats_pb->set_guild_id(guild_id);
}
for (auto& pair : stats.items) {
auto p = stats_pb->add_items();
@ -378,6 +384,9 @@ void Human::FillMFTeamData(cs::MFTeamData* team_data, bool is_game_over)
team_data->set_user_value1(user_value1);
team_data->set_user_value2(user_value2);
team_data->set_user_value3(user_value3);
if (guild_id != 0) {
team_data->set_guild_id(guild_id);
}
}
}
}
@ -2526,24 +2535,32 @@ void Human::SendBattleReport()
};
std::string url;
if (!f8::IsOnlineEnv()) {
url = "http://game2005api-test.kingsome.cn/webapp/index.php?c=Role&a=battleReport";
if (JsonDataMgr::Instance()->channel != 0) {
url = a8::Format("http://game2005api-test.kingsome.cn/%d/webapp/index.php?c=Role&a=battleReport",
{
JsonDataMgr::Instance()->channel
});
} else {
url = "https://game2005api-test.kingsome.cn/webapp/index.php?c=Role&a=battleReport";
}
} else {
if (JsonDataMgr::Instance()->channel != 0) {
if (kTouTiaoChannelId == JsonDataMgr::Instance()->channel) {
url = a8::Format("http://game2005api-al.kingsome.cn/%d/webapp/index.php?c=Role&a=battleReport",
{
JsonDataMgr::Instance()->channel
});
JsonDataMgr::Instance()->channel
});
} else {
url = a8::Format("http://game2005api.kingsome.cn/%d/webapp/index.php?c=Role&a=battleReport",
{
JsonDataMgr::Instance()->channel
});
JsonDataMgr::Instance()->channel
});
}
} else {
url = "http://game2005api.kingsome.cn/webapp/index.php?c=Role&a=battleReport";
}
}
JsonDataMgr::Instance()->GetBattleReportUrl(url);
std::string data;
params->ToUrlEncodeStr(data);
f8::HttpClientPool::Instance()->HttpGet(

View File

@ -62,6 +62,7 @@ class Human : public MoveableEntity
long long user_value1 = 0;
long long user_value2 = 0;
long long user_value3 = 0;
long long guild_id = 0;
long long last_cmmove_frameno = 0;
bool downed = false;
bool disconnected = false;

View File

@ -24,14 +24,28 @@ void JsonDataMgr::Init()
});
}
}
std::string gameserver_cluster_json_file;
std::string setting_json_file;
gameserver_cluster_json_file = a8::Format("%s/node%d/game%d.gameserver.cluster.json",
{
work_path_,
App::Instance()->node_id,
GAME_ID
});
setting_json_file = a8::Format("%s/game%d.gameserver.setting.json",
{
work_path_,
GAME_ID
});
gameserver_cluster_json_.ReadFromFile(gameserver_cluster_json_file);
setting_json_.ReadFromFile(setting_json_file);
if (setting_json_.GetType() == a8::XOT_OBJECT &&
setting_json_.HasKey("battle_report_url")) {
battle_report_url_ = setting_json_.Get("battle_report_url").GetString();
}
ip = GetConf()->At("ip")->AsXValue().GetString();
listen_port = GetConf()->At("listen_port")->AsXValue();
if (GetConf()->HasKey("channel")) {
@ -39,6 +53,11 @@ void JsonDataMgr::Init()
}
server_info = a8::Format("%s:%d", {ip, listen_port});
Reload();
a8::UdpLog::Instance()->Info("battle_report_url:%s",
{
battle_report_url_
});
}
void JsonDataMgr::UnInit()
@ -72,3 +91,10 @@ void JsonDataMgr::Reload()
});
masterserver_cluster_json_.ReadFromFile(masterserver_cluster_json_file);
}
void JsonDataMgr::GetBattleReportUrl(std::string& url)
{
if (!battle_report_url_.empty()) {
url = battle_report_url_;
}
}

View File

@ -19,9 +19,14 @@ public:
std::string server_info;
void Reload();
void GetBattleReportUrl(std::string& url);
private:
std::string battle_report_url_;
private:
std::string work_path_ = "../config";
a8::XObject setting_json_;
a8::XObject gameserver_cluster_json_;
a8::XObject masterserver_cluster_json_;
};

View File

@ -72,6 +72,7 @@ Player* PlayerMgr::CreatePlayerByCMJoin(Player* hum,
hum->user_value1 = msg.user_value1();
hum->user_value2 = msg.user_value2();
hum->user_value3 = msg.user_value3();
hum->guild_id = msg.guild_id();
#if 0
if (hum->atk_add > 0.9999f) {
hum->atk_add = hum->atk_add / 100.0f;

View File

@ -187,6 +187,7 @@ message MFPlayerFull
optional int32 obj_uniid = 1; //id
optional MFVec2 pos = 2; //
optional MFVec2 dir = 3; //
optional int64 guild_id = 4; //id
optional float max_health = 5; //
optional float health = 6; //
@ -527,6 +528,7 @@ message MFTeamData
optional int64 user_value1 = 31; //user_value1
optional int64 user_value2 = 32; //user_value2
optional int64 user_value3 = 33; //user_value3
optional int64 guild_id = 34; //id
}
//
@ -612,6 +614,7 @@ message MFPlayerStats
optional string killer_account_id = 42; //accountid()
optional string account_id = 21; //id
optional int64 guild_id = 22; //id
}
//
@ -732,6 +735,7 @@ message CMJoin
optional int64 user_value1 = 31; //user_value1
optional int64 user_value2 = 32; //user_value2
optional int64 user_value3 = 33; //user_value3
optional int64 guild_id = 34; //id
optional bool force_entry_newbie_room = 50; //
repeated MFTeamMember team_members = 51; //
optional int32 room_mode = 52; //0: 1: