Exemple #1
0
        public Dingo(BotConfig config)
        {
            Instance      = this;
            Configuration = config;
            Logger        = new Logger("BOT");

            Logger.Log("Creating Stack Exchange Client");
            Redis = new StackExchangeClient(config.Redis.Address, config.Redis.Database, Logger.CreateChild("REDIS"));
            Namespace.SetRoot(config.Redis.Prefix);

            Logger.Log("Creating new Bot");
            Discord = new DiscordClient(new DiscordConfiguration()
            {
                Token = config.Token
            });

            Logger.Log("Creating Instances");
            ReplyManager = new ReplyManager(this, Logger.CreateChild("REPLY"));
            SiegeManager = new SiegeManager(this, Logger.CreateChild("SIEGE"));
            LastManager  = new LastManager(this, Logger.CreateChild("LAST"));

            Logger.Log("Creating Command Next");
            var deps = new ServiceCollection()
                       .AddSingleton(this)
                       .BuildServiceProvider(true);

            CommandsNext = Discord.UseCommandsNext(new CommandsNextConfiguration()
            {
                PrefixResolver = ResolvePrefix, Services = deps
            });
            CommandsNext.RegisterConverter(new QueryConverter());
            CommandsNext.RegisterConverter(new CommandQueryArgumentConverter());
            CommandsNext.RegisterCommands(Assembly.GetExecutingAssembly());
            CommandsNext.CommandErrored += HandleCommandErrorAsync;

            this.Discord.ClientErrored += async(error) => await LogException(error.Exception);
        }
Exemple #2
0
 public SiegeProfile(SiegeManager manager, string accountName)
 {
     Name    = accountName;
     Manager = manager;
 }
Exemple #3
0
        private void HandleSkillControls()
        {
            if (Input.GetKeyDown(KeyCode.Tab))
            {
                ui.SwitchConsole();
            }

            if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter))
            {
                ui.OnEnter();
            }

            if (!ui.consoleActive)
            {
                if (Input.GetKeyDown(KeyCode.Q))
                {
                    data.StartMeleeTargeting(false);
                }

                if (data.ActiveConfirmationSkill == null && Input.GetMouseButtonDown(0) && !ui.MouseOverUI)
                {
                    data.StartMeleeTargeting(true);
                }

                if (Input.GetKeyDown(KeyCode.W))
                {
                    EquippableItem u = new HpUpgradeAdd(1);
                    u.Init();
                    u.SpawnGameObject(Utils.GenerateRandomPositionAround(data.GetBody().transform.position, 3));
                    //data.GetOwner().AddUpgrade(u);
                    //data.GetOwner().EquipUpgrade(u);
                }

                if (Input.GetKeyDown(KeyCode.I))
                {
                    ui.SwitchInventory();
                }

                if (Input.GetKeyDown(KeyCode.U))
                {
                    Player p = data.GetOwner() as Player;
                    p.UnlockSkill(temp++, true);

                    //ui.DamageMessage(data.GetBody(), 10, Color.cyan);

                    //ui.ScreenMessage("Ahoasdddddddddddddddddddsssssssssddddddddddddoj" + (temp++), 1);
                    //data.AddPhysicsPush(new Vector2(0, 100), ForceMode2D.Impulse);
                }

                if (Input.GetKeyDown(KeyCode.E))
                {
                    InventoryItem u = new DnaItem(Random.Range(10, 20));
                    u.Init();
                    u.SpawnGameObject(Utils.GenerateRandomPositionAround(data.GetBody().transform.position, 3));

                    InventoryItem p = new HpPotion(1);
                    p.Init();
                    p.SpawnGameObject(Utils.GenerateRandomPositionAround(data.GetBody().transform.position, 3));
                }

                if (Input.GetKeyDown(KeyCode.B))
                {
                    AbstractLevelData levelData = WorldHolder.instance.activeMap.levelData;

                    if (levelData.CanHaveBase())
                    {
                        levelData.CreateBase();
                    }
                }

                if (Input.GetKeyDown(KeyCode.L))
                {
                    ui.ShowLevelsView();
                }

                if (Input.GetKeyDown(KeyCode.M))
                {
                    ui.HideLevelsView();
                }

                if (Input.GetKeyDown(KeyCode.V))
                {
                    AbstractLevelData levelData = WorldHolder.instance.activeMap.levelData;

                    if (levelData.HasBase())
                    {
                        if (SiegeManager.IsSiegeActive() == false)
                        {
                            SiegeManager.StartSiege(WorldHolder.instance.activeMap);
                        }
                        else
                        {
                            SiegeManager.CancelSiege();
                        }
                    }
                }

                if (Input.GetKeyDown(KeyCode.R))
                {
                    InventoryItem u = UpgradeTable.Instance.GenerateUpgrade(ItemType.CLASSIC_UPGRADE, 1, 2, 1);
                    u.Init();
                    u.SpawnGameObject(Utils.GenerateRandomPositionAround(data.GetBody().transform.position, 3));
                }

                /*if (Input.GetKeyDown(KeyCode.R))
                 * {
                 *      AbstractUpgrade u = data.GetOwner().Inventory.GetUpgrade(typeof (TemplateUpgrade));
                 *      data.GetOwner().UnequipUpgrade(u);
                 *      data.GetOwner().RemoveUpgrade(u);
                 *
                 *      u = data.GetOwner().Inventory.GetUpgrade(typeof(TemplateUpgrade));
                 *      data.GetOwner().UnequipUpgrade(u);
                 *      data.GetOwner().RemoveUpgrade(u);
                 * }*/

                if (Input.GetKeyDown(KeyCode.Alpha1))
                {
                    data.LaunchSkill(1);
                }

                if (Input.GetKeyDown(KeyCode.Alpha2))
                {
                    data.LaunchSkill(2);
                }

                if (Input.GetKeyDown(KeyCode.Alpha3))
                {
                    data.LaunchSkill(3);
                }

                if (Input.GetKeyDown(KeyCode.Alpha4))
                {
                    data.LaunchSkill(4);
                }

                if (Input.GetKeyDown(KeyCode.Alpha5))
                {
                    data.LaunchSkill(5);
                }

                if (Input.GetKeyDown(KeyCode.Alpha6))
                {
                    data.LaunchSkill(6);
                }

                if (Input.GetKeyDown(KeyCode.Alpha7))
                {
                    data.LaunchSkill(7);
                }

                if (Input.GetKeyDown(KeyCode.Alpha8))
                {
                    data.LaunchSkill(8);
                }

                if (Input.GetKeyDown(KeyCode.Alpha9))
                {
                    data.LaunchSkill(9);
                }

                if (Input.GetKeyDown(KeyCode.Alpha0))
                {
                    data.LaunchSkill(10);
                }
            }
        }