48 lines
1.7 KiB
C#
48 lines
1.7 KiB
C#
using Google.Protobuf;
|
|
using Google.Protobuf.WellKnownTypes;
|
|
|
|
|
|
using ServerCore;
|
|
using ServerBase;
|
|
using ServerCommon;
|
|
using ServerCommon.BusinessLogDomain;
|
|
using MetaAssets;
|
|
|
|
|
|
|
|
namespace GameServer;
|
|
|
|
public class NotifyFriendStateHandler
|
|
{
|
|
public bool send_GS2C_NTF_FRIEND_STATE(ServerMessage.Types.StateNotiToFriend noti)
|
|
{
|
|
var player_manager = GameServerApp.getServerLogic().getPlayerManager();
|
|
ArgumentNullException.ThrowIfNull(player_manager);
|
|
|
|
if (false == player_manager.tryGetUserByPrimaryKey(noti.BaseInfo.ReceiverGuid, out var player))
|
|
{
|
|
Log.getLogger().error($"send_GS2CS_NTF_FRIEND_STATE {noti.BaseInfo.ReceiverGuid} user not exist this Server");
|
|
return false;
|
|
}
|
|
|
|
ClientToGame clientToGame = new();
|
|
clientToGame.Message = new();
|
|
clientToGame.Message.FriendStateNoti = new();
|
|
clientToGame.Message.FriendStateNoti.BaseInfo = new();
|
|
clientToGame.Message.FriendStateNoti.BaseInfo.SenderId = noti.BaseInfo.SenderId;
|
|
clientToGame.Message.FriendStateNoti.BaseInfo.SenderGuid = noti.BaseInfo.SenderGuid;
|
|
clientToGame.Message.FriendStateNoti.BaseInfo.SenderNickName = noti.BaseInfo.SenderNickName;
|
|
clientToGame.Message.FriendStateNoti.BaseInfo.SenderState = noti.BaseInfo.SenderState;
|
|
clientToGame.Message.FriendStateNoti.BaseInfo.SenderMapId = noti.BaseInfo.SenderMapId;
|
|
clientToGame.Message.FriendStateNoti.LocationInfo = noti.LocationInfo;
|
|
|
|
if (false == GameServerApp.getServerLogic().onSendPacket(player, clientToGame))
|
|
{
|
|
Log.getLogger().error("Failed to send_GS2C_NTF_FRIEND_STATE !!!");
|
|
}
|
|
|
|
|
|
return true;
|
|
}
|
|
}
|