package cmd

import (
	"fmt"
	"gadmin/internal/antiCheating"
	"github.com/spf13/cobra"
	"time"
)

var antiCheatingCmd = &cobra.Command{
	Use:   "antiCheating",
	Short: "",
	Long: `防作弊数据分析
		1. 获取玩家信息
			1.1 获取玩家游戏角色卡信息
			1.2 获取角色卡技能等级
		2.获取战斗数据
		3.计算伤害
		4.将异常伤害数据及玩家信息保存
秦天明：initDps * 技能倍率 * 克制系数.`,
	Args: cobra.MaximumNArgs(1),
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("antiCheating")
		now := time.Now()
		yearMonth := now.Format("200601")
		fmt.Printf("args:%v", args)
		if len(args) != 0 && args[0] != "" {
			_, err := time.Parse("200601", yearMonth)
			if err != nil {
				return
			}
			yearMonth = args[0]
		}
		combat := antiCheating.NewCombat(antiCheating.WithYearMonth(yearMonth))
		combat.Run()
	},
}

func init() {
	rootCmd.AddCommand(antiCheatingCmd)
}
