초기커밋
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user