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.
101 lines
4.0 KiB
101 lines
4.0 KiB
1 month ago
|
using Org.BouncyCastle.Bcpg;
|
||
|
using ProtoCSStruct;
|
||
|
using Sog;
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using System.Threading.Tasks;
|
||
|
|
||
|
namespace Game
|
||
|
{
|
||
|
public class WxFriendRankSvc
|
||
|
{
|
||
|
public static void OnPlayerOnLine(PlayerOnGame player)
|
||
|
{
|
||
|
//long now = GameServerUtils.GetTimeMs();
|
||
|
//if(now - player.RoleData.WxFriends.LasySyncTime > 86400 * 1000)
|
||
|
//{
|
||
|
// player.RoleData.WxFriends.LasySyncTime = now;
|
||
|
// //TODO QUERY friendlist from account
|
||
|
//}
|
||
|
//for(int i = 0; i < player.RoleData.WxFriends.Friends.Count; i++)
|
||
|
//{
|
||
|
// ref var fone = ref player.RoleData.WxFriends.Friends[i];
|
||
|
// if(fone.Uid == 0)
|
||
|
// {
|
||
|
// SSQueryUidByWXIDReq sSQueryUidByWXIDReq = new SSQueryUidByWXIDReq();
|
||
|
// sSQueryUidByWXIDReq.Wxid.SetString(fone.Uid.ToString());
|
||
|
// GameServerUtils.GetPacketSender().SendToWorldServer<SSQueryUidByWXIDReq>((int)SSMsgID.QueryUidByWxidReq,
|
||
|
// ref sSQueryUidByWXIDReq, player.UserID);
|
||
|
// }
|
||
|
// else
|
||
|
// {
|
||
|
// //if (now - fone.LasySyncTime > 10 * 60 * 1000)
|
||
|
// {
|
||
|
// SSQueryRankOneReq sSQueryRankOneReq = new SSQueryRankOneReq();
|
||
|
// sSQueryRankOneReq.Uid = fone.Uid;
|
||
|
// sSQueryRankOneReq.RealmId = fone.RealmId;
|
||
|
// sSQueryRankOneReq.RankId = 1;
|
||
|
// GameServerUtils.GetPacketSender().SendToRankServer<SSQueryRankOneReq>((int)SSGameMsgID.QueryRankOneReq,
|
||
|
// ref sSQueryRankOneReq, player.UserID);
|
||
|
// }
|
||
|
// }
|
||
|
|
||
|
//}
|
||
|
}
|
||
|
|
||
|
public static void OnQueryUidByWxidRes(StructPacket packaet)
|
||
|
{
|
||
|
ref var res = ref packaet.GetMessage<SSQueryUidByWXIDRes>();
|
||
|
long uid = packaet.ObjectID;
|
||
|
PlayerOnGame player = GameServerUtils.GetPlayerTableOp().GetPlayerByUid(uid);
|
||
|
if (player != null)
|
||
|
{
|
||
|
for (int i = 0; i < player.RoleData.WxFriends.Friends.Count; i++)
|
||
|
{
|
||
|
ref var fone = ref player.RoleData.WxFriends.Friends[i];
|
||
|
if (fone.Uid == 0 && fone.Account.GetString().Equals(res.Wxid.GetString()))
|
||
|
{
|
||
|
fone.Uid = res.Uid;
|
||
|
fone.RealmId = res.RealmId;
|
||
|
//查询排行榜
|
||
|
SSQueryRankOneReq sSQueryRankOneReq = new SSQueryRankOneReq();
|
||
|
sSQueryRankOneReq.Uid = fone.Uid;
|
||
|
sSQueryRankOneReq.RealmId = fone.RealmId;
|
||
|
sSQueryRankOneReq.RankId = 1;
|
||
|
GameServerUtils.GetPacketSender().SendToRankServer<SSQueryRankOneReq>((int)SSGameMsgID.QueryRankOneReq,
|
||
|
ref sSQueryRankOneReq, player.UserID);
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
public static void OnQueryRankOneRes(StructPacket packaet)
|
||
|
{
|
||
|
ref var res = ref packaet.GetMessage<SSQueryRankOneRes>();
|
||
|
long uid = packaet.ObjectID ;
|
||
|
PlayerOnGame player = GameServerUtils.GetPlayerTableOp().GetPlayerByUid(uid);
|
||
|
if (player != null)
|
||
|
{
|
||
|
for (int i = 0; i < player.RoleData.WxFriends.Friends.Count; i++)
|
||
|
{
|
||
|
ref var fone = ref player.RoleData.WxFriends.Friends[i];
|
||
|
if (fone.Uid == res.Uid)
|
||
|
{
|
||
|
if (res.Ret == 0)
|
||
|
{
|
||
|
fone.RankInfo.CopyFrom(ref res.Rank);
|
||
|
}
|
||
|
fone.LasySyncTime = GameServerUtils.GetTimeMs();
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|