objects

package
v0.0.0-...-f1ee361 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2018 License: MIT Imports: 12 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CHANNELS []*Channel

CHANNELS Global Variable

View Source
var LOBBYS []*Lobby
View Source
var LobbyLock *sync.Mutex
View Source
var STREAMS []*Stream
View Source
var TOKENS []*Token

TOKENS Global Variable for Token array.

Functions

func DeleteOldTokens

func DeleteOldTokens(userid uint32)

func DeleteStream

func DeleteStream(streamname string)

func DeleteToken

func DeleteToken(token string)

DeleteToken deletes the given Token (String) from our TOKENS Array.

func GetLobbys

func GetLobbys(t *Token)

func HasChannelPermission

func HasChannelPermission(channelname string, t *Token) bool

func JoinChannel

func JoinChannel(channelname string, t *Token) bool

JoinChannel add a User to the Defined channel. returns bool, if Successfull return true else false

func JoinLobby

func JoinLobby(l *Lobby, password string, t *Token)

func LeaveChannel

func LeaveChannel(channelname string) bool

LeaveChannel remove a User from the Defined channel. returns bool, if Successfull return true else false

func LeaveLobby

func LeaveLobby(t *Token)

func NewLobbyC

func NewLobbyC(l *Lobby, t *Token)

func RemoveLobby

func RemoveLobby(ID uint16)

func TokenExists

func TokenExists(token string) bool

TokenExists return a boolean, true if exists else false

func UpdateMatch

func UpdateMatch(l *Lobby)

func WriteLobby

func WriteLobby(l *Lobby, h bool) []byte

Types

type Channel

type Channel struct {
	CInfo    ChannelInfoAnswer
	CPerm    ChannelPermissions
	AutoJoin bool
}

func GetChannel

func GetChannel(channelname string) *Channel

GetChannel returns an Channel object, if not exists return nil

type ChannelInfo

type ChannelInfo struct {
	ChannelName        string
	ChannelDescription string
}

type ChannelInfoAnswer

type ChannelInfoAnswer struct {
	ChannelName        string
	ChannelDescription string
	UserCount          int16
}

type ChannelPermissions

type ChannelPermissions struct {
	AdminOnly bool
	ReadOnly  bool
	WriteOnly bool
}

type Lobby

type Lobby struct {
	ID          uint16
	Running     bool
	Type        byte
	Mods        uint32
	Name        string
	Password    string
	BeatmapName string
	BeatmapID   uint32
	BeatmapMD5  string
	Slots       [16]LobbySlot
	Host        uint32
	PlayMode    byte
	ScoreType   byte
	TeamType    byte
	FreeMods    byte
	Seed        uint32 // or random number, idk.
}

func GetLobby

func GetLobby(ID uint16) (int, *Lobby)

func NewLobby

func NewLobby(Name string, Password string) *Lobby

Only used for lobbys created by non osu!

func ReadLobby

func ReadLobby(r io.Reader) *Lobby

func (*Lobby) SwitchSlot

func (l *Lobby) SwitchSlot(SlotID byte, t *Token)

type LobbySlot

type LobbySlot struct {
	Status uint8
	UserID int32
	Team   byte
	Mods   uint32
}

type ReplayFrame

type ReplayFrame struct {
	ButtonState byte
	Button      byte
	MouseX      float32
	MouseY      float32
	Time        int32
}

type ScoreFrame

type ScoreFrame struct {
	Time         int32
	ID           byte
	Count300     uint16
	Count100     uint16
	Count50      uint16
	CountGeki    uint16
	CountKatu    uint16
	CountMiss    uint16
	TotalScore   int32
	MaxCombo     uint16
	CurrentCombo uint16
	FC           bool
	HP           uint8
	TagByte      int8
	ScoreV2      bool
}

func (*ScoreFrame) ScoreV2F

func (s *ScoreFrame) ScoreV2F(comboPortion, bonusPortion float64) []byte

type SpectatorFrame

type SpectatorFrame struct {
	Extra        int32
	ReplayFrames []ReplayFrame
	Action       byte
	ScoreFrame   ScoreFrame
}

type SpectatorStream

type SpectatorStream struct {
	HostToken *Token

	StreamTokens []*Token
	// contains filtered or unexported fields
}

func NewSpectatorStream

func NewSpectatorStream(t *Token) *SpectatorStream

func (*SpectatorStream) AddUser

func (s *SpectatorStream) AddUser(t *Token)

func (*SpectatorStream) AlreadySpectating

func (s *SpectatorStream) AlreadySpectating(t *Token) bool

func (*SpectatorStream) Broadcast

func (s *SpectatorStream) Broadcast(r io.Reader)

func (*SpectatorStream) BroadcastRaw

func (s *SpectatorStream) BroadcastRaw(b []byte, isFrame bool, ignoreSelf *Token, onlyHost bool)

func (*SpectatorStream) NoMap

func (s *SpectatorStream) NoMap(t *Token)

func (*SpectatorStream) RemoveSpectatorStream

func (s *SpectatorStream) RemoveSpectatorStream(t *Token)

func (*SpectatorStream) RemoveUser

func (s *SpectatorStream) RemoveUser(t *Token)

type Stream

type Stream struct {
	StreamName string
	StreamTemp bool
	Tokens     []*Token
	// contains filtered or unexported fields
}

func GetStream

func GetStream(streamname string) *Stream

func NewStream

func NewStream(streamname string, temp bool) *Stream

func (*Stream) AddUser

func (s *Stream) AddUser(t *Token)

AddUser add a User to stream.

func (*Stream) Broadcast

func (s *Stream) Broadcast(b []byte, t *Token)

func (*Stream) RemoveUser

func (s *Stream) RemoveUser(t *Token)

RemoveUser Remove user from Stream.

type Token

type Token struct {
	Token  string
	User   *consts.User
	Status struct {
		Torney  bool
		Beatmap constants.ClientSendUserStatusStruct
		Info    struct {
			Permissions byte
			ClientPerm  byte
			TimeZone    byte
			CountryID   byte
			Lon         float64
			Lat         float64
			Rank        uint32
		}
	}
	AlreadyNotified bool
	SpectatorStream *SpectatorStream
	Leaderboard     *consts.Leaderboard
	MPLobby         *Lobby
	MPSlot          uint8
	LastPing        time.Time
	Output          bytes.Buffer
	LockPackets     *sync.Mutex
}

Token data

func GetToken

func GetToken(token string) *Token

GetToken Returns a UserToken from a String if not exists return nil

func GetTokenByID

func GetTokenByID(userid uint32) *Token

GetTokenByID Returns a UserToken from an UserID if not exists return nil

func NewToken

func NewToken(uuid uuid.UUID, lon float64, lat float64, u *consts.User) *Token

NewToken returns a Token that has a Token with a Token

func (*Token) Read

func (t *Token) Read() []byte

func (*Token) Write

func (t *Token) Write(f []byte)

Write writes to our Client that'll get send to client on Next/This request.

Jump to

Keyboard shortcuts

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