초기커밋

This commit is contained in:
2025-05-01 07:20:41 +09:00
commit 98bb2e3c5c
2747 changed files with 646947 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
using ServerCommon;
using ServerCore; using ServerBase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GameServer
{
internal static class ItemFirstPurchaseHistoryHelper
{
public static Result checkItemFirstPurchaseItemCount(this Player player, int itemMetaId, int itemCount)
{
var result = new Result();
var err_msg = string.Empty;
if (!MetaData.Instance._ItemTable.TryGetValue(itemMetaId, out var itemMetaData))
{
err_msg = $"Failed to TryGetValue() !!! : itemMetaId:{itemMetaId}";
result.setFail(ServerErrorCode.ItemMetaDataNotFound, err_msg);
Log.getLogger().error(result.toBasicString());
return result;
}
if (itemMetaData.Buy_Discount_Rate == 0)
return result;
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()}");
if (item_first_purchase_history_agent_action.isItemFirstPurchase(itemMetaId))
{
if (itemCount > 1)
{
err_msg = $"Fail to check item first purchased discount item count : purchase count - {itemCount}";
result.setFail(ServerErrorCode.ItemFirstPurchaseDiscountItemCountWrong, err_msg);
Log.getLogger().error(err_msg);
return result;
}
}
return result;
}
}
}

View File

@@ -0,0 +1,40 @@
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;
}
}
}