private void HandleGetPeerAccountInfo(IIncommingMessage message) { int peerId = message.AsInt(); UserInfo user = new UserInfo(); if (AlbotDBManager.getActiveUsersInfo(peerId, ref user) == false) { message.Respond("Peer with a given ID is not in the game", ResponseStatus.Error); return; } var packet = new PeerAccountInfoPacket() { PeerId = peerId, Properties = new Dictionary <string, string>() { { AlbotDictKeys.icon, user.profilePic } }, Username = user.username }; message.Respond(packet, ResponseStatus.Success); }
/// <summary> /// Handles a request to retrieve account information /// </summary> /// <param name="message"></param> private void HandleGetPeerAccountInfo(IIncommingMessage message) { if (!HasGetPeerInfoPermissions(message.Peer)) { message.Respond("Unauthorized", ResponseStatus.Unauthorized); return; } var peerId = message.AsInt(); var peer = Server.GetPeer(peerId); if (peer == null) { message.Respond("Peer with a given ID is not in the game", ResponseStatus.Error); return; } var account = peer.GetExtension <UserExtension>(); if (account == null) { message.Respond("Peer has not been authenticated", ResponseStatus.Failed); return; } var data = account.AccountData; var packet = new PeerAccountInfoPacket { PeerId = peerId, Properties = data.Properties, Username = account.Username }; message.Respond(packet, ResponseStatus.Success); }
public UnetMsfPlayer(NetworkConnection connection, PeerAccountInfoPacket accountInfo) { Connection = connection; AccountInfo = accountInfo; }