Ejemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        MaskStartPiece                      = LayerMask.GetMask("StartNewGame");
        MaskWhitePiece                      = LayerMask.GetMask("WhitePiece");
        MaskBlackPiece                      = LayerMask.GetMask("BlackPiece");
        MaskTilePiece                       = LayerMask.GetMask("Tile");
        oldPref                             = GetComponent <GameObject>();// rbPref = Rigidbody; is it different?
        newPref                             = GetComponent <GameObject>();
        initialPawnStringPosition           = new List <string>();
        pawnPositionArray                   = new string[MAX, MAX];
        pawnObjArray                        = new GameObject[MAX, MAX];
        pawnPositionsIntoLongString         = "";
        mirrorAllPawnPositionIntoLongString = "";
        boardObjArray                       = new GameObject[MAX, MAX];
        boardHolder                         = new GameObject("Board").transform;
        pieceHolder                         = new GameObject("Piece").transform;
        findBMGameObject                    = GameObject.FindGameObjectWithTag("BM");
        BM = findBMGameObject.GetComponent <BotManager>();
        findEGMGameObject = GameObject.FindGameObjectWithTag("EGM");
        EGM = findEGMGameObject.GetComponent <EndGameManager>();
        WP  = new WhitePawn[MAX];



        CreateEverything();
    }
        public override async Task LogicRoutineAsync()
        {
            while (Running)
            {
                var futClient = BotManager.GetMostValueableFUTClient(FUTSettings.Instance.MuleApiMaxTransactionValue + FUTSettings.Instance.MuleApiMinCoinsOnAccount);
                if (futClient != null)
                {
                    var startedMule = false;
                    var players     = await GetApiPlayerAsync();

                    players.RemoveAll(x => x.BuyNowPrice > FUTSettings.Instance.MuleApiMaxTransactionValue);
                    foreach (var muleApiPlayer in players)
                    {
                        futClient.Muling        = true;
                        muleApiPlayer.LockStart = DateTime.UtcNow;
                        Task.Factory.StartNew(() => RunMuleApiClientAsync(futClient, muleApiPlayer));
                        startedMule = true;
                        break;
                    }
                    if (!startedMule)
                    {
                        futClient.Muling = false;
                    }
                }
                await Task.Delay(FUTSettings.Instance.MuleApiRequestDelay);
            }
        }
Ejemplo n.º 3
0
 public Program()
 {
     sqlManager  = new SQLManager();
     upgradeRule = new UpgradeRuleManager(sqlManager);
     unitManager = new UnitManager(sqlManager, upgradeRule);
     botManager  = new BotManager(2, Constants.gameMode.MULTI_PLAYER, /*"sosan"*/ "glad", "1234");//TODO We must define player cards
 }
Ejemplo n.º 4
0
        public async Task <bool> HandleLastAreaTransition()
        {
            // Check to see if we have an area transition to use.
            var transition = _leaderData.LastAreaTransition;

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

            // See if we should stop outside the boss room.
            if (transition.Metadata.Equals("Metadata/Terrain/Labyrinth/Objects/LabyrinthIzaroArenaTransition") ||
                StringHelper.IsArenaTransition(transition))
            {
                if (FollowerSettings.Instance.StopOutsideBossDoor)
                {
                    BotManager.Stop(new StopReasonData("Follower_StopOutsideBossDoor", "The user wishes the bot stop outside the boss room door."));
                    return(true);
                }
            }

            // Take the area transition
            await PlayerAction.TakeTransition(transition);

            // Clear the data so we don't use it again.
            _leaderData.LastAreaTransitionId = 0;

            return(true);
        }
Ejemplo n.º 5
0
            public bool Run(BotDescriptor botDesc)
            {
                GC.Collect();
                GC.WaitForPendingFinalizers();

                try
                {
                    BotManager manager = FindBotManager(botDesc);

                    if (manager != null)
                    {
                        manager.StopBots();

                        manager.StartBots();
                        return true;
                    }

                    BotManager botManager = new BotManager(botDesc);

                    botManager.StartBots();

                    FBotManagers.Add(botManager);
                }
                catch (Exception e)
                {
                    AppContext.WriteLog(e.Message);
                    return false;
                }
                return true;
            }
