1
This commit is contained in:
parent
1bbcb11924
commit
9ea22666f3
@ -44,6 +44,7 @@
|
|||||||
#include "buff/vertigo.h"
|
#include "buff/vertigo.h"
|
||||||
#include "buff/cond_add.h"
|
#include "buff/cond_add.h"
|
||||||
#include "buff/distance_dmg_addition.h"
|
#include "buff/distance_dmg_addition.h"
|
||||||
|
#include "buff/downed.h"
|
||||||
|
|
||||||
#include "mt/Buff.h"
|
#include "mt/Buff.h"
|
||||||
|
|
||||||
@ -128,6 +129,8 @@ std::shared_ptr<Buff> BuffFactory::MakeBuff(const mt::Buff* buff_meta)
|
|||||||
return std::make_shared<VertigoBuff>();
|
return std::make_shared<VertigoBuff>();
|
||||||
case kBET_CondAdd:
|
case kBET_CondAdd:
|
||||||
return std::make_shared<CondAddBuff>();
|
return std::make_shared<CondAddBuff>();
|
||||||
|
case kBET_Down:
|
||||||
|
return std::make_shared<DownedBuff>();
|
||||||
default:
|
default:
|
||||||
return std::make_shared<Buff>();
|
return std::make_shared<Buff>();
|
||||||
}
|
}
|
||||||
|
27
server/gameserver/buff/downed.cc
Normal file
27
server/gameserver/buff/downed.cc
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include "precompile.h"
|
||||||
|
|
||||||
|
#include "buff/downed.h"
|
||||||
|
|
||||||
|
#include "creature.h"
|
||||||
|
#include "human.h"
|
||||||
|
#include "room.h"
|
||||||
|
|
||||||
|
#include "mt/Buff.h"
|
||||||
|
|
||||||
|
void DownedBuff::Activate()
|
||||||
|
{
|
||||||
|
if (!owner->room->IsDestorying() && !owner->room->IsGameOver()) {
|
||||||
|
if (owner->IsHuman()) {
|
||||||
|
owner->AsHuman()->SendViewerUiMemberUpdate({owner->GetUniId()});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DownedBuff::Deactivate()
|
||||||
|
{
|
||||||
|
if (!owner->room->IsDestorying() && !owner->room->IsGameOver()) {
|
||||||
|
if (owner->IsHuman()) {
|
||||||
|
owner->AsHuman()->SendViewerUiMemberUpdate({owner->GetUniId()});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
12
server/gameserver/buff/downed.h
Normal file
12
server/gameserver/buff/downed.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "buff.h"
|
||||||
|
|
||||||
|
class DownedBuff : public Buff
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void Activate() override;
|
||||||
|
virtual void Deactivate() override;
|
||||||
|
|
||||||
|
};
|
@ -3535,6 +3535,7 @@ void Human::InternalBeKill(int killer_id, const std::string& killer_name, int we
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SendViewerUiMemberUpdate({GetUniId(), killer_id, real_killer_id});
|
||||||
}
|
}
|
||||||
|
|
||||||
int Human::GetTeamMode()
|
int Human::GetTeamMode()
|
||||||
|
@ -1720,27 +1720,6 @@ void Human::SendUIUpdate()
|
|||||||
notifymsg.set_boss_state(room->pve_data.boss_state);
|
notifymsg.set_boss_state(room->pve_data.boss_state);
|
||||||
}
|
}
|
||||||
if (room->IsMobaModeRoom()) {
|
if (room->IsMobaModeRoom()) {
|
||||||
#if 0
|
|
||||||
if (GetTeam()->GetTeamId() == room->GetMobaTeamA()->GetTeamId()) {
|
|
||||||
if (room->GetMobaTeamA()) {
|
|
||||||
notifymsg.set_a_team_id(room->GetMobaTeamB()->GetTeamId());
|
|
||||||
notifymsg.set_a_kill_count(room->GetMobaTeamB()->GetKillCount());
|
|
||||||
}
|
|
||||||
if (room->GetMobaTeamB()) {
|
|
||||||
notifymsg.set_b_team_id(room->GetMobaTeamA()->GetTeamId());
|
|
||||||
notifymsg.set_b_kill_count(room->GetMobaTeamA()->GetKillCount());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (room->GetMobaTeamA()) {
|
|
||||||
notifymsg.set_a_team_id(room->GetMobaTeamA()->GetTeamId());
|
|
||||||
notifymsg.set_a_kill_count(room->GetMobaTeamA()->GetKillCount());
|
|
||||||
}
|
|
||||||
if (room->GetMobaTeamB()) {
|
|
||||||
notifymsg.set_b_team_id(room->GetMobaTeamB()->GetTeamId());
|
|
||||||
notifymsg.set_b_kill_count(room->GetMobaTeamB()->GetKillCount());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (room->GetMobaTeamA()) {
|
if (room->GetMobaTeamA()) {
|
||||||
notifymsg.set_a_team_id(room->GetMobaTeamA()->GetTeamId());
|
notifymsg.set_a_team_id(room->GetMobaTeamA()->GetTeamId());
|
||||||
notifymsg.set_a_kill_count(room->GetMobaTeamA()->GetKillCount());
|
notifymsg.set_a_kill_count(room->GetMobaTeamA()->GetKillCount());
|
||||||
@ -1749,8 +1728,7 @@ void Human::SendUIUpdate()
|
|||||||
notifymsg.set_b_team_id(room->GetMobaTeamB()->GetTeamId());
|
notifymsg.set_b_team_id(room->GetMobaTeamB()->GetTeamId());
|
||||||
notifymsg.set_b_kill_count(room->GetMobaTeamB()->GetKillCount());
|
notifymsg.set_b_kill_count(room->GetMobaTeamB()->GetKillCount());
|
||||||
}
|
}
|
||||||
#endif
|
#ifdef MYDEBUG
|
||||||
#ifdef MYDEBUG1
|
|
||||||
a8::XPrintf("zzzzzzzzzzzzz self_team_id:%d data:%s\n",
|
a8::XPrintf("zzzzzzzzzzzzz self_team_id:%d data:%s\n",
|
||||||
{
|
{
|
||||||
GetTeam()->GetTeamId(),
|
GetTeam()->GetTeamId(),
|
||||||
@ -2279,33 +2257,40 @@ void Human::SendViewerUiNotify()
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
#ifdef MYDEBUG
|
#ifdef MYDEBUG
|
||||||
a8::XPrintf("SMViewerUiNotify %s", {f8::PbToJson(&msg)});
|
a8::XPrintf("SMViewerUiNotify %d %s\n", {socket_handle, f8::PbToJson(&msg)});
|
||||||
#endif
|
#endif
|
||||||
SendNotifyMsg(msg);
|
SendNotifyMsg(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Human::SendViewerUiMemberUpdate(std::vector<int> member_ids)
|
void Human::SendViewerUiMemberUpdate(std::vector<int> member_ids)
|
||||||
{
|
{
|
||||||
if (!IsOb()) {
|
if (room->GetRoomOb()->HasOb()) {
|
||||||
return;
|
cs::SMViewerUiMemberUpdate msg;
|
||||||
}
|
for (int id : member_ids) {
|
||||||
cs::SMViewerUiMemberUpdate msg;
|
Human* hum = room->GetHumanByUniId(id);
|
||||||
for (int id : member_ids) {
|
if (hum) {
|
||||||
Player* hum = room->GetPlayerByUniId(id);
|
auto m = msg.add_members();
|
||||||
if (hum) {
|
m->set_team_id(hum->GetTeam()->GetTeamId());
|
||||||
auto m = msg.add_members();
|
m->set_member_uniid(hum->GetUniId());
|
||||||
m->set_team_id(hum->GetTeam()->GetTeamId());
|
m->set_name(hum->GetName());
|
||||||
m->set_member_uniid(hum->GetUniId());
|
m->set_avatar_url(hum->avatar_url);
|
||||||
m->set_name(hum->GetName());
|
m->set_hero_id(hum->meta->id());
|
||||||
m->set_avatar_url(hum->avatar_url);
|
m->set_head_frame(hum->head_frame);
|
||||||
m->set_hero_id(hum->meta->id());
|
m->set_kills(hum->stats->kills);
|
||||||
m->set_head_frame(hum->head_frame);
|
m->set_dead(hum->dead);
|
||||||
m->set_kills(hum->stats->kills);
|
m->set_downed(hum->downed);
|
||||||
m->set_dead(hum->dead);
|
}
|
||||||
m->set_downed(hum->downed);
|
|
||||||
}
|
}
|
||||||
|
room->GetRoomOb()->TraverseOb
|
||||||
|
(
|
||||||
|
[&msg] (Player* ele_hum) -> bool
|
||||||
|
{
|
||||||
|
#ifdef MYDEBUG
|
||||||
|
a8::XPrintf("SMViewerUiMemberNotify %d %s\n", {ele_hum->socket_handle, f8::PbToJson(&msg)});
|
||||||
|
#endif
|
||||||
|
ele_hum->SendNotifyMsg(msg);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
SendNotifyMsg(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GGListener::SendError(int sockhandle, unsigned int seqid,
|
void GGListener::SendError(int sockhandle, unsigned int seqid,
|
||||||
|
@ -15,6 +15,7 @@ class RoomOb : public std::enable_shared_from_this<RoomOb>
|
|||||||
Player* GetByAccountId(const std::string& account_id);
|
Player* GetByAccountId(const std::string& account_id);
|
||||||
void AddOb(Player* hum);
|
void AddOb(Player* hum);
|
||||||
void TraverseOb(std::function<bool (Player*)> cb);
|
void TraverseOb(std::function<bool (Player*)> cb);
|
||||||
|
bool HasOb() { return !id_hash_.empty(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Room* room_ = nullptr;
|
Room* room_ = nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user