contest

package
v0.0.0-...-64c21b7 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: BSD-2-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetContests                 = `SELECT contest_id, open_time, close_time, english_name, status, has_thumbnail, has_special_award, has_souvenir FROM contests`
	SetContestStatus            = `UPDATE contests SET status = $1 WHERE contest_id = $2`
	EditContestEndTimeAndStatus = `UPDATE contests SET status = $1, close_time = $2 WHERE contest_id = $3`
	GetContestMiis              = `SELECT artisan_id, mii_data FROM contest_miis WHERE contest_id = $1`
	GetContestTraits            = `` /* 154-byte string literal not displayed */
	GetNumberOfContestMiis      = `SELECT COUNT(*) FROM contest_miis WHERE contest_id = $1`
	GetContestThumbnailStatus   = `SELECT has_thumbnail, has_special_award, has_souvenir FROM contests WHERE contest_id = $1`
	UpdateContestMiiLikes       = `` /* 270-byte string literal not displayed */

	GetContestMiiLikes = `SELECT entry_id FROM contest_miis WHERE contest_id = $1 ORDER BY likes`
	UpdateMiiRank      = `UPDATE contest_miis SET rank = $1 WHERE entry_id = $2`
	GetBestContestMiis = `` /* 333-byte string literal not displayed */

)

Variables

View Source
var (
	ContestPosting = func(theme string) string {
		return fmt.Sprintf("*******************************\r\nA New Contest is Under Way\r\n*******************************\r\n\r\nCare to test your Mii-making skills\r\nby designing a Mii on a particular\r\ntheme?\r\n\r\n\u25c6Contest Theme:\r\n%s\r\n\r\n\u25c6How to Submit an Entry\r\n1. Design a Mii in the Mii\r\n   Channel.\r\n2. Go to the Check Mii Out\r\n   Channel and submit your Mii.\r\n\r\n\r\nP.S. Check out https://miicontest.wiilink.ca,\r\nit's the official companion website\r\nfor the Check Mii Out Channel!\r\n\r\n\r\n----------------------------------\r\nThis message is regarding the\r\nCheck Mii Out Channel.\r\n\r\nIf you do not wish to receive further\r\ncommercial messages from WiiLink,\r\nplease click the opt-out icon on the \r\nupper-right corner of the screen.\r\n\r\nYou can opt out of either (1) \r\nmessages for the Check Mii Out\r\nChannel only or (2) all messages for\r\nall channels and games.", theme)
	}

	ContestJudging = func(theme string) string {
		return fmt.Sprintf("*******************************\r\nCome and Judge a Contest\r\n*******************************\r\n\r\nCome over to the Check Mii Out\r\nChannel and judge a few Miis\r\nfor a contest.\r\n\r\n\u25c6Contest Theme:\r\n%s\r\n\r\n\r\nP.S. Check out https://miicontest.wiilink.ca,\r\nit's the official companion website\r\nfor the Check Mii Out Channel!\r\n\r\n\r\n----------------------------------\r\n\r\n\r\nThis message is regarding the\r\nCheck Mii Out Channel.\r\n\r\nIf you do not wish to receive further\r\ncommercial messages from WiiLink,\r\nplease click the opt-out icon on the \r\nupper-right corner of the screen.\r\n\r\nYou can opt out of either (1) \r\nmessages for the Check Mii Out\r\nChannel only or (2) all messages for\r\nall channels and games.", theme)
	}

	ContestResults = func(theme string) string {
		return fmt.Sprintf("*******************************\r\nContest Results\r\n*******************************\r\n\r\nWe've tallied up all the votes, and\r\nthe winners for this contest have\r\nbeen decided!\r\n\r\n\u25c6Contest Theme:\r\n%s\r\n\r\n\r\nP.S. Check out https://miicontest.wiilink.ca,\r\nit's the official companion website\r\nfor the Check Mii Out Channel!\r\n\r\n\r\n----------------------------------\r\nThis message is regarding the\r\nCheck Mii Out Channel.\r\n\r\nIf you do not wish to receive further\r\ncommercial messages from WiiLink,\r\nplease click the opt-out icon on the \r\nupper-right corner of the screen.\r\n\r\nYou can opt out of either (1) \r\nmessages for the Check Mii Out\r\nChannel only or (2) all messages for\r\nall channels and games.", theme)
	}
)

Functions

func GetMessageForStatus

func GetMessageForStatus(status ContestStatus, theme string) string

func MakeBestList

func MakeBestList(pool *pgxpool.Pool, ctx context.Context, contestId uint32) error

func MakeContestDetailFile

func MakeContestDetailFile(detail *ContestDetail) error

func MakeContestInfos

func MakeContestInfos(pool *pgxpool.Pool, ctx context.Context) error

func MakeContestMail

func MakeContestMail(contests []*ContestDetail, languageCode uint32) error

func MakeEntryLists

func MakeEntryLists(pool *pgxpool.Pool, ctx context.Context, contestId uint32) error

func MakePhoto

func MakePhoto(photoType common.ListTag, data []byte, contestId uint32) error

func MakeSpecialList

func MakeSpecialList(pool *pgxpool.Pool, ctx context.Context, contestId uint32) error

Types

type BestList

type BestList struct {
	Header BestListHeader
	Miis   []BestListMiiPair
}

func (BestList) ToBytes

func (b BestList) ToBytes(_ any) []byte

type BestListArtisan

type BestListArtisan struct {
	Tag            common.ListTag
	TagSize        uint16
	ArtisanIndex   uint32
	ArtisanNumber  uint32
	MiiArtisanData [76]byte

	IsMasterMiiArtisan uint8

	CountryCode uint8
	MiiIndex    uint16
	// contains filtered or unexported fields
}

