package com.td.Dawa.util;

import cn.hutool.poi.excel.ExcelReader;
import com.td.Dawa.game.excelcharacterattri.vo.ExcelCharacterAttriVo;
import com.td.Dawa.game.excelcharactercolor.vo.ExcelCharacterColorVo;
import com.td.Dawa.game.excelcharactercreate.vo.ExcelCharacterCreateVo;
import com.td.Dawa.game.excelcharacterlevel.vo.ExcelCharacterLevelVo;
import com.td.Dawa.game.exceldrop.vo.ExcelDropVo;
import com.td.Dawa.game.excelparameter.vo.ExcelParameterVo;
import com.td.Dawa.game.excelprop.vo.ExcelPropVo;
import com.td.Dawa.game.excelresources.vo.ExcelResourcesVo;
import com.td.Dawa.game.excelscene.vo.ExcelSceneVo;
import com.td.Dawa.game.excelworkpro.pojo.ExcelWorkPro;
import com.td.Dawa.game.excelworkpro.vo.ExcelWorkProVo;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

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

    /**
     * 角色升级
     */
    public static List<ExcelCharacterLevelVo>  setCharacterLevel(ExcelReader excelReader){
        excelReader.addHeaderAlias("等级序号","id")
                .addHeaderAlias("角色种类","roleType")
                .addHeaderAlias("升级","exp")
                .addHeaderAlias("力量","power")
                .addHeaderAlias("技巧","skill")
                .addHeaderAlias("智力","intelligence")
                .addHeaderAlias("属性分配点","randomAttr")
                .addHeaderAlias("备注","note");
        return excelReader.read(1,3,ExcelCharacterLevelVo.class);
    }
    /**
     * 角色生成
     */
    public static List<ExcelCharacterCreateVo>  setCharacterCreate(ExcelReader excelReader){
        excelReader
                .addHeaderAlias("id序号","id")
                .addHeaderAlias("部位id","position")
                .addHeaderAlias("模型","model")
                .addHeaderAlias("颜色区间","color")
                .addHeaderAlias("权重","weight")
                .addHeaderAlias("备注","note");
        return excelReader.read(1,3,ExcelCharacterCreateVo.class);
    }

    /**
     * 设置角色属性
     */
    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);
    }

    /**
     * 设置角色颜色
     * @param excelReader
     * @return
     */
    public static List<ExcelCharacterColorVo>  setCharacterColor(ExcelReader excelReader){

                //.addHeaderAlias("A","a")
                //.addHeaderAlias("备注","note")
        excelReader.addHeaderAlias("ID","id")
                .addHeaderAlias("R","r")
                .addHeaderAlias("G","g")
                .addHeaderAlias("B","b")
                .addHeaderAlias("Type","type");
        return excelReader.read(0,1,ExcelCharacterColorVo.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("获得花种概率","determine")
                .addHeaderAlias("花种概率","flowers")
                .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("携带效果","effect")
                .addHeaderAlias("是否可使用","employ")
                .addHeaderAlias("使用效果","result")
                .addHeaderAlias("堆叠上限","overlap")
                .addHeaderAlias("备注","note");
        return excelReader.read(1,3,ExcelPropVo.class);
    }

    public static List<ExcelWorkProVo>  setWorkPro(ExcelReader excelReader){
        //职业id	属性参数	属性值	可获得道具概率	获得道具	道具概率	运输格数	勘探层数	进入概率	货币概率	备注
         excelReader.addHeaderAlias("职业id","professionalType")
                .addHeaderAlias("属性参数","parameter")
                .addHeaderAlias("属性值","attribute")
                .addHeaderAlias("可获得道具概率","probability")
                .addHeaderAlias("获得道具","levelItem")
                .addHeaderAlias("道具概率","levelPro")
                .addHeaderAlias("运输格数","transport")
                .addHeaderAlias("勘探层数","exploration")
                .addHeaderAlias("进入概率","enterPro")
                .addHeaderAlias("货币概率","currency")
                .addHeaderAlias("备注","note");
        return excelReader.read(1,3, ExcelWorkProVo.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("物品掉落","dropItem")
                .addHeaderAlias("物品与数量","itemNum")
                .addHeaderAlias("备注","note");
        return excelReader.read(1,3,ExcelDropVo.class);
    }



    public static List<ExcelResourcesVo>  setResource(ExcelReader excelReader){
        //掉落编号	组掉落方式	掉落组编号	组掉落概率	组掉落上下限	组掉落方式	组掉落	非组物品方式	物品掉落	物品与数量	备注
        excelReader.addHeaderAlias("art编号","artId")
                .addHeaderAlias("美术资源种类","artType")
                .addHeaderAlias("美术资源名","artName")
                .addHeaderAlias("帧数","artActionFrame")
                .addHeaderAlias("资源位置","artLocal")
                .addHeaderAlias("备注","note");
        return excelReader.read(1,3,ExcelResourcesVo.class);
    }


    //设置excel 参数表字段
    public static List<ExcelParameterVo>  setParameter(ExcelReader excelReader){
        //
        excelReader.addHeaderAlias("参数id","id")
                .addHeaderAlias("参数","parameter")
                .addHeaderAlias("数值","value")
                .addHeaderAlias("备注","note");
        return excelReader.read(1,3,ExcelParameterVo.class);
    }
}
