示例#1
0
        public void AddChatCommand(string name, Plugin plugin, string callback_name)
        {
            var command_name = name.ToLowerInvariant();

            ChatCommand cmd;
            if (chatCommands.TryGetValue(command_name, out cmd))
            {
                var previous_plugin_name = cmd.Plugin?.Name ?? "an unknown plugin";
                var new_plugin_name = plugin?.Name ?? "An unknown plugin";
                var msg = $"{new_plugin_name} has replaced the '{command_name}' chat command previously registered by {previous_plugin_name}";
                Interface.Oxide.LogWarning(msg);
            }

            cmd = new ChatCommand(command_name, plugin, callback_name);

            // Add the new command to collections
            chatCommands[command_name] = cmd;

            var commandAttribute = new CommandAttribute("/" + command_name, string.Empty);
            var action = (Action<CommandInfo>)Delegate.CreateDelegate(typeof(Action<CommandInfo>), this, GetType().GetMethod("HandleCommand", BindingFlags.NonPublic | BindingFlags.Instance));
            commandAttribute.Method = action;
            if (CommandManager.RegisteredCommands.ContainsKey(command_name))
            {
                var new_plugin_name = plugin?.Name ?? "An unknown plugin";
                var msg = $"{new_plugin_name} has replaced the '{command_name}' chat command";
                Interface.Oxide.LogWarning(msg);
            }
            CommandManager.RegisteredCommands[command_name] = commandAttribute;

            // Hook the unload event
            if (plugin) plugin.OnRemovedFromManager += plugin_OnRemovedFromManager;
        }
