Exemplo n.º 1
0
        public override PluginResponse OnEnable(IBotSettings botSettings)
        {
            if (!botSettings.loadWorld)
            {
                return(new PluginResponse(false, "'Load world' must be enabled."));
            }
            if (string.IsNullOrWhiteSpace(Setting[0].Get <string>()) ||
                string.IsNullOrWhiteSpace(Setting[1].Get <string>()))
            {
                return(new PluginResponse(false, "No coordinates have been entered."));
            }
            if (!Setting[0].Get <string>().Contains(' ') || !Setting[1].Get <string>().Contains(' '))
            {
                return(new PluginResponse(false, "Invalid coordinates (does not contain ' ')."));
            }
            var startSplit = Setting[0].Get <string>().Split(' ');
            var endSplit   = Setting[1].Get <string>().Split(' ');

            if (startSplit.Length != 3 || endSplit.Length != 3)
            {
                return(new PluginResponse(false, "Invalid coordinates (must be x y z)."));
            }

            return(new PluginResponse(true));
        }
Exemplo n.º 2
0
        // Run when the plugin is enabled
        public override PluginResponse OnEnable(IBotSettings botSettings)
        {
            // Checks if the inventory setting is enabled
            if (!botSettings.loadInventory)
            {
                // Shows if inventory setting is disabled (disables the plugin)
                return(new PluginResponse(false, "Please enable 'Load Inventory'"));
            }

            // Checks if the user wants to show the GUI
            if (Setting.GetValue <bool>("Show GUI"))
            {
                // Runs if the user wants to show the GUI
                GUI.MainDialog md = new GUI.MainDialog("LOL");
                md.ShowDialog();
            }

            // Checks if the image location is valid
            if (System.IO.File.Exists(Setting.GetValue <string>("Image Location")))
            {
                // Enables the plugin if the image location is valid
                return(new PluginResponse(true));
            }
            // Disables if the image location is invalid
            return(new PluginResponse(false, "Please select an image"));
        }
Exemplo n.º 3
0
        public void Start(IBot bot, IBotSettings settings, List <IMessageSenderService> senders, ILoggerService logger)
        {
            IsRunning = true;
            while (IsRunning)
            {
                Thread.Sleep(TimeSpan.FromDays(1));
                List <Contribution> contributions;
                using (var db = new Database())
                {
                    contributions = db.Contributions.ToList();
                }

                foreach (var contribution in contributions)
                {
                    using (var db = new Database())
                    {
                        var contr = db.Contributions.Single(c => c.UserId == contribution.UserId);
                        contr.CountDay -= 1;
                        contr.Money     = contr.Money + ((contr.Money / 100) * 7);
                        if (contr.CountDay <= 0)
                        {
                            var user = db.Users.Single(u => u.Id == contr.UserId);
                            user.MoneyInBank += contr.Money;
                            db.Contributions.Remove(contr);
                        }
                        db.SaveChanges();
                    }
                }
            }
        }
Exemplo n.º 4
0
        public IList <BotViewer> GetBots(Transform parent)
        {
            IList <BotViewer> bots = new List <BotViewer>();

            IEnumerator <IBotSettings> enumerator = resourcesManager.GamePrefabs
                                                    .GetBotsSettings()
                                                    .GetEnumerator();

            int i = 1;

            while (enumerator.MoveNext())
            {
                IBotSettings botSettings = enumerator.Current;

                Transform     botObj        = Object.Instantiate(botSettings?.Transform(), parent);
                Vector2       startPosition = GetStartPosition(i);
                IMoveStrategy moveStrategy  = _pullMoveStrategy.GetMoveStrategy(botSettings.Strategy());
                IState        state         = new Move(botSettings.Trap(), botSettings.HitBoxRadius());
                BotViewer     botViewerView = new BotViewer(botObj, startPosition, state, moveStrategy);

                bots.Add(botViewerView);

                i++;
            }

            enumerator.Dispose();

            return(bots);
        }
