gbxclient

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: May 23, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeserializeMethodCall

func DeserializeMethodCall(data []byte) (string, []any, error)

func DeserializeMethodResponse

func DeserializeMethodResponse(data []byte) (any, error)

Types

type Array

type Array struct {
	Data []Value `xml:"data>value"`
}

type CData

type CData string

type CallbackEventArgs

type CallbackEventArgs struct {
	Method     string
	Parameters any
}

type EventEmitter

type EventEmitter struct {
	// contains filtered or unexported fields
}

func (*EventEmitter) On

func (e *EventEmitter) On(event string, ch chan any)

type Fault

type Fault struct {
	FaultCode   *int    `xml:"value>struct>member>value>int"`
	FaultString *string `xml:"value>struct>member>value>string"`
}

type GbxCallbackStruct added in v0.7.0

type GbxCallbackStruct[T any] struct {
	Key  string
	Call func(T)
}

type GbxCallbacks

type GbxCallbacks struct {
	OnAnyCallback               []GbxCallbackStruct[CallbackEventArgs]
	OnBeginMap                  []GbxCallbackStruct[events.MapEventArgs]
	OnBeginMatch                []GbxCallbackStruct[struct{}] // No args
	OnEcho                      []GbxCallbackStruct[events.EchoEventArgs]
	OnEndMap                    []GbxCallbackStruct[events.MapEventArgs]
	OnEndMatch                  []GbxCallbackStruct[events.EndMatchEventArgs]
	OnEndRound                  []GbxCallbackStruct[events.ScoresEventArgs]
	OnPreEndRound               []GbxCallbackStruct[events.ScoresEventArgs]
	OnMapListModified           []GbxCallbackStruct[events.MapListModifiedEventArgs]
	OnPlayerAlliesChanged       []GbxCallbackStruct[events.PlayerAlliesChangedEventArgs]
	OnPlayerChat                []GbxCallbackStruct[events.PlayerChatEventArgs]
	OnPlayerConnect             []GbxCallbackStruct[events.PlayerConnectEventArgs]
	OnPlayerDisconnect          []GbxCallbackStruct[events.PlayerDisconnectEventArgs]
	OnPlayerInfoChanged         []GbxCallbackStruct[events.PlayerInfoChangedEventArgs]
	OnPlayerManialinkPageAnswer []GbxCallbackStruct[events.PlayerManialinkPageAnswerEventArgs]
	OnServerStart               []GbxCallbackStruct[struct{}] // No args
	OnServerStop                []GbxCallbackStruct[struct{}] // No args
	OnStatusChanged             []GbxCallbackStruct[events.StatusChangedEventArgs]
	OnTunnelDataReceived        []GbxCallbackStruct[events.TunnelDataReceivedEventArgs]
	OnVoteUpdated               []GbxCallbackStruct[events.VoteUpdatedEventArgs]
	OnPlayerCheckpoint          []GbxCallbackStruct[events.PlayerWayPointEventArgs]
	OnPlayerFinish              []GbxCallbackStruct[events.PlayerWayPointEventArgs]
	OnPlayerIncoherence         []GbxCallbackStruct[events.PlayerIncoherenceEventArgs]
	OnPlayerGiveUp              []GbxCallbackStruct[events.PlayerGiveUpEventArgs]
	OnStartLine                 []GbxCallbackStruct[events.StartLineEventArgs]
	OnWarmUpStart               []GbxCallbackStruct[struct{}] // No args
	OnWarmUpStartRound          []GbxCallbackStruct[events.WarmUpEventArgs]
	OnWarmUpEndRound            []GbxCallbackStruct[events.WarmUpEventArgs]
	OnWarmUpEnd                 []GbxCallbackStruct[struct{}] // No args
	OnStartRound                []GbxCallbackStruct[struct{}] // No args
	OnElimination               []GbxCallbackStruct[events.EliminationEventArgs]
}

type GbxClient

type GbxClient struct {
	GbxCallbacks
	Host             string
	Port             int
	IsConnected      bool
	DoHandShake      bool
	ReqHandle        uint32
	Socket           net.Conn
	Mutex            sync.Mutex
	RecvData         bytes.Buffer
	ResponseLength   *uint32
	DataPointer      int
	Options          Options
	PromiseCallbacks map[uint32]chan PromiseResult
	Events           EventEmitter
	ScriptCallbacks  map[string][]GbxCallbackStruct[any]
}

func NewGbxClient

func NewGbxClient(host string, port int, options Options) *GbxClient

func (*GbxClient) AddGuest

func (client *GbxClient) AddGuest(login string) error

Add the player with the specified login on the guest list. Only available to Admin.

func (*GbxClient) AddGuestId

func (client *GbxClient) AddGuestId(id int) error

Add the player with the specified PlayerId on the guest list. Only available to Admin.

func (*GbxClient) AddMap

func (client *GbxClient) AddMap(filename string) error

Add the map with the specified filename at the end of the current selection. Only available to Admin.

func (*GbxClient) AddMapList

func (client *GbxClient) AddMapList(filenames []string) (int, error)

Add the list of maps with the specified filenames at the end of the current selection. The list of maps to add is an array of strings. Only available to Admin.

func (*GbxClient) AddScriptCallback added in v1.0.0

func (client *GbxClient) AddScriptCallback(method string, key string, callback func(any))

func (*GbxClient) AppendPlaylistFromMatchSettings

func (client *GbxClient) AppendPlaylistFromMatchSettings(filename string) (int, error)

Add a list of maps defined in the playlist with the specified filename at the end of the current selection. Only available to Admin.

func (*GbxClient) AreHornsDisabled

