Example #1
0
        public IEnumerator Update(BKAction onComplete = null)
        {
            this.onComplete = onComplete;

            var loader = LoaderMgr.Load(localVersionPath);

            loader.isCheckRedirectError = true;

            loader.onComplete += ld =>
            {
                if (ld.hasError)
                {
                    //TODO tip
                    DoComplete(true);
                    return;
                }

                localVersion = new VersionCfgMgr();
                if (localVersion.Init(ld.text))
                {
                    LoadVersion(localVersion.versionAddr);
                }
                else
                {
                    //TODO tip
                    DoComplete(true);
                }
            };

            while (!isComplete)
            {
                yield return(null);
            }
        }
Example #2
0
    // Use this for initialization
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        Time.timeScale = 0.0f;
        loader         = GameObject.Find("Loader");
        if (loader != null)
        {
            lMgrScript = loader.GetComponent <LoaderMgr>();

            if (lMgrScript.restartPressed)
            {
                enableHudUI();
                lMgrScript.restartPressed = false;
            }
            else
            {
                enableStartUI();
            }
        }
        foreach (GameObject obj in panels)
        {
            EndPanelLogic epl = obj.GetComponent <EndPanelLogic> ();
            if (epl != null)
            {
                myEpl = epl;
            }
        }
    }