Ejemplo n.º 6
0
    public void Awake()
    {
        instance = this;
        NavMeshTriangulation navMeshTriangulation = NavMesh.CalculateTriangulation();

        navMesh           = new Mesh();
        navMesh.vertices  = navMeshTriangulation.vertices;
        navMesh.triangles = navMeshTriangulation.indices;
        int num = navMeshTriangulation.indices.Length / 3;

        navWeights = new float[num];
        float num2 = 0f;

        for (int i = 0; i < num; i++)
        {
            Vector3 a          = navMesh.vertices[navMesh.triangles[i * 3]];
            Vector3 vector     = navMesh.vertices[navMesh.triangles[i * 3 + 1]];
            Vector3 b          = navMesh.vertices[navMesh.triangles[i * 3 + 2]];
            float   magnitude  = (a - vector).magnitude;
            float   magnitude2 = (a - b).magnitude;
            float   magnitude3 = (vector - b).magnitude;
            float   num3       = (magnitude + magnitude2 + magnitude3) * 0.5f;
            float   num4       = Mathf.Sqrt(num3 * (num3 - magnitude) * (num3 - magnitude2) * (num3 - magnitude3));
            navWeights[i] = num4;
            num2         += num4;
        }
        for (int i = 0; i < num; i++)
        {
            navWeights[i] /= num2;
        }
    }
Ejemplo n.º 7
0
 public GroupWindow(BotManager botManager)
 {
     InitializeComponent();
     BotManager = botManager;
     AmeisenMap = new AmeisenMap(220, 216);
     Topmost    = BotManager.Settings.topMost;
 }
Ejemplo n.º 8
0
 // Use this for initialization
 void Awake()
 {
     myAnimator      = GetComponent <Animator> ();
     myBotManager    = GetComponent <BotManager> ();
     myHealthManager = GetComponent <HealthManager> ();
     myNavMeshAgent  = GetComponent <NavMeshAgent> ();
 }
Ejemplo n.º 9
0
 public AbstractClient(BotManager botManager, string ipAdresse, int port)
 {
     this.Buffer     = new byte[1024];
     this.BotManager = botManager;
     this.Socket     = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     this.Socket.BeginConnect(IPAddress.Parse(ipAdresse), port, new AsyncCallback(this.ConnectCallback), this.Socket);
 }
Ejemplo n.º 10
0
        private async Task InitializeBot()
        {
            await Task.Delay(100);

            try
            {
                Log = new LogController(new TextLogger("Logs"), Console);
                Program.SetLog(Log);

                Repository = new Repository();
                DbInitializer dbInitializer = new DbInitializer();

                // if db ok - activate bot core
                // otherwise do nothing, keep error messages on console
                if (dbInitializer.InitializeConnection())
                {
                    Bot = new BotManager(Repository, Log).StartBot();
                    this.Invoke((Action)(() => { Text = $"@{Bot.BotApiManager.BotName}, online"; }));
                }
            }
            catch (Exception e)
            {
                Log.LogCritical(new DebugMessage("Bot initialization fails", "InitializeBot()", e));
            }
        }
Ejemplo n.º 11
0
        /// <summary> The plugin start callback. Do any initialization here. </summary>
        public void Start()
        {
            Log.DebugFormat("[Quest] Start");

            GameEventManager.StartingNewGame += GameEventManagerOnStartingNewGame;
            GameEventManager.QuestUpdate     += GameEventManagerOnQuestUpdate;
            GameEventManager.NewGame         += GameEventManagerOnNewGame;
            GameEventManager.GameOver        += GameEventManagerOnGameOver;

            if (!(BotManager.CurrentBot is DefaultBot))
            {
                Log.ErrorFormat(
                    "[Quest] This plugin is not compatible with this bot. Please disable the plugin before starting again or change the bot being used.");
                BotManager.Stop();
                return;
            }

            // This plugin is for construted mode only, as routines must implement quest logic for arena drafts, and most non-basic quests
            // require Play mode or Arena to be completed.
            if (DefaultBotSettings.Instance.GameMode != GameMode.Constructed)
            {
                Log.ErrorFormat(
                    "[Quest] This plugin only works when the \"GameMode\" in DefaultBot is set to \"Constructed\". Please disable the plugin or change the DefaultBot settings.");
                BotManager.Stop();
                return;
            }

            _lastDeck = DefaultBotSettings.Instance.ConstructedCustomDeck;
            _lastRule = DefaultBotSettings.Instance.ConstructedGameRule;

            DefaultBotSettings.Instance.ConstructedGameRule = GameRule.Auto;
        }