Exemplo n.º 5
0
        private int runCount = 0; // number of times run has been called

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="Bot"/> class.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="userInteraction">The user interaction manager..</param>
        /// <param name="console">The console.</param>
        /// <param name="settings">The settings.</param>
        /// <param name="listener">The listener.</param>
        /// <param name="pluginHandler">The plugin handler.</param>
        /// <param name="moduleLoader">The module loader.</param>
        /// <param name="authorization">The authorization manager.</param>
        public Bot(
            Client client, 
            IUserInteraction userInteraction, 
            IConsole console, 
            IBotSettings settings, 
            IListener listener, 
            IPluginHandler pluginHandler,
            IModuleLoader moduleLoader,
            IAuthorization authorization)
        {
            Guard.Against(client.IsNull(), "client");
            Guard.Against(userInteraction.IsNull(), "userInteraction");
            Guard.Against(console.IsNull(), "console");
            Guard.Against(settings.IsNull(), "settings");
            Guard.Against(listener.IsNull(), "listener");
            Guard.Against(pluginHandler.IsNull(), "pluginHandler");
            Guard.Against(moduleLoader.IsNull(), "moduleLoader");
            Guard.Against(authorization.IsNull(), "authorization");

            this.client = client;
            this.userInteraction = userInteraction;
            this.console = console;
            this.settings = settings;
            this.listener = listener;
            this.pluginHandler = pluginHandler;
            this.moduleLoader = moduleLoader;
            this.authorization = authorization;
            this.SessionStart = DateTime.Now;
        }
Exemplo n.º 6
0
        public override PluginResponse OnEnable(IBotSettings botSettings)
        {
            if (!botSettings.loadEntities || !botSettings.loadPlayers)
            {
                return(new PluginResponse(false, "'Load entities & load players' must be enabled."));
            }
            if (!botSettings.loadWorld && !string.IsNullOrWhiteSpace(Setting[7].Get <string>()))
            {
                return(new PluginResponse(false, "'Load worlds' must be enabled."));
            }

            try {
                if (string.IsNullOrWhiteSpace(Setting[0].Get <string>()))
                {
                    return(new PluginResponse(false, "Could not parse discord id."));
                }
                ulong.Parse(Setting[0].Get <string>());
            }
            catch (Exception ex) {
                return(new PluginResponse(false, "Could not parse discord id."));
            }

            // Do warnings.
            if (string.IsNullOrWhiteSpace(Setting[7].Get <string>()) && (!botSettings.loadWorld || botSettings.staticWorlds))
            {
                DiscordHelper.Error("[RaidAlerts] 'Load worlds' should be enabled, 'Shared worlds' should be disabled.", 584);
            }
            if (Setting[10].Get <bool>() && (!botSettings.loadEntities || !botSettings.loadMobs))
            {
                DiscordHelper.Error("[RaidAlerts] 'Load entities' & 'Load mobs' should be enabled.", 585);
            }

            return(new PluginResponse(true));
        }
Exemplo n.º 7
0
        public override PluginResponse OnEnable(IBotSettings botSettings)
        {
            toSaveQueue = new ConcurrentQueue <IPlayer>();
            stopped     = false;
            new Thread(SaveLoop).Start();

            return(new PluginResponse(true));
        }
Exemplo n.º 8
0
 public override PluginResponse OnEnable(IBotSettings botSettings)
 {
     if (!botSettings.loadEntities || !botSettings.loadPlayers)
     {
         return(new PluginResponse(false, "'Load entities & load players' must be enabled."));
     }
     return(new PluginResponse(true));
 }
Exemplo n.º 9
0
 public override PluginResponse OnEnable(IBotSettings botSettings)
 {
     if (!botSettings.loadChat)
     {
         return(new PluginResponse(false, "'Load chat' must be enabled."));
     }
     return(new PluginResponse(true));
 }