Example #3
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(onError);
            Console.CancelKeyPress += new ConsoleCancelEventHandler(OnClose);


            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig <WorldConfigs>();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel, "WorldServer"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            CharMgr.Database = DBManager.Start(Config.CharacterDatabase.Total(), ConnectionType.DATABASE_MYSQL, "Characters");
            if (CharMgr.Database == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            WorldMgr.Database = DBManager.Start(Config.WorldDatabase.Total(), ConnectionType.DATABASE_MYSQL, "World");
            if (WorldMgr.Database == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            AbilityMgr.Database = WorldMgr.Database;

            Client = new RpcClient("WorldServer-" + Config.RealmId, Config.AccountCacherInfo.RpcLocalIp, 1);
            if (!Client.Start(Config.AccountCacherInfo.RpcServerIp, Config.AccountCacherInfo.RpcServerPort))
            {
                ConsoleMgr.WaitAndExit(2000);
            }


            Rm = Program.AcctMgr.GetRealm(Config.RealmId);

            if (Rm == null)
            {
                Log.Error("WorldServer", "Realm (" + Config.RealmId + ") not found");
                return;
            }

            LoaderMgr.Start();

            if (!TCPManager.Listen <TCPServer>(Rm.Port, "World"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            Server = TCPManager.GetTcp <TCPServer>("World");

            AcctMgr.UpdateRealm(Client.Info, Rm.RealmId);

            ConsoleMgr.Start();
        }
Example #4
0
 void Update()
 {
     if (RemoteServer.main != null)
     {
         RemoteServer.main.Update();
     }
     if (RemoteServer.chat != null)
     {
         RemoteServer.chat.Update();
     }
     LoaderMgr.Update();
     TickMgr.onUpdate.Invoke();
     TickMgr.Update();
 }
Example #5
0
        private void DoUpdate()
        {
            if (version.closed)
            {
                Debug.Log(version.closedReason);
                //TODO tip
                DoComplete(true);
                return;
            }

            if (!localVersion.baseVersion.Equals(version.baseVersion))
            {
                Reinstall();
                return;
            }

            LoaderMgr.baseUrl       = version.updateAddr;
            LoaderMgr.backupBaseUrl = version.updateAddr2;

            if (forceUpdateResource || !localVersion.lastVersion.Equals(version.lastVersion))
            {
                var bl = LoaderMgr.LoadBatch();
                bl.AddLoader(localResourceTablePath);
                bl.AddLoader(version.resourceTableAddr);
                bl.isCheckRedirectError = true;

                bl.onComplete += ld =>
                {
                    var localTxt = bl.GetLoader(localResourceTablePath).text;
                    resourceTableText  = bl.GetLoader(version.resourceTableAddr).text;
                    localResourceTable = new ResourceTableImpl();
                    resourceTable      = new ResourceTableImpl();

                    if (localResourceTable.Deserialize(localTxt) &&
                        resourceTable.Deserialize(resourceTableText))
                    {
                        UpdateResource();
                    }
                    else
                    {
                        //TODO tip
                        DoComplete(true);
                    }
                };
            }
            else
            {
                DoComplete();
            }
        }
Example #6
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(onError);

            Log.Info("", "------------------- Launcher Server -------------------", ConsoleColor.DarkRed);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig <LauncherConfig>();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel, "LauncherServer"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            ServerState previousState = Config.ServerState;

            Config.ServerState = ServerState.PATCH;

            LoaderMgr.Start();
            Client = new RpcClient("LauncherServer", Config.RpcInfo.RpcLocalIp, 1);

            Config.ServerState = previousState;

            if (!Client.Start(Config.RpcInfo.RpcServerIp, Config.RpcInfo.RpcServerPort))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            Info = new FileInfo("Configs/mythloginserviceconfig.xml");
            if (!Info.Exists)
            {
                Log.Error("Configs/mythloginserviceconfig.xml", "Config file missing !");
                ConsoleMgr.WaitAndExit(5000);
            }

            StrInfo = Info.OpenText().ReadToEnd();

            if (!TCPManager.Listen <TCPServer>(Config.LauncherServerPort, "LauncherServer"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            Server = TCPManager.GetTcp <TCPServer>("LauncherServer");

            ConsoleMgr.Start();
        }
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(onError);
            Console.CancelKeyPress += new ConsoleCancelEventHandler(OnClose);

            Log.Texte("", "-------------------- World Server ---------------------", ConsoleColor.DarkRed);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig <WorldConfigs>();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel, "WorldServer"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

#if DEBUG
            API.Server api = null;
            if (Config.EnableAPI)
            {
                try
                {
                    api = new API.Server(Config.APIAddress, Config.APIPort, 100);
                }
                catch (Exception e)
                {
                    Log.Error("API", "Unable to start API server: " + e.Message);
                }
            }
#endif

            CharMgr.Database = DBManager.Start(Config.CharacterDatabase.Total(), Config.CharacterDatabase.ConnectionType, "Characters", Config.CharacterDatabase.Database);
            if (CharMgr.Database == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }
            else if (!Config.PreloadAllCharacters)
            {
                CharMgr.Database.RegisterAction(CharMgr.LoadPendingCharacters);
            }

            _timer = new Timer(AuctionHouse.CheckAuctionExpiry, null, new TimeSpan(0, 12, 0, 0), new TimeSpan(0, 24, 0, 0));

            WorldMgr.Database = DBManager.Start(Config.WorldDatabase.Total(), Config.CharacterDatabase.ConnectionType, "World", Config.WorldDatabase.Database);
            if (WorldMgr.Database == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            WorldMgr.StartingPairing = WorldMgr.Database.ExecuteQueryInt("SELECT FLOOR(RAND() * 3) + 1");


            WorldMgr.UpperTierBattlefrontManager = new UpperTierBattlefrontManager();
            WorldMgr.UpperTierBattlefrontManager.SetInitialPairActive();
            Log.Texte("Creating Upper Tier Battlefront Manager", WorldMgr.UpperTierBattlefrontManager.GetActivePairing().PairingName, ConsoleColor.Cyan);

            WorldMgr.LowerTierBattlefrontManager = new LowerTierBattlefrontManager();
            WorldMgr.LowerTierBattlefrontManager.SetInitialPairActive();
            Log.Texte("Creating Lower Tier Battlefront Manager", WorldMgr.LowerTierBattlefrontManager.GetActivePairing().PairingName, ConsoleColor.Cyan);


            Log.Texte("StartingPairing: ", WorldMgr.StartingPairing.ToString(), ConsoleColor.Cyan);

            Client = new RpcClient("WorldServer-" + Config.RealmId, Config.AccountCacherInfo.RpcLocalIp, 1);
            if (!Client.Start(Config.AccountCacherInfo.RpcServerIp, Config.AccountCacherInfo.RpcServerPort))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            Rm = AcctMgr.GetRealm(Config.RealmId);

            if (Rm == null)
            {
                Log.Error("WorldServer", "Realm (" + Config.RealmId + ") not found");
                return;
            }

            LoaderMgr.Start();

            if (!TCPManager.Listen <TCPServer>(Rm.Port, "World"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            Server = TCPManager.GetTcp <TCPServer>("World");

            AcctMgr.UpdateRealm(Client.Info, Rm.RealmId);
            AcctMgr.UpdateRealmCharacters(Rm.RealmId, (uint)CharMgr.Database.GetObjectCount <Character>("Realm=1"), (uint)CharMgr.Database.GetObjectCount <Character>("Realm=2"));

            ConsoleMgr.Start();
        }
Example #8
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(onError);
            Console.CancelKeyPress += new ConsoleCancelEventHandler(OnClose);

            Log.Info("", "-------------------- World Server ---------------------", ConsoleColor.DarkRed);

            // Default the server to DEV mode.
            if (args.Length == 0)
            {
                WorldMgr.ServerMode = "DEV";
            }
            else
            {
                if (args.Length == 1)
                {
                    if (args[0] == "DEV")
                    {
                        WorldMgr.ServerMode = "DEV";
                    }
                    if (args[0] == "PRD")
                    {
                        WorldMgr.ServerMode = "PRD";
                    }
                }
                else
                {
                    WorldMgr.ServerMode = "DEV";
                }
            }

            Log.Info("", "SERVER running in " + WorldMgr.ServerMode + " mode", ConsoleColor.Cyan);


            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig <WorldConfigs>();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel, "WorldServer"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

#if DEBUG
            API.Server api = null;
            if (Config.EnableAPI)
            {
                try
                {
                    api = new API.Server(Config.APIAddress, Config.APIPort, 100);
                }
                catch (Exception e)
                {
                    Log.Error("API", "Unable to start API server: " + e.Message);
                }
            }
#endif

            CharMgr.Database = DBManager.Start(Config.CharacterDatabase.Total(), Config.CharacterDatabase.ConnectionType, "Characters", Config.CharacterDatabase.Database);
            if (CharMgr.Database == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }
            else if (!Config.PreloadAllCharacters)
            {
                CharMgr.Database.RegisterAction(CharMgr.LoadPendingCharacters);
            }

            _timer = new Timer(AuctionHouse.CheckAuctionExpiry, null, new TimeSpan(0, 12, 0, 0), new TimeSpan(0, 24, 0, 0));

            WorldMgr.Database = DBManager.Start(Config.WorldDatabase.Total(), Config.CharacterDatabase.ConnectionType, "World", Config.WorldDatabase.Database);
            if (WorldMgr.Database == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            WorldMgr.StartingPairing = WorldMgr.Database.ExecuteQueryInt("SELECT FLOOR(RAND() * 3) + 1");

            // Ensure directory structure is correct
            if (!Directory.Exists("Zones"))
            {
                Log.Error("Directory Check", "Zones directory does not exist");
                ConsoleMgr.WaitAndExit(2000);
            }
            if (!Directory.Exists("Scripts"))
            {
                Log.Error("Directory Check", "Scripts directory does not exist");
                ConsoleMgr.WaitAndExit(2000);
            }
            if (!Directory.Exists("World"))
            {
                Log.Error("Directory Check", "World directory does not exist");
                ConsoleMgr.WaitAndExit(2000);
            }
            if (!Directory.Exists("Abilities"))
            {
                Log.Error("Directory Check", "Abilities directory does not exist");
                ConsoleMgr.WaitAndExit(2000);
            }



            Client = new RpcClient("WorldServer-" + Config.RealmId, Config.AccountCacherInfo.RpcLocalIp, 1);
            if (!Client.Start(Config.AccountCacherInfo.RpcServerIp, Config.AccountCacherInfo.RpcServerPort))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            Rm = AcctMgr.GetRealm(Config.RealmId);

            if (Rm == null)
            {
                Log.Error("WorldServer", "Realm (" + Config.RealmId + ") not found");
                return;
            }

            LoaderMgr.Start();
            // Clean up rvr_metrics
            Log.Info("Battlefront Manager", "Clearing rvr_metrics", ConsoleColor.Cyan);
            WorldMgr.Database.ExecuteNonQuery("DELETE FROM rvr_metrics WHERE TIMESTAMP NOT BETWEEN DATE_SUB(UTC_TIMESTAMP(), INTERVAL 60 DAY) AND UTC_TIMESTAMP()");

            Log.Info("Battlefront Manager", "Creating Upper Tier Campaign Manager", ConsoleColor.Cyan);
            if (RVRProgressionService._RVRProgressions.Count == 0)
            {
                Log.Error("RVR Progression", "NO RVR Progressions in DB");
                return;
            }
            WorldMgr.UpperTierCampaignManager = new UpperTierCampaignManager(RVRProgressionService._RVRProgressions.Where(x => x.Tier == 4).ToList(), WorldMgr._Regions);
            Log.Info("Battlefront Manager", "Creating Lower Tier Campaign Manager", ConsoleColor.Cyan);
            WorldMgr.LowerTierCampaignManager = new LowerTierCampaignManager(RVRProgressionService._RVRProgressions.Where(x => x.Tier == 1).ToList(), WorldMgr._Regions);
            Log.Info("Battlefront Manager", "Getting Progression based upon rvr_progression.LastOpenedZone", ConsoleColor.Cyan);
            WorldMgr.UpperTierCampaignManager.GetActiveBattleFrontFromProgression();
            WorldMgr.LowerTierCampaignManager.GetActiveBattleFrontFromProgression();
            Log.Info("Battlefront Manager", "Attaching Campaigns to Regions", ConsoleColor.Cyan);
            // Attach Battlefronts to regions
            WorldMgr.AttachCampaignsToRegions();

            Log.Info("Battlefront Manager", "Locking Battlefronts", ConsoleColor.Cyan);
            WorldMgr.UpperTierCampaignManager.LockBattleFrontsAllRegions(4);
            WorldMgr.LowerTierCampaignManager.LockBattleFrontsAllRegions(1);

            Log.Info("Battlefront Manager", "Opening Active battlefronts", ConsoleColor.Cyan);
            WorldMgr.UpperTierCampaignManager.OpenActiveBattlefront();
            WorldMgr.LowerTierCampaignManager.OpenActiveBattlefront();

            WorldMgr.UpdateRegionCaptureStatus(WorldMgr.LowerTierCampaignManager, WorldMgr.UpperTierCampaignManager);

            if (!TCPManager.Listen <TCPServer>(Rm.Port, "World"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            Server = TCPManager.GetTcp <TCPServer>("World");

            AcctMgr.UpdateRealm(Client.Info, Rm.RealmId);
            AcctMgr.UpdateRealmCharacters(Rm.RealmId, (uint)CharMgr.Database.GetObjectCount <Character>("Realm=1"), (uint)CharMgr.Database.GetObjectCount <Character>("Realm=2"));

            ConsoleMgr.Start();
        }
Example #9
0
        private void UpdateResource()
        {
            var curTable = localResourceTable.resourcePackList;
            var newTable = resourceTable.resourcePackList;

            var bl = LoaderMgr.LoadBatch();

            bl.isCheckRedirectError = true;

            foreach (var item in newTable)
            {
                if (!curTable.ContainsKey(item.Key) ||
                    curTable[item.Key].version != item.Value.version)
                {
                    var loader = bl.AddLoader(item.Value.targetFile,
                                              item.Value.version,
                                              item.Value.size);
                    loader.customData = item;
                }
            }

            bl.onOneComplete += (obj) =>
            {
                var item = (KeyValuePair <string, IResourcePack>)obj.customData;
                if (obj.hasError)
                {
                    //TODO tip
                    bl.Dispose();
                    DoComplete(true);
                    return;
                }

                if (curTable.ContainsKey(item.Key))
                {
                    curTable[item.Key] = item.Value;
                }
                else
                {
                    curTable.Add(item);
                }

                if (!Util.Save(persistentDataPath + "/" + item.Value.targetFile, obj.bytes) ||
                    !Util.Save(localResourceTablePath, localResourceTable.Serialize()))
                {
                    //TODO tip
                    bl.Dispose();
                    DoComplete(true);
                }

                obj.Dispose();
            };

            bl.onComplete += (obj) =>
            {
                if (bl.errorCount > 0)
                {
                    return;
                }

                if (Util.Save(localResourceTablePath, resourceTableText) &&
                    Util.Save(localVersionPath, versionText))
                {
                    DoComplete();
                }
                else
                {
                    //TODO tip
                    DoComplete(true);
                }
            };
        }
Example #10
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(onError);
            Console.CancelKeyPress += new ConsoleCancelEventHandler(OnClose);

            Log.Texte("", "-------------------- World Server ---------------------", ConsoleColor.DarkRed);
            Log.Texte("", " █     █░ ▄▄▄       ██▀███  ▓█████  ███▄ ▄███▓ █    ██ ", ConsoleColor.Red);
            Log.Texte("", "▓█░ █ ░█░▒████▄    ▓██ ▒ ██▒▓█   ▀ ▓██▒▀█▀ ██▒ ██  ▓██▒", ConsoleColor.Red);
            Log.Texte("", "▒█░ █ ░█ ▒██  ▀█▄  ▓██ ░▄█ ▒▒███   ▓██    ▓██░▓██  ▒██░", ConsoleColor.Red);
            Log.Texte("", "░█░ █ ░█ ░██▄▄▄▄██ ▒██▀▀█▄  ▒▓█  ▄ ▒██    ▒██ ▓▓█  ░██░", ConsoleColor.Red);
            Log.Texte("", "░░██▒██▓  ▓█   ▓██▒░██▓ ▒██▒░▒████▒▒██▒   ░██▒▒▒█████▓ ", ConsoleColor.Red);
            Log.Texte("", "░ ▓░▒ ▒   ▒▒   ▓▒█░░ ▒▓ ░▒▓░░░ ▒░ ░░ ▒░   ░  ░░▒▓▒ ▒ ▒ ", ConsoleColor.Red);
            Log.Texte("", "  ▒ ░ ░    ▒   ▒▒ ░  ░▒ ░ ▒░ ░ ░  ░░  ░      ░░░▒░ ░ ░ ", ConsoleColor.Red);
            Log.Texte("", "  ░   ░    ░   ▒     ░░   ░    ░   ░      ░    ░░░ ░ ░ ", ConsoleColor.Red);
            Log.Texte("", "    ░          ░  ░   ░        ░  ░       ░      ░    ", ConsoleColor.Red);
            Log.Texte("", "-------------------http://WarEmu.com-------------------", ConsoleColor.DarkRed);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig <WorldConfigs>();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel, "WorldServer"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            CharMgr.Database = DBManager.Start(Config.CharacterDatabase.Total(), ConnectionType.DATABASE_MYSQL, "Characters");
            if (CharMgr.Database == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            WorldMgr.Database = DBManager.Start(Config.WorldDatabase.Total(), ConnectionType.DATABASE_MYSQL, "World");
            if (WorldMgr.Database == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            AbilityMgr.Database = WorldMgr.Database;

            Client = new RpcClient("WorldServer-" + Config.RealmId, Config.AccountCacherInfo.RpcLocalIp, 1);
            if (!Client.Start(Config.AccountCacherInfo.RpcServerIp, Config.AccountCacherInfo.RpcServerPort))
            {
                ConsoleMgr.WaitAndExit(2000);
            }


            Rm = Program.AcctMgr.GetRealm(Config.RealmId);

            if (Rm == null)
            {
                Log.Error("WorldServer", "Realm (" + Config.RealmId + ") not found");
                return;
            }

            LoaderMgr.Start();

            if (!TCPManager.Listen <TCPServer>(Rm.Port, "World"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            Server = TCPManager.GetTcp <TCPServer>("World");

            AcctMgr.UpdateRealm(Client.Info, Rm.RealmId);
            AcctMgr.UpdateRealmCharacters(Rm.RealmId, (uint)CharMgr.Database.GetObjectCount <Character>("Realm=1"), (uint)CharMgr.Database.GetObjectCount <Character>("Realm=2"));

            ConsoleMgr.Start();
        }