Ejemplo n.º 12
0
 private void BotBaseCB_DropDownClosed(object sender, EventArgs e)
 {
     if (BotBaseCB.SelectedIndex < _bots.Count && BotBaseCB.SelectedIndex >= 0)
     {
         BotManager.SetActiveBot(_bots[BotBaseCB.SelectedIndex]);
     }
 }
        public void ConfigureServices(IServiceCollection services)
        {
            //Usage of same ServiceCollection for telegram library and asp.net is bad idea.
            //At first I thought differently, but in practice this model was not very convenient if you need to use many bots on one server process.
            //More precisely, the problem is the common services collection between the bots themselves.
            //or use separate collections for asp and bots.
            //But in this example i use one collection to show how you can do it, because it's really can be difficult.
            //And i recommend to add bot library after all services, to override some settings in service collection.
            services
            .AddMvc()
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

            var token = BotTokenResolver.GetToken();
            var bot   = new Telegram.Bot.TelegramBotClient(token, new QueuedHttpClient(TimeSpan.FromSeconds(1)));

            _botManager = new BotManager(bot, services);

            //Invoked synchronous.
            _botManager.ConfigureServices((servicesWrap) =>
            {
                servicesWrap.AddMvc(new Telegram.Bot.AspNetPipeline.Mvc.Builder.MvcOptions()
                {
                    //Useful for debugging.
                    CheckEqualsRouteInfo = true
                });

                //Logging service example with NLog you can see in IRO.Tests.Telegram.
            });
        }
Ejemplo n.º 14
0
        /// <summary>
        ///     Runs this state and apply the lure.
        /// </summary>
        public override void Run()
        {
            Logging.Write(Name);

            string weaponId = DxHook.Instance.ExecuteScript("SpellStopCasting() " +
                                                            " weaponId = GetInventoryItemID(\"player\", 16); " +
                                                            " EquipItemByName(88535);", "weaponId");


            if (weaponId == "88535")
            {
                MessageBox.Show("Your current weapon is the spear. Please fix this and restart the bot.");
                BotManager.StopActiveBot();
                return;
            }

            Thread.Sleep(1000);

            DxHook.Instance.ExecuteScript("RunMacroText(\"/use 16 \"); ");


            Thread.Sleep(1500);

            DxHook.Instance.ExecuteScript("EquipItemByName(weaponId);");

            Thread.Sleep(500);
        }
Ejemplo n.º 15
0
    public static void RegisterBot(string _netID, BotManager _bot)
    {
        string _playerID = PLAYER_ID_PREFIX + _netID;

        bots.Add(_playerID, _bot);
        _bot.transform.name = _playerID;
    }
Ejemplo n.º 16
0
        internal Game(int conns)
        {
            ClientManager = new GameClientManager();

            //if (PiciEnvironment.GetConfig().data["client.ping.enabled"] == "1")
            //{
            //    ClientManager.StartConnectionChecker();
            //}


            using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
            {
                //PiciEnvironment.GameInstance = this;
                DateTime start = DateTime.Now;

                BanManager           = new ModerationBanManager();
                RoleManager          = new RoleManager();
                HelpTool             = new HelpTool();
                Catalog              = new Catalog();
                Navigator            = new Navigator();
                ItemManager          = new ItemManager();
                RoomManager          = new RoomManager();
                AdvertisementManager = new AdvertisementManager();
                PixelManager         = new PixelManager();

                ModerationTool = new ModerationTool();
                BotManager     = new BotManager();
                questManager   = new QuestManager();
                //soundMachineManager = new SoundMachineManager();

                TimeSpan spent = DateTime.Now - start;
            }
        }