func (client *GbxClient) AreHornsDisabled() (bool, error)

Returns whether the horns are disabled.

func (*GbxClient) AreProfileSkinsDisabled

func (client *GbxClient) AreProfileSkinsDisabled() (bool, error)

Returns whether the custom skins are disabled.

func (*GbxClient) AreServiceAnnouncesDisabled

func (client *GbxClient) AreServiceAnnouncesDisabled() (bool, error)

Returns whether the automatic mesages are disabled.

func (*GbxClient) Authenticate

func (client *GbxClient) Authenticate(login string, password string) error

Allow user authentication by specifying a login and a password, to gain access to the set of functionalities corresponding to this authorization level.

func (*GbxClient) AutoSaveReplays

func (client *GbxClient) AutoSaveReplays(enable bool) error

Enable the autosaving of all replays (vizualisable replays with all players, but not validable) on the server. Only available to SuperAdmin.

func (*GbxClient) AutoTeamBalance

func (client *GbxClient) AutoTeamBalance() error

Attempt to balance teams. Only available to Admin.

func (*GbxClient) Ban

func (client *GbxClient) Ban(login string, reason string) error

Ban the player with the specified login, with an optional message. Only available to Admin.

func (*GbxClient) BanAndBlackList

func (client *GbxClient) BanAndBlackList(login string, reason string, save bool) error

Ban the player with the specified login, with a message. Add it to the black list, and optionally save the new list. Only available to Admin.

func (*GbxClient) BanId

func (client *GbxClient) BanId(id int, reason string) error

Ban the player with the specified PlayerId, with an optional message. Only available to Admin.

func (*GbxClient) BlackList

func (client *GbxClient) BlackList(login string) error

Blacklist the player with the specified login. Only available to SuperAdmin.

func (*GbxClient) BlackListId

func (client *GbxClient) BlackListId(id int) error

Blacklist the player with the specified PlayerId. Only available to SuperAdmin.

func (*GbxClient) Call

func (client *GbxClient) Call(method string, params ...any) (any, error)

func (*GbxClient) CallVote

func (client *GbxClient) CallVote(vote string) error

Call a vote for a cmd. The command is a XML string corresponding to an XmlRpc request. Only available to Admin.

func (*GbxClient) CallVoteEx

func (client *GbxClient) CallVoteEx(vote string, ratio float32, timeout int, who int) error

Extended call vote. Same as CallVote, but you can additionally supply specific parameters for this vote: a ratio, a time out and who is voting. Special timeout values: a ratio of '-1' means default; a timeout of '0' means default, '1' means indefinite; Voters values: '0' means only active players, '1' means any player, '2' is for everybody, pure spectators included. Only available to Admin.

func (*GbxClient) CancelVote

func (client *GbxClient) CancelVote() error

Cancel the current vote. Only available to Admin.

func (*GbxClient) ChangeAuthPassword

func (client *GbxClient) ChangeAuthPassword(login string, password string) error

Change the password for the specified login/user. Only available to SuperAdmin.

func (*GbxClient) ChatEnableManualRouting

func (client *GbxClient) ChatEnableManualRouting(enable bool, forwardAll bool) error

The chat messages are no longer dispatched to the players, they only go to the rpc callback and the controller has to manually forward them. The second (optional) parameter allows all messages from the server to be automatically forwarded. Only available to Admin.

func (*GbxClient) ChatForwardToLogin

func (client *GbxClient) ChatForwardToLogin(message string, senderLogin string, destLogin string) error

(Text, SenderLogin, DestLogin) Send a text message to the specified DestLogin (or everybody if empty) on behalf of SenderLogin. DestLogin can be a single login or a list of comma-separated logins. Only available if manual routing is enabled. Only available to Admin.

func (*GbxClient) ChatSend

func (client *GbxClient) ChatSend(message string) error

Send a text message to all clients. Only available to Admin.

func (*GbxClient) ChatSendServerMessage

func (client *GbxClient) ChatSendServerMessage(message string) error

Send a text message to all clients without the server login. Only available to Admin.

func (*GbxClient) ChatSendServerMessageToId

func (client *GbxClient) ChatSendServerMessageToId(message string, playerId int) error

Send a text message without the server login to the client with the specified PlayerId. Only available to Admin.

func (*GbxClient) ChatSendServerMessageToLogin

func (client *GbxClient) ChatSendServerMessageToLogin(message string, login string) error

Send a text message without the server login to the client with the specified login. Login can be a single login or a list of comma-separated logins. Only available to Admin.

func (*GbxClient) ChatSendToId

func (client *GbxClient) ChatSendToId(message string, playerId int) error

Send a text message to the client with the specified PlayerId. Only available to Admin.

func (*GbxClient) ChatSendToLogin

func (client *GbxClient) ChatSendToLogin(message string, login string) error

Send a text message to the client with the specified login. Login can be a single login or a list of comma-separated logins. Only available to Admin.

func (*GbxClient) CheckMapForCurrentServerParams

func (client *GbxClient) CheckMapForCurrentServerParams(filename string) (bool, error)

Returns a boolean if the map with the specified filename matches the current server settings.

func (*GbxClient) ChooseNextMap

func (client *GbxClient) ChooseNextMap(filename string) error

Set as next map the one with the specified filename, if it is present in the selection. Only available to Admin.

func (*GbxClient) ChooseNextMapList

func (client *GbxClient) ChooseNextMapList(filenames []string) (int, error)

Set as next maps the list of maps with the specified filenames, if they are present in the selection. The list of maps to choose is an array of strings. Only available to Admin.

func (*GbxClient) CleanBanList

