public static void JsonMain() { try { var ucsVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); var f = new JsonApi { Ucs = new Dictionary <string, string> { { "Codename", GlobalStrings.__Codename }, { "StartingLevel", ConfigurationManager.AppSettings["startingLevel"] }, { "StartingExperience", ConfigurationManager.AppSettings["startingExperience"] }, { "StartingGems", ConfigurationManager.AppSettings["startingGems"] }, { "StartingGold", ConfigurationManager.AppSettings["startingGold"] }, { "StartingElixir", ConfigurationManager.AppSettings["startingElixir"] }, { "StartingDarkElixir", ConfigurationManager.AppSettings["startingDarkElixir"] }, { "StartingTrophies", ConfigurationManager.AppSettings["startingTrophies"] }, { "StartingShieldTime", ConfigurationManager.AppSettings["startingShieldTime"] }, { "PatchingServer", ConfigurationManager.AppSettings["patchingServer"] }, { "Maintenance", ConfigurationManager.AppSettings["maintenanceMode"] }, { "MaintenanceTimeLeft", ConfigurationManager.AppSettings["maintenanceTimeLeft"] }, { "ServerPort", ConfigurationManager.AppSettings["serverPort"] }, { "ClientVersion", ConfigurationManager.AppSettings["clientVersion"] }, { "ServerVersion", ucsVersion }, { "LoggingLevel", ConfigurationManager.AppSettings["loggingLevel"] }, { "OldClientVersion", ConfigurationManager.AppSettings["oldClientVersion"] }, { "DatabaseType", ConfigurationManager.AppSettings["databaseConnectionName"] }, { "ExpertPVE", ConfigurationManager.AppSettings["expertPve"] }, { "SaveThreadCount", ConfigurationManager.AppSettings["saveThreadCount"] }, { "OnlinePlayers", Convert.ToString(ResourcesManager.GetOnlinePlayers().Count) }, { "InMemoryPlayers", Convert.ToString(ResourcesManager.GetInMemoryLevels().Count) }, { "InMemoryClans", Convert.ToString(ObjectManager.GetInMemoryAlliances().Count) }, { "TotalPlayer", Convert.ToString(ResourcesManager.GetAllPlayerIds().Count) }, { "TotalClans", Convert.ToString(ObjectManager.GetInMemoryAlliances().Count) }, { "TotalConnectedClients", Convert.ToString(ResourcesManager.GetConnectedClients().Count) } } }; jsonapp = JsonConvert.SerializeObject(f); } catch (Exception ex) { Console.WriteLine("Exception in jsonmain for A.A.S : " + ex); var e = new JsonApiE { Error = new Dictionary <string, string> { { "Codename", GlobalStrings.__Codename }, { "Issue", Convert.ToString(ex) } } }; jsonapp = JsonConvert.SerializeObject(e); } }
/// <summary> /// This function return the data of a random player in database. /// </summary> /// <returns>Data of a random player.</returns> public static Level GetRandomPlayerFromAll() { var index = m_vRandomSeed.Next(0, ResourcesManager.GetAllPlayerIds().Count); //accès concurrent KO return(ResourcesManager.GetPlayer(ResourcesManager.GetAllPlayerIds()[index])); }
public static Level GetRandomPlayerFromAll() { int index = new Random().Next(0, ResourcesManager.GetAllPlayerIds().Count); return(ResourcesManager.GetPlayer(ResourcesManager.GetAllPlayerIds()[index])); }
public static Level GetRandomPlayerFromAll() { int index = ObjectManager.m_vRandomSeed.Next(0, ResourcesManager.GetAllPlayerIds().Count); return(ResourcesManager.GetPlayer(ResourcesManager.GetAllPlayerIds()[index], false)); }