示例#2
0
        /// <summary>
        ///     Processes the input text and returns the processed value.
        /// </summary>
        /// <returns>The processed output</returns>
        protected override string ProcessChange()
        {
            var result = new AlfredCommandResult();

            var recipient = ChatEngine.Owner as IAlfredCommandRecipient;

            // Check to make sure we have a recipient to talk to
            if (recipient == null)
            {
                Log(Resources.AlfredTagHandlerProcessChangeNoRecipient, LogLevel.Warning);

                return result.Output.NonNull();
            }

            // Build a command
            var name = GetAttribute("command");
            var subsystem = GetAttribute("subsystem");
            var data = GetAttribute("data");

            var command = new ChatCommand(subsystem, name, data);

            // Send the command on to the owner. This may modify result or carry out other actions.
            recipient.ProcessAlfredCommand(command, result);

            // Get the output value from the result in case it was set externally
            return result.Output.NonNull();
        }
        private void button_Click(object sender, RoutedEventArgs e)
        {
            if (commandBox.Text == "" || nameBox.Text == "")
            {
                MessageBox.Show("You must include a name and a command.", "Error", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
            }
            else
            {
                CC = new ChatCommand()
                {
                    Name = "",
                    Command = "",
                    TriggerNumbers = new TriggerNumbers(),
                    TriggerLists = new TriggerLists()
                };

                CC.Command = commandBox.Text;
                CC.Name = nameBox.Text;
                List<SteamID> ignores = new List<SteamID>();
                List<SteamID> rooms = new List<SteamID>();
                List<SteamID> users = new List<SteamID>();
                if (delayBox.Text == "") CC.TriggerNumbers.Delay = null;
                else CC.TriggerNumbers.Delay = Convert.ToInt32(delayBox.Text);

                if (probBox.Text == "") CC.TriggerNumbers.Probability = null;
                else CC.TriggerNumbers.Probability = (float)Convert.ToDouble(probBox.Text);

                if (timeoutBox.Text == "") CC.TriggerNumbers.Timeout = null;
                else CC.TriggerNumbers.Timeout = Convert.ToInt32(timeoutBox.Text);

                if (ignoresBox.Text.Split(',').Length > 0 && ignoresBox.Text != "")
                {
                    foreach (string ignore in ignoresBox.Text.Split(','))
                    {
                        ignores.Add(new SteamID(Convert.ToUInt64(ignore)));
                    }
                }
                if (roomsBox.Text.Split(',').Length > 0 && roomsBox.Text != "")
                {
                    foreach (string room in roomsBox.Text.Split(','))
                    {
                        rooms.Add(new SteamID(Convert.ToUInt64(room)));
                    }
                }
                if (usersBox.Text.Split(',').Length > 0 && usersBox.Text != "")
                {
                    foreach (string user in usersBox.Text.Split(','))
                    {
                        users.Add(new SteamID(Convert.ToUInt64(user)));
                    }
                }

                CC.TriggerLists.Ignore = ignores;
                CC.TriggerLists.Rooms = rooms;
                CC.TriggerLists.User = users;
                DialogResult = true;
                Close();
            }
        }
示例#4
0
        /// <summary>
        /// Checks if a player can use a certain command based on the permissions system.
        /// </summary>
        /// <param name="player"></param>
        /// <param name="command"></param>
        /// <returns></returns>
        public static bool CanAccess(this IMyPlayer player, ChatCommand command)
        {
            if (player.IsAdmin())
                return true;
            if (Storage.Data.Perms.Groups.Count == 0)
                return true;
            if (Storage.Data.Perms.Groups.Find(g => g.Members.Contains(player.PlayerID) && g.Commands.Contains(command.Name)) != null)
                return true;

            return false;
        }
 /// <summary>Initializes a new instance of the <see cref="UserStatementResponse" /> class.</summary>
 /// <param name="userInput">The user input.</param>
 /// <param name="responseText">The response text.</param>
 /// <param name="template">The template.</param>
 /// <param name="command">The Command.</param>
 /// <param name="resultData">Information describing the result.</param>
 public UserStatementResponse(
     [CanBeNull] string userInput,
     [CanBeNull] string responseText,
     [CanBeNull] string template,
     ChatCommand command,
     [CanBeNull] object resultData)
 {
     UserInput = userInput ?? string.Empty;
     ResponseText = responseText ?? string.Empty;
     Template = template;
     Command = command;
     ResultData = resultData;
 }
        // Load all command types.
        private void LoadCommands()
        {
            List <Type> CommandTypes = new List <Type>();

            CommandTypes.AddRange(
                Assembly.GetCallingAssembly().GetTypes().Where(t => typeof(ChatCommand).IsAssignableFrom(t))
                );

            foreach (Type t in CommandTypes)
            {
                if (t == typeof(ChatCommand))
                {
                    continue;
                }
                ChatCommand instance = (ChatCommand)Activator.CreateInstance(t, null);
                instance.Register(_commands); // Done like this so scripted commands can be less hardcoded.
            }
        }
示例#7
0
        public static ChatCommand GetCommandAtIndex(int index)
        {
            DataRow row = GetDataRow("commands", index);

            ChatCommand command = new ChatCommand(
                row["trigger_text"].ToString(),
                row["response_text"].ToString(),
                row["channel_name"].ToString(),
                (bool)row["is_universal"],
                (bool)row["must_be_exact"],
                (bool)row["whisper_response"],
                (bool)row["subscriber_only"],
                (bool)row["moderator_only"],
                (bool)row["broadcaster_only"]
                );

            return(command);
        }
        public void Execute(ChatCommand command, IChatService twitch)
        {
            if (_First)
            {
                _First = false;
                _Teas  = GoogleSheet.GetValuesFromSheet("DrinkMeTeas");
            }

            var theseTeas = new IList <object> [_Teas.Count];

            _Teas.CopyTo(theseTeas, 0);
            theseTeas = ShuffleTeas(theseTeas.ToList(), 5).ToArray();
            var randomPick = new Random().Next(0, theseTeas.Count());

            var theRecord = theseTeas.Skip(randomPick).First();

            twitch.BroadcastMessageOnChannel($"{command.ChatMessage.DisplayName} - you should drink {theRecord[0].ToString()} and you can find more at {theRecord[1].ToString()}");
        }
示例#9
0
        public void Execute(ChatCommand command, IChatService twitch)
        {
            if (!Validate(command, twitch))
            {
                return;
            }

            var userName = command.ArgumentsAsList[0].Trim();

            if (userName == "all")
            {
                GoogleSheet.AddPixelsForChatters(command.ChatMessage.Channel, int.Parse(command.ArgumentsAsList[1]), command.ChatMessage.DisplayName);
            }
            else
            {
                GoogleSheet.AddPixelsForUser(command.ArgumentsAsList[0].Trim(), int.Parse(command.ArgumentsAsList[1]), command.ChatMessage.DisplayName);
            }
        }
示例#10
0
        public TwitchCommand(ChatCommand cmd)
        {
            this.Command   = cmd.CommandText?.ToLower();
            this.Arguments = cmd.ArgumentsAsString;

            var isModerator   = cmd.ChatMessage.IsModerator;
            var isSubscriber  = cmd.ChatMessage.IsSubscriber;
            var isBroadcaster = cmd.ChatMessage.IsBroadcaster;

            this.Sender = new TwitchCommandSender(
                cmd.ChatMessage.UserId,
                cmd.ChatMessage.Username,
                cmd.ChatMessage.DisplayName,
                isBroadcaster,
                isModerator,
                isSubscriber,
                cmd.ChatMessage.ColorHex);
        }
示例#11
0
        public void Execute(ChatCommand command, IChatService twitch)
        {
            if (!command.ArgumentsAsList.Any())
            {
                _TheGame.Help(twitch, command.AsGuessGameCommand());
                return;
            }

            try {
                switch (command.ArgumentsAsList[0].ToLowerInvariant())
                {
                case "open":
                    _TheGame.Open(twitch, command.AsGuessGameCommand());
                    break;

                case "reopen":
                    _TheGame.Open(twitch, command.AsGuessGameCommand());
                    break;

                case "help":
                    _TheGame.Help(twitch, command.AsGuessGameCommand());
                    break;

                case "close":
                    _TheGame.Close(twitch, command.AsGuessGameCommand());
                    break;

                case "mine":
                    _TheGame.Mine(twitch, command.AsGuessGameCommand());
                    break;

                case "end":
                    _TheGame.Reset(twitch, command.AsGuessGameCommand());
                    break;

                default:
                    _TheGame.Guess(twitch, command.AsGuessGameCommand());
                    break;
                }
            } catch (InvalidOperationException) {
                twitch.WhisperMessage(command.ChatMessage.Username, "Invalid command...");
                _TheGame.Help(twitch, command.AsGuessGameCommand());
            }
        }
示例#12
0
        public override void Run(ChatCommand context, TwitchClient client)
        {
            string videoId = "";

            if (context.ArgumentsAsList.Count < 1)
            {
                throw new Exception("Invalid parameters");
            }
            else if (context.ArgumentsAsList.Count > 1 || YoutubeClient.TryParseVideoId(context.ArgumentsAsList[0], out videoId) == false)
            {
                client.SendMessage("Sorry! Requesting songs by query doesn't quite work yet, but requesting by URL does!");
            }
            if (!string.IsNullOrEmpty(videoId))
            {
                var video = this.client.GetVideoAsync(videoId).Result;
                client.SendMessage($"@{context.ChatMessage.DisplayName} Your request, \"{video.Title}\", is #{GlobalVariables.GlobalPlaylist.RequestedSongCount + 1} in the queue!");
                GlobalVariables.GlobalPlaylist.Enqueue(new RequestedSong(videoId, context.ChatMessage.DisplayName));
            }
        }
示例#13
0
        public void AddChatCommand(string name, Plugin plugin, string callback_name)
        {
            var command_name = name.ToLowerInvariant();
            ChatCommand cmd;
            if (chatCommands.TryGetValue(command_name, out cmd))
            {
                var previous_plugin_name = cmd.Plugin?.Name ?? "an unknown plugin";
                var new_plugin_name = plugin?.Name ?? "An unknown plugin";
                var msg = $"{new_plugin_name} has replaced the '{command_name}' chat command previously registered by {previous_plugin_name}";
                Interface.Oxide.LogWarning(msg);
            }
            cmd = new ChatCommand(command_name, plugin, callback_name);

            // Add the new command to collections
            chatCommands[command_name] = cmd;

            // Hook the unload event
            if (plugin) plugin.OnRemovedFromManager += plugin_OnRemovedFromManager;
        }
示例#14
0
        public override void Execute(string[] command, NecClient client, ChatMessage message,
                                     List <ChatResponse> responses)
        {
            responses.Add(ChatResponse.CommandError(client, "Available Commands:"));
            Dictionary <string, ChatCommand> commands = server.chat.commandHandler.GetCommands();

            foreach (string key in commands.Keys)
            {
                ChatCommand chatCommand = commands[key];
                if (chatCommand.helpText == null)
                {
                    continue;
                }

                responses.Add(ChatResponse.CommandError(client, "----------"));
                responses.Add(ChatResponse.CommandError(client, $"{key}"));
                responses.Add(ChatResponse.CommandError(client, chatCommand.helpText));
            }
        }
示例#15
0
        private void HandleResolveCommand(ChatCommand command)
        {
            if (command.ArgumentsAsList.Count == 0)
            {
                return;
            }

            var nameOrId = command.ArgumentsAsList[0];

            var res = _resolveHelper.Resolve(nameOrId);

            if (res.Count == 0)
            {
                SendMessage($"Failed to resolve user '{nameOrId}'");
                return;
            }

            SendMessage(string.Join(", ", res.Select(_ => _.ToString())));
        }
示例#16
0
文件: Core.cs 项目: balu92/Fougerite
        public static void Init()
        {
            InitializeCommands();
            ShareCommand   command  = ChatCommand.GetCommand("share") as ShareCommand;
            FriendsCommand command2 = ChatCommand.GetCommand("friends") as FriendsCommand;

            if (File.Exists(RustPPModule.GetAbsoluteFilePath("doorsSave.rpp")))
            {
                command.SetSharedDoors(Helper.ObjectFromFile <Hashtable>(RustPPModule.GetAbsoluteFilePath("doorsSave.rpp")));
            }
            if (File.Exists(RustPPModule.GetAbsoluteFilePath("friendsSave.rpp")))
            {
                command2.SetFriendsLists(Helper.ObjectFromFile <Hashtable>(RustPPModule.GetAbsoluteFilePath("friendsSave.rpp")));
            }
            if (File.Exists(RustPPModule.GetAbsoluteFilePath("admins.xml")))
            {
                Administrator.AdminList = Helper.ObjectFromXML <System.Collections.Generic.List <Administrator> >(RustPPModule.GetAbsoluteFilePath("admins.xml"));
            }
            if (File.Exists(RustPPModule.GetAbsoluteFilePath("cache.rpp")))
            {
                userCache = Helper.ObjectFromFile <Dictionary <ulong, string> >(RustPPModule.GetAbsoluteFilePath("cache.rpp"));
            }
            else
            {
                userCache = new Dictionary <ulong, string>();
            }
            if (File.Exists(RustPPModule.GetAbsoluteFilePath("whitelist.xml")))
            {
                whiteList = new PList(Helper.ObjectFromXML <System.Collections.Generic.List <PList.Player> >(RustPPModule.GetAbsoluteFilePath("whitelist.xml")));
            }
            else
            {
                whiteList = new PList();
            }
            if (File.Exists(RustPPModule.GetAbsoluteFilePath("bans.xml")))
            {
                blackList = new PList(Helper.ObjectFromXML <System.Collections.Generic.List <PList.Player> >(RustPPModule.GetAbsoluteFilePath("bans.xml")));
            }
            else
            {
                blackList = new PList();
            }
        }
示例#17
0
文件: Hooks.cs 项目: balu92/Fougerite
 public static void structureKO(StructureComponent sc, DamageEvent e)
 {
     try
     {
         InstaKOCommand command = ChatCommand.GetCommand("instako") as InstaKOCommand;
         if (command.IsOn(e.attacker.client.userID))
         {
             sc.StartCoroutine("DelayedKill");
         }
         else
         {
             sc.UpdateClientHealth();
         }
     }
     catch
     {
         sc.UpdateClientHealth();
     }
 }
        public void tesMatchCompetition()
        {
            var c1 = new ChatCommand(@"test (?<name>\S*) is (?<disposition>\S*)", (_, __) => { });
            var c2 = new ChatCommand(@"test2 (?<name>\S*) is (?<disposition>\S*)", (_, __) => { }, "something");
            var c3 = new ChatCommand(@"test3 (?<name>\S*) is (?<disposition>\S*)", (_, __) => { }, "somethingelse", PermissionType.GameMaster);

            ccm = new ChatCommandManager(new List <ChatCommand>()
            {
                c1, c2, c3
            });

            var actual              = ccm.MatchCommand("test2 chris is happy");
            var expectedName        = "chris";
            var expectedDisposition = "happy";

            Assert.AreSame(actual.command, c2);
            Assert.AreEqual(expectedName, actual.parameters["name"]);
            Assert.AreEqual(expectedDisposition, actual.parameters["disposition"]);
        }
示例#19
0
        public static void GlobalSendCommand(
            ChatCommand command, ChatUser initiator = null, string param1 = null, string param2 = null
            )
        {
            for (var i = 0; i < m_Users.Count; ++i)
            {
                var user = m_Users[i];

                if (user == initiator)
                {
                    continue;
                }

                if (user.CheckOnline())
                {
                    ChatSystem.SendCommandTo(user.Mobile, command, param1, param2);
                }
            }
        }
示例#20
0
        public static bool IsFriend(HurtEvent e) // ref
        {
            GodModeCommand command = (GodModeCommand)ChatCommand.GetCommand("god");

            Fougerite.Player victim = e.Victim as Fougerite.Player;
            if (victim != null)
            {
                if (command.IsOn(victim.UID))
                {
                    FallDamage dmg = victim.FallDamage;
                    if (dmg != null)
                    {
                        dmg.ClearInjury();
                    }
                    return(true);
                }
                Fougerite.Player attacker = e.Attacker as Fougerite.Player;
                if (attacker != null)
                {
                    FriendsCommand command2 = (FriendsCommand)ChatCommand.GetCommand("amigos");
                    if (command2.ContainsException(attacker.UID) && command2.ContainsException(victim.UID))
                    {
                        return(false);
                    }
                    bool b = Core.config.GetBoolSetting("Settings", "friendly_fire");
                    try
                    {
                        FriendList list = (FriendList)command2.GetFriendsLists()[attacker.UID];
                        if (list == null || b)
                        {
                            return(false);
                        }
                        return(list.isFriendWith(victim.UID));
                    }
                    catch
                    {
                        return(false);
                    }
                }
            }
            return(false);
        }
        public IEnumerable <NewAutoChatCommand> GetNewAutoChatCommands()
        {
            List <NewAutoChatCommand> commandsToAdd = new List <NewAutoChatCommand>();

            if (this.Currency != null)
            {
                ChatCommand statusCommand  = new ChatCommand("User " + this.Currency.Name, this.Currency.SpecialIdentifier, new RequirementViewModel(UserRoleEnum.User, 5));
                string      statusChatText = string.Empty;
                if (this.Currency.IsRank)
                {
                    statusChatText = string.Format("@$username is a ${0} with ${1} {2}!", this.Currency.UserRankNameSpecialIdentifier, this.Currency.UserAmountSpecialIdentifier, this.Currency.Name);
                }
                else
                {
                    statusChatText = string.Format("@$username has ${0} {1}!", this.Currency.UserAmountSpecialIdentifier, this.Currency.Name);
                }
                statusCommand.Actions.Add(new ChatAction(statusChatText));
                commandsToAdd.Add(new NewAutoChatCommand(string.Format("!{0} - {1}", statusCommand.Commands.First(), "Shows User's Amount"), statusCommand));

                if (this.Currency.SpecialTracking == CurrencySpecialTrackingEnum.None)
                {
                    ChatCommand addCommand = new ChatCommand("Add " + this.Currency.Name, "add" + this.Currency.SpecialIdentifier, new RequirementViewModel(UserRoleEnum.Mod, 5));
                    addCommand.Actions.Add(new CurrencyAction(this.Currency, CurrencyActionTypeEnum.AddToSpecificUser, "$arg2text", username: "******"));
                    addCommand.Actions.Add(new ChatAction(string.Format("@$targetusername received $arg2text {0}!", this.Currency.Name)));
                    commandsToAdd.Add(new NewAutoChatCommand(string.Format("!{0} - {1}", addCommand.Commands.First(), "Adds Amount To Specified User"), addCommand));

                    ChatCommand addAllCommand = new ChatCommand("Add All " + this.Currency.Name, "addall" + this.Currency.SpecialIdentifier, new RequirementViewModel(UserRoleEnum.Mod, 5));
                    addAllCommand.Actions.Add(new CurrencyAction(this.Currency, CurrencyActionTypeEnum.AddToAllChatUsers, "$arg1text"));
                    addAllCommand.Actions.Add(new ChatAction(string.Format("Everyone got $arg1text {0}!", this.Currency.Name)));
                    commandsToAdd.Add(new NewAutoChatCommand(string.Format("!{0} - {1}", addAllCommand.Commands.First(), "Adds Amount To All Chat Users"), addAllCommand));

                    if (!this.Currency.IsRank)
                    {
                        ChatCommand giveCommand = new ChatCommand("Give " + this.Currency.Name, "give" + this.Currency.SpecialIdentifier, new RequirementViewModel(UserRoleEnum.User, 5));
                        giveCommand.Actions.Add(new CurrencyAction(this.Currency, CurrencyActionTypeEnum.AddToSpecificUser, "$arg2text", username: "******", deductFromUser: true));
                        giveCommand.Actions.Add(new ChatAction(string.Format("@$username gave @$targetusername $arg2text {0}!", this.Currency.Name)));
                        commandsToAdd.Add(new NewAutoChatCommand(string.Format("!{0} - {1}", giveCommand.Commands.First(), "Gives Amount To Specified User"), giveCommand));
                    }
                }
            }
            return(commandsToAdd);
        }
示例#22
0
        /// <summary>
        /// Adds a chat command
        /// </summary>
        /// <param name="command"></param>
        /// <param name="plugin"></param>
        /// <param name="callback"></param>
        public void AddChatCommand(string command, Plugin plugin, Action <BasePlayer, string, string[]> callback)
        {
            var commandName = command.ToLowerInvariant();

            if (!CanOverrideCommand(command, "chat"))
            {
                var pluginName = plugin?.Name ?? "An unknown plugin";
                Interface.Oxide.LogError("{0} tried to register command '{1}', this command already exists and cannot be overridden!", pluginName, commandName);
                return;
            }

            ChatCommand cmd;

            if (chatCommands.TryGetValue(commandName, out cmd))
            {
                var previousPluginName = cmd.Plugin?.Name ?? "an unknown plugin";
                var newPluginName      = plugin?.Name ?? "An unknown plugin";
                var message            = $"{newPluginName} has replaced the '{commandName}' chat command previously registered by {previousPluginName}";
                Interface.Oxide.LogWarning(message);
            }

            RustCommandSystem.RegisteredCommand covalenceCommand;
            if (RustCore.Covalence.CommandSystem.registeredCommands.TryGetValue(commandName, out covalenceCommand))
            {
                var previousPluginName = covalenceCommand.Source?.Name ?? "an unknown plugin";
                var newPluginName      = plugin?.Name ?? "An unknown plugin";
                var message            = $"{newPluginName} has replaced the '{commandName}' command previously registered by {previousPluginName}";
                Interface.Oxide.LogWarning(message);
                RustCore.Covalence.CommandSystem.UnregisterCommand(commandName, covalenceCommand.Source);
            }

            cmd = new ChatCommand(commandName, plugin, callback);

            // Add the new command to collections
            chatCommands[commandName] = cmd;

            // Hook the unload event
            if (plugin != null && !pluginRemovedFromManager.ContainsKey(plugin))
            {
                pluginRemovedFromManager[plugin] = plugin.OnRemovedFromManager.Add(plugin_OnRemovedFromManager);
            }
        }
        private void ParseCommand(ChatCommand cmd)
        {
            var msg = cmd.ChatMessage;

            if (cmd.CommandText.ToLowerInvariant() == REPLAY_COMMAND)
            {
                Logger.Instance.LogMessage(TracingLevel.INFO, $"{msg.DisplayName} requested a replay");
                if (PageRaised != null)
                {
                    // Are we under cooldown?
                    if ((DateTime.Now - lastPage).TotalSeconds > pageCooldown)
                    {
                        // Is this person allowed to replay?
                        if (allowReplayCommand &&
                            (allowedPagers == null || allowedPagers.Count == 0 || allowedPagers.Contains(msg.DisplayName.ToLowerInvariant())))
                        {
                            lastPage = DateTime.Now;
                            PageRaised?.Invoke(this, new PageRaisedEventArgs(cmd.ArgumentsAsString));

                            /*
                             * if (!String.IsNullOrWhiteSpace(ChatMessage))
                             * {
                             *  string chatMessage = ChatMessage.Replace("{USERNAME}", $"@{msg.DisplayName}");
                             *  client.SendMessage(msg.Channel, chatMessage);
                             * }*/
                        }
                        else
                        {
                            Logger.Instance.LogMessage(TracingLevel.INFO, $"Cannot replay, user {msg.DisplayName} is not allowed to replay. AllowReplay: {allowReplayCommand}");
                        }
                    }
                    else
                    {
                        Logger.Instance.LogMessage(TracingLevel.INFO, $"Cannot replay, cooldown enabled");
                    }
                }
                else
                {
                    Logger.Instance.LogMessage(TracingLevel.INFO, $"Cannot replay, no plugin is currently enabled");
                }
            }
        }
示例#24
0
        private void AddChatCommand(ChatCommand command, CallbackDelegate cb)
        {
            ChatCommand chat = null;

            foreach (ChatCommand cmd in commands)
            {
                if (cmd.getName() == command.getName())
                {
                    chat = cmd;
                    break;
                }
            }

            if (chat != null)
            {
                return;
            }

            commands.Add(chat);
        }
示例#25
0
        private bool IsUserIsAllowed(ChatCommand cmd)
        {
            var username = cmd.ChatMessage.Username.ToLowerInvariant();

            if (usersDictionary.TryGetValue(username, out DateTime lastMessage))
            {
                if ((DateTime.UtcNow - lastMessage).TotalSeconds >= Configuration.TextToSpeechDelay)
                {
                    usersDictionary[username] = DateTime.UtcNow;
                    return(true);
                }
            }
            else
            {
                usersDictionary.Add(username, DateTime.UtcNow);
                return(true);
            }

            return(false);
        }
示例#26
0
 void DoorUse(Fougerite.Player p, DoorEvent de)
 {
     if (Core.IsEnabled() && !de.Open)
     {
         ShareCommand command = ChatCommand.GetCommand("share") as ShareCommand;
         ArrayList    list    = (ArrayList)command.GetSharedDoors()[de.Entity.OwnerID];
         if (list == null)
         {
             de.Open = false;
         }
         else if (list.Contains(p.PlayerClient.userID))
         {
             de.Open = true;
         }
         else
         {
             de.Open = false;
         }
     }
 }
示例#27
0
        private void HandleGetMessages(ChatCommand cmd)
        {
            var messages = _chat
                           .GetMessages(cmd.GetMessagesModel.RoomName)
                           .Select(t => new Message()
            {
                Sender = t.SenderName,
                Text   = t.Text,
                Time   = t.CreatedDate.ToLongTimeString()
            }).ToList();

            var json = JsonConvert.SerializeObject(messages);

            byte[] data = Encoding.UTF8.GetBytes(json);

            var ip   = cmd.SenderIdentifier.Split(':')[0];
            var port = Convert.ToInt32(cmd.SenderIdentifier.Split(':')[1]);

            _client.Send(data, data.Length, ip, port);
        }
示例#28
0
        public CommandResponse GetValue(ChatCommand command)
        {
            var pairs = new List <string>()
            {
                "B8"
            };
            var letters = "CDEFGH";

            for (var i = 2; i <= 7; i++)
            {
                for (var j = 0; j < letters.Length; j++)
                {
                    pairs.Add(letters[j] + i.ToString());
                }
            }

            var marker = pairs[RandomNum(0, pairs.Count - 1)];

            return(new CommandResponse($"@{ command.ChatMessage.Username } has requested you to drop at { marker }", marker));
        }
示例#29
0
    }//跳转到选中好友的聊天面板

    /// <summary>
    /// 发送消息的显示[自带显示]
    /// </summary>
    void SendMsg(Sprite myicon, int selted_id)//显示消息
    {
        if (write.text != "" && write.text.Trim().Length != 0)
        {
            Debug.Log("输入bu为空");
            GameObject chatMassage = Instantiate(msg_me_Prefb, messagePanel);
            if (!myicon)
            {
                Debug.Log("头像失去");
                return;
            }
            chatMassage.transform.Find("Image").GetComponent <Image>().sprite     = myicon;
            chatMassage.transform.Find("rim/ChatText").GetComponent <Text>().text = write.text;

            MessageInfo msg = new MessageInfo//封装消息
            {
                sendId  = NetStart.myInfo.id,
                toIds   = selted_id,
                content = write.text
            };

            List <MessageInfo> msglist;
            MessageInfo.massageAll.TryGetValue(selted_id, out msglist);
            if (msglist == null)
            {
                msglist = new List <MessageInfo>();
                msglist.Add(msg);
                MessageInfo.massageAll.Add(selted_id, msglist);//添加消息
            }
            else
            {
                msglist.Add(msg);
            }
            ChatCommand.Send(msg);
        }
        else
        {
            Debug.Log("输入为空");
        }
        write.text = "";//清空输入框
    }
