92 lines
2.8 KiB
C#
92 lines
2.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
using Nettention.Proud;
|
|
|
|
|
|
using ServerCore; using ServerBase;
|
|
using ServerCommon;
|
|
|
|
|
|
using static ClientToGameRes.Types;
|
|
using static ServerMessage.Types;
|
|
|
|
|
|
|
|
using USER_GUID = System.String;
|
|
|
|
|
|
|
|
namespace GameServer
|
|
{
|
|
public static class MailNotifyHelper
|
|
{
|
|
public static void send_GS2GS_NTF_NEW_MAIL(string targetServer, USER_GUID targetUserGuid)
|
|
{
|
|
ConditionValidCheckHelper.throwIfFalseWithCondition( () => true != targetServer.isNullOrWhiteSpace()
|
|
, () => $"targetServer is NullOrWhiteSpace !!! - targetServer:{targetServer}, targetUserGuid:{targetUserGuid}");
|
|
|
|
var server_logic = GameServerApp.getServerLogic();
|
|
|
|
var rabbit_mq_4_game = server_logic.getRabbitMqConnector() as RabbitMQ4Game;
|
|
NullReferenceCheckHelper.throwIfNull(rabbit_mq_4_game, () => $"rabbit_mq_4_game is null !! - targetServer:{targetServer}, targetUserGuid:{targetUserGuid}");
|
|
|
|
var ntf_packet = new ServerMessage();
|
|
var ntf_recv_mail = new ReceiveMailNoti();
|
|
ntf_packet.ReceiveMailNoti = ntf_recv_mail;
|
|
|
|
ntf_recv_mail.AccountGuid = targetUserGuid;
|
|
|
|
rabbit_mq_4_game.SendMessage(targetServer, ntf_packet);
|
|
}
|
|
|
|
|
|
public static bool send_S2C_NTF_NEW_MAIL(this Player player)
|
|
{
|
|
var mail_action = player.getEntityAction<MailAction>();
|
|
NullReferenceCheckHelper.throwIfNull(mail_action, () => $"mail_action is null !!! - {player.toBasicString()}");
|
|
if (mail_action.isNewReceivedMail() == false)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
var noti_packet = new ClientToGame();
|
|
noti_packet.Message = new();
|
|
noti_packet.Message.NewMailNoti = new();
|
|
|
|
if (false == GameServerApp.getServerLogic().onSendPacket(player, noti_packet))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public static bool send_S2C_NTF_NEW_SYSTEM_MAIL_MAIL(this Player player)
|
|
{
|
|
var mail_action = player.getEntityAction<MailAction>();
|
|
NullReferenceCheckHelper.throwIfNull(mail_action, () => $"mail_action is null !!! - {player.toBasicString()}");
|
|
if (mail_action.isNewSystemMail() == false)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
var noti_packet = new ClientToGame();
|
|
noti_packet.Message = new();
|
|
noti_packet.Message.NewMailNoti = new();
|
|
|
|
if (false == GameServerApp.getServerLogic().onSendPacket(player, noti_packet))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|