Ejemplo n.º 17
0
        /// <summary> The plugin start callback. Do any initialization here. </summary>
        public void Start()
        {
            Log.DebugFormat("[日常任务插件] 开始运行");

            GameEventManager.StartingNewGame += GameEventManagerOnStartingNewGame;
            GameEventManager.QuestUpdate     += GameEventManagerOnQuestUpdate;
            GameEventManager.NewGame         += GameEventManagerOnNewGame;
            GameEventManager.GameOver        += GameEventManagerOnGameOver;

            if (!(BotManager.CurrentBot is DefaultBot))
            {
                Log.ErrorFormat(
                    "[日常任务插件] 本插件和兄弟存在兼容问题,请停止插件后再开始挂机.");
                BotManager.Stop();
                return;
            }

            // This plugin is for construted mode only, as routines must implement quest logic for arena drafts, and most non-basic quests
            // require Play mode or Arena to be completed.
            if (DefaultBotSettings.Instance.GameMode != GameMode.玩家对战模式)
            {
                Log.ErrorFormat(
                    "[日常任务插件] 本插件只适用于玩家对战模式. 请停止本插件或改变其他设置.");
                BotManager.Stop();
                return;
            }

            _lastDeck = DefaultBotSettings.Instance.ConstructedCustomDeck;
            _lastRule = DefaultBotSettings.Instance.ConstructedGameRule;

            DefaultBotSettings.Instance.ConstructedGameRule = GameRule.随机模式;
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Called when user disable the plugin.
        /// </summary>
        public void OnDisabled()
        {
            _isPluginEnabled = false;

            BotManager.ReplaceTreeHooks();

            Navigator.PlayerMover               = new DefaultPlayerMover();
            Navigator.StuckHandler              = new DefaultStuckHandler();
            CombatTargeting.Instance.Provider   = new DefaultCombatTargetingProvider();
            LootTargeting.Instance.Provider     = new DefaultLootTargetingProvider();
            ObstacleTargeting.Instance.Provider = new DefaultObstacleTargetingProvider();
            Navigator.SearchGridProvider        = new MainGridProvider();

            GameEvents.OnPlayerDied -= TrinityOnDeath;
            BotMain.OnStop          -= TrinityBotStop;

            GameEvents.OnPlayerDied   -= TrinityOnDeath;
            GameEvents.OnGameJoined   -= TrinityOnJoinGame;
            GameEvents.OnGameLeft     -= TrinityOnLeaveGame;
            GameEvents.OnItemSold     -= ItemEvents.TrinityOnItemSold;
            GameEvents.OnItemSalvaged -= ItemEvents.TrinityOnItemSalvaged;
            GameEvents.OnItemStashed  -= ItemEvents.TrinityOnItemStashed;
            GameEvents.OnItemIdentificationRequest -= ItemEvents.TrinityOnOnItemIdentificationRequest;
            GameEvents.OnGameChanged  -= GameEvents_OnGameChanged;
            GameEvents.OnWorldChanged -= GameEvents_OnWorldChanged;

            ItemManager.Current = new LootRuleItemManager();

            Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "");
            Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "DISABLED: Trinity is now shut down...");
            Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "");
            GenericCache.Shutdown();
            GenericBlacklist.Shutdown();
        }
Ejemplo n.º 19
0
        public SelectWindow()
        {
            InitializeComponent();
            BotManager = new BotManager();

            if (File.Exists(globalConfigPath + extension))
            {
                globalSettings = Newtonsoft.Json.JsonConvert.DeserializeObject <GlobalSettings>(File.ReadAllText(globalConfigPath + extension));

                if (globalSettings.wowRealmlists.Count > 1)
                {
                    globalSettings.wowRealmlists.RemoveAt(0);
                }

                labelWowPath.Content          = globalSettings.wowExePath;
                labelWowRealmlistPath.Content = globalSettings.wowRealmlistPath;
                labelWowRealmlist.Content     = globalSettings.wowRealmlists[globalSettings.wowSelectedRealmlist];
            }
            else
            {
                globalSettings                = new GlobalSettings();
                labelWowPath.Content          = "path to wow.exe not set";
                labelWowRealmlist.Content     = "path to realmlist.wtf not set";
                labelWowRealmlistPath.Content = "path to realmlist.wtf not set";
            }

            if (File.Exists(autoLoginExe))
            {
                GetAllAcoounts();
                autologinIsPossible = true;
            }
        }
