using LitJson;

namespace Wizard.Scripts.Network.Task.Arena.TwoPick;

public class ClassCharaChooseTask : BaseTask
{
	public class ArenaTwoPickClassCharaChooseTaskParam : BaseParam
	{
		public int class_id;
	}

	public ClassCharaChooseTask()
	{
		base.type = ApiType.Type.ArenaTwoPickClassCharaChoose;
	}

	public void SetParameter(int class_id)
	{
		ArenaTwoPickClassCharaChooseTaskParam arenaTwoPickClassCharaChooseTaskParam = new ArenaTwoPickClassCharaChooseTaskParam();
		arenaTwoPickClassCharaChooseTaskParam.class_id = class_id;
		base.Params = arenaTwoPickClassCharaChooseTaskParam;
	}

	protected override int Parse()
	{
		int num = base.Parse();
		if (num != 1)
		{
			return num;
		}
		JsonData jsonData = base.ResponseData["data"];
		Wizard.Data.TwoPickInfo.SetClassInfo(jsonData["class_info"]);
		Wizard.Data.TwoPickInfo.SetDeckInfo(jsonData["deck_info"]);
		Wizard.Data.TwoPickInfo.SetCandidateCardList(jsonData["candidate_card_list"]);
		return num;
	}
}