示例#30
0
        public override async Task <CommandBase> GetNewCommand()
        {
            if (await this.Validate())
            {
                IEnumerable <string> commands = this.GetCommandStrings();

                RequirementViewModel requirements = this.Requirements.GetRequirements();

                if (this.command != null)
                {
                    this.command.Name         = this.NameTextBox.Text;
                    this.command.Commands     = new HashSet <string>(commands);
                    this.command.Requirements = requirements;
                }
                else
                {
                    this.command = new ChatCommand(this.NameTextBox.Text, commands, requirements);
                    if (this.AutoAddToChatCommands && !ChannelSession.Settings.ChatCommands.Contains(this.command))
                    {
                        ChannelSession.Settings.ChatCommands.Add(this.command);
                    }
                }

                this.command.IncludeExclamationInCommands = this.IncludeExclamationInCommandsToggleButton.IsChecked.GetValueOrDefault();
                this.command.Wildcards = this.WildcardsToggleButton.IsChecked.GetValueOrDefault();
                this.command.Unlocked  = this.UnlockedControl.Unlocked;

                this.command.GroupName = !string.IsNullOrEmpty(this.CommandGroupComboBox.Text) ? this.CommandGroupComboBox.Text : null;
                if (!string.IsNullOrEmpty(this.CommandGroupComboBox.Text))
                {
                    if (!ChannelSession.Settings.CommandGroups.ContainsKey(this.CommandGroupComboBox.Text))
                    {
                        ChannelSession.Settings.CommandGroups[this.CommandGroupComboBox.Text] = new CommandGroupSettings(this.CommandGroupComboBox.Text);
                    }
                    ChannelSession.Settings.CommandGroups[this.CommandGroupComboBox.Text].Name = this.CommandGroupComboBox.Text;
                }

                return(this.command);
            }
            return(null);
        }
