mai

package
v0.0.0-...-64621da Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UniFontPath = maifont + "Montserrat-Bold.ttf"

	Root = transform.ReturnLucyMainDataIndex("maidx") + "resources/maimai/"
)

Functions

func BindFriendCode

func BindFriendCode(ctx *rei.Ctx, bindCode int64)

BindFriendCode Bind FriendCode To Users

func BindUserToMaimai

func BindUserToMaimai(ctx *rei.Ctx, bindName string)

BindUserToMaimai Bind UserMaiMaiID

func FullPageRender

func FullPageRender(data player, ctx *rei.Ctx) (raw image.Image)

FullPageRender Render Full Page

func GetChartType

func GetChartType(chart string) image.Image

GetChartType Get Chart Type

func GetCover

func GetCover(id string) (image.Image, error)

GetCover Careful The nil data

func GetCoverFromLxns

func GetCoverFromLxns(url string) (images image.Image, err error)

GetCoverFromLxns Get origin Cover From LXNS Service.

func GetCoverLxns

func GetCoverLxns(id string) (image.Image, error)

GetCoverLxns Careful The nil data

func GetDefaultPlate

func GetDefaultPlate(id string) (image.Image, error)

func GetRankPicRaw

func GetRankPicRaw(id int) (image.Image, error)

func GetRateStatusAndRenderToImage

func GetRateStatusAndRenderToImage(rank string) image.Image

GetRateStatusAndRenderToImage Get Rate

func GetShouldCount

func GetShouldCount(archivement float64) float64

func GetUserDefaultBackgroundDataFromDatabase

func GetUserDefaultBackgroundDataFromDatabase(userID int64) string

GetUserDefaultBackgroundDataFromDatabase Get Default Background.

func GetUserInfoNameFromDatabase

func GetUserInfoNameFromDatabase(userID int64) string

GetUserInfoNameFromDatabase GetUserName

func GetUserPlateInfoFromDatabase

func GetUserPlateInfoFromDatabase(userID int64) string

GetUserPlateInfoFromDatabase Get plate data

func GetUserSwitcherInfoFromDatabase

func GetUserSwitcherInfoFromDatabase(userid int64) bool

func HandlerUserSetsCustomImage

func HandlerUserSetsCustomImage(ctx *rei.Ctx, ps []tgba.PhotoSize)

HandlerUserSetsCustomImage Handle User Custom Image and Send To Local

func InitDataBase

func InitDataBase() error

func LoadComboImage

func LoadComboImage(imageName string) image.Image

LoadComboImage Load combo images

func LoadFontFace

func LoadFontFace(filePath string, size float64) font.Face

LoadFontFace load font face once before running, to work it quickly and save memory.

func LoadPictureWithResize

func LoadPictureWithResize(link string, w int, h int) image.Image

LoadPictureWithResize Load Picture

func LoadSyncImage

func LoadSyncImage(imageName string) image.Image

LoadSyncImage Load sync images

func MaimaiRenderBase

func MaimaiRenderBase(ctx *rei.Ctx, israw bool)

MaimaiRenderBase Render Base Maimai B50.

func MaimaiSwitcherService

func MaimaiSwitcherService(ctx *rei.Ctx)

MaimaiSwitcherService True == Lxns Service || False == Diving Fish Service.

func NoHeadLineCase

func NoHeadLineCase(word string) string

NoHeadLineCase No HeadLine.

func QueryMaiBotDataFromUserName

func QueryMaiBotDataFromUserName(username string) (playerdata []byte, err error)

func QueryReferSong

func QueryReferSong(Alias string, isLxnet bool) (status bool, id []int, needAcc bool, accInfoList [][]int)

QueryReferSong use LocalStorageData.

func ReCardRenderBase

func ReCardRenderBase(data LxnsMaimaiRequestDataPiece, getNum int, isSimpleRender bool) image.Image

ReCardRenderBase This Function is same as cardRender, but it convert for LXNS Network Maimai.

func ReFullPageRender

