Exemplo n.º 1
0
        public ushort GetCardFlags(int missionId, int cardIdx, byte[] arrayList)
        {
            if (missionId == 0)
            {
                return(0);
            }
            int         result = 0;
            List <Card> list   = MissionCardXML.GetCards(missionId, cardIdx);

            for (int i = 0; i < list.Count; i++)
            {
                Card card = list[i];
                if (arrayList[card.arrayIdx] >= card.missionLimit)
                {
                    result |= card.flag;
                }
            }
            return((ushort)result);
        }
Exemplo n.º 2
0
        private static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomainOnUnhandledException);
            Console.CancelKeyPress += new ConsoleCancelEventHandler(CancelKeyPressEvent);
            try
            {
                //if (!IsAdministrator() || Console.NumberLock || Console.CapsLock)
                //{
                //    Environment.Exit(Environment.ExitCode);
                //    return;
                //}
                Console.SetWindowSize(125, 30);
                Console.CursorVisible        = false;
                Console.TreatControlCAsInput = false; //true=Entrada de combinação de tecla comum. false=Interrupção pelo sistema.
                Console.Title = "</> BR.UZ </>";
                Process ProcessApplication = Process.GetCurrentProcess();
                if (mutex.WaitOne(TimeSpan.Zero, true))
                {
                    try
                    {
                        DateTime LiveDate         = GetDate();
                        bool     IsInvalidLicense = LiveDate == new DateTime() || long.Parse(LiveDate.ToString("yyMMddHHmmss")) >= 210620000000;
                        if (IsInvalidLicense)
                        {
                            Environment.Exit(Environment.ExitCode);
                            return;
                        }
                        Settings.Load();
                        Logger.Start();
                        Debugger.ShowLogo();

                        SQLManager.Load();
                        ServerBlockManager.Load();
                        EventLoader.LoadAll();
                        MissionsXML.Load();
                        ClanManager.Load();

                        ShopManager.Load();
                        DefaultInventoryManager.Load();
                        ServersManager.Load();
                        TitlesManager.Load();
                        MissionCardXML.LoadBasicCards();
                        RankManager.Load();
                        MapsXML.Load();
                        ClanRankXML.Load();
                        MissionAwards.Load();
                        TournamentRulesManager.Load();
                        RandomBoxXML.LoadBoxes();
                        CupomEffectManager.Load();
                        PackageDataManager.Load();
                        StringFilter.Load();
                        AddressFilter.Load();

                        //BATTLE
                        HalfUtils.Load();
                        WeaponsXML.Load();
                        CharaXML.Load();
                        MappingXML.Load();

                        FirewallSecurity.LoadInstances(ProcessApplication.ProcessName, Settings.SessionsBattle);
                        FirewallSecurity.CreateRuleAllow(FirewallSecurity.FirewallRuleNameApiTCP, "127.0.0.1/255.255.255.255", Settings.PortApi, NET_FW_IP_PROTOCOL_.NET_FW_IP_PROTOCOL_TCP);   //Regra de permissão de acesso a especificos especificos endereços de ip na porta do Api.
                        FirewallSecurity.CreateRuleAllow(FirewallSecurity.FirewallRuleNameAuthTCP, "", Settings.PortAuth, NET_FW_IP_PROTOCOL_.NET_FW_IP_PROTOCOL_TCP);                          //Regra de permissão de acesso a todos endereços de ip na porta do Auth.
                        FirewallSecurity.CreateRuleAllow(FirewallSecurity.FirewallRuleNameGameTCP, "127.0.0.1/255.255.255.255", Settings.PortGame, NET_FW_IP_PROTOCOL_.NET_FW_IP_PROTOCOL_TCP); //Regra de permissão de acesso a todos endereços de ip na porta do Game que passaram na autenticação.
                        for (int i = 0; i < Settings.SessionsBattle; i++)
                        {
                            FirewallSecurity.CreateRuleAllow(FirewallSecurity.FirewallRuleNameBattleUDP[i], "127.0.0.1/255.255.255.255", Settings.PortBattle + i, NET_FW_IP_PROTOCOL_.NET_FW_IP_PROTOCOL_UDP); //Regra de permissão de acesso a todos endereços de ip na porta do Battle que passaram na autenticação e no Game.
                        }
                        Utilities.ExecuteQuery($"UPDATE accounts SET online='{false}'");                                                                                                                       //Seta o online de todas as contas como false

                        AuthManager.Start(Settings.IPInternal, Settings.PortAuth);
                        GameManager.Start(Settings.IPInternal, Settings.PortGame);
                        BattleManager.Start(Settings.IPInternal, Settings.PortBattle, Settings.SessionsBattle);
                        ApiManager.Start(Settings.IPInternal, Settings.PortApi);

                        //new Thread(CodeInDevelopment).Start();

                        if (Logger.Problem)
                        {
                            Logger.Red(" [Application] Startup failed.");
                        }
                        else
                        {
                            Logger.White($" [Application] Date time of server: {StartDate = DateTime.Now}");
                            Logger.Success(" [Application] Loaded all components.");
                            new Thread(new ThreadStart(TitleInfo)).Start();
                        }
                        ProcessApplication.WaitForExit();
                    }
                    finally
                    {
                        mutex.ReleaseMutex();
                    }
                }
                else
                {
                    MessageBox.Show("Console Application is already running.", ProcessApplication.ProcessName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(" FATAL ERROR: " + ex);
                Console.ReadKey();
            }
        }