Files
caliverse_server/GameServer/Contents/ItemFirstPurchaseHistory/Helper/ItemFirstPurchaseHistoryNotifyHelper.cs
2025-05-01 07:20:41 +09:00

41 lines
1.8 KiB
C#

using ServerCommon;
using ServerCore; using ServerBase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static ClientToGameMessage.Types;
namespace GameServer
{
internal static class ItemFirstPurchaseHistoryNotifyHelper
{
public static bool send_S2C_NTF_ITEM_FIRST_PURCHASE_HISTORY(this Player player)
{
var item_first_purchase_history_agent_action = player.getEntityAction<ItemFirstPurchaseHistoryAgentAction>();
NullReferenceCheckHelper.throwIfNull(item_first_purchase_history_agent_action, () => $"item_first_purchase_history_agent_action is null !!! - {player.toBasicString()}");
var ntf_packet = new ClientToGame();
ntf_packet.Message = new ClientToGameMessage();
ntf_packet.Message.NtfItemFirstPurchaseHistory = new GS2C_NTF_ITEM_FIRST_PURCHASE_HISTORY();
var item_first_purchase_histories = item_first_purchase_history_agent_action.getItemFirstPurchaseHistories();
foreach (var item_first_purchase_history in item_first_purchase_histories)
{
var item_first_purchase_history_attribute = item_first_purchase_history.getEntityAttribute<ItemFirstPurchaseHistoryAttribute>();
NullReferenceCheckHelper.throwIfNull(item_first_purchase_history_attribute, () => $"ItemFirstPurchaseHistoryAttrib is null !!! - player:{player.toBasicString()}");
ntf_packet.Message.NtfItemFirstPurchaseHistory.ItemMetaids.Add(item_first_purchase_history_attribute.ItemMetaId);
}
if (false == GameServerApp.getServerLogic().onSendPacket(player, ntf_packet))
{
return false;
}
return true;
}
}
}