local this = {}

function this.socket_10000(data, errorCode)
  if errorCode ~= L_Const.errorCode.ErrCodeSucc then
    return
  end
  L_BattleStore:rsp_createBattle(data)
  local status = L_UI:getPageStatus("pageFormationMain")
  if status == "shown" then
    L_UI:close("pageFormationMain")
  end
  L_AttributeManager:analyseResponse10000(data)
end

function this.socket_10003(data, errorcode)
  L_BattleStore:rsp_finHandle(data)
end

function this.socket_10004(data, errorcode)
  local data = {
    res = 0,
    item_id = data and data.u32 or 0
  }
  L_BattleStore:rsp_finHandle(data)
end

function this.scoket_10005(data, errorCode)
  L_BattleStore:rsp_syncBattleHeroInfo(data, errorCode)
end

function this.socket_10708(data, errorCode)
  if errorCode ~= L_Const.errorCode.ErrCodeSucc then
    return
  end
  L_BattleStore:rsp_syncObjBattleInfoByHurt(data)
end

function this.socket_10713(data, errorCode)
  L_BattleStore:rsp_fightFinish(data, errorCode)
end

function this.socket_10729(data, errorCode)
  local itemList = data.rewards and data.rewards.rewards
  if table.isEmpty(itemList) then
    return
  end
  if data.reason == L_Const.FightRewardReason.FRR_Catch then
    L_BattleStore:setCatchReward(itemList)
  else
    L_BattleStore:setBattleReward(itemList)
    L_RewardManager:showBattlePage()
  end
end

return this