Exemplo n.º 10
0
        /// <summary>
        /// Bot
        /// </summary>
        /// <param name="settings">Настройки бота</param>
        /// <param name="unknownCommand">Команда, которая вызывается, когда ядро не смогло найти в Ваших командах нужную, если пусто - используется встроенная.</param>
        /// <param name="updaterServices">Сервивы получения сообщений, если пусто используются встроенные</param>
        /// <param name="senders">Сервивы отправки сообщений, если пусто используются встроенные</param>
        /// <param name="processor">Экзепляр класса обработки полученных сообщений, если пусто используется встроенный</param>
        /// <param name="logger">Экзепляр класса логгера, если пусто используется встроенный.</param>
        public Bot(IBotSettings settings, INucleusCommand unknownCommand = null, List <IGetUpdateService> updaterServices = null, List <IMessageSenderService> senders = null, IProcessor processor = null, ILoggerService logger = null)
        {
            Console.WriteLine("Fooxboy.NucleusBot Core. 2019. Версия: 0.1 alpha");
            Console.WriteLine("Инициалиация NucleusBot...");
            IKernel kernel = new StandardKernel(new NinjectConfigModule());

            _logger      = logger ?? new LoggerService();
            _botServices = new List <INucleusService>();
            _settings    = settings;
            if (updaterServices == null)
            {
                var list = new List <IGetUpdateService>();
                if (_settings.Messenger == Enums.MessengerPlatform.Telegam)
                {
                    list.Add(new Services.TgMessagesService(_settings, _logger));
                }
                else if (_settings.Messenger == Enums.MessengerPlatform.Vkontakte)
                {
                    list.Add(new Services.LongPollService(_settings, _logger));
                }
                else if (_settings.Messenger == Enums.MessengerPlatform.VkontakteAndTelegram)
                {
                    list.Add(new LongPollService(_settings, _logger));
                    list.Add(new TgMessagesService(_settings, _logger));
                }
                _updaters = list;
            }
            else
            {
                _updaters = updaterServices;
            }
            if (senders == null)
            {
                var list = new List <IMessageSenderService>();
                if (_settings.Messenger == Enums.MessengerPlatform.Telegam)
                {
                    list.Add(new Services.TgMessageSenderService(_settings, _logger));
                }
                else if (_settings.Messenger == Enums.MessengerPlatform.Vkontakte)
                {
                    list.Add(new Services.VkMessageSenderService(_settings, _logger));
                }
                else if (_settings.Messenger == Enums.MessengerPlatform.VkontakteAndTelegram)
                {
                    list.Add(new TgMessageSenderService(_settings, _logger));
                    list.Add(new VkMessageSenderService(_settings, _logger));
                }
                SenderServices = list;
            }
            else
            {
                SenderServices = senders;
            }

            AliasesCommand = new Dictionary <string, PayloadNucleusBot>();
            UnknownCommand = unknownCommand ?? new UnknownCommand();
            _processor     = processor ?? new Processor(_logger, this, kernel);
        }
Exemplo n.º 11
0
 public override PluginResponse OnEnable(IBotSettings botSettings)
 {
     // Called once the plugin is ticked in the plugin tab.
     if (string.IsNullOrWhiteSpace(Setting.At(0).Get <string>()))
     {
         return(new PluginResponse(false, "The Server must be set!"));
     }
     return(new PluginResponse(true));
 }
Exemplo n.º 12
0
 public override PluginResponse OnEnable(IBotSettings botSettings)
 {
     if (!botSettings.loadInventory)
     {
         return(new PluginResponse(false, "'Load inventory' must be enabled."));
     }
     FormOpener.ShowForm();
     return(new PluginResponse(true));
 }