func (client *GbxClient) CleanBanList() error

Clean the ban list of the server. Only available to Admin.

func (*GbxClient) CleanBlackList

func (client *GbxClient) CleanBlackList() error

Clean the blacklist of the server. Only available to SuperAdmin.

func (*GbxClient) CleanGuestList

func (client *GbxClient) CleanGuestList() error

Clean the guest list of the server. Only available to Admin.

func (*GbxClient) Connect

func (client *GbxClient) Connect() error

func (*GbxClient) ConnectFakePlayer

func (client *GbxClient) ConnectFakePlayer() error

(debug tool) Connect a fake player to the server. Only available to Admin.

func (*GbxClient) DisableHorns

func (client *GbxClient) DisableHorns(disable bool) error

Disable player horns. Only available to Admin.

func (*GbxClient) DisableProfileSkins

func (client *GbxClient) DisableProfileSkins(disable bool) error

Ignore players profile skin customisation. Only available to Admin.

func (*GbxClient) DisableServiceAnnounces

func (client *GbxClient) DisableServiceAnnounces(disable bool) error

Disable the automatic mesages when a player connects/disconnects from the server. Only available to Admin.

func (*GbxClient) Disconnect

func (client *GbxClient) Disconnect() error

func (*GbxClient) DisconnectFakePlayer

func (client *GbxClient) DisconnectFakePlayer(login string) error

(debug tool) Disconnect a fake player, or all the fake players if login is '*'. Only available to Admin.

func (*GbxClient) Echo

func (client *GbxClient) Echo(public string, internal string) error

Just log the parameters and invoke a callback. Can be used to talk to other xmlrpc clients connected, or to make custom votes. If used in a callvote, the first parameter will be used as the vote message on the clients. Only available to Admin.

func (*GbxClient) EnableCallbacks

func (client *GbxClient) EnableCallbacks(enable bool) error

Allow the GameServer to call you back.

func (*GbxClient) ForcePlayerTeam

func (client *GbxClient) ForcePlayerTeam(login string, team int) error

Force the team of the player. Only available in team mode. You have to pass the login and the team number (0 or 1). Only available to Admin.

func (*GbxClient) ForcePlayerTeamId

func (client *GbxClient) ForcePlayerTeamId(playerID int, team int) error

Force the team of the player. Only available in team mode. You have to pass the playerid and the team number (0 or 1). Only available to Admin.

func (*GbxClient) ForceScores

func (client *GbxClient) ForceScores(scores []structs.TMPlayerScore, silentMode ...bool) error

Force the scores of the current game. Only available in rounds and team mode. You have to pass an array of structs {int PlayerId, int Score}. And a boolean SilentMode - if true, the scores are silently updated (only available for SuperAdmin), allowing an external controller to do its custom counting... Only available to Admin/SuperAdmin.

func (*GbxClient) ForceSpectator

func (client *GbxClient) ForceSpectator(login string, status int) error

Force the spectating status of the player. You have to pass the login and the spectator mode (0: user selectable, 1: spectator, 2: player, 3: spectator but keep selectable). Only available to Admin.

func (*GbxClient) ForceSpectatorId

func (client *GbxClient) ForceSpectatorId(id int, status int) error

Force the spectating status of the player. You have to pass the playerid and the spectator mode (0: user selectable, 1: spectator, 2: player, 3: spectator but keep selectable). Only available to Admin.

func (*GbxClient) ForceSpectatorTarget

func (client *GbxClient) ForceSpectatorTarget(spectator string, target string, cameraType int) error

Force spectators to look at a specific player. You have to pass the login of the spectator (or ” for all) and the login of the target (or ” for automatic), and an integer for the camera type to use (-1 = leave unchanged, 0 = replay, 1 = follow, 2 = free). Only available to Admin.

func (*GbxClient) ForceSpectatorTargetId

func (client *GbxClient) ForceSpectatorTargetId(spectator int, target int, cameraType int) error

Force spectators to look at a specific player. You have to pass the id of the spectator (or -1 for all) and the id of the target (or -1 for automatic), and an integer for the camera type to use (-1 = leave unchanged, 0 = replay, 1 = follow, 2 = free). Only available to Admin.

func (*GbxClient) GameDataDirectory

func (client *GbxClient) GameDataDirectory() (string, error)

Returns the path of the game datas directory. Only available to Admin.

func (*GbxClient) GetBanList

func (client *GbxClient) GetBanList(max int, start int) ([]structs.TMBanListEntry, error)

Returns the list of banned players. This method takes two parameters. The first parameter specifies the maximum number of infos to be returned, and the second one the starting index in the list. The list is an array of structures. Each structure contains the following fields : Login, ClientName and IPAddress.

func (*GbxClient) GetBlackList

func (client *GbxClient) GetBlackList(max int, start int) ([]structs.TMBlackListEntry, error)

Returns the list of blacklisted players. This method takes two parameters. The first parameter specifies the maximum number of infos to be returned, and the second one the starting index in the list. The list is an array of structures. Each structure contains the following fields : Login.

func (*GbxClient) GetCurrentCallVote

func (client *GbxClient) GetCurrentCallVote() (structs.TMCurrentCallVote, error)

Returns the vote currently in progress. The returned structure is { CallerLogin, CmdName, CmdParam }.

func (*GbxClient) GetCurrentMapIndex

func (client *GbxClient) GetCurrentMapIndex() (int, error)

Returns the current map index in the selection, or -1 if the map is no longer in the selection.

func (*GbxClient) GetCurrentMapInfo

func (client *GbxClient) GetCurrentMapInfo() (structs.TMMapInfo, error)

