Compare commits

..

1 Commits
hw ... master

Author SHA1 Message Date
aozhiwei
d94635c78c 修复点射问题 2020-11-30 13:46:58 +08:00
8 changed files with 26 additions and 45 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -42,7 +42,7 @@ class MetaMgr : public a8::Singleton<MetaMgr>
int GetKillPointParam2(int kill_num); int GetKillPointParam2(int kill_num);
std::vector<MetaData::Robot>* GetRobotList(); std::vector<MetaData::Robot>* GetRobotList();
MetaData::Robot* GetRobot(int robot_id); 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 gas_inactive_time = 10;
int jump_time = 10; int jump_time = 10;

View File

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

View File

@ -867,8 +867,13 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
if (moving) { if (moving) {
moved_frames = 0; moved_frames = 0;
} }
//前一个状态是纯点射
if (shot_start && !shot_hold) {
} else {
shot_start = msg.shot_start(); shot_start = msg.shot_start();
shot_hold = msg.shot_hold(); shot_hold = msg.shot_hold();
}
fly_distance = std::min(200.0f, msg.fly_distance()); fly_distance = std::min(200.0f, msg.fly_distance());
if (!shot_hold) { if (!shot_hold) {
series_shot_frames = 0; series_shot_frames = 0;
@ -937,7 +942,7 @@ void Player::_CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg)
need_sync_active_player = true; need_sync_active_player = true;
cs::SMReconnect respmsg; cs::SMReconnect respmsg;
respmsg.set_errcode(0); respmsg.set_errcode(0);
respmsg.set_errmsg(MetaMgr::Instance()->GetText("battle_server_reconnect_ok")); //"战斗重连成功" respmsg.set_errmsg("战斗重连成功");
SendNotifyMsg(respmsg); SendNotifyMsg(respmsg);
PlayerMgr::Instance()->ReBindSocket(this); PlayerMgr::Instance()->ReBindSocket(this);
a8::UdpLog::Instance()->Debug a8::UdpLog::Instance()->Debug

View File

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