func ReFullPageRender(data LxnsMaimaiRequestB50, userData LxnsMaimaiRequestFromFriendCode, ctx *rei.Ctx) (image.Image, bool)

func RemoveUserLocalCustomImage

func RemoveUserLocalCustomImage(ctx *rei.Ctx)

RemoveUserLocalCustomImage Remove User Local Image.

func RenderCard

func RenderCard(data playerData, num int, isSimpleRender bool) image.Image

RenderCard Main Lucy Render Page , if isSimpleRender == true, then render count will not show here.

func Resize

func Resize(image image.Image, w int, h int) image.Image

Resize Image width height

func ReturnMaiIndexBackground

func ReturnMaiIndexBackground(returnInt int) image.Image

func SetUserDefaultPlateToDatabase

func SetUserDefaultPlateToDatabase(ctx *rei.Ctx, plateName string)

SetUserDefaultPlateToDatabase Set Default plateID To Database.

func SetUserPlateToLocal

func SetUserPlateToLocal(ctx *rei.Ctx, plateID string)

SetUserPlateToLocal Set Default Plate to Local

func UpdateAliasPackage

func UpdateAliasPackage()

UpdateAliasPackage Use simple action to update alias.

Types

type AliasesReturnValue

type AliasesReturnValue struct {
	Aliases []struct {
		DvId     int      `json:"dv_id"`
		SongName string   `json:"song_name"`
		SongId   []int    `json:"song_id"`
		Aliases  []string `json:"aliases"`
	} `json:"aliases"`
}

type DataHostSQL

type DataHostSQL struct {
	TelegramId int64  `db:"telegramid"` // telegramid
	Username   string `db:"username"`   // maimai user id ,query from this one.
	Plate      string `db:"plate"`      // plate
	Background string `db:"bg"`         // bg
}

func FormatUserDataBase

func FormatUserDataBase(tgid int64, plate string, bg string, username string) *DataHostSQL

func (*DataHostSQL) BindUserDataBase

func (info *DataHostSQL) BindUserDataBase() error

BindUserDataBase Bind Database only for DataHost Inline code.

type DivingFishB50UserName

type DivingFishB50UserName struct {
	Username string `json:"username"`
	B50      bool   `json:"b50"`
}

type DivingFishDevFullDataRecords

type DivingFishDevFullDataRecords struct {
	AdditionalRating int    `json:"additional_rating"`
	Nickname         string `json:"nickname"`
	Plate            string `json:"plate"`
	Rating           int    `json:"rating"`
	Records          []struct {
		Achievements float64 `json:"achievements"`
		Ds           float64 `json:"ds"`
		DxScore      int     `json:"dxScore"`
		Fc           string  `json:"fc"`
		Fs           string  `json:"fs"`
		Level        string  `json:"level"`
		LevelIndex   int     `json:"level_index"`
		LevelLabel   string  `json:"level_label"`
		Ra           int     `json:"ra"`
		Rate         string  `json:"rate"`
		SongId       int     `json:"song_id"`
		Title        string  `json:"title"`
		Type         string  `json:"type"`
	} `json:"records"`
	Username string `json:"username"`
}

func QueryDevDataFromDivingFish

func QueryDevDataFromDivingFish(username string) DivingFishDevFullDataRecords

type LxnsAliases

type LxnsAliases struct {
	Aliases []struct {
		SongId  int      `json:"song_id"`
		Aliases []string `json:"aliases"`
	} `json:"aliases"`
}

type LxnsMaimaiRequestB50