Returns a struct containing the infos for the current map. The struct contains the following fields : Name, UId, FileName, Author, AuthorNickname, Environnement, Mood, BronzeTime, SilverTime, GoldTime, AuthorTime, CopperPrice, LapRace, NbLaps, NbCheckpoints, MapType, MapStyle.

func (*GbxClient) GetCurrentRanking

func (client *GbxClient) GetCurrentRanking(max int, start int) ([]structs.TMPlayerRanking, error)

Returns the current rankings for the race in progress. (In trackmania legacy team modes, the scores for the two teams are returned. In other modes, it's the individual players' scores) This method take two parameters. The first parameter specifies the maximum number of infos to be returned, and the second one the starting index in the ranking. The ranking returned is a list of structures. Each structure contains the following fields : Login, NickName, PlayerId and Rank. In addition, for legacy trackmania modes it also contains BestTime, Score, NbrLapsFinished, LadderScore, and an array BestCheckpoints that contains the checkpoint times for the best race.

func (*GbxClient) GetCurrentRankingForLogin

func (client *GbxClient) GetCurrentRankingForLogin(login string) ([]structs.TMPlayerRanking, error)

Returns the current ranking for the race in progressof the player with the specified login (or list of comma-separated logins). The ranking returned is a list of structures. Each structure contains the following fields : Login, NickName, PlayerId and Rank. In addition, for legacy trackmania modes it also contains BestTime, Score, NbrLapsFinished, LadderScore, and an array BestCheckpoints that contains the checkpoint times for the best race.

func (*GbxClient) GetCurrentWinnerTeam

func (client *GbxClient) GetCurrentWinnerTeam() (int, error)

Returns the current winning team for the race in progress. (-1: if not in team mode, or draw match)

func (*GbxClient) GetDetailedPlayerInfo

func (client *GbxClient) GetDetailedPlayerInfo(login string) (structs.TMPlayerDetailedInfo, error)

Returns a struct containing the infos on the player with the specified login. The structure contains the following fields : Login, NickName, PlayerId, TeamId, IPAddress, DownloadRate, UploadRate, Language, IsSpectator, IsInOfficialMode, a structure named Avatar, an array of structures named Skins, a structure named LadderStats, HoursSinceZoneInscription and OnlineRights (0: nations account, 3: united account). Each structure of the array Skins contains two fields Environnement and a struct PackDesc. Each structure PackDesc, as well as the struct Avatar, contains two fields FileName and Checksum.

func (*GbxClient) GetForceShowAllOpponents

func (client *GbxClient) GetForceShowAllOpponents() (structs.TMForceShowAllOpponents, error)

Get whether players are forced to show all opponents. The struct returned contains two fields CurrentValue and NextValue.

func (client *GbxClient) GetForcedClubLinks() (structs.TMForcedClubLinks, error)

Get the forced clublinks.

func (*GbxClient) GetForcedTeams

func (client *GbxClient) GetForcedTeams() (bool, error)

Returns whether the players can choose their side or if the teams are forced by the server.

func (*GbxClient) GetGuestList

func (client *GbxClient) GetGuestList(max int, start int) ([]structs.TMGuestListEntry, error)

Returns the list of players on the guest list. This method takes two parameters. The first parameter specifies the maximum number of infos to be returned, and the second one the starting index in the list. The list is an array of structures. Each structure contains the following fields : Login.

func (*GbxClient) GetHideServer

func (client *GbxClient) GetHideServer() (int, error)

Get whether the server wants to be hidden from the public server list.

func (*GbxClient) GetMainServerPlayerInfo

func (client *GbxClient) GetMainServerPlayerInfo(version ...int) (structs.TMPlayerInfo, error)

Returns a struct containing the player infos of the game server (ie: in case of a basic server, itself; in case of a relay server, the main server), with an optional parameter for compatibility: struct version (0 = united, 1 = forever). The structure is identical to the ones from GetPlayerList. Forever PlayerInfo struct is: Login, NickName, PlayerId, TeamId, SpectatorStatus, LadderRanking, and Flags. LadderRanking is 0 when not in official mode, Flags = ForceSpectator(0,1,2) + StereoDisplayMode * 1000 + IsManagedByAnOtherServer * 10000 + IsServer * 100000 + HasPlayerSlot * 1000000 + IsBroadcasting * 10000000 + HasJoinedGame * 100000000 SpectatorStatus = Spectator + TemporarySpectator * 10 + PureSpectator * 100 + AutoTarget * 1000 + CurrentTargetId * 10000

func (*GbxClient) GetMapInfo

func (client *GbxClient) GetMapInfo(filename string) (structs.TMMapInfo, error)

Returns a struct containing the infos for the map with the specified filename. The struct contains the following fields : Name, UId, FileName, Author, AuthorNickname, Environnement, Mood, BronzeTime, SilverTime, GoldTime, AuthorTime, CopperPrice, LapRace, MapType, MapStyle. (NbLaps and NbCheckpoints are also present but always set to -1)

func (*GbxClient) GetMapList

func (client *GbxClient) GetMapList(max int, startIndex int) ([]structs.TMMapInfo, error)

Returns a list of maps among the current selection of the server. This method take two parameters. The first parameter specifies the maximum number of infos to be returned, and the second one the starting index in the selection. The list is an array of structures. Each structure contains the following fields : Name, UId, FileName, Environnement, Author, AuthorNickname, GoldTime, CopperPrice, MapType, MapStyle.

func (*GbxClient) GetMapsDirectory

func (client *GbxClient) GetMapsDirectory() (string, error)

Returns the path of the maps directory. Only available to Admin.

