package faceCfg

import (
	"server/gamedata"
	"server/pkg/github.com/name5566/leaf/log"
	"strconv"
)

const (
	CFG_FACE = "Face"
)

func init() {
	gamedata.InitCfg(CFG_FACE)
}

func GetInitList() []int {
	data, err := gamedata.GetData(CFG_FACE)
	if err != nil {
		log.Debug("GetInitList err: %v", err)
		return nil
	}
	r := make([]int, 0)
	for k, v := range data {
		IsInit := gamedata.GetIntValue(v, "Init")
		if IsInit == 1 {
			k, _ := strconv.Atoi(k)
			r = append(r, k)
		}
	}
	return r
}

func CheckExist(Id int) bool {
	data, err := gamedata.GetData(CFG_FACE)
	if err != nil {
		log.Debug("CheckExist err: %v", err)
		return false
	}
	_, ok := data[strconv.Itoa(Id)]
	return ok
}