type LxnsMaimaiRequestB50 struct {
	Success bool   `json:"success"`
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		StandardTotal int `json:"standard_total"`
		DxTotal       int `json:"dx_total"`
		Standard      []struct {
			Id           int       `json:"id"`
			SongName     string    `json:"song_name"`
			Level        string    `json:"level"`
			LevelIndex   int       `json:"level_index"`
			Achievements float64   `json:"achievements"`
			Fc           *string   `json:"fc"`
			Fs           *string   `json:"fs"`
			DxScore      int       `json:"dx_score"`
			DxRating     float64   `json:"dx_rating"`
			Rate         string    `json:"rate"`
			Type         string    `json:"type"`
			UploadTime   time.Time `json:"upload_time"`
		} `json:"standard"`
		Dx []struct {
			Id           int       `json:"id"`
			SongName     string    `json:"song_name"`
			Level        string    `json:"level"`
			LevelIndex   int       `json:"level_index"`
			Achievements float64   `json:"achievements"`
			Fc           *string   `json:"fc"`
			Fs           *string   `json:"fs"`
			DxScore      int       `json:"dx_score"`
			DxRating     float64   `json:"dx_rating"`
			Rate         string    `json:"rate"`
			Type         string    `json:"type"`
			UploadTime   time.Time `json:"upload_time"`
		} `json:"dx"`
	} `json:"data"`
}

func RequestB50DataByFriendCode

func RequestB50DataByFriendCode(friendCode int64) LxnsMaimaiRequestB50

type LxnsMaimaiRequestDataPiece

type LxnsMaimaiRequestDataPiece struct {
	Id           int       `json:"id"`
	SongName     string    `json:"song_name"`
	Level        string    `json:"level"`
	LevelIndex   int       `json:"level_index"`
	Achievements float64   `json:"achievements"`
	Fc           *string   `json:"fc"`
	Fs           *string   `json:"fs"`
	DxScore      int       `json:"dx_score"`
	DxRating     float64   `json:"dx_rating"`
	Rate         string    `json:"rate"`
	Type         string    `json:"type"`
	UploadTime   time.Time `json:"upload_time"`
}

func DataPiecesRepacked

func DataPiecesRepacked(data LxnsMaimaiRequestB50, returnTypeIsSD bool, getShouldNum int) LxnsMaimaiRequestDataPiece

type LxnsMaimaiRequestFromFriendCode

type LxnsMaimaiRequestFromFriendCode struct {
	Success bool   `json:"success"`
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Name       string `json:"name"`
		Rating     int    `json:"rating"`
		FriendCode int64  `json:"friend_code"`
		Trophy     struct {
			Id    int    `json:"id"`
			Name  string `json:"name"`
			Color string `json:"color"`
		} `json:"trophy"`
		CourseRank int    `json:"course_rank"`
		ClassRank  int    `json:"class_rank"`
		Star       int    `json:"star"`
		IconUrl    string `json:"icon_url"`
		NamePlate  struct {
			Id   int    `json:"id"`
			Name string `json:"name"`
		} `json:"name_plate"`
		Frame struct {
			Id   int    `json:"id"`
			Name string `json:"name"`
		} `json:"frame"`
		UploadTime time.Time `json:"upload_time"`
	} `json:"data"`
}

func RequestBasicDataFromLxns

func RequestBasicDataFromLxns(friendcode int64) LxnsMaimaiRequestFromFriendCode

type LxnsMaimaiRequestUserReferBestSong

type LxnsMaimaiRequestUserReferBestSong struct {
	Success bool `json:"success"`
	Code    int  `json:"code"`
	Data    []struct {
		Id           int       `json:"id"`
		SongName     string    `json:"song_name"`
		Level        string    `json:"level"`
		LevelIndex   int       `json:"level_index"`
		Achievements float64   `json:"achievements"`
		Fc           *string   `json:"fc"`
		Fs           *string   `json:"fs"`
		DxScore      int       `json:"dx_score"`
		DxRating     float64   `json:"dx_rating"`
		Rate         string    `json:"rate"`
		Type         string    `json:"type"`
		UploadTime   time.Time `json:"upload_time"`
	} `json:"data"`
}

func RequestReferSong

func RequestReferSong(friendID int64, songID int64, isSD bool) LxnsMaimaiRequestUserReferBestSong

type LxnsMaimaiRequestUserReferBestSongIndex