func (*GbxClient) GetMaxPlayers

func (client *GbxClient) GetMaxPlayers() (structs.TMMaxPlayers, error)

Get the current and next maximum number of players allowed on server. The struct returned contains two fields CurrentValue and NextValue.

func (*GbxClient) GetMaxSpectators

func (client *GbxClient) GetMaxSpectators() (structs.TMMaxSpectators, error)

Get the current and next maximum number of spectators allowed on server. The struct returned contains two fields CurrentValue and NextValue.

func (*GbxClient) GetModeScriptInfo

func (client *GbxClient) GetModeScriptInfo() (structs.TMModeScriptInfo, error)

Returns the description of the current mode script, as a structure containing: Name, CompatibleTypes, Description, Version and the settings available.

func (*GbxClient) GetModeScriptSettings

func (client *GbxClient) GetModeScriptSettings() (map[string]any, error)

Returns the current settings of the mode script.

func (*GbxClient) GetModeScriptText

func (client *GbxClient) GetModeScriptText() (string, error)

Get the current mode script.

func (*GbxClient) GetNetworkStats

func (client *GbxClient) GetNetworkStats() (structs.TMNetworkStats, error)

Returns a struct containing the networks stats of the server. The structure contains the following fields : Uptime, NbrConnection, MeanConnectionTime, MeanNbrPlayer, RecvNetRate, SendNetRate, TotalReceivingSize, TotalSendingSize and an array of structures named PlayerNetInfos. Each structure of the array PlayerNetInfos contains the following fields : Login, IPAddress, LastTransferTime, DeltaBetweenTwoLastNetState, PacketLossRate. Only available to SuperAdmin.

func (*GbxClient) GetNextMapIndex

func (client *GbxClient) GetNextMapIndex() (int, error)

Returns the map index in the selection that will be played next (unless the current one is restarted...)

func (*GbxClient) GetNextMapInfo

func (client *GbxClient) GetNextMapInfo() (structs.TMMapInfo, error)

Returns a struct containing the infos for the next map. The struct contains the following fields : Name, UId, FileName, Author, AuthorNickname, Environnement, Mood, BronzeTime, SilverTime, GoldTime, AuthorTime, CopperPrice, LapRace, MapType, MapStyle. (NbLaps and NbCheckpoints are also present but always set to -1)

func (*GbxClient) GetPlayerInfo

func (client *GbxClient) GetPlayerInfo(login string, version ...int) (structs.TMPlayerInfo, error)

Returns a struct containing the infos on the player with the specified login, with an optional parameter for compatibility: struct version (0 = united, 1 = forever). The structure is identical to the ones from GetPlayerList. Forever PlayerInfo struct is: Login, NickName, PlayerId, TeamId, SpectatorStatus, LadderRanking, and Flags. LadderRanking is 0 when not in official mode, Flags = ForceSpectator(0,1,2) + StereoDisplayMode * 1000 + IsManagedByAnOtherServer * 10000 + IsServer * 100000 + HasPlayerSlot * 1000000 + IsBroadcasting * 10000000 + HasJoinedGame * 100000000 SpectatorStatus = Spectator + TemporarySpectator * 10 + PureSpectator * 100 + AutoTarget * 1000 + CurrentTargetId * 10000

func (*GbxClient) GetPlayerList

func (client *GbxClient) GetPlayerList(max int, start int, version ...int) ([]structs.TMPlayerInfo, error)

Returns the list of players on the server. This method take two parameters. The first parameter specifies the maximum number of infos to be returned, and the second one the starting index in the list, an optional 3rd parameter is used for compatibility: struct version (0 = united, 1 = forever, 2 = forever, including the servers). The list is an array of PlayerInfo structures. Forever PlayerInfo struct is: Login, NickName, PlayerId, TeamId, SpectatorStatus, LadderRanking, and Flags. LadderRanking is 0 when not in official mode, Flags = ForceSpectator(0,1,2) + StereoDisplayMode * 1000 + IsManagedByAnOtherServer * 10000 + IsServer * 100000 + HasPlayerSlot * 1000000 + IsBroadcasting * 10000000 + HasJoinedGame * 100000000 SpectatorStatus = Spectator + TemporarySpectator * 10 + PureSpectator * 100 + AutoTarget * 1000 + CurrentTargetId * 10000

func (*GbxClient) GetScriptName

func (client *GbxClient) GetScriptName() (structs.TMScriptName, error)

Get the current and next mode script name for script mode. The struct returned contains two fields CurrentValue and NextValue.

func (*GbxClient) GetServerComment

func (client *GbxClient) GetServerComment() (string, error)

Get the server comment in utf8 format.

func (*GbxClient) GetServerName

func (client *GbxClient) GetServerName() (string, error)

Get the server name in utf8 format.

func (*GbxClient) GetServerOptions

func (client *GbxClient) GetServerOptions() (structs.TMServerOptions, error)

Returns a struct containing the server options: Name, Comment, Password, PasswordForSpectator, HideServer, CurrentMaxPlayers, NextMaxPlayers, CurrentMaxSpectators, NextMaxSpectators, KeepPlayerSlots, CurrentCallVoteTimeOut, NextCallVoteTimeOut, CallVoteRatio, AllowMapDownload, AutoSaveReplays, ClientInputsMaxLatency, DisableHorns, DisableServiceAnnounces,PacketAssembly_PacketsPerFrame, PacketAssembly_FullPacketsPerFrame, TrustClientSimu_ClientToServer_SendingRate, DelayedVisuals_ServerToClient_SendingRate.

func (*GbxClient) GetServerPassword

func (client *GbxClient) GetServerPassword() (string, error)