Ejemplo n.º 20
0
        private static void StopBot()
        {
            BotManager.StopActiveBot();
            Task.Run(() =>
            {
                for (int i = 0; i < 3; i++)
                {
                    SystemSounds.Hand.Play();
                    Thread.Sleep(3000);
                }
            });

            if (UserPreferences.Default.LogoutOnStop && BotManager.LoggedIn)
            {
                DxHook.ExecuteScript("Logout();");
            }

            if (UserPreferences.Default.CloseWoWOnStop)
            {
                BotManager.SafeShutdown(true);
            }

            if (UserPreferences.Default.ShutdownPcOnStop)
            {
                Process.Start("shutdown", "/s /t 0");
            }
        }
Ejemplo n.º 21
0
        public static void AddTask(ITask task, string name, TaskPosition type)
        {
            bool added = false;

            switch (type)
            {
            case TaskPosition.Before:
                added = TaskManager.AddBefore(task, name);
                break;

            case TaskPosition.After:
                added = TaskManager.AddAfter(task, name);
                break;

            case TaskPosition.Replace:
                added = TaskManager.Replace(name, task);
                break;

            default:
                GlobalLog.Error($"[BotStructure] Unknown task add type \"{type}\".");
                break;
            }
            if (!added)
            {
                GlobalLog.Error($"[BotStructure] Fail to add \"{name}\".");
                BotManager.Stop();
            }
        }
Ejemplo n.º 22
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
            var token = BotTokenResolver.GetToken();
            var bot   = new Telegram.Bot.TelegramBotClient(
                token,
                new QueuedHttpClient(TimeSpan.FromSeconds(1))
                );

            _botManager = new BotManager(bot);

            //Invoked synchronous.
            _botManager.ConfigureServices((servicesWrap) =>
            {
                //Init our LiteDB.
                servicesWrap.Services.AddLiteDataAccessLayer();
                servicesWrap.Services.AddSingleton <IGameLogicService, GameLogicService>();

                servicesWrap.AddMvc(new Telegram.Bot.AspNetPipeline.Mvc.Builder.MvcOptions()
                {
                    //Useful for debugging.
                    CheckEqualsRouteInfo = true
                });
            });
        }
Ejemplo n.º 23
0
 public BotGame(BotManager bot)
 {
     client    = bot;
     World     = new World(client);
     Character = new Player(client);
     bot.Network.Dispatcher.Register(Character);
 }
Ejemplo n.º 24
0
 private void SetGameMode()
 {
     if (PhotonNetwork.connected)
     {
         mode = GameMode.ONLINE;
     }
     else if (options.IsBotGame)
     {
         mode       = GameMode.BOT;
         botManager = gameObject.AddComponent <BotManager>();
     }
     else if (options.IsTutorialGame)
     {
         mode       = GameMode.TUTORIAL;
         botManager = gameObject.AddComponent <BotManager>();
     }
     else
     {
         mode = GameMode.LOCAL;
     }
     Debug.Log("IsOnline: " + IsOnlineGame.ToString());
     Debug.Log("IsBot: " + IsBotGame.ToString());
     Debug.Log("IsLocal: " + IsLocalGame.ToString());
     Debug.Log("IsSimulated: " + IsSimulatedGame.ToString());
     Debug.Log("IsTutorial: " + IsTutorialGame.ToString());
 }
Ejemplo n.º 25
0
 public Chatter(Chat chat, Config cfg, SlotObservation observation, BotManager bots)
 {
     _chat        = chat;
     _cfg         = cfg;
     _observation = observation;
     _bots        = bots;
 }
