public Server() { Config = new ServerConfiguration(); _users = new List<User>(); }
public static void Configure() { // Using this requires the old mapDif files to be present. Only needed to support Clients < 6.0.0.0 Enabled = ServerConfiguration.GetOrUpdateSetting("maps.enableTileMatrixPatches", !Core.SE); }
public static void Configure() { // Using this requires the old mapDif files to be present. Only needed to support Clients < 6.0.0.0 PatchLandEnabled = ServerConfiguration.GetOrUpdateSetting("maps.enableMapDiffPatches", false); PatchStaticsEnabled = ServerConfiguration.GetOrUpdateSetting("maps.enableStaticsDiffPatches", false); }
public static void Configure() { // Set to true to support < 6.0.0 clients where map0.mul is both Felucca & Trammel var pre6000Trammel = ServerConfiguration.GetOrUpdateSetting("maps.enablePre6000Trammel", false); var failures = new List <string>(); var count = 0; var path = Path.Combine(Core.BaseDirectory, "Data/map-definitions.json"); Console.Write("Map Definitions: Loading..."); var stopwatch = Stopwatch.StartNew(); var maps = JsonConfig.Deserialize <List <MapDefinition> >(path); if (maps == null) { throw new JsonException($"Failed to deserialize {path}."); } foreach (var def in maps) { if (def.Id == 1 && pre6000Trammel) { // Use Old Haven by changing file index to Felucca def.FileIndex = 0; } try { RegisterMap(def); count++; } catch (Exception ex) { #if DEBUG Console.WriteLine(ex); #endif failures.Add($"\tInvalid map definition {def.Name} ({def.Id})"); } } stopwatch.Stop(); Utility.PushColor(failures.Count > 0 ? ConsoleColor.Yellow : ConsoleColor.Green); Console.Write(failures.Count > 0 ? "done with failures" : "done"); Utility.PopColor(); Console.WriteLine( " ({0} maps, {1} failures) ({2:F2} seconds)", count, failures.Count, stopwatch.Elapsed.TotalSeconds ); if (failures.Count > 0) { Utility.PushColor(ConsoleColor.Red); Console.WriteLine(string.Join(Environment.NewLine, failures)); Utility.PopColor(); } }
private static void Main(string[] args) { GCSettings.LatencyMode = GCLatencyMode.SustainedLowLatency; ServerConfiguration config = (ServerConfiguration)ConfigurationManager.GetSection("server"); s_log.Info("Creating repositories..."); UnityContainer repositoryResolver = new UnityContainer(); repositoryResolver.LoadConfiguration(); IAccountRepository accountRepository = repositoryResolver.Resolve <IAccountRepository>(); INPCRepository npcRepository = repositoryResolver.Resolve <INPCRepository>(); IPlayerRepository playerRepository = repositoryResolver.Resolve <IPlayerRepository>(); IAbilityRepository abilityRepository = repositoryResolver.Resolve <IAbilityRepository>(); IServerStatsRepository statsRepository = new NullServerStatsRepository(); try { statsRepository = repositoryResolver.Resolve <IServerStatsRepository>(); } catch { s_log.Warn("Failed to create stats repository. Stats will be disabled."); } s_log.Info("Precaching NPCs..."); var npcs = npcRepository.GetNPCs(); s_log.Info("Precaching NPC Spawns..."); npcRepository.GetNPCSpawns(); s_log.Info("Precaching NPC Behaviours..."); var npcBehaviours = npcRepository.GetNPCBehaviours(); foreach (NPCModel npc in npcs) { npcRepository.GetNPCBehavioursByNPCID(npc.NPCID); } s_log.Info("Precaching NPC Behaviour Vars..."); npcRepository.GetNPCBehaviourVars(); foreach (NPCBehaviourModel npcBehaviour in npcBehaviours) { npcRepository.GetNPCBehaviourVarsByNPCBehaviourID(npcBehaviour.NPCBehaviourID); } s_log.Info("Precaching NPC Stats..."); npcRepository.GetNPCStats(); foreach (NPCModel npc in npcs) { npcRepository.GetNPCStatsByNPCID(npc.NPCID); } s_log.Info("Precaching abilities..."); abilityRepository.GetAbilities(); s_log.Info("Initialising serializer..."); ProtocolUtility.InitialiseSerializer(); s_log.Info("Creating world..."); using (World world = new World(accountRepository, npcRepository, playerRepository, statsRepository, abilityRepository)) { TcpListener listener = new TcpListener(IPAddress.Any, config.Port); listener.Start(); s_log.Info("Listening for connections on " + listener.LocalEndpoint.ToString()); while (true) { Socket socket = listener.AcceptSocket(); world.AcceptSocket(socket); } } }
public static void Configure() { ForceOldAnimations = ServerConfiguration.GetSetting("expansion.forceOldAnimations", false); }
public static void Configure() { Enabled = ServerConfiguration.GetOrUpdateSetting("pathfinding.enable", true); }
public static void Configure() { PatchLandEnabled = ServerConfiguration.GetOrUpdateSetting("maps.enableMapDiffPatches", !Core.HS); PatchStaticsEnabled = ServerConfiguration.GetOrUpdateSetting("maps.enableStaticsDiffPatches", true); }