Get the server password if called as Admin or Super Admin, else returns if a password is needed or not.

func (*GbxClient) GetServerPasswordForSpectator

func (client *GbxClient) GetServerPasswordForSpectator() (string, error)

Get the password for spectator mode if called as Admin or Super Admin, else returns if a password is needed or not.

func (*GbxClient) GetServerTags

func (client *GbxClient) GetServerTags() ([]structs.TMServerTag, error)

Returns the list of tags and associated values set on this server. Only available to Admin.

func (*GbxClient) GetSkinsDirectory

func (client *GbxClient) GetSkinsDirectory() (string, error)

Returns the path of the skins directory. Only available to Admin.

func (*GbxClient) GetStatus

func (client *GbxClient) GetStatus() (structs.TMStatus, error)

Returns the current status of the server.

func (*GbxClient) GetSystemInfo

func (client *GbxClient) GetSystemInfo() (structs.TMSystemInfo, error)

Get some system infos, including connection rates (in kbps).

func (*GbxClient) GetTeamInfo

func (client *GbxClient) GetTeamInfo(clanID int) (structs.TMTeamInfo, error)

Return Team info for a given clan (0 = no clan, 1, 2). The structure contains: Name, ZonePath, City, EmblemUrl, HuePrimary, HueSecondary, RGB, ClubLinkUrl. Only available to Admin.

func (*GbxClient) GetValidationReplay

func (client *GbxClient) GetValidationReplay(login string) (string, error)

Returns a replay containing the data needed to validate the current best time of the player. The parameter is the login of the player.

func (*GbxClient) GetVersion

func (client *GbxClient) GetVersion() (structs.TMVersion, error)

Returns a struct with the Name, TitleId, Version, Build and ApiVersion of the application remotely controlled.

func (*GbxClient) InsertMap

func (client *GbxClient) InsertMap(filename string) error

Insert the map with the specified filename after the current map. Only available to Admin.

func (*GbxClient) InsertMapList

func (client *GbxClient) InsertMapList(filenames []string) (int, error)

Insert the list of maps with the specified filenames after the current map. The list of maps to insert is an array of strings. Only available to Admin.

func (*GbxClient) InsertPlaylistFromMatchSettings

func (client *GbxClient) InsertPlaylistFromMatchSettings(filename string) (int, error)

Insert a list of maps defined in the playlist with the specified filename after the current map. Only available to Admin.

func (*GbxClient) IsAutoSaveReplaysEnabled

func (client *GbxClient) IsAutoSaveReplaysEnabled() (bool, error)

Returns if autosaving of all replays is enabled on the server.

func (*GbxClient) IsKeepingPlayerSlots

func (client *GbxClient) IsKeepingPlayerSlots() (bool, error)

Get whether the server keeps player slots when switching to spectator.

func (*GbxClient) JumpToMapIdent

func (client *GbxClient) JumpToMapIdent(id string) error

Immediately jumps to the map designated by its identifier (it must be in the selection).

func (*GbxClient) JumpToMapIndex

func (client *GbxClient) JumpToMapIndex(index int) error

Immediately jumps to the map designated by the index in the selection.

func (*GbxClient) KeepPlayerSlots

func (client *GbxClient) KeepPlayerSlots(keepPlayerSlots bool) error

Set whether, when a player is switching to spectator, the server should still consider him a player and keep his player slot, or not. Only available to Admin.

func (*GbxClient) Kick

func (client *GbxClient) Kick(login string, reason string) error

Kick the player with the specified login, with an optional message. Only available to Admin.

func (*GbxClient) KickId

func (client *GbxClient) KickId(id int, reason string) error

Kick the player with the specified PlayerId, with an optional message. Only available to Admin.

func (*GbxClient) ListMethods

func (client *GbxClient) ListMethods() ([]string, error)

Return an array of all available XML-RPC methods on this server.

func (*GbxClient) LoadBlackList

func (client *GbxClient) LoadBlackList(fileName string) error

Load the black list file with the specified file name. Only available to Admin.

func (*GbxClient) LoadGuestList

func (client *GbxClient) LoadGuestList(fileName string) error

Load the guest list file with the specified file name. Only available to Admin.

func (*GbxClient) LoadMatchSettings

func (client *GbxClient) LoadMatchSettings(filename string) (int, error)

Set a list of maps defined in the playlist with the specified filename as the current selection of the server, and load the gameinfos from the same file. Only available to Admin.

func (*GbxClient) MethodHelp

func (client *GbxClient) MethodHelp(method string) (string, error)

Given the name of a method, return a help string.

func (*GbxClient) MethodSignature

func (client *GbxClient) MethodSignature(signature string) ([]structs.TMMethodSignature, error)

Given the name of a method, return an array of legal signatures. Each signature is an array of strings. The first item of each signature is the return type, and any others items are parameter types.

func (*GbxClient) NextMap

func (client *GbxClient) NextMap(dontClearCupScores ...bool) error

Switch to next map with an optional boolean parameter DontClearCupScores

func (*GbxClient) QuitGame

func (client *GbxClient) QuitGame() error

Quit the application. Only available to SuperAdmin.

func (*GbxClient) RemoveGuest

func (client *GbxClient) RemoveGuest(login string) error

Remove the player with the specified login from the guest list. Only available to Admin.

func (*GbxClient) RemoveGuestId

func (client *GbxClient) RemoveGuestId(id int) error

Remove the player with the specified PlayerId from the guest list. Only available to Admin.

func (*GbxClient) RemoveMap

func (client *GbxClient) RemoveMap(filename string) error