示例#31
0
        public void ReceiveCallback(Socket user, PackageArgs package)
        {
            Console.WriteLine("New package: " + package.Command.ToString());

            Command     command     = package.Command;
            ChatCommand chatCommand = new ChatCommand();

            if (package.Command == Command.Send_Message)
            {
                chatCommand = ChatCommand.ParseToCommand(
                    ((UserMessage)package.Arguments[Argument.MessageObj]).Content, command);
                command = chatCommand.ParsedCommand;
            }

            switch (command)
            {
            case (Command.User_Setup): UserSetupHandler(user, package); break;

            case (Command.Send_Message): UserSendMeesage(user, package); break;

            case (Command.Get_Last_Messages): GetLastMessages(user); break;

            case (Command.Authorization): UserAuthorization(user, chatCommand); break;

            case (Command.Send_PM): UserSendPM(user, chatCommand); break;

            case (Command.Ban): ActionOnUser(user, chatCommand); break;

            case (Command.Kick): ActionOnUser(user, chatCommand); break;

            case (Command.IvalidCommand): InvalidCommand(user); break;

            case (Command.CheckBlockIP): CheckBlockIP(user, package); break;

            case (Command.Exit): CloseUserSocket(user); return;

            default: Console.WriteLine("Ivalid Package!"); break;
            }

            PackageManag.ReceivePackage(user, ReceiveCallback);
        }
