1 using Microsoft.Xna.Framework;
3 using System.Collections.Generic;
26 partial class Client : IDisposable
83 DebugConsole.NewMessage(value.Name, Color.Yellow);
87 if (character !=
null)
105 private Vector2 spectatePos;
110 if (character ==
null || character.
IsDead)
122 spectatePos = value.Value;
130 return inGame && character ==
null;
137 get {
return muted; }
140 if (muted == value) {
return; }
184 private readonly
object[] votes;
186 partial
void InitProjSpecific();
187 partial
void DisposeProjSpecific();
188 public Client(
string name,
byte sessionId)
191 this.SessionId = sessionId;
193 votes =
new object[Enum.GetNames(typeof(VoteType)).Length];
200 return (votes[(
int)voteType] is T t) ? t :
default;
203 public void SetVote(VoteType voteType,
object value)
205 votes[(int)voteType] = value;
210 || (
byte.TryParse(userId, out
byte sessionId) &&
SessionId == sessionId);
229 permittedCommands =
new List<DebugConsole.Command>();
234 catch (InvalidCastException)
241 for (
int i = 0; i < commandCount; i++)
244 var consoleCommand = DebugConsole.Commands.Find(c => c.Names.Contains(commandName));
245 if (consoleCommand !=
null)
247 permittedCommands.Add(consoleCommand);
267 for (
int i = 0; i < name.Length; i++)
269 rName += name[i] < 32 ?
'?' : name[i];
276 DisposeProjSpecific();
void SetPlayerVoiceIconState(Client client, bool muted, bool mutedLocally)
readonly ushort ID
Unique, but non-persistent identifier. Stays the same if the entities are created in the exactly same...
static Entity FindEntityByID(ushort ID)
Find an entity based on the ID
static GameSession?? GameSession
static NetLobbyScreen NetLobbyScreen
static NetworkMember NetworkMember
void SetPlayerVoiceIconState(Client client, bool muted, bool mutedLocally)
static string SanitizeName(string name)
readonly HashSet< DebugConsole.Command > PermittedConsoleCommands
HashSet< Identifier > GivenAchievements
bool HasPermission(ClientPermissions permission)
void WritePermissions(IWriteMessage msg)
CharacterTeamType PreferredTeam
static void ReadPermissions(IReadMessage inc, out ClientPermissions permissions, out List< DebugConsole.Command > permittedCommands)
T GetVote< T >(VoteType voteType)
void SetPermissions(ClientPermissions permissions, IEnumerable< Identifier > permittedConsoleCommands)
Option< AccountId > AccountId
The ID of the account used to authenticate this session. This value can be used as a persistent value...
bool SessionOrAccountIdMatches(string userId)
readonly byte SessionId
An ID for this client for the current session. THIS IS NOT A PERSISTENT VALUE. DO NOT STORE THIS LONG...
ClientPermissions Permissions
void SetVote(VoteType voteType, object value)
LanguageIdentifier Language
bool UsingFreeCam
Is the client using the 'freecam' console command?
void ReadPermissions(IReadMessage inc)
Client(string name, byte sessionId)
int ReadRangedInteger(int min, int max)
Identifier ReadIdentifier()
void WriteRangedInteger(int val, int min, int max)
void WriteUInt16(UInt16 val)
void WriteIdentifier(Identifier val)
readonly Option< AccountId > AccountId
The primary ID for a given user
CharacterTeamType PreferredTeam