移除无用协议
This commit is contained in:
parent
d57f0681f2
commit
0a0f2c8043
@ -101,11 +101,6 @@ void HandlerMgr::RegisterNetMsgHandlers()
|
||||
RegisterNetMsgHandler(&ggmsghandler, &Player::_CMLeave);
|
||||
RegisterNetMsgHandler(&ggmsghandler, &Player::_CMRevive);
|
||||
RegisterNetMsgHandler(&ggmsghandler, &Player::_CMCancelRevive);
|
||||
RegisterNetMsgHandler(&ggmsghandler, &Player::_CMAdStart);
|
||||
RegisterNetMsgHandler(&ggmsghandler, &Player::_CMAdCancel);
|
||||
RegisterNetMsgHandler(&ggmsghandler, &Player::_CMAdEnd);
|
||||
RegisterNetMsgHandler(&ggmsghandler, &Player::_CMGetBoxInfo);
|
||||
RegisterNetMsgHandler(&ggmsghandler, &Player::_CMOpenBox);
|
||||
}
|
||||
|
||||
void HandlerMgr::ProcGMMsg(unsigned long saddr, int sockhandle,
|
||||
|
@ -1881,15 +1881,6 @@ void Human::SendUIUpdate()
|
||||
SendNotifyMsg(notifymsg);
|
||||
}
|
||||
|
||||
void Human::SendWxVoip()
|
||||
{
|
||||
cs::SMWxVoip notifymsg;
|
||||
if (!team_uuid.empty()) {
|
||||
notifymsg.set_group_id(a8::XValue(room->GetRoomUuid()).GetString() + "_" + a8::XValue(team_id).GetString());
|
||||
}
|
||||
SendNotifyMsg(notifymsg);
|
||||
}
|
||||
|
||||
void Human::SendSysPiaoMsg(const std::string& msg, int color, int duration)
|
||||
{
|
||||
cs::SMSysPiaoMsg notifymsg;
|
||||
|
@ -219,7 +219,6 @@ class Human : public Creature
|
||||
std::map<int, int> spoils_items;
|
||||
std::map<int, int> battlein_items;
|
||||
|
||||
xtimer_list* ad_timer_ = nullptr;
|
||||
Human* last_human_target = nullptr;
|
||||
|
||||
int game_times = 0;
|
||||
|
@ -1123,183 +1123,6 @@ void Player::_CMCancelRevive(f8::MsgHdr& hdr, const cs::CMCancelRevive& msg)
|
||||
CancelRevive();
|
||||
}
|
||||
|
||||
void Player::_CMAdStart(f8::MsgHdr& hdr, const cs::CMAdStart& msg)
|
||||
{
|
||||
if (downed || dead) {
|
||||
return;
|
||||
}
|
||||
if (GetBuffByEffectId(kBET_LordMode)) {
|
||||
return;
|
||||
}
|
||||
if (GetBuffByEffectId(kBET_AdPlaying)) {
|
||||
return;
|
||||
}
|
||||
if (a8::HasBitFlag(status, CS_AlreadyLordMode)) {
|
||||
return;
|
||||
}
|
||||
if (ad_timer_) {
|
||||
room->xtimer.DeleteTimer(ad_timer_);
|
||||
ad_timer_ = nullptr;
|
||||
}
|
||||
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(ADPLAY_BUFFID);
|
||||
if (buff_meta) {
|
||||
AddBuff(this, buff_meta, 1);
|
||||
room->xtimer.
|
||||
AddDeadLineTimerAndAttach(
|
||||
buff_meta->i->duration_time() * SERVER_FRAME_RATE + 2,
|
||||
a8::XParams()
|
||||
.SetSender(this),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Player* hum = (Player*)param.sender.GetUserData();
|
||||
hum->InternalAdCancel();
|
||||
},
|
||||
&xtimer_attacher.timer_list_,
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
hum->ad_timer_ = nullptr;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void Player::_CMAdCancel(f8::MsgHdr& hdr, const cs::CMAdCancel& msg)
|
||||
{
|
||||
InternalAdCancel();
|
||||
}
|
||||
|
||||
void Player::_CMAdEnd(f8::MsgHdr& hdr, const cs::CMAdEnd& msg)
|
||||
{
|
||||
if (GetBuffByEffectId(kBET_LordMode)) {
|
||||
return;
|
||||
}
|
||||
InternalAdOk();
|
||||
}
|
||||
|
||||
void Player::_CMGetBoxInfo(f8::MsgHdr& hdr, const cs::CMGetBoxInfo& msg)
|
||||
{
|
||||
cs::SMGetBoxInfo respmsg;
|
||||
respmsg.set_box_id(msg.box_id());
|
||||
std::vector<std::tuple<int, int, int>>* items = GetBox(msg.box_id());
|
||||
if (items) {
|
||||
for (auto& tuple : *items) {
|
||||
auto p = respmsg.add_items();
|
||||
p->add_values(std::get<0>(tuple));
|
||||
p->add_values(std::get<1>(tuple));
|
||||
}
|
||||
}
|
||||
SendNotifyMsg(respmsg);
|
||||
}
|
||||
|
||||
void Player::_CMOpenBox(f8::MsgHdr& hdr, const cs::CMOpenBox& msg)
|
||||
{
|
||||
cs::SMOpenBox respmsg;
|
||||
respmsg.set_box_id(msg.box_id());
|
||||
respmsg.set_errcode(0);
|
||||
if (msg.box_id() == 1) {
|
||||
if (receved_box_hash_.find(msg.box_id()) == receved_box_hash_.end()) {
|
||||
std::vector<std::tuple<int, int, int>>* items = GetBox(msg.box_id());
|
||||
if (items) {
|
||||
for (auto& tuple : *items) {
|
||||
MetaData::Equip* item_meta = MetaMgr::Instance()->GetEquip(std::get<0>(tuple));
|
||||
if (item_meta) {
|
||||
auto p = respmsg.add_items();
|
||||
p->add_values(std::get<0>(tuple));
|
||||
p->add_values(std::get<1>(tuple));
|
||||
if (item_meta->i->_inventory_slot() >= 0 &&
|
||||
item_meta->i->_inventory_slot() < IS_END) {
|
||||
if (GetInventory(item_meta->i->_inventory_slot()) <
|
||||
GetVolume(item_meta->i->_inventory_slot())) {
|
||||
int add_num = GetVolume(item_meta->i->_inventory_slot()) -
|
||||
GetInventory(item_meta->i->_inventory_slot());
|
||||
add_num = std::min(std::get<1>(tuple), add_num);
|
||||
|
||||
AddInventory(item_meta->i->_inventory_slot(), add_num);
|
||||
}
|
||||
} else {
|
||||
switch (item_meta->i->equip_type()) {
|
||||
case 7:
|
||||
{
|
||||
//背包
|
||||
if (backpack == 0) {
|
||||
MetaData::Equip* old_item_meta = MetaMgr::Instance()->GetEquip(backpack);
|
||||
if (old_item_meta) {
|
||||
if (old_item_meta->i->equip_lv() >= item_meta->i->equip_lv()) {
|
||||
break;
|
||||
}
|
||||
room->DropItem(GetPos(), old_item_meta->i->id(), 1, 1);
|
||||
}
|
||||
backpack = item_meta->i->id();
|
||||
RecalcVolume();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
need_sync_active_player = true;
|
||||
}
|
||||
receved_box_hash_.insert(msg.box_id());
|
||||
} else {
|
||||
respmsg.set_errcode(1);
|
||||
respmsg.set_errmsg(TEXT("battle_server_received", "不能重复领取"));
|
||||
}
|
||||
}
|
||||
SendNotifyMsg(respmsg);
|
||||
}
|
||||
|
||||
void Player::InternalAdCancel()
|
||||
{
|
||||
if (GetBuffByEffectId(kBET_AdPlaying)) {
|
||||
RemoveBuffByEffectId(kBET_AdPlaying);
|
||||
if (ad_timer_) {
|
||||
room->xtimer.DeleteTimer(ad_timer_);
|
||||
ad_timer_ = nullptr;
|
||||
}
|
||||
}
|
||||
if (GetBuffByEffectId(kBET_LordMode)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Player::InternalAdOk()
|
||||
{
|
||||
if (a8::HasBitFlag(status, CS_AlreadyLordMode)) {
|
||||
return;
|
||||
}
|
||||
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(ADPLAY_BUFFID);
|
||||
if (buff_meta) {
|
||||
MetaData::Buff* lord_buff_meta = nullptr;
|
||||
if (rand() % 2 < 1) {
|
||||
lord_buff_meta = MetaMgr::Instance()->GetBuff(buff_meta->param1);
|
||||
} else {
|
||||
lord_buff_meta = MetaMgr::Instance()->GetBuff(buff_meta->param2);
|
||||
}
|
||||
if (lord_buff_meta) {
|
||||
a8::SetBitFlag(status, CS_AlreadyLordMode);
|
||||
AddBuff(this, lord_buff_meta, 1);
|
||||
std::vector<std::string> strings;
|
||||
a8::Split(lord_buff_meta->i->buff_param1(), strings, ':');
|
||||
for (auto& str : strings) {
|
||||
int buff_id = a8::XValue(str);
|
||||
MetaData::Buff* ext_buff_meta = MetaMgr::Instance()->GetBuff(buff_id);
|
||||
if (ext_buff_meta) {
|
||||
AddBuff(this, ext_buff_meta, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
RemoveBuffByEffectId(kBET_AdPlaying);
|
||||
if (ad_timer_) {
|
||||
room->xtimer.DeleteTimer(ad_timer_);
|
||||
ad_timer_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void Player::PushJoinRoomMsg()
|
||||
{
|
||||
if (!a8::HasBitFlag(status, CS_ForceTeam)) {
|
||||
@ -1342,31 +1165,6 @@ void Player::ProcPreSettlementInfo(const std::string& pre_settlement_info)
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::tuple<int, int, int>>* Player::GetBox(int box_id)
|
||||
{
|
||||
if (box_id != 1) {
|
||||
return nullptr;
|
||||
}
|
||||
{
|
||||
auto itr = box_hash_.find(box_id);
|
||||
if (itr != box_hash_.end()) {
|
||||
return &itr->second;
|
||||
}
|
||||
}
|
||||
int drop_id = 0;
|
||||
drop_id = MetaMgr::Instance()->prebattle_box_id_chiji;
|
||||
MetaData::Drop* drop_meta = MetaMgr::Instance()->GetDrop(drop_id);
|
||||
if (drop_meta) {
|
||||
std::vector<std::tuple<int, int, int>> drop_items;
|
||||
drop_meta->RandItems(drop_items);
|
||||
box_hash_[box_id] = drop_items;
|
||||
}
|
||||
{
|
||||
auto itr = box_hash_.find(box_id);
|
||||
return itr != box_hash_.end() ? &itr->second : nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void Player::UpdateAiming()
|
||||
{
|
||||
if (aiming) {
|
||||
|
@ -118,11 +118,6 @@ class Player : public Human
|
||||
void _CMLeave(f8::MsgHdr& hdr, const cs::CMLeave& msg);
|
||||
void _CMRevive(f8::MsgHdr& hdr, const cs::CMRevive& msg);
|
||||
void _CMCancelRevive(f8::MsgHdr& hdr, const cs::CMCancelRevive& msg);
|
||||
void _CMAdStart(f8::MsgHdr& hdr, const cs::CMAdStart& msg);
|
||||
void _CMAdCancel(f8::MsgHdr& hdr, const cs::CMAdCancel& msg);
|
||||
void _CMAdEnd(f8::MsgHdr& hdr, const cs::CMAdEnd& msg);
|
||||
void _CMGetBoxInfo(f8::MsgHdr& hdr, const cs::CMGetBoxInfo& msg);
|
||||
void _CMOpenBox(f8::MsgHdr& hdr, const cs::CMOpenBox& msg);
|
||||
virtual void SetAttackDir(const a8::Vec2& attack_dir) override;
|
||||
void AsyncRequestWatchWar(bool send_rsp_msg);
|
||||
|
||||
@ -130,15 +125,11 @@ protected:
|
||||
Player();
|
||||
|
||||
private:
|
||||
void InternalAdCancel();
|
||||
void InternalAdOk();
|
||||
void InternalUpdate(int delta_time);
|
||||
std::vector<std::tuple<int, int, int>>* GetBox(int box_id);
|
||||
void CheckShotHoldState(Weapon* weapon);
|
||||
|
||||
private:
|
||||
std::map<int, std::vector<std::tuple<int, int, int>>> box_hash_;
|
||||
std::set<int> receved_box_hash_;
|
||||
long long last_cmmove_frameno_ = 0;
|
||||
xtimer_list* watch_war_req_timer_ = nullptr;
|
||||
|
||||
|
@ -1274,7 +1274,6 @@ void Room::UpdateGasInactivePvp()
|
||||
ClearPostBattleAutoFreeList();
|
||||
OnBattleStart();
|
||||
ShuaPlane();
|
||||
NotifyWxVoip();
|
||||
InitAndroidAI();
|
||||
RoomMgr::Instance()->ActiveRoom(GetRoomUuid());
|
||||
int auto_jump_interval = MetaMgr::Instance()->GetSysParamAsInt("auto_jump_interval");
|
||||
@ -1459,7 +1458,6 @@ void Room::UpdateGasJump()
|
||||
xtimer.DeleteTimer(auto_jump_timer_);
|
||||
NotifyGameStart();
|
||||
NotifyUiUpdate();
|
||||
NotifyWxVoip();
|
||||
if (room_type_ != RT_NewBrid) {
|
||||
InitAirDrop();
|
||||
InitAirRaid();
|
||||
@ -2037,24 +2035,6 @@ bool Room::HaveMyTeam(const std::string& team_uuid)
|
||||
return false;
|
||||
}
|
||||
|
||||
void Room::NotifyWxVoip()
|
||||
{
|
||||
xtimer.AddDeadLineTimerAndAttach
|
||||
(0,
|
||||
a8::XParams()
|
||||
.SetSender(this),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Room* room = (Room*)param.sender.GetUserData();
|
||||
room->TraversePlayerList(a8::XParams(),
|
||||
[] (Player * hum, a8::XParams & param)
|
||||
{
|
||||
hum->SendWxVoip();
|
||||
});
|
||||
},
|
||||
&xtimer_attacher_.timer_list_);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void Room::BattleReport()
|
||||
{
|
||||
|
@ -265,7 +265,6 @@ private:
|
||||
void AddObjectLater(RoomEntity* entity);
|
||||
void OnGameOver();
|
||||
void RandRemoveAndroid();
|
||||
void NotifyWxVoip();
|
||||
BornPoint* AllocBornPoint(Human* hum);
|
||||
BornPoint* GetBornPoint(int point_uniid);
|
||||
void CreateSpawnPoints();
|
||||
|
@ -15,11 +15,6 @@ enum CMMessageId_e
|
||||
_CMLeave = 209;
|
||||
_CMRevive = 210;
|
||||
_CMCancelRevive = 211;
|
||||
_CMAdStart = 212;
|
||||
_CMAdCancel = 213;
|
||||
_CMAdEnd = 214;
|
||||
_CMGetBoxInfo = 215;
|
||||
_CMOpenBox = 216;
|
||||
_CMExecCommand = 217;
|
||||
_CMMatchCancel = 218;
|
||||
_CMMatchChoose = 219;
|
||||
@ -37,20 +32,16 @@ enum SMMessageId_e
|
||||
|
||||
_SMWatchWar = 208;
|
||||
_SMLeave = 209;
|
||||
_SMGetBoxInfo = 216;
|
||||
_SMOpenBox = 217;
|
||||
|
||||
_SMJoinedNotify = 103;
|
||||
_SMMapInfo = 1002;
|
||||
_SMPlayerInfo = 1003;
|
||||
_SMUpdate = 1004;
|
||||
_SMRollMsg = 1005;
|
||||
_SMPickup = 1006;
|
||||
_SMVoiceNotify = 1007;
|
||||
_SMDisconnectNotify = 1008;
|
||||
_SMGameOver = 1009;
|
||||
_SMDebugMsg = 1010;
|
||||
_SMWxVoip = 1011;
|
||||
_SMUiUpdate = 1012;
|
||||
_SMGameStart = 1013;
|
||||
_SMSysPiaoMsg = 1014;
|
||||
|
@ -1146,34 +1146,6 @@ message CMCancelRevive
|
||||
{
|
||||
}
|
||||
|
||||
//开始播放广告(服务器收到消息后会添加一个看广告中的buff)
|
||||
message CMAdStart
|
||||
{
|
||||
}
|
||||
|
||||
//取消看广告(用户中途取消看广告)
|
||||
message CMAdCancel
|
||||
{
|
||||
}
|
||||
|
||||
//广告播放完毕(玩家看完广告)
|
||||
message CMAdEnd
|
||||
{
|
||||
optional int32 param = 1; //1:屠夫 2:南瓜
|
||||
}
|
||||
|
||||
//获取宝箱信息
|
||||
message CMGetBoxInfo
|
||||
{
|
||||
optional int32 box_id = 1; //1:战前宝箱
|
||||
}
|
||||
|
||||
//获取宝箱信息
|
||||
message CMOpenBox
|
||||
{
|
||||
optional int32 box_id = 1; //1: 战前宝箱
|
||||
}
|
||||
|
||||
//组队匹配-取消
|
||||
message CMMatchCancel
|
||||
{
|
||||
@ -1344,22 +1316,6 @@ message SMLeave
|
||||
{
|
||||
}
|
||||
|
||||
//获取宝箱信息回复
|
||||
message SMGetBoxInfo
|
||||
{
|
||||
optional int32 box_id = 1; //1:战前宝箱
|
||||
repeated MFTuple items = 2; //values[0]:道具id values[1]:道具数量
|
||||
}
|
||||
|
||||
//开宝箱回复
|
||||
message SMOpenBox
|
||||
{
|
||||
optional int32 box_id = 1; //1: 战前宝箱
|
||||
optional int32 errcode = 2; //错误码
|
||||
optional string errmsg = 3; //错误描述
|
||||
repeated MFTuple items = 4; //values[0]:道具id values[1]:道具数量
|
||||
}
|
||||
|
||||
//断线通知
|
||||
message SMDisconnectNotify
|
||||
{
|
||||
@ -1379,15 +1335,6 @@ message SMDebugMsg
|
||||
optional string debug_msg = 3; //调试信息
|
||||
}
|
||||
|
||||
/*
|
||||
微信实时语音房间
|
||||
客户端需要调用loginserver签名后再加入微信实时语音房间
|
||||
*/
|
||||
message SMWxVoip
|
||||
{
|
||||
optional string group_id = 1; //微信语聊房间id
|
||||
}
|
||||
|
||||
//ui界面更新,一些不需要实时更新的数据
|
||||
message SMUiUpdate
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user