示例#32
0
        protected override async Task PerformInternal(UserViewModel user, IEnumerable <string> arguments)
        {
            using (HttpClient httpClient = new HttpClient())
            {
                using (HttpResponseMessage response = await httpClient.GetAsync(await this.ReplaceStringWithSpecialModifiers(this.Url, user, arguments)))
                {
                    if (response.StatusCode == HttpStatusCode.OK)
                    {
                        string webRequestResult = await response.Content.ReadAsStringAsync();

                        if (!string.IsNullOrEmpty(webRequestResult))
                        {
                            if (this.ResponseAction == WebRequestResponseActionTypeEnum.Chat)
                            {
                                if (ChannelSession.Chat != null)
                                {
                                    await ChannelSession.Chat.SendMessage(await this.ReplaceSpecialIdentifiers(this.ResponseChatText, user, arguments, webRequestResult));
                                }
                            }
                            else if (this.ResponseAction == WebRequestResponseActionTypeEnum.Command)
                            {
                                ChatCommand command = ChannelSession.Settings.ChatCommands.FirstOrDefault(c => c.Name.Equals(this.ResponseCommandName));
                                if (command != null)
                                {
                                    string argumentsText = (this.ResponseCommandArgumentsText != null) ? this.ResponseCommandArgumentsText : string.Empty;
                                    SpecialIdentifierStringBuilder siString = new SpecialIdentifierStringBuilder(argumentsText);
                                    siString.ReplaceSpecialIdentifier(WebRequestAction.ResponseSpecialIdentifier, webRequestResult);
                                    await command.Perform(user, siString.ToString().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries));
                                }
                            }
                            else if (this.ResponseAction == WebRequestResponseActionTypeEnum.SpecialIdentifier)
                            {
                                string replacementText = await this.ReplaceStringWithSpecialModifiers(webRequestResult, user, arguments);

                                SpecialIdentifierStringBuilder.AddCustomSpecialIdentifier(this.SpecialIdentifierName, replacementText);
                            }
                        }
                    }
                }
            }
        }