Exemplo n.º 13
0
        public override PluginResponse OnEnable(IBotSettings botSettings)
        {
            // Called once the plugin is ticked in the plugin tab.
            if (!botSettings.loadChat)
            {
                return(new PluginResponse(false, "'Load chat' must be enabled."));
            }

            return(new PluginResponse(true));
        }
        public Reddit Create(IBotSettings settings)
        {
            var webAgent = new BotWebAgent(settings.Username, settings.Password, settings.ClientId, settings.ClientSecret, settings.RedirectUri);
            //This will check if the access token is about to expire before each request and automatically request a new one for you
            //"false" means that it will NOT load the logged in user profile so reddit.User will be null
            var reddit = new Reddit(webAgent, false);

            reddit.InitOrUpdateUser();
            return(reddit);
        }
Exemplo n.º 15
0
        public override PluginResponse OnEnable(IBotSettings botSettings)
        {
            if (!botSettings.loadWorld)
            {
                Console.WriteLine("[Spiffy Wanderer] 'Load world' must be enabled.");
                return(new PluginResponse(false, "'Load world' must be enabled."));
            }

            return(new PluginResponse(true, ""));
        }
Exemplo n.º 16
0
 public override PluginResponse OnEnable(IBotSettings botSettings)
 {
     if (!botSettings.loadWorld)
     {
         return(new PluginResponse(false, "'Load world' must be enabled."));
     }
     if (Setting.GetValue <ILocation>("Start x y z").Compare(new Location(0, 0, 0)) && Setting.GetValue <ILocation>("End x y z").Compare(new Location(0, 0, 0)))
     {
         return(new PluginResponse(false, "No coordinates have been entered."));
     }
     return(new PluginResponse(true));
 }
Exemplo n.º 17
0
 public Bot(IActionScheduler actionScheduler, IAnswerSearchEngine answerSearchEngine, IConnectedClients clients,
            IBotClient botDataClient, IBotSettings settings)
 {
     Settings           = settings;
     ActionScheduler    = actionScheduler;
     AnswerSearchEngine = answerSearchEngine;
     BotDataClient      = botDataClient;
     AnswerSearchEngine.SetApiKey(Settings.AnswerSearchApiKey);
     ConnectedClients = clients.ChatClients;
     CommandHandler   = new BotCommandHandler(this);
     _ = ScheduleRepeatedMessages();
 }
Exemplo n.º 18
0
        public void SetupBot(BotType botType, IBotSettings settings)
        {
            switch (botType)
            {
            case BotType.Indicator:
                bot = new IndicatorBot((IndicatorSettings)settings);
                break;

            case BotType.Rebalancer:
                bot = new RebalancerBot((RebalancerSettings)settings);
                break;
            }
        }
Exemplo n.º 19
0
        public BotService(IBotSettings botSettings)
        {
            _broadcastList = new List <int>(botSettings.BroadcastList);

            _botClient = new TelegramBotClient(botSettings.Token);

            var me = _botClient.GetMeAsync().Result;

            Console.WriteLine($"Hello, World! I am user {me.Id} and my name is {me.FirstName}.");

            _botClient.OnMessage += OnMessage;
            _botClient.StartReceiving();
        }
Exemplo n.º 20
0
        public override PluginResponse OnEnable(IBotSettings botSettings)
        {
            if (!botSettings.loadWorld)
            {
                return(new PluginResponse(false, "'Load world' must be enabled."));
            }
            if (botSettings.staticWorlds)
            {
                return(new PluginResponse(false, "'Shared worlds' should be disabled."));
            }

            return(new PluginResponse(true));
        }
Exemplo n.º 21
0
 public override PluginResponse OnEnable(IBotSettings botSettings)
 {
     if (string.IsNullOrWhiteSpace(Setting.At(0).Get <string>()) || !File.Exists(Setting.At(0).Get <string>()))
     {
         return(new PluginResponse(false, "Invalid text file selected."));
     }
     messages = File.ReadAllLines(Setting.At(0).Get <string>());
     if (messages.Length == 0)
     {
         return(new PluginResponse(false, "Invalid text file selected."));
     }
     return(new PluginResponse(true));
 }