type BestListHeader

type BestListHeader struct {
	Tag common.ListTag

	ContestId uint32

	Padding        [4]byte
	ContestTag     common.ListTag
	ContestTagSize uint16
	Unknown        uint32
	NumberOfMiis   uint32
	// contains filtered or unexported fields
}

type BestListMii

type BestListMii struct {
	Tag         common.ListTag
	TagSize     uint16
	MiiIndex    uint32
	EntryNumber uint32
	MiiData     [76]byte
}

type BestListMiiPair

type BestListMiiPair struct {
	Mii     BestListMii
	Artisan BestListArtisan
}

type Contest

type Contest struct {
	Type         common.ListTag
	Size         uint16
	ContestIndex uint32
	ContestID    uint32
	Status       ContestStatus
	Options      uint8
	// contains filtered or unexported fields
}

type ContestDetail

type ContestDetail struct {
	Tag common.ListTag

	ContestID uint32
	Language  uint32

	StartTimestamp uint32
	EndTimestamp   uint32
	Padding        [4]byte
	CDTag          common.ListTag
	TagSize        uint16
	Unknown2       uint32
	ContestID2     uint32
	Status         ContestStatus
	Options        Option

	EntryCount  uint32
	Padding2    [20]byte
	Topic       [32]byte
	Description [64]byte
	// contains filtered or unexported fields
}

ContestDetail contains the metadata for contest.

func MakeContestDetailData

func MakeContestDetailData(pool *pgxpool.Pool, ctx context.Context, contestId uint32, startTime, endTime *time.Time, description string, status ContestStatus) (*ContestDetail, error)

func (ContestDetail) ToBytes

func (c ContestDetail) ToBytes(data any) []byte

type ContestInfo

type ContestInfo struct {
	Header   ContestInfoHeader
	Contests []Contest
}

ContestInfo is the complete structure of con_info.ces.

func (ContestInfo) ToBytes

func (c ContestInfo) ToBytes(_ any) []byte

type ContestInfoHeader

type ContestInfoHeader struct {
	Type common.ListTag

	CountryGroup uint32
	ListNumber   uint32
	ErrorCode    uint32

	Padding [4]byte
	// contains filtered or unexported fields
}

type ContestMiiEntry

type ContestMiiEntry struct {
	Type      common.ListTag
	TagSize   uint16
	MiiIndex  uint32
	ArtisanId uint32
	MiiData   [76]byte
}

type ContestStatus

type ContestStatus uint8

ContestStatus is the value of a contest state.

const (
	COpen    ContestStatus = 2 << 0
	CJudging ContestStatus = 2 << 2
	CResults ContestStatus = 2 << 4
	// CCLosed is not used in the channel, rather as a state to not generate a contest file.
	CCLosed ContestStatus = 2 << 6
)

func DatabaseStatusToContestStatus

func DatabaseStatusToContestStatus(status DatabaseStatus) ContestStatus

type DatabaseStatus

type DatabaseStatus string

DatabaseStatus are the states in which a contest can be in within the database.

const (
	Waiting DatabaseStatus = "waiting"
	Open    DatabaseStatus = "open"
	Judging DatabaseStatus = "judging"
	Results DatabaseStatus = "results"
	Closed  DatabaseStatus = "closed"
)

type EntryInfo

type EntryInfo struct {
	Header            EntryInfoHeader
	ContestMiiEntries []ContestMiiEntry
}

func (EntryInfo) ToBytes

func (c EntryInfo) ToBytes(_ any) []byte

type EntryInfoHeader

type EntryInfoHeader struct {
	Type common.ListTag

	ContestId  uint32
	ListNumber uint32
	ErrorCode  uint32

	Padding [4]byte
	// contains filtered or unexported fields
}

type Option

type Option uint8

Option are the multiple options that a contest can have.

const (
	Worldwide        Option = 1 << 0
	Thumbnail        Option = 1 << 1
	Souvenir         Option = 1 << 2
	NicknameChanging Option = 1 << 3
	SpecialAward     Option = 1 << 4
)

type Photo

type Photo struct {
	Header PhotoHeader
	Data   []byte
}

func (Photo) ToBytes

func (t Photo) ToBytes(_ any) []byte

type PhotoHeader

type PhotoHeader struct {
	Type common.ListTag

	ContestId uint32

	Padding      [8]byte
	ThumbnailTag common.ListTag
	TagSize      uint16
	Unknown      uint32
	// contains filtered or unexported fields
}

type SpecialList

type SpecialList struct {
	Header SpecialListHeader
	Miis   []SpecialListMiiPair
}

func (SpecialList) ToBytes

func (s SpecialList) ToBytes(_ any) []byte

type SpecialListArtisan

type SpecialListArtisan struct {
	Tag            common.ListTag
	TagSize        uint16
	ArtisanIndex   uint32
	ArtisanNumber  uint32
	MiiArtisanData [76]byte

	IsMasterMiiArtisan uint8

	CountryCode uint8
	MiiIndex    uint16
	// contains filtered or unexported fields
}

type SpecialListHeader

type SpecialListHeader struct {
	Tag common.ListTag

	ContestId uint32

	Padding        [4]byte
	ContestTag     common.ListTag
	ContestTagSize uint16
	Unknown        uint32
	NumberOfMiis   uint32
	// contains filtered or unexported fields
}

type SpecialListMii

type SpecialListMii struct {
	Tag         common.ListTag
	TagSize     uint16
	MiiIndex    uint32
	EntryNumber uint32
	MiiData     [76]byte
}

type SpecialListMiiPair

type SpecialListMiiPair struct {
	Mii     SpecialListMii
	Artisan SpecialListArtisan
}

Jump to

Keyboard shortcuts

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