Compare commits

...

4 Commits
master ... hw

Author SHA1 Message Date
aozhiwei
535f563c84 1 2020-09-18 12:08:18 +08:00
aozhiwei
3ba9443d8d 添加channel处理 2020-09-14 16:44:27 +08:00
aozhiwei
f209166cca 1 2020-09-14 16:33:45 +08:00
aozhiwei
0a632684a0 1 2020-09-14 15:08:43 +08:00
8 changed files with 43 additions and 19 deletions

View File

@ -575,9 +575,15 @@ void Human::UpdatePoisoning()
bool need_notify = poisoning_time > 1000;
while (poisoning_time > 1000) {
if (room->gas_data.is_last_gas) {
DecHP(room->gas_data.new_area_meta->i->hurt(), VP_SafeArea, "毒圈", VW_SafeArea);
DecHP(room->gas_data.new_area_meta->i->hurt(),
VP_SafeArea,
MetaMgr::Instance()->GetText("battle_server_killer_gas"),
VW_SafeArea);
} else {
DecHP(room->gas_data.old_area_meta->i->hurt(), VP_SafeArea, "毒圈", VW_SafeArea);
DecHP(room->gas_data.old_area_meta->i->hurt(),
VP_SafeArea,
MetaMgr::Instance()->GetText("battle_server_killer_gas"),
VW_SafeArea);
}
if (dead) {
poisoning_time = 0;
@ -732,7 +738,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
Entity* hum = room->GetEntityByUniId(killer_id);
if (hum && hum->entity_type == ET_Player) {
if (killer_id == entity_uniid) {
std::string msg = a8::Format("%s 自杀",
std::string msg = a8::Format(MetaMgr::Instance()->GetText("battle_server_dead_specate").c_str(), //"%s 自杀"
{
killer_name,
});
@ -742,17 +748,17 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
((Human*)hum)->kill_humans.insert(this);
((Human*)hum)->SyncAroundPlayers(__FILE__, __LINE__, __func__);
if (weapon_id == VW_Tank) {
std::string msg = a8::Format("%s 使用 %s 干掉了 %s",
std::string msg = a8::Format(MetaMgr::Instance()->GetText("battle_server_dead_car").c_str(), //"%s 使用 %s 干掉了 %s"
{
killer_name,
"载具",
name
});
SendRollMsg(msg);
} else {
MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(weapon_id);
if (equip_meta) {
std::string msg = a8::Format("%s 使用 %s 干掉了 %s",
//"%s 使用 %s 干掉了 %s"
std::string msg = a8::Format(MetaMgr::Instance()->GetText("battle_server_dead_weapon").c_str(),
{
killer_name,
equip_meta->i->name(),
@ -766,7 +772,8 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
switch (weapon_id) {
case VW_SafeArea:
{
std::string msg = a8::Format("%s 被毒圈干掉",
//"%s 被毒圈干掉"
std::string msg = a8::Format(MetaMgr::Instance()->GetText("battle_server_dead_gas").c_str(),
{
name
});
@ -775,7 +782,8 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
break;
case VW_Spectate:
{
std::string msg = a8::Format("%s 自杀",
//"%s 自杀"
std::string msg = a8::Format(MetaMgr::Instance()->GetText("battle_server_dead_specate").c_str(),
{
name
});
@ -784,7 +792,8 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
break;
case VW_SelfDetonate:
{
std::string msg = a8::Format("%s 被炸死",
//"%s 被炸死"
std::string msg = a8::Format(MetaMgr::Instance()->GetText("battle_server_dead_self_detonate").c_str(),
{
name
});
@ -793,7 +802,8 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
break;
case VW_Mine:
{
std::string msg = a8::Format("%s 被地雷炸死",
//"%s 被地雷炸死"
std::string msg = a8::Format(MetaMgr::Instance()->GetText("battle_server_dead_mine").c_str(),
{
name
});

View File

@ -34,6 +34,9 @@ void JsonDataMgr::Init()
gameserver_cluster_json_.ReadFromFile(gameserver_cluster_json_file);
ip = GetConf()->At("ip")->AsXValue().GetString();
listen_port = GetConf()->At("listen_port")->AsXValue();
if (GetConf()->HasKey("channel")) {
channel = GetConf()->At("channel")->AsXValue();
}
server_info = a8::Format("%s:%d", {ip, listen_port});
Reload();
}

View File

@ -15,6 +15,7 @@ public:
std::string ip;
int listen_port = 0;
int channel = 0;
std::string server_info;
void Reload();

View File

@ -79,18 +79,20 @@ public:
{
if (!f8::IsOnlineEnv()) {
if (f8::IsTestEnv()) {
res_path = a8::Format("/root/pub/%d/%d/conf_test/game%d/gameserver.test/res/",
res_path = a8::Format("/root/pub/%d/%d/conf_test/game%d/gameserver.test/res%d/",
{
GAME_ID,
App::Instance()->instance_id,
GAME_ID
GAME_ID,
App::Instance()->instance_id
});
} else {
res_path = a8::Format("/root/pub/%d/%d/conf_test/game%d/gameserver.dev/res/",
res_path = a8::Format("/root/pub/%d/%d/conf_test/game%d/gameserver.dev/res%d/",
{
GAME_ID,
App::Instance()->instance_id,
GAME_ID
GAME_ID,
App::Instance()->instance_id
});
}
} else {

View File

@ -42,7 +42,7 @@ class MetaMgr : public a8::Singleton<MetaMgr>
int GetKillPointParam2(int kill_num);
std::vector<MetaData::Robot>* GetRobotList();
MetaData::Robot* GetRobot(int robot_id);
std::string GetText(const std::string& textid, const std::string& def_text);
std::string GetText(const std::string& textid, const std::string& def_text="");
int gas_inactive_time = 10;
int jump_time = 10;

View File

@ -206,7 +206,10 @@ void Obstacle::Explosion(Bullet* bullet)
float dmg = meta->i->damage();
float def = hum->def + hum->buff.def_add;
float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K);
hum->DecHP(finaly_dmg, VP_Mine, "地雷", VW_Mine);
hum->DecHP(finaly_dmg,
VP_Mine,
MetaMgr::Instance()->GetText("battle_server_killer_mine"), //"地雷"
VW_Mine);
}
}
break;

View File

@ -937,7 +937,7 @@ void Player::_CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg)
need_sync_active_player = true;
cs::SMReconnect respmsg;
respmsg.set_errcode(0);
respmsg.set_errmsg("战斗重连成功");
respmsg.set_errmsg(MetaMgr::Instance()->GetText("battle_server_reconnect_ok")); //"战斗重连成功"
SendNotifyMsg(respmsg);
PlayerMgr::Instance()->ReBindSocket(this);
a8::UdpLog::Instance()->Debug

View File

@ -135,7 +135,9 @@ void RoomMgr::_CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg)
Room* room = GetRoomByUuid(a8::XValue(msg.room_uuid()));
if (!room) {
send_reconnect_failed(hdr.socket_handle, 1, "房间已销毁");
send_reconnect_failed(hdr.socket_handle,
1,
MetaMgr::Instance()->GetText("battle_server_reconnect_failreason_room_destoryed")); //"房间已销毁"
a8::UdpLog::Instance()->Debug
("房间已销毁 %s",
{
@ -145,7 +147,9 @@ void RoomMgr::_CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg)
}
Player* hum = room->GetPlayerByAccountId(msg.account_id());
if (!hum) {
send_reconnect_failed(hdr.socket_handle, 1, "accountid未在房间列表");
send_reconnect_failed(hdr.socket_handle,
1,
MetaMgr::Instance()->GetText("battle_server_reconnect_failreason_notfound_accountid")); //"accountid未在房间列表"
return;
}
hum->_CMReconnect(hdr, msg);
@ -257,6 +261,7 @@ void RoomMgr::ReportServerState(int instance_id, const std::string& host, int po
url_params->SetVal("port", JsonDataMgr::Instance()->listen_port);
url_params->SetVal("online_num", PlayerMgr::Instance()->OnlineNum());
url_params->SetVal("room_num", RoomNum());
url_params->SetVal("channel", JsonDataMgr::Instance()->channel);
url_params->SetVal("alive_count", App::Instance()->perf.alive_count);
url_params->SetVal("servicing", App::Instance()->servicing ? 1 : 0);
f8::HttpClientPool::Instance()->HttpGet(a8::XParams()