This commit is contained in:
aozhiwei 2020-12-10 11:21:25 +08:00
parent 5de05fc59e
commit 206e04d796
2 changed files with 43 additions and 9 deletions

View File

@ -146,10 +146,10 @@ void ChatMgr::ProcGuildChat(Player* hum, const cs::CMSendChatMsg& msg)
void ChatMgr::ProcTeamChat(Player* hum, const cs::CMSendChatMsg& msg)
{
++world_msg_id_;
++temp_msg_id_;
cs::MFChatMsg* p = new cs::MFChatMsg();
p->set_msg_uuid(world_msg_id_);
p->set_msg_uuid(temp_msg_id_);
hum->FillMFUserInfo(p->mutable_sender());
//p->set_receiver(world_msg_id_);
p->set_chat_channel(msg.chat_channel());
@ -157,15 +157,12 @@ void ChatMgr::ProcTeamChat(Player* hum, const cs::CMSendChatMsg& msg)
p->set_msg_body(msg.msg_body());
p->set_send_time(time(nullptr));
world_msgrec_.curr_id = world_msg_id_;
cs::SMChatMsgNotify notifymsg;
*notifymsg.add_msg_list() = *p;
if (notifymsg.msg_list().size() > 0) {
for (auto& member_id : msg.members()) {
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(member_id);
if (hum) {
hum->SendMsg(notifymsg);
}
for (auto& member_id : msg.members()) {
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(member_id);
if (hum) {
hum->SendMsg(notifymsg);
}
}
delete p;
@ -173,12 +170,48 @@ void ChatMgr::ProcTeamChat(Player* hum, const cs::CMSendChatMsg& msg)
void ChatMgr::ProcBigHornChat(Player* hum, const cs::CMSendChatMsg& msg)
{
++temp_msg_id_;
cs::MFChatMsg* p = new cs::MFChatMsg();
p->set_msg_uuid(temp_msg_id_);
hum->FillMFUserInfo(p->mutable_sender());
//p->set_receiver(world_msg_id_);
p->set_chat_channel(msg.chat_channel());
p->set_msg_type(msg.msg_type());
p->set_msg_body(msg.msg_body());
p->set_send_time(time(nullptr));
cs::SMChatMsgNotify notifymsg;
*notifymsg.add_msg_list() = *p;
PlayerMgr::Instance()->TraversePlayer
([&notifymsg](Player* hum)
{
hum->SendMsg(notifymsg);
});
delete p;
}
void ChatMgr::ProcLoopMsgChat(Player* hum, const cs::CMSendChatMsg& msg)
{
++temp_msg_id_;
cs::MFChatMsg* p = new cs::MFChatMsg();
p->set_msg_uuid(temp_msg_id_);
hum->FillMFUserInfo(p->mutable_sender());
//p->set_receiver(world_msg_id_);
p->set_chat_channel(msg.chat_channel());
p->set_msg_type(msg.msg_type());
p->set_msg_body(msg.msg_body());
p->set_send_time(time(nullptr));
cs::SMChatMsgNotify notifymsg;
*notifymsg.add_msg_list() = *p;
PlayerMgr::Instance()->TraversePlayer
([&notifymsg](Player* hum)
{
hum->SendMsg(notifymsg);
});
delete p;
}
ChatedUserRec* ChatMgr::GetChatedUser(const std::string& account_id)

View File

@ -67,6 +67,7 @@ class ChatMgr : public a8::Singleton<ChatMgr>
long long private_msg_id_ = 1000;
long long world_msg_id_ = 1000;
long long guild_msg_id_ = 1000;
long long temp_msg_id_ = 1000;
ChatMsgRec world_msgrec_;
std::map<long long, ChatMsgRec> guild_msgrec_;
std::map<long long, cs::MFChatMsg*> private_msg_hash_;