示例#33
0
        void EntityHurt(HurtEvent he)
        {
            if (Core.IsEnabled())
            {
                InstaKOCommand command = ChatCommand.GetCommand("instako") as InstaKOCommand;

                if (!(he.Attacker is Fougerite.Player))
                {
                    return;
                }

                if (command == null)
                {
                    return;
                }

                if (command.IsOn(((Fougerite.Player)he.Attacker).PlayerClient.userID))
                {
                    if (he.Entity != null)
                    {
                        try
                        {
                            if (!he.IsDecay)
                            {
                                he.Entity.Destroy();
                            }
                            else if (Fougerite.Hooks.decayList.Contains(he.Entity))
                            {
                                Fougerite.Hooks.decayList.Remove(he.Entity);
                            }
                        }
                        catch (Exception ex)
                        { Logger.LogDebug("EntityHurt EX: " + ex); }
                    }
                    else
                    {
                        Logger.LogDebug("he.Entity is null!");
                    }
                }
            }
        }
示例#34
0
        private void SendGenericCommand(IChatService service, ChatCommand cmd)
        {
            if (service == null)
            {
                throw new ArgumentException("IChatService should not be null");
            }

            if (cmd.ArgumentsAsList.Count == 0)
            {
                _machine.Fire(_setHelpTrigger, service, cmd);
                return;
            }
            //todo: choice based on argumentlist instead of called method??
            switch (cmd.ArgumentsAsList[0])
            {
            case "help":
                _machine.Fire(_setHelpTrigger, service, cmd);
                break;

            case "open":
                _machine.Fire(_setOpenTrigger, service, cmd);
                break;

            case "close":
                _machine.Fire(_setCloseTrigger, service, cmd);
                break;

            case "reset":
            case "end":
                _machine.Fire(_setResetTrigger, service, cmd);
                break;

            case "mine":
                _machine.Fire(_setMineTrigger, service, cmd);
                break;

            default:
                _machine.Fire(_setGuessTrigger, service, cmd);
                break;
            }
        }
示例#35
0
        public static void GlobalSendCommand(ChatCommand command, ChatUser initiator, string param1, string param2)
        {
            for (int i = 0; i < m_Users.Count; ++i)
            {
                ChatUser user = (ChatUser)m_Users[i];

                if (user == initiator)
                {
                    continue;
                }

                if (user.CheckOnline())
                {
                    ChatSystem.SendCommandTo(user.m_Mobile, command, param1, param2);
                }
                else if (!m_Users.Contains(i))
                {
                    --i;
                }
            }
        }
示例#36
0
        public void Perform(TwitchClient client, TwitchService service, ChatCommand chatCommand, Command command)
        {
            if (!command.IsActive)
            {
                return;
            }

            var _viewerCollection     = new CouchDbStore <Viewer>(ApplicationSettings.CouchDbUrl);
            var _viewerRankCollection = new CouchDbStore <ViewerRank>(ApplicationSettings.CouchDbUrl);

            var dbViewer  = (_viewerCollection.GetAsync("viewer-username", chatCommand.ChatMessage.Username).GetAwaiter().GetResult()).FirstOrDefault()?.Value;
            var viewRanks = _viewerRankCollection.GetAsync().GetAwaiter().GetResult();

            if (dbViewer != null)
            {
                var viewerRank = viewRanks
                                 .LastOrDefault(r => r.Value.ExperienceRequired <= dbViewer.Points)?.Value.RankName;

                client.SendMessage(chatCommand.ChatMessage.Channel, $"{chatCommand.ChatMessage.Username}, Your rank is {viewerRank}! You have {dbViewer.Points} experience! kungraHYPERS");
            }
        }