Exemplo n.º 22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PluginContext"/> class.
 /// Is marked as internal so external clients cannot instantiate.
 /// </summary>
 /// <param name="client">The client.</param>
 /// <param name="console">The console.</param>
 /// <param name="authorizer">The authorizer.</param>
 /// <param name="chatrooms">The chatrooms.</param>
 /// <param name="listener">The listener.</param>
 /// <param name="botSettings">The bot settings.</param>
 /// <param name="pluginHandler">The plugin handler.</param>
 /// <param name="dispatcher">The system dispatcher.</param>
 /// <param name="packet">The current packet to be processed.</param>
 /// <param name="chatHelper">The chat helper.</param>
 public PluginContext(Client client, IConsole console,
     IAuthorization authorizer, IChatRoomContainer chatrooms,
     IListener listener, IBotSettings botSettings, 
     IPluginHandler pluginHandler, IDispatcher dispatcher, 
     EventPacket packet, IChatHelper chatHelper)
 {
     this.Client = client;
     this.Console = console;
     this.Authorizer = authorizer;
     this.ChatRooms = chatrooms;
     this.Listener = listener;
     this.BotSettings = botSettings;
     this.Plugins = pluginHandler;
     this.Dispatcher = dispatcher;
     this.ThisRoom = chatHelper;
 }
Exemplo n.º 23
0
 public override PluginResponse OnEnable(IBotSettings botSettings)
 {
     if (!botSettings.loadWorld)
     {
         return(new PluginResponse(false, "'Load world' must be enabled."));
     }
     if (!botSettings.loadEntities || !botSettings.loadPlayers)
     {
         return(new PluginResponse(false, "'Load players' must be enabled."));
     }
     if (string.IsNullOrWhiteSpace(this.Setting[0].Get <string>()))
     {
         return(new PluginResponse(false, "Invalid owner name/uuid."));
     }
     return(new PluginResponse(true));
 }
