1
This commit is contained in:
commit
ce3242cc9d
@ -82,6 +82,8 @@ void GameLog::GameEnd(Player* hum)
|
||||
} else {
|
||||
prop->SetVal("alive_time", hum->dead_frameno * 1000.0f / SERVER_FRAME_RATE);
|
||||
}
|
||||
prop->SetVal("gameover_pass_frame_num", hum->room->GetFrameNo() - hum->last_cmmove_frameno);
|
||||
prop->SetVal("socket_handle", hum->socket_handle);
|
||||
|
||||
f8::TGLog::Instance()->AddTrackLog(game_id, hum->account_id, hum->ip_saddr, logclass1, logclass2, prop);
|
||||
|
||||
|
@ -59,6 +59,7 @@ class Human : public MoveableEntity
|
||||
long long user_value1 = 0;
|
||||
long long user_value2 = 0;
|
||||
long long user_value3 = 0;
|
||||
long long last_cmmove_frameno = 0;
|
||||
bool downed = false;
|
||||
bool disconnected = false;
|
||||
int anim_type = 0;
|
||||
|
@ -135,7 +135,9 @@ public:
|
||||
{
|
||||
MetaMgr::Instance()->gas_inactive_time = MetaMgr::Instance()->GetSysParamAsInt("gas_inactive_time");
|
||||
|
||||
MetaMgr::Instance()->newbie_gas_inactive_time = MetaMgr::Instance()->GetSysParamAsInt("newbie_gas_inactive_time", 10);
|
||||
MetaMgr::Instance()->newbie_gas_inactive_time = MetaMgr::Instance()->GetSysParamAsInt("newbie_gas_inactive_time", 5);
|
||||
MetaMgr::Instance()->midbrid_gas_inactive_time = MetaMgr::Instance()->GetSysParamAsInt("midbrid_gas_inactive_time", 15);
|
||||
MetaMgr::Instance()->common_gas_inactive_time = MetaMgr::Instance()->GetSysParamAsInt("common_gas_inactive_time", 15);
|
||||
MetaMgr::Instance()->newbie_born_point = MetaMgr::Instance()->GetSysParamAsString("newbie_born_point");
|
||||
{
|
||||
std::vector<std::string> strings;
|
||||
|
@ -48,7 +48,9 @@ class MetaMgr : public a8::Singleton<MetaMgr>
|
||||
double GetAiParam(int ai_level, int param_idx);
|
||||
|
||||
int gas_inactive_time = 10;
|
||||
int newbie_gas_inactive_time = 10;
|
||||
int newbie_gas_inactive_time = 5;
|
||||
int midbrid_gas_inactive_time = 15;
|
||||
int common_gas_inactive_time = 15;
|
||||
int jump_time = 10;
|
||||
float K = 100.0f;
|
||||
float kill_param = 0.0f;
|
||||
|
@ -1017,6 +1017,7 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
|
||||
} else {
|
||||
use_skill = false;
|
||||
}
|
||||
last_cmmove_frameno = room->GetFrameNo();
|
||||
}
|
||||
|
||||
void Player::UpdateDropWeapon()
|
||||
|
@ -224,6 +224,14 @@ void Room::ShuaAndroid()
|
||||
int refresh_time = a8::RandEx(MetaMgr::Instance()->refresh_robot_min_time,
|
||||
MetaMgr::Instance()->refresh_robot_max_time);
|
||||
if (robot_num > 0 && refresh_time > 0) {
|
||||
if (IsMiniRoom()) {
|
||||
#if 0
|
||||
robot_num /= 2;
|
||||
robot_num = std::max(1, robot_num);
|
||||
#endif
|
||||
refresh_time /= 2;
|
||||
refresh_time = std::max(2, refresh_time);
|
||||
}
|
||||
CreateAndroid(robot_num);
|
||||
xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * refresh_time,
|
||||
a8::XParams()
|
||||
@ -973,7 +981,7 @@ void Room::UpdateGasMoving()
|
||||
}
|
||||
gas_data_.rad_old = gas_data_.old_area_meta->i->rad();
|
||||
gas_data_.rad_new = gas_data_.new_area_meta->i->rad();
|
||||
if (!MetaMgr::Instance()->GetSafeArea(gas_data_.new_area_meta->i->id() + 1)) {
|
||||
if (!MetaMgr::Instance()->GetSafeArea(gas_data_.new_area_meta->i->id() + 2)) {
|
||||
#if 1
|
||||
//最后一圈
|
||||
if (room_type_ == RT_MidBrid) {
|
||||
@ -1774,7 +1782,13 @@ ObstacleData* Room::GetPermanentObstacleData(int obstacle_uniid)
|
||||
long long Room::GetGasInactiveTime()
|
||||
{
|
||||
if (room_type_ == RT_NewBrid) {
|
||||
return MetaMgr::Instance()->newbie_gas_inactive_time;
|
||||
if (creator_game_times_ <= 0) {
|
||||
return MetaMgr::Instance()->newbie_gas_inactive_time;
|
||||
} else {
|
||||
return MetaMgr::Instance()->common_gas_inactive_time;
|
||||
}
|
||||
} else if (room_type_ == RT_MidBrid) {
|
||||
return MetaMgr::Instance()->midbrid_gas_inactive_time;
|
||||
} else {
|
||||
return MetaMgr::Instance()->gas_inactive_time;
|
||||
}
|
||||
@ -2392,7 +2406,11 @@ a8::Vec2 Room::GetDefaultBornPoint()
|
||||
void Room::AddPlayerPostProc(Player* hum)
|
||||
{
|
||||
if (room_type_ == RT_NewBrid) {
|
||||
CreateAndroid(10 + rand() % 5);
|
||||
if (creator_game_times_ <= 0) {
|
||||
CreateAndroid(10 + rand() % 5);
|
||||
} else {
|
||||
CreateAndroid(2);
|
||||
}
|
||||
xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * (1 + rand() % 3),
|
||||
a8::XParams()
|
||||
.SetSender(hum),
|
||||
@ -2854,12 +2872,14 @@ void Room::ShuaLastGas()
|
||||
|
||||
bool Room::IsMiniRoom()
|
||||
{
|
||||
#if 0
|
||||
if (GetRoomType() == RT_NewBrid ||
|
||||
GetRoomType() == RT_MidBrid) {
|
||||
if (a8::BetweenDays(Global::g_nowtime, creator_register_time_) > 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return
|
||||
GetRoomType() == RT_NewBrid ||
|
||||
|
@ -47,9 +47,31 @@ static RoomType_e GetHumanRoomType(const cs::CMJoin& msg, int& game_times)
|
||||
if (msg.team_uuid().empty()) {
|
||||
return RT_NewBrid;
|
||||
} else {
|
||||
RoomMgr::Instance()->AddProtectTeam(msg.team_uuid());
|
||||
return RT_MidBrid;
|
||||
}
|
||||
}
|
||||
if (!msg.team_uuid().empty()) {
|
||||
if (RoomMgr::Instance()->IsProtectTeam(msg.team_uuid())) {
|
||||
return RT_MidBrid;
|
||||
}
|
||||
bool has_mid_brid = false;
|
||||
bool has_old_brid1 = false;
|
||||
for (auto& team_member : msg.team_members()) {
|
||||
if (team_member.game_times() >= 1 && team_member.game_times() <= 1) {
|
||||
has_mid_brid = true;
|
||||
}
|
||||
if (team_member.game_times() >= 2 && team_member.game_times() <= 2) {
|
||||
has_old_brid1 = true;
|
||||
}
|
||||
}
|
||||
if (has_mid_brid) {
|
||||
return RT_MidBrid;
|
||||
}
|
||||
if (has_old_brid1) {
|
||||
return RT_OldBrid1;
|
||||
}
|
||||
}
|
||||
|
||||
if (game_times <= 0) {
|
||||
return RT_NewBrid;
|
||||
@ -58,13 +80,11 @@ static RoomType_e GetHumanRoomType(const cs::CMJoin& msg, int& game_times)
|
||||
} else {
|
||||
switch (game_times) {
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
{
|
||||
if (msg.team_uuid().empty()) {
|
||||
return RT_NewBrid;
|
||||
} else {
|
||||
return RT_MidBrid;
|
||||
return RT_OldBrid1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -74,21 +94,9 @@ static RoomType_e GetHumanRoomType(const cs::CMJoin& msg, int& game_times)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!msg.team_uuid().empty()) {
|
||||
bool has_mid_brid = false;
|
||||
for (auto& team_member : msg.team_members()) {
|
||||
if (team_member.game_times() >= 1 && team_member.game_times() <= 4) {
|
||||
has_mid_brid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (has_mid_brid) {
|
||||
return RT_MidBrid;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
time_t register_time = f8::ExtractRegisterTimeFromSessionId(msg.session_id());
|
||||
#if 1
|
||||
if (!msg.team_uuid().empty()) {
|
||||
bool has_new_brid = false;
|
||||
for (auto& team_member : msg.team_members()) {
|
||||
@ -113,12 +121,8 @@ static RoomType_e GetHumanRoomType(const cs::CMJoin& msg, int& game_times)
|
||||
#else
|
||||
if (rank >= 0 && rank <= 10) {
|
||||
return RT_OldBrid1;
|
||||
} else if (rank >= 11 && rank <= 17) {
|
||||
return RT_OldBrid2;
|
||||
} else if (rank >= 18) {
|
||||
return RT_OldBrid3;
|
||||
} else {
|
||||
return RT_OldBrid1;
|
||||
return RT_OldBrid2;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -483,3 +487,23 @@ bool RoomMgr::IsGM(const cs::CMJoin& msg)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void RoomMgr::AddProtectTeam(const std::string& team_uuid)
|
||||
{
|
||||
protect_team_hash_[team_uuid] = 1;
|
||||
a8::Timer::Instance()->AddDeadLineTimer
|
||||
(
|
||||
1000 * 30,
|
||||
a8::XParams()
|
||||
.SetSender(team_uuid),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
RoomMgr::Instance()->protect_team_hash_.erase(param.sender.GetString());
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
bool RoomMgr::IsProtectTeam(const std::string& team_uuid)
|
||||
{
|
||||
return protect_team_hash_.find(team_uuid) != protect_team_hash_.end();
|
||||
}
|
||||
|
@ -29,6 +29,8 @@ class RoomMgr : public a8::Singleton<RoomMgr>
|
||||
Room* GetRoomByUuid(long long uuid);
|
||||
void AddOverRoom(long long room_uuid);
|
||||
bool IsGM(const cs::CMJoin& msg);
|
||||
void AddProtectTeam(const std::string& team_uuid);
|
||||
bool IsProtectTeam(const std::string& team_uuid);
|
||||
|
||||
private:
|
||||
void InstallReportStateTimer();
|
||||
@ -54,4 +56,5 @@ class RoomMgr : public a8::Singleton<RoomMgr>
|
||||
std::map<long long, Room*> over_room_hash_;
|
||||
a8::TimerAttacher reportstate_timer_attacher_;
|
||||
std::map<std::string, int> gm_hash_;
|
||||
std::map<std::string, int> protect_team_hash_;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user