utils

package
v0.0.0-...-0f7ec88 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Auctions auction

Functions

func FindCommandByName

func FindCommandByName(commands []discord.ApplicationCommand, name string) discord.ApplicationCommand

HELPER FUNCTIONS

func GenerateNewCookieId

func GenerateNewCookieId() string

func GetRedirectForW

func GetRedirectForW(w string) (redirectUri string, err error)

func GetSessionFromContext

func GetSessionFromContext(c echo.Context) *models.AuthCookie

func Joinln

func Joinln(s ...string) string

func Optional

func Optional[K any](e K) *K

Types

type A

type A struct{}
var App A

func (A) DispatchNewAuction

func (A) DispatchNewAuction(app interfaces.App, auction *models.Auction)

func (A) DispatchNewBid

func (A) DispatchNewBid(app interfaces.App, bid *models.AuctionsBid)

func (A) DispatchNewListing

func (A) DispatchNewListing(app interfaces.App, listing *models.Listing)

func (A) DispatchRemoveAuction

func (A) DispatchRemoveAuction(app interfaces.App, auction *models.Auction)

func (A) DispatchRemoveListing

func (A) DispatchRemoveListing(app interfaces.App, listing *models.Listing)

func (A) DispatchRescheduleAuction

func (A) DispatchRescheduleAuction(app interfaces.App, auction *models.Auction)

func (A) DispatchUpdateAuction

func (A) DispatchUpdateAuction(app interfaces.App, auction *models.Auction)

func (A) SendDM

func (A) SendDM(app interfaces.App, to string, msg discord.MessageCreate)

type Card

type Card struct{}
var Cards Card

func (Card) FullString

func (card Card) FullString(c *models.Card) string

func (Card) GenerateStats

func (card Card) GenerateStats(c *models.Card) *models.CardsStat

func (Card) GetMeta

func (card Card) GetMeta(c *models.Card) *CardMetadata

func (Card) IconURI

func (card Card) IconURI(c *models.Card) string

func (Card) Message

func (Card) Primitive

func (Card) Primitive(c *models.Card) *cards.Card

func (Card) RarityString

func (card Card) RarityString(c *models.Card) (x string)

func (Card) RarityToColor

func (card Card) RarityToColor(c *models.Card) int

func (Card) SaveMeta

func (card Card) SaveMeta(c *models.Card, meta *CardMetadata)

func (Card) SetLocation

func (card Card) SetLocation(c *models.Card, location string)

type CardMetadata

type CardMetadata struct {
	Location string
}

type Event

type Event struct {
	// ID is used to set the EventSource object's last event ID value.
	ID []byte
	// Data field is for the message. When the EventSource receives multiple consecutive lines
	// that begin with data:, it concatenates them, inserting a newline character between each one.
	// Trailing newlines are removed.
	Data []byte
	// Event is a string identifying the type of event described. If this is specified, an event
	// will be dispatched on the browser to the listener for the specified event name; the website
	// source code should use addEventListener() to listen for named events. The onmessage handler
	// is called if no event name is specified for a message.
	Event []byte
	// Retry is the reconnection time. If the connection to the server is lost, the browser will
	// wait for the specified time before attempting to reconnect. This must be an integer, specifying
	// the reconnection time in milliseconds. If a non-integer value is specified, the field is ignored.
	Retry []byte
	// Comment line can be used to prevent connections from timing out; a server can send a comment
	// periodically to keep the connection alive.
	Comment []byte
}

Event represents Server-Sent Event. SSE explanation: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#event_stream_format

func (*Event) MarshalTo

func (ev *Event) MarshalTo(w io.Writer) error

MarshalTo marshals Event to given Writer

type Listener

type Listener struct {
	Response *echo.Response
}

type Listeners

type Listeners struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*Listeners) AddNewListener

func (l *Listeners) AddNewListener(id string, c echo.Context)

func (*Listeners) Broadcast

func (l *Listeners) Broadcast(e *Event)

func (*Listeners) RemoveListener

func (l *Listeners) RemoveListener(id string)

type Player

type Player struct{}
var Players Player

func (Player) AvailableBalance

func (Player) AvailableBalance(p *models.Player) int64

func (Player) AvailableCards

func (Player) AvailableCards(p *models.Player) []*models.Card

Replace with iterator with go1.23

func (Player) CalculateNextLevelXP

func (Player) CalculateNextLevelXP(p *models.Player) int64

func (Player) DeleteBoxFromPlayer

func (Player) DeleteBoxFromPlayer(p *models.Player, b *models.LootBox)

func (Player) GetAvailableCard

func (Player) GetAvailableCard(p *models.Player, i int) (*models.Card, bool)

func (Player) GetMarketAuction

func (Player) GetMarketAuction(p *models.Player, i int) (*models.Card, bool)

func (Player) GetMarketListing

func (Player) GetMarketListing(p *models.Player, i int) (*models.Card, bool)

func (Player) GiveXP

func (c Player) GiveXP(p *models.Player, given int64) (levelUp bool)

func (Player) LootBoxesCount

func (Player) LootBoxesCount(p *models.Player) map[models.LootBoxesType]int

func (Player) MarketAuctions

func (Player) MarketAuctions(p *models.Player) []*models.Card

func (Player) MarketListings

func (Player) MarketListings(p *models.Player) []*models.Card

func (Player) TakeFirstLootBoxOf

func (Player) TakeFirstLootBoxOf(p *models.Player, t models.LootBoxesType) (*models.LootBox, bool)

Jump to

Keyboard shortcuts

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