Ejemplo n.º 26
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to TeleBanel (Telegram Bot Panel)");
            Console.WriteLine("Connecting to telegram server...");

            var myWebsite = new WebsiteMiddleware()
            {
                SiteName      = "Test Website",
                Url           = "https://xomorod.com",
                Title         = "Welcome Test Website",
                About         = "This is a Test about!",
                ContactEmail  = "*****@*****.**",
                ContactPhone  = "+98-914-914-9202",
                FacebookUrl   = "https://facebook.com/test",
                FlickerUrl    = null,
                FeedbackEmail = "*****@*****.**",
                GooglePlusUrl = null,
                InstagramUrl  = null,
                LinkedInUrl   = null,
                TelegramUrl   = "https://telegram.me/dezirerobot",
                Logo          = Properties.Resources.logo.ToByte()
            };

            var bot =
                new BotManager("414286832:AAE-VQpu32juCfeOWLX33SDnyUZ_xHdfkT0", "8", myWebsite)
            {
                ProductManager = new ProductMiddleware(),
                InboxManager   = new InboxMiddleware()
            };     // TestForSelfBot

            bot.StartListeningAsync().Wait();

            Console.Read();
        }
Ejemplo n.º 27
0
Archivo: Bot.cs Proyecto: lythm/orb3d
            public Bot(BotManager manager,BotDescriptor BotDesc, int BotId)
            {
                FBotId = BotId;
                FManager = manager;
                FBotDesc = BotDesc;
                FBufferManager = new BufferManager();
                FBufferManager.Initialize(100, 100);

                FPacketSpliter = new PacketSpliter();

                FPacketSpliter.OnPacket += OnPacket;

                FConnArg = new SocketAsyncEventArgs();
                FConnArg.Completed += new EventHandler<SocketAsyncEventArgs>(IO_Completed);
                FConnArg.UserToken = this;
                FConnArg.RemoteEndPoint = FBotDesc.Host;

                FDisconnArg = new SocketAsyncEventArgs();
                FDisconnArg.Completed += new EventHandler<SocketAsyncEventArgs>(IO_Completed);
                FDisconnArg.UserToken = this;
                FDisconnArg.DisconnectReuseSocket = true;

                FSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

                FTimer = new Timer(OnTimer);
            }
Ejemplo n.º 28
0
 public Autobalancer(CustomGame cg, SlotObservation observation, BotManager bots, SlotManipulation manipulation)
 {
     _cg           = cg;
     _observation  = observation;
     _bots         = bots;
     _manipulation = manipulation;
 }
Ejemplo n.º 29
0
        internal Game(int conns)
        {
            ClientManager = new GameClientManager();

            //if (ButterflyEnvironment.GetConfig().data["client.ping.enabled"] == "1")
            //{
            //    ClientManager.StartConnectionChecker();
            //}


            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
            {
                //ButterflyEnvironment.GameInstance = this;
                DateTime start = DateTime.Now;

                BanManager           = new ModerationBanManager();
                RoleManager          = new RoleManager();
                HelpTool             = new HelpTool();
                Catalog              = new Catalog();
                Navigator            = new Navigator();
                ItemManager          = new ItemManager();
                RoomManager          = new RoomManager();
                AdvertisementManager = new AdvertisementManager();
                PixelManager         = new PixelManager();

                ModerationTool = new ModerationTool();
                BotManager     = new BotManager();
                questManager   = new QuestManager();
                //soundMachineManager = new SoundMachineManager();

                TimeSpan spent = DateTime.Now - start;

                Logging.WriteLine("Class initialization -> READY! (" + spent.Seconds + " s, " + spent.Milliseconds + " ms)");
            }
        }
Ejemplo n.º 30
0
        /// <summary> The plugin is being enabled.</summary>
        public void Enable()
        {
            Log.DebugFormat("[Stats] Enable");
            _enabled = true;

            _isUnlocking = false;
            Log.DebugFormat("Hello this is custom Stats! --------");
            NormalPlayConf();
            DateTime dtDateTime = Convert.ToDateTime("1970-1-1 00:00:00");

            dtDateTime = dtDateTime.AddSeconds(StatsSettings.Instance.Newtime).ToLocalTime();
            // 在新的一天,清0 DWins 和 DLosses
            if (DateTime.Now.DayOfYear != dtDateTime.DayOfYear)
            {
                StatsSettings.Instance.DWins   = 0;
                StatsSettings.Instance.DLosses = 0;
            }

            DateTime baseTime = Convert.ToDateTime("1970-1-1 8:00:00");

            TimeSpan ts       = DateTime.Now - baseTime;
            long     intervel = (long)ts.TotalSeconds;

            StatsSettings.Instance.Newtime  = intervel;
            StatsSettings.Instance.Ticktime = intervel;
            //UpdateMainGuiStats();
            BotManager.Start();
        }