Exemplo n.º 24
0
 public void Start(IBot bot, IBotSettings settings, List <IMessageSenderService> senders, ILoggerService logger)
 {
     IsRunning = true;
     while (IsRunning)
     {
         Thread.Sleep(TimeSpan.FromHours(1));
         using (var db = new Database())
         {
             var users = db.Users.ToList();
             foreach (var user in users)
             {
                 if (user.BusinessIds != "")
                 {
                     var ids = user.BusinessIds.Split(",");
                     foreach (var id in ids)
                     {
                         if (id == "1")
                         {
                             Main.Api.Users.AddMoney(user.Id, 25000);
                         }
                         if (id == "2")
                         {
                             Main.Api.Users.AddMoney(user.Id, 65000);
                         }
                         if (id == "3")
                         {
                             Main.Api.Users.AddMoney(user.Id, 100000);
                         }
                         if (id == "4")
                         {
                             Main.Api.Users.AddMoney(user.Id, 100);
                         }
                         if (id == "5")
                         {
                             Main.Api.Users.AddMoney(user.Id, 100);
                         }
                         if (id == "6")
                         {
                             Main.Api.Users.AddMoney(user.Id, 100);
                         }
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 25
0
        public override PluginResponse OnEnable(IBotSettings botSettings)
        {
            if (!botSettings.loadWorld)
            {
                return(new PluginResponse(false, "'Load world' must be enabled."));
            }
            if (!botSettings.loadInventory)
            {
                return(new PluginResponse(false, "'Load inventory' must be enabled."));
            }
            if (Setting.At(0).Get <ILocation>().Compare(new Location(0, 0, 0)) &&
                Setting.At(1).Get <ILocation>().Compare(new Location(0, 0, 0)))
            {
                return(new PluginResponse(false, "No coordinates have been entered."));
            }

            return(new PluginResponse(true));
        }
Exemplo n.º 26
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindowViewModel"/> class.
        /// </summary>
        /// <param name="bot">The bot.</param>
        /// <param name="settings">Bot settings.</param>        
        /// <param name="dialogs">Dialog service.</param>
        /// <param name="messageBox">MessageBox service.</param>
        /// <param name="chatrooms">The chatroom container.</param>
        /// <param name="chatRoomViewModels">Chatroom view models.</param>
        /// <param name="dispatcher">The dispatcher.</param>
        public MainWindowViewModel(Bot bot, IBotSettings settings, IModalDialogService dialogs,
            IMessageBoxService messageBox, IChatRoomContainer chatrooms, 
            IChatViewModelFactory chatRoomViewModels, IDispatcherHelper dispatcher)
        {
            this.bot = bot;
            this.settings = settings;
            this.dialogs = dialogs;
            this.messageBox = messageBox;
            this.chatRoomViewModels = chatRoomViewModels;
            this.dispatcher = dispatcher;

            // set up commands
            LoadedCommand = new RelayCommand(() => OnLoaded());

            // subscribe to events
            MessengerInstance.Register<LoginSettingsRequested>(this, OnSettingsRequested);
            chatrooms.CollectionChanged += OnChatRoomsChanged;
        }
Exemplo n.º 27
0
        public BotService(
            IBotSettings settings,
            ICommandManager commandManager,
            IInlineKeyboardMarkupBuilder inlineKeyboardMarkupBuilder)
        {
            this.commandManager = commandManager;
            this.inlineKeyboardMarkupBuilder = inlineKeyboardMarkupBuilder;

            bot = settings.UseProxy
                ? new TelegramBotClient(settings.Token, new HttpToSocks5Proxy(settings.ProxyHostName, settings.ProxyPort)
            {
                ResolveHostnamesLocally = true
            })
                : new TelegramBotClient(settings.Token);

            bot.OnMessage       += OnMessageReceived;
            bot.OnMessageEdited += OnMessageReceived;

            bot.OnCallbackQuery += OnBotOnCallbackQueryReceived;
        }
Exemplo n.º 28
0
        public override PluginResponse OnEnable(IBotSettings botSettings)
        {
            // CLear the list in-case
            // it was restarted.
            AccountsSaved.Clear();

            // Request permissions to hook low level events.
            var permission = EventPermissions.CheckPermissions("low-level");

            if (permission == false)
            {
                return(new PluginResponse(false, "Not enough permissions, plugin requires 'All permissions'."));
            }
            EventPermissions.LowLevelHook("Ban checker", LowLevelEvents.OnServerInitialResponse, ServerResponse);

            bool exists = false;

            // Check if the files exist.
            if (!File.Exists(Setting.At(0).Get <string>()))
            {
                DiscordHelper.Alert("'Banned accounts' path not set.", 1);
            }
            else
            {
                exists = true;
            }
            if (!File.Exists(Setting.At(1).Get <string>()))
            {
                DiscordHelper.Alert("'Unbanned accounts' path not set.", 2);
            }
            else
            {
                exists = true;
            }

            if (!exists)
            {
                DiscordHelper.Error("No output paths have been set.", 1);
            }
            return(new PluginResponse(true));
        }
Exemplo n.º 29
0
        public override PluginResponse OnEnable(IBotSettings botSettings)
        {
            if (!botSettings.loadChat)
            {
                return(new PluginResponse(false, "'Load chat' must be enabled."));
            }
            if (string.IsNullOrWhiteSpace(Setting.At(0).Get <string>()))
            {
                return(new PluginResponse(false, "'Authorized Users' not set."));
            }
            if (string.IsNullOrWhiteSpace(Setting.At(1).Get <string>()))
            {
                return(new PluginResponse(false, "'Trigger Keywords' not set."));
            }
            if (string.IsNullOrWhiteSpace(Setting.At(2).Get <string>()))
            {
                return(new PluginResponse(false, "'Trigger Macro' not set."));
            }

            return(new PluginResponse(true));
        }
Exemplo n.º 30
0
        public void Start(IBot bot, IBotSettings settings, List <IMessageSenderService> senders, ILoggerService logger)
        {
            IsRunning = true;
            while (IsRunning)
            {
                Thread.Sleep(TimeSpan.FromHours(1));
                using (var db = new Database())
                {
                    var users = db.Users.Where(u => u.IsBanned);
                    foreach (var user in users)
                    {
                        user.TimeBan -= 1;
                        if (user.TimeBan == 0)
                        {
                            user.IsBanned = false;
                        }
                    }

                    db.SaveChanges();
                }
            }
        }
Exemplo n.º 31
0
        public void Start(IBot bot, IBotSettings settings, List <IMessageSenderService> senders, ILoggerService logger)
        {
            IsRunning = true;

            //повторяется каждую минуту.
            Times = new List <ReportsTimeModel>();
            while (IsRunning)
            {
                Thread.Sleep(60000);
                foreach (var time in Times)
                {
                    if (!(time.Time == 0))
                    {
                        time.Time -= 1;
                    }
                }


                //TODO: оптимизация.
                //if (Times.Count == 0) IsRunning = false;
            }
        }
Exemplo n.º 32
0
 public void Start(IBot bot, IBotSettings settings, List <IMessageSenderService> senders, ILoggerService logger)
 {
     while (IsRunning)
     {
         Thread.Sleep(TimeSpan.FromHours(1));
         using (var db = new Database())
         {
             foreach (var user in db.Users)
             {
                 if (!user.IsAvailbleBonus)
                 {
                     user.TimeBonus -= 1;
                     if (user.TimeBonus <= 0)
                     {
                         user.IsAvailbleBonus = true;
                     }
                     db.SaveChanges();
                 }
             }
         }
     }
 }
Exemplo n.º 33
0
        public override PluginResponse OnEnable(IBotSettings botSettings)
        {
            var notificationsGroup = (IParentSetting)Setting.Get("Notifications");
            var miscellaneousGroup = (IParentSetting)Setting.Get("Miscellaneous");

            if (!botSettings.loadEntities || !botSettings.loadPlayers)
            {
                return(new PluginResponse(false, "'Load entities & load players' must be enabled."));
            }
            if (!botSettings.loadWorld && !string.IsNullOrWhiteSpace(miscellaneousGroup.GetValue <string>("Lamp coordinates")))
            {
                return(new PluginResponse(false, "'Load worlds' must be enabled."));
            }

            try {
                if (string.IsNullOrWhiteSpace(Setting.At(0).Get <string>()))
                {
                    return(new PluginResponse(false, "Could not parse discord id."));
                }
                ulong.Parse(Setting.At(0).Get <string>());
            }
            catch (Exception ex) {
                return(new PluginResponse(false, "Could not parse discord id."));
            }

            // Do warnings.
            if (string.IsNullOrWhiteSpace(miscellaneousGroup.GetValue <string>("Lamp coordinates")) && (!botSettings.loadWorld || botSettings.staticWorlds))
            {
                DiscordHelper.Error("[RaidAlerts] 'Load worlds' should be enabled, 'Shared worlds' should be disabled.", 584);
            }
            if ((notificationsGroup.GetValue <bool>("Detect falling tnt") || notificationsGroup.GetValue <bool>("Detect falling sand")) && (!botSettings.loadEntities || !botSettings.loadMobs))
            {
                DiscordHelper.Error("[RaidAlerts] 'Load entities' & 'Load mobs' should be enabled.", 585);
            }

            return(new PluginResponse(true));
        }
Exemplo n.º 34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChatViewModel"/> class.
 /// </summary>
 /// <param name="chatRoom">The chat room.</param>
 /// <param name="settings">Bot Settings.</param>
 public ChatViewModel(ChatRoom chatRoom, IBotSettings settings)
 {
     this.chatRoom = chatRoom;
     this.userName = settings.UserName;
 }
Exemplo n.º 35
0
 public BotInfoViewModel(IBotSettings settings)
     : base()
 {
     this.settings = settings;
     MessengerInstance.Register<LoginSettingsLoaded>(this, e => LoadSettings());
 }