76 lines
2.8 KiB
C#
76 lines
2.8 KiB
C#
using ServerCore; using ServerBase;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using static ClientToGameMessage.Types;
|
|
using static ServerMessage.Types;
|
|
|
|
namespace GameServer
|
|
{
|
|
internal static class RentalNotifyHelper
|
|
{
|
|
public static bool send_S2C_NTF_OWNED_RENTAL_INFOS(this Player player)
|
|
{
|
|
var rental_agent_action = player.getEntityAction<RentalAgentAction>();
|
|
|
|
var ntf_packet = new ClientToGame();
|
|
ntf_packet.Message = new ClientToGameMessage();
|
|
ntf_packet.Message.NtfOwnedRentalInfos = new GS2C_NTF_OWNED_RENTAL_INFOS();
|
|
|
|
var rentals = rental_agent_action.getRentals();
|
|
foreach (var rental in rentals)
|
|
{
|
|
var owned_rental_info = rental.toOwnedRentalInfo();
|
|
ntf_packet.Message.NtfOwnedRentalInfos.OwnedRentalInfos.Add(owned_rental_info);
|
|
}
|
|
|
|
if (false == GameServerApp.getServerLogic().onSendPacket(player, ntf_packet))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public static bool send_S2C_NTF_MODIFY_OWNED_RENTAL_INFOS(this Player player, ModifyType modifyType, Rental rental)
|
|
{
|
|
var modify_owned_rental_info = new ModifyOwnedRentalInfo();
|
|
modify_owned_rental_info.ModifyType = modifyType;
|
|
modify_owned_rental_info.OwnedRentalInfo = rental.toOwnedRentalInfo();
|
|
|
|
var ntf_packet = new ClientToGame();
|
|
ntf_packet.Message = new ClientToGameMessage();
|
|
ntf_packet.Message.NtfModifyOwnedRentalInfos = new GS2C_NTF_MODIFY_OWNED_RENTAL_INFOS();
|
|
|
|
ntf_packet.Message.NtfModifyOwnedRentalInfos.ModifyOwnedRentalInfos.Add(modify_owned_rental_info);
|
|
|
|
if (false == GameServerApp.getServerLogic().onSendPacket(player, ntf_packet))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public static bool send_GS2GS_NTF_RENT_FLOOR(RentFloorRequestInfo rentFloorRequestInfo, int instanceMetaId)
|
|
{
|
|
var server_logic = GameServerApp.getServerLogic();
|
|
var message = new ServerMessage();
|
|
|
|
message.NtfRentFloor = new GS2GS_NTF_RENT_FLOOR();
|
|
message.NtfRentFloor.ExceptServerName = server_logic.getServerName();
|
|
message.NtfRentFloor.RentFloorRequestInfo = rentFloorRequestInfo;
|
|
message.NtfRentFloor.InstanceMetaId = instanceMetaId;
|
|
|
|
var rabbit_mq = server_logic.getRabbitMqConnector() as RabbitMQ4Game;
|
|
NullReferenceCheckHelper.throwIfNull(rabbit_mq, () => $"rabbit_mq is null !!!");
|
|
|
|
rabbit_mq.sendMessageToExchangeAllGame(message);
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|