public void ValidateAndFillDetails() { if (IsNullOrEmpty(Title)) { Title = $"{FounderName}'s game"; } if (IsNullOrEmpty(EngineVersion) || (Mode != AutohostMode.None)) { EngineVersion = server.Engine; } server.Downloader.GetResource(DownloadType.ENGINE, server.Engine); switch (Mode) { case AutohostMode.Game1v1: MaxPlayers = 2; break; case AutohostMode.Planetwars: if (MaxPlayers < 2) { MaxPlayers = 16; } break; case AutohostMode.GameChickens: if (MaxPlayers < 2) { MaxPlayers = 10; } break; case AutohostMode.GameFFA: if (MaxPlayers < 3) { MaxPlayers = 16; } break; case AutohostMode.Teams: if (MaxPlayers < 4) { MaxPlayers = 16; } break; case AutohostMode.None: if (MaxPlayers == 0) { MaxPlayers = 16; } break; } if (MaxPlayers > 32) { MaxPlayers = 32; } HostedMod = MapPicker.FindResources(ResourceType.Mod, ModName ?? server.Game ?? GlobalConst.DefaultZkTag).FirstOrDefault(); HostedMap = MapName != null ? MapPicker.FindResources(ResourceType.Map, MapName).FirstOrDefault() : MapPicker.GetRecommendedMap(GetContext()); ModName = HostedMod?.InternalName ?? ModName ?? server.Game ?? GlobalConst.DefaultZkTag; MapName = HostedMap?.InternalName ?? MapName ?? "Small_Divide-Remake-v04"; if (HostedMod != null) { try { HostedModInfo = MetaDataCache.ServerGetMod(HostedMod.InternalName); } catch (Exception ex) { Trace.TraceWarning("Error loading mod metadata for {0} : {1}", HostedMod.InternalName, ex); } } }