示例#37
0
        /// <summary>
        ///     Processes an Alfred Command. If the command is handled, result should be modified accordingly
        ///     and the method should return true. Returning false will not stop the message from being
        ///     propagated.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="result">The result. If the command was handled, this should be updated.</param>
        /// <returns><c>True</c> if the command was handled; otherwise false.</returns>
        public bool ProcessAlfredCommand(ChatCommand command, AlfredCommandResult result)
        {
            var alfred = Alfred;
            if (alfred == null)
            {
                return false;
            }

            // Extract our target for loop readability
            var target = command.Subsystem;

            // Commands are very, very important and need to be logged.
            alfred.Console?.Log(Resources.AlfredCommandRouterProcessAlfredCommandLogHeader,
                                string.Format(CultureInfo.CurrentCulture,
                                              Resources.AlfredCommandRouterProcessAlfredCommandLogMessage,
                                              command.Name,
                                              target,
                                              command.Data),
                                LogLevel.Info);

            // Send the command to each subsystem. These will in turn send it on to their pages and modules.
            foreach (var subsystem in alfred.Subsystems)
            {
                // If the command isn't for the subsystem, move on.
                if (target.HasText() && !target.Matches(subsystem.Id))
                {
                    continue;
                }

                // Send the command to the subsystem for routing. If it's handled, the subsystem will return true.
                if (subsystem.ProcessAlfredCommand(command, result))
                {
                    return true;
                }
            }

            return false;
        }
        public void RegisterChatCommand( ChatCommand command )
        {
            //Check if the given command already is registered
            if ( m_chatCommands.Keys.Any( chatCommand => chatCommand.Command.ToLower( ).Equals( command.Command.ToLower( ) ) ) )
            {
                return;
            }

            GuidAttribute guid = (GuidAttribute)Assembly.GetCallingAssembly( ).GetCustomAttributes( typeof( GuidAttribute ), true )[ 0 ];
            Guid guidValue = new Guid( guid.Value );

            m_chatCommands.Add( command, guidValue );
        }
示例#39
0
		public static void SendCommandTo( Mobile to, ChatCommand type, string param1, string param2 )
		{
			if ( to != null )
				to.Send( new ChatMessagePacket( null, (int)type + 20, param1, param2 ) );
		}
示例#40
0
		public static void SendCommandTo( Mobile to, ChatCommand type, string param1 )
		{
			SendCommandTo( to, type, param1, null );
		}
示例#41
0
		public static void SendCommandTo( Mobile to, ChatCommand type )
		{
			SendCommandTo( to, type, null, null );
		}
示例#42
0
 public static void GlobalSendCommand( ChatCommand command, ChatUser initiator, string param1 )
 {
     GlobalSendCommand( command, initiator, param1, null );
 }
示例#43
0
 public static void GlobalSendCommand( ChatCommand command, string param1, string param2 )
 {
     GlobalSendCommand( command, null, param1, param2 );
 }
示例#44
0
		public void SendCommand( ChatCommand command, ChatUser initiator, string param1 )
		{
			SendCommand( command, initiator, param1, null );
		}
示例#45
0
		public void SendCommand( ChatCommand command, string param1, string param2 )
		{
			SendCommand( command, null, param1, param2 );
		}
示例#46
0
 /// <summary>
 ///     Handles a chat command.
 /// </summary>
 /// <param name="command">The command.</param>
 public void HandleChatCommand(ChatCommand command)
 {
     LastCommand = command;
 }
示例#47
0
        public void SendCommand( ChatCommand command, ChatUser initiator, string param1 = null, string param2 = null )
        {
            foreach ( var user in m_Users.ToArray() )
            {
                if ( user == initiator )
                    continue;

                if ( user.CheckOnline() )
                    ChatSystem.SendCommandTo( user.Mobile, command, param1, param2 );
            }
        }
 public CommandPermissionEvent(Player player, string[] command, ChatCommand chatCmd)
     : base(player, command)
 {
     ChatCommand = chatCmd;
 }
示例#49
0
 public void RegisterChatCommand(string command, Action<string> func, string description)
 {
     ChatCommand cmd = new ChatCommand(command, func, description);
     if (!registeredChatCommands.ContainsKey(command))
     {
         registeredChatCommands.Add(command, cmd);
     }
 }
示例#50
0
        /// <summary>
        ///     Processes an Alfred Command. If the <paramref name="command"/> is handled,
        ///     <paramref name="result"/> should be modified accordingly and the method should
        ///     return true. Returning <see langword="false"/> will not stop the message from being
        ///     propagated.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="result">
        /// The result. If the <paramref name="command"/> was handled, this should be updated.
        /// </param>
        /// <returns>
        ///     <c>True</c> if the <paramref name="command"/> was handled; otherwise false.
        /// </returns>
        public override bool ProcessAlfredCommand(ChatCommand command, AlfredCommandResult result)
        {
            var al = AlfredInstance as TestAlfred;
            if (al != null)
            {
                al.LastCommand = command;
            }

            return base.ProcessAlfredCommand(command, result);
        }
示例#51
0
		public void SendCommand( ChatCommand command )
		{
			SendCommand( command, null, null, null );
		}
        protected ChatManager( )
        {
            m_instance = this;

            m_chatMessages = new List<string>( );
            m_chatHistory = new List<ChatEvent>( );
            m_chatHandlerSetup = false;
            m_resourceLock = new FastResourceLock( );
            m_chatEvents = new List<ChatEvent>( );
            m_chatCommands = new Dictionary<ChatCommand, Guid>( );

            ChatCommand deleteCommand = new ChatCommand( "delete", Command_Delete, true );

            ChatCommand tpCommand = new ChatCommand( "tp", Command_Teleport, true );

            ChatCommand stopCommand = new ChatCommand( "stop", Command_Stop, true );

            ChatCommand getIdCommand = new ChatCommand( "getid", Command_GetId, true );

            ChatCommand saveCommand = new ChatCommand( "save", Command_Save, true );

            ChatCommand ownerCommand = new ChatCommand( "owner", Command_Owner, true );

            ChatCommand exportCommand = new ChatCommand( "export", Command_Export, true );

            ChatCommand importCommand = new ChatCommand( "import", Command_Import, true );

            ChatCommand spawnCommand = new ChatCommand( "spawn", Command_Spawn, true );

            ChatCommand clearCommand = new ChatCommand( "clear", Command_Clear, true );

            ChatCommand listCommand = new ChatCommand( "list", Command_List, true );

            ChatCommand kickCommand = new ChatCommand( "kick", Command_Kick, true );

            ChatCommand onCommand = new ChatCommand( "on", Command_On, true );

            ChatCommand offCommand = new ChatCommand( "off", Command_Off, true );

            ChatCommand banCommand = new ChatCommand( "ban", Command_Ban, true );

            ChatCommand unbanCommand = new ChatCommand( "unban", Command_Unban, true );

            ChatCommand asyncSaveCommand = new ChatCommand( "savesync", Command_SyncSave, true );

            RegisterChatCommand( offCommand );
            RegisterChatCommand( onCommand );
            RegisterChatCommand( deleteCommand );
            RegisterChatCommand( tpCommand );
            RegisterChatCommand( stopCommand );
            RegisterChatCommand( getIdCommand );
            RegisterChatCommand( saveCommand );
            RegisterChatCommand( ownerCommand );
            RegisterChatCommand( exportCommand );
            RegisterChatCommand( importCommand );
            RegisterChatCommand( spawnCommand );
            RegisterChatCommand( clearCommand );
            RegisterChatCommand( listCommand );
            RegisterChatCommand( kickCommand );
            RegisterChatCommand( banCommand );
            RegisterChatCommand( unbanCommand );
            RegisterChatCommand( asyncSaveCommand );

            ApplicationLog.BaseLog.Info( "Finished loading ChatManager" );
        }
