You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

46 lines
1.7 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Sog;
using ProtoCSStruct;
namespace Friend
{
public static class FriendSettingSvc
{
public static void OnCliFriendSetSettingReq(uint remoteAppID, StructPacket packet)
{
PlayerInfoFriend player = FriendServerUtils.GetPlayerTableOp().GetPlayerInfo(packet.ObjectID);
if (player == null)
{
TraceLog.Error("FriendSettingSvc.OnCliFriendSetSettingReq can not find player uid {0}", packet.ObjectID);
return;
}
ref FriendCacheInfoStruct friendinfo = ref FriendOp.GetFriendInfoByUid(player.UserID);
if (friendinfo.IsNull())
{
TraceLog.Error("FriendSettingSvc.OnCliFriendSetSettingReq can not find player uid {0} friendInfo from cache"
, player.UserID);
return;
}
ref CSFriendSetSettingReq req = ref packet.GetMessage<CSFriendSetSettingReq>();
TraceLog.Debug("FriendSettingSvc.OnCliFriendSetSettingReq uid {0} AutoAccept {1} RefuseAll {2}"
, packet.ObjectID, req.AutoAccept, req.RefuseAll);
friendinfo.Self.AutoAccept = req.AutoAccept;
friendinfo.Self.RefuseAll = req.RefuseAll;
friendinfo.SetNeedSave(true);
var res = new CSFriendSetSettingRes();
res.RefuseAll = req.RefuseAll;
res.AutoAccept = req.AutoAccept;
FriendServerUtils.GetPacketSender().SendToServerByID(player.WorldServerID, (int)CSGameMsgID.FriendSetSettingRes,ref res, player.UserID);
}
}
}