Ejemplo n.º 1
0
        public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command)
        {
            string tableName = commandController.GetTableNameFromCommandTerms(terms);

            SavedRollTable deleteTable = Utils.GetTableFromId(bot.SavedTables, tableName);

            string sendMessage = "No tables found for [user]" + characterName + "[/user]";

            if (deleteTable != null)
            {
                if (characterName == deleteTable.OriginCharacter)
                {
                    bot.SavedTables.Remove(deleteTable);

                    sendMessage = "[b]" + deleteTable.TableId + "[/b] deleted by [user]" + characterName + "[/user]";

                    Utils.WriteToFileAsData(bot.SavedTables, Utils.GetTotalFileName(BotMain.FileFolder, BotMain.SavedTablesFileName));
                }
                else
                {
                    sendMessage = "Only " + deleteTable.OriginCharacter + " can delete their own saved table.";
                }
            }

            bot.SendMessageInChannel(sendMessage, channel);
        }
Ejemplo n.º 2
0
        public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command)
        {
            ChannelSettings thisChannel = bot.GetChannelSettings(channel);

            if (thisChannel.AllowTableInfo)
            {
                string tableName = commandController.GetTableNameFromCommandTerms(terms);

                SavedRollTable infoTable = Utils.GetTableFromId(bot.SavedTables, tableName);

                string sendMessage = "Table \'" + tableName + "\' not found.";
                if (infoTable != null)
                {
                    sendMessage = "Table id [b]" + infoTable.TableId + "[/b] created by [user]" + infoTable.OriginCharacter + "[/user]";

                    if (infoTable.Table != null)
                    {
                        string tabledesc = infoTable.Table.Description + "\n";
                        sendMessage += "\n\n Name: [b]" + infoTable.Table.Name + "[/b]\n " + tabledesc + " Roll Die: d" + infoTable.Table.DieSides + " Roll Bonus: " + infoTable.Table.RollBonus;
                        sendMessage += "\n" + infoTable.Table.GetTableEntryList();
                    }
                    else
                    {
                        sendMessage += "\n (Rolltable contents not found)";
                    }
                }

                bot.SendMessageInChannel(sendMessage, channel);
            }
            else
            {
                bot.SendMessageInChannel(Name + " is currently not allowed in this channel under " + Utils.GetCharacterUserTags("Dice Bot") + "'s settings for this channel.", channel);
            }
        }
Ejemplo n.º 3
0
        public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command)
        {
            ChannelSettings thisChannel = bot.GetChannelSettings(channel);

            if (thisChannel.AllowTableRolls)
            {
                bool includeLabel   = true;
                bool secondaryRolls = true;

                if (terms != null && terms.Length >= 1 && terms.Contains("nolabel"))
                {
                    includeLabel = false;
                }
                if (terms != null && terms.Length >= 1 && terms.Contains("nosecondary"))
                {
                    secondaryRolls = false;
                }

                int    rollModifier = commandController.GetRollModifierFromCommandTerms(terms);
                string tableName    = commandController.GetTableNameFromCommandTerms(terms);

                SavedRollTable savedTable = Utils.GetTableFromId(bot.SavedTables, tableName);

                if (savedTable.DefaultTable || thisChannel.AllowCustomTableRolls)
                {
                    string sendMessage = bot.DiceBot.GetRollTableResult(bot.SavedTables, tableName, characterName, channel, rollModifier, includeLabel, secondaryRolls, 3);

                    bot.SendMessageInChannel(sendMessage, channel);
                }
                else
                {
                    bot.SendMessageInChannel("Only default talbes are allowed in this channel under " + Utils.GetCharacterUserTags("Dice Bot") + "'s settings for this channel.", channel);
                }
            }
            else
            {
                bot.SendMessageInChannel(Name + " is currently not allowed in this channel under " + Utils.GetCharacterUserTags("Dice Bot") + "'s settings for this channel.", channel);
            }
        }