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.
 
 
 
 
 
 

96 lines
3.4 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Sog;
using ProtoCSStruct;
namespace Friend
{
public static class SysSvc
{
public static void OnUpdateRolebaseToWorld(uint remoteAppID, StructPacket packet)
{
ref SSUpdateRolebaseToWorld updateReq =ref packet.GetMessage<SSUpdateRolebaseToWorld>();
long uid = updateReq.Rolebase.Uid;
PlayerInfoFriend player = FriendServerUtils.GetPlayerTableOp().GetPlayerInfo(uid);
if (player == null)
{
TraceLog.Error("SysSvc.OnUpdateRolebaseToWorld can not find player uid {0}", uid);
return;
}
TraceLog.Trace("SysSvc.OnUpdateRolebaseToWorld uid {0}", uid);
player.roleBase.CopyFrom(ref updateReq.Rolebase);
player.IpAddr = updateReq.ClientIpAddr.ToString();
}
public static void OnUpdateRoleDataToWorld(uint remoteAppID, StructPacket packet)
{
long uid = packet.ObjectID;
ref SSUpdateRoleDataToWorld updateReq = ref packet.GetMessage<SSUpdateRoleDataToWorld>();
PlayerInfoFriend player = FriendServerUtils.GetPlayerTableOp().GetPlayerInfo(uid);
if (player == null)
{
TraceLog.Error("SysSvc.OnUpdateRoleDataToWorld can not find player uid {0}", uid);
return;
}
TraceLog.Trace("SysSvc.OnUpdateRoleDataToWorld uid {0}", uid);
player.MainlineHeros.CopyFrom(ref updateReq.MainlineHeros);
player.mainlineFightPower = 0;
for (int i = 0; i < player.MainlineHeros.Count; i++)
{
player.mainlineFightPower += player.MainlineHeros[i].Power;
}
}
public static void OnAddServerTimeSync(uint remoteAppID, StructPacket packet)
{
ref SSAddServerTimeSync sync =ref packet.GetMessage<SSAddServerTimeSync>();
FriendServerUtils.GetApp().Time.SetOffset(sync.Offset);
FriendServerUtils.GetApp().Time.UpdateTime();
TraceLog.Debug("SysSvc.OnAddServerTimeSync remote svr {0} offset {1} new time {2}"
, ServerIDUtils.IDToString(remoteAppID), sync.Offset, FriendServerUtils.GetApp().Time.GetDateTime());
}
public static void OnSetLanguageReq(uint serverID, StructPacket packet)
{
PlayerInfoFriend player = FriendServerUtils.GetPlayerTableOp().GetPlayerInfo(packet.ObjectID);
if (player == null)
{
TraceLog.Error("SysSvc.OnSetLanguageReq player {0} = null", packet.ObjectID);
return;
}
ref CSSetLanguageReq req =ref packet.GetMessage<CSSetLanguageReq>();
TraceLog.Trace("SysSvc.OnSetLanguageReq uid {0} set lang {1} old {2}", packet.ObjectID, req.Lang, player.Lang);
player.Lang = req.Lang.ToString();
}
public static void OnGetRealmlistRes(uint remoteAppID, StructPacket packet)
{
ref SSRankRealmlistRes res = ref packet.GetMessage<SSRankRealmlistRes>();
var serverData = FriendServerUtils.GetFriendServerData();
for (int i = 0; i < res.Realms.Count; i++)
{
var realm = new RealmBriefInfo(ref res.Realms[i]);
serverData.m_realmInfosMap[realm.realmId] = realm;
}
TraceLog.Trace("OnGetRealmlistRes realm count {0}", serverData.m_realmInfosMap.Count);
}
}
}