1
This commit is contained in:
parent
f55fa5996b
commit
8fb3dd1932
@ -256,6 +256,7 @@ enum PropertyType_e
|
||||
kPropLevel = 20,
|
||||
kPropExp = 21,
|
||||
kPropRace = 22,
|
||||
kPropZombieId = 23,
|
||||
};
|
||||
|
||||
enum MapObjectType_e
|
||||
|
@ -281,6 +281,34 @@ void FrameEvent::AddItemChg(Human* hum, int item_id, int item_num)
|
||||
hum->chged_items_.push_back(idx);
|
||||
}
|
||||
|
||||
void FrameEvent::AddLevelChg(Human* hum)
|
||||
{
|
||||
chged_levels_.push_back(hum);
|
||||
int idx = chged_levels_.size() - 1;
|
||||
hum->chged_level_.push_back(idx);
|
||||
}
|
||||
|
||||
void FrameEvent::AddExpChg(Human* hum)
|
||||
{
|
||||
chged_exps_.push_back(hum);
|
||||
int idx = chged_exps_.size() - 1;
|
||||
hum->chged_exp_.push_back(idx);
|
||||
}
|
||||
|
||||
void FrameEvent::AddRaceChg(Human* hum)
|
||||
{
|
||||
chged_races_.push_back(hum);
|
||||
int idx = chged_races_.size() - 1;
|
||||
hum->chged_race_.push_back(idx);
|
||||
}
|
||||
|
||||
void FrameEvent::AddZombieIdChg(Human* hum)
|
||||
{
|
||||
chged_zombieids_.push_back(hum);
|
||||
int idx = chged_zombieids_.size() - 1;
|
||||
hum->chged_zombieid_.push_back(idx);
|
||||
}
|
||||
|
||||
void FrameEvent::Clear()
|
||||
{
|
||||
if (!explosions_.empty()) {
|
||||
@ -328,4 +356,16 @@ void FrameEvent::Clear()
|
||||
if (!chged_weapon_ammo_.empty()) {
|
||||
chged_weapon_ammo_.clear();
|
||||
}
|
||||
if (!chged_levels_.empty()) {
|
||||
chged_levels_.clear();
|
||||
}
|
||||
if (!chged_exps_.empty()) {
|
||||
chged_exps_.clear();
|
||||
}
|
||||
if (!chged_races_.empty()) {
|
||||
chged_races_.clear();
|
||||
}
|
||||
if (!chged_zombieids_.empty()) {
|
||||
chged_zombieids_.clear();
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,10 @@ public:
|
||||
void RemoveBuff(Human* hum, int buff_id);
|
||||
void AddSkillCdChg(Human* hum);
|
||||
void AddItemChg(Human* hum, int item_id, int item_num);
|
||||
void AddLevelChg(Human* hum);
|
||||
void AddExpChg(Human* hum);
|
||||
void AddRaceChg(Human* hum);
|
||||
void AddZombieIdChg(Human* hum);
|
||||
|
||||
void Clear();
|
||||
private:
|
||||
@ -44,6 +48,10 @@ private:
|
||||
std::vector<std::tuple<Human*, int, int>> chged_weapon_ammo_;
|
||||
std::vector<Human*> chged_hps_;
|
||||
std::vector<Human*> chged_skillcds_;
|
||||
std::vector<Human*> chged_levels_;
|
||||
std::vector<Human*> chged_exps_;
|
||||
std::vector<Human*> chged_races_;
|
||||
std::vector<Human*> chged_zombieids_;
|
||||
|
||||
friend class FrameMaker;
|
||||
};
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "human.h"
|
||||
#include "room.h"
|
||||
#include "typeconvert.h"
|
||||
#include "metamgr.h"
|
||||
|
||||
cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
|
||||
{
|
||||
@ -194,6 +195,9 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (room->GetRoomMode() == kZombieMode && room->BattleStarted()) {
|
||||
room->FillObjectPositions((Human*)hum, *msg);
|
||||
}
|
||||
if (room->frame_event.airdrops_.size() > 0) {
|
||||
*msg->mutable_airdrop() = room->frame_event.airdrops_.Get(0);
|
||||
}
|
||||
@ -205,6 +209,16 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
|
||||
room->GetFrameNo() - hum->join_frameno <= 2) {
|
||||
msg->set_alive_count(room->AliveCount());
|
||||
}
|
||||
if (room->GetRoomMode() == kZombieMode) {
|
||||
if (room->BattleStarted()) {
|
||||
int game_left_time = MetaMgr::Instance()->zbmode_game_duration * 1000 -
|
||||
(room->GetFrameNo() - room->GetBattleStartFrameNo()) * FRAME_RATE_MS;
|
||||
game_left_time = std::max(0, game_left_time);
|
||||
msg->set_game_left_time(game_left_time);
|
||||
} else {
|
||||
msg->set_game_left_time(MetaMgr::Instance()->zbmode_game_duration * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
@ -1769,6 +1769,23 @@ void Human::SendWxVoip()
|
||||
SendNotifyMsg(notifymsg);
|
||||
}
|
||||
|
||||
void Human::SendSysPiaoMsg(const std::string& msg, int color, int duration)
|
||||
{
|
||||
cs::SMSysPiaoMsg notifymsg;
|
||||
notifymsg.set_msg(msg);
|
||||
notifymsg.set_color(color);
|
||||
notifymsg.set_duration(duration);
|
||||
SendNotifyMsg(notifymsg);
|
||||
}
|
||||
|
||||
void Human::SendShowCountdown(const std::string& msg, int countdown)
|
||||
{
|
||||
cs::SMShowCountdown notifymsg;
|
||||
notifymsg.set_msg(msg);
|
||||
notifymsg.set_countdown(countdown);
|
||||
SendNotifyMsg(notifymsg);
|
||||
}
|
||||
|
||||
int Human::GetWeaponConfigLv(int weapon_id)
|
||||
{
|
||||
auto itr = weapon_configs.find(weapon_id);
|
||||
@ -1943,6 +1960,18 @@ void Human::ClearFrameData()
|
||||
if (!chged_weapon_ammo_.empty()) {
|
||||
chged_weapon_ammo_.clear();
|
||||
}
|
||||
if (!chged_level_.empty()) {
|
||||
chged_level_.clear();
|
||||
}
|
||||
if (!chged_exp_.empty()) {
|
||||
chged_exp_.clear();
|
||||
}
|
||||
if (!chged_race_.empty()) {
|
||||
chged_race_.clear();
|
||||
}
|
||||
if (!chged_zombieid_.empty()) {
|
||||
chged_zombieid_.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void Human::GenBattleReportData(a8::MutableXObject* params)
|
||||
|
@ -236,6 +236,8 @@ class Human : public MoveableEntity
|
||||
void UpdateAction();
|
||||
void SendUIUpdate();
|
||||
void SendWxVoip();
|
||||
void SendSysPiaoMsg(const std::string& msg, int color, int duration);
|
||||
void SendShowCountdown(const std::string& msg, int countdown);
|
||||
int GetWeaponConfigLv(int weapon_id);
|
||||
int GetSkinConfigLv(int skin_id);
|
||||
void OnDie();
|
||||
@ -352,6 +354,10 @@ protected:
|
||||
std::vector<int> chged_skillcds_;
|
||||
std::vector<int> chged_items_;
|
||||
std::vector<int> chged_weapon_ammo_;
|
||||
std::vector<int> chged_level_;
|
||||
std::vector<int> chged_exp_;
|
||||
std::vector<int> chged_race_;
|
||||
std::vector<int> chged_zombieid_;
|
||||
Human* follow_target_ = nullptr;
|
||||
bool follow_synced_active_player = false;
|
||||
HumanCar car_;
|
||||
|
@ -2905,6 +2905,19 @@ bool Room::IsMiniRoom()
|
||||
#endif
|
||||
}
|
||||
|
||||
void Room::FillObjectPositions(Human* hum, cs::SMUpdate& msg)
|
||||
{
|
||||
for (auto& pair : human_hash_) {
|
||||
if (pair.second != hum) {
|
||||
auto p = msg.add_object_positions();
|
||||
p->set_obj_uniid(pair.second->GetEntityUniId());
|
||||
TypeConvert::ToPb(pair.second->GetPos(), p->mutable_pos());
|
||||
TypeConvert::ToPb(pair.second->attack_dir, p->mutable_dir());
|
||||
p->set_race((int)pair.second->GetRace());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
size_t Room::GetRoomMaxPlayerNum()
|
||||
{
|
||||
if (room_mode_ == kZombieMode) {
|
||||
|
@ -126,6 +126,7 @@ public:
|
||||
int GetCanShuaNum(int shua_num);
|
||||
void AdjustPosInnerMap(a8::Vec2& pos, float radius);
|
||||
bool IsMiniRoom();
|
||||
void FillObjectPositions(Human* hum, cs::SMUpdate& msg);
|
||||
|
||||
private:
|
||||
int AllocUniid();
|
||||
|
@ -124,6 +124,8 @@ message MFVec2
|
||||
valule: 当前经验
|
||||
property_type: 22 阵营
|
||||
valule: 当前阵营
|
||||
property_type: 23 zombieid
|
||||
valule: zombieid
|
||||
*/
|
||||
message MFPropertyChg
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user