private async Task <bool> WaitForServerReadyToConnect(Guid customerGUID, int zoneInstanceID)
        {
            DateTime StartPollingTime = DateTime.Now;

            while (DateTime.Now < StartPollingTime.AddSeconds(owsGeneralConfig.Value.SecondsToWaitForServerSpinUp))
            {
                //Check Map Status
                var resultCheckMapInstanceStatus = await charactersRepository.CheckMapInstanceStatus(CustomerGUID, zoneInstanceID);

                if (resultCheckMapInstanceStatus.MapInstanceStatus == 2) //Ready to play
                {
                    return(true);
                }

                System.Threading.Thread.Sleep(owsGeneralConfig.Value.SecondsToWaitInBetweenSpinUpPolling);
            }

            //The server did not spin up in time so shut it down


            return(false);
        }
Exemple #2
0
        private async Task <bool> WaitForServerReadyToConnect(int mapInstanceID)
        {
            DateTime StartPollingTime = DateTime.Now;

            while (DateTime.Now < StartPollingTime.AddSeconds(90))
            {
                //Check Map Status
                var resultCheckMapInstanceStatus = await charactersRepository.CheckMapInstanceStatus(CustomerGUID, mapInstanceID);

                if (resultCheckMapInstanceStatus.MapInstanceStatus == 2) //Ready to play
                {
                    /*using (RPGDataDataContext dc = new RPGDataDataContext())
                     * {
                     *  dc.AddCharacterToMapInstanceByCharName(gCustomerGUID, id, MapInstanceID); //id = CharName
                     * }*/

                    return(true);
                }

                System.Threading.Thread.Sleep(2);
            }

            return(false);
        }