Exemplo n.º 1
0
        /// <summary>
        /// Sends a message to a chat room.
        /// </summary>
        /// <param name="steamIdChat">The SteamID of the chat room.</param>
        /// <param name="type">The message type.</param>
        /// <param name="message">The message.</param>
        public void SendChatRoomMessage(SteamID steamIdChat, EChatEntryType type, string message)
        {
            if (steamIdChat == null)
            {
                throw new ArgumentNullException(nameof(steamIdChat));
            }

            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            SteamID chatId = steamIdChat.ConvertToUInt64(); // copy the steamid so we don't modify it

            if (chatId.IsClanAccount)
            {
                // this steamid is incorrect, so we'll fix it up
                chatId.AccountInstance = ( uint )SteamID.ChatInstanceFlags.Clan;
                chatId.AccountType     = EAccountType.Chat;
            }

            var chatMsg = new ClientMsg <MsgClientChatMsg>();

            chatMsg.Body.ChatMsgType     = type;
            chatMsg.Body.SteamIdChatRoom = chatId;
            chatMsg.Body.SteamIdChatter  = Client.SteamID;

            chatMsg.WriteNullTermString(message, Encoding.UTF8);

            this.Client.Send(chatMsg);
        }
Exemplo n.º 2
0
        public void SendGuestPass(ulong giftId, uint accountId, string email = null)
        {
            var sendGift = new ClientMsg <MsgClientSendGuestPass>();

            sendGift.Body.GiftId = giftId;

            if (string.IsNullOrEmpty(email))
            {
                sendGift.Body.GiftType  = 1;
                sendGift.Body.AccountId = accountId;
                sendGift.WriteNullTermString("");
            }
            else
            {
                sendGift.Body.GiftType  = 0;
                sendGift.Body.AccountId = 0;
                sendGift.WriteNullTermString(email);
            }

            this.Client.Send(sendGift);
        }