コード例 #1
0
        /// <summary>
        ///Broadcasts a new chat DATA
        /// </summary>
        /// <param name="User">Broadcasting user source<</param>
        /// <param name="Data">Data to broadcast</param>
        /// <param name="SendToMe">Send to the broadcaster</param>
        public void BroadCastChatData(GameClient User, string Data, bool SendToMe = false)
        {
            foreach (GameClient ChatUser in this.ChatUsers.Keys)
            {
                if (ChatUser == null)
                {
                    continue;
                }

                if (ChatUser.LoggingOut)
                {
                    continue;
                }

                if (ChatUser.GetRoleplay() == null)
                {
                    continue;
                }

                if (ChatUser.GetRoleplay().WebSocketConnection == null)
                {
                    continue;
                }

                if (!SendToMe)
                {
                    if (ChatUser == User)
                    {
                        continue;
                    }
                }

                PlusEnvironment.GetGame().GetWebEventManager().SendDataDirect(ChatUser, Data);
            }
        }
コード例 #2
0
        /// <summary>
        /// Broadcasts a new chat message entry
        /// </summary>
        /// <param name="User">Broadcasting user source</param>
        /// <param name="Params"></param>
        public void BroadCastNewChat(GameClient User, Dictionary <object, object> Params)
        {
            if (User == null)
            {
                return;
            }

            if (User.LoggingOut)
            {
                return;
            }

            if (User.GetRoleplay().WebSocketConnection == null)
            {
                User.SendWhisper("Sua conexão do websocket está atualmente offline. Entre em contato com um membro da equipe se esse problema persistir", 1);
                return;
            }

            PlusEnvironment.GetGame().GetWebEventManager().SendDataDirect(User, JsonConvert.SerializeObject(new Dictionary <object, object>()
            {
                { "event", "chatManager" },
                { "action", "onsendchat" },
                { "chatname", this.ChatName },
                { "chatmessage", Convert.ToString(Params["chatmessage"]) },
            }));

            this.BroadCastChatData(User, JsonConvert.SerializeObject(new Dictionary <object, object>()
            {
                { "event", "chatManager" },
                { "action", "onchat" },
                { "chatname", this.ChatName },
                { "chatusername", Convert.ToString(Params["chatusername"]) },
                { "chatmessage", Convert.ToString(Params["chatmessage"]) },
                { "chatfigure", User.GetHabbo().Look }
            }));

            #region Text stuff
            foreach (GameClient ChatUser in this.ChatUsers.Keys)
            {
                if (ChatUser == null)
                {
                    continue;
                }

                if (ChatUser == User)
                {
                    continue;
                }

                if (ChatUser.GetRoleplay() == null)
                {
                    continue;
                }

                if (ChatUser.GetRoomUser() == null)
                {
                    continue;
                }

                //ChatUser.SendWhisper("You have received a new text message from the '" + this.ChatName + "' WhatsHolo Group Chat on your " + RoleplayManager.GetPhoneName(ChatUser) + "!", 1);
                //ChatUser.SendMessage(new RoomNotificationComposer("text_message", "message", "Nova mensagem no grupo do WhatsApp '" + this.ChatName + "'!"));
            }
            #endregion
        }