using System.Collections.Generic;
using LitJson;

namespace Wizard;

public class CrossoverReceiveRankRewardTask : BaseTask
{
	private class QuestRewardReceiveTaskParam : BaseParam
	{
		public int reward_id;
	}

	public List<ReceivedReward> ReceivedRewardList { get; private set; }

	public CrossoverReceiveRankRewardTask()
	{
		base.type = ApiType.Type.CrossoverReceiveRankReward;
	}

	public void SetParameter(int rewardId)
	{
		QuestRewardReceiveTaskParam questRewardReceiveTaskParam = new QuestRewardReceiveTaskParam
		{
			reward_id = rewardId
		};
		base.Params = questRewardReceiveTaskParam;
	}

	protected override int Parse()
	{
		int num = base.Parse();
		if (num != 1)
		{
			return num;
		}
		JsonData jsonData = base.ResponseData["data"];
		ReceivedRewardList = new List<ReceivedReward>();
		JsonData jsonData2 = jsonData["total_receive_count_list"];
		for (int i = 0; i < jsonData2.Count; i++)
		{
			ReceivedRewardList.Add(new ReceivedReward(jsonData2[i]));
		}
		PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(jsonData["reward_list"]);
		return num;
	}
}
