From f3e54250fd1c8d9127f45f5ae894f528210d9410 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 13 May 2019 17:08:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=95=91=E6=8F=B4=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/gameserver/constant.h | 1 + server/gameserver/human.cc | 11 +++-------- server/gameserver/human.h | 2 -- server/gameserver/player.cc | 16 +++++++++++++--- server/tools/protobuild/cs_proto.proto | 6 ++---- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/server/gameserver/constant.h b/server/gameserver/constant.h index 21e8a78..cca524d 100755 --- a/server/gameserver/constant.h +++ b/server/gameserver/constant.h @@ -64,6 +64,7 @@ enum ActionType_e AT_Reload = 1, AT_UseItem = 2, AT_Relive = 3, + AT_Rescue = 4 }; enum InventorySlot_e diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 9234c03..8f376b1 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -425,8 +425,9 @@ void Human::CancelAction() Entity* entity = room->GetEntityByUniId(action_target_id); if (entity->entity_type != ET_Player) { Human* hum = (Human*)entity; - a8::UnSetBitFlag(hum->status, HS_Rescue); - hum->SyncAroundPlayers(); + if (hum->action_type == AT_Rescue) { + hum->CancelAction(); + } } } ResetAction(); @@ -1286,12 +1287,6 @@ void Human::FillBodyState(::google::protobuf::RepeatedPtrField<::cs::MFBodyState state->set_left_time(std::max(0, skill_meta->i->last_time() * 1000 - passed_time)); state->set_lasting_time(skill_meta->i->last_time() * 1000); } - if (a8::HasBitFlag(status, HS_Rescue)) { - cs::MFBodyState* state = states->Add(); - state->set_state_type(HS_Rescue); - state->set_left_time(0); - state->set_lasting_time(0); - } } void Human::SummonHero() diff --git a/server/gameserver/human.h b/server/gameserver/human.h index a740539..3a86507 100644 --- a/server/gameserver/human.h +++ b/server/gameserver/human.h @@ -24,7 +24,6 @@ enum HumanStatus HS_RecoverHP = 8, HS_ReflectDamage = 9, HS_SummonHero = 10, - HS_Rescue = 20, HS_End }; @@ -75,7 +74,6 @@ class Human : public Entity long long dead_frameno = 0; long long join_frameno = 0; int status = 0; - long long rescue_frameno = 0; Weapon default_weapon; std::vector weapons; diff --git a/server/gameserver/player.cc b/server/gameserver/player.cc index b5322b5..5fc551e 100644 --- a/server/gameserver/player.cc +++ b/server/gameserver/player.cc @@ -301,7 +301,10 @@ void Player::UpdateAction() return; } Human* hum = (Human*)entity; - a8::UnSetBitFlag(hum->status, HS_Rescue); + if (hum->action_type == AT_Rescue) { + hum->CancelAction(); + return; + } if (!hum->dead && hum->downed) { hum->health = MetaMgr::Instance()->GetSysParamAsInt("downed_relive_recover_hp"); hum->downed = false; @@ -783,8 +786,15 @@ void Player::HumanInteraction(Human* hum) if (!hum->downed) { return; } - a8::SetBitFlag(hum->status, HS_Rescue); - hum->rescue_frameno = room->frame_no; + if (hum->action_type == AT_Rescue) { + return; + } + hum->StartAction( + AT_Rescue, + MetaMgr::Instance()->GetSysParamAsInt("rescue_time") * 1000, + room->frame_no, + entity_uniid + ); StartAction( AT_Relive, MetaMgr::Instance()->GetSysParamAsInt("downed_relive_time") * 1000, diff --git a/server/tools/protobuild/cs_proto.proto b/server/tools/protobuild/cs_proto.proto index 0ae1386..81b6160 100755 --- a/server/tools/protobuild/cs_proto.proto +++ b/server/tools/protobuild/cs_proto.proto @@ -147,7 +147,7 @@ message MFPlayerFull optional bool disconnected = 9; //是否断网 optional int32 anim_type = 10; // optional int32 anim_seq = 11; // - //optional int32 action_type = 12; //0: none 1:reload 2:useitem 3:relive + //optional int32 action_type = 12; //0: none 1:reload 2:useitem 3:relive 4: rescue //optional int32 action_duration = 22; //持续时间毫秒 optional int32 skin = 13; //皮肤id optional int32 backpack = 14; //背包 @@ -374,7 +374,7 @@ message MFObjectFull //活跃玩家数据(当前) message MFActivePlayerData { - optional int32 action_type = 3; //0: none 1:reload 2:useitem 3:relive + optional int32 action_type = 3; //0: none 1:reload 2:useitem 3:relive 4: rescue optional int32 action_duration = 5; //持续时间毫秒 optional int32 action_item_id = 6; optional int32 action_target_id = 7; @@ -554,8 +554,6 @@ message MFBodyState 8: 回血 9: 反伤 10: 分身 - - 20: 救援中 */ optional int32 state_type = 1; optional float left_time = 2; //剩余时间(单位毫秒)