type LxnsMaimaiRequestUserReferBestSongIndex struct {
	Success bool `json:"success"`
	Code    int  `json:"code"`
	Data    struct {
		Id           int       `json:"id"`
		SongName     string    `json:"song_name"`
		Level        string    `json:"level"`
		LevelIndex   int       `json:"level_index"`
		Achievements float64   `json:"achievements"`
		Fc           *string   `json:"fc"`
		Fs           *string   `json:"fs"`
		DxScore      int       `json:"dx_score"`
		DxRating     float64   `json:"dx_rating"`
		Rate         string    `json:"rate"`
		Type         string    `json:"type"`
		UploadTime   time.Time `json:"upload_time"`
	} `json:"data"`
}

func RequestReferSongIndex

func RequestReferSongIndex(friendID int64, songID int64, diff int64, isSD bool) LxnsMaimaiRequestUserReferBestSongIndex

type LxnsScoreUploader

type LxnsScoreUploader struct {
	Id           int         `json:"id"`
	Type         string      `json:"type"`
	LevelIndex   int         `json:"level_index"`
	Achievements float64     `json:"achievements"`
	Fc           interface{} `json:"fc"`
	Fs           interface{} `json:"fs"`
	DxScore      int         `json:"dx_score"`
	PlayTime     string      `json:"play_time"`
}

type LxnsSongListInfo

type LxnsSongListInfo struct {
	Songs []struct {
		Id           int    `json:"id"`
		Title        string `json:"title"`
		Artist       string `json:"artist"`
		Genre        string `json:"genre"`
		Bpm          int    `json:"bpm"`
		Version      int    `json:"version"`
		Difficulties struct {
			Standard []struct {
				Type         string  `json:"type"`
				Difficulty   int     `json:"difficulty"`
				Level        string  `json:"level"`
				LevelValue   float64 `json:"level_value"`
				NoteDesigner string  `json:"note_designer"`
				Version      int     `json:"version"`
			} `json:"standard"`
			Dx []struct {
				Type         string  `json:"type"`
				Difficulty   int     `json:"difficulty"`
				Level        string  `json:"level"`
				LevelValue   float64 `json:"level_value"`
				NoteDesigner string  `json:"note_designer"`
				Version      int     `json:"version"`
			} `json:"dx"`
		} `json:"difficulties"`
	} `json:"songs"`
	Genres []struct {
		Id    int    `json:"id"`
		Title string `json:"title"`
		Genre string `json:"genre"`
	} `json:"genres"`
	Versions []struct {
		Id      int    `json:"id"`
		Title   string `json:"title"`
		Version int    `json:"version"`
	} `json:"versions"`
}

type LxnsUploaderStruct

type LxnsUploaderStruct struct {
	Score []LxnsScoreUploader `json:"scores"`
}

type MappedListStruct

type MappedListStruct struct {
	DingFishId int      `json:"dv_id"`
	SongName   string   `json:"song_name"`
	SongId     []int    `json:"song_id"`
	Aliases    []string `json:"aliases"`
}

type UserIDToMaimaiFriendCode

type UserIDToMaimaiFriendCode struct {
	TelegramId int64 `db:"telegramid"`
	MaimaiID   int64 `db:"friendid"`
}

func FormatMaimaiFriendCode

func FormatMaimaiFriendCode(friendCode int64, tgid int64) *UserIDToMaimaiFriendCode

func GetUserMaiFriendID

func GetUserMaiFriendID(userid int64) UserIDToMaimaiFriendCode

func (*UserIDToMaimaiFriendCode) BindUserFriendCode

func (info *UserIDToMaimaiFriendCode) BindUserFriendCode() error

type UserSwitcherService

type UserSwitcherService struct {
	TGId   int64 `db:"tgid"`
	IsUsed bool  `db:"isused"` // true == lxns service \ false == Diving Fish.
}

func FormatUserSwitcher

func FormatUserSwitcher(tgid int64, isSwitcher bool) *UserSwitcherService

func (*UserSwitcherService) ChangeUserSwitchInfoFromDataBase

func (info *UserSwitcherService) ChangeUserSwitchInfoFromDataBase() error

Jump to

Keyboard shortcuts

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