Remove the map with the specified filename from the current selection. Only available to Admin.

func (*GbxClient) RemoveMapList

func (client *GbxClient) RemoveMapList(filenames []string) (int, error)

Remove the list of maps with the specified filenames from the current selection. The list of maps to remove is an array of strings. Only available to Admin.

func (*GbxClient) RemoveScriptCallback added in v1.0.0

func (client *GbxClient) RemoveScriptCallback(method string, key string)

func (*GbxClient) ResetServerTags

func (client *GbxClient) ResetServerTags() error

Reset all tags on the server. Only available to Admin.

func (*GbxClient) RestartMap

func (client *GbxClient) RestartMap(dontClearCupScores ...bool) error

Restarts the map with an optional boolean parameter DontClearCupScores

func (*GbxClient) SaveBestGhostsReplay

func (client *GbxClient) SaveBestGhostsReplay(login string, filename string) error

Saves a replay with the ghost of all the players' best race. First parameter is the login of the player (or ” for all players), Second parameter is the filename, or ” for an automatic filename. Only available to Admin.

func (*GbxClient) SaveBlackList

func (client *GbxClient) SaveBlackList(fileName string) error

Save the black list in the file with specified file name. Only available to Admin.

func (*GbxClient) SaveCurrentReplay

func (client *GbxClient) SaveCurrentReplay(filename string) error

Saves the current replay (vizualisable replays with all players, but not validable). Pass a filename, or ” for an automatic filename. Only available to Admin.

func (*GbxClient) SaveGuestList

func (client *GbxClient) SaveGuestList(fileName string) error

Save the guest list in the file with specified file name. Only available to Admin.

func (*GbxClient) SaveMatchSettings

func (client *GbxClient) SaveMatchSettings(filename string) (int, error)

Save the current selection of map in the playlist with the specified filename, as well as the current gameinfos. Only available to Admin.

func (*GbxClient) Send

func (client *GbxClient) Send(method string, params ...any) (any, error)

func (*GbxClient) SendDisplayManialinkPage

func (client *GbxClient) SendDisplayManialinkPage(xml CData, timeout int, hideOnClick bool) error

Display a manialink page on all clients. The parameters are the xml description of the page to display, a timeout to autohide it (0 = permanent), and a boolean to indicate whether the page must be hidden as soon as the user clicks on a page option. Only available to Admin.

func (*GbxClient) SendDisplayManialinkPageToId

func (client *GbxClient) SendDisplayManialinkPageToId(uid int, xml CData, timeout int, hideOnClick bool) error

Display a manialink page on the client with the specified UId. The first parameter is the UId of the player, the other are identical to 'SendDisplayManialinkPage'. Only available to Admin.

func (*GbxClient) SendDisplayManialinkPageToLogin

func (client *GbxClient) SendDisplayManialinkPageToLogin(login string, xml CData, timeout int, hideOnClick bool) error

Display a manialink page on the client with the specified login. The first parameter is the login of the player, the other are identical to 'SendDisplayManialinkPage'. Login can be a single login or a list of comma-separated logins. Only available to Admin.

func (*GbxClient) SendHideManialinkPage

func (client *GbxClient) SendHideManialinkPage() error

Hide the displayed manialink page on all clients. Only available to Admin.

func (*GbxClient) SendHideManialinkPageToId

func (client *GbxClient) SendHideManialinkPageToId(uid int) error

Hide the displayed manialink page on the client with the specified UId. Only available to Admin.

func (*GbxClient) SendHideManialinkPageToLogin

func (client *GbxClient) SendHideManialinkPageToLogin(login string) error

Hide the displayed manialink page on the client with the specified login. Login can be a single login or a list of comma-separated logins. Only available to Admin.

func (*GbxClient) SetApiVersion

func (client *GbxClient) SetApiVersion(version string) error

Define the wanted api.

func (*GbxClient) SetConnectionRates

func (client *GbxClient) SetConnectionRates(download int, upload int) error

Set the download and upload rates (in kbps).

func (*GbxClient) SetForceShowAllOpponents

func (client *GbxClient) SetForceShowAllOpponents(opponents int) error

Set whether to override the players preferences and always display all opponents (0=no override, 1=show all, other value=minimum number of opponents). Only available to Admin. Requires a map restart to be taken into account.

func (client *GbxClient) SetForcedClubLinks(clubLink1 string, clubLink2 string) error

Set the clublinks to use for the two clans. Only available to Admin.

func (*GbxClient) SetForcedTeams

func (client *GbxClient) SetForcedTeams(forced bool) error

Set whether the players can choose their side or if the teams are forced by the server (using ForcePlayerTeam()). Only available to Admin.

func (*GbxClient) SetHideServer

func (client *GbxClient) SetHideServer(visibility int) error

Set whether the server should be hidden from the public server list (0 = visible, 1 = always hidden, 2 = hidden from nations). Only available to Admin.

func (*GbxClient) SetMaxPlayers

func (client *GbxClient) SetMaxPlayers(maxPlayers int) error

Set a new maximum number of players. Only available to Admin. Requires a map restart to be taken into account.

func (*GbxClient) SetMaxSpectators

func (client *GbxClient) SetMaxSpectators(maxSpectators int) error

Set a new maximum number of Spectators. Only available to Admin. Requires a map restart to be taken into account.

func (*GbxClient) SetModeScriptSettings

func (client *GbxClient) SetModeScriptSettings(settings map[string]any) error

Change the settings of the mode script. Only available to Admin.

func (*GbxClient) SetModeScriptText

func (client *GbxClient) SetModeScriptText(script string) error

Set the mode script and restart. Only available to Admin.

