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.
 
 
 
 
 
 

132 lines
5.3 KiB

using ProtoCSStruct;
using Sog;
using System.Collections.Generic;
namespace Game
{
public static class PlayerNotify
{
public static void NotifyPlayerPayDataChange(PlayerOnGame player)
{
CSPayPlayerPayinfoChgNotify chg = new CSPayPlayerPayinfoChgNotify();
chg.PayData = player.RoleData.PayData;
player.Trace("PlayerNotify.NotifyPlayerPayDataChange uid {0} chg.PayData.LastVipRewardWeek:{1} ", player.UserID, chg.PayData.LastVipRewardWeek);
player.SendToClient((int)CSGameMsgID.PayPlayerPayinfoChgNotify, ref chg);
}
public static void NotifyWorldPlayerRolebaseChangeUpdate(PlayerOnGame player)
{
player.Trace("PlayerNotify.NotifyWorldPlayerRolebaseChangeUpdate uid {0} ", player.UserID);
// 更新“最大资产”成就
var updateReq = new SSUpdateRolebaseToWorld { Rolebase = player.RoleBase };
PlayerSession playerSession = GameServerUtils.GetPlayerTableOp().GetPlayerSession(player.SessionID);
if (playerSession != null)
{
if (playerSession.IPAddr != null)
{
updateReq.ClientIpAddr.SetString(playerSession.IPAddr);
}
}
updateReq.PayCount = PlayerPayUtil.GetTotalPaySuccessCount(player);
GameServerUtils.GetPacketSender().SendToWorldServer((int)SSGameMsgID.UpdateRolebaseToWorld, ref updateReq, player.UserID);
}
public static void NotifyPlayerShowInfoChange(PlayerOnGame player)
{
player.Trace("PlayerNotify.NotifyPlayerShowInfoChange uid {0} ", player.UserID);
var notify = new SSPlayerShowInfoUpdate
{
Uid = player.UserID,
Level = player.GetLevel(),
Gender = player.GetGender(),
RealmId = player.RealmID,
IconFrameId = player.GetIconFrame(),
Power = player.RoleBase.Power,
Skin = player.RoleData.Skin.NowSkin,
WingskinId = player.RoleData.WingData.Wing.SkinId,
WingrefitId = player.RoleData.WingData.Wing.RefitId,
WingwearId = player.RoleData.WingData.Wing.WearId,
};
notify.Nick.SetString(player.GetNick());
notify.Icon.SetString(player.GetIcon());
GameServerUtils.GetPacketSender().SendToRankServer((int)SSGameMsgID.PlayerShowinfoUpdate, ref notify, player.UserID);
GameServerUtils.GetPacketSender().SendToWorldServer((int)SSGameMsgID.PlayerShowinfoUpdate, ref notify, player.UserID);
}
public static void NotifyPlayerPowerChange(PlayerOnGame player, int FromCli = 0, long change = 0)
{
var notify = new SSPlayerPowerUpdate
{
Uid = player.UserID,
Power = player.RoleBase.Power,
};
var cNotifdy = new CsPowerChangeNotify
{
Power = player.RoleBase.Power,
FromCli = FromCli,
Change = change,
};
player.SendToClient((int)CSGameMsgID.PowerChangeNotify, ref cNotifdy);
PlayerNotify.NotifyPlayerShowInfoChange(player);
}
public static void NotifyWorldGamePlayerDestroy(PlayerOnGame player)
{
player.Trace("PlayerNotify.NotifyWorldGamePlayerDestroy uid {0} ", player.UserID);
SSGamePlayerDestroy req = new SSGamePlayerDestroy();
req.Uid = player.UserID;
req.CurLoginSerialNum = player.CurLoginSerialNum;
GameServerUtils.GetPacketSender().SendToWorldServer((int)SSGameMsgID.GamePlayerDestroy, ref req, player.UserID);
}
public static void NotifyWorldRoleLoginSuccess(PlayerOnGame player)
{
player.Trace("PlayerNotify.NotifyWorldRoleLoginSuccess uid {0} ", player.UserID);
SSRoleLoginSuccessNotify req = new SSRoleLoginSuccessNotify();
req.Uid = player.UserID;
req.LoginTime = player.RoleBase.LastLoginTime;
req.Language.SetString(player.Lang);
req.ApkVersion.SetString(player.apkVersion);
GameServerUtils.GetPacketSender().SendToWorldServer((int)SSGameMsgID.RoleLoginSuccessNotify, ref req, player.UserID);
}
public static void NotifyWorldSimpleRoleData(PlayerOnGame player)
{
player.Trace("PlayerNotify.NotifyWorldSimpleRoleData uid {0}", player.UserID);
// var req = new SSUpdateRoleDataToWorld();
//GameServerUtils.GetPacketSender().SendToWorldServer((int)SSGameMsgID.UpdateRoleDataToWorld, ref req, player.UserID);
}
public static void NotifyPlayerGoodsChange(PlayerOnGame player, ref CSPlayerGoodsChgNotify notify)
{
PlayerSession playerSession = GameServerUtils.GetPlayerTableOp().GetPlayerSession(player.SessionID);
if (playerSession == null)
{
player.Debug("NotifyPlayerGoodsChange uid {0} session {1} can not find session,skip",
player.UserID, player.SessionID);
return;
}
player.Trace("PlayerNotify.NotifyPlayerGoodsChange uid {0} ", player.UserID);
player.SendToClient((int)CSGameMsgID.PlayerGoodsChgNotify, ref notify);
}
}
}