1
This commit is contained in:
parent
5de05fc59e
commit
206e04d796
@ -146,10 +146,10 @@ void ChatMgr::ProcGuildChat(Player* hum, const cs::CMSendChatMsg& msg)
|
|||||||
|
|
||||||
void ChatMgr::ProcTeamChat(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();
|
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());
|
hum->FillMFUserInfo(p->mutable_sender());
|
||||||
//p->set_receiver(world_msg_id_);
|
//p->set_receiver(world_msg_id_);
|
||||||
p->set_chat_channel(msg.chat_channel());
|
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_msg_body(msg.msg_body());
|
||||||
p->set_send_time(time(nullptr));
|
p->set_send_time(time(nullptr));
|
||||||
|
|
||||||
world_msgrec_.curr_id = world_msg_id_;
|
|
||||||
cs::SMChatMsgNotify notifymsg;
|
cs::SMChatMsgNotify notifymsg;
|
||||||
*notifymsg.add_msg_list() = *p;
|
*notifymsg.add_msg_list() = *p;
|
||||||
if (notifymsg.msg_list().size() > 0) {
|
for (auto& member_id : msg.members()) {
|
||||||
for (auto& member_id : msg.members()) {
|
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(member_id);
|
||||||
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(member_id);
|
if (hum) {
|
||||||
if (hum) {
|
hum->SendMsg(notifymsg);
|
||||||
hum->SendMsg(notifymsg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete p;
|
delete p;
|
||||||
@ -173,12 +170,48 @@ void ChatMgr::ProcTeamChat(Player* hum, const cs::CMSendChatMsg& msg)
|
|||||||
|
|
||||||
void ChatMgr::ProcBigHornChat(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
|
||||||
|
([¬ifymsg](Player* hum)
|
||||||
|
{
|
||||||
|
hum->SendMsg(notifymsg);
|
||||||
|
});
|
||||||
|
delete p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatMgr::ProcLoopMsgChat(Player* hum, const cs::CMSendChatMsg& msg)
|
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
|
||||||
|
([¬ifymsg](Player* hum)
|
||||||
|
{
|
||||||
|
hum->SendMsg(notifymsg);
|
||||||
|
});
|
||||||
|
delete p;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatedUserRec* ChatMgr::GetChatedUser(const std::string& account_id)
|
ChatedUserRec* ChatMgr::GetChatedUser(const std::string& account_id)
|
||||||
|
@ -67,6 +67,7 @@ class ChatMgr : public a8::Singleton<ChatMgr>
|
|||||||
long long private_msg_id_ = 1000;
|
long long private_msg_id_ = 1000;
|
||||||
long long world_msg_id_ = 1000;
|
long long world_msg_id_ = 1000;
|
||||||
long long guild_msg_id_ = 1000;
|
long long guild_msg_id_ = 1000;
|
||||||
|
long long temp_msg_id_ = 1000;
|
||||||
ChatMsgRec world_msgrec_;
|
ChatMsgRec world_msgrec_;
|
||||||
std::map<long long, ChatMsgRec> guild_msgrec_;
|
std::map<long long, ChatMsgRec> guild_msgrec_;
|
||||||
std::map<long long, cs::MFChatMsg*> private_msg_hash_;
|
std::map<long long, cs::MFChatMsg*> private_msg_hash_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user