using Google.Protobuf.WellKnownTypes; using ServerCommon; using ServerCore; using ServerBase; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using static ServerMessage.Types; namespace GameServer { internal static class BuildingProfitHistoryNotifyHelper { public static bool send_GS2GS_NTF_ADD_BUILDING_PROFIT_HISTORY(BuildingProfitHistory buildingProfitHistory) { var server_logic = GameServerApp.getServerLogic(); var building_profit_history_attribute = buildingProfitHistory.getEntityAttribute(); NullReferenceCheckHelper.throwIfNull(building_profit_history_attribute, () => $"building_profit_history_attribute is null !!!"); var message = new ServerMessage(); message.NtfAddBuildingProfitHistory = new GS2GS_NTF_ADD_BUILDING_PROFIT_HISTORY(); message.NtfAddBuildingProfitHistory.ExceptServerName = server_logic.getServerName(); message.NtfAddBuildingProfitHistory.BuildingMetaId = building_profit_history_attribute.BuildingMetaId; message.NtfAddBuildingProfitHistory.Floor = building_profit_history_attribute.Floor; message.NtfAddBuildingProfitHistory.ProfitTime = building_profit_history_attribute.ProfitTime.ToTimestamp(); message.NtfAddBuildingProfitHistory.ProfitHistoryType = building_profit_history_attribute.ProfitHistoryType; message.NtfAddBuildingProfitHistory.FloorProfit = new FloorProfitInfo(); foreach (var (currency_type, currency_amount) in building_profit_history_attribute.Profits) { var money = new Money(); money.Amount = currency_amount; message.NtfAddBuildingProfitHistory.FloorProfit.Profits.Add((int)currency_type, money); } var rabbit_mq = server_logic.getRabbitMqConnector() as RabbitMQ4Game; NullReferenceCheckHelper.throwIfNull(rabbit_mq, () => $"rabbit_mq is null !!!"); rabbit_mq.sendMessageToExchangeAllGame(message); return true; } } }