func (*GbxClient) SetNextMapIdent

func (client *GbxClient) SetNextMapIdent(id string) error

Sets the map in the selection that will be played next (unless the current one is restarted...)

func (*GbxClient) SetNextMapIndex

func (client *GbxClient) SetNextMapIndex(index int) error

Sets the map index in the selection that will be played next (unless the current one is restarted...)

func (*GbxClient) SetScriptName

func (client *GbxClient) SetScriptName(scriptName string) error

Set a new mode script name for script mode. Only available to Admin. Requires a map restart to be taken into account.

func (*GbxClient) SetServerComment

func (client *GbxClient) SetServerComment(comment string) error

Set a new server comment in utf8 format. Only available to Admin.

func (*GbxClient) SetServerName

func (client *GbxClient) SetServerName(name string) error

Set a new server name in utf8 format. Only available to Admin.

func (*GbxClient) SetServerOptions

func (client *GbxClient) SetServerOptions(options structs.TMServerOptionsRequest) error

Set new server options using the struct passed as parameters. This struct must contain the following fields : Name, Comment, Password, PasswordForSpectator, NextCallVoteTimeOut, CallVoteRatio. May additionally include any of the other members listed in RpcGetServerOptions. Only available to Admin. A change of NextMaxPlayers, NextMaxSpectators, NextCallVoteTimeOut requires a map restart to be taken into account.

func (*GbxClient) SetServerPassword

func (client *GbxClient) SetServerPassword(password string) error

Set a new password for the server. Only available to Admin.

func (*GbxClient) SetServerPasswordForSpectator

func (client *GbxClient) SetServerPasswordForSpectator(password string) error

Set a new password for the spectator mode. Only available to Admin.

func (*GbxClient) SetServerTag

func (client *GbxClient) SetServerTag(tag string, value string) error

Set a tag and its value on the server. This method takes two parameters. The first parameter specifies the name of the tag, and the second one its value. The list is an array of structures {string Name, string Value}. Only available to Admin.

func (*GbxClient) SetTeamInfo

func (client *GbxClient) SetTeamInfo(name string, huePrimary float32, zonePath string, par4 string, par5 float32, par6 string, par7 string, par8 float32, par9 string) error

Set Team names and colors (deprecated). Only available to Admin.

func (*GbxClient) SpectatorReleasePlayerSlot

func (client *GbxClient) SpectatorReleasePlayerSlot(login string) error

Pass the login of the spectator. A spectator that once was a player keeps his player slot, so that he can go back to race mode. Calling this function frees this slot for another player to connect. Only available to Admin.

func (*GbxClient) SpectatorReleasePlayerSlotId

func (client *GbxClient) SpectatorReleasePlayerSlotId(id int) error

Pass the playerid of the spectator. A spectator that once was a player keeps his player slot, so that he can go back to race mode. Calling this function frees this slot for another player to connect. Only available to Admin.

func (*GbxClient) StartServerInternet

func (client *GbxClient) StartServerInternet() error

Start a server on internet, using the current configuration. Only available to SuperAdmin.

func (*GbxClient) StartServerLan

func (client *GbxClient) StartServerLan() error

Start a server on lan, using the current configuration. Only available to SuperAdmin.

func (*GbxClient) StopServer

func (client *GbxClient) StopServer() error

Stop the server. Only available to SuperAdmin.

func (*GbxClient) TriggerModeScriptEvent

func (client *GbxClient) TriggerModeScriptEvent(method string, param string) error

Send an event to the mode script. Only available to Admin.

func (*GbxClient) TriggerModeScriptEventArray

func (client *GbxClient) TriggerModeScriptEventArray(method string, params []string) error

Send an event to the mode script. Only available to Admin.

func (*GbxClient) UnBan

func (client *GbxClient) UnBan(login string) error

Unban the player with the specified login. Only available to Admin.

func (*GbxClient) UnBlackList

func (client *GbxClient) UnBlackList(login string) error

UnTMBlackListEntry the player with the specified login. Only available to SuperAdmin.

func (*GbxClient) UnsetServerTag

func (client *GbxClient) UnsetServerTag(tag string) error

Unset the tag with the specified name on the server. Only available to Admin.

type Member

type Member struct {
	Name  string `xml:"name"`
	Value Value  `xml:"value"`
}

type MethodCall

type MethodCall struct {
	MethodName string  `xml:"methodName"`
	Params     []Param `xml:"params>param"`
}

type MethodResponse

type MethodResponse struct {
	Params []Param `xml:"params>param"`
	Fault  *Fault  `xml:"fault"`
}

type Options

type Options struct {
	ShowErrors  bool
	ThrowErrors bool
}

type Param

type Param struct {
	Value Value `xml:"value"`
}

type PromiseResult

type PromiseResult struct {
	Result any
	Error  error
}

type Struct

type Struct struct {
	Members []Member `xml:"member"`
}

type Value

type Value struct {
	String   *string  `xml:"string"`
	Int      *int     `xml:"i4"`
	Bool     *bool    `xml:"boolean"`
	Float    *float64 `xml:"double"`
	Struct   *Struct  `xml:"struct"`
	Array    *Array   `xml:"array"`
	Base64   *string  `xml:"base64"`
	DateTime *string  `xml:"dateTime.iso8601"`
}

type XMLParam

type XMLParam struct {
	Value string `xml:",innerxml"`
}

type XMLRequest

type XMLRequest struct {
	XMLName    xml.Name   `xml:"methodCall"`
	MethodName string     `xml:"methodName"`
	Params     []XMLParam `xml:"params>param"`
}

Jump to

Keyboard shortcuts

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