Ejemplo n.º 31
0
        public static void Start()
        {
            _serverStarted = DateTime.Now;

            var loggerConfiguration = new LoggerConfiguration()
                                      .MinimumLevel.Verbose()
                                      .WriteTo.Console(
                outputTemplate: "[{Timestamp:HH:mm:ss.fff} {Level:u3}] {Message:lj}{NewLine}{Exception}")
                                      .WriteTo.File("logs/.txt", rollingInterval: RollingInterval.Day);

            if (File.Exists("telegram.txt"))
            {
                var lines = File.ReadAllLines("telegram.txt");
                loggerConfiguration.WriteTo.Telegram(lines[0], lines[1],
                                                     restrictedToMinimumLevel: LogEventLevel.Information);
            }

            Log.Logger = loggerConfiguration.CreateLogger();

            PacketManager = new PacketManager();
            BotManager    = new BotManager();

            _working = true;

            new Task(StatusUpdate).Start();

            Log.Information("[{0}] Loaded in {1}", "SERVER", DateTime.Now - _serverStarted);

            Console.Beep();

            BotManager.StartBots();
        }
Ejemplo n.º 32
0
 public Game()
 {
     _packetManager     = new PacketManager();
     _clientManager     = new GameClientManager();
     _moderationManager = new ModerationManager();
     _moderationManager.Init();
     _itemDataManager = new ItemDataManager();
     _itemDataManager.Init();
     _catalogManager = new CatalogManager();
     _catalogManager.Init(_itemDataManager);
     _televisionManager = new TelevisionManager();
     _navigatorManager  = new NavigatorManager();
     _roomManager       = new RoomManager();
     _chatManager       = new ChatManager();
     _groupManager      = new GroupManager();
     _groupManager.Init();
     _questManager       = new QuestManager();
     _achievementManager = new AchievementManager();
     _talentTrackManager = new TalentTrackManager();
     _landingViewManager = new LandingViewManager();
     _gameDataManager    = new GameDataManager();
     _globalUpdater      = new ServerStatusUpdater();
     _globalUpdater.Init();
     _botManager = new BotManager();
     _botManager.Init();
     _cacheManager  = new CacheManager();
     _rewardManager = new RewardManager();
     _badgeManager  = new BadgeManager();
     _badgeManager.Init();
     _permissionManager = new PermissionManager();
     _permissionManager.Init();
     _subscriptionManager = new SubscriptionManager();
     _subscriptionManager.Init();
 }
Ejemplo n.º 33
0
 public static void OnBotAdded(BotManager sender, Bot bot)
 {
     if (AllowLogging)
         bot.Dispatcher.MessageDispatched += OnMessageDispatched;
 }
Ejemplo n.º 34
0
 private static void OnBotAdded(BotManager sender, Bot bot)
 {
     bot.RegisterHandler(new WelcomeMessage());
 }
Ejemplo n.º 35
0
 private void OnBotRemoved(BotManager manager, Behaviors.Bot bot)
 {
     // Dispatcher.Invoke(new Action(() => RemoveChild(bot)));
     // note : remove the window only if another bot with the same name is created
 }
Ejemplo n.º 36
0
 public static void OnBotRemoved(BotManager botManager, Bot bot)
 {
     bot.SaveSettings();
 }
Ejemplo n.º 37
0
 public static void OnBotAdded(BotManager sender, Bot bot)
 {
     bot.RegisterHandler(new HandlerClass());
 }
Ejemplo n.º 38
0
 private void OnBotAdded(BotManager manager, Behaviors.Bot bot)
 {
     Dispatcher.Invoke(new Action(() => AddChild(bot)));
 }