示例#53
0
		public void SendCommand( ChatCommand command, ChatUser initiator )
		{
			SendCommand( command, initiator, null, null );
		}
示例#54
0
 public void SendCommand(ChatCommand command, string param1)
 {
     this.SendCommand(command, null, param1, null);
 }
示例#55
0
 public static void GlobalSendCommand( ChatCommand command )
 {
     GlobalSendCommand( command, null, null, null );
 }
示例#56
0
        /// <summary>
        ///     Processes an Alfred Command. If the <paramref name="command" /> is handled,
        ///     <paramref name="result" /> should be modified accordingly and the method should return true.
        ///     Returning false will not stop the message from being propagated.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="result">The result. If the command was handled, this should be updated.</param>
        /// <returns><c>True</c> if the command was handled; otherwise false.</returns>
        public virtual bool ProcessAlfredCommand(
            ChatCommand command,
            [CanBeNull] AlfredCommandResult result)
        {
            /* If there's no result, there's no way any feedback could get back.
            This is just here to protect against bad input */

            if (result == null) { return false; }

            // Only route messages to sub-components if they don't have a destination
            if (command.Subsystem.IsEmpty() || command.Subsystem.Matches(Id))
            {
                foreach (var page in Pages)
                {
                    if (page.ProcessAlfredCommand(command, result)) { return true; }
                }
            }

            return false;
        }
示例#57
0
 public static void GlobalSendCommand( ChatCommand command, ChatUser initiator )
 {
     GlobalSendCommand( command, initiator, null, null );
 }
示例#58
0
        protected ChatManager()
        {
            m_instance = this;

            m_chatMessages = new List<string>();
            m_chatHandlerSetup = false;
            m_chatEvents = new List<ChatEvent>();
            m_chatCommands = new List<ChatCommand>();

            ChatCommand deleteCommand = new ChatCommand();
            deleteCommand.command = "delete";
            deleteCommand.callback = Command_Delete;
            deleteCommand.requiresAdmin = true;

            ChatCommand tpCommand = new ChatCommand();
            tpCommand.command = "tp";
            tpCommand.callback = Command_Teleport;
            tpCommand.requiresAdmin = true;

            ChatCommand stopCommand = new ChatCommand();
            stopCommand.command = "stop";
            stopCommand.callback = Command_Stop;
            stopCommand.requiresAdmin = true;

            ChatCommand getIdCommand = new ChatCommand();
            getIdCommand.command = "getid";
            getIdCommand.callback = Command_GetId;
            getIdCommand.requiresAdmin = true;

            ChatCommand saveCommand = new ChatCommand();
            saveCommand.command = "save";
            saveCommand.callback = Command_Save;
            saveCommand.requiresAdmin = true;

            ChatCommand ownerCommand = new ChatCommand();
            ownerCommand.command = "owner";
            ownerCommand.callback = Command_Owner;
            ownerCommand.requiresAdmin = true;

            ChatCommand exportCommand = new ChatCommand();
            exportCommand.command = "export";
            exportCommand.callback = Command_Export;
            exportCommand.requiresAdmin = true;

            ChatCommand importCommand = new ChatCommand();
            importCommand.command = "import";
            importCommand.callback = Command_Import;
            importCommand.requiresAdmin = true;

            ChatCommand spawnCommand = new ChatCommand();
            spawnCommand.command = "spawn";
            spawnCommand.callback = Command_Spawn;
            spawnCommand.requiresAdmin = true;

            ChatCommand clearCommand = new ChatCommand();
            clearCommand.command = "clear";
            clearCommand.callback = Command_Clear;
            clearCommand.requiresAdmin = true;

            ChatCommand listCommand = new ChatCommand();
            listCommand.command = "list";
            listCommand.callback = Command_List;
            listCommand.requiresAdmin = true;

            ChatCommand offCommand = new ChatCommand();
            offCommand.command = "off";
            offCommand.callback = Command_Off;
            offCommand.requiresAdmin = true;

            RegisterChatCommand(deleteCommand);
            RegisterChatCommand(tpCommand);
            RegisterChatCommand(stopCommand);
            RegisterChatCommand(getIdCommand);
            RegisterChatCommand(saveCommand);
            RegisterChatCommand(ownerCommand);
            RegisterChatCommand(exportCommand);
            RegisterChatCommand(importCommand);
            RegisterChatCommand(spawnCommand);
            RegisterChatCommand(clearCommand);
            RegisterChatCommand(listCommand);
            RegisterChatCommand(offCommand);

            SetupWCFService();

            Console.WriteLine("Finished loading ChatManager");
        }
示例#59
0
        public static void GlobalSendCommand( ChatCommand command, ChatUser initiator, string param1, string param2 )
        {
            for ( int i = 0; i < m_Users.Count; ++i )
            {
                ChatUser user = (ChatUser)m_Users[i];

                if ( user == initiator )
                    continue;

                if ( user.CheckOnline() )
                    ChatSystem.SendCommandTo( user.m_Mobile, command, param1, param2 );
                else if ( !m_Users.Contains( i ) )
                    --i;
            }
        }
示例#60
0
        public void RegisterChatCommand(ChatCommand command)
        {
            //Check if the given command already is registered
            foreach (ChatCommand chatCommand in m_chatCommands)
            {
                if (chatCommand.command.ToLower().Equals(command.command.ToLower()))
                    return;
            }

            m_chatCommands.Add(command);
        }