global

package
v0.0.0-...-44a0b5b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogWriterCleanupKey = "logWriter"

	WebsiteTitle          = "lol.buffge.com"
	AdaptChatWebsiteTitle = "我的眼里都是你"
	AppName               = "lol对局先知"
)

Variables

View Source
var (
	DefaultClientConf = conf.Client{
		AutoAcceptGame:                 false,
		AutoPickChampID:                0,
		AutoBanChampID:                 0,
		AutoSendTeamHorse:              true,
		ShouldSendSelfHorse:            true,
		HorseNameConf:                  [6]string{"通天代", "小代", "上等马", "中等马", "下等马", "牛马"},
		ChooseSendHorseMsg:             [6]bool{true, true, true, true, true, true},
		ChooseChampSendMsgDelaySec:     3,
		ShouldInGameSaveMsgToClipBoard: true,
		ShouldAutoOpenBrowser:          &defaultShouldAutoOpenBrowserCfg,
	}
	DefaultAppConf = conf.AppConf{
		Mode: conf.ModeProd,
		Sentry: conf.SentryConf{
			Enabled: true,
			Dsn:     sentryDsn,
		},
		PProf: conf.PProfConf{
			Enable: true,
		},
		Log: conf.LogConf{
			Level:    logger.LevelInfoStr,
			Filepath: defaultLogPath,
		},
		BuffApi: conf.BuffApi{
			Url:     buffApiUrl,
			Timeout: 3,
		},
		CalcScore: conf.CalcScoreConf{
			Enabled:            true,
			FirstBlood:         [2]float64{10, 5},
			PentaKills:         [1]float64{20},
			QuadraKills:        [1]float64{10},
			TripleKills:        [1]float64{5},
			JoinTeamRateRank:   [4]float64{10, 5, 5, 10},
			GoldEarnedRank:     [4]float64{10, 5, 5, 10},
			HurtRank:           [2]float64{10, 5},
			Money2hurtRateRank: [2]float64{10, 5},
			VisionScoreRank:    [2]float64{10, 5},
			MinionsKilled: [][2]float64{
				{10, 20},
				{9, 10},
				{8, 5},
			},
			KillRate: []conf.RateItemConf{
				{Limit: 50, ScoreConf: [][2]float64{
					{15, 40},
					{10, 20},
					{5, 10},
				}},
				{Limit: 40, ScoreConf: [][2]float64{
					{15, 20},
					{10, 10},
					{5, 5},
				}},
			},
			HurtRate: []conf.RateItemConf{
				{Limit: 40, ScoreConf: [][2]float64{
					{15, 40},
					{10, 20},
					{5, 10},
				}},
				{Limit: 30, ScoreConf: [][2]float64{
					{15, 20},
					{10, 10},
					{5, 5},
				}},
			},
			AssistRate: []conf.RateItemConf{
				{Limit: 50, ScoreConf: [][2]float64{
					{20, 30},
					{18, 25},
					{15, 20},
					{10, 10},
					{5, 5},
				}},
				{Limit: 40, ScoreConf: [][2]float64{
					{20, 15},
					{15, 10},
					{10, 5},
					{5, 3},
				}},
			},
			AdjustKDA: [2]float64{2, 5},
			Horse: [6]conf.HorseScoreConf{
				{Score: 180, Name: "通天代"},
				{Score: 150, Name: "小代"},
				{Score: 125, Name: "上等马"},
				{Score: 105, Name: "中等马"},
				{Score: 95, Name: "下等马"},
				{Score: 0.0001, Name: "牛马"},
			},
			MergeMsg: false,
		},
	}

	Conf         = new(conf.AppConf)
	ClientConf   = new(conf.Client)
	Logger       *zap.SugaredLogger
	Cleanups     = make(map[string]func() error)
	AppBuildInfo = AppInfo{}
)
View Source
var (
	SqliteDB *gorm.DB
)

DB

Functions

func Cleanup

func Cleanup()

func GetClientConf

func GetClientConf() conf.Client

func GetEnv

func GetEnv() conf.Mode

func GetScoreConf

func GetScoreConf() conf.CalcScoreConf

func IsDevMode

func IsDevMode() bool

func SetAppInfo

func SetAppInfo(info AppInfo)

func SetClientConf

func SetClientConf(cfg conf.UpdateClientConfReq) *conf.Client

func SetScoreConf

func SetScoreConf(scoreConf conf.CalcScoreConf)

func SetUserInfo

func SetUserInfo(info UserInfo)

Types

type AppInfo

type AppInfo struct {
	Version   string
	Commit    string
	BuildUser string
	BuildTime string
}

type UserInfo

type UserInfo struct {
	IP string `json:"ip"`
}

func GetUserInfo

func GetUserInfo() UserInfo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL