using Wizard.Scripts.Network.Data.TaskData.Arena;

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

public class TwoPickFinishBattleTask : FinishTaskBase
{
	public TwoPickFinishBattleTask()
	{
		base.type = ApiType.Type.ArenaTwoPickFinishBattle;
		if (GameMgr.GetIns().GetDataMgr().TwoPickFormat == TwoPickFormat.Chaos)
		{
			base.type = ApiType.Type.ArenaTwoPickChaosFinishBattle;
		}
		if (GameMgr.GetIns().GetDataMgr().TwoPickFormat == TwoPickFormat.Cube)
		{
			base.type = ApiType.Type.ArenaTwoPickCubeFinishBattle;
		}
		Wizard.Data.ArenaBattleFinish = null;
	}

	protected override int Parse()
	{
		int num = base.Parse();
		if (IsEffectiveErrorCode(num))
		{
			return num;
		}
		Wizard.Data.ArenaBattleFinish = new Finish();
		if (!IsResponseDataExist(base.ResponseData))
		{
			return num;
		}
		new BattleFinishResponsProcessing().Processing(base.ResponseData, Wizard.Data.ArenaBattleFinish.data);
		return num;
	}
}
