package com.td.WaDa.util;

import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import com.td.WaDa.game.excelcharacterattri.pojo.ExcelCharacterAttri;
import com.td.WaDa.game.excelcharacterattri.vo.ExcelCharacterAttriVo;
import com.td.WaDa.game.exceldrop.vo.ExcelDropSimpleVo;
import com.td.WaDa.game.exceldrop.vo.ExcelDropVo;
import com.td.WaDa.game.excelprop.vo.ExcelPropVo;
import com.td.WaDa.game.excelscene.vo.ExcelSceneVo;
import lombok.extern.slf4j.Slf4j;

import java.io.InputStream;
import java.util.List;

/**
 * Excel对应实体类型工具类
 */
@Slf4j
public class ExcelDataUtil {

    /**
     * 设置角色属性
     */
    public static List<ExcelCharacterAttriVo>  setCharacterAttributes(ExcelReader excelReader){
        excelReader.addHeaderAlias("角色种类","roleType")
                .addHeaderAlias("初始力量下限","startPowerLimitLower")
                .addHeaderAlias("初始力量上限","startPowerLimitUpper")
                .addHeaderAlias("初始智慧下限","startWisdomLimitLower")
                .addHeaderAlias("初始智慧上限","startWisdomLimitUpper")
                .addHeaderAlias("初始技巧下限","startSkillLimitLower")
                .addHeaderAlias("初始技巧上限","startSkillLimitUpper")
                .addHeaderAlias("属性随机值","randomAttr")
                .addHeaderAlias("职业","professional")
                .addHeaderAlias("携带动作","action")
                .addHeaderAlias("互动事件","interactive")
                .addHeaderAlias("备注","note");
        return excelReader.read(1,3,ExcelCharacterAttriVo.class);
    }

    /**
     * 设置场景excel
     */
    public static List<ExcelSceneVo>  setScene(ExcelReader excelReader){
        //场景序号	场景种类	场景组编号	场景等级	art编号	场景掉落id	消耗体力	工作时间	进入基础概率	运输基础数量
        excelReader.addHeaderAlias("场景序号","sceneId")
                .addHeaderAlias("场景种类","sceneType")
                .addHeaderAlias("场景组编号","sceneGroup")
                .addHeaderAlias("场景等级","sceneLevel")
                .addHeaderAlias("art编号","sceneResources")
                .addHeaderAlias("场景掉落id","sceneEvent")
                .addHeaderAlias("消耗体力","physicalStrength")
                .addHeaderAlias("工作时间","timeLimit")
                .addHeaderAlias("进入基础概率","probability")
                .addHeaderAlias("运输基础数量","amount")
                .addHeaderAlias("备注","note");
        return excelReader.read(1,3,ExcelSceneVo.class);
    }

    public static List<ExcelPropVo>  setProp(ExcelReader excelReader){
        //序号	物品类型	等级	名称	图标	模型	描述	堆叠上限	备注
        excelReader.addHeaderAlias("序号","propId")
                .addHeaderAlias("物品类型","itemType")
                .addHeaderAlias("等级","itemLevel")
                .addHeaderAlias("名称","name")
                .addHeaderAlias("图标","icon")
                .addHeaderAlias("模型","model")
                .addHeaderAlias("描述","tips")
                .addHeaderAlias("堆叠上限","overlap")
                .addHeaderAlias("备注","note");
        return excelReader.read(1,3,ExcelPropVo.class);
    }

    public static List<ExcelDropVo>  setDrop(ExcelReader excelReader){
        //掉落编号	组掉落方式	掉落组编号	组掉落概率	组掉落上下限	组掉落方式	组掉落	非组物品方式	物品掉落	物品与数量	备注
        excelReader.addHeaderAlias("掉落编号","dropId")
                .addHeaderAlias("组掉落方式","dropType")
                .addHeaderAlias("掉落组编号","dropGroup")
                .addHeaderAlias("组掉落概率","dropGroupPro")
                .addHeaderAlias("组掉落上下限","dropGroupLimit")
                .addHeaderAlias("组掉落方式","dropGroupWay")
                .addHeaderAlias("组掉落","groupDrop")
                .addHeaderAlias("非组物品方式","dropWay")
                .addHeaderAlias("物品掉落","drop")
                .addHeaderAlias("物品与数量","item")
                .addHeaderAlias("备注","note");
        return excelReader.read(1,3,ExcelDropVo.class);
    }
}
